/* 名画単 — 美術館をイメージした落ち着いた配色 */
:root {
  --bg: #f5f0e6;
  --surface: #fffdf8;
  --surface-2: #ede6d8;
  --ink: #2a2521;
  --ink-2: #6b6158;
  --line: #d9cfbe;
  --accent: #7b2d3b;      /* ワインレッド */
  --accent-ink: #fffdf8;
  --gold: #a7844d;
  --ok: #2f7a4f;
  --ng: #b23a3a;
  --cover: #2f3a4a;       /* まだ開いていないパネル */
  --cover-2: #3b485a;
  --chart: #7b2d3b;
  --grid: #e4dccd;
  --shadow: 0 1px 2px rgba(40, 30, 20, .08), 0 4px 16px rgba(40, 30, 20, .06);
  --radius: 14px;
  /* Mac/iPhone → Windows → Android の順に書体を探す */
  --serif: "Hiragino Mincho ProN", "YuMincho", "Yu Mincho", "Noto Serif JP", "Noto Serif CJK JP", "Source Han Serif JP", "MS PMincho", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Segoe UI", "Yu Gothic UI", "Meiryo", "Noto Sans JP", "Noto Sans CJK JP", Roboto, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a1816;
    --surface: #24211e;
    --surface-2: #2e2a26;
    --ink: #eee7da;
    --ink-2: #a99f92;
    --line: #3e3832;
    --accent: #c9707f;
    --accent-ink: #1a1816;
    --gold: #cfae78;
    --ok: #5fbf86;
    --ng: #e57373;
    --cover: #36404e;
    --cover-2: #434e5e;
    --chart: #d98a97;
    --grid: #34302b;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
  min-height: 100dvh;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }

#app {
  max-width: 560px;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 12px) 16px calc(env(safe-area-inset-bottom) + 32px);
}

/* ヘッダー */
.topbar {
  display: flex; align-items: center; gap: 8px;
  min-height: 44px; margin-bottom: 8px;
}
.topbar .title { flex: 1; font-family: var(--serif); font-size: 18px; font-weight: 600; text-align: center; }
.icon-btn {
  width: 44px; height: 44px; border: 0; background: transparent; border-radius: 12px;
  display: grid; place-items: center; color: var(--ink-2); flex: none;
}
.icon-btn:active { background: var(--surface-2); }
.icon-btn svg { width: 22px; height: 22px; }
.spacer { width: 44px; flex: none; }

/* ホーム */
.hero { text-align: center; padding: 24px 0 20px; }
.logo { font-family: var(--serif); font-size: 44px; font-weight: 700; letter-spacing: .08em; margin: 0; line-height: 1.2; }
.logo small { display: block; font-size: 13px; letter-spacing: .3em; color: var(--gold); font-weight: 400; margin-top: 4px; }
.beta {
  display: inline-block; font-family: var(--sans); font-size: 11px; font-weight: 700; letter-spacing: .05em;
  color: var(--accent-ink); background: var(--gold); border-radius: 6px; padding: 1px 7px; margin-left: 6px; vertical-align: 14px;
}
.greet { color: var(--ink-2); font-size: 14px; margin-top: 10px; }

.section-label { font-size: 13px; color: var(--ink-2); margin: 20px 4px 8px; letter-spacing: .05em; }

.levels { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.level-btn {
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius);
  padding: 14px 12px; text-align: left; box-shadow: var(--shadow); min-height: 76px;
  display: flex; flex-direction: column; gap: 2px;
}
.level-btn:active { transform: scale(.98); }
.level-btn b { font-family: var(--serif); font-size: 19px; }
.level-btn span { font-size: 12px; color: var(--ink-2); }
.level-btn.wide { grid-column: 1 / -1; }
.level-btn[disabled] { opacity: .5; box-shadow: none; cursor: default; background: var(--surface-2); }
.level-btn[disabled]:active { transform: none; }

.menu { display: grid; gap: 10px; }
.menu-btn {
  display: flex; align-items: center; gap: 12px; width: 100%;
  border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius);
  padding: 14px 16px; text-align: left; box-shadow: var(--shadow); min-height: 56px;
}
.menu-btn:active { transform: scale(.99); }
.menu-btn .mi { width: 36px; height: 36px; border-radius: 10px; background: var(--surface-2); display: grid; place-items: center; color: var(--accent); flex: none; }
.menu-btn .mi svg { width: 20px; height: 20px; }
.menu-btn .mt { flex: 1; }
.menu-btn .mt b { display: block; font-weight: 600; }
.menu-btn .mt span { font-size: 12px; color: var(--ink-2); }
.menu-btn .lock { font-size: 11px; color: var(--ink-2); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; white-space: nowrap; }
.menu-btn.locked { opacity: .7; }

.footer-links { display: flex; justify-content: center; gap: 18px; flex-wrap: wrap; margin-top: 28px; font-size: 13px; }
.footer-links button { border: 0; background: none; color: var(--ink-2); text-decoration: underline; padding: 8px 4px; }

/* ボタン */
.btn {
  display: block; width: 100%; border: 0; border-radius: 12px; padding: 14px 16px; min-height: 50px;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 17px;
}
.btn:active { filter: brightness(.92); }
.btn.secondary { background: var(--surface); color: var(--ink); border: 1px solid var(--line); font-weight: 600; }
.btn[disabled] { opacity: .5; }
.btn.btn-ng { opacity: .55; }
.btn + .btn { margin-top: 10px; }
.text-btn { border: 0; background: none; color: var(--ink-2); font-size: 13px; text-decoration: underline; padding: 10px; }

/* 出題 */
.progress-dots { display: flex; justify-content: center; gap: 8px; margin: 4px 0 18px; }
.progress-dots i { width: 28px; height: 6px; border-radius: 3px; background: var(--line); }
.progress-dots i.ok { background: var(--ok); }
.progress-dots i.ng { background: var(--ng); }
.progress-dots i.now { background: var(--ink-2); }

.qcard {
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow);
  padding: 34px 16px 30px; text-align: center; position: relative; overflow: hidden;
}
.qcard .qword { font-family: Georgia, "Times New Roman", var(--serif); font-size: 42px; font-weight: 600; letter-spacing: .01em; word-break: break-word; line-height: 1.2; }
.qcard .qpos { font-size: 12px; color: var(--ink-2); margin-top: 8px; }
.judge {
  position: absolute; inset: 0; display: grid; place-items: center; pointer-events: none;
  font-size: 150px; font-weight: 300; line-height: 1; opacity: 0;
}
.judge.show { animation: judgePop .45s ease-out forwards; }
.judge.ok { color: var(--ok); }
.judge.ng { color: var(--ng); }
@keyframes judgePop { 0% { opacity: 0; transform: scale(.6); } 60% { opacity: .9; transform: scale(1.05); } 100% { opacity: .22; transform: scale(1); } }

.choices { display: grid; gap: 10px; margin-top: 16px; }
.choice {
  border: 1.5px solid var(--line); background: var(--surface); border-radius: 12px; min-height: 56px;
  padding: 12px 16px; text-align: left; font-size: 17px; display: flex; align-items: center; gap: 12px;
}
.choice .n { width: 26px; height: 26px; border-radius: 50%; background: var(--surface-2); display: grid; place-items: center; font-size: 13px; color: var(--ink-2); flex: none; }
.choice:active:not([disabled]) { background: var(--surface-2); }
.choice[disabled] { cursor: default; }
.choice.correct { border-color: var(--ok); background: color-mix(in srgb, var(--ok) 12%, var(--surface)); }
.choice.correct .n { background: var(--ok); color: #fff; }
.choice.wrong { border-color: var(--ng); background: color-mix(in srgb, var(--ng) 10%, var(--surface)); }
.choice.wrong .n { background: var(--ng); color: #fff; }
.choice.dim { opacity: .55; }

.explain {
  margin-top: 14px; background: var(--surface-2); border-radius: 12px; padding: 12px 14px; font-size: 14px;
}
.explain b { font-size: 16px; }
.explain .other { color: var(--ink-2); margin-top: 2px; }
.after-actions { margin-top: 14px; }
.report-link { display: block; margin: 6px auto 0; }

/* 結果 */
.result-head { text-align: center; margin: 10px 0 14px; }
.result-head h2 { font-family: var(--serif); margin: 0; font-size: 26px; }
.result-head p { margin: 4px 0 0; color: var(--ink-2); }
.result-marks { display: flex; justify-content: center; gap: 10px; margin: 14px 0 18px; }
.result-marks span { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; font-size: 26px; font-weight: 700; background: var(--surface); border: 2px solid var(--line); }
.result-marks .ok { color: var(--ok); border-color: var(--ok); }
.result-marks .ng { color: var(--ng); border-color: var(--ng); }
.result-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 16px; }
.result-list div { display: flex; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); align-items: baseline; }
.result-list div:first-child { border-top: 0; }
.result-list .mk { width: 18px; font-weight: 700; flex: none; }
.result-list .mk.ok { color: var(--ok); }
.result-list .mk.ng { color: var(--ng); }
.result-list .w { font-family: Georgia, var(--serif); font-weight: 600; min-width: 96px; }
.result-list .m { color: var(--ink-2); font-size: 14px; }
.notice {
  background: color-mix(in srgb, var(--gold) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--gold) 40%, var(--line));
  border-radius: 12px; padding: 12px 14px; font-size: 14px; margin-bottom: 14px;
}

/* Excellent */
.excellent {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  animation: fadeIn .25s ease-out;
}
.excellent .inner { text-align: center; padding: 16px; }
.excellent h1 {
  font-family: Georgia, "Times New Roman", serif; font-style: italic; font-size: 64px; margin: 0; color: var(--gold);
  animation: exPop .7s cubic-bezier(.2, 1.4, .4, 1) both; text-shadow: 0 2px 0 color-mix(in srgb, var(--gold) 30%, transparent);
}
.excellent p { color: var(--ink-2); margin: 8px 0 24px; animation: fadeIn .4s .5s both; }
.excellent .btn { animation: fadeIn .4s .8s both; max-width: 280px; margin: 0 auto; }
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 51; }
.confetti i { position: absolute; top: -12px; width: 8px; height: 12px; border-radius: 2px; animation: fall linear forwards; }
@keyframes exPop { 0% { transform: scale(.3); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); } }

/* パネル */
.frame {
  background: linear-gradient(145deg, #8a6a3a, #c9a76a 30%, #7d5f33 60%, #b8955a);
  padding: 12px; border-radius: 6px; box-shadow: 0 6px 24px rgba(30, 20, 10, .28);
  margin: 6px auto 16px;
}
.frame-inner { background: #1c1a18; padding: 3px; }
.puzzle { position: relative; width: 100%; }
.puzzle img { display: block; width: 100%; height: auto; }
.puzzle .grid { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(3, 1fr); }
.puzzle .tile {
  background: repeating-linear-gradient(45deg, var(--cover), var(--cover) 8px, var(--cover-2) 8px, var(--cover-2) 16px);
  border: 1px solid rgba(255, 255, 255, .12); display: grid; place-items: center;
  color: rgba(255, 255, 255, .35); font-family: var(--serif); font-size: 28px;
  transition: opacity .2s;
}
.puzzle .tile.open { opacity: 0; }
.puzzle .tile.opening { animation: tileOpen 1.1s ease-in forwards; }
@keyframes tileOpen {
  0% { opacity: 1; transform: scale(1); box-shadow: inset 0 0 0 0 rgba(255, 230, 160, 0); }
  40% { opacity: 1; transform: scale(1.04); box-shadow: inset 0 0 40px 10px rgba(255, 230, 160, .8); }
  100% { opacity: 0; transform: scale(1.1); }
}
.plaque { text-align: center; }
.plaque .ttl { font-family: var(--serif); font-size: 22px; font-weight: 700; }
.plaque .sub { color: var(--ink-2); font-size: 14px; }
.panel-count { text-align: center; color: var(--ink-2); font-size: 14px; margin-bottom: 14px; }

/* ギャラリー */
.gallery-row { margin-bottom: 18px; }
.gallery-row h3 { font-family: var(--serif); font-size: 16px; margin: 0 0 8px 2px; font-weight: 600; }
.gallery-row h3.unknown { color: var(--ink-2); letter-spacing: .2em; }
.gallery-cells { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.gcell {
  border: 0; padding: 0; background: none; text-align: center; display: flex; flex-direction: column; gap: 4px;
}
.gcell .thumb {
  aspect-ratio: 1; border-radius: 6px; overflow: hidden; background: var(--surface-2); border: 1px solid var(--line);
  display: grid; place-items: center; font-family: var(--serif); font-size: 28px; color: var(--ink-2);
}
.gcell .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gcell .cap { font-size: 11px; color: var(--ink-2); line-height: 1.35; min-height: 2.7em; }
.gcell[disabled] { cursor: default; }
.gallery-summary { text-align: center; color: var(--ink-2); font-size: 14px; margin: 0 0 16px; }

/* 作品詳細 */
.detail img { width: 100%; height: auto; display: block; border-radius: 4px; box-shadow: var(--shadow); }
.detail h2 { font-family: var(--serif); margin: 16px 0 2px; font-size: 24px; }
.detail .meta { color: var(--ink-2); font-size: 14px; }
.detail h4 { font-size: 13px; letter-spacing: .1em; color: var(--gold); margin: 22px 0 6px; }
.detail p { margin: 0 0 10px; }
.detail .credit { font-size: 11px; color: var(--ink-2); margin-top: 22px; word-break: break-word; }

/* フォーム */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 16px; box-shadow: var(--shadow); }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.field input {
  width: 100%; border: 1.5px solid var(--line); border-radius: 10px; padding: 12px; font-size: 17px; background: var(--bg);
}
.field input:focus { outline: none; border-color: var(--accent); }
.field .hint { font-size: 12px; color: var(--ink-2); margin-top: 4px; }
.field .hint.good { color: var(--ok); }
.field .hint.bad { color: var(--ng); }
.form-error { color: var(--ng); font-size: 14px; margin: 0 0 12px; }
.warn-box { border-left: 4px solid var(--ng); background: color-mix(in srgb, var(--ng) 8%, var(--surface)); padding: 10px 12px; border-radius: 6px; font-size: 14px; margin-bottom: 16px; }

/* 成績 */
.stat-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.stat-tile { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px; text-align: center; }
.stat-tile b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; }
.stat-tile span { font-size: 11px; color: var(--ink-2); }
.chart-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 12px 10px; margin-bottom: 14px; }
.chart-card h3 { font-size: 15px; margin: 0 0 2px; }
.chart-card .cap { font-size: 12px; color: var(--ink-2); margin: 0 0 8px; }
.chart { position: relative; }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { fill: var(--ink-2); font-size: 10px; font-family: var(--sans); }
.chart .tip {
  position: absolute; pointer-events: none; background: var(--ink); color: var(--bg); font-size: 12px; border-radius: 6px;
  padding: 4px 8px; white-space: nowrap; transform: translate(-50%, -100%); margin-top: -8px; display: none;
}
.chart-empty { color: var(--ink-2); font-size: 13px; text-align: center; padding: 24px 0; }
.lvbar { margin: 10px 0; }
.lvbar .lb { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 3px; }
.lvbar .lb span { color: var(--ink-2); font-variant-numeric: tabular-nums; }
.lvbar .track { height: 10px; background: var(--grid); border-radius: 5px; overflow: hidden; }
.lvbar .fill { height: 100%; background: var(--chart); border-radius: 5px; min-width: 0; }
.table-toggle { font-size: 12px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 6px; }
.data-table th, .data-table td { border-top: 1px solid var(--line); padding: 5px 4px; text-align: right; font-variant-numeric: tabular-nums; }
.data-table th:first-child, .data-table td:first-child { text-align: left; }

.weak-list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.weak-list div { display: flex; gap: 10px; padding: 10px 14px; border-top: 1px solid var(--line); align-items: baseline; }
.weak-list div:first-child { border-top: 0; }
.weak-list .w { font-family: Georgia, var(--serif); font-weight: 600; min-width: 100px; }
.weak-list .m { flex: 1; color: var(--ink-2); font-size: 14px; }
.weak-list .c { font-size: 12px; color: var(--ng); white-space: nowrap; }
.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; padding-bottom: 2px; }
.tabs button { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 6px 14px; font-size: 14px; white-space: nowrap; }
.tabs button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.prose h2 { font-family: var(--serif); font-size: 20px; }
.prose p, .prose li { font-size: 14px; }
.empty { text-align: center; color: var(--ink-2); padding: 30px 10px; }

.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 24px); transform: translateX(-50%);
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: 14px; z-index: 60;
  max-width: calc(100% - 32px); animation: fadeIn .2s;
}
.offline-pill { font-size: 11px; color: var(--ink-2); border: 1px solid var(--line); border-radius: 999px; padding: 1px 8px; }

@media (min-width: 700px) {
  #app { padding-top: 32px; }
  .qcard .qword { font-size: 48px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* タイトル画面 */
.title-screen { overflow-x: clip; text-align: center; padding: 8px 0 12px; min-height: calc(100dvh - 60px); display: flex; flex-direction: column; justify-content: center; }
.ts-stage { position: relative; width: min(64vw, 250px); margin: 8px auto 18px; }
.ts-frame { margin: 0; padding: 10px; }
.ts-frame img { display: block; width: 100%; height: auto; }
.wordcard {
  position: absolute; right: -12%; bottom: -8%; width: 60%; aspect-ratio: 1.75;
  transform: rotate(-7deg); perspective: 600px; filter: drop-shadow(0 6px 10px rgba(30, 20, 10, .28));
}
.wc-stack, .wc-card { position: absolute; inset: 0; border-radius: 6px; }
.wc-stack { background: #f3efe4; border: 1px solid #d9d0bd; transform: translate(5px, 5px) rotate(2deg); }
.wc-stack.s2 { background: #ece6d6; transform: translate(10px, 9px) rotate(4deg); }
.wc-card { transform-style: preserve-3d; transition: transform .5s ease; }
.wc-card.flip { transform: rotateY(180deg); }
.wc-card.swap { transition: transform .25s ease-in, opacity .25s; transform: translateY(-14px) rotateY(180deg); opacity: 0; }
.wc-face {
  position: absolute; inset: 0; border-radius: 6px; display: grid; place-items: center; padding: 0 10px 0 22px;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  background: #fffef9 repeating-linear-gradient(to bottom, transparent 0 calc(33% - 1px), #e6eef6 calc(33% - 1px) 33%);
  border: 1px solid #d9d0bd; color: #22252b; overflow: hidden;
}
.wc-front { font-family: Georgia, "Times New Roman", serif; font-weight: 600; font-size: clamp(15px, 4.6vw, 21px); }
.wc-back { transform: rotateY(180deg); color: #c0392b; font-family: var(--sans); font-weight: 700; font-size: clamp(15px, 4.6vw, 20px); }
.wc-ring {
  position: absolute; left: 4px; top: 50%; width: 22px; height: 22px; margin-top: -11px; border-radius: 50%;
  border: 3px solid #b9bec6; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15), 0 1px 1px rgba(0, 0, 0, .2);
  background: radial-gradient(circle, var(--bg) 0 4px, transparent 4.5px);
}
.title-screen .logo { font-size: 48px; }
.tagline { font-family: var(--serif); color: var(--ink-2); margin: 10px 0 22px; font-size: 16px; line-height: 1.7; }
.ts-actions { max-width: 320px; width: 100%; margin: 0 auto; }
.ts-who { font-size: 13px; color: var(--ink-2); margin: 10px 0 0; }
@media (min-width: 700px) { .ts-stage { width: 260px; } }

/* あそびかた */
.howto { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 4px 14px; margin-bottom: 8px; }
.howto-step { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.howto-step:first-child { border-top: 0; }
.howto-step .hn { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-weight: 700; font-size: 14px; margin-top: 2px; }
.howto-step b { display: block; }
.howto-step p { margin: 2px 0 0; font-size: 14px; color: var(--ink-2); }
.ts-actions .btn + .btn { margin-top: 10px; }
.copyright { font-size: 12px; color: var(--ink-2); text-align: center; margin: 24px 0 0; letter-spacing: .05em; }

/* 出題中（正誤は出さない） */
.qcard .qnum { font-size: 13px; color: var(--gold); letter-spacing: .1em; margin-bottom: 4px; font-weight: 700; }
.progress-dots i.done { background: var(--gold); }
.choice.selected { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.choice.selected .n { background: var(--accent); color: var(--accent-ink); }

/* 結果発表の表 */
.result-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 10px; }
.result-table tr { border-top: 1px solid var(--line); }
.result-table tr:first-child { border-top: 0; }
.result-table th, .result-table td { padding: 10px 8px; vertical-align: middle; text-align: left; }
.result-table th { font-size: 12px; color: var(--ink-2); font-weight: 600; white-space: nowrap; width: 3.6em; padding-left: 12px; }
.result-table .w { font-family: Georgia, var(--serif); font-weight: 600; font-size: 16px; overflow-wrap: normal; word-break: normal; -webkit-hyphens: auto; hyphens: auto; width: 34%; }
.result-table .m { font-size: 14px; }
.result-table .m small { display: block; font-size: 11px; color: var(--ink-2); line-height: 1.4; margin-top: 2px; }
.result-table .m small.yours { color: var(--ng); }
.result-table .mk { width: 2.4em; text-align: center; font-size: 24px; font-weight: 700; padding-right: 12px; }
.result-table .mk.ok { color: var(--ok); }
.result-table .mk.ng { color: var(--ng); }
/* 発表前は意味と◯✕を隠す */
.result-table tr:not(.shown) .m > *, .result-table tr:not(.shown) .mk { visibility: hidden; }
.result-table tr:not(.shown) .m::before { content: "…"; color: var(--ink-2); }
.result-table tr.shown .mk { animation: markPop .35s ease-out; }
.result-table tr.shown .m { animation: fadeIn .3s; }
@keyframes markPop { 0% { transform: scale(.3); opacity: 0; } 70% { transform: scale(1.25); opacity: 1; } 100% { transform: scale(1); } }
#after .btn:first-of-type { margin-top: 6px; }

[hidden] { display: none !important; }

/* 結果発表の英単語 → Google検索 */
.result-table .w a { color: inherit; text-decoration: underline dotted; text-decoration-color: var(--ink-2); text-underline-offset: 4px; padding: 4px 0; }
.result-table .w a:active { color: var(--accent); }
.result-table .w .ext { width: 13px; height: 13px; color: var(--ink-2); margin-left: 4px; vertical-align: -1px; }
.table-hint { font-size: 12px; color: var(--ink-2); text-align: center; margin: 0 0 2px; }

/* ===== ランキングモード ===== */
kbd { font-family: var(--sans); font-size: 12px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; background: var(--surface); }
.rk-rules { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; margin-bottom: 14px; font-size: 14px; }
.rk-rules p { margin: 0 0 6px; }
.rk-rules ul, .rk-ready ul { margin: 0; padding-left: 1.2em; color: var(--ink-2); }
.rk-rules li, .rk-ready li { margin: 2px 0; }
.rk-ready ul { margin-bottom: 16px; font-size: 14px; }
.rk-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; box-shadow: var(--shadow); }
.rk-card-head { display: flex; justify-content: space-between; align-items: baseline; }
.rk-card-head b { font-family: var(--serif); font-size: 19px; }
.rk-card-head span { font-size: 12px; color: var(--ink-2); }
.rk-best { font-size: 14px; color: var(--ink-2); margin: 6px 0 10px; }
.rk-best b { color: var(--ink); font-size: 17px; }
.rk-rank { color: var(--accent); font-weight: 700; }
.rk-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.rk-actions .btn { margin: 0 !important; min-height: 44px; font-size: 15px; padding: 10px; }

/* プレイ画面 */
.rk-stage { position: relative; min-height: calc(100dvh - 40px); padding-top: 4px; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.rk-bg { position: fixed; inset: 0; background: center / cover no-repeat; z-index: -2; filter: saturate(.9); }
.rk-veil { position: fixed; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(20, 16, 12, .72), rgba(20, 16, 12, .55) 40%, rgba(20, 16, 12, .78)); }
.rk-top { display: flex; justify-content: space-between; align-items: center; color: #f3ece0; font-size: 14px; min-height: 44px; }
.rk-streak b { font-size: 22px; font-variant-numeric: tabular-nums; margin-left: 2px; }
.rk-timebar { height: 8px; border-radius: 4px; background: rgba(255, 255, 255, .18); overflow: hidden; margin: 6px 0 14px; }
.rk-timebar i { display: block; height: 100%; width: 100%; background: #e8c46a; transform-origin: left center; }
.rk-timebar i.hurry { background: #e5534b; }
.rk-qbox { position: relative; text-align: center; padding: 26px 10px 22px; border-radius: 18px; background: rgba(255, 255, 255, .06); border: 1px solid rgba(255, 255, 255, .14); overflow: hidden; }
.rk-qnum { color: #e8c46a; font-size: 13px; letter-spacing: .1em; font-weight: 700; }
.rk-word { display: block; margin: 2px auto 0; pointer-events: none; }
.rk-qbox .judge { font-size: 130px; }
.rk-qbox .judge.show { animation: judgePop .35s ease-out forwards; }
.rk-miss { position: absolute; left: 0; right: 0; bottom: 8px; color: #ffb4ad; font-weight: 700; font-size: 14px; }
.rk-choices .choice { background: rgba(255, 253, 248, .94); color: #2a2521; border-color: rgba(255, 255, 255, .5); }
.rk-choices .choice .n { background: #ede6d8; color: #6b6158; }
.rk-choices .choice.correct { background: #e3f1e8; border-color: #2f7a4f; }
.rk-choices .choice.wrong { background: #f7e1e1; border-color: #b23a3a; }

/* ブレークタイム */
.rk-break { text-align: center; padding-top: 8px; }
.rk-break-head { display: flex; justify-content: center; align-items: baseline; gap: 14px; font-family: var(--serif); font-size: 22px; font-weight: 700; }
.rk-break-head b { font-size: 44px; color: var(--accent); font-variant-numeric: tabular-nums; min-width: 2ch; }
.rk-break-sub { color: var(--ink-2); margin: 2px 0 14px; font-size: 14px; }
.rk-break figure { margin: 0 0 12px; }
.rk-break img { width: 100%; max-height: 52vh; object-fit: contain; border-radius: 4px; box-shadow: var(--shadow); }
.rk-break .ttl { font-family: var(--serif); font-size: 20px; font-weight: 700; margin-top: 10px; }
.rk-break .sub { font-size: 13px; color: var(--ink-2); }
.rk-break-text { text-align: left; font-size: 14px; }
.rk-break-text p { margin: 0 0 8px; }
.rk-break .credit { font-size: 11px; color: var(--ink-2); text-align: left; word-break: break-word; }

/* 結果 */
.rk-score { text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 14px; }
.rk-score .lbl { font-size: 13px; color: var(--ink-2); }
.rk-score .num { font-family: var(--serif); font-size: 64px; font-weight: 700; line-height: 1.1; }
.rk-score .num small, .rk-score .pts small { font-size: 18px; margin-left: 2px; }
.rk-score .sub { font-size: 13px; color: var(--ink-2); }
.rk-score .pts { font-size: 28px; font-weight: 700; color: var(--accent); margin-top: 6px; font-variant-numeric: tabular-nums; }
.rk-bestline, .rk-sending { text-align: center; font-size: 14px; color: var(--ink-2); }
.rk-newbest { text-align: center; font-family: var(--serif); font-size: 26px; font-weight: 700; color: var(--gold); margin: 0 0 10px; }
.rk-cert { display: block; width: 100%; aspect-ratio: 1080 / 1350; border-radius: 4px; box-shadow: var(--shadow); background: var(--surface-2); margin-bottom: 12px; }
.rk-share { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.rk-share .btn { margin: 0 !important; }

/* ランキング表 */
.board-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; font-size: 14px; }
.board-table th { font-size: 11px; color: var(--ink-2); font-weight: 600; text-align: left; padding: 8px; border-bottom: 1px solid var(--line); }
.board-table td { padding: 9px 8px; border-top: 1px solid var(--line); vertical-align: middle; }
.board-table .rk { width: 2.6em; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.board-table tr:nth-child(1) .rk { color: #b8902f; } .board-table tr:nth-child(2) .rk { color: #8f9aa5; } .board-table tr:nth-child(3) .rk { color: #a0673a; }
.board-table .nm { font-weight: 600; word-break: break-all; }
.board-table .st small { display: block; font-size: 11px; color: var(--ink-2); }
.board-table .sc { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.board-table tr.me { background: color-mix(in srgb, var(--gold) 14%, var(--surface)); }
.board-table tr.gap td { text-align: center; color: var(--ink-2); padding: 2px; }
.admin-run { margin-bottom: 10px; font-size: 14px; }

/* シーズンとバッジ */
.rk-season { display: flex; flex-direction: column; align-items: center; gap: 2px; background: linear-gradient(135deg, #2a2521, #4a3a2c); color: #f3e7cc; border-radius: var(--radius); padding: 12px 16px; margin-bottom: 12px; text-align: center; font-size: 13px; }
.rk-season-name { font-family: var(--serif); font-size: 20px; font-weight: 700; color: #e8c46a; letter-spacing: .05em; }
.rk-season.soon .rk-season-name { font-size: 17px; }
.rk-alltime { font-size: 12px; margin-top: 2px; }
.rk-best .rk-rank { margin-left: 6px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border-radius: 12px; padding: 3px; margin-bottom: 10px; }
.seg button { border: 0; background: none; border-radius: 9px; padding: 8px; font-weight: 600; color: var(--ink-2); }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.badge { display: inline-flex; vertical-align: middle; margin-left: 4px; }
.badge-svg { display: block; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, .25)); }
.board-table .nm-in { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 2px; }
.ts-badges { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.ts-badge { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.ts-badge small { font-size: 10px; color: var(--ink-2); line-height: 1.3; text-align: center; }
.board-table th { white-space: nowrap; }

/* ---------- アチーブメント（トロフィー） ---------- */
.trophy-svg { display: block; flex: none; filter: drop-shadow(0 1px 1.5px rgba(40, 30, 20, .25)); }
.trophy-svg.off { filter: none; opacity: .6; }
.ach-summary { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); }
.ach-summary > div b { display: block; font-size: 28px; font-variant-numeric: tabular-nums; line-height: 1.1; }
.ach-summary > div b small { font-size: 15px; color: var(--ink-2); font-weight: 500; }
.ach-summary > div span { font-size: 12px; color: var(--ink-2); }
.ach-tiers { list-style: none; margin: 0 0 0 auto; padding: 0; display: flex; gap: 10px; }
.ach-tiers li { display: flex; align-items: center; gap: 3px; font-size: 13px; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.ach-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.ach-item { display: flex; align-items: center; gap: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.ach-item:not(.done) { background: transparent; }
.ach-item.plat.done { border-color: #8fa6c4; box-shadow: 0 0 0 1px #8fa6c4 inset, var(--shadow); }
.ach-body { flex: 1; min-width: 0; }
.ach-body b { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-weight: 600; }
.ach-item:not(.done) .ach-body b { color: var(--ink-2); }
.ach-body p { margin: 2px 0 6px; font-size: 13px; color: var(--ink-2); }
.tier { font-size: 10px; font-weight: 600; letter-spacing: .04em; border-radius: 999px; padding: 1px 7px; border: 1px solid currentColor; }
.t-b { color: #9a5a2f; } .t-s { color: #737a84; } .t-g { color: #9c7420; } .t-p { color: #4f6382; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .t-b { color: #d9a27a; } :root:not([data-theme="light"]) .t-s { color: #c3c8cf; } :root:not([data-theme="light"]) .t-g { color: #e3c36d; } :root:not([data-theme="light"]) .t-p { color: #a9c0e2; } }
:root[data-theme="dark"] .t-b { color: #d9a27a; } :root[data-theme="dark"] .t-s { color: #c3c8cf; } :root[data-theme="dark"] .t-g { color: #e3c36d; } :root[data-theme="dark"] .t-p { color: #a9c0e2; }
.ach-prog { display: flex; align-items: center; gap: 8px; }
.ach-bar { flex: 1; height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.ach-bar i { display: block; height: 100%; border-radius: 999px; background: var(--gold); }
.ach-num { font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ach-done { font-size: 12px; font-weight: 600; color: var(--ok); }
.ach-pop { position: fixed; z-index: 60; top: calc(env(safe-area-inset-top, 0px) + 12px); left: 50%; transform: translateX(-50%); width: min(360px, calc(100% - 32px));
  display: flex; align-items: center; gap: 12px; text-align: left; font: inherit; color: var(--ink); cursor: pointer;
  background: var(--surface); border: 1px solid var(--gold); border-radius: 14px; padding: 10px 14px; box-shadow: 0 6px 24px rgba(40, 30, 20, .22);
  animation: achIn .45s cubic-bezier(.2, .9, .3, 1.2) both; }
.ach-pop.out { animation: achOut .3s ease-in both; }
.ap-text { display: flex; flex-direction: column; min-width: 0; }
.ap-text small { font-size: 11px; color: var(--gold); font-weight: 600; letter-spacing: .05em; }
.ap-text b { font-size: 15px; }
@keyframes achIn { from { opacity: 0; transform: translate(-50%, -24px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes achOut { to { opacity: 0; transform: translate(-50%, -16px); } }
@media (prefers-reduced-motion: reduce) { .ach-pop, .ach-pop.out { animation: none; } }
.ach-item.secret .ach-body b, .ach-item.secret .ach-body p { color: var(--ink-2); letter-spacing: .2em; }

/* ---------- 名画クイズモード（隠しモード） ---------- */
.qcard.mq { padding: 18px 14px 18px; }
.mq-img { margin: 6px auto 10px; display: flex; justify-content: center; }
.mq-img img { display: block; max-width: 100%; width: auto; height: auto; max-height: 34vh; border-radius: 4px; box-shadow: 0 2px 10px rgba(40, 30, 20, .25); -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.mq-ask { font-family: var(--serif); font-size: 19px; font-weight: 600; line-height: 1.5; }
.mq-ask.clue { font-size: 16px; text-align: left; padding: 8px 4px; }
.mq-choices .choice { font-size: 15px; }
.result-table .mq-thumb { width: 64px; padding-right: 4px; }
.result-table .mq-thumb img { display: block; width: 56px; height: 56px; object-fit: cover; border-radius: 4px; }
.menu-btn.mq-menu { border-color: var(--gold); }
.menu-btn.mq-menu .mi { color: var(--gold); }
.mq-unlock { text-align: center; background: var(--surface); border: 1px solid var(--gold); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; box-shadow: var(--shadow); animation: fadeIn .5s both; }
.mq-unlock b { font-family: var(--serif); font-size: 18px; color: var(--gold); }
.mq-unlock p { margin: 6px 0 12px; font-size: 14px; color: var(--ink-2); }
.menu.mq-wrap { margin-top: 12px; }
.ach-body p.q { letter-spacing: .2em; }

/* ---------- まだ演出を見ていないパネル ---------- */
.btn.glow { box-shadow: 0 0 0 2px var(--gold), 0 0 18px rgba(201, 150, 46, .55); animation: glowPulse 1.8s ease-in-out infinite; }
@keyframes glowPulse { 50% { box-shadow: 0 0 0 2px var(--gold), 0 0 6px rgba(201, 150, 46, .25); } }
.unseen-btn { display: block; width: 100%; margin: 0 0 14px; padding: 12px 14px; font: inherit; font-size: 14px; font-weight: 600; text-align: center; cursor: pointer;
  color: var(--ink); background: var(--surface); border: 1.5px solid var(--gold); border-radius: 12px; box-shadow: 0 0 14px rgba(201, 150, 46, .35); }
.excellent .btn.secondary { margin-top: 10px; animation: fadeIn .4s .9s both; max-width: 280px; margin-left: auto; margin-right: auto; }
@media (prefers-reduced-motion: reduce) { .btn.glow { animation: none; } }

/* ---------- アイコン ---------- */
.avatar { display: inline-block; flex: none; vertical-align: middle; border-radius: 22%; overflow: hidden; }
.avatar svg { display: block; width: 100%; height: 100%; }
.ts-who { display: flex; align-items: center; justify-content: center; gap: 8px; }
.greet { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; }
.greet-av { display: inline-flex; }
.menu-btn .mi.mi-av { background: none; padding: 0; }
.board-table .nm-in { display: inline-flex; align-items: center; gap: 6px; }
.av-stage { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 4px 0 12px; }
.av-big { width: 160px; height: 160px; flex: none; }
.av-big svg { display: block; width: 100%; height: 100%; }
.av-side { display: flex; flex-direction: column; gap: 8px; width: 130px; }
.av-side .btn { margin: 0; padding: 10px 8px; font-size: 14px; }
.av-tabs { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 8px; scrollbar-width: none; }
.av-tabs::-webkit-scrollbar { display: none; }
.av-tabs button { flex: none; font: inherit; font-size: 13px; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; white-space: nowrap; }
.av-tabs button[aria-selected="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.av-opts { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px; }
.av-opt { border: 2px solid transparent; border-radius: 18px; padding: 0; background: none; cursor: pointer; position: relative; }
.av-opt[aria-pressed="true"] { border-color: var(--accent); }
.av-opt svg { display: block; width: 100%; height: auto; border-radius: 16px; }
.av-num { position: absolute; right: -4px; top: -4px; background: var(--accent); color: var(--accent-ink); font-size: 11px; font-weight: 700; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; }
.av-lock { position: absolute; right: 2px; bottom: 2px; font-size: 13px; background: rgba(255, 253, 248, .9); border-radius: 8px; padding: 0 3px; }
.av-sw { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 10px; padding: 10px 6px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); margin-top: 8px; }
.av-sw button { width: 44px; height: 44px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; position: relative; }
.av-sw button[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--accent); }
.av-sw button svg { width: 100%; height: 100%; border-radius: 50%; display: block; }
.av-sw button.lk::after { content: "🔒"; position: absolute; right: -6px; bottom: -6px; font-size: 12px; }
.av-note { margin: 8px 2px 0; font-size: 12px; color: var(--accent); font-weight: 600; line-height: 1.6; }
.av-opts + .btn, .av-sw + .btn, .av-note + .btn { margin-top: 14px; }
.menu-btn .mi.mi-av svg { width: 100%; height: 100%; }

/* ---------- コインとガチャ ---------- */
.coin-ic { display: inline-block; flex: none; border-radius: 50%; vertical-align: -3px; background: radial-gradient(circle at 35% 35%, #ffe9a6, #d9a93a 60%, #a87b1f); box-shadow: inset 0 0 0 1.5px #b8892c; }
.menu-btn .mi .coin-ic { width: 22px; height: 22px; }
.coin-gain { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 6px auto 10px; padding: 8px 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--gold); width: fit-content; font-size: 15px; animation: fadeIn .3s both; }
.coin-gain b { font-variant-numeric: tabular-nums; }
.coin-gain .coin-total { color: var(--ink-2); font-size: 13px; }
.coin-gain .cnt { display: inline-block; min-width: 2ch; text-align: right; color: var(--ink); }
.cnt.pop { animation: coinPop .28s ease-out; }
@keyframes coinPop { 40% { transform: scale(1.3); color: var(--gold); } }
.ex-coin { min-height: 44px; margin-bottom: 8px; }
.gc-wallet { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 34px; font-weight: 700; font-variant-numeric: tabular-nums; margin: 4px 0 8px; }
.gc-wallet small { font-size: 15px; color: var(--ink-2); font-weight: 600; }
.gc-stage { display: grid; place-items: center; justify-content: center; min-height: 270px; margin-bottom: 10px; }
.gc-capsule { position: relative; width: 120px; height: 120px; }
/* ガチャマシン */
.gc-machine { position: relative; width: 200px; height: 262px; }
.gc-machine .gm { display: block; width: 100%; height: 100%; overflow: visible; }
.gm-handle { transform-box: fill-box; transform-origin: center; }
.gm-cap { transform-box: fill-box; transform-origin: center; }
.gc-machine.spin .gm-handle { animation: gmCrank 1.4s cubic-bezier(.45, 0, .3, 1) forwards; }
.gc-machine.spin .gm-cap { animation: gmJiggle .18s ease-in-out 8; }
@keyframes gmCrank { to { transform: rotate(720deg); } }
@keyframes gmJiggle { 25% { transform: translate(-1.5px, -2px) rotate(-8deg); } 75% { transform: translate(1.5px, 1px) rotate(8deg); } }
.gc-out, .gc-opened { position: absolute; width: 28px; height: 28px; border-radius: 50%; overflow: hidden; }
.gc-out { left: 86px; top: 221px; opacity: 0; box-shadow: 0 2px 4px rgba(0, 0, 0, .25); }
.gc-out .top, .gc-out .bottom, .gc-opened .top, .gc-opened .bottom { position: absolute; left: 0; width: 100%; height: 50%; }
.gc-out .top, .gc-opened .top { top: 0; background: var(--cap, #f4b6c6); }
.gc-out .bottom, .gc-opened .bottom { bottom: 0; background: #fffdf8; }
.gc-machine.roll .gc-out { animation: gcRoll 1.15s cubic-bezier(.3, .6, .4, 1) forwards; }
@keyframes gcRoll {
  0% { opacity: 0; transform: translate(0, -6px) scale(.7); }
  12% { opacity: 1; transform: translate(0, 0) scale(.8); }
  35% { transform: translate(6px, 26px) rotate(90deg) scale(1); }
  45% { transform: translate(12px, 20px) rotate(150deg) scale(1); }
  55% { transform: translate(20px, 26px) rotate(220deg) scale(1); }
  100% { opacity: 1; transform: translate(64px, 26px) rotate(560deg) scale(1.15); }
}
.gc-opened { position: relative; width: 64px; height: 64px; overflow: visible; border-radius: 0; margin-bottom: -18px; }
.gc-opened .top { border-radius: 32px 32px 0 0; animation: capTop .55s ease-out forwards; }
.gc-opened .bottom { border-radius: 0 0 32px 32px; box-shadow: inset 0 2px 0 rgba(0, 0, 0, .08); animation: capBottom .55s ease-out forwards; }
@keyframes capTop { to { transform: translate(-26px, -22px) rotate(-35deg); opacity: 0; } }
@keyframes capBottom { to { transform: translate(24px, 18px) rotate(25deg); opacity: 0; } }
.gc-capsule .top, .gc-capsule .bottom { position: absolute; left: 0; width: 120px; height: 60px; }
.gc-capsule .top { top: 0; border-radius: 60px 60px 0 0; background: linear-gradient(160deg, #f4b6c6, #c9707f); }
.gc-capsule .bottom { bottom: 0; border-radius: 0 0 60px 60px; background: linear-gradient(160deg, #fffdf8, #e2d8c6); box-shadow: inset 0 3px 0 rgba(0, 0, 0, .08); }
.gc-capsule.shake { animation: capShake .14s ease-in-out 7; }
@keyframes capShake { 25% { transform: rotate(-9deg); } 75% { transform: rotate(9deg); } }
.gc-stage.open { gap: 10px; animation: fadeIn .4s both; }
.gc-new { font-family: var(--serif); font-size: 20px; font-weight: 700; color: var(--gold); }
.gc-face { width: 150px; height: 150px; animation: markPop .45s ease-out; }
.gc-face svg { display: block; width: 100%; height: 100%; }
.gc-stage .btn { width: auto; padding: 10px 24px; margin: 0; }
.gc-hint { font-size: 12px; color: var(--ink-2); line-height: 1.6; margin: 10px 2px; }
.gc-all { text-align: center; font-weight: 700; color: var(--gold); }
.gc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: 6px; }
.gc-item { aspect-ratio: 1; border-radius: 14px; padding: 0; border: 0; background: none; cursor: pointer; overflow: hidden; display: block; }
.gc-item svg { display: block; width: 100%; height: 100%; }
.gc-item.none { display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); font-weight: 700; cursor: default; }
@media (prefers-reduced-motion: reduce) { .gc-capsule.shake, .gc-machine .gm-handle, .gc-machine .gm-cap, .gc-machine .gc-out, .gc-opened span { animation: none !important; } .gc-opened { display: none; } }

/* ---------- 秘蔵の一枚 ---------- */
.hizo-label { text-align: center; font-family: var(--serif); font-weight: 700; color: var(--gold); letter-spacing: .2em; margin: 0 0 8px; }
.plaque.hizo { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold), 0 0 18px rgba(201, 150, 46, .45); }
.mq-unlock.hizo { margin-top: 12px; border-width: 2px; }
.hizo-row h3 { color: var(--gold); }
.hizo-row .gcell .thumb { box-shadow: 0 0 0 2px var(--gold), 0 0 12px rgba(201, 150, 46, .5); }
.av-secret { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--gold); border-radius: var(--radius); padding: 8px 10px; margin-bottom: 10px; font-size: 13px; }
.av-secret span:not(.avatar) { flex: 1; }
.av-secret .btn { width: auto; margin: 0; padding: 8px 12px; font-size: 13px; }

/* ---------- プロフカード ---------- */
.pcard { border-radius: 22px; padding: 14px; margin-bottom: 14px; box-shadow: 0 0 0 3px #c8a25a, 0 0 0 5px #6e5221, var(--shadow); background-color: #2a2521; }
.pc-in { background: rgba(255, 253, 248, .93); border-radius: 16px; padding: 16px 14px; color: #2a2521; border: 1px solid rgba(167, 132, 77, .55); }
.pc-head { display: flex; align-items: center; gap: 14px; }
.pc-av { border-radius: 24%; box-shadow: 0 0 0 2px #c8a25a; }
.pc-av-edit { position: relative; flex: none; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 24%; line-height: 0; }
.pc-av-edit:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.pc-av-pen { position: absolute; right: -6px; bottom: -6px; width: 28px; height: 28px; border-radius: 50%; background: #c8a25a; color: #2a2521; font-size: 15px; line-height: 28px; text-align: center; box-shadow: 0 1px 3px rgba(0, 0, 0, .35); }
@media (hover: hover) { .pc-av-edit:hover .pc-av { filter: brightness(1.06); } }
.pc-who { min-width: 0; }
.pc-name { font-size: 20px; font-weight: 800; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; word-break: break-all; }
.pc-id { font-size: 13px; color: #6b6158; font-variant-numeric: tabular-nums; letter-spacing: .04em; }
.pc-since { font-size: 12px; color: #6b6158; }
.pc-tr { display: flex; justify-content: space-around; margin: 14px 0 10px; padding: 8px 0; border-top: 1px solid #e4dccd; border-bottom: 1px solid #e4dccd; }
.pc-tr span { display: flex; align-items: center; gap: 4px; }
.pc-tr b { font-size: 18px; font-variant-numeric: tabular-nums; }
.pc-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.pc-stats > div { background: #f5f0e6; border-radius: 12px; padding: 8px 10px; }
.pc-stats b { display: block; font-size: 22px; font-variant-numeric: tabular-nums; line-height: 1.2; }
.pc-stats b small { font-size: 13px; color: #6b6158; }
.pc-stats span { font-size: 11px; color: #6b6158; }
.pc-hizo { font-style: normal; color: #a7844d; font-weight: 700; }
.pc-h { font-family: var(--serif); font-weight: 700; margin-bottom: 6px; }
.pc-row { display: grid; grid-template-columns: 3em 1fr 3em 5.4em; align-items: center; gap: 6px; font-size: 13px; padding: 3px 0; }
.pc-lv { font-weight: 700; }
.pc-bar { height: 10px; background: #ede6d8; border-radius: 999px; overflow: hidden; }
.pc-bar i { display: block; height: 100%; background: linear-gradient(90deg, #c8a25a, #a7844d); border-radius: 999px; }
.pc-n, .pc-best { text-align: right; color: #6b6158; font-variant-numeric: tabular-nums; }
.pc-friend { margin-top: 10px; font-size: 12px; color: #6b6158; text-align: center; }
.pc-actions .btn { margin-bottom: 8px; }
.pc-note { font-size: 12px; color: var(--ink-2); line-height: 1.6; }
.pc-bgs { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 8px; margin-bottom: 14px; }
.pc-bgs button { aspect-ratio: 1; border-radius: 12px; border: 2px solid transparent; cursor: pointer; box-shadow: 0 0 0 1px var(--line); }
.pc-bgs button[aria-pressed="true"] { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent); }
.board-table a.nm-in { color: inherit; text-decoration: none; }

/* ---------- フレンド・お知らせ・スタンプ ---------- */
.fr-code { margin-bottom: 12px; }
.card + .card { margin-top: 0; }
.fr-mine { display: flex; align-items: center; gap: 10px; }
.fr-mine b { font-size: 26px; letter-spacing: .12em; font-family: ui-monospace, Menlo, monospace; flex: 1; }
.fr-mine .btn { width: auto; margin: 0; padding: 8px 14px; }
.fr-note { font-size: 12px; color: var(--ink-2); line-height: 1.6; margin: 8px 0 0; }
.fr-form { display: flex; gap: 8px; }
.fr-form input { flex: 1; font: inherit; font-size: 18px; letter-spacing: .1em; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); text-transform: uppercase; min-width: 0; }
.fr-form .btn { width: auto; margin: 0; padding: 10px 16px; }
.fr-list { display: grid; gap: 8px; }
.fr-item { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 8px 10px; }
.fr-item .btn { width: auto; margin: 0; padding: 6px 12px; font-size: 13px; }
.fr-row { display: flex; align-items: center; gap: 10px; flex: 1; color: inherit; text-decoration: none; min-width: 0; }
.fr-name { display: flex; flex-direction: column; font-weight: 700; min-width: 0; }
.fr-name small { font-weight: 400; font-size: 11px; color: var(--ink-2); }
.fr-empty { color: var(--ink-2); font-size: 13px; }
.nt-list { display: grid; gap: 8px; }
.nt-item { display: flex; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.nt-item.new { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold); }
.nt-who { flex: none; }
.nt-body { flex: 1; min-width: 0; }
.nt-body p { margin: 0 0 6px; font-size: 14px; line-height: 1.5; }
.nt-body small { display: block; color: var(--ink-2); font-size: 11px; margin-top: 4px; }
.nt-body .btn { width: auto; margin: 0; padding: 6px 12px; font-size: 13px; }
.nt-dot { background: var(--accent); color: var(--accent-ink); border-radius: 999px; min-width: 22px; height: 22px; display: grid; place-items: center; font-size: 12px; font-weight: 700; padding: 0 6px; }
.excellent .stamp-pick p { margin: 0 0 10px; color: var(--ink); text-align: center; font-weight: 700; animation: none; }
.stamp-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stamp-grid button { background: none; border: 0; padding: 0; cursor: pointer; }
.stamp-grid button:active { transform: scale(.94); }
.stamp-svg { display: block; }

/* ランキング：最後にまちがえた問題の正解 */
.rk-last { margin: 12px 0; text-align: center; }
.rk-last-h { font-size: 12px; color: var(--ink-2); letter-spacing: .05em; }
.rk-last-w { font-family: Georgia, "Times New Roman", var(--serif); font-size: 32px; font-weight: 700; margin: 4px 0; word-break: break-word; }
.rk-last-w a { color: inherit; text-decoration: underline dotted; text-decoration-color: var(--ink-2); text-underline-offset: 5px; }
.rk-last-m { font-size: 16px; }
.rk-last-m b { color: var(--ok); }
.rk-last-m small { display: block; font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.rk-last-y { font-size: 13px; color: var(--ng); margin-top: 4px; }

/* ランキング：ブレークタイム直前の「TEA BREAK!」 */
.tea-break { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; background: rgba(42, 37, 33, .35); pointer-events: none; animation: fadeIn .2s both; }
.tea-break .tb-in { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 22px 30px; border-radius: 26px; background: var(--surface); border: 2px solid var(--gold); box-shadow: 0 10px 40px rgba(40, 30, 20, .35); animation: teaPop .55s cubic-bezier(.2, 1.4, .4, 1) both; }
.tea-break .tb-text { font-family: Georgia, "Times New Roman", var(--serif); font-size: clamp(30px, 9vw, 46px); font-weight: 700; font-style: italic; color: var(--gold); letter-spacing: .02em; white-space: nowrap; }
.tea-break.out { animation: fadeOut .3s both; }
@keyframes teaPop { from { transform: scale(.4) rotate(-6deg); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes fadeOut { to { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .tea-break .tb-in { animation: none; } }

/* パソコン：↑↓キーで選んでいる答え */
.choice.kbd { outline: 3px solid var(--accent); outline-offset: 2px; background: var(--surface-2); }

/* ---------- 二つ名 ---------- */
.pc-title { font-family: var(--serif); font-size: 13px; font-weight: 700; color: #a7844d; letter-spacing: .04em; }
.tt-edit { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; margin-bottom: 14px; }
.tt-preview { text-align: center; font-family: var(--serif); font-size: 22px; font-weight: 700; color: var(--gold); min-height: 1.5em; margin-bottom: 10px; }
.tt-none { color: var(--ink-2); font-size: 14px; font-weight: 400; }
.tt-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 10px; }
.tt-tabs button { font: inherit; font-size: 13px; padding: 7px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-2); cursor: pointer; }
.tt-tabs button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.tt-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.tt-chip { font: inherit; font-size: 13px; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); cursor: pointer; }
.tt-chip.on { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.tt-chip.lk { color: var(--ink-2); }
.tt-chip.hid { cursor: default; border-style: dashed; letter-spacing: .1em; }
.tt-chip.tr::before { content: "🏆"; margin-right: 2px; font-size: 11px; }
.gc-word { display: grid; place-items: center; background: var(--surface); border: 1px solid var(--gold); color: var(--ink); font-size: 11px; font-weight: 700; text-align: center; padding: 2px; line-height: 1.2; word-break: break-all; }
.gc-wordbig { font-family: var(--serif); font-size: 34px; font-weight: 700; color: var(--gold); padding: 18px 26px; border: 2px solid var(--gold); border-radius: 18px; background: var(--surface); animation: markPop .45s ease-out; }

/* ---------- 起動時の MoffyLab ロゴ ---------- */
.splash { position: fixed; inset: 0; z-index: 9999; display: flex; align-items: center; justify-content: center; background: #fff;
  animation: splash-out .6s ease 3s forwards; }
.splash img { width: min(220px, 56vw); height: auto; opacity: 0; animation: splash-in .7s ease .2s forwards; }
.splash.skip { animation: splash-out .25s ease forwards; }
@keyframes splash-in { to { opacity: 1; } }
@keyframes splash-out { to { opacity: 0; visibility: hidden; } }
@media (prefers-reduced-motion: reduce) { .splash { animation-delay: 2.6s; animation-duration: .2s; } .splash img { animation-duration: .01s; } }
.gc-opened ~ .gc-face, .gc-opened ~ .gc-wordbig { animation: markPop .45s ease-out .2s both; }

/* 公開記念のプレゼント */
.gift-ov .inner { max-width: 340px; }
.gift-ic { display: grid; place-items: center; margin-bottom: 6px; animation: markPop .5s ease-out; }
.gift-h { font-family: var(--serif); font-size: 26px; color: var(--gold); margin: 0 0 6px; }
.gift-ov p { margin: 6px 0; animation: none; }
.gift-ov .gift-until { font-size: 13px; color: var(--ink-2); margin-bottom: 14px; }
.gift-ov .btn { animation: none; }
.ts-gift { text-align: center; font-size: 13px; font-weight: 700; color: var(--gold); margin: 10px 16px 0; }

/* 画面の上のほうに出すコインの枚数 */
.coin-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px 5px 7px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line);
  color: var(--ink); font-size: 15px; font-variant-numeric: tabular-nums; text-decoration: none; flex: none; }
.coin-pill b { font-weight: 700; }
.coin-pill:active { background: var(--surface-2); }
