/* JP Decoder — app styles
   iOS-native feel: large titles, grouped lists, segmented controls, floating tab bar.
   Light by default, follows the system dark mode (or Account > Appearance). */

:root {
  --bg: #F2F2F7;          /* grouped background */
  --plain: #FFFFFF;       /* plain page background */
  --card: #FFFFFF;
  --fill: #E6E6EB;        /* segmented track, search field */
  --fill-2: #F2F2F5;
  --label: #0B0B0F;
  --label-2: #55555D;
  --label-3: #8E8E93;
  --sep: #E3E3E8;
  --blue: #1B6EF3;
  --blue-press: #155BD0;
  --blue-soft: rgba(27, 110, 243, 0.12);
  --red: #E0283C;
  --red-soft: rgba(224, 40, 60, 0.12);
  --green: #0B8A3E;
  --green-soft: rgba(11, 138, 62, 0.16);
  --amber: #B7791F;
  --amber-soft: rgba(183, 121, 31, 0.14);
  --gold: #E7C873;
  --arc-a: #F7D69A;
  --arc-b: #F4A38E;
  --tab-bg: rgba(250, 250, 252, 0.9);
  --tab-border: rgba(0, 0, 0, 0.55);
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  --radius: 22px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", "Meiryo", sans-serif;
  --font-jp: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Noto Sans JP", "Yu Gothic UI", "Yu Gothic", "Meiryo", system-ui, sans-serif;
  --tabbar-space: calc(108px + env(safe-area-inset-bottom));
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000; --plain: #000000; --card: #1C1C1E; --fill: #2C2C2E; --fill-2: #1C1C1E;
    --label: #F5F5F7; --label-2: #C7C7CC; --label-3: #8E8E93; --sep: #38383A;
    --blue: #3A8BFF; --blue-press: #2F76DB; --blue-soft: rgba(58, 139, 255, 0.2);
    --red: #FF5A68; --red-soft: rgba(255, 90, 104, 0.18); --green: #34C76F; --green-soft: rgba(52, 199, 111, 0.2);
    --amber: #E7C873; --amber-soft: rgba(231, 200, 115, 0.16);
    --tab-bg: rgba(28, 28, 30, 0.9); --tab-border: rgba(255, 255, 255, 0.35); --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #000000; --plain: #000000; --card: #1C1C1E; --fill: #2C2C2E; --fill-2: #1C1C1E;
  --label: #F5F5F7; --label-2: #C7C7CC; --label-3: #8E8E93; --sep: #38383A;
  --blue: #3A8BFF; --blue-press: #2F76DB; --blue-soft: rgba(58, 139, 255, 0.2);
  --red: #FF5A68; --red-soft: rgba(255, 90, 104, 0.18); --green: #34C76F; --green-soft: rgba(52, 199, 111, 0.2);
  --amber: #E7C873; --amber-soft: rgba(231, 200, 115, 0.16);
  --tab-bg: rgba(28, 28, 30, 0.9); --tab-border: rgba(255, 255, 255, 0.35); --shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--label);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
body.plain { background: var(--plain); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg.solid { fill: currentColor; stroke: none; }
.jp { font-family: var(--font-jp); }
.hidden { display: none !important; }
.muted { color: var(--label-3); }

.shell { max-width: 640px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; }
.view { padding: calc(16px + env(safe-area-inset-top)) 20px var(--tabbar-space); outline: none; }

/* ---------- Floating tab bar ---------- */
.tabbar {
  position: fixed; z-index: 30;
  left: 50%; transform: translateX(-50%);
  bottom: calc(14px + env(safe-area-inset-bottom));
  width: min(600px, calc(100% - 28px));
  display: flex; padding: 6px;
  background: var(--tab-bg);
  border: 1.5px solid var(--tab-border);
  border-radius: 40px;
  backdrop-filter: blur(18px) saturate(1.6);
  -webkit-backdrop-filter: blur(18px) saturate(1.6);
  box-shadow: var(--shadow);
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  height: 62px; border-radius: 32px;
  font-size: 11.5px; font-weight: 700; color: var(--label);
}
.tabbar a svg { width: 26px; height: 26px; }
.tabbar a.active { background: var(--fill); color: var(--blue); }
body.sheet-open .tabbar, body.welcome .tabbar { display: none; }

/* ---------- Headers ---------- */
.nav-row { display: flex; justify-content: flex-end; align-items: center; min-height: 44px; }
.capsule {
  display: inline-flex; align-items: center; gap: 2px; padding: 4px;
  border: 1.5px solid var(--tab-border); border-radius: 30px; background: var(--card);
  box-shadow: var(--shadow);
}
.capsule .cbtn { width: 52px; height: 44px; display: grid; place-items: center; border-radius: 22px; border: 0; background: transparent; cursor: pointer; color: var(--label); }
.capsule .cbtn:active { background: var(--fill); }
.date-line { font-size: 15px; font-weight: 700; color: var(--label-3); margin: 6px 0 0; }
.large-title { font-size: 40px; font-weight: 850; letter-spacing: -0.03em; line-height: 1.08; margin: 2px 0 18px; }
.title-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.title-row .large-title { margin-bottom: 18px; }
.sec-head { font-size: 13px; font-weight: 600; color: var(--label-3); margin: 26px 16px 8px; text-transform: none; }
.sec-head.big { font-size: 20px; font-weight: 800; color: var(--label); margin: 28px 0 12px; display: flex; align-items: center; gap: 10px; }
.back-link { display: inline-flex; align-items: center; gap: 2px; color: var(--blue); font-size: 17px; font-weight: 500; background: none; border: 0; padding: 8px 0; margin-bottom: 4px; cursor: pointer; }
.back-link svg { width: 22px; height: 22px; stroke-width: 2.4; }

/* ---------- Segmented control ---------- */
.seg {
  display: flex; padding: 3px; border-radius: 30px; background: var(--fill);
  margin-bottom: 22px;
}
.seg button {
  flex: 1; min-height: 40px; border: 0; background: transparent; border-radius: 26px;
  font-size: 15px; font-weight: 700; color: var(--label); cursor: pointer; white-space: nowrap; padding: 0 8px;
}
.seg button.on { background: var(--card); box-shadow: 0 1px 4px rgba(0, 0, 0, .12); border: 1.5px solid var(--sep); }
.seg.sm button { min-height: 34px; font-size: 14px; }

/* ---------- Buttons ---------- */
.btn-blue {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  width: 100%; min-height: 64px; padding: 10px 20px; border: 0; border-radius: 34px;
  background: var(--blue); color: #fff; font-size: 19px; font-weight: 800; cursor: pointer; text-align: center;
}
.btn-blue small { font-size: 14px; font-weight: 600; opacity: .9; }
.btn-blue:active { background: var(--blue-press); }
.btn-blue.slim { min-height: 52px; font-size: 17px; }
.btn-plain {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 48px; padding: 0 20px; border-radius: 26px; border: 0;
  background: var(--fill); color: var(--label); font-weight: 700; font-size: 16px; cursor: pointer;
}
.btn-plain.blue { color: var(--blue); background: var(--blue-soft); }
.btn-row { display: flex; gap: 10px; }
.btn-row > * { flex: 1; }
.link-btn { background: none; border: 0; color: var(--blue); font-weight: 600; font-size: 16px; cursor: pointer; padding: 0; }

/* ---------- Grouped lists (iOS settings style) ---------- */
.group { background: var(--card); border-radius: var(--radius); overflow: hidden; }
.group + .group { margin-top: 18px; }
.cell {
  display: flex; align-items: center; gap: 14px;
  min-height: 60px; padding: 12px 20px; position: relative;
  width: 100%; border: 0; background: transparent; text-align: left; cursor: pointer; color: var(--label);
  font-size: 17px; font-weight: 700;
}
.cell + .cell::before { content: ""; position: absolute; top: 0; left: 20px; right: 0; height: 1px; background: var(--sep); }
.cell .grow { flex: 1; min-width: 0; }
.cell .value { color: var(--label-3); font-weight: 500; }
.cell .chev { color: var(--label-3); width: 18px; height: 18px; stroke-width: 2.6; }
.cell.blue { color: var(--blue); }
.cell.red { color: var(--red); }
.cell .sub { display: block; font-size: 13.5px; font-weight: 500; color: var(--label-3); margin-top: 1px; }
.cell:active { background: var(--fill-2); }
.cell.static { cursor: default; }
.cell.static:active { background: transparent; }

/* Icon rows (Search landing) */
.icon-row { display: flex; align-items: center; gap: 18px; padding: 10px 0; font-size: 19px; font-weight: 800; }
.icon-tile { width: 56px; height: 56px; border-radius: 14px; background: var(--blue); color: #fff; display: grid; place-items: center; flex: none; }
.icon-tile svg { width: 28px; height: 28px; }
.icon-row .count { margin-left: auto; color: var(--label-3); font-size: 16px; font-weight: 600; }
.text-link-row { display: flex; align-items: center; justify-content: space-between; padding: 14px 0; font-size: 19px; font-weight: 800; color: var(--label-2); }
.text-link-row svg { color: var(--blue); stroke-width: 3; }

/* Numbered rows (Discover) */
.num-row { display: flex; align-items: center; gap: 16px; padding: 6px 0; }
.num-tile { width: 56px; height: 56px; border-radius: 12px; background: var(--blue); color: #fff; display: grid; place-items: center; font-size: 22px; font-weight: 800; flex: none; font-variant-numeric: tabular-nums; }
.num-row .t { font-size: 20px; font-weight: 800; letter-spacing: -0.01em; }
.num-row .s { font-size: 14px; color: var(--label-3); font-weight: 600; }
.num-row .grow { flex: 1; min-width: 0; }
.num-row .chev { color: var(--label-3); }
.rule { height: 1px; background: var(--sep); margin: 14px 0; }

.collection { display: grid; grid-template-columns: 150px 1fr; gap: 18px; align-items: start; }
.cover {
  aspect-ratio: 1; border-radius: 6px; background: var(--fill); display: grid; place-items: center;
}
.cover .book { width: 58%; aspect-ratio: 0.7; border-radius: 10px; background: #111317; position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: flex-end; padding: 10px; color: #fff; box-shadow: 0 6px 16px rgba(0, 0, 0, .25); }
.cover .book b { font-family: var(--font-jp); font-size: 26px; line-height: 1; }
.cover .book i { font-style: normal; font-size: 8px; font-weight: 700; letter-spacing: .08em; opacity: .7; margin-top: 4px; }
.cover .book::before { content: ""; position: absolute; left: 10px; top: 12px; width: 26px; height: 4px; border-radius: 2px; background: var(--gold); }
.collection h3 { margin: 4px 0 4px; font-size: 18px; font-weight: 800; }
.collection p { margin: 0; font-size: 14px; color: var(--label-3); }

/* ---------- Entry rows ---------- */
.list { display: flex; flex-direction: column; }
.erow { display: flex; align-items: center; gap: 14px; padding: 12px 4px; border-bottom: 1px solid var(--sep); }
.erow:last-child { border-bottom: 0; }
.erow .grow { flex: 1; min-width: 0; }
.erow .jpw { font-family: var(--font-jp); font-size: 19px; font-weight: 700; }
.erow .rom { font-size: 13px; color: var(--label-3); margin-left: 8px; }
.erow .en { font-size: 15px; color: var(--label-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.erow .chev { color: var(--label-3); width: 18px; height: 18px; }
.erow .flags { display: flex; gap: 6px; align-items: center; color: var(--label-3); }
.erow .flags svg { width: 16px; height: 16px; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.dot-safe { background: var(--green); } .dot-careful { background: var(--amber); } .dot-avoid { background: var(--red); }
.empty { text-align: center; color: var(--label-3); padding: 40px 12px; }
.empty .jp { display: block; font-size: 30px; font-weight: 800; color: var(--label); margin-bottom: 8px; }

/* ---------- Welcome ---------- */
.welcome-wrap { min-height: calc(100dvh - 40px); display: flex; flex-direction: column; justify-content: center; text-align: center; padding: 30px 0; }
.app-glyph { width: 72px; height: 72px; margin: 0 auto 30px; border-radius: 18px; background: var(--label); color: var(--plain); display: grid; place-items: center; font-weight: 900; font-size: 24px; position: relative; }
.app-glyph::after { content: ""; position: absolute; bottom: 14px; left: 22px; right: 22px; height: 4px; border-radius: 2px; background: var(--gold); }
.greet { font-family: var(--font-jp); font-size: 46px; font-weight: 900; letter-spacing: 0.02em; line-height: 1.1; }
.greet-en { color: var(--label-3); font-size: 15px; font-weight: 600; margin-top: 6px; }
.greet-sub { font-family: var(--font-jp); font-size: 19px; font-weight: 700; margin-top: 18px; }
.day-n { font-size: 40px; font-weight: 850; margin: 34px 0 40px; letter-spacing: -0.01em; }
.day-n .jp { font-weight: 800; }
.promo {
  display: block; text-align: left; border-radius: 22px; padding: 20px 22px; margin-bottom: 40px;
  background: linear-gradient(135deg, #FFF7E6 0%, #FDEBE6 55%, #EEF4FF 100%);
  color: #0B0B0F; box-shadow: var(--shadow); border: 1px solid rgba(0,0,0,.06); position: relative; overflow: hidden;
}
:root[data-theme="dark"] .promo { background: linear-gradient(135deg, #2A2418 0%, #2A1D1B 55%, #17202E 100%); color: #F5F5F7; border-color: rgba(255,255,255,.08); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .promo { background: linear-gradient(135deg, #2A2418 0%, #2A1D1B 55%, #17202E 100%); color: #F5F5F7; border-color: rgba(255,255,255,.08); } }
.promo .tagline { display: inline-block; font-size: 12px; font-weight: 800; letter-spacing: .06em; background: #0B0B0F; color: #fff; padding: 4px 10px; border-radius: 8px; }
.promo .pw { font-family: var(--font-jp); font-size: 38px; font-weight: 900; margin: 10px 0 0; }
.promo .pr { font-size: 14px; opacity: .65; font-weight: 600; }
.promo .pm { font-size: 17px; font-weight: 700; margin-top: 8px; }
.promo .more { display: inline-block; margin-top: 14px; background: #0B0B0F; color: #fff; font-size: 14px; font-weight: 800; padding: 9px 16px; border-radius: 20px; }
.promo .risk-tag { position: absolute; top: 20px; right: 20px; }

/* ---------- Today ---------- */
.gauge-wrap { position: relative; max-width: 420px; margin: 4px auto 0; }
.gauge { width: 100%; height: auto; display: block; }
.gauge .track { stroke: var(--fill); }
.gauge-center { position: absolute; left: 0; right: 0; bottom: 6%; text-align: center; }
.gauge-center .lbl { font-size: 17px; font-weight: 800; }
.gauge-center .num { font-size: 84px; font-weight: 900; line-height: 1; letter-spacing: -0.04em; margin-top: 18px; }
.gauge-center .num small { font-size: 34px; font-weight: 800; letter-spacing: -0.02em; }
.stat-card { background: var(--fill-2); border-radius: 30px; padding: 26px 28px; display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; margin-top: 30px; }
body.plain .stat-card { background: var(--bg); }
.kv .k { font-size: 15px; font-weight: 800; }
.kv .v { font-size: 30px; font-weight: 850; line-height: 1.1; margin-bottom: 10px; font-variant-numeric: tabular-nums; }
.kv .v.blue { color: var(--blue); } .kv .v.red { color: var(--red); } .kv .v.amber { color: var(--amber); }
.ring { width: 150px; height: 150px; }
.ring circle { fill: none; stroke-width: 14; }
.ring .rt { stroke: var(--green-soft); }
.ring .rv { stroke: var(--green); stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; }
.ring text { fill: var(--label); stroke: none; font-size: 30px; font-weight: 850; text-anchor: middle; dominant-baseline: central; }
.ring text tspan { font-size: 16px; }
.round-icon { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--blue); color: #fff; }
.round-icon svg { width: 18px; height: 18px; }
.edition-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; margin-bottom: 14px; border-radius: 16px; background: var(--amber-soft); color: var(--label); font-size: 14px; font-weight: 600;
}
.edition-banner a { color: var(--blue); font-weight: 800; white-space: nowrap; }

/* ---------- Study sheet ---------- */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .28); z-index: 40; }
.sheet {
  position: fixed; z-index: 41; left: 50%; transform: translateX(-50%);
  top: calc(10px + env(safe-area-inset-top)); bottom: 0;
  width: min(640px, 100%);
  background: var(--plain); border-radius: 34px 34px 0 0;
  display: flex; flex-direction: column; overflow: hidden;
  animation: sheetUp .28s cubic-bezier(.2, .8, .2, 1);
}
:root[data-theme="dark"] .sheet { background: #111113; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sheet { background: #111113; } }
@keyframes sheetUp { from { transform: translate(-50%, 40px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }
.sheet-top { padding: 10px 22px 0; flex: none; }
.grabber { width: 44px; height: 6px; border-radius: 3px; background: var(--fill); margin: 0 auto 14px; }
.sheet-close { position: absolute; top: 14px; left: 16px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: var(--fill); color: var(--label-2); display: grid; place-items: center; cursor: pointer; }
.sheet-close svg { width: 18px; height: 18px; stroke-width: 2.6; }
.pbar { height: 6px; border-radius: 3px; background: var(--fill); overflow: hidden; margin: 8px 56px 18px; }
.pbar i { display: block; height: 100%; background: var(--blue); border-radius: 3px; transition: width .25s; }
.pill-label { margin: 0 8px; padding: 4px; border-radius: 30px; background: var(--fill-2); border: 1px solid var(--sep); }
.pill-label span { display: block; text-align: center; padding: 8px; border-radius: 26px; background: var(--label-3); color: #fff; font-weight: 800; font-size: 16px; }
.sheet-body { flex: 1; overflow-y: auto; padding: 18px 22px 56px; -webkit-overflow-scrolling: touch; }
.card-meta { display: flex; align-items: center; justify-content: center; position: relative; min-height: 44px; }
.card-meta .badge { display: inline-grid; place-items: center; min-width: 32px; height: 32px; padding: 0 6px; border-radius: 7px; color: #fff; font-size: 15px; font-weight: 800; margin-right: 10px; font-variant-numeric: tabular-nums; }
.card-meta .no { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: .02em; }
.card-meta .tools { position: absolute; right: 0; top: 50%; transform: translateY(-50%); display: flex; align-items: center; gap: 12px; }
.circle-btn { width: 40px; height: 40px; border-radius: 50%; border: 2.4px solid var(--blue); background: transparent; color: var(--blue); display: grid; place-items: center; cursor: pointer; padding: 0; }
.circle-btn svg { width: 20px; height: 20px; stroke-width: 2.4; }
.circle-btn.on { background: var(--blue); color: #fff; }
.tools .div { width: 1.5px; height: 22px; background: var(--sep); }
.hw-wrap { text-align: center; margin-top: 18px; cursor: pointer; }
.furi { font-family: var(--font-jp); color: var(--label-3); font-size: calc(15px * var(--fs, 1)); letter-spacing: .08em; min-height: 1.2em; }
.hw { font-family: var(--font-jp); font-size: calc(46px * var(--fs, 1)); font-weight: 800; line-height: 1.2; letter-spacing: .01em; overflow-wrap: anywhere; }
.hw.long { font-size: calc(32px * var(--fs, 1)); }
.rom { font-size: calc(20px * var(--fs, 1)); font-weight: 700; margin-top: 8px; letter-spacing: .02em; }
.mean { font-size: calc(19px * var(--fs, 1)); font-weight: 800; color: var(--label-2); margin-top: 14px; }
.mean .pos { color: var(--label-3); margin-right: 6px; }
.tap-hint { margin-top: 18px; color: var(--label-3); font-size: 14px; font-weight: 600; }
.listen-big { width: 120px; height: 120px; border-radius: 50%; border: 0; background: var(--blue); color: #fff; display: grid; place-items: center; margin: 16px auto 0; cursor: pointer; box-shadow: 0 10px 30px rgba(27, 110, 243, .35); }
.listen-big svg { width: 44px; height: 44px; }
.word-audio { display: flex; justify-content: center; gap: 10px; margin-top: 16px; }
.play-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--blue-soft); color: var(--blue); display: inline-grid; place-items: center; cursor: pointer; flex: none; padding: 0; }
.play-btn svg { width: 18px; height: 18px; }
.play-btn.playing { background: var(--blue); color: #fff; }
.slow-btn { height: 44px; padding: 0 16px; border-radius: 22px; border: 0; background: var(--fill); color: var(--label-2); font-weight: 800; font-size: 13px; letter-spacing: .04em; cursor: pointer; }
.slow-btn.playing { background: var(--blue); color: #fff; }

.sheet-bottom { flex: none; background: var(--bg); border-top: 1px solid var(--sep); padding: 0 16px calc(14px + env(safe-area-inset-bottom)); }
.counter-bar { display: flex; align-items: center; gap: 14px; background: var(--fill); border-radius: 32px; padding: 10px 18px; margin: -38px 4px 16px; position: relative; }
.sheet-bottom.no-lift .counter-bar { margin-top: 14px; }
.cnt { display: flex; align-items: center; gap: 8px; font-size: 21px; font-weight: 800; font-variant-numeric: tabular-nums; }
.cnt i { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.cnt i svg { width: 18px; height: 18px; stroke-width: 2.6; }
.cnt.new i { background: #8FB4F8; } .cnt.re i { background: #F3A0AA; } .cnt.rev i { background: var(--green); }
.counter-bar .spacer { flex: 1; }
.counter-bar .ibtn { border: 0; background: none; color: var(--blue); cursor: pointer; padding: 4px; display: grid; place-items: center; font-weight: 900; font-size: 26px; line-height: 1; text-decoration: underline; text-underline-offset: 4px; }
.counter-bar .ibtn svg { width: 30px; height: 30px; }
.counter-bar .vdiv { width: 1.5px; height: 24px; background: var(--sep); }
.grades { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grade { display: flex; flex-direction: column; align-items: center; }
.grade button { width: 100%; min-height: 66px; border: 0; border-radius: 34px; background: var(--blue); color: #fff; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.grade button b { font-size: 21px; font-weight: 850; line-height: 1.15; }
.grade button small { font-size: 13px; font-weight: 700; opacity: .92; }
.grade button:active { background: var(--blue-press); }
.grade .hint { font-size: 13px; font-weight: 700; margin-top: 6px; color: var(--label-2); font-variant-numeric: tabular-nums; }
.grade.suggest button { box-shadow: 0 0 0 3px var(--plain), 0 0 0 5px var(--red); }

/* Details revealed inside the sheet / entry page */
.detail { margin-top: 26px; text-align: left; }
.detail .group { background: var(--bg); }
body.plain .detail .group, .sheet .detail .group { background: var(--fill-2); }
.kvrow { padding: 14px 18px; }
.kvrow + .kvrow { border-top: 1px solid var(--sep); }
.kvrow .k { font-size: 12.5px; font-weight: 700; color: var(--label-3); text-transform: uppercase; letter-spacing: .06em; }
.kvrow .v { font-size: 16px; margin-top: 3px; }
.kvrow .v.lead { font-size: 19px; font-weight: 800; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 10px; border-radius: 13px; font-size: 12.5px; font-weight: 700; background: var(--fill); color: var(--label-2); white-space: nowrap; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.risk::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.risk-safe { color: var(--green); background: var(--green-soft); }
.risk-careful { color: var(--amber); background: var(--amber-soft); }
.risk-avoid { color: var(--red); background: var(--red-soft); }
.can-use { border-radius: 18px; padding: 16px 18px; margin-top: 12px; }
.can-use.safe { background: var(--green-soft); } .can-use.careful { background: var(--amber-soft); } .can-use.avoid { background: var(--red-soft); }
.can-use .q { font-weight: 800; font-size: 15px; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.can-use .a { margin-top: 6px; font-size: 16px; }
.alts { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 18px 16px; }
.alt { font-family: var(--font-jp); padding: 8px 14px; border-radius: 14px; border: 0; background: var(--card); font-size: 16px; font-weight: 700; cursor: pointer; }
.sheet .alt, body.plain .alt { background: var(--plain); border: 1px solid var(--sep); }
.ex-head-row { display: flex; align-items: center; justify-content: space-between; margin: 26px 2px 10px; }
.ex-head-row h4 { margin: 0; font-size: 20px; font-weight: 800; }
.examples { display: flex; flex-direction: column; gap: 10px; }
.ex { border-radius: 18px; padding: 14px 16px; background: var(--fill-2); }
body:not(.plain) .view .ex { background: var(--card); }
.ex-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.ex-type { font-size: 12.5px; font-weight: 800; color: var(--label-3); text-transform: uppercase; letter-spacing: .06em; }
.ex-context { font-size: 14px; color: var(--label-3); margin: -2px 0 8px; font-weight: 600; }
.ex-jp { font-family: var(--font-jp); font-size: calc(19px * var(--fs, 1)); font-weight: 700; line-height: 1.55; }
.ex-en { font-size: 15px; color: var(--label-2); margin-top: 3px; }
.ex-en.concealed { filter: blur(6px); cursor: pointer; user-select: none; }
.ex-note { margin-top: 10px; font-size: 14.5px; padding: 10px 12px; border-radius: 12px; background: var(--red-soft); }
.ex-dont .ex-type { color: var(--red); }
.ex-dont .ex-jp { text-decoration: line-through; text-decoration-color: var(--red); text-decoration-thickness: 2px; }
.ex-alt .ex-type { color: var(--green); }
.turn { display: flex; gap: 10px; align-items: flex-start; }
.turn + .turn { margin-top: 8px; }
.turn .who { flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 800; background: var(--fill); color: var(--label-2); margin-top: 4px; }
.turn:nth-child(even) .who { background: var(--blue); color: #fff; }
.bubble { display: inline-block; padding: 9px 14px; border-radius: 18px 18px 18px 4px; background: var(--green-soft); }
.handle { font-size: 13px; color: var(--label-3); font-weight: 600; margin-bottom: 2px; }
.origin { font-size: 15px; color: var(--label-2); padding: 14px 18px; }
.memo-box { font-size: 15px; padding: 14px 18px; white-space: pre-wrap; }

/* ---------- Search ---------- */
.search-field { display: flex; align-items: center; gap: 10px; height: 54px; padding: 0 18px; border-radius: 28px; background: var(--fill); margin-bottom: 18px; }
.search-field svg { stroke-width: 2.8; color: var(--label); }
.search-field input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; font-size: 17px; font-weight: 600; color: var(--label); font-family: var(--font); }
.search-field input::placeholder { color: var(--label-3); }
.search-field .clear { border: 0; background: var(--label-3); color: var(--plain); width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; padding: 0; }
.search-field .clear svg { width: 12px; height: 12px; stroke-width: 3; color: var(--plain); }
.filter-chips { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.filter-chips::-webkit-scrollbar { display: none; }
.filter-chip { flex: none; height: 34px; padding: 0 14px; border-radius: 17px; border: 0; background: var(--fill); color: var(--label); font-size: 14px; font-weight: 700; cursor: pointer; }
.filter-chip.on { background: var(--blue); color: #fff; }
.result-count { font-size: 14px; color: var(--label-3); font-weight: 600; margin: 14px 4px 4px; }

/* ---------- Records ---------- */
.rec-card { background: var(--card); border-radius: var(--radius); padding: 22px 20px 0; }
.rec-card .k { font-size: 16px; color: var(--label-3); font-weight: 700; }
.rec-card .big { font-size: 46px; font-weight: 850; letter-spacing: -0.02em; line-height: 1.1; }
.chart { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 16px; }
.bars { position: relative; height: 170px; display: flex; align-items: flex-end; gap: 0; border-top: 1px solid var(--sep); border-bottom: 1px solid var(--sep); background-image: linear-gradient(var(--sep) 1px, transparent 1px); background-size: 100% 25%; }
.bars .col { flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; border-left: 1px dashed var(--sep); }
.bars .col:last-child { border-right: 1px dashed var(--sep); }
.bars .col i { width: 56%; max-width: 26px; border-radius: 4px 4px 0 0; background: var(--blue); min-height: 0; }
.bars .col.today i { background: var(--blue); }
.axis { display: flex; flex-direction: column; justify-content: space-between; font-size: 15px; color: var(--label-3); font-weight: 600; height: 170px; }
.xlabels { display: flex; margin-right: 0; }
.xlabels span { flex: 1; text-align: center; font-size: 14px; color: var(--label-3); font-weight: 600; padding: 6px 0; border-left: 1px dashed var(--sep); }
.xlabels span:last-child { border-right: 1px dashed var(--sep); }
.xlabels span.today { color: var(--blue); font-weight: 800; }
.totals { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 16px 0; }
.totals .k { font-size: 15px; font-weight: 800; color: var(--label-3); }
.totals .k.blue { color: var(--blue); }
.totals .v { font-size: 19px; font-weight: 700; margin-top: 4px; }
.rec-card .cell { margin: 0 -20px; width: calc(100% + 40px); border-top: 1px solid var(--sep); }
.prog-row + .prog-row { margin-top: 14px; }
.prog-row .top { display: flex; justify-content: space-between; font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.prog-row .top span:last-child { color: var(--label-3); font-variant-numeric: tabular-nums; }
.bar { height: 8px; border-radius: 4px; background: var(--fill); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--blue); border-radius: 4px; }

/* ---------- Quiz ---------- */
.quiz-type { font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: var(--blue); font-weight: 800; margin-bottom: 8px; }
.quiz-q { font-size: 22px; font-weight: 800; letter-spacing: -0.01em; line-height: 1.35; }
.quiz-q .jp { font-weight: 800; }
.choices { display: flex; flex-direction: column; gap: 10px; margin-top: 20px; }
.choice { display: flex; align-items: center; gap: 14px; text-align: left; min-height: 60px; padding: 12px 18px; border-radius: 20px; background: var(--card); border: 2px solid transparent; cursor: pointer; font-size: 17px; font-weight: 700; }
body.plain .choice, .sheet .choice { background: var(--fill-2); }
.choice .letter { flex: none; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 800; background: var(--fill); color: var(--label-2); }
.choice.correct { border-color: var(--green); background: var(--green-soft); }
.choice.correct .letter { background: var(--green); color: #fff; }
.choice.wrong { border-color: var(--red); background: var(--red-soft); }
.choice.wrong .letter { background: var(--red); color: #fff; }
.choice:disabled { cursor: default; color: var(--label); }
.feedback { margin-top: 16px; padding: 16px 18px; border-radius: 18px; background: var(--fill-2); font-size: 16px; }
.feedback b.ok { color: var(--green); } .feedback b.ng { color: var(--red); }
.feedback a { color: var(--blue); font-weight: 700; font-size: 15px; }
.score-big { font-size: 84px; font-weight: 900; letter-spacing: -0.04em; text-align: center; line-height: 1; margin: 16px 0 4px; }
.score-big small { font-size: 32px; color: var(--label-3); }
.option .check { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--sep); flex: none; }
.option.on .check { border-color: var(--blue); background: var(--blue); box-shadow: inset 0 0 0 4px var(--card); }

/* ---------- Settings controls ---------- */
.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 16px; background: var(--fill); transition: background .2s; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 28px; height: 28px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .2); transition: transform .2s; }
.switch input:checked + span { background: #34C759; }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }
.mini-seg { display: inline-flex; background: var(--fill); border-radius: 10px; padding: 2px; flex: none; }
.mini-seg button { border: 0; background: transparent; padding: 6px 12px; border-radius: 8px; font-size: 14px; font-weight: 700; color: var(--label); cursor: pointer; }
.mini-seg button.on { background: var(--card); box-shadow: 0 1px 3px rgba(0, 0, 0, .15); }
.edition-cell .thumb { width: 60px; height: 72px; border-radius: 10px; background: #111317; position: relative; flex: none; display: flex; align-items: flex-end; padding: 7px; color: #fff; font-family: var(--font-jp); font-weight: 800; font-size: 18px; }
.edition-cell .thumb::before { content: ""; position: absolute; left: 7px; top: 9px; width: 18px; height: 3px; border-radius: 2px; background: var(--gold); }
.badge-pill { font-size: 14px; font-weight: 800; padding: 6px 14px; border-radius: 18px; background: var(--fill); color: var(--label-3); white-space: nowrap; }
.badge-pill.blue { background: var(--blue); color: #fff; }

/* ---------- Modal (memo) ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 60; display: grid; place-items: end center; }
.modal { width: min(640px, 100%); background: var(--plain); border-radius: 28px 28px 0 0; padding: 18px 20px calc(20px + env(safe-area-inset-bottom)); animation: sheetUp2 .22s ease-out; }
@keyframes sheetUp2 { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal h3 { margin: 0 0 12px; font-size: 19px; font-weight: 800; }
.modal textarea { width: 100%; min-height: 130px; border-radius: 16px; border: 0; background: var(--fill); padding: 14px; font: 16px var(--font); color: var(--label); resize: vertical; outline: none; }
.modal .btn-row { margin-top: 12px; }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(110px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; max-width: calc(100% - 32px); padding: 12px 18px; border-radius: 16px; background: rgba(20, 20, 24, .92); color: #fff; font-size: 15px; font-weight: 700; transition: opacity .2s, transform .2s; z-index: 80; text-align: center; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.noscript { padding: 24px; text-align: center; }
kbd { font-family: var(--font); font-size: 11px; padding: 1px 6px; border-radius: 5px; border: 1px solid var(--sep); color: var(--label-3); }
:focus-visible { outline: 2.5px solid var(--blue); outline-offset: 2px; }

@media (max-width: 380px) {
  .large-title { font-size: 34px; }
  .gauge-center .num { font-size: 68px; }
  .ring { width: 120px; height: 120px; }
  .collection { grid-template-columns: 110px 1fr; }
  .grade button b { font-size: 18px; }
  .cnt { font-size: 18px; } .cnt i { width: 30px; height: 30px; }
  .tabbar a { font-size: 10.5px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Dark mode: give the selected segment more contrast */
:root[data-theme="dark"] .seg button.on, :root[data-theme="dark"] .mini-seg button.on { background: #48484A; border-color: #48484A; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .seg button.on, :root:not([data-theme="light"]) .mini-seg button.on { background: #48484A; border-color: #48484A; } }

/* Example sentences: furigana, highlighted headword, romaji */
.ex-jp ruby rt { font-size: 0.5em; font-weight: 600; color: var(--label-3); letter-spacing: 0; }
.ex-jp { line-height: 1.9; }
mark.hl { background: var(--blue-soft); color: var(--blue); border-radius: 5px; padding: 0 2px; }
.ex-dont mark.hl { background: var(--red-soft); color: var(--red); }
.ex-alt mark.hl { background: none; color: inherit; padding: 0; }
.ex-ro { font-size: 13.5px; color: var(--amber); font-weight: 600; margin-top: 1px; }

/* =====================================================================
   Brand layer (v0.3): ink + gold primary, docked tab bar, new top screens
   ===================================================================== */
:root { --primary: #121316; --on-primary: #FFFFFF; --primary-press: #000000; --gold-ink: #B8901E; --tabbar-space: calc(84px + env(safe-area-inset-bottom)); }
:root[data-theme="dark"] { --primary: #F5F5F7; --on-primary: #121316; --primary-press: #FFFFFF; --gold-ink: #E7C873; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --primary: #F5F5F7; --on-primary: #121316; --primary-press: #FFFFFF; --gold-ink: #E7C873; } }

/* Primary actions in brand ink instead of blue */
.btn-blue, .grade button, .listen-big { background: var(--primary); color: var(--on-primary); }
.btn-blue:active, .grade button:active { background: var(--primary-press); }
.listen-big { box-shadow: 0 10px 30px rgba(0, 0, 0, .22); }
.num-tile, .icon-tile, .round-icon { background: var(--primary); color: var(--on-primary); }
.filter-chip.on, .badge-pill.blue { background: var(--primary); color: var(--on-primary); }
.option.on .check { border-color: var(--primary); background: var(--primary); }
.circle-btn { border-color: var(--label); color: var(--label); }
.circle-btn.on { background: var(--label); color: var(--plain); }
.counter-bar .ibtn { color: var(--label); }
.pbar i { background: var(--gold-ink); }
.play-btn { background: var(--fill); color: var(--label); }
.play-btn.playing, .slow-btn.playing { background: var(--gold-ink); color: #fff; }
.tabbar a.active { color: var(--label); }

/* Docked tab bar with line icons and a gold dot */
.tabbar {
  left: 0; right: 0; bottom: 0; transform: none; width: 100%;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  border: 0; border-top: 1px solid var(--sep); border-radius: 0; box-shadow: none;
  justify-content: center;
}
.tabbar a { position: relative; max-width: 112px; height: 54px; border-radius: 0; background: none !important; color: var(--label-3); font-weight: 600; font-size: 11px; gap: 3px; }
.tabbar a svg { width: 25px; height: 25px; stroke-width: 1.7; }
.tabbar a.active { color: var(--label); font-weight: 700; }
.tabbar a.active svg { stroke-width: 2.1; }
.tabbar a.active::before { content: ""; position: absolute; top: 2px; left: calc(50% + 13px); width: 6px; height: 6px; border-radius: 50%; background: var(--gold); }
.toast { bottom: calc(92px + env(safe-area-inset-bottom)); }

/* ---------- Welcome (v0.3) ---------- */
.w2 { min-height: calc(100dvh - 40px); display: flex; flex-direction: column; padding: 4px 0 20px; }
.w2-top { display: flex; justify-content: space-between; align-items: center; }
.w2-brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 750; font-size: 15px; }
.mark { width: 34px; height: 34px; border-radius: 9px; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; font-style: normal; font-weight: 900; font-size: 12px; position: relative; flex: none; }
.mark::after { content: ""; position: absolute; left: 9px; right: 9px; bottom: 6px; height: 2.5px; border-radius: 2px; background: var(--gold); }
.daychip { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 14px 0 10px; border-radius: 17px; background: var(--fill-2); border: 1px solid var(--sep); font-weight: 800; font-size: 14px; }
.daychip svg { width: 18px; height: 18px; color: #E8590C; fill: rgba(232, 89, 12, .15); }
.w2-greet { margin: 46px 0 26px; }
.w2-greet .greet { font-size: 50px; text-align: left; }
.w2-greet .greet-en { margin-top: 8px; font-size: 17px; color: var(--label-2); font-weight: 600; }
.flip {
  display: flex; flex-direction: column; align-items: center; text-align: center; width: 100%;
  border: 0; cursor: pointer; padding: 26px 22px 22px; border-radius: 28px;
  background: var(--primary); color: var(--on-primary);
  box-shadow: 0 18px 40px rgba(0, 0, 0, .18); position: relative; overflow: hidden;
}
.flip::after { content: ""; position: absolute; right: -40px; top: -40px; width: 140px; height: 140px; border-radius: 50%; background: radial-gradient(circle, rgba(231, 200, 115, .35), transparent 70%); }
.flip-label { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--gold); }
.flip-label svg { width: 15px; height: 15px; fill: var(--gold); stroke: none; }
.flip-jp { font-family: var(--font-jp); font-size: 54px; font-weight: 900; line-height: 1.15; margin-top: 18px; overflow-wrap: anywhere; }
.flip-ro { font-size: 17px; opacity: .7; font-weight: 600; margin-top: 4px; }
.flip-back { display: none; flex-direction: column; align-items: center; gap: 10px; margin-top: 16px; }
.flip-en { font-size: 20px; font-weight: 800; }
.flip-use { font-size: 15px; opacity: .8; line-height: 1.4; }
.flip-hint { margin-top: 16px; font-size: 13px; font-weight: 700; opacity: .55; }
.flip.revealed .flip-back { display: flex; }
.flip.revealed .flip-hint { display: none; }
.flip .chip { background: rgba(255, 255, 255, .14); }
:root[data-theme="dark"] .flip .chip { background: rgba(0, 0, 0, .08); }
.w2-link { align-self: center; margin: 14px 0 0; font-weight: 700; font-size: 15px; color: var(--label-2); }
.w2 .btn-blue { margin-top: auto; }
.w2 > .btn-blue { margin-top: 28px; }

/* ---------- Today (v0.3) ---------- */
.t2-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin: 8px 0 18px; }
.t2-title { margin: 2px 0 0; font-size: 34px; font-weight: 850; letter-spacing: -0.03em; line-height: 1.1; }
.round-btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: var(--fill-2); border: 1px solid var(--sep); color: var(--label); flex: none; }
.deck { background: var(--primary); color: var(--on-primary); border-radius: 28px; padding: 22px 20px 20px; box-shadow: 0 18px 40px rgba(0, 0, 0, .16); }
.deck-head { display: flex; justify-content: space-between; align-items: baseline; }
.deck-label { font-size: 12px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); }
.deck-count { font-size: 40px; font-weight: 900; letter-spacing: -0.03em; line-height: 1; }
.deck-count small { font-size: 20px; opacity: .55; font-weight: 800; }
.deck-bar { display: flex; gap: 3px; height: 10px; margin-top: 16px; }
.deck-bar i { display: block; border-radius: 5px; }
.b-done { background: var(--gold); }
.b-rev { background: #6FBF95; }
.b-new { background: rgba(255, 255, 255, .28); }
.b-empty { background: rgba(255, 255, 255, .16); }
:root[data-theme="dark"] .b-new, :root[data-theme="dark"] .b-empty { background: rgba(0, 0, 0, .18); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .b-new, :root:not([data-theme="light"]) .b-empty { background: rgba(0, 0, 0, .18); } :root:not([data-theme="light"]) .flip .chip { background: rgba(0, 0, 0, .08); } }
.deck-legend { display: flex; gap: 14px; margin-top: 10px; font-size: 12.5px; font-weight: 700; opacity: .75; }
.deck-legend b { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }
.next-up { display: flex; align-items: baseline; gap: 10px; margin-top: 18px; padding: 14px 16px; border-radius: 18px; background: rgba(255, 255, 255, .08); border: 1px solid rgba(255, 255, 255, .12); }
:root[data-theme="dark"] .next-up { background: rgba(0, 0, 0, .05); border-color: rgba(0, 0, 0, .1); }
.nu-l { font-size: 11px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; opacity: .6; }
.nu-jp { font-family: var(--font-jp); font-size: 24px; font-weight: 800; }
.nu-ro { font-size: 14px; opacity: .6; font-weight: 600; }
.mode-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.mode-pick button { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; border-radius: 14px; border: 1.5px solid rgba(255, 255, 255, .18); background: transparent; color: inherit; font-weight: 750; font-size: 14.5px; cursor: pointer; opacity: .7; }
:root[data-theme="dark"] .mode-pick button { border-color: rgba(0, 0, 0, .15); }
.mode-pick button.on { opacity: 1; border-color: var(--gold); background: rgba(231, 200, 115, .12); }
.mode-pick svg { width: 20px; height: 20px; }
.mp-ic { font-size: 17px; font-weight: 900; }
.deck-start { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 14px; min-height: 56px; border-radius: 18px; background: var(--gold); color: #1A1608; font-size: 18px; font-weight: 850; }
.deck-start svg { width: 22px; height: 22px; stroke-width: 2.4; }
.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.tile { position: relative; display: flex; flex-direction: column; padding: 16px; border-radius: 22px; background: var(--fill-2); border: 1px solid var(--sep); }
.tile b { font-size: 28px; font-weight: 900; letter-spacing: -0.02em; line-height: 1.1; margin-top: 10px; font-variant-numeric: tabular-nums; }
.tile b small { font-size: 15px; color: var(--label-3); font-weight: 800; }
.tile > span:last-of-type { font-size: 13px; font-weight: 700; color: var(--label-3); }
.t-ic { width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center; }
.t-ic svg { width: 20px; height: 20px; }
.t-ic.flame { background: rgba(232, 89, 12, .12); color: #E8590C; }
.t-ic.bolt { background: rgba(184, 144, 30, .14); color: var(--gold-ink); }
.t-ic.trophy { background: rgba(123, 75, 196, .12); color: #7B4BC4; }
.t-ic.check { background: var(--green-soft); color: var(--green); }
.t-bar { display: block; height: 5px; border-radius: 3px; background: var(--fill); margin-top: 8px; overflow: hidden; }
.t-bar i { display: block; height: 100%; background: var(--label); border-radius: 3px; }
.t2-sec { display: flex; align-items: baseline; gap: 8px; margin: 28px 2px 10px; }
.t2-sec h2 { margin: 0; font-size: 20px; font-weight: 850; letter-spacing: -0.02em; }
.t2-sec span { font-size: 14px; font-weight: 700; color: var(--label-3); }
.hscroll { display: flex; gap: 10px; overflow-x: auto; margin: 0 -20px; padding: 2px 20px 8px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.hscroll::-webkit-scrollbar { display: none; }
.mini { flex: none; width: 150px; scroll-snap-align: start; position: relative; display: flex; flex-direction: column; padding: 16px 14px 14px; border-radius: 20px; background: var(--card); border: 1px solid var(--sep); overflow: hidden; }
body.plain .mini { background: var(--fill-2); }
.mini-cat { position: absolute; left: 0; top: 0; right: 0; height: 4px; }
.mini-jp { font-family: var(--font-jp); font-size: 22px; font-weight: 800; line-height: 1.2; overflow-wrap: anywhere; }
.mini-ro { font-size: 12.5px; color: var(--label-3); font-weight: 600; margin-top: 2px; }
.mini-en { font-size: 13px; color: var(--label-2); margin-top: 10px; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mini .dot { position: absolute; top: 14px; right: 12px; }
.quiz-card { display: flex; align-items: center; gap: 14px; margin-top: 24px; padding: 16px 18px; border-radius: 22px; background: var(--fill-2); border: 1px solid var(--sep); }
.quiz-card .q-ic { width: 42px; height: 42px; border-radius: 13px; background: var(--primary); color: var(--on-primary); display: grid; place-items: center; flex: none; }
.quiz-card b { display: block; font-size: 17px; }
.quiz-card .grow > span { font-size: 13px; color: var(--label-3); font-weight: 600; }
.quiz-card .chev { color: var(--label-3); }
.capsule { border: 0; box-shadow: none; background: none; gap: 8px; padding: 0; }
.capsule .cbtn { width: 44px; height: 44px; border-radius: 50%; background: var(--fill-2); border: 1px solid var(--sep); }
.flip-jp.long { font-size: 34px; }
.next-up { align-items: center; }
.next-up .nu-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.next-up .nu-jp, .next-up .nu-ro { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.next-up .nu-jp { font-size: 22px; }
.next-up .chev { opacity: .5; width: 18px; height: 18px; }
.tiles { grid-template-columns: repeat(4, 1fr); gap: 8px; }
.tile { padding: 12px 10px 12px; border-radius: 18px; align-items: flex-start; }
.tile b { font-size: 22px; margin-top: 8px; }
.tile b small { font-size: 12px; }
.tile > span:last-of-type { font-size: 11.5px; }
.t-ic { width: 28px; height: 28px; border-radius: 9px; }
.t-ic svg { width: 17px; height: 17px; }
.t-bar { margin-top: 6px; width: 100%; }

.mark-img { width: 34px; height: 34px; border-radius: 9px; display: block; flex: none; }

/* Context line under an example (v0.4) */
.ex .ex-nuance { margin-top: 8px; padding: 7px 10px; border-radius: 8px; background: var(--fill-2); color: var(--label-2); font-size: 13px; line-height: 1.45; }
.ex .ex-nuance b { font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--amber); margin-right: 4px; }

/* Free sample → full app (v0.4) */
.upsell { margin: 22px 0 8px; padding: 20px 18px; border-radius: var(--radius); background: #15161A; color: #F4F2EC; }
.upsell .up-k { display: block; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--gold); font-weight: 700; }
.upsell h2 { margin: 8px 0 6px; font-size: 20px; line-height: 1.25; }
.upsell p { margin: 0 0 10px; color: rgba(244,242,236,.78); font-size: 14.5px; line-height: 1.45; }
.upsell ul { margin: 0 0 16px; padding-left: 18px; color: rgba(244,242,236,.9); font-size: 14px; line-height: 1.6; }
.upsell .up-btn { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 13px 16px; border-radius: 14px; background: var(--gold); color: #15161A; font-weight: 700; text-decoration: none; }
.upsell .up-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }

/* Where it's used / who says it (v0.4) */
.scene-row { display: flex; flex-wrap: wrap; gap: 6px; }
.scene-chip { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--blue-soft); color: var(--blue); font-size: 13px; font-weight: 600; text-decoration: none; }
.age-chip { display: inline-block; padding: 3px 10px; border-radius: 999px; background: var(--amber-soft); color: var(--amber); font-size: 13px; font-weight: 700; }
.age-note { display: block; margin-top: 6px; color: var(--label-2); font-size: 14px; }
.num-tile.scene-tile { width: auto; min-width: 64px; padding: 0 10px; font-size: 13px; background: var(--blue); }
