/* 研修ナビ（不穏な経理クイズ）
   はじめは明るいクイズアプリの見た目。body の lv0〜lv3 に合わせて、色がぬけて、暗く、ざらついていく */

:root {
  --bg: #fff4e4;
  --paper: #ffffff;
  --ink: #3b3634;
  --sub: #8a7f76;
  --line: #f0dfc6;
  --accent: #ff8a3d;
  --mint: #2ec4b6;
  --ok: #f0473b;
  --ng: #2f6fd6;
  --sat: 1;
  --vig: 0;
  --scan: 0;
  --round: 'M PLUS Rounded 1c', 'Hiragino Maru Gothic ProN', sans-serif;
  --mincho: 'Zen Old Mincho', 'Yu Mincho', serif;
}

body.lv1 { --bg: #f5ede1; --sat: 0.88; --vig: 0.12; }
body.lv2 { --bg: #e7e1d8; --line: #ddd3c6; --sat: 0.62; --vig: 0.3; --scan: 0.05; }
body.lv3 { --bg: #cbc5bd; --paper: #f4f1ec; --line: #c3bbb1; --sub: #6f6862; --sat: 0.38; --vig: 0.55; --scan: 0.09; }
body.lv4 { --bg: #24211e; --paper: #d8d2c8; --ink: #1d1a17; --line: #6a635a; --sub: #4c463f; --on-bg: #b9b2a7; --sat: 0.25; --vig: 0.72; --scan: 0.12; }
body.snap, body.snap .app, body.snap .judge, body.snap .vignette { transition: none !important; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--round);
  font-weight: 500;
  transition: background-color 4s ease, color 4s ease;
}
button { font: inherit; color: inherit; }

/* 画面の上にかぶせる、ざらつき・暗いふち・走査線 */
.noise {
  position: fixed; inset: 0; width: 100%; height: 100%;
  z-index: 50; pointer-events: none; opacity: 0;
  image-rendering: pixelated;
}
.vignette {
  position: fixed; inset: 0; z-index: 49; pointer-events: none;
  background:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, var(--scan)) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, transparent 50%, rgba(20, 16, 14, var(--vig)) 100%);
  transition: background 4s ease;
}

.app, .judge { filter: saturate(var(--sat)); transition: filter 4s ease; }
.app { max-width: 480px; margin: 0 auto; padding: 0 16px 40px; }

/* 上のバー */
.bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 0 10px; }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 800; font-size: 17px; color: var(--on-bg, var(--ink)); }
.brand__logo {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px;
  background: var(--accent); color: #fff; font-size: 16px;
}
.tools { display: flex; gap: 6px; }
.tool {
  padding: 5px 10px; border: 1.5px solid var(--line); border-radius: 999px; background: var(--paper);
  font-size: 12px; font-weight: 800; color: var(--sub); cursor: pointer;
}

.screen { display: none; }
.screen.is-active { display: block; animation: rise 0.35s ease-out; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

/* タイトル */
#title { padding-top: 28px; text-align: center; }
.title__tag {
  display: inline-block; margin: 0 0 10px; padding: 5px 16px; border-radius: 999px;
  background: #ffe3cc; color: #c4561a; font-weight: 800; font-size: 14px;
}
.title__name { margin: 0; font-weight: 800; font-size: 46px; letter-spacing: 0.04em; }
.title__lead { margin: 14px 0 18px; line-height: 1.8; }
.title__info { display: flex; justify-content: center; gap: 8px; margin: 0 0 26px; padding: 0; list-style: none; }
.title__info li { padding: 6px 12px; border-radius: 12px; background: var(--paper); border: 1.5px solid var(--line); font-size: 13px; font-weight: 800; }
.title__note { margin: 14px 0 0; font-size: 12px; line-height: 1.7; color: var(--sub); text-align: left; }
.title__author { margin: 14px 0 6px; font-size: 13px; font-weight: 800; color: var(--sub); }
.title__site { margin: 18px 0 0; font-size: 12px; color: var(--sub); }
.title__site a { color: inherit; }

/* 広告の枠（タイトル画面だけ）。広告が入るまでは場所を取らない。
   枠ごと display:none にすると広告を読みこめなくなるので、高さだけ 0 にしておく */
.ad-slot { margin: 0 auto; text-align: center; }
.ad-slot ins { display: block; width: 100%; }
.ad-slot ins:not([data-ad-status='filled']) { height: 0 !important; min-height: 0 !important; overflow: hidden; }
.ad-slot:empty { display: none; }
/* 誤クリックをふせぐため、ボタンから150pxほど離す */
.ad-slot:has(ins[data-ad-status='filled']) { margin-top: 90px; }
.ad-slot:has(ins[data-ad-status='filled'])::before {
  content: 'スポンサーリンク'; display: block; margin-bottom: 6px; font-size: 11px; font-weight: 800; letter-spacing: 0.08em; color: var(--sub);
}

.btn {
  display: inline-block; min-width: 200px; padding: 14px 28px; border: 0; border-radius: 999px;
  background: var(--accent); color: #fff; font-weight: 800; font-size: 17px; cursor: pointer;
  box-shadow: 0 5px 0 #d9681f;
}
.btn:active { transform: translateY(3px); box-shadow: 0 2px 0 #d9681f; }
.btn--start { font-size: 20px; padding: 16px 36px; }

/* 研修担当のひとこと */
.host {
  position: relative; margin: 6px 0 14px; padding: 12px 14px 12px; border-radius: 16px;
  background: var(--paper); border: 1.5px solid var(--line);
}
.host.is-empty { visibility: hidden; }
.host__label {
  display: inline-block; margin-bottom: 4px; padding: 2px 10px; border-radius: 999px;
  background: var(--mint); color: #fff; font-size: 11px; font-weight: 800;
}
.host__text { margin: 0; font-size: 14px; line-height: 1.6; }
.lv3 .host__label { background: #8d8780; }
.host.is-system .host__label { background: #55504a; border-radius: 4px; }
.host.is-system .host__text { font-size: 13px; color: var(--sub); }
.lv3 .host__text { letter-spacing: 0.08em; }

/* 何問目か */
.progress { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.progress__no { white-space: nowrap; font-size: 14px; color: var(--on-bg, var(--sub)); }
.progress__no b { font-size: 20px; color: var(--on-bg, var(--ink)); }
.lv4 .brand__logo, .lv4 .progress__bar { background: #6d655c; }
.progress__track { flex: 1; height: 10px; border-radius: 999px; background: var(--line); overflow: hidden; }
.progress__bar { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--accent); transition: width 0.5s ease; }

/* 問題のカード */
.card {
  min-height: 150px; padding: 22px 20px; border-radius: 22px; background: var(--paper);
  box-shadow: 0 6px 0 var(--line); display: grid; align-content: center;
}
.card.in { animation: pop 0.3s ease-out; }
@keyframes pop { from { transform: scale(0.96); opacity: 0.4; } }
.card__text { margin: 0; font-weight: 800; font-size: 20px; line-height: 1.65; }
.card.is-fake .card__text { font-family: var(--mincho); color: #5e1717; letter-spacing: 0.14em; font-size: 22px; text-align: center; }
.lv3 .card { box-shadow: none; border: 1px solid var(--line); }

/* 給与台帳など */
.ledger { width: 100%; margin-top: 14px; border-collapse: collapse; font-size: 14px; }
.ledger caption { text-align: left; font-size: 12px; color: var(--sub); padding-bottom: 4px; }
.ledger th, .ledger td { border: 1px solid var(--line); padding: 6px 8px; text-align: left; }
.ledger th { background: #faf3ea; font-size: 12px; color: var(--sub); }
.ledger tr.blank td { background: #f1ece6; }
.ledger td:first-child { width: 1%; padding: 6px 10px; white-space: nowrap; text-align: center; }

/* 選択肢 */
.choices { display: grid; gap: 10px; margin-top: 18px; }
.choice {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 16px; text-align: left;
  border: 2px solid var(--line); border-radius: 16px; background: var(--paper);
  font-weight: 800; font-size: 17px; cursor: pointer; transition: transform 0.08s, border-color 0.2s;
}
.choice:hover:not(:disabled) { border-color: var(--accent); }
.choice:active:not(:disabled) { transform: scale(0.98); }
.choice:disabled { cursor: default; opacity: 0.55; }
.choice.is-picked { opacity: 1; border-color: var(--accent); background: #fff1e4; }
.choice__key {
  display: grid; place-items: center; flex: none; width: 32px; height: 32px; border-radius: 10px;
  color: #fff; font-size: 15px;
}
.choice:nth-child(1) .choice__key { background: #ff8a3d; }
.choice:nth-child(2) .choice__key { background: #2ec4b6; }
.choice:nth-child(3) .choice__key { background: #f2b705; }
.choice:nth-child(4) .choice__key { background: #ef6f9b; }
.choices--ox { grid-template-columns: 1fr 1fr; }
.choices--ox .choice { justify-content: center; padding: 18px 0; }
.choice__ox { font-size: 54px; line-height: 1; }
.choices--ox .choice:nth-child(1) .choice__ox { color: var(--ok); }
.choices--ox .choice:nth-child(2) .choice__ox { color: var(--ng); }

/* 〇×の判定 */
.judge {
  position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 16px;
  background: rgba(255, 244, 228, 0.86);
}
.lv2 .judge { background: rgba(231, 225, 216, 0.88); }
.lv3 .judge { background: rgba(203, 197, 189, 0.9); }
.lv4 .judge { background: rgba(36, 33, 30, 0.9); }
/* 答えに関係なく出る、システムのエラーふうの判定 */
.judge.is-system .judge__box { border-radius: 6px; box-shadow: none; border: 1px solid var(--line); }
.judge.is-system .judge__word { color: #8b1d1d; font-size: 22px; }
.judge__mark.is-none { display: none; }
.judge[hidden] { display: none; }
.judge.in .judge__box { animation: pop 0.25s ease-out; }
.judge__box {
  width: min(420px, 100%); padding: 24px 22px 26px; border-radius: 24px; background: var(--paper);
  text-align: center; box-shadow: 0 8px 0 var(--line);
}
.judge__mark { width: 140px; height: 140px; margin: 0 auto 4px; }
.judge__mark svg { width: 100%; height: 100%; }
.draw { fill: none; stroke-width: 11; stroke-linecap: round; stroke-dasharray: 100; stroke-dashoffset: 100; animation: draw 0.35s ease-out forwards; }
.draw--2 { animation-delay: 0.15s; }
.is-ok .draw { stroke: var(--ok); }
.is-ng .draw { stroke: var(--ng); }
@keyframes draw { to { stroke-dashoffset: 0; } }
/* 不穏になると、〇が閉じきらない */
.lv3 .is-ok .draw { animation-name: draw-open; animation-duration: 0.9s; }
@keyframes draw-open { to { stroke-dashoffset: 8; } }
.judge__word { margin: 0; font-weight: 800; font-size: 30px; }
.is-ok + .judge__word { color: var(--ok); }
.is-ng + .judge__word { color: var(--ng); }
.judge__note { margin: 10px 0 20px; line-height: 1.75; font-size: 15px; }

/* 明朝体で出る、不穏な文 */
.mincho, .flick { font-family: var(--mincho); font-weight: 700; color: #6b1a1a; letter-spacing: 0.08em; }
.flick { display: inline-block; margin-left: 0.3em; }
.flick.gone { display: none; }

/* ザザッと乱れる */
.glitch {
  animation: glitch 0.1s steps(2) infinite;
  text-shadow: 2px 0 rgba(255, 0, 70, 0.5), -2px 0 rgba(0, 190, 255, 0.5);
}
@keyframes glitch {
  0% { transform: translate(0, 0); clip-path: inset(0 0 0 0); }
  25% { transform: translate(-3px, 1px); clip-path: inset(6% 0 12% 0); }
  50% { transform: translate(3px, -1px); clip-path: inset(18% 0 4% 0); }
  75% { transform: translate(-2px, 0); clip-path: inset(0 0 16% 0); }
  100% { transform: translate(0, 0); clip-path: inset(0 0 0 0); }
}
.fade-swap { opacity: 0.25; transition: opacity 0.2s; }

/* 選択肢の下に出る、小さな声 */
.whisper { min-height: 1.6em; margin: 14px 0 0; text-align: center; font-size: 16px; }

/* 最後の問題：振込の確認画面と、実行のボタン */
.transfer { margin-top: 14px; border: 1.5px solid #8e8a84; border-radius: 8px; background: #fbfaf8; overflow: hidden; font-size: 14px; }
.transfer__head { margin: 0; padding: 7px 12px; background: #5d5a55; color: #fff; font-weight: 800; font-size: 13px; }
.transfer__list { margin: 0; padding: 6px 12px; }
.transfer__list div { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px dashed #d4cfc8; }
.transfer__list div:last-child { border-bottom: 0; }
.transfer__list dt { color: #77716a; font-size: 12px; }
.transfer__list dd { margin: 0; font-weight: 800; }
.transfer__status { margin: 0; padding: 8px 12px; text-align: center; font-weight: 800; color: #8e8a84; background: #efece7; }
.transfer__status.is-done { color: #fff; background: #8b1d1d; animation: stamp-in 0.3s ease-out; }
.transfer__status small { display: block; font-size: 11px; font-weight: 500; opacity: 0.85; }
@keyframes stamp-in { from { transform: scale(1.08); } }
.choices--transfer { grid-template-columns: 1fr 1fr; }
.choices--transfer .choice { justify-content: center; padding: 18px 0; font-size: 17px; }
.choices--transfer .choice:nth-child(1) { background: #fff1e4; border-color: #d97a4a; }
.choice.is-fading { opacity: 0.5; filter: blur(0.4px); }
.choice.is-turned { opacity: 1; background: #fff1e4; border-color: #d97a4a; }

/* 振込のあと：来年の給与台帳（まっくらな画面） */
body.is-chosen { background: #0e0d0c; transition: none; }
body.is-chosen .bar { visibility: hidden; }
#chosen { padding-top: 60px; text-align: center; }
.ledger--dark { color: #cfc8bd; font-size: 15px; }
.ledger--dark caption { color: #8f877c; font-size: 13px; padding-bottom: 8px; }
.ledger--dark th, .ledger--dark td { border-color: #39352f; }
.ledger--dark th { background: #1a1816; color: #8f877c; }
.ledger--dark tr.six td { background: #2a1513; color: #f1dcd6; }
.ledger--dark #chosenName { font-size: 18px; letter-spacing: 0.1em; }
.chosen__line { margin: 46px 0 0; min-height: 1.6em; font-size: clamp(16px, 5vw, 21px); letter-spacing: 0.04em; text-wrap: balance; color: #eadfd2; opacity: 0; }
.chosen__line.is-on { opacity: 1; }
/* 主人公がいなくなる暗転 */
.blackout { position: fixed; inset: 0; z-index: 60; background: #000; opacity: 0; pointer-events: none; transition: opacity 0.6s ease; }
body.is-blackout .blackout { opacity: 1; }
.title__wait { min-height: 1.4em; margin: 4px 0 0; font-size: 14px; }

/* 名前を入れる画面 */
#entry { padding-top: 10px; }
.entry { margin-top: 8px; padding: 24px 20px 22px; border-radius: 22px; background: var(--paper); box-shadow: 0 6px 0 var(--line); text-align: center; }
.entry__label { display: block; margin-bottom: 10px; font-weight: 800; font-size: 15px; }
.entry__input {
  width: 100%; padding: 14px 16px; border: 2px solid var(--line); border-radius: 14px; background: #fffaf3;
  font: inherit; font-weight: 800; font-size: 20px; text-align: center; color: var(--ink);
}
.entry__input:focus { outline: none; border-color: var(--accent); }
.entry__error { min-height: 1.4em; margin: 8px 0 10px; font-size: 13px; color: #c43d2f; }
.entry__note { margin: 14px 0 0; font-size: 12px; color: var(--sub); line-height: 1.6; }

@media (prefers-reduced-motion: reduce) {
  .glitch { animation: none; }
  .card.in, .judge.in .judge__box, .screen.is-active { animation: none; }
}
