/* Ukiyo Passport
   Layout: an Edo travel-map world. The journey map is the home screen; chapters open as seasonal scenes;
   lessons run in a focused full-screen player. One committed light, washi-paper look (the Floating World
   chapter switches the player to its own night palette). */
:root {
  --paper: #FBF3EE; --paper2: #F3E4DC; --washi: #F1E6D2; --card: #FFFFFF; --line: #E4D2C8;
  --ink: #1F2B4D; --ink-soft: #56607E; --sea: #CFE0EE;
  --beni: #D23F4E; --beni-deep: #9E2A37; --sakura: #F6B8C4; --gold: #E0A43A; --matcha: #6E9A4E;
  --ok: #2F7D3E; --ok-bg: #E2F0D6; --bad: #B8323F; --bad-bg: #FBE0E3;
  --night: #1A0D16; --night-card: #2A1220; --night-ink: #F6E7D8; --night-gold: #E9B44C;
  --accent: var(--beni); --band: #FDE3E8;
  --f-display: "Dela Gothic One", "Zen Maru Gothic", system-ui, sans-serif;
  --f-body: "Zen Maru Gothic", "Hiragino Maru Gothic ProN", system-ui, sans-serif;
  --f-mincho: "Shippori Mincho", "Hiragino Mincho ProN", "Yu Mincho", serif;
  --f-kana: "Klee One", "Zen Maru Gothic", "Hiragino Maru Gothic ProN", system-ui, sans-serif;
  --gutter: max(16px, env(safe-area-inset-left, 0px));
  --gutter-r: max(16px, env(safe-area-inset-right, 0px));
  --tabbar: 0px;
  color-scheme: light;
  padding-top: env(safe-area-inset-top, 0px);
}
* { box-sizing: border-box; }
html, body { background: var(--paper); color: var(--ink); }
body { margin: 0; font-family: var(--f-body); font-size: 16px; line-height: 1.6; min-height: 100%;
  background-image: radial-gradient(circle at 8% 4%, rgba(246, 184, 196, .35), transparent 38%), radial-gradient(circle at 95% 96%, rgba(157, 188, 216, .28), transparent 42%);
  background-attachment: fixed; padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom, 0px)); }
[hidden] { display: none !important; }
img, svg { max-width: 100%; }
button { font-family: inherit; color: inherit; }
a { color: var(--beni-deep); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.sr-only { position: absolute; left: 0; top: 0; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { max-width: 1120px; margin: 0 auto; padding-left: var(--gutter); padding-right: var(--gutter-r); }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: env(safe-area-inset-top, 0px); z-index: 30; background: rgba(251, 243, 238, .92); backdrop-filter: blur(8px); border-bottom: 2px solid var(--line); }
body::before { content: ""; position: fixed; inset: 0 0 auto; height: env(safe-area-inset-top, 0px); z-index: 31; background: var(--paper); }
.topbar .wrap { display: flex; align-items: center; gap: 12px; padding-block: 10px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; margin-right: auto; min-width: 0; }
.brand .seal { width: 40px; height: 40px; flex: none; }
.brand b { font-family: var(--f-display); font-weight: 400; font-size: 21px; line-height: 1; letter-spacing: .01em; }
.brand small { display: block; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-soft); margin-top: 3px; }
.hud { display: flex; align-items: center; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border: 2px solid var(--ink); border-radius: 999px; background: var(--card); font-weight: 700; font-size: 14px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.chip svg { width: 18px; height: 22px; }
.chip.dim svg { filter: grayscale(1); opacity: .55; }
.chip.level { gap: 8px; padding-left: 4px; }
.chip.level .rank { background: var(--beni); color: #fff; border-radius: 999px; height: 26px; min-width: 26px; padding: 0 8px; display: grid; place-items: center; font-family: var(--f-mincho); font-weight: 800; font-size: 13px; }
.chip .bar { width: 44px; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.chip .bar i { display: block; height: 100%; background: var(--gold); }
.ring { width: 22px; height: 22px; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 2px solid var(--ink); background: var(--card); display: grid; place-items: center; cursor: pointer; padding: 0; }
.icon-btn svg { width: 20px; height: 20px; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 6px; }
.tabs a { display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 12px; text-decoration: none; color: var(--ink); font-weight: 700; font-size: 15px; border: 2px solid transparent; }
.tabs a svg { width: 20px; height: 20px; }
.tabs a[aria-current="page"] { background: var(--card); border-color: var(--ink); box-shadow: 0 3px 0 var(--ink); }
.tabs-row { padding-block: 10px 4px; }
@media (max-width: 760px) {
  :root { --tabbar: 66px; }
  .tabs-row { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; background: var(--card); border-top: 2px solid var(--ink);
    padding: 6px var(--gutter-r) calc(6px + env(safe-area-inset-bottom, 0px)) var(--gutter); }
  .tabs { justify-content: space-around; }
  .tabs a { flex-direction: column; gap: 2px; padding: 4px 6px; font-size: 11px; border: 0; }
  .tabs a[aria-current="page"] { background: none; box-shadow: none; color: var(--beni); }
  .brand small, .chip .label, .chip .bar { display: none; }
  .brand b { font-size: 18px; }
  .chip { height: 32px; padding: 0 9px; font-size: 13px; }
}

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 2px solid var(--ink); background: var(--card); border-radius: 14px; padding: 11px 20px; font-weight: 700; font-size: 16px; cursor: pointer; box-shadow: 0 3px 0 var(--ink); transition: transform .08s, box-shadow .08s; text-decoration: none; color: var(--ink); }
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 0 var(--ink); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.btn.primary { background: var(--beni); color: #fff; }
.btn.ghost { box-shadow: none; border-color: var(--line); background: transparent; }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: .45; cursor: not-allowed; transform: none; box-shadow: 0 3px 0 var(--ink); }
.btn svg { width: 18px; height: 18px; }

/* ---------- page sections ---------- */
main { padding-block: 18px 40px; }
.h2 { font-family: var(--f-display); font-weight: 400; font-size: clamp(22px, 3.4vw, 30px); line-height: 1.15; margin: 0; text-wrap: balance; }
.h3 { font-family: var(--f-display); font-weight: 400; font-size: 19px; line-height: 1.2; margin: 0; }
.eyebrow { font-size: 12px; letter-spacing: .16em; text-transform: uppercase; font-weight: 700; color: var(--beni); }
.muted { color: var(--ink-soft); }
.card { background: var(--card); border: 2px solid var(--ink); border-radius: 20px; padding: 18px; box-shadow: 0 4px 0 var(--ink); min-width: 0; }

/* ---------- journey ---------- */
.journey { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 24px; align-items: start; }
.map-col { position: sticky; top: 84px; min-width: 0; }
.mapbox { position: relative; width: 100%; aspect-ratio: 1000 / 1120; border: 3px solid var(--ink); border-radius: 24px; overflow: hidden; background: var(--sea); box-shadow: 0 6px 0 var(--ink); }
.mapbox .japan { position: absolute; inset: 0; width: 100%; height: 100%; }
.japan .maplabel { font-family: var(--f-mincho); font-weight: 800; fill: var(--ink); paint-order: stroke; stroke: #F1E6D2; stroke-width: 5px; stroke-linejoin: round; }
.japan .maplabel.sea { fill: #6A86A6; stroke: none; opacity: .85; }
.japan .route { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.japan .route.walked { stroke: var(--beni); stroke-width: 5; }
.japan .route.ahead { stroke: #7C879E; stroke-width: 4; stroke-dasharray: 2 9; }
.japan .leader { stroke: var(--ink); stroke-width: 1.6; stroke-dasharray: 3 4; fill: none; opacity: .7; }
.japan .at { fill: var(--beni); stroke: #fff; stroke-width: 2; }
.japan .kumo { fill: #E9C46A; opacity: .6; }
.japan .cartouche rect { fill: #FBF3EE; stroke: var(--beni); stroke-width: 3; }
.japan .cartouche .inner { fill: none; stroke-width: 1; }
.japan .ct-jp { font-family: var(--f-mincho); font-weight: 800; font-size: 30px; fill: var(--ink); letter-spacing: .12em; }
.japan .ct-en { font-family: var(--f-body); font-size: 13px; font-weight: 700; letter-spacing: .3em; fill: var(--beni); }
.node { position: absolute; transform: translate(-50%, -50%); display: grid; justify-items: center; gap: 4px; background: none; border: 0; padding: 0; cursor: pointer; }
.node .seal { width: clamp(36px, 7.4vw, 56px); height: clamp(36px, 7.4vw, 56px); border-radius: 50%; background: var(--card); border: 3px solid var(--ink); display: grid; place-items: center;
  font-family: var(--f-mincho); font-weight: 800; font-size: clamp(17px, 3.2vw, 25px); box-shadow: 0 3px 0 var(--ink); transition: transform .15s; position: relative; }
.node:hover .seal { transform: translateY(-3px) rotate(-4deg); }
.node .lbl { background: var(--ink); color: #fff; border-radius: 8px; padding: 1px 8px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.node.done .seal { background: var(--beni); color: #fff; }
.node.locked .seal { background: #E9E4E0; color: #9A94A3; border-color: #9A94A3; box-shadow: 0 3px 0 #9A94A3; }
.node.locked .lbl { background: #9A94A3; }
.node.current .seal::before { content: ""; position: absolute; inset: -9px; border-radius: 50%; border: 3px solid var(--beni); animation: pulse 1.8s ease-out infinite; }
.node .you { position: absolute; bottom: calc(100% - 12px); width: clamp(34px, 6vw, 50px); pointer-events: none; }
.node .you svg { display: block; width: 100%; height: auto; }
@keyframes pulse { 0% { transform: scale(.85); opacity: 1; } 100% { transform: scale(1.35); opacity: 0; } }
.map-note { font-size: 12px; color: var(--ink-soft); margin: 10px 4px 0; }
@media (max-width: 900px) { .node .lbl { display: none; } }

.side-col { display: grid; gap: 18px; min-width: 0; }
.next { padding: 0; overflow: hidden; }
.next .band { position: relative; background: var(--band); border-bottom: 2px solid var(--ink); padding: 14px 18px 0; display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 14px; align-items: end; min-height: 120px; overflow: hidden; }
.next .band .banner-art { position: absolute; inset: 0; width: 100%; height: 100%; }
.next .band .portrait { width: 96px; position: relative; display: block; }
.next .band .who { position: relative; padding-bottom: 14px; min-width: 0; }
.next .body { padding: 16px 18px 18px; display: grid; gap: 12px; }
.dots { display: flex; gap: 6px; align-items: center; }
.dots i { width: 28px; height: 8px; border-radius: 4px; background: var(--line); }
.dots i.on { background: var(--beni); }
.dots i.gate { width: 18px; height: 18px; border-radius: 4px; background: none; display: grid; place-items: center; }
.dots i.gate svg { width: 18px; height: 18px; }
.goal { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 16px; align-items: center; }
.goal .big-ring { width: 76px; height: 76px; }
.stat-line { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 14px; color: var(--ink-soft); }
.stat-line b { color: var(--ink); font-variant-numeric: tabular-nums; }
.chapter-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.chapter-list button { width: 100%; display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; align-items: center; text-align: left; background: var(--paper); border: 2px solid var(--line); border-radius: 14px; padding: 8px 12px; cursor: pointer; }
.chapter-list button:hover { border-color: var(--ink); }
.chapter-list .s { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; font-family: var(--f-mincho); font-weight: 800; font-size: 20px; background: var(--card); border: 2px solid var(--ink); }
.chapter-list .done .s { background: var(--beni); color: #fff; }
.chapter-list .locked { opacity: .6; }
.chapter-list b { display: block; font-size: 15px; line-height: 1.3; }
.chapter-list small { color: var(--ink-soft); font-size: 13px; }
.chapter-list .tag { font-size: 12px; font-weight: 700; color: var(--ink-soft); }
@media (max-width: 900px) { .journey { grid-template-columns: minmax(0, 1fr); } .map-col { position: relative; top: 0; } }

/* ---------- chapter ---------- */
.theme-spring { --accent: #D9607F; --band: #FDE3E8; }
.theme-autumn { --accent: #C8471E; --band: #FBE1CF; }
.theme-summer { --accent: #5563C4; --band: #E2E5FA; }
.theme-festival { --accent: #C98A1A; --band: #FFF0CC; }
.theme-night { --accent: #E0303F; --band: #2A1220; }
.chapter { display: grid; gap: 22px; }
.chapter-head { position: relative; border: 3px solid var(--ink); border-radius: 24px; overflow: hidden; background: var(--band); box-shadow: 0 6px 0 var(--ink);
  display: grid; grid-template-columns: 190px minmax(0, 1fr); gap: 18px; align-items: end; padding: 22px 22px 0; }
.chapter-head .banner-art { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .9; }
.chapter-head .portrait { position: relative; width: 190px; display: block; animation: bob 3.2s ease-in-out infinite; }
.chapter-head .txt { position: relative; padding-bottom: 22px; min-width: 0; display: grid; gap: 8px; }
.chapter-head .kanji { font-family: var(--f-mincho); font-weight: 800; font-size: 54px; line-height: 1; color: var(--accent); letter-spacing: .06em; }
.chapter-head .season { display: inline-block; justify-self: start; background: var(--card); border: 2px solid var(--ink); border-radius: 999px; padding: 2px 12px; font-size: 13px; font-weight: 700; }
.chapter-head p { margin: 0; max-width: 60ch; }
.theme-night .chapter-head, .theme-night.chapter-head { color: var(--night-ink); background: radial-gradient(circle at 80% 20%, rgba(224, 48, 63, .45), transparent 55%), radial-gradient(circle at 15% 90%, rgba(233, 180, 76, .25), transparent 50%), var(--night); }
.theme-night .chapter-head .season { background: var(--night-card); border-color: var(--night-gold); color: var(--night-gold); }
.theme-night .chapter-head .kanji { color: #FF6B6B; text-shadow: 0 0 18px rgba(224, 48, 63, .8); }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.chapter-body { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 22px; align-items: start; }
.path { list-style: none; margin: 0; padding: 8px 0; display: grid; gap: 14px; }
.path li { display: flex; }
.path li:nth-child(4n+2) { padding-left: 70px; } .path li:nth-child(4n+3) { padding-left: 110px; } .path li:nth-child(4n+4) { padding-left: 50px; }
.step { display: grid; grid-template-columns: 74px minmax(0, 1fr); gap: 14px; align-items: center; background: none; border: 0; padding: 0; text-align: left; cursor: pointer; min-width: 0; }
.step .disc { width: 74px; height: 74px; border-radius: 50%; display: grid; place-items: center; background: var(--card); border: 3px solid var(--ink); box-shadow: 0 5px 0 var(--ink);
  font-family: var(--f-kana); font-weight: 600; font-size: 28px; position: relative; transition: transform .12s; }
.step:hover .disc { transform: translateY(-2px); }
.step.done .disc { background: var(--accent); color: #fff; }
.step.current .disc { background: var(--gold); }
.step.current .disc::after { content: ""; position: absolute; inset: -8px; border-radius: 50%; border: 3px solid var(--accent); animation: pulse 1.8s ease-out infinite; }
.step.locked { cursor: not-allowed; }
.step.locked .disc { background: #EEE8E4; color: #A49DAA; border-color: #A49DAA; box-shadow: 0 5px 0 #A49DAA; }
.step .disc svg { width: 34px; height: 34px; }
.step b { display: block; font-size: 16px; line-height: 1.25; }
.step small { color: var(--ink-soft); font-size: 13px; }
.scrolls { display: grid; gap: 12px; }
.scroll { display: grid; grid-template-columns: 64px minmax(0, 1fr); background: var(--card); border: 2px solid var(--ink); border-radius: 16px; overflow: hidden; }
.scroll .k { background: var(--ink); color: #fff; display: grid; place-items: center; font-family: var(--f-mincho); font-weight: 800; font-size: 22px; writing-mode: vertical-rl; letter-spacing: .08em; padding: 10px 0; }
.scroll .t { padding: 10px 14px; min-width: 0; }
.scroll .t b { font-family: var(--f-display); font-weight: 400; font-size: 16px; display: block; line-height: 1.25; }
.scroll .t p { margin: 4px 0 0; font-size: 14px; }
.scroll.locked .k { background: var(--line); color: var(--paper); }
.scroll.locked .t { color: var(--ink-soft); }
.fortune { font-family: var(--f-mincho); font-weight: 800; font-size: 40px; color: var(--beni); line-height: 1; }
@media (max-width: 860px) { .chapter-body { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 620px) {
  .chapter-head { grid-template-columns: 110px minmax(0, 1fr); padding: 14px 14px 0; gap: 10px; }
  .chapter-head .portrait { width: 110px; }
  .chapter-head .kanji { font-size: 38px; }
  .chapter-head .txt { padding-bottom: 14px; }
  .chapter-head p { display: none; }
  .path li:nth-child(4n+2) { padding-left: 36px; } .path li:nth-child(4n+3) { padding-left: 64px; } .path li:nth-child(4n+4) { padding-left: 28px; }
}

/* ---------- practice, skills, passport ---------- */
.page-head { display: grid; gap: 6px; margin-bottom: 18px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 18px; align-items: start; }
.meter { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--matcha); }
.weak { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.weak li { display: grid; grid-template-columns: minmax(54px, max-content) minmax(0, 1fr) 70px; gap: 12px; align-items: center; }
.weak .jp { font-family: var(--f-kana); font-size: 22px; font-weight: 600; white-space: nowrap; }
.kana-grid { display: grid; gap: 6px; }
.kana-row { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; }
.kcell { aspect-ratio: 1; border-radius: 12px; border: 2px solid var(--line); background: var(--paper); display: grid; place-items: center; align-content: center; gap: 0; cursor: pointer; padding: 2px; min-width: 0; }
.kcell b { font-family: var(--f-kana); font-weight: 600; font-size: clamp(20px, 4.4vw, 30px); line-height: 1.1; }
.kcell small { font-size: 11px; color: var(--ink-soft); line-height: 1; }
.kcell.s0 { border-color: var(--ink); background: #fff; }
.kcell.s1 { border-color: var(--ink); background: #FDE7EB; } .kcell.s2 { border-color: var(--ink); background: #FBD1DA; }
.kcell.s3 { border-color: var(--ink); background: #F6B8C4; } .kcell.s4 { border-color: var(--ink); background: #EE97A8; }
.kcell.s5 { border-color: var(--ink); background: var(--beni); color: #fff; } .kcell.s5 small { color: #fff; }
.kcell.unseen { opacity: .45; }
.kcell.blank { visibility: hidden; }
.legend { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; font-size: 12px; color: var(--ink-soft); }
.legend i { display: inline-block; width: 16px; height: 16px; border-radius: 5px; border: 2px solid var(--ink); vertical-align: -3px; margin-right: 4px; }
.words { width: 100%; border-collapse: collapse; font-size: 15px; }
.words th { text-align: left; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); padding: 6px 8px; border-bottom: 2px solid var(--line); }
.words td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.words td.jp { font-family: var(--f-kana); font-size: 20px; font-weight: 600; white-space: nowrap; }
.table-wrap { overflow-x: auto; position: relative; }
@media (max-width: 560px) { .words { font-size: 14px; } .words td, .words th { padding: 6px 4px; } .words td.jp { font-size: 17px; } }
.say { width: 34px; height: 34px; border-radius: 10px; border: 2px solid var(--ink); background: var(--card); display: inline-grid; place-items: center; cursor: pointer; padding: 0; vertical-align: middle; }
.say svg { width: 18px; height: 18px; }
.profile { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 18px; align-items: center; }
.profile .portrait { width: 130px; }
.rankseal { display: inline-grid; place-items: center; width: 74px; height: 74px; border-radius: 14px; border: 4px solid var(--beni); color: var(--beni); font-family: var(--f-mincho); font-weight: 800; font-size: 24px; transform: rotate(-6deg); background: rgba(210, 63, 78, .06); }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.stat { background: var(--paper); border: 2px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.stat b { display: block; font-family: var(--f-display); font-weight: 400; font-size: 24px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat small { color: var(--ink-soft); font-size: 13px; }
.stamps { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 10px; }
.stampc { background: var(--paper); border: 2px solid var(--line); border-radius: 14px; padding: 12px 8px; display: grid; justify-items: center; gap: 6px; text-align: center; font-size: 13px; font-weight: 700; }
.hanko { width: 62px; height: 62px; border-radius: 12px; border: 4px solid var(--beni); color: var(--beni); display: grid; place-items: center; font-family: var(--f-mincho); font-weight: 800; font-size: 30px; transform: rotate(-8deg); background: rgba(210, 63, 78, .06); }
.hanko.miss { border-color: var(--line); color: var(--line); background: none; }
.hanko.big { width: 120px; height: 120px; font-size: 56px; border-width: 6px; animation: stamp .5s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes stamp { 0% { transform: scale(2.2) rotate(-20deg); opacity: 0; } 100% { transform: scale(1) rotate(-8deg); opacity: 1; } }
.ycards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.ycard { background: var(--card); border: 2px solid var(--ink); border-radius: 16px; overflow: hidden; display: grid; grid-template-rows: auto 1fr; }
.ycard .art { position: relative; background: radial-gradient(circle at 30% 40%, #3A4A7E, var(--ink) 70%); color: #fff; display: grid; grid-template-columns: 84px 1fr; align-items: center; gap: 2px 10px; padding: 10px 14px; }
.ycard .yart { grid-row: span 2; width: 84px; height: 84px; display: block; filter: drop-shadow(0 3px 0 rgba(0, 0, 0, .35)); }
.ycard .yart.q { display: grid; place-items: center; font-family: var(--f-mincho); font-size: 44px; filter: none; opacity: .7; }
.ycard:not(.locked) { cursor: pointer; transition: transform .15s; }
.ycard:not(.locked):hover { transform: translateY(-3px); }
.ycard:not(.locked):hover .yart { animation: bob 1s ease-in-out infinite; }
.ycard.wiggle .yart { animation: wiggle .6s ease-in-out; }
@keyframes wiggle { 20% { transform: rotate(-12deg) scale(1.12); } 50% { transform: rotate(10deg) scale(1.12); } 80% { transform: rotate(-5deg); } }
.ycard .art .k { font-family: var(--f-mincho); font-weight: 800; font-size: 30px; line-height: 1; align-self: end; }
.ycard .art .r { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; opacity: .85; align-self: start; }
.ycard .tx { padding: 10px 14px; font-size: 14px; }
.ycard .tx b { font-family: var(--f-display); font-weight: 400; font-size: 16px; display: block; }
.ycard.locked .art { background: var(--line); color: var(--paper); }
.ycard.locked .tx { color: var(--ink-soft); }
.choice { display: flex; flex-wrap: wrap; gap: 8px; }
.choice button { border: 2px solid var(--ink); background: var(--card); border-radius: 999px; padding: 6px 14px; font-weight: 700; cursor: pointer; }
.choice button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.cert { text-align: center; display: grid; justify-items: center; gap: 8px; background: var(--card); border: 6px double var(--beni); border-radius: 18px; padding: 22px; }
@media (max-width: 560px) { .profile { grid-template-columns: 90px minmax(0, 1fr); } .profile .portrait { width: 90px; } }

/* ---------- lesson player ---------- */
body.playing { overflow: hidden; }
.player { position: fixed; inset: 0; z-index: 60; background: var(--paper); display: grid; grid-template-rows: auto minmax(0, 1fr) auto; color: var(--ink);
  padding-top: env(safe-area-inset-top, 0px); }
.player.theme-night { --paper: #1A0D16; --card: #2A1220; --ink: #F6E7D8; --ink-soft: #CDB7A8; --line: #4A2635; color: var(--night-ink);
  background: radial-gradient(circle at 85% 8%, rgba(224, 48, 63, .38), transparent 42%), radial-gradient(circle at 10% 95%, rgba(233, 180, 76, .18), transparent 45%), #1A0D16; }
.player.theme-night .btn { box-shadow: 0 3px 0 #000; border-color: var(--night-gold); }
.player.theme-night .btn.primary { background: #C8263A; }
.player.theme-night .lanterns { display: block; }
.lanterns { display: none; position: absolute; left: 0; right: 0; top: env(safe-area-inset-top, 0px); height: 56px; pointer-events: none; overflow: hidden; }
.player.theme-night .ptop { padding-top: 54px; }
.lanterns svg { width: 100%; height: 100%; }
.ptop { position: relative; z-index: 1; display: flex; align-items: center; gap: 14px; padding: 14px var(--gutter-r) 10px var(--gutter); max-width: 900px; width: 100%; margin: 0 auto; }
.pbar { flex: 1; height: 14px; border-radius: 7px; background: var(--line); overflow: hidden; border: 2px solid var(--ink); }
.pbar i { display: block; height: 100%; background: var(--accent); border-radius: 5px; transition: width .3s; }
.pxp { display: inline-flex; align-items: center; gap: 4px; font-weight: 800; font-variant-numeric: tabular-nums; }
.pxp svg { width: 20px; height: 20px; }
.pbody { overflow-y: auto; padding: 8px var(--gutter-r) 24px var(--gutter); position: relative; z-index: 1; }
.pinner { max-width: 760px; margin: 0 auto; display: grid; gap: 18px; align-content: start; padding-top: clamp(4px, 3vh, 36px); }
.pinner.k-intro, .pinner.k-gate, .pinner.k-teach-kana, .pinner.k-teach-row, .pinner.k-teach-word, .pinner.k-teach-phrase, .pinner.k-done { min-height: 100%; align-content: center; padding-top: 0; }
.pfoot { border-top: 2px solid var(--line); background: var(--card); padding: 14px var(--gutter-r) calc(14px + env(safe-area-inset-bottom, 0px)) var(--gutter); position: relative; z-index: 2; }
.pfoot .in { max-width: 760px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; min-height: 50px; }
.pfoot.ok { background: var(--ok-bg); border-color: #B9DBA4; }
.pfoot.bad { background: var(--bad-bg); border-color: #F2B8C0; }
.player.theme-night .pfoot.ok { background: #16301E; border-color: #2F6B3E; }
.player.theme-night .pfoot.bad { background: #3A1018; border-color: #7A2030; }
.fb { display: grid; gap: 2px; min-width: 0; flex: 1 1 260px; }
.fb b { font-family: var(--f-display); font-weight: 400; font-size: 20px; }
.pfoot.ok .fb b { color: var(--ok); } .pfoot.bad .fb b { color: var(--bad); }
.player.theme-night .pfoot.ok .fb b { color: #8FD69C; } .player.theme-night .pfoot.bad .fb b { color: #FF8A96; }
.fb span { font-size: 15px; }
.qline { font-family: var(--f-display); font-weight: 400; font-size: clamp(19px, 3vw, 24px); line-height: 1.25; margin: 0; text-wrap: balance; }
.prompt { display: grid; justify-items: center; gap: 4px; padding: 10px; }
.prompt .kana { font-family: var(--f-kana); font-weight: 600; font-size: clamp(72px, 16vw, 120px); line-height: 1.1; }
.prompt .word { font-family: var(--f-kana); font-weight: 600; font-size: clamp(40px, 9vw, 64px); line-height: 1.15; text-align: center; }
.prompt .ro { color: var(--ink-soft); font-size: 18px; }
.prompt .en { font-family: var(--f-display); font-weight: 400; font-size: clamp(24px, 5vw, 34px); text-align: center; }
.bigsay { width: 110px; height: 110px; border-radius: 28px; border: 3px solid var(--ink); background: var(--card); box-shadow: 0 5px 0 var(--ink); display: grid; place-items: center; cursor: pointer; color: var(--accent); }
.bigsay svg { width: 56px; height: 56px; }
.opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.opt { display: grid; gap: 2px; justify-items: center; text-align: center; border: 2px solid var(--ink); background: var(--card); border-radius: 16px; padding: 14px 10px; font-size: 18px; font-weight: 700; cursor: pointer; box-shadow: 0 4px 0 var(--ink); min-height: 64px; align-content: center; min-width: 0; }
.opt .k { font-family: var(--f-kana); font-weight: 600; font-size: 30px; line-height: 1.15; }
.opt small { font-size: 13px; color: var(--ink-soft); font-weight: 600; }
.opt .n { position: absolute; }
.opt:hover:not([disabled]) { transform: translateY(-1px); }
.opt[disabled] { cursor: default; }
.opt.right { background: var(--ok-bg); border-color: var(--ok); box-shadow: 0 4px 0 var(--ok); color: #1D4A26; }
.opt.wrong { background: var(--bad-bg); border-color: var(--bad); box-shadow: 0 4px 0 var(--bad); color: #6E1A24; }
.opt.right small, .opt.wrong small { color: inherit; }
.opts.long { grid-template-columns: minmax(0, 1fr); }
.opts.long .opt { justify-items: start; text-align: left; font-size: 17px; }
.shake { animation: shake .35s; }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
.teach { display: grid; gap: 16px; justify-items: center; text-align: center; background: var(--card); border: 2px solid var(--ink); border-radius: 22px; padding: 22px 18px; box-shadow: 0 5px 0 var(--ink); }
.teach .tag { font-size: 12px; letter-spacing: .16em; text-transform: uppercase; font-weight: 700; color: var(--accent); }
.teach .kana-big { font-family: var(--f-kana); font-weight: 600; font-size: clamp(96px, 24vw, 150px); line-height: 1; }
.teach .ro-big { font-family: var(--f-display); font-weight: 400; font-size: 34px; line-height: 1; }
.teach .tip { max-width: 44ch; font-size: 17px; }
.teach .word-big { font-family: var(--f-kana); font-weight: 600; font-size: clamp(48px, 12vw, 76px); line-height: 1.1; }
.teach .en { font-family: var(--f-display); font-weight: 400; font-size: 24px; }
.breakdown { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.breakdown span { display: grid; justify-items: center; min-width: 46px; padding: 6px 8px; border: 2px solid var(--line); border-radius: 12px; background: var(--paper); }
.breakdown b { font-family: var(--f-kana); font-weight: 600; font-size: 26px; line-height: 1.1; }
.breakdown small { font-size: 12px; color: var(--ink-soft); }
.rowteach { display: grid; grid-template-columns: repeat(auto-fit, minmax(64px, 1fr)); gap: 8px; width: 100%; max-width: 520px; }
.note { font-size: 15px; color: var(--ink-soft); max-width: 50ch; }
.intro { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 16px; align-items: end; }
.intro .portrait { width: 150px; animation: bob 3.2s ease-in-out infinite; }
.bubble { position: relative; background: var(--card); border: 2px solid var(--ink); border-radius: 18px; padding: 14px 18px; min-width: 0; font-size: 17px; }
.bubble::before { content: ""; position: absolute; left: -12px; bottom: 22px; border: 10px solid transparent; border-right-color: var(--ink); border-left: 0; }
.bubble::after { content: ""; position: absolute; left: -9px; bottom: 23px; border: 9px solid transparent; border-right-color: var(--card); border-left: 0; }
.bubble .who { font-family: var(--f-display); font-size: 14px; color: var(--accent); }
.fact { background: var(--card); border: 2px solid var(--ink); border-radius: 18px; overflow: hidden; display: grid; grid-template-columns: 96px minmax(0, 1fr); }
.fact .kanji { background: var(--ink); color: var(--card); display: grid; place-items: center; font-family: var(--f-mincho); font-weight: 800; font-size: 34px; writing-mode: vertical-rl; padding: 14px 0; letter-spacing: .1em; }
.player.theme-night .fact .kanji { background: #9E1F35; color: #FFE9D2; }
.fact .body { padding: 14px 18px; min-width: 0; }
.fact .tag { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.fact h3 { margin: 0 0 4px; font-family: var(--f-display); font-weight: 400; font-size: 19px; line-height: 1.25; text-wrap: balance; }
.fact p { margin: 0; max-width: 62ch; }
.answer-line { min-height: 74px; border-bottom: 3px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 0; align-content: flex-start; }
.bank { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.tile { display: grid; justify-items: center; border: 2px solid var(--ink); background: var(--card); border-radius: 14px; padding: 8px 14px; cursor: pointer; box-shadow: 0 3px 0 var(--ink); min-width: 52px; }
.tile b { font-family: var(--f-kana); font-weight: 600; font-size: 26px; line-height: 1.15; }
.tile small { font-size: 12px; color: var(--ink-soft); }
.tile.used { visibility: hidden; }
.match { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.match .col { display: grid; gap: 10px; }
.mbtn { border: 2px solid var(--ink); background: var(--card); border-radius: 14px; padding: 12px; min-height: 60px; font-size: 20px; font-weight: 700; cursor: pointer; box-shadow: 0 3px 0 var(--ink); }
.mbtn.k { font-family: var(--f-kana); font-weight: 600; font-size: 30px; padding: 6px; }
.mbtn.sel { background: #FFF1C9; border-color: var(--gold); box-shadow: 0 3px 0 var(--gold); }
.mbtn.gone { visibility: hidden; }
.mbtn.miss { animation: shake .35s; background: var(--bad-bg); }
.order-pool { display: flex; flex-wrap: wrap; gap: 8px; }
.order-pool button { border: 2px solid var(--ink); background: var(--sakura); border-radius: 12px; padding: 8px 14px; font-weight: 700; cursor: pointer; box-shadow: 0 3px 0 var(--ink); color: #1F2B4D; }
.slots { display: grid; gap: 8px; }
.slot { display: grid; grid-template-columns: 40px minmax(0, 1fr); gap: 10px; align-items: center; min-height: 48px; border: 2px dashed var(--line); border-radius: 12px; padding: 6px 10px; }
.slot.filled { border-style: solid; border-color: var(--ink); background: var(--card); }
.slot .n { font-family: var(--f-mincho); font-weight: 800; color: var(--ink-soft); text-align: center; }
.slot small { color: var(--ink-soft); display: block; font-size: 13px; }
.typein { display: flex; gap: 10px; justify-content: center; }
.typein input { font: inherit; font-size: 26px; font-weight: 700; text-align: center; width: min(260px, 100%); border: 2px solid var(--ink); border-radius: 14px; padding: 10px; background: var(--card); color: var(--ink); }
.done-card { display: grid; justify-items: center; gap: 14px; text-align: center; padding-top: 10px; }
.done-card .portrait { width: 170px; animation: bob 3.2s ease-in-out infinite; }
.done-card h2 { font-family: var(--f-display); font-weight: 400; font-size: clamp(28px, 5vw, 38px); margin: 0; }
.tallies { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; width: 100%; max-width: 520px; }
.tally { border: 2px solid var(--ink); border-radius: 16px; padding: 10px; background: var(--card); }
.tally b { display: block; font-family: var(--f-display); font-weight: 400; font-size: 26px; font-variant-numeric: tabular-nums; }
.tally small { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); font-weight: 700; }
.levelup { background: linear-gradient(90deg, #FFF1C9, #FDE3E8); border: 2px solid var(--gold); border-radius: 16px; padding: 12px 18px; font-weight: 700; color: #1F2B4D; }
.levelup b { font-family: var(--f-mincho); font-size: 22px; color: var(--beni); }
.unlocks { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.unlocks .ycard { width: 220px; text-align: left; }
.confirm { position: fixed; inset: 0; z-index: 80; background: rgba(31, 43, 77, .45); display: grid; place-items: center; padding: 16px; }
.confirm .box { background: var(--card); color: var(--ink); border: 2px solid var(--ink); border-radius: 20px; padding: 20px; max-width: 380px; display: grid; gap: 12px; box-shadow: 0 6px 0 var(--ink); }
.confirm .row { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
@media (max-width: 560px) {
  .intro { grid-template-columns: 96px minmax(0, 1fr); } .intro .portrait { width: 96px; }
  .fact { grid-template-columns: 62px minmax(0, 1fr); } .fact .kanji { font-size: 24px; }
  .opt { font-size: 16px; padding: 12px 8px; } .opt .k { font-size: 26px; }
  .tallies { gap: 6px; } .tally b { font-size: 21px; }
}

/* ---------- toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(18px + var(--tabbar) + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-weight: 700; z-index: 90; max-width: calc(100% - 32px); text-align: center; }

/* ---------- about (static, crawlable) ---------- */
.about { border-top: 2px solid var(--line); margin-top: 10px; padding-block: 36px 24px; }
.about-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); gap: 16px; margin: 18px 0 26px; }
.about-grid article { background: var(--card); border: 2px solid var(--line); border-radius: 18px; padding: 16px 18px; }
.about h2 { font-family: var(--f-display); font-weight: 400; font-size: clamp(22px, 3.4vw, 30px); margin: 0 0 8px; line-height: 1.2; text-wrap: balance; }
.about h3 { font-family: var(--f-display); font-weight: 400; font-size: 18px; margin: 0 0 6px; }
.about p { max-width: 68ch; margin: 0 0 10px; }
.route-list { list-style: none; margin: 10px 0 24px; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); gap: 10px; counter-reset: stop; }
.route-list li { counter-increment: stop; display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 10px; align-items: start; background: var(--paper2); border-radius: 14px; padding: 10px 12px; }
.route-list li::before { content: counter(stop); width: 30px; height: 30px; border-radius: 50%; background: var(--beni); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 14px; }
.faq dt { font-weight: 800; margin-top: 12px; }
.faq dd { margin: 4px 0 0; max-width: 68ch; }
.foot { padding-block: 20px 28px; font-size: 13px; color: var(--ink-soft); border-top: 2px solid var(--line); }

/* ---------- night: the Floating World chapter page ---------- */
html:has(body.night) { background: #1A0D16; }
body.night { --paper: #1A0D16; --paper2: #24101C; --card: #2A1220; --ink: #F6E7D8; --ink-soft: #CDB7A8; --line: #4A2635; color: var(--ink);
  background: radial-gradient(circle at 85% 0%, rgba(224, 48, 63, .35), transparent 45%), radial-gradient(circle at 5% 100%, rgba(233, 180, 76, .14), transparent 42%), #1A0D16; background-attachment: fixed; }
body.night::before { background: #1A0D16; }
body.night .topbar { background: rgba(26, 13, 22, .92); }
body.night .card, body.night .btn, body.night .tabs a[aria-current="page"], body.night .step .disc { box-shadow: 0 4px 0 #000; }
body.night .scroll .k { background: #9E1F35; color: #FFE9D2; }
body.night .scroll.locked .k { background: var(--line); color: var(--ink-soft); }
body.night .step.locked .disc { background: #3A2430; color: #8E7A86; border-color: #6B5361; box-shadow: 0 5px 0 #000; }
body.night .chip.level .rank { color: #fff; }
body.night a { color: #FF9AA6; }

/* ---------- small screens: header and lesson footer ---------- */
@media (max-width: 520px) {
  .brand > span { display: none; }
  .hud { gap: 6px; }
}
@media (max-width: 560px) {
  .pfoot .in > .muted { display: none; }
  .pfoot .btn { flex: 1 1 auto; }
  .pfoot .fb { flex-basis: 100%; }
  .player.theme-night .ptop { padding-top: 46px; }
}

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

/* ---------- accounts and the checkpoint (paywall) ---------- */
.chip.signin { cursor: pointer; border-color: var(--beni); color: var(--beni-deep); }
.acct-btn { text-decoration: none; color: var(--ink); font-weight: 900; font-size: 17px; border-radius: 999px; }
.acct-btn.pass { background: var(--beni); color: #fff; box-shadow: 0 0 0 3px var(--gold); }
.pass-badge { display: inline-grid; place-items: center; width: 22px; height: 22px; border: 2px solid var(--beni); color: var(--beni); border-radius: 5px; font-family: var(--f-mincho); font-weight: 800; font-size: 13px; line-height: 1; transform: rotate(-6deg); vertical-align: -5px; background: #fff; }
.pass-hint { margin: 10px 0 0; font-size: 14px; color: var(--ink-soft); display: flex; gap: 8px; align-items: center; }
.acct { display: flex; gap: 16px; align-items: center; }
.acct-pon { flex: none; width: 96px; }
.acct-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.admin-tools { display: grid; gap: 6px; margin-top: 14px; padding: 12px; border: 2px dashed var(--gold); border-radius: 14px; background: #FFF8EA; }
@media (max-width: 520px) { .chip.signin { height: 32px; padding: 0 10px; font-size: 13px; } .acct { align-items: flex-start; } .acct-pon { width: 64px; } }

body.ck-open { overflow: hidden; }
.ck { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 16px; background: rgba(31, 43, 77, .55); backdrop-filter: blur(3px); animation: ckFade .2s ease-out; }
@keyframes ckFade { from { opacity: 0; } }
.ck-sheet { position: relative; width: min(860px, 100%); max-height: calc(100dvh - 32px); display: grid; grid-template-columns: 300px 1fr; grid-template-rows: minmax(0, 1fr); background: var(--card); border: 2px solid var(--ink); border-radius: 24px; box-shadow: 0 8px 0 var(--ink); overflow: hidden; animation: ckRise .35s cubic-bezier(.2, 1.3, .4, 1); }
@keyframes ckRise { from { transform: translateY(40px) scale(.97); opacity: 0; } }
.ck-x { position: absolute; top: 12px; right: 12px; z-index: 2; }
.ck-scene { position: relative; background: linear-gradient(#FDE3E8 0 62%, #E9D3B4 62%); border-right: 2px solid var(--ink); display: grid; place-items: end center; padding: 18px 10px 0; overflow: hidden; min-height: 280px; }
.ck-fuji { position: absolute; left: 0; right: 0; bottom: 38%; width: 100%; height: 34%; }
.ck-gate { position: absolute; top: 22px; left: 50%; transform: translateX(-50%); width: 220px; height: 150px; border-top: 16px solid #5B3B2A; border-radius: 4px; }
.ck-gate::before, .ck-gate::after { content: ""; position: absolute; top: -6px; width: 16px; height: 170px; background: #7A5134; border: 2px solid var(--ink); }
.ck-gate::before { left: 14px; } .ck-gate::after { right: 14px; }
.ck-gate span { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); background: #F6E3C8; border: 2px solid var(--ink); padding: 2px 10px; font-family: var(--f-mincho); font-weight: 800; font-size: 20px; letter-spacing: .2em; writing-mode: horizontal-tb; }
.ck-pon { position: relative; width: 230px; margin-bottom: -6px; }
.ck-pon .pon { display: block; width: 100%; height: auto; animation: bob 3s ease-in-out infinite; }
.ck[data-step="welcome"] .pon-stamp { transform-origin: 150px 186px; animation: ponStamp .7s cubic-bezier(.3, 1.6, .5, 1) .1s both; }
@keyframes ponStamp { 0% { transform: rotate(-30deg); } 60% { transform: rotate(12deg); } 100% { transform: rotate(0); } }
.ck-body { padding: 28px 28px 24px; overflow-y: auto; min-height: 0; overscroll-behavior: contain; display: grid; gap: 12px; align-content: start; }
.ck-eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--beni-deep); }
.ck-title { margin: 0; font-family: var(--f-display); font-weight: 400; font-size: clamp(24px, 4vw, 32px); line-height: 1.15; padding-right: 36px; }
.ck-title span { display: inline-block; }
.ck-bubble { position: relative; margin: 2px 0; background: var(--band); border: 2px solid var(--ink); border-radius: 16px; padding: 12px 14px; font-size: 16px; }
.ck-bubble::before { content: var(--officer, "Officer Pon"); display: block; font-size: 12px; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; color: var(--beni-deep); margin-bottom: 2px; }
.ck-small { margin: 0; color: var(--ink-soft); }
.ck-small b { color: var(--ink); overflow-wrap: anywhere; }
.ck-fine { margin: 0; font-size: 13px; color: var(--ink-soft); line-height: 1.5; }
.ck-tally { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.ck-tally div { border: 2px dashed var(--line); border-radius: 14px; padding: 8px 4px; text-align: center; background: var(--paper); }
.ck-tally b { display: block; font-family: var(--f-display); font-weight: 400; font-size: 24px; line-height: 1.1; }
.ck-tally small { font-size: 12px; color: var(--ink-soft); font-weight: 700; }
.ck-actions { display: grid; gap: 8px; margin-top: 4px; }
.ck-free { background: #fff; color: var(--beni-deep); border-radius: 999px; padding: 1px 9px; font-size: 13px; font-weight: 900; text-transform: uppercase; letter-spacing: .06em; }
.ck-form { display: grid; gap: 8px; }
.ck-form label { font-weight: 700; }
.ck-form input { font: inherit; font-size: 18px; padding: 12px 14px; border: 2px solid var(--ink); border-radius: 14px; background: #fff; color: var(--ink); width: 100%; min-width: 0; }
.ck-form input:focus { outline: none; box-shadow: 0 0 0 4px rgba(224, 164, 58, .45); }
.ck-form.has-err input { border-color: var(--bad); }
.ck-code { --n: 6; font-family: ui-monospace, "SF Mono", Menlo, monospace !important; font-size: 28px !important; letter-spacing: .55em; text-align: center; padding-left: calc(14px + .55em) !important; }
.ck-err { margin: 0; min-height: 0; color: var(--bad); font-weight: 700; font-size: 14px; }
.ck-err:empty { display: none; }
.ck-or { display: flex; align-items: center; gap: 10px; color: var(--ink-soft); font-size: 13px; }
.ck-or::before, .ck-or::after { content: ""; flex: 1; height: 2px; background: var(--line); }
.linkish { background: none; border: 0; padding: 0; color: var(--beni-deep); font-weight: 700; text-decoration: underline; cursor: pointer; font-size: inherit; }
.ck-saved { display: flex; gap: 10px; align-items: center; background: var(--ok-bg); border: 2px solid var(--ok); border-radius: 14px; padding: 8px 12px; font-size: 14px; animation: ckRise .4s ease-out; }
.hanko.mini { width: 34px; height: 34px; font-size: 18px; border-width: 3px; flex: none; animation: stamp .5s cubic-bezier(.2, 1.6, .4, 1); }
.ck-plans { display: grid; gap: 10px; }
.ck-plan { position: relative; display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; text-align: left; width: 100%; padding: 12px 14px; border: 2px solid var(--line); border-radius: 16px; background: #fff; cursor: pointer; transition: border-color .12s, box-shadow .12s, transform .12s; }
.ck-plan:hover { border-color: var(--ink-soft); }
.ck-plan.on { border-color: var(--ink); box-shadow: 0 4px 0 var(--ink); background: #FFFBF4; transform: translateY(-1px); }
.ck-plan .seal { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 10px; border: 3px solid var(--line); color: var(--line); font-family: var(--f-mincho); font-weight: 800; font-size: 24px; transform: rotate(-6deg); transition: all .15s; }
.ck-plan.on .seal { border-color: var(--beni); color: var(--beni); background: rgba(210, 63, 78, .06); }
.ck-plan .txt b { display: block; font-size: 17px; }
.ck-plan .txt small, .ck-plan .price small { color: var(--ink-soft); font-size: 13px; line-height: 1.35; display: block; }
.ck-plan .price { text-align: right; }
.ck-plan .price b { font-family: var(--f-display); font-weight: 400; font-size: 22px; }
.ck-plan .ribbon { position: absolute; top: -11px; right: 14px; background: var(--gold); color: var(--ink); border: 2px solid var(--ink); border-radius: 999px; font-size: 11px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; padding: 1px 9px; }
.ck-perks { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 15px; }
.ck-perks li { padding-left: 26px; position: relative; }
.ck-perks li::before { content: "✓"; position: absolute; left: 0; top: 0; width: 19px; height: 19px; margin-top: 3px; border-radius: 50%; background: var(--matcha); color: #fff; font-size: 12px; font-weight: 900; display: grid; place-items: center; }
.ck-wait, .ck-welcome { display: grid; gap: 14px; justify-items: center; text-align: center; padding: 18px 0; }
.ck-welcome .ck-title, .ck-wait .ck-title { padding-right: 0; }
.ck-welcome .ck-actions { width: 100%; }
.ck-spinner { width: 54px; height: 54px; border-radius: 50%; border: 6px solid var(--line); border-top-color: var(--beni); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.ck-dots { display: inline-flex; gap: 4px; }
.ck-dots i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: dots 1s infinite; }
.ck-dots i:nth-child(2) { animation-delay: .15s; } .ck-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes dots { 50% { opacity: .25; transform: translateY(-3px); } }
.ck-google { gap: 10px; }
.petals { position: fixed; inset: 0; pointer-events: none; z-index: 95; overflow: hidden; }
.petals i { position: absolute; top: -30px; width: 22px; height: 22px; animation: petalFall linear forwards; }
.petals svg { width: 100%; height: 100%; }
@keyframes petalFall { to { transform: translate(var(--drift), 110vh) rotate(540deg); } }
@media (max-width: 720px) {
  .ck { padding: 0; place-items: end stretch; }
  .ck-sheet { grid-template-columns: 1fr; grid-template-rows: auto minmax(0, 1fr); width: 100%; max-height: 100dvh; border-radius: 24px 24px 0 0; border-bottom: 0; box-shadow: none; animation: ckUp .35s cubic-bezier(.2, 1, .3, 1); }
  @keyframes ckUp { from { transform: translateY(100%); } }
  .ck-scene { min-height: 0; height: 150px; border-right: 0; border-bottom: 2px solid var(--ink); padding-top: 8px; }
  .ck-gate { top: 10px; width: 170px; height: 120px; border-top-width: 12px; }
  .ck-gate span { font-size: 15px; top: 6px; }
  .ck-pon { width: 136px; }
  .ck-body { padding: 18px 16px calc(18px + env(safe-area-inset-bottom, 0px)); }
  .ck[data-step="code"] .ck-scene, .ck[data-step="email"] .ck-scene, .ck[data-step="pass"] .ck-scene { height: 112px; }
  .ck[data-step="code"] .ck-pon, .ck[data-step="email"] .ck-pon, .ck[data-step="pass"] .ck-pon { width: 104px; }
}
@media (max-width: 380px) { .ck-tally b { font-size: 20px; } .ck-plan { grid-template-columns: 1fr auto; } .ck-plan .seal { display: none; } }
@media (prefers-reduced-motion: reduce) { .ck, .ck-sheet, .ck-pon .pon, .pon-stamp, .ck-saved { animation: none !important; } }

/* ---------- living illustrations: blinking, swaying, glowing, and reactions to taps ---------- */
.portrait { overflow: visible; }
.portrait * { transform-box: view-box; }
.portrait .eyes, .yart .eyes, .pon .eyes { transform-origin: 50% 45%; animation: blink 5.2s infinite; }
.yart .eyes { transform-box: fill-box; transform-origin: center; animation-duration: 4.3s; }
@keyframes blink { 0%, 94%, 100% { transform: scaleY(1); } 96.5% { transform: scaleY(.08); } }
.portrait .sway { transform-origin: 150px 70px; animation: sway 3.6s ease-in-out infinite; }
.portrait .sway.two { transform-origin: 50px 86px; animation-delay: -1.8s; }
.portrait .sway:not(.two):not(.fan):not(.dangle) { transform-origin: 150px 76px; }
.portrait .sway.fan { transform-box: fill-box; transform-origin: 50% 100%; animation-duration: 1.8s; }
.portrait .sway.dangle { transform-box: fill-box; transform-origin: 50% 0; animation-duration: 2.2s; }
@keyframes sway { 0%, 100% { rotate: -2.5deg; } 50% { rotate: 3deg; } }
.portrait .tail { transform-origin: 145px 225px; animation: wag 2.4s ease-in-out infinite; }
@keyframes wag { 0%, 100% { rotate: -5deg; } 50% { rotate: 7deg; } }
.portrait .glow, .yart .glow { animation: glow 2.6s ease-in-out infinite; }
@keyframes glow { 0%, 100% { opacity: .22; } 45% { opacity: .5; } 60% { opacity: .34; } }
.portrait .wave { transform-origin: 138px 176px; animation: wave .7s ease-in-out infinite; }
@keyframes wave { 0%, 100% { rotate: -4deg; } 50% { rotate: 9deg; } }
.portrait .spark, .yart .spark { transform-box: fill-box; transform-origin: center; animation: twinkle 1.3s ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { opacity: .25; scale: .7; } 50% { opacity: 1; scale: 1.15; } }
svg.portrait[data-guide] { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.node .you svg.portrait { cursor: default; }
.portrait.boing { animation: boing .7s cubic-bezier(.3, 1.5, .5, 1) !important; transform-origin: 50% 100%; }
@keyframes boing { 0% { transform: scale(1, 1); } 25% { transform: scale(1.12, .86); } 55% { transform: scale(.92, 1.12) translateY(-10px); } 100% { transform: scale(1, 1); } }
.guide-pop { position: fixed; z-index: 96; width: 220px; text-align: center; pointer-events: none; background: #fff; color: var(--ink); border: 2px solid var(--ink); border-radius: 16px; padding: 6px 10px; box-shadow: 0 4px 0 var(--ink); animation: popUp 1.7s ease-out forwards; }
.guide-pop b { display: block; font-family: var(--f-kana, inherit); font-size: 22px; line-height: 1.2; }
.guide-pop small { font-size: 12px; color: var(--ink-soft); }
@keyframes popUp { 0% { opacity: 0; transform: translateY(14px) scale(.8); } 12% { opacity: 1; transform: translateY(0) scale(1.04); } 20% { transform: scale(1); } 80% { opacity: 1; } 100% { opacity: 0; transform: translateY(-14px); } }
.fb-guide { flex: none; width: 62px; margin: -22px 0 -8px; animation: boing .6s cubic-bezier(.3, 1.5, .5, 1); transform-origin: 50% 100%; }
.fb-guide .portrait { width: 100%; height: auto; display: block; }
.pfoot.bad .fb-guide { animation: shake .4s; }
.opt, .tile, .btn { transition: transform .08s; }
.opt:active, .tile:active { transform: scale(.96); }
@media (max-width: 560px) { .fb-guide { width: 48px; margin-top: -14px; } .pfoot .fb { flex-basis: calc(100% - 64px) !important; } }
@media (prefers-reduced-motion: reduce) { .portrait *, .yart *, .portrait.boing, .fb-guide, .ycard .yart { animation: none !important; } .guide-pop { animation-duration: 1.7s; } }

/* slow pronunciation */
.say-pair { display: inline-flex; gap: 6px; vertical-align: middle; }
.say.slow { width: auto; padding: 0 9px 0 7px; gap: 4px; display: inline-flex; align-items: center; font: inherit; font-size: 12px; font-weight: 700; color: var(--ink); }
.say.slow svg { width: 20px; height: 20px; color: #4E8B3A; }
.slow-pill { display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; padding: 6px 14px; border: 2px solid var(--ink); border-radius: 999px; background: var(--card); color: var(--ink); font: inherit; font-weight: 700; font-size: 14px; cursor: pointer; }
.slow-pill svg { width: 20px; height: 20px; color: var(--matcha, #4E8B3A); }
.prompt:has(.bigsay) { display: grid; justify-items: center; }
