:root {
  --navy: #0b2d5c;
  --blue: #075b9f;
  --sky: #38a7d8;
  --gold: #d49424;
  --ink: #18283a;
  --muted: #63778d;
  --line: #d7e2ec;
  --wash: #f1f6fa;
  --paper: #fff;
  --good: #087f8c;
  --absent: #718093;
  --radius: 12px;
  --shadow: 0 12px 30px rgba(11,45,92,.08);
  font-family: Inter, "Noto Sans", "Noto Sans Japanese", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { min-height: 100vh; margin: 0; background: linear-gradient(180deg, #fff 0, #f7fafc 100%); }
button, select { font: inherit; }
button, a, select { touch-action: manipulation; }
button:focus-visible, a:focus-visible, select:focus-visible { outline: 3px solid #74c7ee; outline-offset: 2px; }
.shell { width: min(1080px, calc(100% - 32px)); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: fixed; z-index: 20; inset-block-start: 8px; inset-inline-start: 12px; padding: 8px 12px; background: #fff; color: var(--navy); transform: translateY(-160%); opacity: 0; pointer-events: none; }
.skip-link:focus { transform: translateY(0); opacity: 1; pointer-events: auto; }

.site-header { border-block-end: 1px solid var(--line); background: rgba(255,255,255,.96); }
.masthead { display: flex; min-height: 82px; align-items: center; justify-content: space-between; gap: 20px; }
.brand { display: inline-flex; align-items: baseline; gap: 10px; color: var(--navy); text-decoration: none; }
.brand-jp { font-family: Georgia, "Noto Serif JP", serif; font-size: 24px; font-weight: 700; letter-spacing: .03em; }
.brand-global { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .18em; }
.language select, .header-actions select { min-height: 38px; padding: 5px 28px 5px 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--navy); background: #fff; font-weight: 700; }

.hub { padding-block: clamp(42px, 7vw, 78px); }
.eyebrow { margin: 0 0 8px; color: var(--blue); font-size: 11px; font-weight: 900; letter-spacing: .2em; }
.hub h1 { max-width: 760px; margin: 0; color: var(--navy); font-size: clamp(34px, 5vw, 58px); line-height: 1.18; letter-spacing: -.035em; }
.lead { max-width: 650px; margin: 18px 0 0; color: #455a70; font-size: 18px; line-height: 1.65; }
.game-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-block: 38px 30px; }
.game-card { display: grid; grid-template-columns: 64px 1fr auto; min-height: 200px; align-items: center; gap: 20px; padding: 28px; border: 1px solid var(--line); border-radius: 16px; color: var(--ink); background: #fff; text-decoration: none; box-shadow: var(--shadow); transition: translate .15s ease, box-shadow .15s ease; }
.game-card:hover { translate: 0 -3px; box-shadow: 0 18px 36px rgba(11,45,92,.13); }
.card-mark { display: grid; width: 64px; aspect-ratio: 1; place-items: center; border-radius: 14px; background: var(--navy); color: #fff; font-size: 24px; font-weight: 900; }
.clues-card .card-mark { background: var(--good); }
.game-card small, .game-card span span { display: block; }
.game-card small { color: var(--blue); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.game-card strong { display: block; margin-block: 5px 7px; color: var(--navy); font-size: 25px; }
.game-card span span { color: var(--muted); font-size: 14px; line-height: 1.5; }
.arrow { color: var(--blue); font-size: 24px; }
.back-link { color: var(--blue); font-weight: 750; text-underline-offset: 3px; }
footer { margin-block-start: auto; padding-block: 20px; border-block-start: 1px solid var(--line); color: var(--muted); background: #fff; font-size: 12px; }
footer .shell { display: flex; justify-content: space-between; gap: 20px; }

.game-header { display: grid; grid-template-columns: 1fr auto 1fr; min-height: 62px; align-items: center; border-block-end: 1px solid var(--line); }
.mini-brand { display: inline-flex; align-items: center; gap: 8px; color: var(--navy); font-family: Georgia, "Noto Serif JP", serif; font-size: 13px; text-decoration: none; }
.mini-brand b { color: var(--muted); font-family: inherit; font-size: 9px; letter-spacing: .08em; text-transform: uppercase; }
.game-name { color: var(--navy); font-size: 18px; font-weight: 900; letter-spacing: -.02em; }
.header-actions { display: flex; justify-content: flex-end; gap: 8px; }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 50%; color: var(--navy); background: #fff; font-weight: 900; cursor: pointer; }
.game-shell { width: min(560px, calc(100% - 24px)); margin-inline: auto; padding-block: 12px 20px; text-align: center; }
.game-meta { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
.game-prompt { margin: 7px 0 9px; color: var(--navy); font-size: 15px; font-weight: 800; }
.meaning-card { display: grid; gap: 4px; margin: 10px 0; padding: 16px 18px; border-inline-start: 6px solid var(--sky); border-radius: 8px 16px 16px 8px; background: #eaf6fb; text-align: start; }
.meaning-card small { color: var(--blue); font-size: 11px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.meaning-card strong { color: var(--navy); font-size: 21px; line-height: 1.4; }
.reading-path { display: flex; justify-content: space-between; align-items: center; padding: 7px 2px; color: var(--muted); font-size: 12px; }
.reading-path b { color: var(--blue); font-size: 18px; letter-spacing: .16em; }
.kana-input { min-height: 52px; padding: 8px 18px; border: 0; border-block: 3px solid var(--navy); color: var(--navy); background: #fff; font-size: 28px; font-weight: 850; letter-spacing: .18em; }
.attempt-log { display: grid; gap: 4px; min-height: 44px; margin: 7px 0; padding: 0; list-style: none; text-align: start; }
.attempt-log li { display: grid; grid-template-columns: auto auto 1fr; align-items: center; gap: 10px; padding: 6px 10px; border-radius: 999px; background: var(--wash); color: var(--muted); font-size: 11px; }
.attempt-log li b { color: var(--blue); }
.attempt-reading { color: var(--navy); font-size: 15px; font-weight: 850; letter-spacing: .08em; }
.message { min-height: 20px; margin: 6px 0; color: #9a3d25; font-size: 12px; font-weight: 700; }
.kana-keyboard { display: grid; grid-template-columns: repeat(10, 1fr); gap: 3px; width: min(520px, 100%); margin-inline: auto; }
.key { min-width: 0; min-height: 31px; padding: 2px; border: 0; border-radius: 5px; color: var(--ink); background: #e2e9ef; font-size: 16px; font-weight: 750; cursor: pointer; }
.key.action { grid-column: span 2; color: #fff; background: var(--navy); font-size: 12px; }
.key.modifier { color: var(--navy); background: #cfe9f5; }

.campus-shell { width: min(680px, calc(100% - 24px)); }
.clue-list { display: grid; gap: 7px; min-height: 190px; margin: 0; padding: 0; list-style: none; text-align: start; }
.clue-list li { display: grid; grid-template-columns: 30px 1fr; gap: 9px; align-items: center; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; color: #31485f; font-size: 13px; line-height: 1.4; box-shadow: 0 4px 12px rgba(11,45,92,.04); }
.clue-number { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 50%; color: #fff; background: var(--blue); font-size: 12px; font-weight: 900; }
.clue-list li.locked { border-style: dashed; color: #97a6b5; background: transparent; }
.clue-list li.locked .clue-number { color: var(--muted); background: #e4ebf1; }
.school-options { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.school-option { min-height: 43px; padding: 8px 10px; border: 1px solid #aebfce; border-radius: 9px; color: var(--navy); background: #fff; font-size: 13px; font-weight: 800; cursor: pointer; }
.school-option:hover { border-color: var(--blue); background: var(--wash); }
.school-option.wrong { border-color: #b96b59; color: #84402e; background: #fff0ec; text-decoration: line-through; }
.school-option.correct { border-color: var(--good); color: #fff; background: var(--good); }

.result-panel { margin-block-start: 10px; padding: 18px; border: 1px solid var(--line); border-radius: 14px; background: #fff; text-align: start; box-shadow: var(--shadow); }
.result-panel h2 { margin: 0; color: var(--navy); font-size: 22px; }
.result-kicker { margin: 0 0 4px; color: var(--good); font-size: 11px; font-weight: 900; letter-spacing: .12em; text-transform: uppercase; }
.result-word { display: flex; flex-wrap: wrap; align-items: baseline; gap: 8px; }
.result-word small { color: var(--muted); }
.result-panel p { margin: 8px 0; line-height: 1.55; }
.example { padding: 9px 11px; border-inline-start: 3px solid var(--sky); background: var(--wash); font-size: 13px; }
.answer-sources { margin-block: 14px; padding-block: 12px; border-block: 1px solid var(--line); }
.answer-sources h3 { margin: 0; color: var(--navy); font-size: 14px; }
.source-list { display: grid; gap: 12px; margin: 10px 0; padding-inline-start: 20px; font-size: 11px; }
.source-list a { color: var(--blue); }
.source-list blockquote { margin: 4px 0; padding-inline-start: 8px; border-inline-start: 2px solid var(--line); color: var(--muted); line-height: 1.45; }
.source-list small { color: var(--muted); }
.article-button, .primary-button { display: inline-flex; min-height: 40px; align-items: center; justify-content: center; padding: 8px 14px; border: 0; border-radius: 8px; color: #fff; background: var(--navy); font-weight: 800; text-decoration: none; cursor: pointer; }
.share-row { display: flex; flex-wrap: wrap; gap: 7px; margin-block-start: 12px; }
.share-button { min-height: 38px; padding: 7px 11px; border: 1px solid var(--blue); border-radius: 8px; color: var(--blue); background: #fff; font-size: 12px; font-weight: 800; cursor: pointer; text-decoration: none; }
.share-button.primary-share { color: #fff; background: var(--blue); }
.share-tools p { margin-block-start: 14px; }
.share-status { display: block; min-height: 18px; margin-block-start: 6px; color: var(--muted); font-size: 11px; }
.dictionary-note { color: var(--muted); font-size: 11px; }

.help-dialog { width: min(480px, calc(100% - 28px)); padding: 0; border: 0; border-radius: 16px; color: var(--ink); box-shadow: 0 24px 80px rgba(11,45,92,.25); }
.help-dialog::backdrop { background: rgba(7,28,53,.62); }
.help-dialog form { position: relative; padding: 28px; }
.help-dialog h2 { margin: 0 0 12px; color: var(--navy); }
.help-dialog p { line-height: 1.6; }
.dialog-close { position: absolute; inset-block-start: 12px; inset-inline-end: 12px; width: 34px; height: 34px; border: 0; border-radius: 50%; background: var(--wash); font-size: 21px; cursor: pointer; }
[dir="rtl"] .arrow { transform: scaleX(-1); }

@media (max-width: 700px) {
  .game-grid { grid-template-columns: 1fr; }
  .game-card { min-height: 150px; }
  footer .shell { flex-direction: column; gap: 5px; }
}

@media (max-width: 480px) {
  .shell { width: calc(100% - 24px); }
  .masthead { min-height: 68px; }
  .brand-jp { font-size: 20px; }
  .hub { padding-block: 32px; }
  .hub h1 { font-size: 36px; }
  .lead { font-size: 16px; }
  .game-grid { margin-block-start: 25px; }
  .game-card { grid-template-columns: 50px 1fr auto; gap: 13px; padding: 19px; }
  .card-mark { width: 50px; border-radius: 11px; font-size: 24px; }
  .game-card strong { font-size: 21px; }
  .mini-brand span:last-child { display: none; }
  .game-header { width: 100%; padding-inline: 10px; min-height: 55px; }
  .game-name { font-size: 16px; }
  .game-shell { padding-block-start: 8px; }
  .meaning-card { padding: 12px 14px; }
  .meaning-card strong { font-size: 18px; }
  .attempt-log li { grid-template-columns: auto auto; border-radius: 12px; }
  .attempt-log li span:last-child { grid-column: 1 / -1; }
  .key { min-height: 29px; font-size: 15px; }
  .message { margin-block: 4px; }
  .clue-list { min-height: 178px; gap: 5px; }
  .clue-list li { min-height: 32px; padding: 6px 9px; font-size: 12px; }
  .school-option { min-height: 40px; font-size: 12px; }
  .result-panel { padding: 14px; }
}

@media (max-height: 740px) and (max-width: 480px) {
  .game-header { min-height: 50px; }
  .game-prompt { margin-block: 4px; }
  .meaning-card { margin-block: 6px; }
  .key { min-height: 26px; }
}

@media (prefers-reduced-motion: reduce) { .game-card { transition: none; } }
