/* VIVANT 別班採用試験（非公式） v2
   原則：要素の既定状態は「見える」。演出は .anim 系クラスを付けたときだけ足し、JSのタイマーで必ず外す。 */
:root {
  --void: #05070b;
  --deep: #0a1220;
  --panel: rgba(14, 25, 46, 0.9);
  --line: rgba(130, 175, 235, 0.3);
  --line-strong: rgba(140, 185, 245, 0.6);
  --signal: #3b8cff;
  --glow: #7cbcff;
  --red: #d8232c;
  --red-text: #ff6b70;
  --paper: #f1ece0;
  --sand: #cfc5b0;
  --sand-dim: #a99f8b;

  /* ボタン（押せるもの）専用の色。パネルは平らな枠、ボタンは塗り＋明るい縁＋下側の厚み */
  --btn-pri: #1f66d6;
  --btn-pri-hover: #2470e0;
  --btn-pri-edge: #9cc8ff;
  --btn-pri-depth: #0a2a63;
  --btn-sec: #17305a;
  --btn-sec-hover: #1f3e73;
  --btn-sec-edge: #8fbfff;
  --btn-sec-text: #f3f7ff;
  --btn-ter: #101b30;
  --btn-ter-hover: #182742;
  --btn-ter-edge: #7f9cc6;
  --btn-ter-text: #dde5f2;
  --btn-depth: #050b16;
  --focus: #ffffff;

  --f-display: "Shippori Mincho B1", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --f-body: "Zen Kaku Gothic New", "Hiragino Sans", "Yu Gothic", system-ui, sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;

  --gutter: 16px;
  --maxw: 1200px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--void);
  background-image: radial-gradient(ellipse 80% 55% at 50% 38%, #0c1a33 0%, rgba(5, 7, 11, 0) 70%);
  color: var(--paper);
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.75;
  overflow-x: hidden;
}
[hidden] { display: none !important; }
.mono { font-family: var(--f-mono); letter-spacing: 0.04em; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
a { color: var(--glow); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; box-shadow: 0 0 0 6px rgba(59, 140, 255, 0.55); }
.noscript { position: relative; z-index: 3; max-width: 640px; margin: 24px auto; padding: 16px; border: 1px solid var(--red); color: var(--paper); }

/* ── 背景の層 ── */
#field { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; }
.vignette {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background:
    repeating-linear-gradient(to bottom, rgba(255,255,255,0.022) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse 75% 70% at 50% 45%, transparent 50%, rgba(0,0,0,0.7) 100%);
}
.grain {
  position: fixed; inset: -50%; z-index: 1; pointer-events: none; opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0.9 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  animation: grain 0.9s steps(5) infinite;
}
@keyframes grain {
  20% { transform: translate(-3%, 2%); } 40% { transform: translate(2%, -4%); }
  60% { transform: translate(-4%, -1%); } 80% { transform: translate(3%, 3%); }
}
.flash { position: fixed; inset: 0; z-index: 4; pointer-events: none; opacity: 0; }
.flash.is-blue { background: radial-gradient(ellipse at 50% 45%, rgba(59, 140, 255, 0.35), transparent 65%); animation: flash 0.6s ease-out forwards; }
.flash.is-red { background: radial-gradient(ellipse at 50% 45%, rgba(216, 35, 44, 0.35), rgba(216, 35, 44, 0.08) 70%); animation: flash 0.55s ease-out forwards; }
@keyframes flash { 0% { opacity: 1; } 100% { opacity: 0; } }

/* ── HUD ── */
.hud {
  position: sticky; top: 0; z-index: 6;
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 4px var(--gutter);
  font-family: var(--f-mono); font-size: 13px; letter-spacing: 0.04em; color: var(--sand);
  background: linear-gradient(to bottom, rgba(5,7,11,0.94), rgba(5,7,11,0.66));
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(4px);
}
.hud__l { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.hud__r { display: flex; align-items: center; gap: 4px; white-space: nowrap; flex: none; }
.hud__dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--red); margin-right: 8px; vertical-align: 1px; box-shadow: 0 0 8px var(--red); animation: blink 1.6s steps(2) infinite; }
.hud__sep { color: var(--sand-dim); margin: 0 6px; }
@keyframes blink { 50% { opacity: 0.25; } }
.sound-btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; min-width: 44px; margin: 4px 0 7px 10px; padding: 0 12px;
  font: inherit; font-family: var(--f-body); font-size: 14px; font-weight: 700; letter-spacing: 0.04em; color: var(--btn-ter-text);
  background: var(--btn-ter); border: 1.5px solid var(--btn-ter-edge); border-radius: 4px; cursor: pointer;
  box-shadow: 0 3px 0 var(--btn-depth), inset 0 1px 0 rgba(255,255,255,0.08);
  transition: background 0.15s, border-color 0.15s, transform 0.1s, box-shadow 0.1s;
}
.sound-btn:hover { background: var(--btn-ter-hover); border-color: var(--btn-sec-edge); color: #fff; }
.sound-btn:active { transform: translateY(3px); box-shadow: 0 0 0 var(--btn-depth); }
.sound-btn__icon { width: 14px; height: 10px; display: inline-block; background:
  linear-gradient(var(--sand-dim), var(--sand-dim)) 0 6px / 2px 4px no-repeat,
  linear-gradient(var(--sand-dim), var(--sand-dim)) 4px 3px / 2px 7px no-repeat,
  linear-gradient(var(--sand-dim), var(--sand-dim)) 8px 0 / 2px 10px no-repeat,
  linear-gradient(var(--sand-dim), var(--sand-dim)) 12px 4px / 2px 6px no-repeat; }
.sound-btn[aria-pressed="true"] { color: var(--btn-sec-text); background: var(--btn-sec); border-color: var(--btn-sec-edge); }
.sound-btn[aria-pressed="true"] .sound-btn__icon { filter: drop-shadow(0 0 3px var(--glow)); background:
  linear-gradient(var(--glow), var(--glow)) 0 6px / 2px 4px no-repeat,
  linear-gradient(var(--glow), var(--glow)) 4px 3px / 2px 7px no-repeat,
  linear-gradient(var(--glow), var(--glow)) 8px 0 / 2px 10px no-repeat,
  linear-gradient(var(--glow), var(--glow)) 12px 4px / 2px 6px no-repeat; }
@media (max-width: 760px) { .hud__coord { display: none; } }
@media (max-width: 400px) { .hud__clock { display: none; } }

/* ── 起動演出（JSが生成・必ずタイマーで消える） ── */
.boot {
  position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center;
  background: rgba(3, 5, 9, 0.97); cursor: pointer;
}
.boot.is-out { opacity: 0; transition: opacity 0.28s ease; }
.boot__box { width: min(520px, calc(100% - 32px)); font-family: var(--f-mono); font-size: 13px; line-height: 1.9; color: var(--sand); }
.boot__line { margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.boot__line b { color: var(--glow); font-weight: 400; }
.boot__line.is-red b { color: var(--red-text); }
.boot__bar { margin-top: 14px; height: 2px; background: var(--line); overflow: hidden; }
.boot__bar i { display: block; height: 100%; width: 0; background: var(--glow); box-shadow: 0 0 10px var(--glow); transition: width 0.25s linear; }
.boot__skip { margin-top: 14px; font-size: 13px; color: var(--sand); letter-spacing: 0.1em; }

/* ── レイアウト ── */
main { position: relative; z-index: 2; max-width: var(--maxw); margin: 0 auto; padding: 28px var(--gutter) 48px; }
.screen.anim-in { animation: screenIn 0.5s ease; }
@keyframes screenIn { from { opacity: 0.35; transform: translateY(10px); } }

/* ── 機密文書の枠 ── */
.dossier {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 22px 22px 24px;
  box-shadow: 0 0 0 1px rgba(5,7,11,0.6), 0 24px 60px -30px rgba(0,0,0,0.9), inset 0 0 40px -20px rgba(59, 140, 255, 0.25);
  backdrop-filter: blur(3px);
}
.dossier::before {
  content: ""; position: absolute; left: 10px; right: 10px; top: -1px; height: 5px;
  background: repeating-linear-gradient(to right, var(--line-strong) 0 1px, transparent 1px 12px);
  pointer-events: none;
}
.corner { position: absolute; width: 14px; height: 14px; border-color: var(--glow); border-style: solid; border-width: 0; opacity: 0.85; filter: drop-shadow(0 0 4px rgba(111, 182, 255, 0.7)); }
.corner.tl { top: -1px; left: -1px; border-top-width: 2px; border-left-width: 2px; }
.corner.tr { top: -1px; right: -1px; border-top-width: 2px; border-right-width: 2px; }
.corner.bl { bottom: -1px; left: -1px; border-bottom-width: 2px; border-left-width: 2px; }
.corner.br { bottom: -1px; right: -1px; border-bottom-width: 2px; border-right-width: 2px; }
.meta-row {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 16px;
  font-family: var(--f-mono); font-size: 13px; letter-spacing: 0.04em; color: var(--sand);
  padding-bottom: 10px; margin-bottom: 18px;
  border-bottom: 1px dashed var(--line);
}
.eyebrow { margin: 0 0 6px; font-family: var(--f-mono); font-size: 13px; letter-spacing: 0.16em; color: var(--glow); }

/* ── トップ ── */
.hero { display: grid; gap: 18px; }
.hero__text { padding-top: 26px; padding-bottom: 28px; }
.title { margin: 0; font-family: var(--f-display); font-weight: 800; line-height: 1.08; }
.title__main {
  display: block;
  font-size: clamp(44px, 12vw, 96px);
  letter-spacing: 0.06em;
  color: var(--paper);
  text-shadow: 0 0 28px rgba(80, 150, 255, 0.35), 0 2px 0 rgba(0,0,0,0.6);
}
.title__br { display: none; }
.title__sub { display: block; margin-top: 12px; font-size: clamp(15px, 3.8vw, 19px); font-weight: 500; letter-spacing: 0.2em; color: var(--sand); }
.lead { margin: 22px 0 0; max-width: 34em; font-size: 16.5px; line-height: 1.85; }
.rules { list-style: none; margin: 22px 0 0; padding: 0; display: grid; gap: 8px; font-size: 15px; color: var(--paper); }
.rules li { display: flex; gap: 12px; align-items: baseline; }
.rules__k { flex: none; font-size: 13px; font-weight: 700; letter-spacing: 0.06em; color: var(--glow); border: 1px solid var(--line-strong); padding: 0 7px; line-height: 1.7; }

.hero__stamp {
  display: inline-block; align-self: flex-start; margin: 0 0 14px 2px; transform: rotate(-8deg);
  border: 3px double var(--red); color: var(--red); white-space: nowrap;
  padding: 2px 10px 4px 14px;
  font-family: var(--f-display); font-weight: 800; font-size: 20px; letter-spacing: 0.3em;
  opacity: 0.9;
  -webkit-mask-image: radial-gradient(circle at 30% 40%, #000 55%, rgba(0,0,0,0.55) 70%, #000 85%);
          mask-image: radial-gradient(circle at 30% 40%, #000 55%, rgba(0,0,0,0.55) 70%, #000 85%);
}

.hero__map { margin: 0; padding: 12px 12px 10px; }
.map-frame { position: relative; aspect-ratio: 4 / 3; border: 1px solid var(--line); background: #040811; overflow: hidden; }
#opmap { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.map-hud { position: absolute; font-size: 13px; letter-spacing: 0.08em; color: var(--sand); padding: 6px 8px; pointer-events: none; text-shadow: 0 0 6px #000; }
.map-hud--tl { top: 0; left: 0; color: var(--glow); }
.map-hud--tr { top: 0; right: 0; }
.map-hud--bl { bottom: 0; left: 0; }
.map-hud--br { bottom: 0; right: 0; color: var(--red-text); }
.map-cap { margin-top: 8px; font-size: 13px; color: var(--sand); text-align: right; }

.section-label {
  display: flex; align-items: center; gap: 12px;
  margin: 40px 0 16px; font-family: var(--f-display); font-weight: 800; font-size: 23px; letter-spacing: 0.06em;
}
.section-label .mono { font-family: var(--f-body); font-size: 14px; letter-spacing: 0.04em; color: var(--sand); font-weight: 500; white-space: nowrap; }
.section-label__rule { flex: 1; height: 1px; background: linear-gradient(to right, var(--line-strong), transparent); }

/* ファイルカード（カード全体がボタン。下部の塗りの帯で「押せる」ことを示す） */
.file-grid { display: grid; grid-template-columns: 1fr; gap: 16px; }
.file-card {
  --accent: var(--glow);
  position: relative; display: flex; flex-direction: column;
  width: 100%; min-height: 44px; text-align: left; cursor: pointer; overflow: hidden;
  padding: 0;
  background: linear-gradient(165deg, #142645, #0c1629);
  border: 1.5px solid var(--btn-sec-edge); border-radius: 6px; color: var(--paper); font: inherit;
  box-shadow: 0 5px 0 var(--btn-depth), inset 0 1px 0 rgba(255,255,255,0.08);
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
  perspective: 900px;
}
.file-card__cover {
  position: relative; display: flex; align-items: center; gap: 14px;
  padding: 16px 18px 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(59, 140, 255, 0.12), transparent);
  transform-origin: top center; transition: transform 0.3s ease, background 0.2s;
}
.emblem { flex: none; width: 60px; height: 60px; color: var(--accent); filter: drop-shadow(0 0 6px rgba(111, 182, 255, 0.35)); transition: filter 0.2s, transform 0.3s; }
.emblem .accent { color: var(--red); }
.emblem svg { width: 100%; height: 100%; display: block; overflow: visible; }
.file-card__id { min-width: 0; }
.file-card__code { display: block; font-family: var(--f-mono); font-size: 13px; letter-spacing: 0.1em; color: var(--accent); }
.file-card__title { display: block; font-family: var(--f-display); font-weight: 800; font-size: 27px; line-height: 1.25; letter-spacing: 0.03em; color: #fff; }
.file-card__sub { display: block; font-size: 14px; color: var(--sand); line-height: 1.5; }
.file-card__body { display: flex; flex-direction: column; gap: 12px; padding: 14px 18px 16px; flex: 1; }
.file-card__count { display: flex; align-items: baseline; gap: 8px; font-size: 14px; color: var(--sand); }
.file-card__count strong { font-size: 20px; font-weight: 700; color: #fff; }
.file-card__note {
  display: flex; gap: 8px; align-items: flex-start;
  font-size: 14px; line-height: 1.6; color: var(--paper);
  padding: 8px 10px; border-left: 3px solid var(--red); background: rgba(216, 35, 44, 0.12);
}
.file-card__note b { flex: none; color: var(--red-text); font-size: 13px; font-weight: 700; padding-top: 1px; }
.meter { display: grid; gap: 6px; }
.meter__head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 2px 8px; font-size: 14px; color: var(--sand); }
.meter__head strong { color: #fff; font-weight: 700; font-size: 15px; }
.lvbar { display: flex; height: 8px; gap: 2px; }
.lvbar i { display: block; height: 100%; }
.lvbar .l1 { background: rgba(124, 188, 255, 0.4); }
.lvbar .l2 { background: rgba(124, 188, 255, 0.7); }
.lvbar .l3 { background: var(--glow); box-shadow: 0 0 6px rgba(111, 182, 255, 0.6); }
.lvlegend { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 13px; color: var(--sand); }
.lvlegend__st { color: var(--glow); letter-spacing: 0.02em; }
.bestbar { position: relative; height: 8px; background: repeating-linear-gradient(to right, rgba(170, 200, 255, 0.18) 0 calc(10% - 1px), transparent calc(10% - 1px) 10%); border: 1px solid var(--line); }
.bestbar i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(to right, #7a1015, var(--red)); box-shadow: 0 0 8px rgba(216, 35, 44, 0.6); }
.file-card__go {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 54px; padding: 0 18px; margin-top: auto;
  background: var(--btn-pri); border-top: 1.5px solid var(--btn-pri-edge);
  color: #fff; font-size: 17px; font-weight: 700; letter-spacing: 0.05em;
  transition: background 0.15s;
}
.file-card__go-ic { font-size: 18px; transition: transform 0.15s; }
.file-card:hover, .file-card:focus-visible { border-color: #c4dfff; transform: translateY(-2px); box-shadow: 0 7px 0 var(--btn-depth), 0 18px 40px -18px rgba(59, 140, 255, 0.6); }
.file-card:hover .file-card__go, .file-card:focus-visible .file-card__go { background: var(--btn-pri-hover); }
.file-card:hover .file-card__go-ic, .file-card:focus-visible .file-card__go-ic { transform: translateX(4px); }
.file-card:hover .file-card__cover, .file-card:focus-visible .file-card__cover { transform: rotateX(8deg) translateY(-1px); background: linear-gradient(180deg, rgba(59, 140, 255, 0.22), transparent); }
.file-card:hover .emblem, .file-card:focus-visible .emblem { filter: drop-shadow(0 0 12px rgba(111, 182, 255, 0.8)); transform: scale(1.06); }
.file-card:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--btn-depth); }
.file-card--all { --accent: var(--red-text); }
.file-card--all .emblem { filter: drop-shadow(0 0 6px rgba(216, 35, 44, 0.45)); }

/* ── 出題 ── */
.quiz-layout { display: grid; gap: 14px; }
.quiz-main { min-width: 0; }
.quiz-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.quiz-head__file { display: flex; align-items: center; gap: 10px; min-width: 0; }
.tag { flex: none; font-size: 13px; letter-spacing: 0.08em; color: var(--glow); border: 1px solid var(--line-strong); padding: 2px 7px; }
.quiz-head__title { font-family: var(--f-display); font-weight: 800; font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quiz-head__count { flex: none; font-size: 24px; }
.quiz-head__count .slash { color: var(--sand); margin: 0 4px; }
.quiz-head__count #qTotal { color: var(--sand); font-size: 17px; }

/* 計器パネル（スマホは問題の上にコンパクト表示） */
.panel {
  order: -1; position: relative;
  display: grid; grid-template-columns: 84px 1fr; grid-template-areas: "gauge stats" "manju manju"; gap: 10px 14px; align-items: center;
  padding: 12px; background: var(--panel); border: 1px solid var(--line-strong);
}
.panel__head { display: none; }
.gauge { grid-area: gauge; position: relative; width: 92px; height: 92px; }
.gauge__svg { width: 100%; height: 100%; transform: rotate(-90deg); overflow: visible; }
.gauge__track { fill: none; stroke: rgba(120, 170, 240, 0.16); stroke-width: 6; }
.gauge__arc { fill: none; stroke: var(--signal); stroke-width: 6; stroke-linecap: butt; filter: drop-shadow(0 0 4px rgba(59, 140, 255, 0.8)); transition: stroke 0.3s; }
.gauge__tick { stroke: rgba(170, 200, 255, 0.35); stroke-width: 1; }
.gauge__tick.is-major { stroke: rgba(170, 200, 255, 0.7); stroke-width: 1.5; }
.gauge__read { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.1; }
.gauge__read #timerSec { font-size: 22px; color: #fff; }
.gauge__unit { font-size: 13px; color: var(--sand); margin-top: 2px; }
.panel.is-tense .gauge__arc { stroke: var(--red); filter: drop-shadow(0 0 6px rgba(216, 35, 44, 0.9)); }
.panel.is-tense .gauge__read #timerSec { color: var(--red-text); }
.panel.is-tense { animation: pulse 1s ease-in-out infinite; border-color: rgba(216, 35, 44, 0.6); }
@keyframes pulse { 0%, 100% { box-shadow: inset 0 0 30px -18px rgba(216, 35, 44, 0.5), 0 0 0 0 rgba(216, 35, 44, 0); } 15% { box-shadow: inset 0 0 36px -12px rgba(216, 35, 44, 0.8), 0 0 0 5px rgba(216, 35, 44, 0.25); } 30% { box-shadow: inset 0 0 30px -18px rgba(216, 35, 44, 0.5), 0 0 0 0 rgba(216, 35, 44, 0); } 45% { box-shadow: inset 0 0 34px -14px rgba(216, 35, 44, 0.7), 0 0 0 3px rgba(216, 35, 44, 0.18); } }
.panel.is-expired .gauge.anim-shake { animation: shake 0.45s; }
.panel__stats { grid-area: stats; margin: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.panel__stats > div { min-width: 0; border-left: 1px solid var(--line); padding-left: 8px; }
.panel__stats dt { font-size: 13px; color: var(--sand); white-space: nowrap; }
.panel__stats dd { margin: 0; font-size: 21px; line-height: 1.3; color: #fff; white-space: nowrap; }
.panel__stats small { font-size: 0.6em; color: var(--sand); margin-left: 2px; }
.panel .manju-row { grid-area: manju; margin: 0; }
.plus { position: absolute; right: 12px; top: 6px; margin: 0; font-size: 16px; color: var(--glow); text-shadow: 0 0 8px rgba(59, 140, 255, 0.9); pointer-events: none; }
.plus.anim-rise { animation: rise 1s ease-out; }
@keyframes rise { from { transform: translateY(8px); } }

/* 赤い饅頭の進捗 */
.manju-row { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 7px; }
.manju {
  position: relative; width: 20px; height: 16px; border-radius: 50% 50% 46% 46% / 60% 60% 40% 40%;
  border: 1px solid rgba(216, 35, 44, 0.5); background: transparent;
  transition: background 0.3s, box-shadow 0.3s;
}
.manju.is-now { border-color: var(--red); box-shadow: 0 0 0 3px rgba(216, 35, 44, 0.16); }
.manju.is-ok {
  border-color: transparent;
  background: radial-gradient(ellipse 45% 35% at 38% 30%, rgba(255,210,200,0.75), transparent 70%), radial-gradient(ellipse at 50% 70%, #e2313a, #8f1016 85%);
  box-shadow: 0 0 10px rgba(216, 35, 44, 0.55);
}
.manju.is-ng { border-color: var(--sand-dim); opacity: 0.75; }
.manju.is-ng::after { content: ""; position: absolute; left: 2px; right: 2px; top: 50%; height: 1px; background: var(--sand); transform: rotate(-30deg); }
.manju-row--result { margin: 18px 0 0; }

/* 問題カード */
.dossier--q { padding-bottom: 22px; overflow: hidden; }
.dossier--q::after { /* 走査線（演出時のみ表示） */
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 60px; pointer-events: none; display: none;
  background: linear-gradient(to bottom, transparent, rgba(111, 182, 255, 0.18) 80%, rgba(111, 182, 255, 0.7) 98%, transparent);
}
.dossier--q.anim-flip { animation: flip 0.55s cubic-bezier(.2,.7,.2,1); transform-origin: top center; }
.dossier--q.anim-flip::after { display: block; animation: scanDown 0.6s linear; }
@keyframes flip { from { transform: perspective(1000px) rotateX(9deg) translateY(-6px); } }
@keyframes scanDown { from { transform: translateY(-60px); } to { transform: translateY(600px); } }
.dossier--q.fx-ng { animation: glitch 0.45s steps(2); }
.dossier--q.fx-ng::after { display: block; background: linear-gradient(to bottom, transparent, rgba(216, 35, 44, 0.25) 80%, rgba(255, 98, 104, 0.8) 98%, transparent); animation: scanDown 0.5s linear; }
.dossier--q.fx-ng .q-text { text-shadow: 2px 0 rgba(216, 35, 44, 0.8), -2px 0 rgba(59, 140, 255, 0.7); }
@keyframes glitch { 0% { transform: translate(0); } 20% { transform: translate(-4px, 1px); clip-path: inset(10% 0 60% 0); } 40% { transform: translate(4px, -1px); clip-path: inset(50% 0 20% 0); } 60% { transform: translate(-2px, 0); clip-path: none; } 100% { transform: translate(0); } }
.dossier--q.fx-ok { box-shadow: 0 0 0 1px var(--glow), 0 0 50px -10px rgba(59, 140, 255, 0.7), inset 0 0 60px -20px rgba(59, 140, 255, 0.6); }
.lv { display: inline-flex; align-items: center; gap: 8px; }
.lv__stars { color: var(--glow); letter-spacing: 0.12em; font-size: 15px; }
.lv__stars .off { color: var(--sand-dim); opacity: 0.7; }
.lv__text { font-size: 13px; }
.q-text {
  margin: 0 0 20px; font-family: var(--f-display); font-weight: 700;
  font-size: clamp(21px, 5.4vw, 30px); line-height: 1.55; letter-spacing: 0.02em; color: #fff;
  overflow-wrap: anywhere;
}
.q-text:focus { outline: none; }

.options { display: grid; grid-template-columns: 1fr; gap: 12px; }
.opt {
  position: relative; display: flex; align-items: center; gap: 14px;
  width: 100%; min-height: 60px; padding: 10px 16px 10px 10px;
  text-align: left; font: inherit; font-size: 17.5px; font-weight: 500; line-height: 1.5; color: #fff;
  background: #10203c; border: 1.5px solid #6e9ae0; border-radius: 5px;
  box-shadow: 0 4px 0 var(--btn-depth), inset 0 1px 0 rgba(255,255,255,0.07);
  cursor: pointer; overflow-wrap: anywhere;
  transition: border-color 0.12s, background 0.12s, box-shadow 0.12s, transform 0.1s, opacity 0.2s;
}
.opt:hover:not(:disabled) { border-color: #c4dfff; background: #1a3561; box-shadow: 0 4px 0 var(--btn-depth), inset 4px 0 0 var(--glow); }
.opt:focus-visible { border-color: #fff; background: #1a3561; }
.opt:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--btn-depth); }
.opt__key {
  flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 4px;
  font-family: var(--f-mono); font-size: 18px; font-weight: 500; color: #fff;
  background: var(--btn-pri); border: 1.5px solid var(--btn-pri-edge);
}
.opt__text { flex: 1; min-width: 0; }
.opt__tag { flex: none; font-size: 14px; font-weight: 700; }
.opt:disabled { cursor: default; box-shadow: none; }
.opt.is-dim { opacity: 0.55; }
.opt.is-dim .opt__key { background: transparent; border-color: #6e9ae0; color: var(--glow); }
.opt.is-correct {
  border-color: var(--glow); background: #173a6e;
  box-shadow: 0 0 0 1px var(--glow), 0 0 26px rgba(59, 140, 255, 0.55);
  opacity: 1;
}
.opt.is-correct .opt__key { background: var(--signal); color: #fff; border-color: #fff; }
.opt.is-correct .opt__tag { color: #cfe6ff; }
.opt.is-wrong { border-color: var(--red); background: #4a1218; opacity: 1; }
.opt.is-wrong.anim-shake { animation: shake 0.38s; }
.opt.is-wrong .opt__key { background: var(--red); color: #fff; border-color: #ffb0b3; }
.opt.is-wrong .opt__tag { color: #ffc2c4; }
@keyframes shake { 20% { transform: translateX(-5px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }

/* 回答後 */
.feedback { margin-top: 20px; padding-top: 18px; border-top: 1px dashed var(--line); }
.feedback.anim-in { animation: screenIn 0.35s ease; }
.feedback__verdict { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.feedback__vtext { flex: 1; min-width: 0; }
.feedback__mark { flex: none; width: 46px; height: 46px; border-radius: 50%; border: 2px solid currentColor; display: grid; place-items: center; font-family: var(--f-display); font-weight: 800; font-size: 22px; }
.feedback__label { margin: 0; font-family: var(--f-display); font-weight: 800; font-size: 24px; letter-spacing: 0.08em; line-height: 1.3; }
.feedback__code { margin: 2px 0 0; font-size: 13px; letter-spacing: 0.12em; color: var(--sand); }
.feedback__points { flex: none; margin: 0; text-align: right; font-family: var(--f-body); font-size: 14px; line-height: 1.5; color: var(--sand); }
.feedback__points b { display: block; font-family: var(--f-mono); font-size: 24px; font-weight: 500; color: var(--glow); }
.feedback.is-ok .feedback__verdict { color: var(--glow); }
.feedback.is-ok .feedback__mark { box-shadow: 0 0 18px rgba(59, 140, 255, 0.5); }
.feedback.is-ok .feedback__label { text-shadow: 0 0 16px rgba(59, 140, 255, 0.6); }
.feedback.is-ng .feedback__verdict { color: var(--red-text); }
.feedback.is-ng .feedback__points b { color: var(--sand); }
.feedback__answer { margin: 0 0 10px; display: flex; gap: 10px; align-items: baseline; font-size: 18px; font-weight: 700; color: #fff; overflow-wrap: anywhere; }
.k { flex: none; font-family: var(--f-body); font-size: 13px; font-weight: 700; letter-spacing: 0.04em; color: var(--sand); border: 1px solid var(--line-strong); padding: 0 7px; }
.feedback__ex { margin: 0 0 12px; font-size: 16px; line-height: 1.8; overflow-wrap: anywhere; }
.feedback__src { margin: 0 0 18px; }
.src-link {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 6px 14px;
  font-size: 15px; font-weight: 700; color: #d9ebff; text-decoration: none;
  background: var(--btn-ter); border: 1.5px solid var(--btn-ter-edge); border-radius: 4px;
  box-shadow: 0 3px 0 var(--btn-depth);
  transition: background 0.12s, border-color 0.12s, transform 0.1s, box-shadow 0.1s;
}
.src-link__k { font-size: 13px; font-weight: 500; color: var(--sand); }
.src-link__ic { font-size: 14px; }
.src-link:hover { background: var(--btn-ter-hover); border-color: var(--btn-sec-edge); color: #fff; }
.src-link:active { transform: translateY(3px); box-shadow: 0 0 0 var(--btn-depth); }

/* ── ボタン（3段：主＝青の塗り／副＝明るい縁と塗り／控えめ＝暗い塗りと読める縁。赤は使わない） ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 56px; padding: 10px 22px;
  font: inherit; font-weight: 700; font-size: 16.5px; letter-spacing: 0.04em; line-height: 1.4; text-decoration: none; text-align: center;
  color: var(--btn-sec-text); background: var(--btn-sec); border: 1.5px solid var(--btn-sec-edge); border-radius: 5px;
  box-shadow: 0 4px 0 var(--btn-depth), inset 0 1px 0 rgba(255,255,255,0.1);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, box-shadow 0.1s, transform 0.1s;
}
.btn:hover { background: var(--btn-sec-hover); border-color: #c4dfff; color: #fff; }
.btn:active { transform: translateY(4px); box-shadow: 0 0 0 var(--btn-depth); }
.btn__ic { flex: none; font-size: 1.05em; line-height: 1; }
.btn--primary { background: var(--btn-pri); border-color: var(--btn-pri-edge); color: #fff; box-shadow: 0 4px 0 var(--btn-pri-depth), 0 0 22px -6px rgba(59, 140, 255, 0.7), inset 0 1px 0 rgba(255,255,255,0.2); }
.btn--primary:hover { background: var(--btn-pri-hover); border-color: #d2e7ff; }
.btn--primary:active { box-shadow: 0 0 0 var(--btn-pri-depth); }
.btn--tertiary { background: var(--btn-ter); border-color: var(--btn-ter-edge); color: var(--btn-ter-text); font-size: 16px; }
.btn--tertiary:hover { background: var(--btn-ter-hover); border-color: var(--btn-sec-edge); color: #fff; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }
.kbd { font-family: var(--f-mono); font-size: 13px; font-weight: 400; padding: 0 7px; border: 1px solid rgba(255,255,255,0.7); border-radius: 3px; }
#nextBtn { width: 100%; font-size: 18px; }
#abortBtn { margin-top: 20px; }

/* ── 結果 ── */
.result-layout { display: grid; gap: 18px; }
.notice { --tier: var(--glow); overflow: hidden; }
.rank {
  margin: 4px 0 6px; font-family: var(--f-display); font-weight: 800;
  font-size: clamp(40px, 11vw, 76px); line-height: 1.15; letter-spacing: 0.08em;
  color: var(--tier); text-shadow: 0 0 30px color-mix(in srgb, var(--tier) 55%, transparent);
}
.rank:focus { outline: none; }
.notice[data-tier="elite"] { --tier: #a9d4ff; box-shadow: 0 0 0 1px rgba(111, 182, 255, 0.5), 0 0 60px -20px rgba(59, 140, 255, 0.8), inset 0 0 60px -20px rgba(59, 140, 255, 0.5); }
.notice[data-tier="beppan"] { --tier: var(--glow); }
.notice[data-tier="koan"] { --tier: #c9d3e6; }
.notice[data-tier="marubishi"] { --tier: #d9c7a2; }
.notice[data-tier="gosokin"] { --tier: var(--red-text); }
.rank-comment { margin: 0 0 6px; color: var(--paper); font-size: 16.5px; max-width: 30em; }
.verdict-stamp {
  position: absolute; right: 14px; top: 40px; transform: rotate(-12deg);
  border: 4px double var(--red); color: var(--red); white-space: nowrap;
  padding: 4px 12px 6px 16px;
  font-family: var(--f-display); font-weight: 800; font-size: 21px; letter-spacing: 0.3em;
  opacity: 0.92; pointer-events: none;
  -webkit-mask-image: radial-gradient(circle at 35% 45%, #000 55%, rgba(0,0,0,0.5) 72%, #000 86%);
          mask-image: radial-gradient(circle at 35% 45%, #000 55%, rgba(0,0,0,0.5) 72%, #000 86%);
}
/* 判定スタンプ（右上・位置と大きさは据え置き）と日付が重ならないよう、報告書の見出し行は左に縦積み */
.notice .meta-row { flex-direction: column; align-items: flex-start; gap: 2px; padding-right: 120px; }
@media (max-width: 520px) { .notice .meta-row { padding-right: 0; } }
.verdict-stamp.anim-press { animation: press 0.42s cubic-bezier(.3,1.6,.5,1); }
@keyframes press { from { transform: rotate(-22deg) scale(2.2); opacity: 0.5; } }
.newbest { display: inline-block; margin-top: 6px; font-size: 13px; letter-spacing: 0.08em; color: var(--red-text); border: 1px solid var(--red); padding: 3px 9px; }
.actions { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 24px; }
.actions > * { grid-column: 1 / -1; }
.share-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(215px, 1fr)); gap: 12px; }
.png-msg { margin: 10px 0 0; min-height: 1.5em; font-size: 14px; color: var(--sand); }
.stats { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); border: 1px solid var(--line); background: var(--panel); }
.stats > div { padding: 12px 14px 10px; border-top: 1px solid var(--line); min-width: 0; }
.stats > div:nth-child(2n+3) { border-left: 1px solid var(--line); }
.stats > div.stats__wide { grid-column: 1 / -1; border-top: 0; }
.stats dt { font-size: 14px; color: var(--sand); }
.stats dd { margin: 2px 0 0; font-family: var(--f-mono); font-size: clamp(24px, 6.4vw, 34px); line-height: 1.2; white-space: nowrap; }
.stats__wide dd { font-size: clamp(36px, 10vw, 52px); color: var(--glow); text-shadow: 0 0 18px rgba(59, 140, 255, 0.55); }
.stats small { font-size: 0.45em; color: var(--sand); margin-left: 4px; }
.section-label--miss { margin-top: 28px; }

.miss-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.miss { padding: 16px 16px 12px; background: var(--panel); border: 1px solid var(--line-strong); border-left: 3px solid var(--red); }
.miss__head { display: flex; justify-content: space-between; gap: 10px; font-family: var(--f-mono); font-size: 13px; letter-spacing: 0.06em; color: var(--sand); margin-bottom: 6px; }
.miss__q { margin: 0 0 12px; font-family: var(--f-display); font-weight: 700; font-size: 18px; line-height: 1.6; color: #fff; overflow-wrap: anywhere; }
.miss__cmp { display: grid; grid-template-columns: 1fr; gap: 8px; margin-bottom: 10px; }
.miss__box { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1.5px solid; overflow-wrap: anywhere; }
.miss__box--mine { border-color: rgba(255, 107, 112, 0.7); background: rgba(120, 15, 22, 0.35); }
.miss__box--right { border-color: rgba(124, 188, 255, 0.8); background: rgba(30, 80, 160, 0.3); }
.miss__mark { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; border: 2px solid currentColor; font-weight: 800; font-size: 15px; line-height: 1; }
.miss__box--mine .miss__mark { color: var(--red-text); }
.miss__box--right .miss__mark { color: var(--glow); }
.miss__lbl { display: block; font-size: 13px; color: var(--sand); line-height: 1.4; }
.miss__val { display: block; font-size: 17px; font-weight: 700; line-height: 1.5; }
.miss__box--mine .miss__val { color: #ffc2c4; text-decoration: line-through; text-decoration-color: rgba(255, 107, 112, 0.7); }
.miss__box--mine .miss__val.is-timeout { text-decoration: none; }
.miss__box--right .miss__val { color: #fff; }
.miss__ex { margin: 0 0 10px; font-size: 15.5px; line-height: 1.8; overflow-wrap: anywhere; }
.miss__src { margin: 0; }
.miss-empty { padding: 16px; border: 1px dashed var(--line-strong); color: var(--paper); }

/* ── フッター ── */
.foot { position: relative; z-index: 2; max-width: var(--maxw); margin: 0 auto; padding: 22px var(--gutter) 40px; border-top: 1px solid var(--line); font-size: 14px; color: var(--sand); }
.foot__note { margin: 0 0 12px; line-height: 1.8; }
.foot__h { margin: 0 0 4px; font-size: 13px; color: var(--sand); }
.foot__src { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0 18px; }
.foot__src a { display: inline-block; min-height: 44px; line-height: 44px; color: #cfe3ff; text-underline-offset: 3px; }
.foot__src a:hover { color: #fff; }

/* ── 幅ごとの組み替え ── */
@media (max-width: 520px) {
  .dossier { padding: 18px 16px 20px; }
  .hero__map { padding: 10px 10px 8px; }
  .verdict-stamp { position: relative; right: auto; top: auto; display: inline-block; margin: 8px 0 4px 4px; font-size: 20px; }
}
@media (min-width: 640px) {
  .file-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .options { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stats > div { border-left: 1px solid var(--line); }
  .stats > div:nth-child(2) { border-left: 0; }
  .panel { grid-template-columns: 100px 1fr; }
  .gauge { width: 100px; height: 100px; }
  .miss__cmp { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  main { padding-top: 36px; }
  .hero { grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 22px; align-items: stretch; }
  .hero__text { display: flex; flex-direction: column; justify-content: center; padding: 34px 34px 36px; }
  .title__br { display: inline; }
  .title__main { font-size: clamp(76px, 7.4vw, 104px); line-height: 1.04; }
  .hero__map { display: flex; flex-direction: column; }
  .map-frame { aspect-ratio: auto; flex: 1; min-height: 460px; }

  .quiz-layout { grid-template-columns: minmax(0, 1fr) 320px; gap: 28px; align-items: start; }
  .panel {
    order: 0; position: sticky; top: 76px;
    grid-template-columns: 1fr; grid-template-areas: "head" "gauge" "stats" "manju"; gap: 16px; padding: 18px;
  }
  .panel__head { grid-area: head; display: flex; justify-content: space-between; font-family: var(--f-body); font-size: 15px; font-weight: 700; color: var(--paper); padding-bottom: 8px; border-bottom: 1px solid var(--line-strong); }
  #panelState { color: var(--glow); }
  .panel.is-tense #panelState { color: var(--red-text); }
  .gauge { width: 210px; height: 210px; justify-self: center; }
  .gauge__read #timerSec { font-size: 46px; }
  .gauge__unit { font-size: 14px; }
  .panel__stats { grid-template-columns: 1fr; gap: 0; }
  .panel__stats > div { display: flex; justify-content: space-between; align-items: baseline; border-left: 0; border-top: 1px solid var(--line); padding: 8px 2px; }
  .panel__stats dt { font-size: 15px; }
  .panel__stats dd { font-size: 26px; }
  .plus { top: 46px; right: 18px; font-size: 18px; }
  .q-text { font-size: 30px; margin-bottom: 26px; }
  .quiz-head { margin-bottom: 16px; }
  .quiz-head__title { font-size: 22px; }
  .options { grid-template-columns: 1fr; gap: 14px; }
  .opt { min-height: 76px; font-size: 18px; padding: 12px 18px 12px 14px; }
  .opt__key { width: 44px; height: 44px; font-size: 19px; }
  .dossier--q { padding: 28px 30px 30px; }

  .result-layout { grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr); gap: 28px; align-items: start; }
  .notice { position: sticky; top: 76px; padding: 28px 28px 30px; }
  .section-label--miss { margin-top: 30px; }
}
@media (min-width: 1100px) {
  .file-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .file-card__cover { padding: 16px 14px 14px; gap: 12px; }
  .file-card__body { padding: 14px 14px 16px; }
  .file-card__go { padding: 0 14px; font-size: 16px; }
  .emblem { width: 50px; height: 50px; }
  .file-card__title { font-size: 23px; white-space: nowrap; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .grain { display: none; }
}

/* BGM トグルの音符アイコン */
.sound-btn__note { font-size: 15px; line-height: 1; color: var(--sand-dim); }
.sound-btn[aria-pressed="true"] .sound-btn__note { color: var(--glow); }
@media (max-width: 400px) {
  .sound-btn { margin-left: 6px; padding: 0 9px; font-size: 13px; gap: 6px; }
}

/* 結果画面：本家の音楽への案内 */
.music { margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line-strong); }
.music__h { margin: 0 0 6px; font-family: var(--f-display); font-weight: 800; font-size: 18px; color: var(--paper); }
.music__note { margin: 0 0 12px; font-size: 14px; line-height: 1.7; color: var(--sand); }
.music__links { display: grid; gap: 10px; }
.btn--stack { flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding-top: 10px; padding-bottom: 10px; }
.btn--stack > span { max-width: 100%; }
.btn__main { display: inline-flex; align-items: center; gap: 8px; }
.btn__sub { font-size: 13px; font-weight: 500; letter-spacing: 0.02em; color: var(--sand); overflow-wrap: anywhere; }
.foot__h--music { margin-top: 14px; }
.foot__music-note { margin: 0 0 2px; font-size: 13px; color: var(--sand); }

/* 画面切り替え時に読み上げ用としてフォーカスを移す見出し（押せるものではない）には、輪郭を出さない */
#qText:focus, #qText:focus-visible, #rTitle:focus, #rTitle:focus-visible { outline: none; box-shadow: none; }

/* 配属通知の枠は中身が増えて画面の高さを超えるため、追従（sticky）をやめる。
   追従のままだと、枠の下のほう（本家の音楽の案内）が一覧を最後までスクロールしないと見えない。 */
.notice { position: relative !important; top: auto !important; }
