/* 理社クイズ 試作品スタイル — スマホ縦画面を基準に、PCでは中央寄せで広げる */

:root {
  /* 方眼紙の背景・黒い太線・オレンジのアクセント（2026-11 デザイン刷新） */
  --bg: #e8e8e8;
  --bg-deep: #efeeeb;
  --surface: #ffffff;
  --ink: #1c1917;
  --ink-soft: #57534e;
  --line: #1c1917;
  --navy: #1c1917;
  --accent: #fb5a19;
  --accent-grad: linear-gradient(90deg, #fb8619 0%, #fb4a19 100%);
  --grid: rgba(28, 25, 23, .09);
  --gold: #f2c14e;
  --gold-soft: #fbefcd;
  --science: #0d6e66;
  --science-soft: #dff1ee;
  --social: #9a4a10;
  --social-soft: #f8e8d8;
  --ok: #17703a;
  --ok-soft: #e1f3e6;
  --ng: #a8261b;
  --ng-soft: #fbe6e3;
  --focus: #2f6fdf;
  --radius: 22px;
  --radius-sm: 16px;
  --shadow: 0 4px 0 rgba(28, 25, 23, .14);
  --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", "Meiryo", system-ui, sans-serif;
  --bottom-nav-h: 64px;
  color-scheme: light;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background-color: var(--bg);
  background-image:
    linear-gradient(to right, var(--grid) 1px, transparent 1px),
    linear-gradient(var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.75;
  letter-spacing: .02em;
  min-height: 100vh;
  padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom));
}

body.is-playing { padding-bottom: 24px; }

h1, h2, h3 { line-height: 1.45; margin: 0 0 .5em; font-weight: 900; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
a { color: var(--navy); }

:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

.skip-link {
  position: absolute; left: -9999px; top: 8px;
  background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 100;
}
.skip-link:focus { left: 8px; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---- 試作品の明示 ---- */
.demo-strip {
  background: var(--navy);
  color: #fff;
  font-size: .8rem;
  line-height: 1.5;
  padding: 6px 16px;
  text-align: center;
}
.demo-strip strong {
  display: inline-block;
  background: var(--gold); color: var(--navy);
  padding: 0 8px; border-radius: 999px; margin-right: 6px;
}

/* ---- ヘッダー ---- */
.app-header {
  /* 注意: backdrop-filter / transform を付けると、中の固定メニュー（スマホ下部）の基準がずれる */
  background: transparent;
  position: sticky; top: 0; z-index: 20;
  padding: 10px 12px 0;
}
.app-header__inner {
  max-width: 760px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 14px; background: var(--ink); color: #fff;
  border: 3px solid var(--accent); border-radius: 18px;
}
.brand {
  display: inline-flex; align-items: center; gap: 8px;
  color: #fff; text-decoration: none; font-weight: 900; font-size: 1.25rem;
  letter-spacing: .08em; font-style: italic;
  flex: none; white-space: nowrap;
}
.brand__mark { width: 34px; height: 34px; border-radius: 9px; display: block; }

.player-chip {
  display: flex; align-items: center; gap: 6px;
  font-size: .82rem; line-height: 1.35; text-align: right; color: #d6d3d1;
  min-width: 0;
}
.player-chip__title {
  color: var(--gold); font-size: 1rem; font-weight: 900; letter-spacing: .04em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 11em;
}
.player-chip__name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 9em; flex: none; }
/* 二つ名は3語まで組めて長くなるので、スマホでは2行まで折り返して名前とロゴをつぶさない */
@media (max-width: 559px) {
  .player-chip__title {
    font-size: .86rem; line-height: 1.25; white-space: normal; max-width: none; min-width: 0; text-align: left; word-break: keep-all;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  }
  .player-chip__name { max-width: 5.5em; }
}

/* スマホ: 画面下にメニュー / PC: ヘッダー内に並べる */
.main-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  background: var(--surface); border-top: 3px solid var(--ink);
  padding-bottom: env(safe-area-inset-bottom);
  height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom));
}
.main-nav a {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: .72rem; line-height: 1.3; text-decoration: none; color: var(--ink-soft);
  gap: 2px; padding: 6px 2px; text-align: center;
}
.main-nav a span { font-size: 1.25rem; line-height: 1; }
.main-nav a[aria-current="page"] { color: var(--navy); font-weight: 800; }
.main-nav a[aria-current="page"] span { color: var(--accent); }
body.is-playing .main-nav { display: none; }

@media (min-width: 760px) {
  body { padding-bottom: 32px; }
  .main-nav {
    position: static; height: auto; border-top: 0; background: transparent;
    max-width: 760px; margin: 0 auto; padding: 0 16px 8px;
    display: flex; gap: 6px;
  }
  .main-nav { padding-top: 10px; }
  .main-nav a {
    flex-direction: row; font-size: .9rem; font-weight: 800; padding: 5px 16px; border-radius: 999px; gap: 6px;
    background: var(--surface); border: 3px solid var(--ink); color: var(--ink);
  }
  .main-nav a span { font-size: 1rem; }
  @media (hover: hover) and (pointer: fine) { .main-nav a:hover { background: var(--bg-deep); } }
  .main-nav a[aria-current="page"] { background: var(--ink); color: #fff; }
}

/* ---- レイアウト ---- */
.app-main {
  max-width: 760px; margin: 0 auto; padding: 20px 16px 32px;
  outline: none;
}
.stack > * + * { margin-top: 16px; }

.card {
  background: var(--surface);
  border: 3px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card--plain { box-shadow: none; }

.eyebrow {
  font-size: .8rem; font-weight: 700; letter-spacing: .12em; color: var(--ink-soft); margin: 0 0 4px;
}
.lead { color: var(--ink-soft); }
.note {
  font-size: .85rem; color: var(--ink-soft); line-height: 1.6;
  background: var(--bg-deep); border-radius: var(--radius-sm); padding: 10px 14px;
}
.note--warn { background: var(--gold-soft); color: #5a4613; }

/* ---- ボタン ---- */
.btn {
  appearance: none; border: 3px solid transparent; border-radius: 999px;
  font: inherit; font-weight: 900; font-size: 1rem; line-height: 1.4;
  min-height: 52px; padding: 12px 20px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  text-decoration: none; text-align: center;
  transition: transform .12s ease, background-color .15s ease;
}
.btn:active { transform: translateY(1px); }
.btn--primary {
  background: var(--accent-grad); color: #fff; border-color: #fff;
  box-shadow: 0 0 0 2px #fb4a19, 0 8px 18px rgba(251, 74, 25, .35);
}
@media (hover: hover) and (pointer: fine) { .btn--primary:hover { filter: brightness(1.05); } }
.btn--secondary { background: var(--ink); color: #fff; border-color: #fff; box-shadow: 0 0 0 2px var(--ink), 0 6px 14px rgba(28, 25, 23, .25); }
.btn--ghost { background: var(--surface); color: var(--ink); border-color: var(--ink); }
.btn--danger { background: var(--ng); color: #fff; }
.btn--small { min-height: 40px; padding: 6px 14px; font-size: .9rem; }
.btn--block { width: 100%; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; }
/* 左右に同じ幅で並べる（設定画面の利用規約・お問い合わせ） */
.btn-row--split { display: grid; grid-template-columns: 1fr 1fr; }
.btn-row--split .btn { width: 100%; }
/* 押している間は色を反転する（設定画面の BGM・効果音のためし再生） */
.btn--toggle.is-playing { background: var(--ink); color: #fff; }
.btn-col { display: grid; gap: 10px; }

/* ---- ホーム ---- */
/* トップの見出し：白いカードに黒い太枠。キャッチと大きな見出し（「四択クエスト」はオレンジ）、右にナナコロと名乗りの吹き出し */
.hero {
  position: relative; overflow: hidden;
  background-color: var(--surface);
  background-image:
    linear-gradient(to right, var(--grid) 1px, transparent 1px),
    linear-gradient(var(--grid) 1px, transparent 1px);
  background-size: 18px 18px;
  border: 3px solid var(--ink); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px 20px; min-height: 172px;
}
.hero__catch { margin: 0 0 6px; font-size: .82rem; font-weight: 800; letter-spacing: .08em; color: var(--ink); }
.hero__title { margin: 0; line-height: 1.2; max-width: calc(100% - 104px); }
.hero__title-sub { display: block; font-size: 1.35rem; font-weight: 900; color: var(--ink); }
.hero__title-main {
  display: block; font-size: 2.1rem; font-weight: 900; letter-spacing: .02em; white-space: nowrap;
  background: var(--accent-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero__nanakoro { position: absolute; right: 12px; bottom: 8px; width: 92px; height: 106px; z-index: 1; }
.hero__nanakoro > span[aria-hidden] { display: block; width: 100%; height: 100%; }
.hero__nanakoro svg { width: 100%; height: 100%; overflow: visible; }
/* 名乗りの吹き出し：白地に黒い太枠。しっぽでナナコロ本人を指す */
.hero__nanakoro-name {
  position: absolute; right: -4px; top: -14px; transform: rotate(-4deg); z-index: 2;
  background: var(--surface); color: var(--ink); border: 3px solid var(--ink); border-radius: 999px;
  font-weight: 900; font-size: .78rem; line-height: 1.3; padding: 3px 10px; white-space: nowrap;
}
.hero__nanakoro-name::after {
  content: ""; position: absolute; right: 30px; bottom: -10px;
  width: 12px; height: 12px; background: var(--surface);
  border-right: 3px solid var(--ink); border-bottom: 3px solid var(--ink); transform: rotate(45deg);
}
@media (min-width: 560px) {
  .hero { padding: 28px 32px; min-height: 196px; }
  .hero__catch { font-size: .9rem; }
  .hero__title { max-width: calc(100% - 150px); }
  .hero__title-sub { font-size: 1.7rem; }
  .hero__title-main { font-size: 3rem; }
  .hero__nanakoro { width: 124px; height: 142px; right: 28px; bottom: 10px; }
  .hero__nanakoro-name { font-size: .88rem; top: -12px; right: auto; left: 50%; transform: translateX(-50%) rotate(-4deg); }
  .hero__nanakoro-name::after { right: auto; left: 50%; margin-left: -7px; }
}

.subject-grid { display: grid; gap: 12px; grid-template-columns: 1fr 1fr; }

/* トップの教科ボタン：教科名だけを白い大きな文字で。理科は青緑、社会は橙の配色 */
.subject-card {
  display: grid; place-items: center; width: 100%; min-height: 112px;
  border: 3px solid var(--ink); border-radius: var(--radius); padding: 18px; cursor: pointer;
  font: inherit; color: #fff; box-shadow: 0 6px 0 var(--ink);
  transition: transform .12s ease, box-shadow .12s ease, filter .15s ease;
}
@media (hover: hover) and (pointer: fine) { .subject-card:hover { transform: translateY(-2px); filter: brightness(1.06); } }
.subject-card:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--ink); }
.subject-card:focus-visible { outline: 4px solid var(--gold); outline-offset: 3px; }
.subject-card__name { font-size: 2.4rem; font-weight: 900; letter-spacing: .12em; text-shadow: 0 2px 0 rgba(0, 0, 0, .2); }
.subject-card--science { background: linear-gradient(135deg, #12857c 0%, #1565a8 100%); }
.subject-card--social { background: linear-gradient(135deg, #d4621a 0%, #a8341a 100%); }


/* ---- 単元選択 ---- */
.back-link {
  display: inline-flex; align-items: center; gap: 6px; font-weight: 700;
  text-decoration: none; min-height: 44px;
}
.unit-list { display: grid; gap: 12px; list-style: none; margin: 0; padding: 0; }
@media (min-width: 640px) { .unit-list { grid-template-columns: 1fr 1fr; } }
.unit-card {
  width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer;
  background: var(--surface); border: 3px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; display: grid; gap: 4px; min-height: 96px;
  box-shadow: var(--shadow);
}
@media (hover: hover) and (pointer: fine) { .unit-card:hover { border-color: var(--accent); } }
.unit-card__name { font-weight: 800; font-size: 1.1rem; }
.unit-card__desc { font-size: .9rem; color: var(--ink-soft); }
.unit-card__meta { font-size: .82rem; color: var(--ink-soft); display: flex; gap: 10px; flex-wrap: wrap; }
.unit-card__start { font-weight: 700; color: var(--navy); }
.subject-science .unit-card { box-shadow: inset 8px 0 0 var(--science), var(--shadow); }
.subject-social .unit-card { box-shadow: inset 8px 0 0 var(--social), var(--shadow); }

/* ---- プレイ ---- */
.play-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.play-head__unit { font-weight: 800; font-size: .95rem; }
.badge {
  display: inline-block; font-size: .78rem; font-weight: 700; border-radius: 999px;
  padding: 1px 10px; background: var(--bg-deep); color: var(--ink);
}
.badge--review { background: var(--gold-soft); color: #6a5212; border: 1px solid #ecd9a3; }

.progress { margin: 12px 0 4px; }
.progress__label { font-size: .9rem; font-weight: 700; color: var(--ink-soft); }
.progress__dots { display: flex; gap: 6px; list-style: none; padding: 0; margin: 6px 0 0; }
.progress__dot {
  flex: 1; height: 28px; border-radius: 8px; background: var(--bg-deep);
  display: grid; place-items: center; font-size: .85rem; font-weight: 800; color: var(--ink-soft);
  border: 2px solid transparent;
}
.progress__dot.is-current { border-color: var(--navy); background: var(--surface); color: var(--navy); }
.progress__dot.is-ok { background: var(--ok-soft); color: var(--ok); }
.progress__dot.is-ng { background: var(--ng-soft); color: var(--ng); }

.question {
  font-size: 1.2rem; font-weight: 700; line-height: 1.8; margin: 0; outline: none;
}
@media (min-width: 760px) { .question { font-size: 1.3rem; } }
.question__num { display: block; font-size: .85rem; color: var(--ink-soft); font-weight: 700; margin-bottom: 4px; }

.choices { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.choice {
  width: 100%; font: inherit; color: var(--ink); text-align: left; cursor: pointer;
  background: var(--surface); border: 3px solid var(--line); border-radius: var(--radius-sm);
  min-height: 60px; padding: 12px 14px; display: grid;
  grid-template-columns: 36px 1fr auto; align-items: center; gap: 12px;
  font-size: 1.05rem; font-weight: 600; line-height: 1.55;
  transition: border-color .15s ease, background-color .15s ease;
  touch-action: manipulation;
}
@media (hover: hover) and (pointer: fine) { .choice:hover:not([disabled]) { border-color: var(--accent); background: #fff8f3; } }
.choice__key {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  background: var(--ink); font-weight: 900; color: #fff; font-size: .95rem;
}
.choice__mark { font-weight: 800; font-size: .85rem; white-space: nowrap; }
.choice[disabled] { cursor: default; }
.choices > li, .choice { min-width: 0; height: 100%; }
.choice { align-content: center; min-height: 62px; }
.choice.is-dim { opacity: .62; }
.choice.is-correct { border-color: var(--ok); background: var(--ok-soft); opacity: 1; }
.choice.is-correct .choice__key { background: var(--ok); color: #fff; }
.choice.is-correct .choice__mark { color: var(--ok); }
.choice.is-wrong { border-color: var(--ng); background: var(--ng-soft); opacity: 1; border-style: dashed; }
.choice.is-wrong .choice__key { background: var(--ng); color: #fff; }
.choice.is-wrong .choice__mark { color: var(--ng); }

.feedback { border-radius: var(--radius); padding: 16px 18px; border: 2px solid; }
.feedback--ok { background: var(--ok-soft); border-color: #9fd2ae; }
.feedback--ng { background: #fff6f4; border-color: #f0bdb6; }
.feedback__title { font-size: 1.15rem; font-weight: 800; margin: 0 0 6px; display: flex; align-items: center; gap: 8px; }
.feedback--ok .feedback__title { color: var(--ok); }
.feedback--ng .feedback__title { color: var(--ng); }
.feedback__symbol {
  width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center;
  color: #fff; font-size: 1.1rem;
}
.feedback--ok .feedback__symbol { background: var(--ok); }
.feedback--ng .feedback__symbol { background: var(--ng); }
.feedback__answer { font-weight: 700; margin-bottom: 6px; }
.feedback__explain { margin-bottom: 14px; }
.feedback__encourage { font-size: .9rem; color: var(--ink-soft); }
.feedback-modal-wrap {
  position: fixed; inset: 0; z-index: 52; display: grid; place-items: end center;
  padding: 18px max(14px, env(safe-area-inset-right)) calc(14px + env(safe-area-inset-bottom)) max(14px, env(safe-area-inset-left));
  background: rgba(10, 15, 38, .68); overflow-y: auto;
}
.feedback-modal-wrap .feedback { width: min(100%, 620px); max-height: min(88vh, 760px); overflow-y: auto; box-shadow: 0 16px 48px rgba(0,0,0,.35); }
.report-bell { margin-left: auto; width: 44px; height: 44px; border: 2px solid currentColor; border-radius: 50%; background: #fff; cursor: pointer; font-size: 1.15rem; }
.question-stats { font-size: .82rem; color: var(--ink-soft); background: rgba(255,255,255,.7); padding: 8px 10px; border-radius: 8px; }
.report-panel { display: grid; gap: 12px; }
.report-panel h2 { margin: 0; }
.report-reasons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.report-detail { width: 100%; resize: vertical; min-height: 96px; padding: 10px; border: 2px solid var(--line); border-radius: 10px; font: inherit; }
.report-confirm { display: grid; grid-template-columns: max-content 1fr; gap: 8px 12px; margin: 0; }
.report-confirm dt { font-weight: 800; }
.report-confirm dd { margin: 0; overflow-wrap: anywhere; }

.kbd-hint { font-size: .8rem; color: var(--ink-soft); display: none; }
@media (hover: hover) and (min-width: 760px) { .kbd-hint { display: block; } }

/* ---- 結果 ---- */
.score {
  display: flex; align-items: center; gap: 18px;
}
.score__ring {
  --p: 0;
  width: 108px; height: 108px; border-radius: 50%; flex-shrink: 0;
  background: conic-gradient(var(--navy) calc(var(--p) * 1%), var(--bg-deep) 0);
  display: grid; place-items: center;
}
.score__ring > span {
  width: 84px; height: 84px; border-radius: 50%; background: var(--surface);
  display: grid; place-items: center; font-weight: 800; font-size: 1.5rem; color: var(--navy);
  line-height: 1.1; text-align: center;
}
.score__ring small { display: block; font-size: .7rem; color: var(--ink-soft); font-weight: 700; }

.review-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.review-list li {
  display: grid; grid-template-columns: 64px 1fr; gap: 10px; align-items: start;
  padding: 10px 12px; border-radius: var(--radius-sm); background: var(--bg);
  font-size: .92rem; line-height: 1.6;
}
.review-list .tag { font-weight: 800; font-size: .82rem; text-align: center; border-radius: 8px; padding: 2px 0; }
.review-list .tag--ok { background: var(--ok-soft); color: var(--ok); }
.review-list .tag--ng { background: var(--ng-soft); color: var(--ng); }
.review-list .answer { display: block; font-weight: 700; }

.unlock-card {
  display: flex; gap: 14px; align-items: center;
  border: 2px solid var(--gold); background: var(--gold-soft); border-radius: var(--radius);
  padding: 14px 16px;
}
.unlock-card__icon {
  width: 48px; height: 48px; flex-shrink: 0; border-radius: 50%;
  background: var(--navy); color: var(--gold); display: grid; place-items: center; font-size: 1.4rem;
}
.unlock-card__title { font-weight: 800; font-size: 1.1rem; display: block; }

/* ---- 実績・称号 ---- */
.equipped {
  display: flex; align-items: center; gap: 14px;
  background: linear-gradient(160deg, var(--navy), #33498a); color: #fff;
  border-radius: var(--radius); padding: 18px;
}
.equipped__label { font-size: .8rem; color: #cdd5ee; display: block; }
.equipped__name { font-size: 1.3rem; font-weight: 800; color: var(--gold); display: block; }

.ach-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
@media (min-width: 640px) { .ach-list { grid-template-columns: 1fr 1fr; } }
.ach {
  background: var(--surface); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 16px; display: grid; gap: 8px; align-content: start;
}
.ach.is-unlocked { border-color: #e2c770; }
.ach__head { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.ach__title { font-weight: 800; font-size: 1.1rem; }
.ach.is-locked .ach__title { color: var(--ink-soft); }
.ach__state { font-size: .78rem; font-weight: 800; border-radius: 999px; padding: 2px 10px; white-space: nowrap; }
.ach.is-unlocked .ach__state { background: var(--gold-soft); color: #6a5212; border: 1px solid #ecd9a3; }
.ach.is-locked .ach__state { background: var(--bg-deep); color: var(--ink-soft); }
.ach__cond { font-size: .9rem; margin: 0; }
.meter { height: 10px; border-radius: 999px; background: var(--bg-deep); overflow: hidden; }
.meter > span { display: block; height: 100%; background: var(--science); border-radius: 999px; }
.ach.is-unlocked .meter > span { background: #c99a1d; }
.ach__progress { font-size: .82rem; color: var(--ink-soft); }

/* ---- ランキング見本 ---- */
.rank-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.rank-row {
  display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: 10px 14px;
}
.rank-row__rank {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; background: var(--bg-deep); color: var(--navy);
}
.rank-row:nth-child(1) .rank-row__rank { background: var(--gold); }
.rank-row__name { font-weight: 800; display: block; line-height: 1.4; }
.rank-row__title { font-size: .8rem; color: var(--ink-soft); }
.rank-row__pts { text-align: right; font-weight: 800; color: var(--navy); line-height: 1.3; }
.rank-row__pts small { display: block; font-weight: 600; font-size: .75rem; color: var(--ink-soft); }
.sample-stamp {
  display: inline-block; border: 2px solid var(--ng); color: var(--ng);
  font-weight: 800; padding: 0 10px; border-radius: 6px; transform: rotate(-3deg); font-size: .9rem;
}

/* ---- 設定 ---- */
.setting { display: grid; gap: 6px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.setting:last-child { border-bottom: 0; }
.setting__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.setting__label { font-weight: 700; }
.setting__help { font-size: .85rem; color: var(--ink-soft); margin: 0; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 700; }
.switch input { width: 52px; height: 30px; appearance: none; background: #c9c2b2; border-radius: 999px; position: relative; cursor: pointer; margin: 0; transition: background-color .15s; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked { background: var(--science); }
.switch input:checked::after { transform: translateX(22px); }
.select, input[type="range"] { font: inherit; }
.select { min-height: 44px; border-radius: 10px; border: 2px solid var(--line); padding: 4px 10px; background: var(--surface); }
input[type="range"] { width: 100%; accent-color: var(--navy); min-height: 32px; }

/* ---- ダイアログ ---- */
.dialog {
  border: 3px solid var(--ink); border-radius: var(--radius); padding: 22px; max-width: min(92vw, 460px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, .25); color: var(--ink);
}
.dialog::backdrop { background: rgba(20, 26, 44, .5); }
.dialog__actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; margin-top: 8px; }

/* ---- トースト（実績解除など） ---- */
.toast-area {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--bottom-nav-h) + 12px + env(safe-area-inset-bottom));
  width: min(92vw, 420px); display: grid; gap: 8px; z-index: 50; pointer-events: none;
}
@media (min-width: 760px) { .toast-area { bottom: 24px; } }
.toast {
  background: var(--navy); color: #fff; border-radius: 12px; padding: 12px 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .2); display: flex; gap: 12px; align-items: center;
  border-left: 6px solid var(--gold); pointer-events: auto;
  animation: toast-in .35s ease-out both;
}
.toast__icon { color: var(--gold); font-size: 1.3rem; }
.toast.is-leaving { animation: toast-out .3s ease-in both; }

/* ---- ログイン状態が別タブで変わったとき：操作を止める覆い ---- */
.auth-stale {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px;
  background: rgba(20, 26, 44, .62);
}
.auth-stale__card {
  background: #fff; color: var(--ink); border-radius: var(--radius); padding: 22px; max-width: min(92vw, 420px);
  box-shadow: 0 10px 40px rgba(0, 0, 0, .25); display: grid; gap: 10px;
}
.auth-stale__card p { margin: 0; }

/* ---- 短い演出（点滅なし・1回だけ） ---- */
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.025); } 100% { transform: scale(1); } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes nudge { 0%, 100% { transform: translateX(0); } 30% { transform: translateX(-3px); } 60% { transform: translateX(3px); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }
@keyframes sparkle { 0% { transform: scale(.6) rotate(-20deg); opacity: 0; } 60% { opacity: 1; } 100% { transform: scale(1) rotate(0); opacity: 1; } }

.fx-pop { animation: pop .38s ease-out 1; }
.fx-nudge { animation: nudge .3s ease-out 1; }
.fx-rise { animation: rise .3s ease-out both; }
.fx-sparkle { animation: sparkle .5s ease-out both; }

html[data-motion="reduce"] *,
html[data-motion="reduce"] *::before,
html[data-motion="reduce"] *::after {
  animation: none !important;
  transition: none !important;
}

/* =====================================================================
   演出（プレイ中・フィナーレ）
   問題文と選択肢は不透明なカードに置き、派手な演出は背景・周辺・回答直後に限る。
   全画面の閃光や高速の点滅は使わない。
   ===================================================================== */
:root { --beat: 0; --motion: 1; }

.show-layer, #show-fx-front, .show-praise, .show-band, .show-stamp, .show-stage { display: none; }
body.show-on .show-layer { display: block; position: fixed; inset: 0; z-index: 0; pointer-events: none; background: #0b1030; }
body.show-on { background: #0b1030; }
body.show-on .demo-strip, body.show-on .app-main, body.show-on .main-nav, body.show-on .show-stage { position: relative; z-index: 2; }
body.show-on .app-header { display: none; }
body.show-on .main-nav { position: fixed; }
@media (min-width: 760px) { body.show-on .main-nav { display: none; } }
#show-bg, #show-fx-back, .show-bg-fallback { position: absolute; inset: 0; width: 100%; height: 100%; }
.show-bg-fallback { display: none; background: linear-gradient(#24305e, #e9b98a); transition: background 1s; }
.show-bg-fallback[data-stage="2"] { background: radial-gradient(circle at 50% 40%, #3b3f8f, #0b1030 70%); }
.show-bg-fallback[data-stage="3"] { background: radial-gradient(circle at 50% 30%, #3fdcb0 0, #3b3f8f 35%, #0b1030 75%); }
.show-bg-fallback[data-stage="4"] { background: conic-gradient(from 0deg at 50% 45%, #8f7cff, #4fc3c8, #f2c14e, #ff7a8a, #8f7cff); }
body.show-on #show-fx-front { display: block; position: fixed; inset: 0; width: 100%; height: 100%; z-index: 40; pointer-events: none; }
/* 設定画面の「演出の強さ」の見本：画面の一番手前に出す */
body.fx-preview #show-fx-front { display: block; position: fixed; inset: 0; width: 100%; height: 100%; z-index: 1000; pointer-events: none; }

/* 本文：カードは不透明、背景の上の文字は白 */
body.show-on .app-main { color: #fff; padding-top: 8px; padding-bottom: 40px; }
body.show-on .app-main .card,
body.show-on .app-main .choice,
body.show-on .app-main .feedback,
body.show-on .app-main .note,
body.show-on .app-main .unlock-card { color: var(--ink); }
body.show-on .app-main .note { background: rgba(255, 255, 255, .94); }
body.show-on .app-main .eyebrow { color: #f9e3a8; }
body.show-on .app-main h1, body.show-on .app-main h2 { text-shadow: 0 2px 0 rgba(0, 0, 0, .35); }
body.show-on .app-main .card h1, body.show-on .app-main .card h2 { text-shadow: none; color: var(--ink); }
body.show-on .app-main .card .eyebrow { color: var(--ink-soft); }
body.show-on .btn--ghost { background: rgba(255, 255, 255, .92); color: var(--ink); }

/* ステージ（ナナコロと仲間） */
body.show-on .show-stage {
  display: block; max-width: 760px; margin: 0 auto; height: 108px;
}
@media (min-width: 760px) { body.show-on .show-stage { height: 136px; } }
.show-stage__actors { position: absolute; inset: 0; }
.show-stage__actors > div { position: absolute; bottom: 0; transition: transform .6s cubic-bezier(.3,1.4,.5,1), opacity .4s; }
.show-stage__actors .nanakoro-svg { width: 100%; height: 100%; overflow: visible; transform: translateY(calc(var(--beat) * -5px)); }
.nanakoro { left: 50%; width: 92px; height: 106px; margin-left: -46px; }
@media (min-width: 760px) { .nanakoro { width: 116px; height: 134px; margin-left: -58px; } }
.nk-body { transform-box: fill-box; transform-origin: 50% 70%; }
.nanakoro-svg [hidden] { display: none; }

.deco-garland { position: absolute; left: 0; right: 0; top: 0; width: 100%; height: 34px; opacity: 0; transform: translateY(-20px); transition: opacity .6s, transform .6s; }
body.lv-3 .deco-garland { opacity: 1; transform: none; }

/* 背景側の飾り：光の柱（ゆっくり動く。点滅しない） */
.show-decor { position: absolute; inset: 0; overflow: hidden; }
.deco-beams { position: absolute; inset: 0; opacity: 0; transition: opacity 1.2s; }
.deco-beams span { position: absolute; bottom: -10%; left: 50%; width: 18vmax; height: 130vmax; margin-left: -9vmax; transform-origin: 50% 100%; background: linear-gradient(to top, rgba(255, 240, 180, .32), rgba(255, 240, 180, 0)); animation: beam 7s ease-in-out infinite alternate; }
.deco-beams span:nth-child(1) { --a: -38deg; } .deco-beams span:nth-child(2) { --a: -14deg; animation-delay: -2s; }
.deco-beams span:nth-child(3) { --a: 14deg; animation-delay: -4s; } .deco-beams span:nth-child(4) { --a: 38deg; animation-delay: -6s; }
body.lv-9 .deco-beams { opacity: 1; }
@keyframes sway { from { transform: rotate(-6deg); } to { transform: rotate(6deg); } }
@keyframes beam { from { transform: rotate(calc(var(--a) - 8deg)); } to { transform: rotate(calc(var(--a) + 8deg)); } }

/* HUD */
.hud { background: rgba(14, 20, 52, .78); border: 1px solid rgba(255, 255, 255, .18); border-radius: var(--radius); padding: 10px 14px; color: #fff; }
.hud__row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.hud__unit { font-weight: 800; }
.hud__tools { display: flex; gap: 8px; align-items: center; }
.hud .progress { margin: 6px 0 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 10px; }
.hud .progress__label { color: #dfe5f5; }
.hud .progress__dots { width: 100%; }
.hud__level { font-size: .78rem; font-weight: 800; color: var(--gold); letter-spacing: .05em; }
.hud .progress__dot { background: rgba(255, 255, 255, .16); color: #dfe5f5; }
.hud .progress__dot.is-current { background: #fff; color: var(--navy); border-color: var(--gold); }
.hud .progress__dot.is-ok { background: var(--ok-soft); color: var(--ok); }
.hud .progress__dot.is-ng { background: var(--ng-soft); color: var(--ng); }
/* プレイ中の音のパネル */
.hud__row { position: relative; }
.audio-panel {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 30; width: min(320px, calc(100vw - 56px));
  display: grid; gap: 12px; padding: 14px; background: var(--surface); color: var(--ink);
  border: 2px solid var(--ink); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
}
.audio-panel[hidden] { display: none; }
.icon-btn { min-width: 44px; min-height: 40px; border-radius: 10px; border: 2px solid rgba(255, 255, 255, .5); background: rgba(255, 255, 255, .1); color: #fff; font-size: 1.1rem; cursor: pointer; }
.btn--on-dark { min-height: 40px; }
.question-card { border: 3px solid var(--ink); }
body.show-on .choice { border-color: var(--ink); }
body.show-on .kbd-hint { color: #dfe5f5; }

/* 開始前の選択 */
.ready h1 { margin-bottom: .3em; }
.ready__choices { display: grid; gap: 10px; margin: 14px 0; }
@media (min-width: 560px) { .ready__choices { grid-template-columns: 1fr 1fr; } }
.btn--big { min-height: 64px; font-size: 1.1rem; }

/* 大きなほめ言葉・励まし */
body.show-on .show-praise {
  display: grid; position: fixed; left: 0; right: 0; top: 16%; z-index: 45; pointer-events: none;
  justify-items: center; text-align: center; opacity: 0; visibility: hidden;
}
.show-praise.is-on { opacity: 1; visibility: visible; animation: praise-pop 1.3s ease-out both; }
.praise-main {
  font-size: clamp(2.6rem, 12vw, 5rem); font-weight: 900; line-height: 1.1; color: #fff;
  -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; text-shadow: 0 6px 0 var(--ink), 0 0 30px rgba(255, 220, 120, .6);
  letter-spacing: .04em;
}
.show-praise.lvl-1 .praise-main { color: var(--gold); }
.show-praise.lvl-2 .praise-main, .show-praise.lvl-3 .praise-main {
  background: linear-gradient(90deg, #ffe066, #ff7a8a, #8f7cff, #4fc3c8, #7ad37a); -webkit-background-clip: text; background-clip: text; color: transparent;
  -webkit-text-stroke: 2px var(--ink); font-size: clamp(3rem, 14vw, 5.8rem);
}
.show-praise.is-ng .praise-main { color: #ffd6a8; background: none; -webkit-text-stroke: 3px var(--ink); font-size: clamp(2.2rem, 10vw, 4rem); }
.praise-sub { margin-top: 8px; background: var(--ink); color: #fff; font-weight: 800; padding: 4px 14px; border-radius: 999px; font-size: .95rem; }
@keyframes praise-pop {
  0% { transform: scale(.4) rotate(-8deg); opacity: 0; }
  14% { transform: scale(1.12) rotate(2deg); opacity: 1; }
  24% { transform: scale(1) rotate(0); }
  80% { transform: scale(1) translateY(0); opacity: 1; }
  100% { transform: scale(.96) translateY(-24px); opacity: 0; }
}
.show-praise.is-ng.is-on { animation-name: praise-wobble; }
@keyframes praise-wobble {
  0% { transform: translateY(-30px) rotate(-6deg); opacity: 0; }
  18% { transform: translateY(6px) rotate(4deg); opacity: 1; }
  32% { transform: translateY(0) rotate(-3deg); }
  46% { transform: rotate(2deg); }
  80% { transform: rotate(0); opacity: 1; }
  100% { transform: translateY(10px); opacity: 0; }
}

/* 段階アップの帯 */
body.show-on .show-band {
  display: flex; position: fixed; left: 0; right: 0; top: 12px; z-index: 45; pointer-events: none;
  flex-direction: column; align-items: center; padding: 8px 0;
  background: linear-gradient(90deg, #23325c, #3b4fa0, #23325c); border-block: 3px solid var(--gold); color: #fff;
  transform: translateX(-110%) skewX(-10deg); opacity: 0;
}
.show-band.is-on { animation: band 1.7s cubic-bezier(.2,.9,.3,1) both; }
.show-band.is-last { background: linear-gradient(90deg, #a8261b, #e2493b, #a8261b); }
.band-sub { font-size: .8rem; letter-spacing: .2em; color: var(--gold); font-weight: 800; }
.band-main { font-size: 1.4rem; font-weight: 900; letter-spacing: .08em; }
@keyframes band { 0% { transform: translateX(-110%) skewX(-10deg); opacity: 1; } 18% { transform: translateX(0) skewX(-10deg); } 80% { transform: translateX(0) skewX(-10deg); opacity: 1; } 100% { transform: translateX(110%) skewX(-10deg); opacity: 1; } }
html[data-motion="reduce"] .show-band.is-on { opacity: 1; transform: none; }

/* フィナーレのスタンプ */
body.show-on .show-stamp {
  display: grid; position: fixed; inset: 0; z-index: 46; place-content: center; text-align: center; pointer-events: none;
  opacity: 0; visibility: hidden;
}
.show-stamp.is-on { opacity: 1; visibility: visible; animation: stamp 2s cubic-bezier(.2,1.4,.4,1) both; }
.stamp-main { font-size: clamp(2.6rem, 13vw, 6rem); font-weight: 900; color: var(--gold); -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; text-shadow: 0 8px 0 var(--ink); transform: rotate(-6deg); display: block; }
.stamp-sub { font-size: 1.3rem; font-weight: 900; color: #fff; -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; }
@keyframes stamp { 0% { transform: scale(2.4); opacity: 0; } 30% { transform: scale(.92); opacity: 1; } 42% { transform: scale(1.04); } 55% { transform: scale(1); } 88% { opacity: 1; } 100% { opacity: 0; transform: scale(1.05); } }

/* 結果のフィナーレ：順番に現れる */
.fin-hide { opacity: 0; visibility: hidden; transform: translateY(16px); }
.result [data-fin] { transition: opacity .45s ease-out, transform .45s ease-out, visibility .45s; }
.fx-slam { animation: slam .55s cubic-bezier(.2,1.5,.4,1) both; }
@keyframes slam { from { transform: scale(1.6) rotate(-4deg); opacity: 0; } to { transform: none; opacity: 1; } }
.skip-finale { position: fixed; right: 12px; bottom: calc(var(--bottom-nav-h) + 12px + env(safe-area-inset-bottom)); z-index: 47; }
@media (min-width: 760px) { .skip-finale { bottom: 16px; } }
.score__ring b { font-size: inherit; }


/* 演出の強さが低い・0 のとき */
html[data-motion="low"] .deco-beams span { animation-duration: 14s; }
html[data-motion="reduce"] .show-stage__actors .nanakoro-svg { transform: none; }
html[data-motion="reduce"] .show-stage__actors > div { transition: none; }

/* 修正: 画面外で待機する仲間が横にはみ出さないようにする（スマホで縮小表示になるのを防ぐ） */
html, body { overflow-x: clip; }
body.show-on .show-stage { overflow-x: clip; overflow-y: visible; }
/* 修正: 表示状態のほうを強くする */
body.show-on .show-praise.is-on, body.show-on .show-stamp.is-on { opacity: 1; visibility: visible; }
/* 背景の上でも選択肢が透けないよう、選ばなかった選択肢は不透明のまま文字だけ薄くする */
body.show-on .choice { background: #fff; }
body.show-on .choice.is-dim { opacity: 1; background: #eceae4; color: #5c6478; }
body.show-on .choice.is-correct { background: var(--ok-soft); }
body.show-on .choice.is-wrong { background: var(--ng-soft); }

/* ほめ言葉：背景が白いカードの上でも読めるよう、濃い帯の上に出す */
body.show-on .show-praise { top: 9%; }
.show-praise.is-on { background: radial-gradient(ellipse at center, rgba(14, 20, 52, .82) 0, rgba(14, 20, 52, .55) 55%, rgba(14, 20, 52, 0) 75%); padding: 10px 0 18px; }
.praise-cast { display: flex; align-items: flex-end; justify-content: center; gap: 4px; height: 96px; }
.praise-nanakoro { width: 84px; height: 98px; }
.praise-friend { width: 58px; height: 68px; }
.praise-cast svg { width: 100%; height: 100%; overflow: visible; }
.show-praise.is-on .praise-nanakoro { animation: cast-jump .9s cubic-bezier(.3,1.5,.5,1) both; }
.show-praise.is-on.lvl-2 .praise-nanakoro, .show-praise.is-on.lvl-3 .praise-nanakoro { animation-name: cast-spin; }
.show-praise.is-on .praise-friend { animation: cast-jump .9s .12s cubic-bezier(.3,1.5,.5,1) both; }
.show-praise.is-on.is-ng .praise-nanakoro { animation: cast-trip 1s ease-out both; }
@keyframes cast-jump { 0% { transform: translateY(40px) scale(.6); opacity: 0; } 35% { transform: translateY(-26px) scale(1.08); opacity: 1; } 60% { transform: translateY(0) scale(1.04, .94); } 100% { transform: none; } }
@keyframes cast-spin { 0% { transform: translateY(40px) rotate(0) scale(.6); opacity: 0; } 45% { transform: translateY(-34px) rotate(300deg) scale(1.1); opacity: 1; } 70% { transform: translateY(0) rotate(360deg); } 100% { transform: rotate(360deg); } }
@keyframes cast-trip { 0% { transform: translateY(-30px); opacity: 0; } 20% { transform: translateY(0) rotate(0); opacity: 1; } 40% { transform: rotate(-28deg) translateX(-8px) scale(1.05, .9); } 60% { transform: rotate(12deg); } 80% { transform: rotate(-4deg) translateY(-8px); } 100% { transform: none; } }

/* 結果画面（背景の上）の文字色 */
body.show-on .review-list li { color: var(--ink); background: rgba(255, 255, 255, .95); }
body.show-on .app-main .unlock-card .eyebrow { color: #6a5212; }
.score__ring > span { white-space: nowrap; }

/* 調整: ほめ言葉は画面上部（HUDのあたり）に出し、スマホでは少し小さく */
body.show-on .show-praise { top: 1%; }
@media (max-width: 559px) {
  .praise-cast { height: 76px; }
  .praise-nanakoro { width: 66px; height: 78px; }
  .praise-friend { width: 46px; height: 54px; }
  .praise-main { font-size: 2.4rem; }
  .show-praise.lvl-2 .praise-main, .show-praise.lvl-3 .praise-main { font-size: 2.8rem; }
}
.stamp-main { white-space: nowrap; font-size: clamp(2rem, 11vw, 6rem); }
.score__ring > span { display: flex; flex-direction: column; align-items: center; justify-content: center; }
.score__num { white-space: nowrap; }

/* =====================================================================
   長く遊べるデモ版（5・10・20問）の追加
   ===================================================================== */
/* 単元カード（中に長さのボタン） */
.unit-card { cursor: default; }
.unit-card:hover { border-color: var(--line); }
.unit-card.is-cleared { border-color: #e2c770; }
.unit-card__head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.badge--clear { background: var(--gold-soft); color: #6a5212; border: 1px solid #ecd9a3; }
.length-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.length-btn {
  font: inherit; cursor: pointer; border-radius: 999px; border: 3px solid #fff; background: var(--accent-grad); color: #fff;
  box-shadow: 0 0 0 2px #fb4a19;
  min-height: 58px; padding: 6px 4px; display: grid; place-items: center; line-height: 1.25; touch-action: manipulation;
}
.length-btn b { font-size: 1.1rem; }
.length-btn small { font-size: .72rem; opacity: .9; }
@media (hover: hover) and (pointer: fine) { .length-btn:hover:not([disabled]) { filter: brightness(1.06); } }
.length-btn.is-off { background: var(--bg-deep); color: var(--ink-soft); border-color: var(--bg-deep); box-shadow: 0 0 0 2px #c9c6c1; cursor: not-allowed; }
.unit-card__limit { font-size: .8rem; color: var(--ink-soft); margin: 6px 0 0; line-height: 1.5; }
.genre-picker { display: grid; gap: 12px; }
.genre-picker h2, .genre-picker p { margin-block: 0; }
.genre-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.genre-option { display: flex; gap: 9px; align-items: center; min-width: 0; padding: 10px; border: 3px solid var(--line); border-radius: 14px; cursor: pointer; background: var(--surface); }
.genre-option:has(input:checked) { border-color: var(--accent); background: #fff1e8; }
.genre-option input { width: 22px; height: 22px; flex: none; }
.genre-option span { display: grid; min-width: 0; }
.genre-option b { overflow-wrap: anywhere; }
.genre-option small { color: var(--ink-soft); }
.mix-actions { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
@media (max-width: 559px) { .mix-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* 20問のときは進捗を細い目盛りにする */
.progress__dots.is-many { gap: 3px; }
.progress__dots.is-many .progress__dot { height: 14px; border-radius: 4px; border-width: 1px; }

/* リアクション中 */
.reaction-catcher { position: fixed; inset: 0; z-index: 44; background: transparent; cursor: pointer; touch-action: manipulation; }
.reaction-catcher[hidden] { display: none; }
.reaction-skip-row { position: fixed; left: 16px; right: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); max-width: 560px; margin: 0 auto; z-index: 47; display: grid; gap: 4px; }
.reaction-spacer { height: 90px; }
.reaction-skip-row .btn { position: relative; z-index: 46; box-shadow: 0 6px 18px rgba(0, 0, 0, .35); border: 2px solid var(--gold); }
.reaction-hint { margin: 0; text-align: center; font-size: .8rem; color: #fff; text-shadow: 0 1px 2px #000; }
body.show-on .play.is-reacting .choices { pointer-events: none; }
body.has-feedback-modal { overflow: hidden; }

/* コンボの追加演出（ほめ言葉のまわりに金の縁） */
.show-praise.combo-1 .praise-sub, .show-praise.combo-2 .praise-sub, .show-praise.combo-3 .praise-sub { background: linear-gradient(90deg, #a8261b, #e2493b); border: 2px solid var(--gold); }
.show-praise.combo-3 .praise-main { font-size: clamp(3.2rem, 15vw, 6.4rem); }
.show-praise.lvl-4 .praise-main {
  background: linear-gradient(90deg, #ffe066, #ff7a8a, #8f7cff, #4fc3c8, #7ad37a, #ffe066); -webkit-background-clip: text; background-clip: text; color: transparent;
  -webkit-text-stroke: 2px var(--ink);
}

/* 仲間は最大6人（L11 以上で5・6人目） */
.show-parade { display: block; position: fixed; left: 0; right: 0; bottom: 6px; height: 80px; z-index: 39; pointer-events: none; overflow: hidden; opacity: 0; }
.show-parade.is-on { opacity: 1; }
.parader { position: absolute; bottom: 0; width: 60px; height: 70px; left: -80px; }
.parader svg { width: 100%; height: 100%; overflow: visible; }
.show-parade.is-on .parader { animation: parade 2.6s linear both; animation-delay: calc(var(--i) * 0.12s); }
@keyframes parade { 0% { transform: translateX(0) translateY(0); } 25% { transform: translateX(30vw) translateY(-14px); } 50% { transform: translateX(60vw) translateY(0); } 75% { transform: translateX(90vw) translateY(-14px); } 100% { transform: translateX(calc(100vw + 120px)) translateY(0); } }
.show-parade { display: none; }

/* ラストスパート：画面の縁がゆっくり赤金に灯る（点滅させない） */
body.show-on.is-spurt .show-layer::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 80px 10px rgba(226, 73, 59, .55), inset 0 0 160px 30px rgba(242, 193, 78, .25);
  animation: spurt-glow 2.4s ease-in-out infinite alternate;
}
@keyframes spurt-glow { from { opacity: .55; } to { opacity: 1; } }

/* 短い復習のフィナーレは控えめなスタンプ */
.show-stamp.is-small .stamp-main { font-size: clamp(1.8rem, 9vw, 3.6rem); color: #a8f0ff; }

/* 結果：次の目標 */
.clear-badge { display: inline-block; background: var(--gold-soft); border: 2px solid var(--gold); color: #6a5212; font-weight: 800; border-radius: 999px; padding: 2px 12px; margin: 0; }
.goals h2 { margin-bottom: .3em; }
.goal-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.goal { display: grid; gap: 8px; padding: 12px; border-radius: var(--radius-sm); background: var(--bg); border-left: 5px solid var(--navy); font-size: .95rem; line-height: 1.6; }
.goal--review-missed { border-left-color: var(--ng); }
.goal--clear-unit, .goal--next-unit { border-left-color: var(--science); }
.goal--achievement { border-left-color: var(--gold); }
.goal .btn { justify-self: start; }
.goal-card h2 { margin-bottom: .2em; }

/* スマホで押しやすく：選択肢と次へを大きく */
@media (max-width: 559px) {
  .choice { min-height: 58px; font-size: 1.05rem; }
  .btn--big { min-height: 60px; }
}

/* 私的プレビュー（素材由来の問題） */
.unit-field { margin: 18px 0 8px; font-size: 1.05rem; border-left: 5px solid var(--navy); padding-left: 10px; }
.feedback__source { font-size: .78rem; color: var(--ink-soft); background: var(--bg-deep); border-radius: 8px; padding: 6px 10px; margin: 0 0 12px; line-height: 1.5; word-break: break-all; }
body.is-private-preview .demo-strip { background: #7a1f16; }
body.is-private-preview .demo-strip strong { background: #ffd6a8; }

/* 正解の手応え：選択肢のはね・カードのはずみ・画面のゆれ・正解の印（show.js の hit()） */
.choice.fx-hit { position: relative; z-index: 3; animation: choice-hit .7s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes choice-hit {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(242, 193, 78, .9); }
  25% { transform: scale(1.12) rotate(-1.5deg); box-shadow: 0 0 0 10px rgba(242, 193, 78, .75), 0 0 36px 12px rgba(255, 236, 160, .7); }
  55% { transform: scale(.97) rotate(.8deg); }
  100% { transform: scale(1); box-shadow: 0 0 0 22px rgba(242, 193, 78, 0), 0 0 0 0 rgba(255, 236, 160, 0); }
}
.question-card.fx-bounce { animation: card-bounce .5s cubic-bezier(.3, 1.5, .5, 1) both; }
@keyframes card-bounce { 0% { transform: none; } 30% { transform: scale(1.03, .96) translateY(4px); } 60% { transform: scale(.99, 1.02) translateY(-3px); } 100% { transform: none; } }
#main.fx-shake { animation: screen-shake .45s linear both; }
@keyframes screen-shake {
  0% { translate: 0 0; }
  12% { translate: calc(var(--shake) * -1) calc(var(--shake) * .6); }
  25% { translate: var(--shake) calc(var(--shake) * -.5); }
  38% { translate: calc(var(--shake) * -.7) calc(var(--shake) * -.4); }
  52% { translate: calc(var(--shake) * .5) calc(var(--shake) * .4); }
  68% { translate: calc(var(--shake) * -.3) 0; }
  84% { translate: calc(var(--shake) * .15) 0; }
  100% { translate: 0 0; }
}
.fx-seal {
  position: fixed; z-index: 41; width: 0; height: 0; pointer-events: none;
  animation: seal-life .95s ease-out both;
}
.fx-seal__rays, .fx-seal__ring { position: absolute; left: 50%; top: 50%; border-radius: 50%; }
.fx-seal__rays {
  width: calc(260px * var(--s)); height: calc(260px * var(--s)); margin: calc(-130px * var(--s)) 0 0 calc(-130px * var(--s));
  background: repeating-conic-gradient(rgba(255, 228, 140, .85) 0 8deg, rgba(255, 228, 140, 0) 8deg 22deg);
  -webkit-mask: radial-gradient(circle, transparent 28%, #000 32%, #000 52%, transparent 72%);
  mask: radial-gradient(circle, transparent 28%, #000 32%, #000 52%, transparent 72%);
  animation: seal-rays .95s ease-out both;
}
.fx-seal__ring {
  width: calc(120px * var(--s)); height: calc(120px * var(--s)); margin: calc(-60px * var(--s)) 0 0 calc(-60px * var(--s));
  display: grid; place-items: center; border: calc(9px * var(--s)) solid #e2493b; box-shadow: 0 0 0 calc(4px * var(--s)) #fff, 0 6px 22px rgba(0, 0, 0, .35);
  background: rgba(255, 255, 255, .92);
  animation: seal-slam .95s cubic-bezier(.2, 1.4, .4, 1) both;
}
.fx-seal__text { font-weight: 900; font-size: calc(2.1rem * var(--s)); color: #e2493b; letter-spacing: .04em; transform: rotate(-12deg); }
@keyframes seal-slam { 0% { transform: scale(2.6) rotate(-30deg); opacity: 0; } 22% { transform: scale(.9) rotate(4deg); opacity: 1; } 34% { transform: scale(1.06) rotate(-2deg); } 46% { transform: scale(1); } 100% { transform: scale(1); } }
@keyframes seal-rays { 0% { transform: scale(.3) rotate(0); opacity: 0; } 25% { opacity: 1; } 100% { transform: scale(1.25) rotate(70deg); opacity: 0; } }
@keyframes seal-life { 0%, 78% { opacity: 1; } 100% { opacity: 0; } }
html[data-motion="reduce"] .fx-seal { display: none; }

/* 問題文をターミナルのように1文字ずつ出す（app.js の startTyping）。点滅は1秒に1回のゆっくりしたもの */
.question.is-typing { cursor: pointer; }
.type-caret {
  display: inline-block; width: .55em; height: 1.05em; margin-left: 2px; vertical-align: -.15em;
  background: var(--navy); border-radius: 1px; animation: caret-blink 1s steps(1, end) infinite;
}
@keyframes caret-blink { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }
.type-rest { visibility: hidden; }

/* 上部の帯は画面を圧迫するため表示しない。文言はトップページのお知らせ（#dialog-notice）で出す。
   私的プレビューだけは「公開禁止」を常に見せるため帯を残す */
body:not(.is-private-preview) .demo-strip { display: none; }
.dialog--notice h2 {
  display: inline-block; background: var(--gold); color: var(--navy);
  padding: 2px 12px; border-radius: 999px; font-size: 1rem; margin: 0 0 10px;
}
.dialog--notice p { line-height: 1.7; margin: 0 0 14px; }
.notice-dismiss { display: flex; align-items: center; gap: 8px; font-size: .92rem; cursor: pointer; }
.notice-dismiss input { width: 20px; height: 20px; margin: 0; }

/* プレイ画面：問題と四択のあいだを空け、四択は画面の下に寄せて片手で押しやすくする（高さは app.js が --play-top で渡す） */
.stack.play { display: flex; flex-direction: column; gap: 16px; min-height: calc(100dvh - var(--play-top, 0px) - 56px - env(safe-area-inset-bottom)); }
.stack.play > * + * { margin-top: 0; }
.play .choices { margin-top: auto; }

/* 右上の名前ボタンとメニュー（プロフィール・ログイン／ログアウト） */
.player-chip { position: relative; }
.player-chip__btn {
  display: inline-flex; align-items: center; gap: 6px; min-width: 0; max-width: 100%;
  font: inherit; color: inherit; background: transparent; cursor: pointer;
  border: 2px solid rgba(255, 255, 255, .35); border-radius: 999px; padding: 4px 10px 4px 12px; min-height: 40px;
}
.player-chip__btn[aria-expanded="true"] { border-color: var(--accent); }
.player-chip__caret { font-size: .7rem; opacity: .8; }
.player-menu {
  position: absolute; right: 0; top: calc(100% + 10px); z-index: 60; min-width: 190px;
  background: var(--surface); color: var(--ink); border: 3px solid var(--ink); border-radius: 16px;
  padding: 6px; display: grid; gap: 2px; box-shadow: 0 10px 28px rgba(0, 0, 0, .25); text-align: left;
}
.player-menu[hidden] { display: none; }
.player-menu__item {
  display: block; width: 100%; font: inherit; font-weight: 800; font-size: .95rem; color: var(--ink); text-decoration: none;
  background: transparent; border: 0; border-radius: 10px; padding: 10px 12px; text-align: left; cursor: pointer;
}
.player-menu__item:focus-visible, .player-menu__item:active { background: var(--bg-deep); }
@media (hover: hover) and (pointer: fine) { .player-menu__item:hover:not([disabled]) { background: var(--bg-deep); } }
.player-menu__item[disabled] { color: var(--ink-soft); cursor: not-allowed; }
.player-menu__note { margin: 0; padding: 0 12px 6px; font-size: .78rem; color: var(--ink-soft); line-height: 1.5; }

/* きみのがんばり：連続日数・レベル・直近14日のグラフ・これまでの数字 */
.progress-card h2 { margin-bottom: 10px; }
.progress-top { display: grid; grid-template-columns: auto 1fr; gap: 14px; align-items: center; }
.streak {
  display: grid; grid-template-columns: auto auto; grid-template-rows: auto auto; column-gap: 6px; align-items: end;
  background: var(--accent-grad); color: #fff; border: 3px solid var(--ink); border-radius: 18px; padding: 8px 14px;
}
.streak__icon { grid-row: span 2; font-size: 1.8rem; line-height: 1; align-self: center; }
.streak__num { font-size: 2rem; font-weight: 900; line-height: 1; }
.streak__unit { grid-column: 2; font-size: .78rem; font-weight: 800; }
.streak.is-zero { background: var(--bg-deep); color: var(--ink); }
.xpbox__level { margin: 0; font-weight: 900; font-size: .9rem; }
.xpbox__level b { font-size: 1.5rem; }
.xpbar { height: 14px; border: 2px solid var(--ink); border-radius: 999px; background: var(--surface); overflow: hidden; margin: 2px 0 2px; }
.xpbar > span { display: block; height: 100%; background: var(--accent-grad); }
.xpbox__note { margin: 0; font-size: .78rem; color: var(--ink-soft); }
.progress-cheer { margin: 12px 0 8px; font-weight: 900; }
.daychart { margin: 0; }
.daychart__bars { display: grid; grid-template-columns: repeat(14, minmax(0, 1fr)); gap: 4px; align-items: end; height: 110px; padding: 6px 0 0; border-bottom: 2px solid var(--ink); }
.daychart__day { display: grid; grid-template-rows: 1fr auto; height: 100%; min-width: 0; }
.daychart__bar { align-self: end; background: #f3d9c8; border-radius: 6px 6px 0 0; min-height: 3px; display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; }
.daychart__bar > span { display: block; background: var(--accent-grad); }
.daychart__label { font-size: .62rem; text-align: center; color: var(--ink-soft); line-height: 1.6; white-space: nowrap; }
.daychart__day.is-today .daychart__label { color: var(--ink); font-weight: 900; }
.daychart__day.is-today .daychart__bar { box-shadow: 0 0 0 2px var(--ink); }
.daychart figcaption { font-size: .8rem; color: var(--ink-soft); margin-top: 6px; }
.stat-tiles { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.stat-tiles li { border: 2px solid var(--ink); border-radius: 14px; padding: 8px 6px; text-align: center; display: grid; gap: 2px; background: var(--surface); }
.stat-tiles__value { font-size: 1.35rem; font-weight: 900; line-height: 1.2; }
.stat-tiles__value small { font-size: .7rem; margin-left: 2px; }
.stat-tiles__label { font-size: .7rem; color: var(--ink-soft); line-height: 1.3; }

/* プロフィール */
.profile-card { display: grid; gap: 8px; }
.profile-card__title { word-break: keep-all; margin: 0; color: var(--accent); font-weight: 900; font-size: 1.05rem; }
.profile-card__name { margin: 0; font-size: 1.8rem; }
.profile-card__xp { margin: 0; font-weight: 800; color: var(--ink-soft); }
.profile-card__xp b { color: var(--ink); font-size: 1.15rem; }
.title-chips { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.title-chips li { border: 2px solid var(--ink); border-radius: 999px; padding: 2px 12px; font-weight: 800; font-size: .88rem; background: var(--surface); }
.title-chips li.is-equipped { background: var(--ink); color: var(--gold); }

/* 理社クイズについて */
.about-list { margin: 0; padding-left: 1.2em; display: grid; gap: 8px; }
.about-list li { line-height: 1.7; }
.notice-about { margin: 0 0 10px; font-size: .9rem; font-weight: 800; }
.notice-about a { color: var(--accent); }

/* ---- ゴールド・ことばガチャ・二つ名（レア度は5段階で色分け） ---- */
.rar--common { --rc: #78716c; --rc-soft: #f1efed; }
.rar--uncommon { --rc: #1f8a46; --rc-soft: #e0f4e7; }
.rar--rare { --rc: #2563c9; --rc-soft: #e2ecfb; }
.rar--epic { --rc: #8a3fd1; --rc-soft: #f0e5fb; }
.rar--legend { --rc: #c98a00; --rc-soft: #fff3cc; }
.profile-card__title .rar { color: var(--rc); }

.gold-coin {
  display: inline-grid; place-items: center; flex: none;
  width: 1.6em; height: 1.6em; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #ffe28a, #f2b705 60%, #c98a00);
  border: 2px solid var(--ink); color: var(--ink); font-weight: 900; font-size: .85rem; line-height: 1;
}
.gold-inline { display: inline-flex; align-items: center; gap: 4px; }
.gold-link, .gold-gain {
  display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink);
  border: 3px solid var(--ink); border-radius: var(--radius-sm); background: var(--gold-soft);
  padding: 10px 14px; margin: 0 0 12px; font-weight: 800;
}
.gold-link__num { white-space: nowrap; }
.gold-link__num b, .gold-gain b { font-size: 1.25rem; }
.gold-link__go { white-space: normal !important; text-align: right; }
.gold-link__go, .gold-gain__go { margin-left: auto; color: var(--accent); white-space: nowrap; font-size: .9rem; }
.gold-gain small { display: block; font-weight: 600; color: var(--ink-soft); font-size: .75rem; }

.gacha-machine { display: grid; gap: 12px; text-align: center; }
.gacha-gold { margin: 0; display: flex; justify-content: center; align-items: center; gap: 6px; font-weight: 800; }
.gacha-gold b { font-size: 1.6rem; }
.gacha-stage { min-height: 190px; display: grid; place-items: center; }
.capsule {
  --rc: var(--accent);
  width: 120px; height: 120px; border-radius: 50%; border: 4px solid var(--ink);
  background: linear-gradient(180deg, var(--rc) 0 50%, #fff 50% 100%);
  position: relative; box-shadow: var(--shadow);
}
.capsule span { position: absolute; left: -4px; right: -4px; top: calc(50% - 4px); height: 8px; background: var(--ink); }
.capsule.rar--common, .capsule--common { --rc: #a8a29e; }
.capsule--uncommon { --rc: #1f8a46; }
.capsule--rare { --rc: #2563c9; }
.capsule--epic { --rc: #8a3fd1; }
.capsule--legend { --rc: #f2b705; }
.capsule.is-shaking { animation: capsule-shake .55s ease-in-out 2; }
@keyframes capsule-shake {
  0%, 100% { transform: rotate(0); }
  20% { transform: rotate(-14deg) translateY(-4px); }
  40% { transform: rotate(12deg); }
  60% { transform: rotate(-8deg) translateY(-2px); }
  80% { transform: rotate(6deg); }
}
.pull-card {
  width: min(100%, 320px); display: grid; gap: 6px; padding: 18px 16px;
  border: 4px solid var(--rc); border-radius: var(--radius); background: var(--rc-soft);
  box-shadow: 0 6px 0 var(--rc);
}
.pull-card.rar--legend { background: linear-gradient(135deg, #fff8dc, #ffe08a 50%, #fff3cc); }
.pull-card.is-new { animation: pull-pop .5s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes pull-pop { from { transform: scale(.4) rotate(-6deg); opacity: 0; } to { transform: none; opacity: 1; } }
.pull-card__rarity { color: var(--rc); font-weight: 900; letter-spacing: .05em; }
.pull-card__slot { font-size: .8rem; color: var(--ink-soft); font-weight: 700; }
.pull-card__text { font-size: 1.7rem; font-weight: 900; line-height: 1.3; }
.pull-card__note { font-size: .85rem; font-weight: 700; }
@media (prefers-reduced-motion: reduce) { .capsule.is-shaking, .pull-card.is-new { animation: none; } }

.odds { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.odds li { display: flex; justify-content: space-between; padding: 6px 12px; border-radius: 999px; border: 2px solid var(--rc); background: var(--rc-soft); color: var(--rc); font-weight: 800; }

.zukan-slot { font-size: .95rem; margin: 12px 0 6px; }
.zukan { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.zukan li { border: 2px solid var(--rc); background: var(--rc-soft); color: var(--ink); border-radius: 999px; padding: 2px 10px; font-size: .85rem; font-weight: 700; }
.zukan li.is-unknown { background: var(--surface); color: var(--rc); border-style: dashed; opacity: .75; }

.plate-builder { display: grid; gap: 10px; }
.plate-slot { border: 0; margin: 0; padding: 0; }
.plate-slot legend { font-weight: 900; margin-bottom: 6px; }
.part-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.part-chip:not(.rar) { --rc: var(--ink-soft); --rc-soft: var(--surface); }
.part-chip {
  font: inherit; font-weight: 800; font-size: .9rem; cursor: pointer;
  border: 2px solid var(--rc); background: var(--rc-soft); color: var(--ink);
  border-radius: 999px; padding: 6px 12px; min-height: 40px;
}
.part-chip.is-on { background: var(--rc); color: #fff; box-shadow: 0 0 0 3px var(--ink); }
.part-chip--none.is-on { background: var(--ink); }

/* 管理画面（運営者だけ） */
.admin-reauth { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; }
.admin-reauth[hidden] { display: none; }
.admin-tabs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
@media (min-width: 560px) { .admin-tabs { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.admin-tab {
  display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 6px 10px;
  border: 2px solid var(--ink); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink);
  font-weight: 700; font-size: .92rem; text-decoration: none;
}
.admin-tab[aria-current="page"] { background: var(--ink); color: #fff; }
.admin-badge { min-width: 22px; padding: 0 6px; border-radius: 999px; background: var(--accent); color: #fff; font-size: .8rem; line-height: 22px; text-align: center; }
.admin-filter { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.admin-filter a { padding: 6px 2px; color: var(--ink-soft); font-size: .92rem; }
.admin-filter a[aria-current="true"] { color: var(--ink); font-weight: 700; }
.admin-card > * + * { margin-top: 10px; }
.admin-meta { display: flex; flex-wrap: wrap; gap: 2px 12px; margin: 0; color: var(--ink-soft); font-size: .85rem; }
.admin-meta b { color: var(--ink); font-size: 1rem; }
.admin-meta code { overflow-wrap: anywhere; }
.admin-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.admin-text--soft { color: var(--ink-soft); font-size: .92rem; }
.admin-question summary { cursor: pointer; font-weight: 700; font-size: .9rem; overflow-wrap: anywhere; }
.admin-question > * + * { margin-top: 8px; }
.admin-choices { margin: 0; padding: 0; list-style: none; }
.admin-choices li { padding: 4px 0; border-top: 1px solid rgba(28, 25, 23, .15); overflow-wrap: anywhere; }
.admin-choices .is-correct { color: var(--ok); font-weight: 700; }
.admin-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.admin-reply, .admin-input {
  width: 100%; padding: 10px 12px; border: 2px solid var(--ink); border-radius: 12px; background: #fff; color: var(--ink); font: inherit;
}
.admin-input { flex: 1 1 160px; width: auto; min-width: 0; }
.admin-user { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.admin-user > * + * { margin-top: 0; }
.admin-user b { overflow-wrap: anywhere; }

/* 音量（BGM・効果音） */
.audio-row { display: grid; gap: 4px; }
.audio-row + .audio-row { margin-top: 8px; }
.audio-row__ctl { display: flex; align-items: center; gap: 10px; }
.audio-row__ctl input[type="range"] { flex: 1; min-width: 0; }
.audio-mute {
  flex: none; min-height: 40px; min-width: 112px; padding: 4px 10px; font: inherit; font-size: .85rem; font-weight: 700;
  color: var(--ink); background: var(--surface); border: 2px solid var(--line); border-radius: 10px; cursor: pointer;
}
.audio-mute[aria-pressed="true"] { background: var(--gold-soft); border-color: var(--gold); }

/* 結果：けいけんちのゲージ */
.xp-gain { display: grid; gap: 8px; margin-bottom: 10px; position: relative; overflow: hidden; }
.xp-gain__head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.xp-gain__label { font-weight: 900; }
.xp-gain__plus { font-size: 1.7rem; font-weight: 900; color: var(--accent); font-variant-numeric: tabular-nums; }
.xp-gain__row { display: flex; align-items: center; gap: 12px; }
.xp-gain__level { flex: none; font-weight: 900; font-size: .95rem; }
.xp-gain__level b { font-size: 1.7rem; font-variant-numeric: tabular-nums; }
.xp-gain__level.is-pop { animation: xp-pop .55s cubic-bezier(.2, 1.6, .4, 1); color: var(--accent); }
.xpbar--big { flex: 1; height: 24px; margin: 0; border-width: 3px; }
.xp-gain__note { margin: 0; font-size: .82rem; color: var(--ink-soft); text-align: right; font-variant-numeric: tabular-nums; }
.xp-gain.is-levelup { animation: xp-flash .7s ease-out; }
.levelup {
  margin: 0; padding: 6px 10px; text-align: center; font-size: 1.35rem; font-weight: 900; color: var(--navy);
  background: var(--gold); border: 2px solid var(--ink); border-radius: 10px; animation: slam .5s cubic-bezier(.2, 1.5, .4, 1) both;
}
.levelup[hidden] { display: none; }
.levelup small { display: block; font-size: .85rem; font-weight: 800; }
@keyframes xp-pop { 0% { transform: scale(1); } 45% { transform: scale(1.5); } 100% { transform: scale(1); } }
@keyframes xp-flash { 0% { box-shadow: 0 0 0 0 rgba(242, 193, 78, .95); } 100% { box-shadow: 0 0 0 26px rgba(242, 193, 78, 0); } }
html[data-motion="reduce"] .levelup, html[data-motion="reduce"] .xp-gain.is-levelup, html[data-motion="reduce"] .xp-gain__level.is-pop { animation: none; }

/* 解説の「次へ」と「ここで終わる」の間をあける */
.feedback #next-btn + .btn { margin-top: 10px; }

/* フラッシュカード */
.flash-start { margin-top: 10px; }
.goal-card .flash-start { margin-top: 8px; }
.stack.flash { display: flex; flex-direction: column; gap: 16px; min-height: calc(100dvh - var(--flash-top, 0px) - 24px); }
.flash__hud { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.flash__where { display: grid; gap: 2px; min-width: 0; }
.flash__label { font-weight: 800; overflow-wrap: anywhere; }
.flash__count { color: var(--ink-soft); font-size: .9rem; }
.flash__tools { display: flex; flex-wrap: wrap; gap: 8px; }
.flash__card .question { margin: 0; }
.flash__hint { text-align: center; }
.flash__answer { border: 3px solid var(--accent); }
.flash__answer-head { display: flex; align-items: center; justify-content: space-between; margin: 0 0 4px; }
.flash__answer-head .eyebrow { margin: 0; }
.flash__correct { font-size: 1.5rem; font-weight: 800; line-height: 1.4; margin: 0 0 10px; overflow-wrap: anywhere; }
.flash__explain { margin: 0; line-height: 1.7; }
.flash__bar { position: sticky; bottom: calc(12px + env(safe-area-inset-bottom)); margin-top: auto; z-index: 5; }
.flash__bar .btn[disabled] { opacity: .55; cursor: default; }
.flash-result__tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
.flash-result__tile { display: grid; justify-items: center; gap: 2px; padding: 12px 4px; border: 2px solid var(--ink); border-radius: var(--radius-sm); background: var(--gold-soft); }
.flash-result__tile b { font-size: 1.6rem; line-height: 1.2; }
.flash-result__tile small { color: var(--ink-soft); }

/* 確認コードは長いので、画面からはみ出さないように折り返す */
.receipt-code { display: block; overflow-wrap: anywhere; }

/* 週間ランキング */
.rank-row.is-me { border-color: var(--accent); background: var(--gold-soft); }
.rank-row__name small { font-weight: 600; color: var(--ink-soft); }
.rank-me { border: 3px solid var(--accent); }
.rank-me__label { margin: 0; font-weight: 700; color: var(--ink-soft); }
.rank-me__score { margin: 2px 0 6px; font-size: 1.2rem; }
.rank-me__score b { font-size: 2rem; }

/* 管理画面：問題の修正 */
.admin-question-edit { display: grid; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 2px solid var(--ink); }
.admin-input { width: 100%; min-height: 40px; padding: 8px 10px; border: 2px solid var(--ink); border-radius: 10px; background: var(--surface); font: inherit; }

/* 正解で増える、色違いのナナコロ */
.crowd-member { transform: translateX(-50%); }
.crowd-member .nanakoro-svg { animation: crowd-pop .4s cubic-bezier(.3,1.6,.5,1) both; transform-origin: 50% 90%; }
@keyframes crowd-pop { 0% { scale: 0; } 100% { scale: 1; } }
html[data-motion="reduce"] .crowd-member .nanakoro-svg { animation: none; }
