:root{--primary:#d94862;--accent:#f2a541;--tint:#fbe3e6}
@media (prefers-color-scheme:dark){:root{--primary:#ef7d91;--tint:#3a1f25}}
/* Shared by hiraganagame.com and katakanagame.com. Theme colours are injected by build.mjs. */
:root {
  --bg: #fbf8f3; --surface: #ffffff; --surface-2: #f5efe6; --ink: #1d1a17; --muted: #6f675e; --line: #ebe2d5;
  --good: #1f9d6b; --good-tint: #dcf3e8; --bad: #d64545; --bad-tint: #fde3e1;
  --m0: #d9d1c6; --m1: #f2a541; --m2: #6cc4a1; --m3: #1f9d6b;
  --radius: 18px; --radius-sm: 12px;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 8px 24px rgba(60, 40, 20, .08);
  --shadow-lg: 0 2px 4px rgba(60, 40, 20, .06), 0 20px 50px rgba(60, 40, 20, .14);
  --ui: "Nunito", ui-rounded, system-ui, -apple-system, "Segoe UI", sans-serif;
  --kana: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", "Hiragino Sans", "Yu Gothic", "Noto Sans JP", sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15120f; --surface: #201c18; --surface-2: #29241f; --ink: #f4eee6; --muted: #a89e92; --line: #342d27;
    --good: #43c08d; --good-tint: #173a2c; --bad: #ef6b6b; --bad-tint: #3d1c1c; --m0: #4a423a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .3);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, .3), 0 20px 50px rgba(0, 0, 0, .45);
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 500 17px/1.6 var(--ui); -webkit-font-smoothing: antialiased; }
[lang="ja"] { font-family: var(--kana); }
a { color: var(--primary); text-decoration-thickness: 2px; text-underline-offset: 3px; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -.02em; font-weight: 900; }
h1 { font-size: clamp(2rem, 5vw, 3.2rem); margin: 0 0 .4em; }
h2 { font-size: clamp(1.4rem, 3vw, 1.9rem); margin: 1.6em 0 .5em; }
img { max-width: 100%; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.wrap { width: min(1120px, 100% - 40px); margin-inline: auto; }
.section { margin-block: 56px; }
.section-title { margin-top: 0; }
.muted { color: var(--muted); }
.center { text-align: center; }
.lead { font-size: 1.15rem; color: var(--muted); max-width: 46em; }
.eyebrow { text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; font-weight: 800; color: var(--primary); margin: 0 0 12px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: var(--bg); padding: 8px 14px; border-radius: 8px; z-index: 99; }
.skip:focus { left: 8px; }
:focus-visible { outline: 3px solid var(--primary); outline-offset: 2px; border-radius: 6px; }

/* ---------- header ---------- */
.site-header { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--line); }
.header-inner { display: flex; align-items: center; gap: 20px; height: 64px; }
.logo { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--ink); font-weight: 900; font-size: 1.15rem; letter-spacing: -.02em; flex-shrink: 0; }
.logo-mark { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: var(--primary); color: #fff; font-size: 1.35rem; font-weight: 700; box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .15); }
.logo-text b { color: var(--primary); margin-left: 3px; }
.nav { display: flex; gap: 4px; margin-left: auto; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav a { padding: 8px 12px; border-radius: 999px; color: var(--muted); text-decoration: none; font-weight: 800; font-size: .95rem; white-space: nowrap; }
.nav a:hover { color: var(--ink); background: var(--surface-2); }
.nav a[aria-current="page"] { color: var(--primary); background: var(--tint); }
.streak-pill { display: inline-flex; align-items: center; gap: 4px; padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-weight: 900; font-size: .95rem; flex-shrink: 0; }
@media (max-width: 760px) {
  .header-inner { flex-wrap: wrap; height: auto; padding-block: 10px 0; gap: 8px 12px; }
  .nav { order: 3; width: 100%; margin: 0 -6px; padding-bottom: 8px; }
  .streak-pill { margin-left: auto; }
  .logo-text { font-size: 1.05rem; }
}

/* ---------- buttons ---------- */
.btn { --b: var(--primary); display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 12px 22px; border-radius: 14px; font-weight: 900; text-decoration: none; border: 2px solid transparent; cursor: pointer; transition: transform .12s, box-shadow .12s, background .12s; font-size: 1rem; line-height: 1.2; }
.btn:active { transform: translateY(2px); }
.btn-primary { background: var(--b); color: #fff; box-shadow: 0 4px 0 color-mix(in srgb, var(--b) 65%, #000); }
.btn-primary:hover { filter: brightness(1.05); }
.btn-primary:active { box-shadow: 0 2px 0 color-mix(in srgb, var(--b) 65%, #000); }
.btn-ghost { background: var(--surface); color: var(--ink); border-color: var(--line); box-shadow: 0 3px 0 var(--line); }
.btn-ghost:hover { border-color: color-mix(in srgb, var(--primary) 40%, var(--line)); }
.btn-lg { padding: 16px 28px; font-size: 1.1rem; border-radius: 16px; }
.btn-sm { padding: 8px 14px; font-size: .9rem; border-radius: 11px; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }

/* ---------- hero ---------- */
.hero { position: relative; overflow: hidden; padding: 64px 0 40px; }
.hero::before, .game-head::before {
  content: ""; position: absolute; inset: 0; z-index: -1; background: var(--primary); opacity: .07;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='30' viewBox='0 0 60 30'%3E%3Cg fill='none' stroke='%23000' stroke-width='2'%3E%3Ccircle cx='30' cy='30' r='28'/%3E%3Ccircle cx='30' cy='30' r='20'/%3E%3Ccircle cx='30' cy='30' r='12'/%3E%3Ccircle cx='0' cy='15' r='28'/%3E%3Ccircle cx='60' cy='15' r='28'/%3E%3C/g%3E%3C/svg%3E") repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='30' viewBox='0 0 60 30'%3E%3Cg fill='none' stroke='%23000' stroke-width='2'%3E%3Ccircle cx='30' cy='30' r='28'/%3E%3Ccircle cx='30' cy='30' r='20'/%3E%3Ccircle cx='30' cy='30' r='12'/%3E%3Ccircle cx='0' cy='15' r='28'/%3E%3Ccircle cx='60' cy='15' r='28'/%3E%3C/g%3E%3C/svg%3E") repeat;
  mask-image: linear-gradient(to bottom, #000, transparent), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='30' viewBox='0 0 60 30'%3E%3Cg fill='none' stroke='%23000' stroke-width='2'%3E%3Ccircle cx='30' cy='30' r='28'/%3E%3Ccircle cx='30' cy='30' r='20'/%3E%3Ccircle cx='30' cy='30' r='12'/%3E%3Ccircle cx='0' cy='15' r='28'/%3E%3Ccircle cx='60' cy='15' r='28'/%3E%3C/g%3E%3C/svg%3E");
  mask-composite: intersect; -webkit-mask-composite: source-in;
}
.hero-inner { display: grid; grid-template-columns: 1.15fr .85fr; gap: 48px; align-items: center; }
.hero h1 { font-size: clamp(2.5rem, 6.5vw, 4.4rem); }
.hero h1 em { font-style: normal; color: var(--primary); position: relative; white-space: nowrap; }
.hero h1 em::after { content: ""; position: absolute; left: 0; right: 0; bottom: .06em; height: .16em; background: var(--accent); opacity: .45; border-radius: 4px; z-index: -1; }
.hero-card { position: relative; height: 380px; }
.flash { position: absolute; inset: 30px 40px; background: var(--surface); border-radius: 28px; box-shadow: var(--shadow-lg); display: grid; place-items: center; align-content: center; gap: 6px; border: 1px solid var(--line); transform: rotate(-3deg); }
.flash::after { content: ""; position: absolute; inset: 14px; border: 2px dashed var(--line); border-radius: 20px; pointer-events: none; }
.flash-k { font-family: var(--kana); font-weight: 700; font-size: 150px; line-height: 1; color: var(--ink); transition: opacity .25s, transform .25s; }
.flash-r { font-weight: 900; font-size: 1.6rem; color: var(--primary); letter-spacing: .04em; transition: opacity .25s; }
.flash.swap .flash-k, .flash.swap .flash-r { opacity: 0; transform: translateY(8px) scale(.96); }
.hero-float i { position: absolute; font-style: normal; font-family: var(--kana); font-weight: 700; color: var(--primary); opacity: .22; font-size: calc(26px + (var(--i) * 4px)); animation: bob 6s ease-in-out infinite; animation-delay: calc(var(--i) * -.8s); }
.hero-float i:nth-child(1) { left: 0; top: 6%; } .hero-float i:nth-child(2) { right: 2%; top: 0; }
.hero-float i:nth-child(3) { right: -2%; top: 46%; } .hero-float i:nth-child(4) { left: 4%; bottom: 4%; }
.hero-float i:nth-child(5) { right: 14%; bottom: -2%; } .hero-float i:nth-child(6) { left: -3%; top: 42%; }
.hero-float i:nth-child(7) { left: 42%; top: -6%; } .hero-float i:nth-child(8) { left: 40%; bottom: -8%; }
@keyframes bob { 50% { transform: translateY(-12px) rotate(6deg); } }
@media (max-width: 860px) {
  .hero { padding-top: 36px; }
  .hero-inner { grid-template-columns: 1fr; gap: 12px; }
  .hero-card { height: 260px; order: -1; max-width: 360px; width: 100%; margin: 0 auto; }
  .flash-k { font-size: 104px; }
}
@media (prefers-reduced-motion: reduce) { .hero-float i { animation: none; } }

/* ---------- progress panel ---------- */
.progress-panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px 28px; box-shadow: var(--shadow); display: grid; grid-template-columns: 260px 1fr; gap: 24px; align-items: center; }
.progress-panel h2 { margin: 0 0 6px; font-size: 1.3rem; }
.progress-panel p { margin: 0; font-size: .95rem; }
.pp-rows { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 10px; }
.pp-row { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 8px; border-radius: 12px; text-decoration: none; color: var(--ink); background: var(--surface-2); transition: transform .12s; }
.pp-row:hover { transform: translateY(-2px); }
.pp-k { font-size: 1.6rem; font-weight: 700; line-height: 1; }
.pp-bar { width: 100%; height: 6px; border-radius: 6px; background: var(--m0); overflow: hidden; }
.pp-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--m1), var(--m3)); border-radius: inherit; transition: width .6s; }
@media (max-width: 760px) { .progress-panel { grid-template-columns: 1fr; padding: 20px; } .pp-rows { grid-template-columns: repeat(5, 1fr); gap: 6px; } .pp-row { padding: 8px 4px; } }

/* ---------- mode cards ---------- */
.mode-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 18px; }
.mode-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px 20px; text-decoration: none; color: var(--ink); box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s; }
.mode-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.mode-card h3 { margin: 16px 0 6px; font-size: 1.25rem; }
.mode-card p { margin: 0 0 14px; color: var(--muted); font-size: .95rem; flex: 1; }
.go { font-weight: 900; color: var(--primary); }
.art { position: relative; height: 120px; border-radius: 14px; background: var(--tint); overflow: hidden; display: flex; align-items: center; justify-content: center; gap: 14px; }
.art i { font-style: normal; }
.art-big { font-family: var(--kana); font-size: 58px; font-weight: 700; line-height: 1; }
.art-pills { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.art-pills i { background: var(--surface); padding: 3px 10px; border-radius: 8px; font-weight: 800; font-size: .8rem; text-align: center; box-shadow: 0 2px 0 var(--line); }
.art-pills i.ok { background: var(--good); color: #fff; box-shadow: none; }
.art-keys { display: flex; gap: 5px; }
.art-keys i { width: 30px; height: 32px; display: grid; place-items: center; background: var(--surface); border-radius: 7px; font-weight: 900; box-shadow: 0 3px 0 var(--line); }
.art-rain i { position: absolute; font-family: var(--kana); font-weight: 700; font-size: 30px; left: calc(10% + var(--i) * 18%); animation: fall 3.2s linear infinite; animation-delay: calc(var(--i) * -.75s); }
@keyframes fall { from { top: -40px; } to { top: 120px; } }
.mode-card:not(:hover) .art-rain i { animation-play-state: paused; }
.art-match { display: grid; grid-template-columns: repeat(4, 44px); gap: 8px; }
.art-match i { height: 56px; border-radius: 9px; background: var(--surface); display: grid; place-items: center; font-weight: 900; font-size: 1.3rem; box-shadow: 0 3px 0 var(--line); }
.art-match i[lang] { font-family: var(--kana); }
.art-match i.back { background: var(--primary); box-shadow: 0 3px 0 color-mix(in srgb, var(--primary) 60%, #000); background-image: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, .25) 0 6px, transparent 7px); }

/* ---------- chart ---------- */
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; align-items: start; }
.split > div:first-child { position: sticky; top: 100px; }
@media (max-width: 860px) { .split { grid-template-columns: 1fr; } .split > div:first-child { position: static; } }
.chart { display: grid; grid-template-columns: repeat(var(--cols), 1fr); gap: 8px; max-width: 620px; }
.chart.compact { gap: 6px; max-width: 440px; justify-self: end; width: 100%; }
@media (max-width: 860px) { .chart.compact { justify-self: stretch; max-width: none; } }
.chart-section .chart { margin-bottom: 8px; }
.kcell { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; aspect-ratio: 1 / 1.05; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink); transition: transform .12s, border-color .12s, background .12s; cursor: pointer; }
.kcell:hover { transform: translateY(-2px); border-color: var(--primary); }
.kcell .k { font-size: clamp(1.4rem, 4.4vw, 2.1rem); font-weight: 700; line-height: 1.1; }
.kcell .r { font-size: .78rem; font-weight: 800; color: var(--muted); }
.chart-yoon .kcell .k, .chart-extended .kcell .k { font-size: clamp(1.2rem, 3.6vw, 1.8rem); }
.compact .kcell { border-radius: 10px; }
.compact .kcell .k { font-size: clamp(1.2rem, 3.6vw, 1.6rem); }
.kcell.empty { background: transparent; border: 1px dashed var(--line); cursor: default; }
.kcell.empty:hover { transform: none; }
.kcell[data-m]::after { content: ""; position: absolute; top: 7px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--m0); }
.kcell[data-m="1"]::after { background: var(--m1); } .kcell[data-m="2"]::after { background: var(--m2); } .kcell[data-m="3"]::after { background: var(--m3); }
.kcell.playing { background: var(--tint); border-color: var(--primary); transform: scale(1.06); }
.chart-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 24px; margin-top: 20px; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 12px; padding: 4px; }
.seg button { border: 0; background: transparent; padding: 8px 14px; border-radius: 9px; font-weight: 800; cursor: pointer; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.legend { display: inline-flex; align-items: center; gap: 6px; font-size: .88rem; color: var(--muted); font-weight: 700; flex-wrap: wrap; }
.legend i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; margin-left: 8px; }
.legend i:first-child { margin-left: 0; }
.legend .m0 { background: var(--m0); } .legend .m1 { background: var(--m1); } .legend .m2 { background: var(--m2); } .legend .m3 { background: var(--m3); }

/* ---------- prose, faq ---------- */
.prose { max-width: 760px; }
.prose p, .prose li { font-size: 1.06rem; }
.prose li { margin-bottom: 8px; }
.faq { display: grid; gap: 10px; max-width: 820px; }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 4px 20px; }
.faq summary { cursor: pointer; font-weight: 900; padding: 14px 0; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; color: var(--primary); font-size: 1.4rem; line-height: 1; transition: transform .2s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { margin: 0 0 16px; color: var(--muted); }
.steps { padding-left: 0; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; position: relative; padding-left: 56px; margin-bottom: 24px; }
.steps li::before { content: counter(s); position: absolute; left: 0; top: 2px; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--tint); color: var(--primary); font-weight: 900; font-size: 1.2rem; }
.steps h2 { font-size: 1.3rem; margin: 0 0 6px; padding-top: 8px; }
.steps p { margin: 0; }
.plan { width: 100%; border-collapse: collapse; background: var(--surface); border-radius: 14px; overflow: hidden; border: 1px solid var(--line); font-size: .98rem; }
.plan th, .plan td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); }
.plan th { background: var(--surface-2); font-weight: 900; }
.plan tr:last-child td { border-bottom: 0; }

/* ---------- sister / footer ---------- */
.sister-card { display: flex; align-items: center; gap: 22px; padding: 24px 28px; border-radius: var(--radius); background: var(--ink); color: var(--bg); text-decoration: none; box-shadow: var(--shadow-lg); }
.sister-card .go { margin-left: auto; color: var(--accent); white-space: nowrap; }
.sister-k { font-family: var(--kana); font-size: 3.4rem; font-weight: 700; line-height: 1; width: 84px; height: 84px; border-radius: 20px; display: grid; place-items: center; background: rgba(255, 255, 255, .1); flex-shrink: 0; }
@media (max-width: 640px) { .sister-card { flex-wrap: wrap; } .sister-card .go { margin-left: 0; } }
.site-footer { margin-top: 80px; border-top: 1px solid var(--line); padding: 48px 0 24px; background: var(--surface-2); }
.footer-grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1fr; gap: 28px; }
.footer-grid h2 { font-size: .85rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 0 0 12px; }
.footer-grid a:not(.logo) { display: block; color: var(--ink); text-decoration: none; font-weight: 700; margin-bottom: 8px; }
.footer-grid a:not(.logo):hover { color: var(--primary); }
.footer-grid p { color: var(--muted); font-size: .95rem; }
.copyright { color: var(--muted); font-size: .85rem; margin-top: 32px; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-grid > div:first-child { grid-column: 1 / -1; } }

/* ---------- game pages ---------- */
.game-head { position: relative; padding-top: 40px; }
.game-head::before { left: -50vw; right: -50vw; top: -10px; bottom: -40px; }
.game-head h1 { margin-bottom: .2em; }
.app { position: relative; min-height: 520px; margin-top: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: 26px; box-shadow: var(--shadow-lg); padding: clamp(18px, 3.5vw, 36px); overflow: clip; }
.noscript { text-align: center; padding: 40px; }

/* setup */
.setup h2 { margin: 0 0 4px; font-size: 1.35rem; }
.setup-sub { margin: 0 0 18px; color: var(--muted); }
.opt-block { margin-bottom: 22px; }
.opt-label { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; font-weight: 900; font-size: .85rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 10px; }
.opt-label .count { text-transform: none; letter-spacing: 0; color: var(--primary); }
.presets { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.preset { border: 1px solid var(--line); background: var(--surface); padding: 6px 12px; border-radius: 999px; font-weight: 800; font-size: .88rem; cursor: pointer; color: var(--muted); }
.preset:hover { color: var(--ink); border-color: var(--primary); }
.group-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.gchip { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px 8px 10px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 800; transition: all .12s; }
.gchip .gk { font-family: var(--kana); font-size: 1.25rem; font-weight: 700; min-width: 1.4em; text-align: center; }
.gchip small { color: var(--muted); font-size: .8rem; }
.gchip[aria-pressed="true"] { border-color: var(--primary); background: var(--tint); }
.gchip[aria-pressed="true"] small { color: var(--ink); }
.gchip .gm { width: 34px; height: 5px; border-radius: 4px; background: var(--m0); overflow: hidden; }
.gchip .gm i { display: block; height: 100%; background: var(--m3); }
.group-sec { margin-bottom: 12px; }
.group-sec-title { font-size: .82rem; font-weight: 800; color: var(--muted); margin: 10px 0 6px; }
.seg-row { display: flex; flex-wrap: wrap; gap: 12px 20px; }
.setup-foot { position: sticky; bottom: 0; z-index: 3; background: var(--surface); display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; border-top: 1px solid var(--line); padding: 16px 0 14px; margin-top: 6px; }
.setup-foot .best { color: var(--muted); font-weight: 700; }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; cursor: pointer; color: var(--muted); font-size: .95rem; }
.toggle input { width: 18px; height: 18px; accent-color: var(--primary); }

/* hud */
.hud { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.hud .bar { flex: 1; height: 12px; border-radius: 10px; background: var(--surface-2); overflow: hidden; }
.hud .bar i { display: block; height: 100%; background: var(--primary); border-radius: inherit; transition: width .3s; }
.hud .stat { font-weight: 900; font-variant-numeric: tabular-nums; white-space: nowrap; }
.hud .combo { color: var(--accent); }
.hud .timer { min-width: 3.2em; text-align: right; }
.hud .timer.low { color: var(--bad); animation: pulse .6s infinite alternate; }
.icon-btn { border: 0; background: var(--surface-2); width: 38px; height: 38px; border-radius: 11px; cursor: pointer; display: grid; place-items: center; font-size: 1.05rem; flex-shrink: 0; }
.icon-btn:hover { background: var(--line); }
@keyframes pulse { to { opacity: .55; } }

/* prompt card */
.stage { display: grid; justify-items: center; gap: 22px; }
.prompt { position: relative; width: min(300px, 70vw); aspect-ratio: 1; border-radius: 28px; background: var(--bg); border: 2px solid var(--line); display: grid; place-items: center; box-shadow: inset 0 -6px 0 var(--line); }
.prompt .pk { font-family: var(--kana); font-weight: 700; font-size: clamp(90px, 24vw, 150px); line-height: 1; }
.prompt .pk.long { font-size: clamp(70px, 17vw, 110px); }
.prompt .pr { font-weight: 900; font-size: clamp(60px, 16vw, 100px); line-height: 1; letter-spacing: -.02em; color: var(--primary); }
.prompt .speak-mini { position: absolute; bottom: 12px; right: 12px; }
.prompt.pop { animation: pop .25s; }
@keyframes pop { 50% { transform: scale(1.05); } }
.prompt.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.stamp { position: absolute; top: -14px; right: -14px; width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; font-family: var(--kana); font-weight: 700; font-size: 2rem; color: #fff; transform: rotate(-12deg) scale(0); transition: transform .25s cubic-bezier(.3, 1.6, .5, 1); box-shadow: 0 4px 12px rgba(0, 0, 0, .2); }
.stamp.show { transform: rotate(-12deg) scale(1); }
.stamp.good { background: var(--good); }
.stamp.bad { background: var(--bad); }
.choices { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; width: min(520px, 100%); }
.choice { position: relative; padding: 16px 12px; border-radius: 16px; border: 2px solid var(--line); background: var(--surface); font-weight: 900; font-size: 1.5rem; cursor: pointer; box-shadow: 0 4px 0 var(--line); transition: transform .08s, border-color .12s, background .12s; }
.choice[lang="ja"] { font-size: 2rem; font-weight: 700; padding: 10px; }
.choice:hover:not(:disabled) { border-color: var(--primary); }
.choice:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
.choice .kbd { position: absolute; top: 6px; left: 10px; font: 800 .7rem var(--ui); color: var(--muted); }
.choice.right { background: var(--good-tint); border-color: var(--good); box-shadow: 0 4px 0 var(--good); color: var(--good); }
.choice.wrong { background: var(--bad-tint); border-color: var(--bad); box-shadow: 0 4px 0 var(--bad); color: var(--bad); }
.choice:disabled { cursor: default; }
.feedback { min-height: 64px; text-align: center; width: min(560px, 100%); }
.feedback .hint { background: var(--tint); border-radius: 14px; padding: 12px 16px; font-size: .98rem; text-align: left; display: flex; gap: 12px; align-items: flex-start; }
.feedback .hint b { color: var(--primary); }
.feedback .hint .hk { font-family: var(--kana); font-size: 2rem; line-height: 1; font-weight: 700; }
.next-row { display: flex; justify-content: center; margin-top: 10px; }

/* typing */
.type-input { width: min(320px, 80vw); font: 900 2rem var(--ui); text-align: center; padding: 12px 16px; border-radius: 16px; border: 3px solid var(--line); background: var(--bg); color: var(--ink); outline: none; text-transform: lowercase; transition: border-color .12s; }
.type-input:focus { border-color: var(--primary); }
.type-input.bad { border-color: var(--bad); animation: shake .3s; }
.type-input.good { border-color: var(--good); }
.reveal { font-weight: 800; color: var(--bad); min-height: 1.6em; }
.skip-hint { color: var(--muted); font-size: .88rem; }

/* rain */
.rain-field { position: relative; height: min(58vh, 520px); border-radius: 20px; overflow: hidden; background: linear-gradient(to bottom, var(--tint), var(--bg) 70%); border: 1px solid var(--line); }
.rain-field::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 10px; background: repeating-linear-gradient(90deg, var(--primary) 0 16px, color-mix(in srgb, var(--primary) 70%, #fff) 16px 32px); opacity: .7; }
.drop { position: absolute; top: 0; left: 0; display: grid; place-items: center; width: 66px; height: 66px; margin-left: -33px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line); box-shadow: var(--shadow); font-family: var(--kana); font-weight: 700; font-size: 34px; will-change: transform; }
.drop.long { font-size: 24px; }
.drop.target { border-color: var(--primary); }
.drop.popped { animation: popout .3s forwards; background: var(--good); color: #fff; border-color: var(--good); }
.drop.landed { animation: splat .5s forwards; background: var(--bad); color: #fff; border-color: var(--bad); }
@keyframes popout { to { transform: var(--t) scale(1.6); opacity: 0; } }
@keyframes splat { to { transform: var(--t) scaleY(.4); opacity: 0; } }
.rain-hud { position: absolute; top: 12px; left: 14px; right: 14px; display: flex; justify-content: space-between; font-weight: 900; z-index: 2; pointer-events: none; }
.hearts { letter-spacing: 2px; }
.level-toast { position: absolute; inset: 0; display: grid; place-items: center; font-size: 2.4rem; font-weight: 900; color: var(--primary); pointer-events: none; animation: toast 1.2s forwards; z-index: 3; }
@keyframes toast { 0% { opacity: 0; transform: scale(.8); } 20% { opacity: 1; transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; } }
.rain-bottom { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 16px; }
.rain-miss { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); background: var(--bad); color: #fff; padding: 4px 12px; border-radius: 999px; font-weight: 900; z-index: 2; animation: toast 1.4s forwards; }
.rain-miss span { font-family: var(--kana); }

/* match */
.match-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; max-width: 560px; margin: 0 auto; perspective: 900px; }
.mcard { position: relative; aspect-ratio: 1 / 1.15; border: 0; padding: 0; background: none; cursor: pointer; transform-style: preserve-3d; transition: transform .35s; }
.mcard.flipped, .mcard.done { transform: rotateY(180deg); }
.mcard .face { position: absolute; inset: 0; border-radius: 14px; display: grid; place-items: center; backface-visibility: hidden; -webkit-backface-visibility: hidden; }
.mcard .front { background: var(--primary); box-shadow: 0 4px 0 color-mix(in srgb, var(--primary) 60%, #000); background-image: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, .22) 0 10px, transparent 11px), radial-gradient(circle at 50% 50%, transparent 0 18px, rgba(255, 255, 255, .12) 19px 21px, transparent 22px); }
.mcard .back { background: var(--surface); border: 2px solid var(--line); transform: rotateY(180deg); font-weight: 900; font-size: clamp(1.2rem, 4vw, 1.8rem); box-shadow: 0 4px 0 var(--line); }
.mcard .back[lang="ja"] { font-size: clamp(1.8rem, 7vw, 2.8rem); font-weight: 700; }
.mcard.done .back { border-color: var(--good); background: var(--good-tint); color: var(--good); box-shadow: 0 4px 0 var(--good); }
.mcard.miss .back { border-color: var(--bad); background: var(--bad-tint); }

/* results */
.results { text-align: center; display: grid; justify-items: center; gap: 6px; padding-top: 8px; }
.results h2 { margin: 0; font-size: 2rem; }
.big-score { font-size: clamp(3.6rem, 12vw, 5.5rem); font-weight: 900; line-height: 1; color: var(--primary); letter-spacing: -.04em; }
.res-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 14px 0 6px; }
.res-stats div { background: var(--surface-2); border-radius: 14px; padding: 10px 18px; min-width: 110px; }
.res-stats b { display: block; font-size: 1.4rem; }
.res-stats span { color: var(--muted); font-size: .85rem; font-weight: 700; }
.new-best { background: var(--accent); color: #fff; padding: 4px 14px; border-radius: 999px; font-weight: 900; font-size: .9rem; animation: pop .5s 2; }
.missed { margin-top: 14px; width: min(620px, 100%); }
.missed h3 { margin: 0 0 10px; font-size: 1rem; color: var(--muted); }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.char-page .chip-row { justify-content: flex-start; }
.kchip { display: inline-flex; flex-direction: column; align-items: center; min-width: 60px; padding: 8px 10px; border-radius: 12px; background: var(--surface); border: 2px solid var(--line); text-decoration: none; color: var(--ink); cursor: pointer; font-family: inherit; }
.kchip span { font-family: var(--kana); font-weight: 700; font-size: 1.6rem; line-height: 1.1; }
.kchip small { font-weight: 800; color: var(--muted); }
.kchip:hover { border-color: var(--primary); }
.kchip.on { border-color: var(--primary); background: var(--tint); }
.res-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin-top: 20px; }
.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 14px; border-radius: 2px; animation: confetti 1.6s ease-in forwards; }
@keyframes confetti { to { transform: translate(var(--dx), 600px) rotate(720deg); opacity: 0; } }

/* ---------- character page ---------- */
.char-page { padding-top: 28px; }
.crumbs { font-size: .92rem; color: var(--muted); font-weight: 700; margin-bottom: 20px; }
.crumbs a { text-decoration: none; }
.char-hero { display: grid; grid-template-columns: 300px 1fr; gap: 40px; align-items: center; }
.char-card { position: relative; aspect-ratio: 1; background: var(--surface); border-radius: 30px; border: 1px solid var(--line); box-shadow: var(--shadow-lg); display: grid; place-items: center; background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px); background-size: 50% 50%; background-position: center; }
.char-k { font-size: 170px; font-weight: 700; line-height: 1; }
.char-page[data-char] .char-k:lang(ja) { font-size: clamp(110px, 30vw, 170px); }
.speak-btn { position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%); border: 0; background: var(--primary); color: #fff; font-weight: 900; padding: 8px 16px; border-radius: 999px; cursor: pointer; box-shadow: 0 3px 0 color-mix(in srgb, var(--primary) 60%, #000); }
.mini-speak { border: 0; background: var(--surface-2); border-radius: 8px; padding: 2px 8px; cursor: pointer; vertical-align: middle; }
.char-info h1 { font-size: clamp(2rem, 5vw, 3rem); }
.char-info h1 span { color: var(--primary); }
.mastery { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; background: var(--surface-2); font-weight: 800; font-size: .92rem; }
.mastery i { width: 10px; height: 10px; border-radius: 50%; }
.char-body { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; margin-top: 40px; }
.card-section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 24px; }
.card-section h2 { font-size: .85rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 0 0 10px; }
.card-section p { margin: 0; }
.mnemonic { background: var(--tint); border-color: transparent; }
.mnemonic p { font-size: 1.2rem; font-weight: 700; }
.ex-word { font-size: 2rem; font-weight: 700; }
.inline-k { font-size: 1.4em; font-weight: 700; }
.other-script { display: flex; align-items: center; gap: 16px; padding: 18px 22px; border-radius: var(--radius); background: var(--ink); color: var(--bg); text-decoration: none; font-weight: 800; }
.other-script > span:first-child { font-family: var(--kana); font-size: 2.6rem; line-height: 1; }
.prevnext { display: flex; justify-content: space-between; gap: 12px; margin-top: 32px; }
.prevnext a { padding: 12px 18px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; font-weight: 800; color: var(--ink); }
.prevnext a span { font-size: 1.3em; }
@media (max-width: 760px) {
  .char-hero { grid-template-columns: 1fr; gap: 24px; }
  .char-card { max-width: 260px; width: 100%; margin: 0 auto; }
  .char-info { text-align: center; }
  .char-info .cta-row { justify-content: center; }
}
.big-404 { font-size: 7rem; font-weight: 700; margin: 0; color: var(--primary); line-height: 1; }
.game-head.center .lead { margin-inline: auto; }

@media (max-width: 520px) {
  body { font-size: 16px; }
  .wrap { width: calc(100% - 28px); }
  .section { margin-block: 40px; }
  .app { border-radius: 20px; min-height: 480px; }
  .choice { font-size: 1.3rem; padding: 14px 8px; }
  .match-grid { gap: 8px; }
}
