/* =========================================================
   SubelJapan — "Mochi Pop" design system
   Sáng, sạch, bo tròn, nút nổi 3D, màu kẹo pastel
   ========================================================= */

/* ---------- Tokens ---------- */
:root {
  --f-head: "Baloo 2", "Nunito", "Kiwi Maru", system-ui, sans-serif;
  --f-body: "Nunito", "Kiwi Maru", system-ui, -apple-system, "Segoe UI", sans-serif;
  /* Kiwi Maru: chữ tròn nhưng giữ nét tách như chữ viết tay (さ き り ふ…), không nối nét như các font gothic */
  --f-jp: "Kiwi Maru", "Klee One", "Hiragino Maru Gothic ProN", "Yu Gothic", sans-serif;
  --f-kana: "Klee One", "Kiwi Maru", "Yu Mincho", serif;

  --bg: #fff5f7;
  --bg2: #ffeaf0;
  --card: #ffffff;
  --card2: #fff9fb;
  --ink: #3a2e4d;
  --ink2: #7a6e8f;
  --ink3: #9a8eac; /* chữ phụ: đậm hơn chút cho dễ đọc */
  --ink-ic: #4a3756;
  --line: #f1e2e9;
  --line2: #e6d3dc;

  --pri: #ff6b9a;
  --pri-d: #e0497c;
  --pri-l: #ffe1eb;
  --pri-t: #c8336a;

  --mint: #29c993;
  --mint-d: #17a576;
  --mint-l: #d9f7ec;
  --mint-t: #108a61;
  --sky: #4aa8ff;
  --sky-d: #2a86de;
  --sky-l: #e0f0ff;
  --sky-t: #1f6fbf;
  --sun: #ffc233;
  --sun-d: #e3a200;
  --sun-l: #fff3d1;
  --sun-t: #9a6b00;
  --lav: #9b7bff;
  --lav-d: #7957eb;
  --lav-l: #eee8ff;
  --lav-t: #5e3fcf;
  --coral: #ff835f;
  --coral-d: #e8613c;
  --coral-l: #ffe8df;
  --red: #ff5a6e;
  --red-d: #e03a50;
  --red-l: #ffe3e7;
  --red-t: #c42840;
  --gold: #ffb800;

  --r-sm: 12px;
  --r: 16px;
  --r-lg: 22px;
  --r-xl: 28px;
  --side-w: 248px;
  --rail-w: 340px;
  --shadow-pop: 0 18px 50px rgba(58, 46, 77, .16);
  color-scheme: only light;
}
/* ---------- GIAO DIỆN (theme) ----------
 * html có data-theme="tên"; giao diện tối có thêm data-dark. Ô xem trước trong Cài đặt cũng dùng đúng 2 thuộc tính này
 * nên mỗi khối phải tự đủ màu (không dựa vào :root). Quy tắc riêng cho giao diện tối viết bằng [data-dark]. */
:is([data-theme="sakura"], [data-theme="momo"], [data-theme="ichigo"], [data-theme="yuzu"], [data-theme="matcha"], [data-theme="umi"], [data-theme="sora"], [data-theme="fuji"], [data-theme="kohi"], [data-theme="yuki"]) {
  --bg: #fff5f7; --bg2: #ffeaf0; --card: #ffffff; --card2: #fff9fb; --ink: #3a2e4d; --ink2: #7a6e8f; --ink3: #9a8eac; --ink-ic: #4a3756;
  --line: #f1e2e9; --line2: #e6d3dc; --pri: #ff6b9a; --pri-d: #e0497c; --pri-l: #ffe1eb; --pri-t: #c8336a;
  --mint-l: #d9f7ec; --mint-t: #108a61; --sky-l: #e0f0ff; --sky-t: #1f6fbf; --sun-l: #fff3d1; --sun-t: #9a6b00; --lav-l: #eee8ff; --lav-t: #5e3fcf;
  --coral-l: #ffe8df; --red-l: #ffe3e7; --red-t: #c42840; --shadow-pop: 0 18px 50px rgba(58, 46, 77, .16); color-scheme: only light;
}
[data-theme="momo"] { --bg: #fff6f1; --bg2: #ffe9df; --line: #f6e2d8; --line2: #ebd0c3; --pri: #ff8a65; --pri-d: #e8693f; --pri-l: #ffe4d9; --pri-t: #b84a22; --card2: #fffaf7; }
[data-theme="ichigo"] { --bg: #fff6f5; --bg2: #ffe7e6; --line: #f6dfde; --line2: #ebcbca; --pri: #f2546b; --pri-d: #d43650; --pri-l: #ffe0e4; --pri-t: #b02a40; --card2: #fffafa; }
[data-theme="yuzu"] { --bg: #fff9ef; --bg2: #fff0d6; --line: #f6e8cf; --line2: #ead7b4; --pri: #ff9a3c; --pri-d: #e37a17; --pri-l: #ffecd6; --pri-t: #b45a06; --card2: #fffcf6; }
[data-theme="matcha"] { --bg: #f4faf2; --bg2: #e6f4e2; --line: #e1eedc; --line2: #cfe2c8; --pri: #4cbf7a; --pri-d: #2f9c5c; --pri-l: #dcf3e4; --pri-t: #237a47; --card2: #f9fdf8; }
[data-theme="umi"] { --bg: #effaf9; --bg2: #dcf3f1; --line: #d8ecea; --line2: #c2dfdc; --pri: #1fb5a8; --pri-d: #11948a; --pri-l: #d5f3ef; --pri-t: #0d7a71; --card2: #f7fdfc; }
[data-theme="sora"] { --bg: #f3f8ff; --bg2: #e3efff; --line: #dfeaf8; --line2: #ccdcf0; --pri: #4a9dff; --pri-d: #2a7ee0; --pri-l: #dff0ff; --pri-t: #1f63b5; --card2: #f8fbff; }
[data-theme="fuji"] { --bg: #f7f4ff; --bg2: #ede7ff; --line: #e7e0f7; --line2: #d6cceb; --pri: #9b7bff; --pri-d: #7957eb; --pri-l: #ebe4ff; --pri-t: #5e3fcf; --card2: #fbf9ff; }
[data-theme="kohi"] { --bg: #faf5ef; --bg2: #f2e7da; --line: #ece0d2; --line2: #dccbb7; --pri: #b07a4f; --pri-d: #8f5d36; --pri-l: #f3e4d4; --pri-t: #7a4a26; --card2: #fdfaf6; --ink: #3d2f2b; --ink2: #7d6c62; --ink3: #9c8b80; }
[data-theme="yuki"] { --bg: #f4f6fa; --bg2: #e8edf4; --line: #e2e7ef; --line2: #d0d8e3; --pri: #6c86d9; --pri-d: #4f69bd; --pri-l: #e3e9fb; --pri-t: #3f56a3; --card2: #fafbfd; --ink: #2f3446; --ink2: #6b7186; --ink3: #8d93a6; }
/* giao diện tối: phần chung */
[data-dark] {
  --ink: #f4eefb; --ink2: #b9adcc; --ink3: #7d7192;
  --mint-l: #1f3d36; --mint-t: #6be3b8; --sky-l: #1f3350; --sky-t: #8cc6ff; --sun-l: #43381c; --sun-t: #ffd56b; --lav-l: #342b55; --lav-t: #c2b0ff;
  --coral-l: #47302a; --red-l: #4a2530; --red-t: #ff9aa8; --shadow-pop: 0 18px 50px rgba(0, 0, 0, .45); color-scheme: dark;
}
[data-theme="yoru"] { --bg: #1d1828; --bg2: #262035; --card: #2a2339; --card2: #2f2840; --ink-ic: #2a2236; --line: #3b3250; --line2: #15111d; --pri: #ff79a6; --pri-d: #d24e7e; --pri-l: #4a2c42; --pri-t: #ffa6c4; }
[data-theme="kuroneko"] { --bg: #16161a; --bg2: #1f1f25; --card: #24242b; --card2: #2a2a33; --ink: #f3f1f6; --ink2: #b8b5c2; --ink3: #807d8c; --ink-ic: #24242b; --line: #35353f; --line2: #0d0d10; --pri: #f78a3b; --pri-d: #cf6a20; --pri-l: #43301f; --pri-t: #ffb47a; }
[data-theme="shinkai"] { --bg: #0e1828; --bg2: #152238; --card: #1a2a42; --card2: #1f304b; --ink: #eaf3ff; --ink2: #a8bcd5; --ink3: #7189a7; --ink-ic: #1a2a42; --line: #2a3d5a; --line2: #08101c; --pri: #22a9b8; --pri-d: #16838f; --pri-l: #163f4c; --pri-t: #7ddfe8; }
[data-theme="mori"] { --bg: #121b16; --bg2: #19251e; --card: #1e2c24; --card2: #23332a; --ink: #eef7f0; --ink2: #b1c7b8; --ink3: #768c7e; --ink-ic: #1e2c24; --line: #2e4136; --line2: #0a110d; --pri: #3daa76; --pri-d: #2b8659; --pri-l: #1e4030; --pri-t: #8ee0b3; }

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; font-synthesis-weight: none; } /* không tô đậm giả: Kiwi Maru tối đa 500, Klee One 600 */
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink);
  font: 600 15.5px/1.55 var(--f-body); -webkit-font-smoothing: antialiased; overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, h4 { font-family: var(--f-head); line-height: 1.15; margin: 0 0 .4em; font-weight: 800; letter-spacing: -.2px; }
h1 { font-size: 30px; } h2 { font-size: 23px; } h3 { font-size: 19px; }
p { margin: 0 0 .8em; }
a { color: var(--pri-t); text-decoration: none; }
button { font: inherit; color: inherit; }
img, svg { display: block; }
.ic { display: inline-block; flex: none; overflow: visible; }
.ic .o { stroke: var(--ink-ic); stroke-width: 2.3; stroke-linecap: round; stroke-linejoin: round; }
.ic .hl { fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; opacity: .75; }
.ic .t, .ic .tj { font-family: var(--f-body); font-weight: 900; }
.ic .tj { font-family: var(--f-jp); font-weight: 700; }
.jp { font-family: var(--f-jp); font-weight: 700; }
.kana { font-family: var(--f-kana); font-weight: 600; }
[data-kfont="maru"] .kana { font-family: var(--f-jp); font-weight: 700; }
ruby rt { font-size: .5em; font-weight: 700; color: var(--ink2); }
.no-furi ruby rt { visibility: hidden; }
::selection { background: var(--pri-l); }
:focus-visible { outline: 3px solid var(--sky); outline-offset: 2px; border-radius: 10px; }

/* ---------- Utilities ---------- */
.row { display: flex; align-items: center; }
.col { display: flex; flex-direction: column; }
.wrap { flex-wrap: wrap; }
.gap { gap: 14px; } .gap-s { gap: 8px; } .gap-xs { gap: 4px; } .gap-l { gap: 22px; }
.grow { flex: 1 1 0; min-width: 0; }
.center { text-align: center; }
.center-row { justify-content: center; }
.between { justify-content: space-between; }
.muted { color: var(--ink2); }
.faint { color: var(--ink3); }
.small { font-size: 13px; }
.tiny { font-size: 11.5px; }
.bold { font-weight: 800; }
.hidden { display: none !important; }
.mt { margin-top: 16px; } .mt-s { margin-top: 8px; } .mt-l { margin-top: 26px; }
.mb { margin-bottom: 16px; } .mb-s { margin-bottom: 8px; }
.pad { padding: 18px; } .pad-xl { padding: 48px 16px; }
.w100 { width: 100%; }
.nowrap { white-space: nowrap; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.tape, .petal, #petals { display: none !important; }

/* ---------- App shell ---------- */
.app { min-height: 100vh; }
.side {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w); z-index: 40; display: flex; flex-direction: column;
  padding: 18px 14px 14px; background: var(--card); border-right: 2px solid var(--line); overflow-y: auto; scrollbar-width: thin;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 14px; color: var(--ink); }
.brand-logo { width: 42px; height: 42px; flex: none; }
.brand-logo svg { width: 100%; height: 100%; }
.brand-name { font: 800 23px/1 var(--f-head); letter-spacing: -.3px; color: var(--ink); }
.brand-name b { color: var(--pri); font-weight: 800; }
.side-nav { display: flex; flex-direction: column; gap: 3px; }
.side-nav a, .side-more {
  position: relative; display: flex; align-items: center; gap: 13px; padding: 8px 12px; min-height: 48px; border-radius: 14px;
  color: var(--ink2); font: 800 14.5px/1.2 var(--f-body); border: 2px solid transparent; transition: background .15s, color .15s;
}
.side-nav a:hover { background: var(--bg); color: var(--ink); }
.side-nav a.active { background: var(--pri-l); color: var(--pri-t); border-color: color-mix(in srgb, var(--pri) 35%, transparent); }
.side-nav .nav-sep { height: 2px; background: var(--line); margin: 8px 10px; border-radius: 2px; }
.side-nav .ic { transition: transform .2s; }
.side-nav a:hover .ic { transform: rotate(-6deg) scale(1.08); }
.dot-num { min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--red); color: #fff; font: 900 12px/22px var(--f-body); font-style: normal; text-align: center; margin-left: auto; }
.side-foot { margin-top: auto; padding-top: 14px; }
.side-me { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 16px; background: var(--bg); border: 2px solid var(--line); color: var(--ink); }
.side-me:hover { border-color: var(--line2); }
.side-me .lv { font-size: 12px; color: var(--ink2); font-weight: 700; }
.side-me b { display: block; font-size: 14.5px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.view { margin-left: var(--side-w); min-height: 100vh; padding: 26px 28px 60px; }
.mtop { display: none; }
.bottombar { display: none; }

.page { max-width: 1060px; margin: 0 auto; }
.page-narrow { max-width: 720px; margin: 0 auto; }
.page-mid { max-width: 880px; margin: 0 auto; }
.with-rail { display: grid; grid-template-columns: minmax(0, 1fr) var(--rail-w); gap: 30px; max-width: 1100px; margin: 0 auto; align-items: start; }
.rail { position: sticky; top: 22px; display: flex; flex-direction: column; gap: 16px; }
.rail-mobile { display: none; }

/* focus mode: bài học, trò chơi, luyện tập */
.focus-mode .side, .focus-mode .mtop, .focus-mode .bottombar { display: none !important; }
.focus-mode .view { margin-left: 0; padding: 0; }

/* ---------- Card ---------- */
.card { background: var(--card); border: 2px solid var(--line); border-radius: var(--r-lg); box-shadow: 0 4px 0 var(--line2); }
.card-pad { padding: 20px; }
.card-sm { padding: 14px 16px; }
.card.hov { transition: transform .15s, box-shadow .15s, border-color .15s; cursor: pointer; }
.card.hov:hover { transform: translateY(-3px); box-shadow: 0 7px 0 var(--line2); border-color: var(--line2); }
.card.hov:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--line2); }
.paper { background: var(--card); border: 2px solid var(--line); border-radius: var(--r-lg); box-shadow: 0 4px 0 var(--line2); }
.card-title { display: flex; align-items: center; gap: 10px; font: 800 17px/1.2 var(--f-head); margin-bottom: 12px; }
.card-title .more { margin-left: auto; font: 800 13px var(--f-body); color: var(--pri-t); }
.tint-pink { background: var(--pri-l); border-color: transparent; box-shadow: none; }
.soft { background: var(--card2); }

/* ---------- Buttons ---------- */
.btn {
  --b: var(--pri); --bd: var(--pri-d); --bt: #fff;
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 20px; border: 0; border-radius: 16px; background: var(--b); color: var(--bt);
  font: 800 15px/1.15 var(--f-body); letter-spacing: .15px; text-align: center; cursor: pointer; user-select: none;
  box-shadow: 0 4px 0 var(--bd); transition: transform .08s, box-shadow .08s, filter .15s, background .15s;
}
.btn:hover { filter: brightness(1.05) saturate(1.05); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--bd); }
.btn[disabled], .btn.disabled { --b: var(--line); --bd: var(--line2); --bt: var(--ink3); cursor: not-allowed; filter: none; transform: none; }
.btn-white, .btn-paper { --b: var(--card); --bd: var(--line2); --bt: var(--ink); border: 2px solid var(--line); }
.btn-white:hover, .btn-paper:hover { filter: none; background: var(--card2); }
.btn-ghost { --b: transparent; --bd: transparent; --bt: var(--pri-t); box-shadow: none; }
.btn-ghost:hover { background: var(--pri-l); filter: none; }
.btn-ghost:active { transform: none; }
.btn-green { --b: var(--mint); --bd: var(--mint-d); }
.btn-red { --b: var(--red); --bd: var(--red-d); }
.btn-yel { --b: var(--sun); --bd: var(--sun-d); --bt: #5a3d00; }
.btn-sky { --b: var(--sky); --bd: var(--sky-d); }
.btn-lav { --b: var(--lav); --bd: var(--lav-d); }
.btn-soft { --b: var(--pri-l); --bd: color-mix(in srgb, var(--pri) 30%, var(--pri-l)); --bt: var(--pri-t); }
.btn-lg { min-height: 56px; padding: 12px 26px; font-size: 16.5px; border-radius: 18px; }
.btn-sm { min-height: 38px; padding: 6px 13px; font-size: 13.5px; border-radius: 12px; box-shadow: 0 3px 0 var(--bd); }
.btn-sm:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--bd); }
.btn-block { display: flex; width: 100%; }
.btn-round { width: 48px; padding: 0; border-radius: 50%; }
.icon-btn { display: inline-grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; border: 2px solid var(--line); background: var(--card); box-shadow: 0 3px 0 var(--line2); cursor: pointer; transition: transform .08s, box-shadow .08s; }
.icon-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line2); }
.link-btn { border: 0; background: none; padding: 0; color: var(--pri-t); font-weight: 800; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.say-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 12px; border: 2px solid var(--line); background: var(--card); cursor: pointer; box-shadow: 0 3px 0 var(--line2); transition: transform .08s; }
.say-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line2); }
.speaking { animation: speak .5s ease; }
@keyframes speak { 30% { transform: scale(1.12); } 60% { transform: scale(.96); } }
kbd { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 7px; border: 2px solid var(--line); border-bottom-width: 3px; font: 800 11px var(--f-body); color: var(--ink3); background: var(--card); }

/* ---------- Chips, tags, inputs ---------- */
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px 5px 7px; min-height: 38px; border-radius: 13px; font-weight: 900; font-size: 15px; color: var(--ink); background: var(--card); border: 2px solid var(--line); }
.chip.c-fire b { color: var(--coral-d); } .chip.c-fish b { color: var(--sky-d); } .chip.c-xp b { color: var(--sun-t); }
.chip.c-fire.off { filter: grayscale(1); opacity: .7; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 8px 14px; min-height: 42px; border-radius: 14px; cursor: pointer;
  background: var(--card); border: 2px solid var(--line); box-shadow: 0 3px 0 var(--line2); font: 800 14px var(--f-body); color: var(--ink2);
  transition: transform .08s, box-shadow .08s, background .15s, border-color .15s, color .15s;
}
.chip-btn:hover { color: var(--ink); border-color: var(--line2); }
.chip-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line2); }
.chip-btn.active { background: var(--pri-l); border-color: var(--pri); color: var(--pri-t); box-shadow: 0 3px 0 color-mix(in srgb, var(--pri) 55%, var(--line2)); }
.chip-btn small { font-weight: 700; color: var(--ink3); }
.tag { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 999px; font: 800 12.5px/1.5 var(--f-body); background: var(--bg2); color: var(--ink2); }
.tag-pink { background: var(--pri-l); color: var(--pri-t); } .tag-blue { background: var(--sky-l); color: var(--sky-t); }
.tag-green { background: var(--mint-l); color: var(--mint-t); } .tag-yel { background: var(--sun-l); color: var(--sun-t); }
.tag-lav { background: var(--lav-l); color: var(--lav-t); }
.input {
  width: 100%; min-height: 50px; padding: 11px 16px; border-radius: 15px; border: 2px solid var(--line); background: var(--card2);
  font: 700 16px var(--f-body); color: var(--ink); outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--pri); box-shadow: 0 0 0 4px var(--pri-l); background: var(--card); }
.input::placeholder { color: var(--ink3); font-weight: 600; }
textarea.input { min-height: 90px; resize: vertical; }
select.input { appearance: none; cursor: pointer; background-image: linear-gradient(45deg, transparent 50%, var(--ink2) 50%), linear-gradient(135deg, var(--ink2) 50%, transparent 50%); background-position: calc(100% - 20px) 22px, calc(100% - 15px) 22px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.seg { display: inline-flex; padding: 4px; gap: 4px; border-radius: 16px; background: var(--bg2); border: 2px solid var(--line); }
.seg button { border: 0; background: transparent; padding: 8px 16px; min-height: 40px; border-radius: 12px; font: 800 14px var(--f-body); color: var(--ink2); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.seg button.active { background: var(--card); color: var(--pri-t); box-shadow: 0 2px 0 var(--line2); }
.switch { position: relative; display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 800; user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch i { position: relative; width: 46px; height: 28px; border-radius: 14px; background: var(--line2); transition: background .2s; flex: none; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 0 rgba(0,0,0,.12); transition: transform .2s; }
.switch input:checked + i { background: var(--mint); }
.switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { outline: 3px solid var(--sky); outline-offset: 2px; }
.range { width: 100%; accent-color: var(--pri); }

/* ---------- Progress, ring, stars ---------- */
.bar { position: relative; height: 14px; border-radius: 99px; background: var(--bg2); overflow: hidden; }
.bar > i { position: absolute; inset: 0 auto 0 0; border-radius: inherit; background: var(--pri); transition: width .5s cubic-bezier(.3,1.3,.5,1); }
.bar > i::after { content: ""; position: absolute; left: 8px; right: 8px; top: 3px; height: 4px; border-radius: 4px; background: rgba(255,255,255,.4); }
.bar.green > i { background: var(--mint); } .bar.sun > i { background: var(--sun); } .bar.sky > i { background: var(--sky); } .bar.lav > i { background: var(--lav); }
.bar.thin { height: 9px; } .bar.thin > i::after { display: none; }
.ring { position: relative; flex: none; }
.ring svg { transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 9; stroke-linecap: round; }
.ring-bg { stroke: var(--bg2); }
.ring-fg { transition: stroke-dashoffset .8s cubic-bezier(.3,1.2,.5,1); }
.ring-in { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; line-height: 1; }
.ring-in b { font: 900 18px var(--f-body); }
.ring-in small { display: block; font-size: 11px; color: var(--ink2); font-weight: 800; }
.stars { display: inline-flex; gap: 2px; vertical-align: middle; }
.star { display: inline-flex; filter: grayscale(1) opacity(.3); transition: filter .3s; }
.star.on { filter: none; }
.hanko {
  display: inline-grid; place-items: center; width: 70px; height: 70px; border-radius: 50%; flex: none;
  border: 3.5px solid #e24a4a; color: #e24a4a; font: 700 22px/1 var(--f-jp); transform: rotate(-12deg);
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.6), inset 0 0 0 5px #e24a4a; background: rgba(255,255,255,.75); letter-spacing: -1px;
}
.hanko .jp { writing-mode: vertical-rl; font-size: 20px; }
.hanko.sm { width: 46px; height: 46px; border-width: 2.5px; box-shadow: inset 0 0 0 2px rgba(255,255,255,.6), inset 0 0 0 3.5px #e24a4a; }
.hanko.sm .jp { font-size: 14px; }
.hanko.xs { width: 30px; height: 30px; border-width: 2px; box-shadow: none; }
.hanko.xs .jp { font-size: 12px; writing-mode: horizontal-tb; }
.stamp-in { animation: stamp .55s cubic-bezier(.3,1.6,.5,1) both .45s; }
@keyframes stamp { 0% { transform: scale(2.6) rotate(-30deg); opacity: 0; } 60% { opacity: 1; } 100% { transform: scale(1) rotate(-12deg); opacity: 1; } }

/* ---------- Mascot ---------- */
.mascot { overflow: visible; cursor: pointer; }
.mascot .m-body { transform-origin: 60px 108px; }
.mascot.bob .m-body { animation: bob 3.2s ease-in-out infinite; }
.mascot.jump .m-body { animation: jump 1.1s cubic-bezier(.3,1.5,.5,1) 2; }
.mascot.wiggle .m-body { animation: wig 1.4s ease-in-out infinite; }
.mascot .m-tail { transform-origin: 96px 100px; animation: tail 2.4s ease-in-out infinite; }
.mascot .m-blink { transform-origin: 60px 72px; animation: blink 4.6s infinite; }
.mascot.squish .m-body { animation: squish .45s ease; }
@keyframes bob { 50% { transform: translateY(-4px) scale(1.01, .99); } }
@keyframes jump { 0%, 100% { transform: none; } 35% { transform: translateY(-16px) scale(.96, 1.04); } 60% { transform: translateY(0) scale(1.06, .94); } }
@keyframes wig { 25% { transform: rotate(-4deg); } 75% { transform: rotate(4deg); } }
@keyframes tail { 50% { transform: rotate(9deg); } }
@keyframes blink { 0%, 92%, 100% { transform: none; } 95% { transform: scaleY(.1); } }
@keyframes squish { 30% { transform: scale(1.12, .86); } 60% { transform: scale(.94, 1.06); } }
.mochi-say { display: flex; align-items: flex-end; gap: 12px; }
.mochi-wrap { border: 0; background: none; padding: 0; cursor: pointer; flex: none; }
.bubble { position: relative; padding: 13px 16px; border-radius: 18px; background: var(--card); border: 2px solid var(--line); box-shadow: 0 3px 0 var(--line2); font-weight: 700; }
.bubble::before { content: ""; position: absolute; left: -10px; bottom: 18px; width: 16px; height: 16px; background: var(--card); border-left: 2px solid var(--line); border-bottom: 2px solid var(--line); transform: rotate(45deg); border-radius: 0 0 0 4px; }

/* ---------- Toast ---------- */
#toast-root { position: fixed; left: 50%; top: 16px; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(92vw, 440px); }
/* đang học / chơi: hạ thông báo xuống dưới thanh tiến độ, khỏi che nút thoát */
body.focus-mode #toast-root { top: 58px; }
.toast { display: flex; align-items: center; gap: 10px; padding: 11px 18px; border-radius: 18px; background: var(--card); border: 2px solid var(--line); box-shadow: var(--shadow-pop); font-weight: 800; transform: translateY(-30px) scale(.9); opacity: 0; transition: transform .35s cubic-bezier(.3,1.5,.5,1), opacity .25s; pointer-events: auto; }
.toast.show { transform: none; opacity: 1; }
.toast-badge { display: flex; gap: 12px; align-items: center; }

/* ---------- Modal & sheet ---------- */
.modal-back { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; padding: 16px; background: rgba(40, 30, 55, .38); backdrop-filter: blur(3px); opacity: 0; transition: opacity .22s; }
.modal-back.show { opacity: 1; }
.modal { position: relative; width: min(560px, 100%); max-height: calc(100vh - 32px); overflow-y: auto; padding: 26px; border-radius: var(--r-xl); background: var(--card); border: 2px solid var(--line); box-shadow: var(--shadow-pop); transform: translateY(24px) scale(.96); transition: transform .3s cubic-bezier(.3,1.4,.5,1); scrollbar-width: thin; }
.modal-back.show .modal { transform: none; }
.modal-sm { width: min(430px, 100%); }
.modal-lg { width: min(760px, 100%); }
.modal-x { position: absolute; top: 12px; right: 12px; width: 38px; height: 38px; border-radius: 12px; border: 0; background: var(--bg2); display: grid; place-items: center; cursor: pointer; z-index: 2; }
.modal-x:hover { background: var(--pri-l); }
.confirm-text { font-size: 16.5px; font-weight: 800; margin: 12px 0 18px; }
.sheet-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.sheet-item { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 6px; border-radius: 18px; border: 2px solid var(--line); background: var(--card); box-shadow: 0 3px 0 var(--line2); color: var(--ink); font-weight: 800; font-size: 13px; text-align: center; position: relative; }
.sheet-item .dot-num { position: absolute; top: 6px; right: 6px; margin: 0; }

/* ---------- Confetti ---------- */
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 400; overflow: hidden; }
.confetti i { position: absolute; top: -24px; border-radius: 3px; animation: fall linear forwards; }
.confetti i.shape { background: none !important; }
@keyframes fall { to { transform: translate(var(--dx), 110vh) rotate(var(--rot)); } }

/* ---------- Animations ---------- */
.pop-in { animation: popIn .42s cubic-bezier(.3,1.4,.5,1) both; }
.slide-up { animation: slideUp .3s cubic-bezier(.3,1.3,.5,1) both; }
.fade-in { animation: fadeIn .35s ease both; }
.bounce-in { animation: bounceIn .6s cubic-bezier(.3,1.7,.5,1) both; }
.float { animation: float 3.4s ease-in-out infinite; }
.shake { animation: shake .42s ease; }
.wobble { animation: wig 1.2s ease-in-out infinite; }
@keyframes popIn { from { opacity: 0; transform: translateY(14px) scale(.97); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(30px); } }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes bounceIn { 0% { transform: scale(.3); opacity: 0; } 60% { transform: scale(1.08); opacity: 1; } }
@keyframes float { 50% { transform: translateY(-7px); } }
@keyframes shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
@keyframes pulse { 0% { transform: scale(1); opacity: .55; } 100% { transform: scale(1.45); opacity: 0; } }
html[data-motion="reduce"] *, html[data-motion="reduce"] *::before, html[data-motion="reduce"] *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }

/* ---------- Page header ---------- */
.page-head { display: flex; align-items: center; gap: 18px; margin-bottom: 22px; }
.page-head .ph-icon { width: 76px; height: 76px; flex: none; display: grid; place-items: center; border-radius: 24px; background: var(--card); border: 2px solid var(--line); box-shadow: 0 4px 0 var(--line2); }
.page-head h1 { margin: 0 0 2px; }
.page-head p { margin: 0; color: var(--ink2); font-weight: 600; max-width: 640px; }
.page-head.center { flex-direction: column; text-align: center; }
.page-head.center p { margin: 0 auto; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-weight: 800; color: var(--ink2); margin-bottom: 14px; }
.back-link:hover { color: var(--pri-t); }
.section-label { display: flex; align-items: center; gap: 8px; margin: 26px 0 12px; font: 800 18px var(--f-head); }
.section-label small { font: 700 13px var(--f-body); color: var(--ink2); }
.gs-label { margin: 20px 0 10px; font: 800 14px var(--f-body); color: var(--ink2); text-transform: uppercase; letter-spacing: .6px; }

/* =========================================================
   HOME — Lộ trình (path) + rail
   ========================================================= */
.hello { display: flex; align-items: center; gap: 16px; padding: 18px 20px; margin-bottom: 26px; }
.hello h1 { font-size: 25px; margin: 0; }
.hello .hello-jp { color: var(--pri-t); font-size: 14px; }
.hello .mascot { flex: none; }
.hello-cta { margin-left: auto; }

.unit { margin-bottom: 30px; }
.unit-banner {
  --ucd: color-mix(in srgb, var(--uc) 75%, #2a1a3a);
  position: relative; overflow: hidden; display: flex; align-items: center; gap: 16px; padding: 18px 20px 18px 22px; border-radius: 22px;
  background: var(--uc); color: #fff; box-shadow: 0 5px 0 var(--ucd); margin-bottom: 26px;
}
.unit-banner::after {
  content: ""; position: absolute; inset: 0 0 0 45%; opacity: .9; pointer-events: none;
  --a: var(--uc); --b: color-mix(in srgb, var(--uc) 82%, #fff);
  background-image:
    radial-gradient(circle at 100% 150%, var(--a) 24%, var(--b) 24%, var(--b) 28%, var(--a) 28%, var(--a) 36%, var(--b) 36%, var(--b) 40%, transparent 40%, transparent),
    radial-gradient(circle at 0 150%, var(--a) 24%, var(--b) 24%, var(--b) 28%, var(--a) 28%, var(--a) 36%, var(--b) 36%, var(--b) 40%, transparent 40%, transparent),
    radial-gradient(circle at 50% 100%, var(--b) 10%, var(--a) 10%, var(--a) 23%, var(--b) 23%, var(--b) 30%, var(--a) 30%, var(--a) 43%, var(--b) 43%, var(--b) 50%, var(--a) 50%, var(--a) 63%, var(--b) 63%, var(--b) 71%, transparent 71%, transparent),
    radial-gradient(circle at 100% 50%, var(--b) 5%, var(--a) 5%, var(--a) 15%, var(--b) 15%, var(--b) 20%, var(--a) 20%, var(--a) 29%, var(--b) 29%, var(--b) 34%, var(--a) 34%, var(--a) 44%, var(--b) 44%, var(--b) 49%, transparent 49%, transparent),
    radial-gradient(circle at 0 50%, var(--b) 5%, var(--a) 5%, var(--a) 15%, var(--b) 15%, var(--b) 20%, var(--a) 20%, var(--a) 29%, var(--b) 29%, var(--b) 34%, var(--a) 34%, var(--a) 44%, var(--b) 44%, var(--b) 49%, transparent 49%, transparent);
  background-size: 64px 32px;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 70%); mask-image: linear-gradient(90deg, transparent, #000 70%);
}
.unit-banner > * { position: relative; z-index: 1; }
.ub-text { flex: 1; min-width: 0; }
.ub-kicker { font: 800 12.5px var(--f-body); text-transform: uppercase; letter-spacing: 1px; opacity: .9; }
.ub-title { font: 800 23px/1.15 var(--f-head); margin: 2px 0 2px; display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; }
.ub-title .jp { font-size: 16px; opacity: .9; font-weight: 700; }
.ub-desc { font-weight: 700; opacity: .95; font-size: 14px; }
.ub-prog { display: flex; align-items: center; gap: 10px; margin-top: 10px; font: 800 12.5px var(--f-body); }
.ub-prog .bar { flex: 1; max-width: 220px; height: 10px; background: rgba(255,255,255,.35); }
.ub-prog .bar > i { background: #fff; }
.ub-prog .bar > i::after { display: none; }
.ub-guide { --b: rgba(255,255,255,.18); --bd: rgba(0,0,0,.12); --bt: #fff; border: 2px solid rgba(255,255,255,.55); flex: none; }
.ub-guide:hover { --b: rgba(255,255,255,.28); }
.ub-icon { width: 60px; height: 60px; flex: none; display: grid; place-items: center; border-radius: 18px; background: rgba(255,255,255,.95); box-shadow: 0 4px 0 rgba(0,0,0,.12); }

.path { position: relative; display: flex; flex-direction: column; align-items: center; padding: 4px 0 10px; }
.pnode { --ucd: color-mix(in srgb, var(--uc) 72%, #2a1a3a); --ucl: color-mix(in srgb, var(--uc) 18%, var(--card)); position: relative; display: flex; flex-direction: column; align-items: center; margin: 7px 0; transform: translateX(var(--x, 0)); z-index: 1; }
.pnode.open { z-index: 20; }
.pn-btn {
  position: relative; display: grid; place-items: center; width: 74px; height: 68px; border-radius: 50%; border: 0; cursor: pointer; padding: 0;
  background: var(--card); color: var(--uc); box-shadow: inset 0 0 0 4px color-mix(in srgb, var(--uc) 40%, var(--card)), 0 7px 0 color-mix(in srgb, var(--uc) 35%, var(--line2));
  font: 700 29px/1 var(--f-kana); transition: transform .1s, box-shadow .1s;
}
.pn-btn:active { transform: translateY(5px); box-shadow: inset 0 0 0 4px color-mix(in srgb, var(--uc) 40%, var(--card)), 0 2px 0 color-mix(in srgb, var(--uc) 35%, var(--line2)); }
.pn-btn .ic { width: 38px; height: 38px; }
.pnode.done .pn-btn { background: var(--uc); color: #fff; box-shadow: inset 0 -5px 0 rgba(0,0,0,.08), 0 7px 0 var(--ucd); }
.pnode.done .pn-btn:active { box-shadow: 0 2px 0 var(--ucd); }
.pnode.cur .pn-btn { width: 86px; height: 80px; background: var(--uc); color: #fff; box-shadow: inset 0 -6px 0 rgba(0,0,0,.08), 0 8px 0 var(--ucd); font-size: 34px; }
.pnode.cur .pn-btn::before { content: ""; position: absolute; inset: -9px; border-radius: 50%; border: 5px solid var(--uc); opacity: .5; animation: pulse 1.8s ease-out infinite; pointer-events: none; }
.pn-check { position: absolute; right: -4px; bottom: 2px; width: 28px; height: 28px; border-radius: 50%; background: var(--sun); border: 3px solid var(--card); display: grid; place-items: center; }
.pn-check .ic { width: 16px; height: 16px; }
.pn-stars { display: flex; gap: 1px; margin-top: 9px; }
.pn-stars .star .ic { width: 15px; height: 15px; }
.pn-label { margin-top: 5px; max-width: 150px; text-align: center; font: 800 12.5px/1.25 var(--f-body); color: var(--ink2); }
.pnode.cur .pn-label { color: var(--ink); }
.pn-start {
  position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); white-space: nowrap; padding: 7px 14px; border-radius: 13px;
  background: var(--card); border: 2px solid var(--line); color: var(--uc); font: 900 13.5px var(--f-body); text-transform: uppercase; letter-spacing: .6px;
  box-shadow: 0 3px 0 var(--line2); animation: float 1.8s ease-in-out infinite; pointer-events: none;
}
.pn-start::after { content: ""; position: absolute; left: 50%; bottom: -8px; width: 12px; height: 12px; background: var(--card); border-right: 2px solid var(--line); border-bottom: 2px solid var(--line); transform: translateX(-50%) rotate(45deg); }
.pnode.chest .pn-btn { width: 80px; height: 72px; border-radius: 22px; background: var(--card); box-shadow: inset 0 0 0 3px var(--line), 0 6px 0 var(--line2); }
.pnode.chest.ready .pn-btn { animation: wig 1.2s ease-in-out infinite; box-shadow: inset 0 0 0 3px var(--sun), 0 6px 0 var(--sun-d); }
.pnode.chest.claimed .pn-btn { opacity: .65; }
.pnode.chest.locked .pn-btn .ic { filter: grayscale(.85) opacity(.55); }
.pn-pop {
  position: absolute; top: calc(100% + 10px); left: 50%; width: 270px; transform: translateX(-50%); z-index: 30; padding: 16px; border-radius: 20px;
  background: var(--uc); color: #fff; box-shadow: 0 5px 0 var(--ucd), var(--shadow-pop); text-align: left; animation: popIn .3s cubic-bezier(.3,1.4,.5,1);
}
.pn-pop::before { content: ""; position: absolute; top: -9px; left: 50%; width: 18px; height: 18px; background: var(--uc); transform: translateX(-50%) rotate(45deg); border-radius: 4px; }
.pn-pop h4 { font-size: 18px; margin: 0 0 2px; position: relative; }
.pn-pop p { font-size: 13.5px; opacity: .95; margin: 0 0 12px; position: relative; }
.pn-pop .btn { --b: #fff; --bd: rgba(0,0,0,.15); --bt: var(--uc); position: relative; }
.pn-pop .pp-meta { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; font: 800 12.5px var(--f-body); position: relative; }
.pn-pop .star { filter: grayscale(1) brightness(2.2) opacity(.6); }
.pn-pop .star.on { filter: none; }
.deco { position: absolute; z-index: 0; pointer-events: none; opacity: .95; }
.deco .mascot { pointer-events: auto; }
.path-end { text-align: center; padding: 20px; color: var(--ink2); font-weight: 700; }

/* rail */
.stat-row { display: flex; gap: 8px; justify-content: space-between; }
.stat-row .chip { flex: 1; justify-content: center; min-height: 46px; border-radius: 15px; }
.goal-card { display: flex; align-items: center; gap: 14px; }
.goal-card .gc-txt { flex: 1; }
.goal-card b { font: 800 16px var(--f-head); display: block; }
.week { display: flex; gap: 5px; margin-top: 12px; justify-content: space-between; }
.wday { display: flex; flex-direction: column; align-items: center; gap: 4px; font: 800 11px var(--f-body); color: var(--ink3); }
.wday i { width: 30px; height: 30px; border-radius: 50%; background: var(--bg2); display: grid; place-items: center; font-style: normal; }
.wday.on i { background: var(--coral-l); }
.wday.frz i { background: var(--sky-l); }
.wday.today { color: var(--ink); }
.wday.today i { box-shadow: 0 0 0 2.5px var(--coral); }
.quest { display: flex; align-items: center; gap: 12px; padding: 10px 0; }
.quest + .quest { border-top: 2px solid var(--line); }
.quest .q-ico { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 14px; background: var(--bg2); }
.quest .q-body { flex: 1; min-width: 0; }
.quest .q-text { font-weight: 800; font-size: 14px; margin-bottom: 5px; }
.quest .q-bar { display: flex; align-items: center; gap: 8px; }
.quest .q-bar .bar { flex: 1; height: 12px; }
.quest .q-bar small { font: 800 12px var(--f-body); color: var(--ink2); min-width: 38px; text-align: right; }
.quest .q-rew { display: flex; align-items: center; gap: 3px; font: 900 13px var(--f-body); color: var(--sky-t); flex: none; }
.quest.done .q-ico { background: var(--mint-l); }
.quest.claimed { opacity: .6; }
.claim-btn { min-height: 36px; padding: 4px 12px; font-size: 13px; }
.shop-teaser { display: flex; align-items: center; gap: 12px; }
.shop-teaser .mascot { flex: none; }
.wotd { display: flex; align-items: center; gap: 12px; cursor: pointer; }
.wotd .w-jp { font-size: 22px; }
.rail-foot { font-size: 12px; color: var(--ink3); text-align: center; line-height: 1.6; }
.rail-foot a { color: var(--ink2); }

/* =========================================================
   LESSON
   ========================================================= */
.lesson { min-height: 100vh; display: flex; flex-direction: column; background: var(--bg); }
.lesson-top { display: flex; align-items: center; gap: 16px; max-width: 980px; width: 100%; margin: 0 auto; padding: 22px 20px 10px; }
.lesson-x { width: 44px; height: 44px; border: 0; background: none; border-radius: 12px; display: grid; place-items: center; cursor: pointer; opacity: .75; }
.lesson-x:hover { background: var(--bg2); opacity: 1; }
.lesson-prog { flex: 1; height: 18px; }
.lesson-prog > i { background: var(--uc, var(--pri)); }
.lesson-count { font: 800 13px var(--f-body); color: var(--ink2); min-width: 64px; text-align: right; }
.lesson-hearts { display: flex; align-items: center; gap: 4px; font: 900 15px var(--f-body); color: var(--coral-d); }
.lesson-body { flex: 1; width: 100%; max-width: 720px; margin: 0 auto; padding: 18px 20px 150px; }
.lesson-foot { position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; background: var(--card); border-top: 2px solid var(--line); transition: background .2s, border-color .2s; }
.lesson-foot:empty { display: none; }
.foot-in { max-width: 980px; margin: 0 auto; padding: 18px 20px calc(18px + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: 14px; }
.lesson-foot.ok { background: var(--mint-l); border-color: transparent; }
.lesson-foot.bad { background: var(--red-l); border-color: transparent; }
.fb { display: flex; align-items: center; gap: 14px; flex: 1; min-width: 0; }
.fb-badge { width: 58px; height: 58px; flex: none; display: grid; place-items: center; border-radius: 50%; background: var(--card); }
.fb-title { font: 800 20px/1.2 var(--f-head); }
.lesson-foot.ok .fb-title { color: var(--mint-t); }
.lesson-foot.bad .fb-title { color: var(--red-t); }
.fb-hint { font-weight: 700; color: var(--ink); margin-top: 2px; font-size: 14.5px; }
.fb-hint .jp { font-size: 1.1em; }
.lesson-foot .btn { min-width: 170px; }
.feedback { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 20px; margin-top: 12px; }
.feedback.ok { background: var(--mint-l); } .feedback.bad { background: var(--red-l); }
.feedback .fb-left { display: flex; align-items: center; gap: 12px; flex: 1; }

.intro-card { text-align: center; padding-top: 10px; }
.unit-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 14px 5px 8px; border-radius: 999px; background: color-mix(in srgb, var(--uc) 16%, var(--card)); color: color-mix(in srgb, var(--uc) 70%, var(--ink)); font: 800 13px var(--f-body); }
.lesson-title { font-size: 34px; margin: 14px 0 2px; }
.lesson-sub { color: var(--ink2); font-weight: 700; margin-bottom: 20px; }
.preview { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 10px 0 24px; }
/* màn mở đầu bài chữ: thẻ chữ to, bấm để nghe */
.preview:has(.ikana-grid) { flex-direction: column; align-items: center; gap: 8px; }
.ikana-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; width: min(640px, 100%); }
.ikana { width: 106px; display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 12px 6px 10px; border-radius: 20px; background: var(--card); border: 2px solid var(--line); box-shadow: 0 4px 0 var(--line2); color: var(--ink); cursor: pointer; transition: transform .18s var(--spring), box-shadow .18s, border-color .18s; animation: optIn .45s var(--spring) both; }
.ikana:hover { transform: translateY(-3px); box-shadow: 0 7px 0 var(--line2); border-color: var(--pri); }
.ikana:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--line2); }
.ikana .g { font-size: 50px; line-height: 1.15; }
.ikana.small { width: 98px; }
.ikana.small .g { font-size: 36px; }
.ikana b { font: 900 15px var(--f-body); color: var(--pri-t); letter-spacing: .3px; }
.ikana small { font: 700 11.5px/1.25 var(--f-body); color: var(--ink3); text-align: center; }
@media (max-width: 520px) { .ikana-grid { gap: 9px; } .ikana, .ikana.small { width: calc((100% - 27px) / 4); } .ikana .g { font-size: 40px; } .ikana.small .g { font-size: 30px; } }
/* thẻ xem trước từ vựng: hình + chữ + nghĩa */
.ikana.ivocab { width: 138px; gap: 3px; padding: 10px 6px 9px; container-type: inline-size; }
/* từ dài tự thu nhỏ để luôn nằm trên 1 dòng (--n = số chữ) */
.ivocab .w { font: 500 15px/1.3 var(--f-jp); font-size: min(17px, calc(100cqi / var(--n, 1))); color: var(--ink); white-space: nowrap; }
.ivocab small { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
@media (max-width: 520px) { .ikana.ivocab { width: calc((100% - 18px) / 3); } }
.chip-kana { display: inline-grid; place-items: center; min-width: 56px; height: 56px; padding: 0 10px; border-radius: 16px; background: var(--card); border: 2px solid var(--line); box-shadow: 0 3px 0 var(--line2); font: 600 28px var(--f-kana); }
.chip-pic { display: inline-grid; place-items: center; width: 64px; height: 64px; border-radius: 18px; background: var(--card); border: 2px solid var(--line); box-shadow: 0 3px 0 var(--line2); }
.chip-pic.big { width: 130px; height: 130px; border-radius: 30px; }
.intro-card .mochi-say { justify-content: center; text-align: left; max-width: 560px; margin: 0 auto; }
.done-note { display: inline-flex; align-items: center; gap: 12px; margin-top: 20px; padding: 10px 16px; border-radius: 16px; background: var(--sun-l); font-weight: 800; color: var(--sun-t); }

/* gojūon mini */
.gojuon { display: grid; gap: 6px; }
.gj-row { display: grid; grid-template-columns: 54px repeat(var(--cols, 5), minmax(0, 1fr)); gap: 6px; }
.gj-head span { text-align: center; font: 900 13px var(--f-body); color: var(--ink3); text-transform: uppercase; letter-spacing: 1px; }
.gj-lab { display: flex; flex-direction: column; align-items: center; justify-content: center; font: 900 14px var(--f-body); color: var(--ink2); line-height: 1.1; }
.gj-lab small { font-size: 11px; color: var(--ink3); }
.gojuon.mini { max-width: 380px; margin: 0 auto 22px; }
.gojuon.mini .gj-row { grid-template-columns: 34px repeat(5, 1fr); }
.gj-c { display: grid; place-items: center; height: 44px; border-radius: 12px; background: var(--card); border: 2px solid var(--line); color: var(--ink3); font: 600 21px var(--f-kana); }
.gj-c.on { background: var(--uc, var(--pri)); border-color: transparent; color: #fff; box-shadow: 0 3px 0 color-mix(in srgb, var(--uc, var(--pri)) 70%, #000); }
.gj-c.empty { background: transparent; border-style: dashed; }

/* learn cards */
.learn-card { padding: 24px; }
.lc-main { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; align-items: start; }
.lc-char { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.glyph {
  position: relative; display: grid; place-items: center; width: 100%; max-width: 230px; aspect-ratio: 1; border-radius: 24px; cursor: pointer;
  background: var(--card2); border: 2px solid var(--line); box-shadow: 0 4px 0 var(--line2);
  background-image: linear-gradient(90deg, transparent calc(50% - 1px), var(--line) calc(50% - 1px), var(--line) calc(50% + 1px), transparent calc(50% + 1px)),
                    linear-gradient(0deg, transparent calc(50% - 1px), var(--line) calc(50% - 1px), var(--line) calc(50% + 1px), transparent calc(50% + 1px));
}
.glyph span { font: 600 130px/1 var(--f-kana); color: var(--ink); }
.glyph.wide span { font-size: 92px; letter-spacing: -6px; }
.glyph.xwide span { font-size: 64px; letter-spacing: -4px; }
.glyph.sm { max-width: 150px; border-radius: 20px; }
.glyph.sm span { font-size: 86px; }
.lc-romaji { font: 900 34px/1 var(--f-body); color: var(--pri-t); letter-spacing: .5px; }
.lc-mean { font: 800 17px var(--f-body); text-align: center; }
.hv-badge { display: inline-block; padding: 4px 14px; border-radius: 12px; background: var(--sun-l); color: var(--sun-t); font: 900 18px var(--f-body); letter-spacing: 1px; }
.hv-badge.sm { font-size: 13px; padding: 2px 10px; }
.lc-stroke { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.mini-label { font: 800 12px var(--f-body); color: var(--ink3); text-transform: uppercase; letter-spacing: .8px; }
.lc-info { margin-top: 20px; display: flex; flex-direction: column; gap: 12px; }
.info-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 15px; }
.mnemo { display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px; border-radius: 18px; background: var(--sun-l); font-weight: 700; color: var(--ink); }
.mnemo .ic { flex: none; margin-top: -2px; }
/* mẹo nhớ có hình (mã hoá kép): hình gợi nhớ to + chữ đang học ở góc */
.mnemo.has-pic { align-items: center; gap: 14px; text-align: left; }
.mn-pic { position: relative; flex: none; display: grid; place-items: center; width: 74px; height: 74px; border-radius: 22px; background: #fff; /* luôn trắng như sticker: viền hình đậm, nền tối sẽ làm chìm */ box-shadow: var(--sh-1); }
.mn-pic .ic { margin: 0; }
.mn-k { position: absolute; right: -8px; bottom: -8px; display: grid; place-items: center; min-width: 30px; height: 30px; padding: 0 4px; border-radius: 11px; background: var(--pri); color: #fff; font-size: 19px; line-height: 1; box-shadow: 0 3px 8px -4px var(--pri); }
.mn-lab { display: block; margin-bottom: 2px; font: 800 11px var(--f-body); letter-spacing: .3px; text-transform: uppercase; color: var(--sun-t); }
.warn-note { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; border-radius: 18px; background: var(--lav-l); font-weight: 700; }
.warn-note .jp { font-size: 1.15em; }
.example { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 18px; background: var(--card2); border: 2px solid var(--line); cursor: pointer; transition: border-color .15s, transform .1s; }
.example:hover { border-color: var(--line2); }
.example:active { transform: scale(.99); }
.ex-pic { width: 46px; height: 46px; flex: none; display: grid; place-items: center; }
.ex-jp { font-size: 20px; }
.ex-kana { color: var(--ink2); font-size: 15px; }
.ex-ro { color: var(--pri-t); font-weight: 800; }
.ex-vi { color: var(--ink2); flex: 1; }
.ex-say { margin-left: auto; opacity: .6; }
.vocab-card { text-align: center; padding: 30px 24px; }
.vc-pic { display: grid; place-items: center; margin: 0 auto 10px; width: 150px; height: 150px; border-radius: 40px; background: var(--card2); border: 2px solid var(--line); }
.vc-word { font-size: 44px; cursor: pointer; line-height: 1.3; }
.vc-romaji { font: 800 18px var(--f-body); color: var(--pri-t); }
.vc-mean { font: 800 22px var(--f-head); margin: 4px 0 16px; }

/* stroke order view */
.stroke-box { display: flex; justify-content: center; gap: 8px; width: 100%; max-width: 230px; }
.stroke-box.sm { max-width: 150px; }
.sv-box { flex: 1; aspect-ratio: 1; max-width: 230px; border-radius: 22px; background: var(--card2); border: 2px solid var(--line); box-shadow: 0 4px 0 var(--line2); }
.sv-box.multi { max-width: 120px; }
.sv-box svg { width: 100%; height: 100%; }
.sv-grid rect { fill: none; stroke: none; }
.sv-grid line { stroke: var(--line); stroke-width: 1; stroke-dasharray: 3 3; }
.sv-bg path { fill: none; stroke: var(--line); stroke-width: 3.4; stroke-linecap: round; stroke-linejoin: round; }
.sv-fg path { fill: none; stroke: var(--ink); stroke-width: 3.6; stroke-linecap: round; stroke-linejoin: round; }
.sv-fg path.cur { stroke: var(--pri); }
.sv-num text { font: 800 8px var(--f-body); fill: var(--pri-t); opacity: 0; transition: opacity .2s; }
.sv-num text.on { opacity: .9; }
.sv-loading { font: 600 62px var(--f-kana); fill: var(--ink3); }
.sv-loading.fallback { fill: var(--ink); }

/* quiz */
.quiz { text-align: center; }
.quiz-ask { font: 800 23px/1.25 var(--f-head); margin-bottom: 18px; text-align: left; }
.quiz-prompt { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; min-height: 150px; margin-bottom: 22px; }
.q-big { font: 600 112px/1.1 var(--f-kana); }
.q-word { font-size: 46px; line-height: 1.3; }
.q-sub { color: var(--ink2); font-weight: 800; font-size: 17px; }
.q-mean { font: 800 30px var(--f-head); }
.q-text { font: 800 20px/1.4 var(--f-body); max-width: 560px; }
.romaji-big { font: 900 64px/1.1 var(--f-body); color: var(--pri-t); }
.listen-btn { width: 120px; height: 120px; border-radius: 32px; border: 0; background: var(--sky); box-shadow: 0 6px 0 var(--sky-d); display: grid; place-items: center; cursor: pointer; transition: transform .08s; }
.listen-btn .ic .o { stroke: #fff; }
.listen-btn:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--sky-d); }
.listen-row { display: flex; gap: 14px; align-items: flex-end; justify-content: center; }
.listen-slow { width: 70px; height: 70px; border-radius: 22px; background: var(--sky-l); box-shadow: 0 5px 0 color-mix(in srgb, var(--sky) 40%, var(--line2)); }
.quiz-opts { display: grid; grid-template-columns: 1fr; gap: 12px; }
.quiz-opts.four { grid-template-columns: 1fr 1fr; }
.opt {
  position: relative; display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 64px; padding: 12px 44px; border-radius: 18px; cursor: pointer;
  background: var(--card); border: 2px solid var(--line); box-shadow: 0 4px 0 var(--line2); font: 800 19px var(--f-body); color: var(--ink);
  transition: transform .08s, box-shadow .08s, background .15s, border-color .15s;
}
.opt kbd { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); }
.opt:hover:not(:disabled) { background: var(--card2); border-color: var(--line2); }
.opt:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--line2); }
.opt:disabled { cursor: default; }
.opt.ok { background: var(--mint-l); border-color: var(--mint); color: var(--mint-t); box-shadow: 0 4px 0 var(--mint); }
.opt.bad { background: var(--red-l); border-color: var(--red); color: var(--red-t); box-shadow: 0 4px 0 var(--red); }
.opt.ok kbd, .opt.bad kbd { border-color: currentColor; color: currentColor; }
.opt-jp { font-size: 34px; font-weight: 600; font-family: var(--f-kana); }
.opt-pic { display: inline-grid; }
.retry-tag, .streak-tag { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; font: 800 13px var(--f-body); margin-bottom: 12px; }
.retry-tag { background: var(--sun-l); color: var(--sun-t); }
.streak-tag { background: var(--coral-l); color: var(--coral-d); }
.type-answer { max-width: 440px; margin: 0 auto; }
.type-answer .input { text-align: center; font-size: 26px; font-weight: 900; min-height: 64px; letter-spacing: 1px; }
.type-answer .preview-kana { min-height: 34px; margin-top: 10px; font-size: 24px; color: var(--ink2); }
/* pairs */
.pairs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; max-width: 520px; margin: 0 auto; }
.pairs .opt { min-height: 66px; padding: 10px; }
.pairs .opt.sel { background: var(--sky-l); border-color: var(--sky); box-shadow: 0 4px 0 var(--sky); color: var(--sky-t); }
.pairs .opt.done { opacity: .35; background: var(--mint-l); border-color: var(--mint); box-shadow: none; transform: none; }
.pairs .opt.err { animation: shake .4s; background: var(--red-l); border-color: var(--red); }
/* write in lesson */
.write-step { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.write-step .ws-head { display: flex; align-items: center; gap: 12px; justify-content: center; }
.write-step .ws-target { font: 900 30px var(--f-body); color: var(--pri-t); }

/* result */
.result { text-align: center; padding-top: 24px; }
.result-mochi { position: relative; display: inline-block; margin-bottom: 4px; }
.result-mochi .hanko { position: absolute; right: -62px; top: 18px; }
.result h1 { font-size: 34px; margin-bottom: 6px; }
.result-stars { margin: 4px 0 18px; }
.result-stars .star .ic { width: 52px; height: 52px; }
.result-stars .star.on { animation: bounceIn .6s cubic-bezier(.3,1.7,.5,1) both; }
.result-stars .star:nth-child(2).on { animation-delay: .2s; } .result-stars .star:nth-child(3).on { animation-delay: .4s; }
.result-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin: 18px auto; max-width: 560px; }
.rs { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 14px 10px 12px; }
.rs b { font: 900 24px var(--f-body); }
.rs span { font: 800 12.5px var(--f-body); color: var(--ink2); }
.rs.pink { border-color: var(--pri); } .rs.sun { border-color: var(--sun); } .rs.sky { border-color: var(--sky); } .rs.mint { border-color: var(--mint); }
.big-score { font: 900 64px/1 var(--f-body); color: var(--pri-t); margin: 6px 0; }
.big-score small { font-size: 22px; color: var(--ink2); }
.new-best { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px; border-radius: 999px; background: var(--sun-l); color: var(--sun-t); font-weight: 900; }

/* =========================================================
   STROKE PAD (luyện viết chấm từng nét)
   ========================================================= */
.spad { position: relative; width: 100%; max-width: 360px; margin: 0 auto; user-select: none; -webkit-user-select: none; }
.spad-svg { width: 100%; height: auto; touch-action: none; border-radius: 26px; background: var(--card); border: 2px solid var(--line); box-shadow: 0 5px 0 var(--line2); cursor: crosshair; }
.spad .g-grid line { stroke: var(--line); stroke-width: .8; stroke-dasharray: 3 3; }
.spad .g-grid .sep { stroke-dasharray: none; stroke-width: 1.2; }
.spad .g-guide path { fill: none; stroke: color-mix(in srgb, var(--ink) 11%, var(--card)); stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; transition: opacity .3s; }
.spad .g-guide.off path { opacity: 0; }
.spad .g-done path { fill: none; stroke: var(--ink); stroke-width: 5.2; stroke-linecap: round; stroke-linejoin: round; }
.spad .g-done path.fresh { stroke: var(--mint-d); }
.spad .g-ink path { fill: none; stroke: var(--pri); stroke-width: 5.2; stroke-linecap: round; stroke-linejoin: round; }
.spad .g-ink path.miss { stroke: var(--red); animation: missFade .7s ease forwards; }
@keyframes missFade { 0% { opacity: 1; } 40% { opacity: 1; } 100% { opacity: 0; } }
.spad .g-hint path { fill: none; stroke: var(--sky); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; opacity: .75; }
.spad .g-mark circle.start { fill: var(--pri); stroke: #fff; stroke-width: 1.4; }
.spad .g-mark circle.ping { fill: none; stroke: var(--pri); stroke-width: 1.4; animation: ping 1.4s ease-out infinite; transform-box: fill-box; transform-origin: center; }
.spad .g-mark path.arrow { fill: none; stroke: var(--pri); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; opacity: .8; }
.spad .g-mark text { font: 900 6.5px var(--f-body); fill: #fff; text-anchor: middle; dominant-baseline: central; }
@keyframes ping { from { transform: scale(1); opacity: .9; } to { transform: scale(2.4); opacity: 0; } }
.spad-msg { min-height: 30px; margin-top: 12px; text-align: center; font-weight: 800; color: var(--ink2); }
.spad-msg.bad { color: var(--red-t); } .spad-msg.ok { color: var(--mint-t); }
.spad-steps { display: flex; gap: 5px; justify-content: center; margin-top: 10px; flex-wrap: wrap; }
.spad-steps i { width: 12px; height: 12px; border-radius: 50%; background: var(--line); transition: background .2s, transform .2s; }
.spad-steps i.done { background: var(--mint); } .spad-steps i.cur { background: var(--pri); transform: scale(1.3); } .spad-steps i.miss { background: var(--sun); }
.spad.complete .spad-svg { border-color: var(--mint); box-shadow: 0 5px 0 var(--mint); }
.pad-tools { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }
.pad-wrap { display: flex; justify-content: center; }
.pad-canvas { border-radius: 26px; background: var(--card); border: 2px solid var(--line); box-shadow: 0 5px 0 var(--line2); touch-action: none; cursor: crosshair; }
.score-pop { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 20px; background: var(--card2); border: 2px solid var(--line); text-align: left; }
.score-num { font: 900 30px var(--f-body); color: var(--pri-t); }
.score-num small { font-size: 15px; color: var(--ink2); }

/* =========================================================
   WRITE PAGE
   ========================================================= */
.write-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 24px; align-items: start; }
.write-main { padding: 22px; }
.write-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.write-head .wh-k { font: 600 54px/1 var(--f-kana); }
.write-head .wh-r { font: 900 22px var(--f-body); color: var(--pri-t); }
.write-head .wh-sub { color: var(--ink2); font-weight: 700; font-size: 13.5px; }
.write-grid2 { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 20px; align-items: start; }
.write-side { display: flex; flex-direction: column; gap: 10px; align-items: center; }
.write-list { padding: 16px; position: sticky; top: 22px; max-height: calc(100vh - 44px); overflow-y: auto; scrollbar-width: thin; }
.wl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); gap: 6px; }
.wl-c { position: relative; display: grid; place-items: center; height: 50px; border-radius: 13px; border: 2px solid var(--line); background: var(--card); cursor: pointer; font: 600 22px var(--f-kana); color: var(--ink); transition: transform .08s; }
.wl-c:active { transform: scale(.94); }
.wl-c.on { background: var(--pri); color: #fff; border-color: var(--pri); box-shadow: 0 3px 0 var(--pri-d); }
.wl-c.w1::after, .wl-c.w2::after, .wl-c.w3::after { content: ""; position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--sun); }
.wl-c.w3::after { background: var(--mint); }
.wl-c.small { font-size: 17px; }
.wl-head { font: 800 13px var(--f-body); color: var(--ink3); margin: 12px 2px 6px; text-transform: uppercase; letter-spacing: .6px; }
.combo-pill { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--coral-l); color: var(--coral-d); font: 900 13.5px var(--f-body); }
.write-done { text-align: center; padding: 6px 0 0; }

/* =========================================================
   CHART
   ========================================================= */
.chart-tools { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.chart-sec { padding: 20px; margin-bottom: 18px; }
.chart-h { display: flex; align-items: baseline; gap: 10px; font: 800 19px var(--f-head); margin-bottom: 14px; }
.chart-h small { font: 700 13px var(--f-body); color: var(--ink2); }
.kcell {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; min-height: 66px; padding: 6px 2px; border-radius: 16px;
  border: 2px solid var(--line); background: var(--card); box-shadow: 0 3px 0 var(--line2); cursor: pointer; transition: transform .08s, box-shadow .08s, border-color .15s;
}
.kcell:hover { border-color: var(--line2); transform: translateY(-2px); box-shadow: 0 5px 0 var(--line2); }
.kcell:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--line2); }
.kc-k { font: 600 28px/1.1 var(--f-kana); }
.kc-r { font: 800 12.5px var(--f-body); color: var(--ink2); }
.kcell.m1 { background: var(--sun-l); border-color: color-mix(in srgb, var(--sun) 45%, var(--line)); }
.kcell.m2 { background: var(--mint-l); border-color: color-mix(in srgb, var(--mint) 45%, var(--line)); }
.kcell.sel { outline: 3px solid var(--sky); outline-offset: 1px; }
.kcell.empty { background: transparent; border: 2px dashed var(--line); box-shadow: none; cursor: default; }
.hide-romaji .kc-r { visibility: hidden; }
.gojuon .kcell { min-height: 70px; }
.yoon .gj-row { grid-template-columns: 54px repeat(3, minmax(0, 1fr)); }
.kana-flow { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 6px; }
.legend { display: inline-flex; align-items: center; gap: 10px; font: 800 12.5px var(--f-body); color: var(--ink2); flex-wrap: wrap; }
.legend i { display: inline-block; width: 16px; height: 16px; border-radius: 6px; border: 2px solid var(--line); background: var(--card); margin-right: -4px; vertical-align: -3px; }
.legend i.m1 { background: var(--sun-l); } .legend i.m2 { background: var(--mint-l); }
.row-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.drill-bar { position: sticky; bottom: 16px; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 12px 14px 12px 18px; border-radius: 20px; background: var(--ink); color: var(--card); box-shadow: var(--shadow-pop); margin-top: 10px; }
.drill-bar b { font: 800 15px var(--f-body); }
.kdetail { text-align: center; }
.kd-top { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; justify-items: center; margin-bottom: 12px; }
.kd-top .glyph, .kd-top .stroke-box { max-width: 190px; }
.kd-top .glyph span { font-size: 108px; }
.kd-nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 14px; }
.confuse { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: center; }
.confuse .chip-kana { width: 50px; height: 50px; font-size: 25px; min-width: 50px; cursor: pointer; }

/* =========================================================
   GRID CARDS (games, practice modes, reading, tools)
   ========================================================= */
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.tile-card { --tc: var(--pri); position: relative; display: flex; flex-direction: column; gap: 6px; padding: 20px; text-align: left; color: var(--ink); overflow: hidden; }
.tile-card .tc-ico { width: 72px; height: 72px; display: grid; place-items: center; border-radius: 22px; background: color-mix(in srgb, var(--tc) 18%, var(--card)); margin-bottom: 6px; }
.tile-card b { font: 800 18px/1.2 var(--f-head); }
.tile-card small { font-weight: 700; color: var(--ink2); font-size: 13.5px; line-height: 1.45; }
.tile-card .tc-foot { margin-top: auto; padding-top: 8px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tile-card .tc-corner { position: absolute; top: 14px; right: 14px; }
button.tile-card { border: 2px solid var(--line); background: var(--card); cursor: pointer; font: inherit; }
.game-grid, .mode-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.game-card, .mode-card { --tc: var(--gc, var(--pri)); }
.mode-card { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; padding: 18px; text-align: left; border: 2px solid var(--line); background: var(--card); border-radius: var(--r-lg); box-shadow: 0 4px 0 var(--line2); cursor: pointer; transition: transform .15s, box-shadow .15s; }
.mode-card:hover { transform: translateY(-3px); box-shadow: 0 7px 0 var(--line2); }
.mode-card:active { transform: translateY(2px); box-shadow: 0 2px 0 var(--line2); }
.mode-card .mc-icon { width: 66px; height: 66px; display: grid; place-items: center; border-radius: 20px; background: var(--bg2); margin-bottom: 4px; }
.mode-card b { font: 800 17px var(--f-head); }
.mode-card small { color: var(--ink2); font-weight: 700; }
.gc-best { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; background: var(--sun-l); color: var(--sun-t); font: 800 12px var(--f-body); }
.hero-strip { display: flex; align-items: center; gap: 18px; padding: 20px 22px; margin-bottom: 22px; background: var(--pri-l); border-color: transparent; box-shadow: none; }
.hero-strip h2 { margin: 0 0 4px; }
.hero-strip p { margin: 0; color: var(--ink2); }

/* =========================================================
   GAMES
   ========================================================= */
.game-setup { max-width: 720px; margin: 0 auto; padding: 24px 20px 60px; }
.gs-head { --gc: var(--pri); text-align: center; padding: 26px 22px; background: color-mix(in srgb, var(--gc) 22%, var(--card)); border-color: transparent; box-shadow: 0 5px 0 color-mix(in srgb, var(--gc) 45%, var(--line2)); }
.gs-head .gs-icon { display: inline-grid; place-items: center; width: 110px; height: 110px; border-radius: 34px; background: var(--card); margin-bottom: 8px; box-shadow: 0 5px 0 rgba(0,0,0,.06); }
.gs-head h1 { margin-bottom: 4px; }
.gs-head p { margin: 0 auto; max-width: 480px; font-weight: 700; color: var(--ink2); }
.gs-note { margin-top: 14px; padding: 12px 16px; border-radius: 16px; background: var(--sky-l); color: var(--sky-t); font-weight: 700; }
.gs-best { margin: 18px 0; text-align: center; font-weight: 800; color: var(--ink2); }
.game, .practice { max-width: 760px; margin: 0 auto; padding: 20px 20px 140px; }
.game-top { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.timer-bar { flex: 1; height: 18px; border-radius: 99px; background: var(--bg2); overflow: hidden; position: relative; }
.timer-fill { position: absolute; inset: 0 auto 0 0; width: 100%; background: var(--mint); border-radius: inherit; transition: width .25s linear, background .3s; }
.timer-fill.low { background: var(--red); }
.g-score { display: inline-flex; align-items: center; gap: 6px; font: 900 17px var(--f-body); white-space: nowrap; }
.combo { min-height: 34px; text-align: center; }
.combo span, .combo-pill { display: inline-flex; align-items: center; gap: 6px; }
.gq-prompt { display: grid; place-items: center; min-height: 190px; margin-bottom: 18px; padding: 16px; }
.lives { display: inline-flex; gap: 2px; }
.lives .used { filter: grayscale(1) opacity(.35); }
.rain-area { position: relative; height: 440px; border-radius: 26px; overflow: hidden; background: linear-gradient(var(--sky-l), var(--card)); border: 2px solid var(--line); box-shadow: 0 5px 0 var(--line2); }
.rain-cloud { position: absolute; top: 0; display: grid; place-items: center; width: 74px; height: 64px; transform: translateX(-50%); }
.rain-cloud .jp { position: relative; font: 600 30px var(--f-kana); }
.rain-cloud.target { filter: drop-shadow(0 0 0 var(--pri)); }
.rain-cloud.target .jp { color: var(--pri-t); }
.rain-cloud.boom { animation: boom .5s ease forwards; }
.rain-cloud.splat { animation: splat .5s ease forwards; }
@keyframes boom { to { transform: translateX(-50%) scale(1.8); opacity: 0; } }
@keyframes splat { to { transform: translateX(-50%) scaleY(.2); opacity: 0; } }
.boom-r { position: absolute; transform: translate(-50%, -50%); font: 900 18px var(--f-body); color: var(--mint-t); pointer-events: none; animation: popIn .3s; }
.rain-ground { position: absolute; left: 0; right: 0; bottom: 0; height: 22px; background: var(--mint); opacity: .5; }
.rain-paused { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(255,255,255,.6); font: 800 20px var(--f-head); }
.rain-input { margin-top: 14px; text-align: center; font-size: 22px; font-weight: 900; }
.rain-input.err { animation: shake .4s; border-color: var(--red); }
.rain-opts { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px; }
.mem-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; perspective: 900px; }
.mem-card { position: relative; aspect-ratio: 1; border: 0; padding: 0; background: none; cursor: pointer; }
.mem-inner { position: absolute; inset: 0; transition: transform .4s cubic-bezier(.3,1.3,.5,1); transform-style: preserve-3d; }
.mem-card.flip .mem-inner, .mem-card.matched .mem-inner { transform: rotateY(180deg); }
.mem-front, .mem-back { position: absolute; inset: 0; display: grid; place-items: center; border-radius: 18px; backface-visibility: hidden; border: 2px solid var(--line); box-shadow: 0 4px 0 var(--line2); }
.mem-back { background: var(--pri); border-color: transparent; box-shadow: 0 4px 0 var(--pri-d); }
.mem-front { background: var(--card); transform: rotateY(180deg); font: 600 32px var(--f-kana); }
.mem-front small { font: 900 20px var(--f-body); }
.mem-card.matched .mem-front { background: var(--mint-l); border-color: var(--mint); }
.listen-stage { display: grid; place-items: center; gap: 14px; margin: 10px 0 22px; }
.builder { text-align: center; }
.builder-slots { display: flex; justify-content: center; gap: 8px; margin: 16px 0; flex-wrap: wrap; }
.slot { width: 58px; height: 64px; border-radius: 16px; border: 2px dashed var(--line2); display: grid; place-items: center; font: 600 30px var(--f-kana); background: var(--card2); }
.slot.filled { border-style: solid; background: var(--card); box-shadow: 0 3px 0 var(--line2); }
.tiles { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; }
.tile { width: 58px; height: 62px; border-radius: 16px; border: 2px solid var(--line); background: var(--card); box-shadow: 0 4px 0 var(--line2); font: 600 30px var(--f-kana); cursor: pointer; transition: transform .08s; }
.tile:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--line2); }
.tile.used { visibility: hidden; }
.b-pic { margin: 0 auto; display: grid; place-items: center; width: 120px; height: 120px; border-radius: 32px; background: var(--card2); border: 2px solid var(--line); }
.b-mean { font: 800 22px var(--f-head); margin-top: 8px; }
.b-hint { color: var(--ink2); font-weight: 700; }
.tf-card { padding: 28px; text-align: center; margin-bottom: 18px; }
.tf-q { display: flex; align-items: center; justify-content: center; gap: 16px; }
.tf-k { font: 600 80px/1 var(--f-kana); }
.tf-eq { font: 900 34px var(--f-body); color: var(--ink3); }
.tf-r { font: 900 46px var(--f-body); color: var(--pri-t); }
.tf-card.flash-ok { animation: flashOk .4s; } .tf-card.flash-bad { animation: shake .4s; }
@keyframes flashOk { 50% { background: var(--mint-l); } }
.tf-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.tf-btns .btn { min-height: 84px; }
.dots { display: inline-flex; gap: 4px; }

/* practice */
.chain-best { display: flex; align-items: center; justify-content: space-around; gap: 12px; padding: 16px; margin-bottom: 8px; font-weight: 800; flex-wrap: wrap; }
.chain-best > span { display: inline-flex; align-items: center; gap: 8px; }
.chain-best b { font: 900 30px var(--f-body); color: var(--lav-t); }
.chain-box { display: inline-flex; align-items: center; gap: 6px; padding: 6px 14px 6px 8px; border-radius: 16px; background: var(--lav-l); color: var(--lav-t); }
.chain-box b { font: 900 22px var(--f-body); }
.chain-box small { font-weight: 800; }
.chain-box.bump { animation: bounceIn .4s; }
.chain-box.hot { background: var(--coral-l); color: var(--coral-d); }
.chain-box.fire { background: var(--coral); color: #fff; }
.chain-meter { height: 10px; border-radius: 99px; background: var(--bg2); overflow: hidden; margin-bottom: 10px; }
.chain-fill { height: 100%; width: 0; background: var(--lav); border-radius: inherit; transition: width .3s; }
.pr-mode { margin-bottom: 14px; font-weight: 800; display: flex; align-items: center; justify-content: center; gap: 6px; }
.pr-stage { min-height: 300px; }
.write-q { text-align: center; }
.wq-target { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-bottom: 14px; }
.wq-label { font: 800 28px var(--f-head); }
.wq-label.romaji-big { font-size: 52px; }
.wq-sub { display: inline-flex; align-items: center; gap: 6px; color: var(--ink2); font-weight: 800; }
.wq-pad { display: flex; justify-content: center; }
.wq-reveal { display: flex; align-items: center; gap: 16px; padding: 14px; margin-top: 14px; text-align: left; }
.big-inline { font-size: 1.6em; }

/* review */
.flash { perspective: 1200px; max-width: 460px; margin: 0 auto; }
.flash-inner { position: relative; min-height: 330px; transition: transform .5s cubic-bezier(.3,1.3,.5,1); transform-style: preserve-3d; cursor: pointer; }
.flash.flipped .flash-inner { transform: rotateY(180deg); }
.flash-face { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 22px; backface-visibility: hidden; text-align: center; }
.flash-back { transform: rotateY(180deg); }
.flash-face .big { font: 600 96px/1.1 var(--f-kana); }
.flash-face .word { font-size: 42px; }
.grade-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 460px; margin: 18px auto 0; }
.grade-row .btn { flex-direction: column; gap: 0; min-height: 64px; }
.grade-row .btn small { font-size: 11.5px; opacity: .9; font-weight: 700; }

/* =========================================================
   READING
   ========================================================= */
.story-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.story-card { display: flex; gap: 14px; align-items: center; padding: 14px 16px; color: var(--ink); }
.story-card .sc-ico { width: 62px; height: 62px; flex: none; display: grid; place-items: center; border-radius: 18px; background: var(--bg2); }
.story-card b { display: block; font: 800 16px/1.3 var(--f-jp); }
.story-card small { color: var(--ink2); font-weight: 700; }
.story-card .sc-done { margin-left: auto; }
.lv-pill { display: inline-flex; align-items: center; padding: 1px 9px; border-radius: 999px; font: 900 11px/1.6 var(--f-body); text-transform: uppercase; letter-spacing: .5px; }
.lv-1 { background: var(--mint-l); color: var(--mint-t); } .lv-2 { background: var(--sky-l); color: var(--sky-t); } .lv-3 { background: var(--lav-l); color: var(--lav-t); }
.reader { padding: 24px; }
.reader-tools { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: center; padding: 12px 16px; border-radius: 18px; background: var(--bg2); margin-bottom: 18px; }
.rline { display: flex; gap: 12px; align-items: flex-start; padding: 12px 10px; border-radius: 16px; cursor: pointer; transition: background .15s; }
.rline:hover { background: var(--card2); }
.rline.playing { background: var(--pri-l); }
.rline .rl-num { width: 28px; height: 28px; flex: none; border-radius: 9px; background: var(--bg2); display: grid; place-items: center; font: 900 12px var(--f-body); color: var(--ink2); margin-top: 6px; }
.rline .rl-jp { font: 700 24px/1.9 var(--f-jp); }
.rline .rl-r { font-weight: 700; color: var(--pri-t); font-size: 14px; }
.rline .rl-vi { font-weight: 700; color: var(--ink2); font-size: 14.5px; }
.no-romaji .rl-r, .no-vi .rl-vi { display: none; }
.word-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; }
.word-chip { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: 14px; background: var(--card2); border: 2px solid var(--line); cursor: pointer; }
.word-chip .jp { font-size: 18px; }
.word-chip small { color: var(--ink2); font-weight: 700; }
.dlg { display: flex; flex-direction: column; gap: 12px; }
.dline { display: flex; gap: 10px; align-items: flex-end; max-width: 86%; cursor: pointer; }
.dline.B { flex-direction: row-reverse; margin-left: auto; text-align: right; }
.dline .d-av { width: 48px; height: 48px; flex: none; border-radius: 50%; background: var(--card); border: 2px solid var(--line); display: grid; place-items: center; }
.dline .d-bub { padding: 11px 15px; border-radius: 20px 20px 20px 6px; background: var(--card); border: 2px solid var(--line); box-shadow: 0 3px 0 var(--line2); }
.dline.B .d-bub { border-radius: 20px 20px 6px 20px; background: var(--pri-l); border-color: transparent; box-shadow: 0 3px 0 color-mix(in srgb, var(--pri) 30%, var(--line2)); }
.dline.playing .d-bub { outline: 3px solid var(--sky); }
.d-who { font: 800 11.5px var(--f-body); color: var(--ink3); text-transform: uppercase; letter-spacing: .5px; }
.d-jp { font: 700 20px/1.8 var(--f-jp); }
.d-r { color: var(--pri-t); font-weight: 700; font-size: 13.5px; }
.d-vi { color: var(--ink2); font-weight: 700; font-size: 14px; }
.phrase { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; cursor: pointer; }
.phrase + .phrase { border-top: 2px solid var(--line); border-radius: 0; }
.phrase .p-jp { font: 700 19px/1.8 var(--f-jp); }
.phrase .p-r { color: var(--pri-t); font-weight: 700; font-size: 13.5px; }
.phrase .p-vi { color: var(--ink2); font-weight: 700; }
.tip-box { display: flex; gap: 12px; padding: 14px 16px; border-radius: 18px; background: var(--sun-l); font-weight: 700; }

/* =========================================================
   TYPING
   ========================================================= */
.type-stage { text-align: center; padding: 26px 22px; }
.type-target .tt-pic { margin: 0 auto 6px; }
.type-target .tt-jp { font: 700 50px/1.3 var(--f-jp); letter-spacing: 2px; }
.type-target .tt-vi { font: 800 17px var(--f-body); color: var(--ink2); }
.type-target .tt-hint { font: 800 15px var(--f-body); color: var(--pri-t); min-height: 24px; }
.type-live { display: flex; justify-content: center; min-height: 52px; margin: 16px 0 6px; font: 700 36px var(--f-jp); letter-spacing: 2px; }
.type-live .tl-ok { color: var(--mint-t); }
.type-live .tl-bad { color: var(--red-t); text-decoration: underline wavy; }
.type-live .tl-pend { color: var(--ink3); font-family: var(--f-body); font-weight: 800; }
.type-live .caret { width: 3px; background: var(--pri); border-radius: 2px; margin-left: 3px; animation: blinkC 1s steps(1) infinite; }
@keyframes blinkC { 50% { opacity: 0; } }
.type-input { max-width: 420px; margin: 0 auto; }
.type-input .input { text-align: center; font-size: 22px; font-weight: 900; letter-spacing: 1px; }
.type-stats { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin-top: 16px; }
.ime-out { min-height: 70px; padding: 14px 18px; border-radius: 18px; background: var(--card2); border: 2px solid var(--line); font: 700 30px/1.5 var(--f-jp); word-break: break-all; }
.ime-out .pend { color: var(--ink3); font-family: var(--f-body); }
.key-table { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.key-table .wide { grid-column: span 2; }
.key-table div { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; border-radius: 12px; background: var(--card2); border: 2px solid var(--line); font-weight: 800; }
.key-table .jp { font-size: 19px; }
.key-table code { font: 800 13px var(--f-body); color: var(--pri-t); white-space: nowrap; }

/* =========================================================
   DICTIONARY
   ========================================================= */
.dict-search { position: relative; margin-bottom: 14px; }
.dict-search .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); }
.dict-search .input { padding-left: 52px; min-height: 56px; font-size: 17px; }
.dict-item { display: flex; align-items: center; gap: 14px; padding: 12px 14px; }
.dict-item + .dict-item { border-top: 2px solid var(--line); }
.dict-item .di-pic { width: 48px; height: 48px; flex: none; display: grid; place-items: center; border-radius: 14px; background: var(--bg2); font: 600 28px var(--f-kana); }
.dict-item .di-main { flex: 1; min-width: 0; }
.dict-item .di-jp { font: 700 20px/1.4 var(--f-jp); }
.dict-item .di-sub { color: var(--ink2); font-weight: 700; font-size: 14px; }
.dict-item .di-acts { display: flex; gap: 6px; }
.fav-btn { width: 40px; height: 40px; border-radius: 12px; border: 2px solid var(--line); background: var(--card); display: grid; place-items: center; cursor: pointer; }
.fav-btn .ic { filter: grayscale(1) opacity(.35); transition: filter .2s, transform .2s; }
.fav-btn.on .ic { filter: none; transform: scale(1.1); }
.empty-state { text-align: center; padding: 40px 16px; color: var(--ink2); font-weight: 700; }
.empty-state .mascot { margin: 0 auto 10px; }

/* =========================================================
   SHOP
   ========================================================= */
.shop-hero { display: flex; align-items: center; gap: 22px; padding: 22px; margin-bottom: 22px; }
.shop-hero .sh-stage { position: relative; width: 190px; height: 190px; flex: none; display: grid; place-items: center; border-radius: 40px; background: var(--pri-l); }
.shop-hero .sh-fish { display: inline-flex; align-items: center; gap: 8px; padding: 8px 16px; border-radius: 16px; background: var(--sky-l); font: 900 22px var(--f-body); color: var(--sky-t); }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px; }
.shop-item { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 16px 14px; text-align: center; }
.shop-item .si-pic { width: 110px; height: 110px; display: grid; place-items: center; border-radius: 30px; background: var(--card2); border: 2px solid var(--line); margin-bottom: 4px; }
.shop-item b { font: 800 15.5px var(--f-head); }
.shop-item small { color: var(--ink2); font-weight: 700; font-size: 12.5px; min-height: 36px; }
.shop-item .btn { width: 100%; margin-top: auto; }
.shop-item.owned { border-color: color-mix(in srgb, var(--mint) 40%, var(--line)); }
.shop-item.worn { border-color: var(--pri); box-shadow: 0 4px 0 var(--pri); }
.price { display: inline-flex; align-items: center; gap: 4px; font-weight: 900; }

/* =========================================================
   PRINT WORKSHEETS
   ========================================================= */
.ws-preview { background: #fff; color: #222; border-radius: 18px; padding: 24px; border: 2px solid var(--line); overflow-x: auto; }
.ws-sheet { width: 100%; max-width: 760px; margin: 0 auto; color: #222; }
.ws-title { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 2px solid #333; padding-bottom: 6px; margin-bottom: 12px; font-family: var(--f-body); }
.ws-title h2 { margin: 0; font-size: 20px; color: #222; }
.ws-title span { font-size: 12px; color: #555; font-weight: 700; }
.ws-row { display: flex; align-items: center; gap: 0; margin-bottom: 6px; break-inside: avoid; }
.ws-lab { width: 54px; flex: none; text-align: center; font: 800 12px var(--f-body); color: #555; }
.ws-box { position: relative; width: 62px; height: 62px; flex: none; border: 1px solid #999; margin-left: -1px; display: grid; place-items: center; }
.ws-box::before, .ws-box::after { content: ""; position: absolute; background: none; }
.ws-box::before { left: 50%; top: 0; bottom: 0; border-left: 1px dashed #ccc; }
.ws-box::after { top: 50%; left: 0; right: 0; border-top: 1px dashed #ccc; }
.ws-box span { position: relative; z-index: 1; font: 400 46px/1 var(--f-kana); }
.ws-box.model span { color: #222; }
.ws-box.trace span { color: #d6d6d6; }
.ws-box.trace2 span { color: #ececec; }
.ws-foot { margin-top: 10px; font: 700 11px var(--f-body); color: #888; text-align: right; }
@media print {
  @page { size: A4; margin: 12mm; }
  body { background: #fff !important; }
  .side, .mtop, .bottombar, #toast-root, .no-print { display: none !important; }
  .view { margin: 0 !important; padding: 0 !important; }
  .ws-preview { border: 0; padding: 0; border-radius: 0; }
  .print-only-wrap .card { border: 0; box-shadow: none; padding: 0; }
}

/* =========================================================
   PROFILE
   ========================================================= */
.prof-hero { display: flex; align-items: center; gap: 22px; padding: 24px; margin-bottom: 18px; }
.prof-hero .ph-ava { width: 140px; height: 140px; flex: none; display: grid; place-items: center; border-radius: 40px; background: var(--pri-l); }
.prof-hero h1 { margin: 0; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.stat-box { display: flex; align-items: center; gap: 12px; padding: 14px; }
.stat-box b { display: block; font: 900 21px/1.1 var(--f-body); }
.stat-box span { font: 800 12px var(--f-body); color: var(--ink2); }
.heat { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); gap: 4px; overflow-x: auto; padding-bottom: 4px; }
.heat i { width: 15px; height: 15px; border-radius: 5px; background: var(--bg2); }
.heat i.h1 { background: color-mix(in srgb, var(--pri) 30%, var(--card)); } .heat i.h2 { background: color-mix(in srgb, var(--pri) 55%, var(--card)); }
.heat i.h3 { background: color-mix(in srgb, var(--pri) 80%, var(--card)); } .heat i.h4 { background: var(--pri-d); }
.heat i.fz { background: var(--sky-l); box-shadow: inset 0 0 0 2px var(--sky); }
.badge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 10px; }
.badge { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 8px; border-radius: 18px; text-align: center; background: var(--card2); border: 2px solid var(--line); }
.badge b { font: 800 13px/1.25 var(--f-body); }
.badge small { font: 700 11px/1.35 var(--f-body); color: var(--ink2); }
.badge.locked .ic { filter: grayscale(1) opacity(.3); }
.badge.locked b { color: var(--ink3); }
.badge.got { border-color: color-mix(in srgb, var(--sun) 55%, var(--line)); background: var(--sun-l); }
.set-row { display: flex; align-items: center; gap: 14px; padding: 14px 0; flex-wrap: wrap; }
.set-row + .set-row { border-top: 2px solid var(--line); }
.set-row .sr-l { flex: 1; min-width: 200px; }
.set-row .sr-l b { display: block; font-weight: 800; }
.set-row .sr-l small { color: var(--ink2); font-weight: 700; }
/* ô chọn giao diện: mỗi thẻ có ô xem trước mang đúng data-theme của giao diện đó nên tự hiện đúng màu */
.set-row.set-stack { display: block; }
.set-stack > * + * { margin-top: 10px; }
.set-stack > .th-group { margin-top: 16px; }
.set-stack > .th-group + .theme-grid { margin-top: 8px; }
.th-group { margin-top: 2px; font: 800 12px var(--f-body); text-transform: uppercase; letter-spacing: .6px; color: var(--ink3); }
.theme-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 10px; }
.theme-card { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 6px 6px 8px; border-radius: 18px; border: 2px solid var(--line); background: var(--card); text-align: left; cursor: pointer; transition: transform .25s var(--spring), border-color .2s, box-shadow .2s; }
.theme-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--pri) 45%, var(--line)); }
.theme-card:active { transform: scale(.96); }
.theme-card.active { border-color: var(--pri); box-shadow: 0 0 0 3px var(--pri-l); }
.tc-prev { position: relative; display: block; height: 62px; border-radius: 13px; overflow: hidden; background: var(--bg); border: 1px solid var(--line); }
.tc-prev i { position: absolute; display: block; }
.tp-top { left: 0; right: 0; top: 0; height: 13px; background: var(--pri-l); }
.tp-card { left: 8px; right: 32%; top: 19px; bottom: 8px; border-radius: 8px; background: var(--card); box-shadow: 0 2px 0 var(--line2); }
.tp-dot { left: 6px; top: 7px; width: 13px; height: 13px; border-radius: 50%; background: var(--pri); }
.tp-ln { left: 24px; right: 8px; top: 8px; height: 4px; border-radius: 4px; background: var(--ink); opacity: .78; }
.tp-ln.s { top: 16px; right: 20px; background: var(--ink3); opacity: 1; }
.tp-btn { right: 8px; bottom: 9px; width: 21%; height: 13px; border-radius: 999px; background: var(--pri); box-shadow: 0 2px 0 var(--pri-d); }
.tc-name { display: flex; align-items: baseline; justify-content: space-between; gap: 4px; padding: 0 4px; }
.set-row .tc-name b { display: block; font: 800 12.5px/1.2 var(--f-body); color: var(--ink); }
.tc-name small { flex: none; font-size: 11.5px; color: var(--ink3); }
.tc-ok { position: absolute; right: 10px; top: 10px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--pri); color: #fff; box-shadow: 0 0 0 2px var(--card); animation: optIn .35s var(--spring) both; }
.tc-ok .ic { width: 14px; height: 14px; }
@media (max-width: 520px) { .theme-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; } .tc-prev { height: 54px; } .tc-name { flex-direction: column; gap: 0; } }
.weak-list { display: flex; flex-wrap: wrap; gap: 8px; }
.weak-list .chip-kana { width: auto; min-width: 54px; height: 54px; font-size: 24px; cursor: pointer; flex-direction: column; gap: 0; }
.weak-list .chip-kana small { font: 800 10px var(--f-body); color: var(--red-t); }
.name-widget label { display: block; font-weight: 800; margin-bottom: 8px; }
.name-card { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 18px; margin-top: 14px; border-radius: 20px; background: var(--pri-l); text-align: center; }
.name-kata { font: 700 40px var(--f-jp); color: var(--pri-t); }

/* =========================================================
   ONBOARDING (intro)
   ========================================================= */
/* màn giới thiệu lần đầu: nền có đốm màu dịu theo chủ đề, máy tính thì gom thành một thẻ giữa màn */
.intro { position: fixed; inset: 0; z-index: 250; display: flex; flex-direction: column; overflow-y: auto; overflow-x: hidden;
  background: radial-gradient(60% 42% at 8% 4%, var(--pri-l), transparent 70%), radial-gradient(46% 34% at 96% 18%, var(--sun-l), transparent 70%), radial-gradient(56% 40% at 92% 100%, var(--sky-l), transparent 70%), var(--bg);
  animation: wlFade .35s ease both; }
.intro-shell { flex: 1; display: flex; flex-direction: column; width: 100%; }
.intro-top { display: flex; align-items: center; gap: 14px; max-width: 760px; width: 100%; margin: 0 auto; padding: 22px 20px 0; }
.intro-dots { display: flex; gap: 6px; flex: 1; }
.intro-dots i { flex: 1; height: 8px; border-radius: 6px; background: var(--line); transition: background .3s, flex-grow .45s var(--spring); }
.intro-dots i.on { background: var(--pri); }
.intro-dots i.cur { flex-grow: 2.4; }
.intro-body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; max-width: 640px; width: 100%; margin: 0 auto; padding: 20px; }
.intro-body h1 { font-size: 34px; margin: 14px 0 8px; }
.intro-body p { font-size: 16.5px; color: var(--ink2); font-weight: 700; max-width: 520px; }
.intro-foot { max-width: 640px; width: 100%; margin: 0 auto; padding: 16px 20px calc(24px + env(safe-area-inset-bottom)); display: flex; gap: 12px; }
.intro-foot .btn-cat { margin-top: 12px; }
/* chuyển trang: tới thì trượt từ phải, lùi thì trượt từ trái; các thẻ con bật lên lần lượt */
.intro-body.in-first { animation: inFirst .55s cubic-bezier(.2, .8, .2, 1) both; }
.intro-body.in-next { animation: inNext .45s cubic-bezier(.2, .8, .2, 1) both; }
.intro-body.in-back { animation: inBack .45s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes inFirst { from { opacity: 0; transform: translateY(18px) scale(.97); } }
@keyframes inNext { from { opacity: 0; transform: translateX(56px); } }
@keyframes inBack { from { opacity: 0; transform: translateX(-56px); } }
.intro-body h1, .intro-body > p { animation: inStag .5s cubic-bezier(.2, .8, .2, 1) both .06s; }
.scripts3 > *, .feat-list > *, .goal-opts > * { animation: inStag .5s var(--spring) both; animation-delay: calc(.14s + var(--i, 0) * .05s); }
@keyframes inStag { from { opacity: 0; transform: translateY(16px) scale(.94); } }
/* Mochi chào: nắng toả xoay chậm + 3 bong bóng chữ (bấm nghe) */
.in-hero { position: relative; display: grid; place-items: center; width: 230px; height: 196px; }
.in-hero > .mascot { position: relative; z-index: 1; }
.in-burst { position: absolute; left: 50%; top: 50%; width: 400px; height: 400px; margin: -200px 0 0 -200px; border-radius: 50%; pointer-events: none;
  background: repeating-conic-gradient(var(--pri-l) 0 8deg, transparent 8deg 16deg);
  -webkit-mask: radial-gradient(closest-side, #000 26%, transparent 100%); mask: radial-gradient(closest-side, #000 26%, transparent 100%);
  animation: wlBurstIn .8s ease both .15s, wlSpin 70s linear infinite; }
.in-orb { position: absolute; z-index: 2; width: 50px; height: 50px; display: grid; place-items: center; border-radius: 50%; background: var(--card); border: 2px solid var(--line); box-shadow: 0 4px 0 var(--line2); font-size: 25px; cursor: pointer;
  animation: orbPop .55s var(--spring) both, orbFloat 3.2s ease-in-out infinite; transition: scale .2s var(--spring); }
.in-orb:hover { scale: 1.12; }
.in-orb:active { scale: .92; }
.in-orb.o1 { left: -4px; top: 30px; color: var(--pri-t); animation-delay: .35s, 1s; }
.in-orb.o2 { right: -6px; top: 8px; color: var(--sky-t); animation-delay: .47s, 1.5s; }
.in-orb.o3 { right: 2px; bottom: 14px; color: var(--sun-t); animation-delay: .59s, 2s; }
@keyframes orbPop { from { opacity: 0; transform: scale(.3) rotate(-20deg); } }
@keyframes orbFloat { 50% { translate: 0 -7px; } }
@media (min-width: 760px) and (min-height: 620px) {
  .intro { padding: 28px 20px; }
  .intro-shell { flex: 0 0 auto; margin: auto; max-width: 700px; background: var(--card); border: 2px solid var(--line); border-radius: 34px; box-shadow: var(--shadow-pop); animation: inFirst .5s cubic-bezier(.2, .8, .2, 1) both; }
  .intro-body { flex: 0 0 auto; min-height: 430px; padding-bottom: 6px; }
  .intro-foot { padding-bottom: 26px; }
}
html[data-motion="reduce"] .intro *, html[data-motion="reduce"] .intro { animation-duration: .01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; }
.scripts3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; width: 100%; margin-top: 14px; }
.script-card { padding: 16px 10px; text-align: center; }
.script-card .sc-k { font: 600 50px/1.1 var(--f-kana); }
.script-card b { display: block; font: 800 16px var(--f-head); margin-top: 6px; }
.script-card small { color: var(--ink2); font-weight: 700; font-size: 12.5px; }
.goal-opts { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; margin-top: 10px; }
.goal-opt { display: flex; align-items: center; gap: 12px; padding: 12px 14px; text-align: left; border-radius: 18px; border: 2px solid var(--line); background: var(--card); box-shadow: 0 3px 0 var(--line2); cursor: pointer; font: inherit; color: var(--ink); }
.goal-opt b { display: block; font-weight: 800; }
.goal-opt small { color: var(--ink2); font-weight: 700; }
.goal-opt.active { border-color: var(--pri); background: var(--pri-l); box-shadow: 0 3px 0 var(--pri); }
.feat-list { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; margin-top: 12px; text-align: left; }
.feat-list div { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 16px; background: var(--card); border: 2px solid var(--line); font-weight: 800; font-size: 14px; }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 1240px) {
  :root { --rail-w: 300px; }
}
@media (max-width: 1140px) {
  :root { --side-w: 92px; }
  .side { padding: 16px 10px; align-items: center; }
  .side .brand-name, .side-nav a span, .side-me .sm-txt { display: none; }
  .side .brand { padding: 4px 0 14px; }
  .side-nav a { justify-content: center; padding: 8px; width: 60px; }
  .side-nav a .dot-num { position: absolute; top: 2px; right: 0; margin: 0; min-width: 19px; height: 19px; line-height: 19px; font-size: 10.5px; }
  .side-me { padding: 6px; }
}
@media (max-width: 1020px) {
  .with-rail { grid-template-columns: minmax(0, 1fr); max-width: 720px; }
  .rail { display: none; }
  .rail-mobile { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
  .write-layout { grid-template-columns: minmax(0, 1fr); }
  .write-list { position: static; max-height: none; }
}
@media (max-width: 760px) {
  body { font-size: 15px; }
  .side { display: none; }
  .view { margin-left: 0; padding: 16px 14px calc(96px + env(safe-area-inset-bottom)); }
  .mtop { display: flex; position: sticky; top: 0; z-index: 40; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 14px; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 2px solid var(--line); }
  .mtop .brand { padding: 0; gap: 8px; }
  .mtop .brand-logo { width: 34px; height: 34px; }
  .mtop .brand-name { font-size: 19px; }
  .mtop-stats { display: flex; gap: 6px; }
  .mtop-stats .chip { min-height: 34px; padding: 3px 9px 3px 5px; font-size: 14px; border-radius: 12px; }
  .bottombar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); background: var(--card); border-top: 2px solid var(--line); }
  .bottombar a, .bottombar button { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 4px 2px; border: 0; background: none; color: var(--ink3); font: 800 10.5px var(--f-body); cursor: pointer; }
  .bottombar .bb-ico { display: grid; place-items: center; width: 46px; height: 34px; border-radius: 12px; transition: background .2s; }
  .bottombar .active { color: var(--pri-t); }
  .bottombar .active .bb-ico { background: var(--pri-l); }
  .bottombar .dot-num { position: absolute; top: 0; right: calc(50% - 26px); margin: 0; min-width: 18px; height: 18px; line-height: 18px; font-size: 10px; }
  h1 { font-size: 25px; }
  .page-head { gap: 12px; margin-bottom: 16px; }
  .page-head .ph-icon { width: 60px; height: 60px; border-radius: 18px; }
  .page-head .ph-icon .ic { width: 42px; height: 42px; }
  .hello { padding: 14px; gap: 10px; flex-wrap: wrap; }
  .hello h1 { font-size: 20px; }
  .hello-cta { width: 100%; margin: 0; }
  .unit-banner { padding: 15px 16px; gap: 12px; }
  .ub-title { font-size: 19px; }
  .ub-icon { display: none; }
  .ub-guide span { display: none; }
  .ub-guide { width: 48px; padding: 0; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .lc-main { grid-template-columns: 1fr 1fr; gap: 12px; }
  .learn-card { padding: 16px; }
  .glyph span { font-size: 92px; }
  .q-big { font-size: 92px; }
  .quiz-ask { font-size: 20px; }
  .opt { min-height: 58px; font-size: 17px; padding: 10px 36px; }
  .opt-jp { font-size: 28px; }
  .lesson-top { padding: 14px 14px 6px; gap: 10px; }
  .lesson-body { padding: 12px 16px 170px; }
  .foot-in { padding: 14px 16px calc(14px + env(safe-area-inset-bottom)); flex-wrap: wrap; }
  .lesson-foot .btn { min-width: 0; flex: 1 1 100%; }
  .fb-badge { width: 46px; height: 46px; }
  .fb-title { font-size: 18px; }
  .result-mochi .hanko { right: -40px; width: 58px; height: 58px; }
  .write-grid2 { grid-template-columns: minmax(0, 1fr); }
  .write-side { flex-direction: row; justify-content: center; }
  .write-side .stroke-box { max-width: 120px; }
  .write-main { padding: 16px; }
  .shop-hero, .prof-hero { flex-direction: column; text-align: center; }
  .scripts3 { gap: 8px; } .script-card .sc-k { font-size: 38px; }
  .goal-opts, .feat-list { grid-template-columns: 1fr; }
  .rain-area { height: 360px; }
  .rain-opts { grid-template-columns: repeat(2, 1fr); }
  .gj-row { grid-template-columns: 34px repeat(var(--cols, 5), minmax(0, 1fr)); gap: 4px; }
  .gojuon { gap: 4px; }
  .gojuon .kcell { min-height: 58px; border-radius: 12px; padding: 4px 0; }
  .kc-k { font-size: 23px; }
  .kc-r { font-size: 11px; }
  .yoon .gj-row { grid-template-columns: 34px repeat(3, minmax(0, 1fr)); }
  .chart-sec { padding: 14px 10px; }
  .gj-lab small { display: none; }
  .tf-k { font-size: 64px; }
  .modal { padding: 22px 18px; }
  .dline { max-width: 96%; }
  .rline .rl-jp { font-size: 21px; }
}
@media (max-width: 420px) {
  .quiz-opts.four { gap: 8px; }
  .pn-label { max-width: 120px; }
  .mtop .brand-name { display: none; }
  .mem-grid { gap: 6px; }
  .kd-top .glyph span { font-size: 80px; }
}

/* ---------- bổ sung ---------- */
.container, .container-sm { max-width: 760px; margin: 0 auto; }
.container { max-width: 1060px; }
.title-hand { font-family: var(--f-head); font-weight: 800; }
.prow { position: relative; width: 100%; display: flex; justify-content: center; }
.prow.open { z-index: 25; }
.deco { position: absolute; top: 50%; left: calc(50% + var(--dx, 150px)); transform: translate(-50%, -50%); z-index: 0; pointer-events: none; }
.deco .mascot { pointer-events: auto; }
.spad .g-guide path.next { stroke: color-mix(in srgb, var(--pri) 28%, var(--card)); }
.fp-box { display: flex; justify-content: center; }
.hide-sm { }
.lesson-prog { flex: 1; }
.trace-modal .write-head { margin-bottom: 10px; }
.chip-pic .ic, .sc-ico .ic { max-width: 100%; }
code { font: 800 .92em var(--f-body); padding: 1px 6px; border-radius: 6px; background: var(--bg2); color: var(--pri-t); }
.result-stats .rs .ic { margin-bottom: 2px; }
.reader h1 ruby rt { font-size: .42em; }
.story-card b ruby rt { font-size: .55em; }
.fb-badge .ic { width: 34px; height: 34px; }
.mc-icon .ic, .tc-ico .ic { flex: none; }
.shop-item .si-pic { border: 2px solid var(--line); }
.shop-item .si-pic:hover { border-color: var(--pri); }
.pnode .pn-btn > span { line-height: 1; transform: translateY(-2px); }
@media (max-width: 760px) {
  .hide-sm { display: none !important; }
  .deco { --dx-m: 1; left: calc(50% + var(--dx, 150px) * .78); }
  .deco .ic { width: 54px; height: 54px; }
  .deco .mascot { width: 64px; height: 64px; }
  .pn-pop { width: 240px; }
}
@media (max-width: 400px) { .deco { display: none; } }
.pnode.cur { margin-top: 46px; }
.lesson-foot [data-prev] { min-width: 0; width: 64px; padding: 0; }
@media (max-width: 760px) {
  .rail-mobile .stat-row { display: none; }
  .lesson-foot [data-prev] { flex: 0 0 64px; }
  .lesson-foot .foot-in > .grow:empty { display: none; }
}
@media (max-width: 420px) {
  .mtop .brand-name { display: inline; font-size: 18px; }
  .mtop-stats .chip:last-child { display: none; }
}
@media (max-width: 760px) { .lesson-foot [data-next] { flex: 1 1 0; } }
.side { scrollbar-width: none; }
.side::-webkit-scrollbar { display: none; }
@media (max-height: 900px) and (min-width: 761px) {
  .side { padding-top: 12px; }
  .brand { padding-bottom: 8px; }
  .side-nav { gap: 1px; }
  .side-nav a { min-height: 42px; padding: 5px 12px; }
  .side-nav .ic { width: 28px; height: 28px; }
  .side-nav .nav-sep { margin: 5px 10px; }
  .side-foot { padding-top: 8px; }
  .side-me { padding: 6px 10px; }
  .side-me .mascot { width: 38px; height: 38px; }
}
[data-dark] .ic, [data-dark] .mascot { filter: drop-shadow(0 0 .7px rgba(255,255,255,.85)) drop-shadow(0 0 .7px rgba(255,255,255,.6)); }
[data-dark] .star:not(.on) { filter: grayscale(1) opacity(.35); }

/* =========================================================
   Nút bấm tinh chỉnh + icon nét mảnh
   ========================================================= */
.gl { display: inline-block; flex: none; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; overflow: visible; }
.gl .f { fill: currentColor; stroke-width: 1.4; }
.mascot { display: inline-block; vertical-align: middle; }
.btn {
  border-radius: 999px; padding: 10px 22px; gap: 9px;
  box-shadow: 0 3px 0 var(--bd), 0 10px 18px -12px var(--bd);
  transition: transform .1s, box-shadow .1s, filter .15s, background .15s;
}
.btn:hover { filter: brightness(1.04); transform: translateY(-1px); box-shadow: 0 4px 0 var(--bd), 0 12px 20px -12px var(--bd); }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--bd); }
.btn-lg { border-radius: 999px; padding: 12px 30px; }
.btn-sm { border-radius: 999px; padding: 6px 15px; box-shadow: 0 2px 0 var(--bd); }
.btn-sm:hover { box-shadow: 0 3px 0 var(--bd); }
.btn-sm:active { transform: translateY(1px); box-shadow: 0 1px 0 var(--bd); }
.btn .gl { stroke-width: 2.6; }
.btn-white, .btn-paper { --bd: var(--line2); border: 2px solid var(--line); color: var(--ink); }
.btn-white .gl, .btn-paper .gl { color: var(--pri-t); }
.btn-ghost, .btn-ghost:hover { box-shadow: none; transform: none; }
.btn[disabled], .btn.disabled { box-shadow: none; transform: none; opacity: .75; }
.btn-round { width: 48px; height: 48px; min-height: 48px; padding: 0; }
.btn-yel { --bd: #d69600; }
.ub-guide { border-radius: 999px; }
.modal-x { width: 38px; height: 38px; border-radius: 50%; background: transparent; color: var(--ink3); transition: background .15s, color .15s; }
.modal-x:hover { background: var(--bg2); color: var(--ink); }
.lesson-x { color: var(--ink3); opacity: 1; border-radius: 50%; }
.lesson-x:hover { color: var(--ink); }
.icon-btn { color: var(--ink2); border-radius: 50%; }
.say-btn { color: var(--pri-t); border-radius: 50%; }
.ex-say { color: var(--ink3); opacity: 1; }
.chip-btn { border-radius: 999px; }
.seg { border-radius: 999px; }
.seg button { border-radius: 999px; }
.lesson-foot [data-prev] { border-radius: 50%; width: 56px; height: 56px; min-height: 56px; }
@media (max-width: 760px) { .lesson-foot [data-prev] { flex: 0 0 56px; } }
.modal .center > .mascot, .modal-body > .center > .mascot { margin: 0 auto; }
.pn-pop .btn { border-radius: 999px; }
.drill-bar { border-radius: 999px; padding-left: 24px; }
.levelup { text-align: center; }
.lu-top { position: relative; margin: -26px -26px 14px; padding: 26px 20px 10px; border-radius: 26px 26px 0 0; background: var(--pri-l);
  background-image: radial-gradient(circle at 20% 30%, rgba(255,255,255,.7) 0 4px, transparent 5px), radial-gradient(circle at 82% 22%, rgba(255,255,255,.7) 0 3px, transparent 4px), radial-gradient(circle at 70% 75%, rgba(255,255,255,.6) 0 5px, transparent 6px); }
.lu-badge { position: absolute; right: calc(50% - 98px); bottom: 14px; width: 64px; height: 64px; border-radius: 50%; display: grid; place-items: center; background: var(--card); box-shadow: 0 4px 0 var(--line2); }
.lu-kicker { font: 900 13px var(--f-body); color: var(--pri-t); text-transform: uppercase; letter-spacing: 1.5px; }
.levelup h2 { font-size: 26px; margin: 4px 0 6px; }
.levelup p { color: var(--ink2); font-weight: 700; }
.lu-gift { display: inline-flex; align-items: center; gap: 6px; padding: 6px 16px; border-radius: 999px; background: var(--sky-l); color: var(--sky-t); font: 900 20px var(--f-body); margin-bottom: 16px; }
@media (max-width: 760px) { .lu-top { margin: -22px -18px 14px; } }

/* ---------- sửa bố cục điện thoại ---------- */
/* Mèo Mochi đi dạo không đứng đè lên khung tập viết */
body[data-route="write"] .pet, body[data-route="write"] .pet-shadow { opacity: 0 !important; pointer-events: none !important; transition: opacity .3s; }
@media (max-width: 760px) {
  /* thẻ trượt vào / dấu đóng thẻ ghi nhớ không làm trang lắc ngang */
  .view { overflow-x: clip; }
  /* dải "Muốn luyện không ngừng?" không bị bóp thành cột chữ */
  .hero-strip { flex-wrap: wrap; gap: 10px 14px; padding: 16px; }
  .hero-strip > .mascot { width: 64px; height: 64px; flex: none; }
  .hero-strip > .grow { flex: 1 1 0; min-width: 0; }
  .hero-strip h2 { font-size: 19px; }
  .hero-strip > .btn { flex: 1 1 100%; justify-content: center; }
  /* tab không xuống dòng giữa chữ */
  .seg button { white-space: nowrap; padding: 8px 11px; }
  /* sổ từ: chừa chỗ cho chữ Nhật */
  .dict-item { gap: 10px; padding: 12px 10px; }
  .dict-item .di-pic { width: 42px; height: 42px; }
  .dict-item .di-acts { gap: 4px; }
  .dict-item .di-acts .say-btn, .dict-item .di-acts .fav-btn { width: 36px; height: 36px; }
  .dict-item .di-acts .say-btn .ic, .dict-item .di-acts .say-btn .gl { width: 20px; height: 20px; }
}
@media (max-width: 420px) {
  /* tab có từ 3 mục: bỏ biểu tượng cho vừa một hàng */
  .seg:has(> button:nth-child(3)) button > svg { display: none; }
  .seg:has(> button:nth-child(3)) { max-width: 100%; }
}

/* ---------- tên trang trong chữ: "Japan" hồng như logo ---------- */
.bn { font-weight: 800; color: var(--ink); white-space: nowrap; }
.bn > b { margin-left: .04em; color: var(--pri); font-weight: inherit; }
.rail-foot .bn { color: inherit; }
.rail-foot .bn > b { color: var(--pri-t); }
/* chữ Nhật trong câu tiếng Việt không bị bẻ đôi giữa từ (お守\nり) */
.shop-item small, .badge small, .tip-card p, .ub-desc { word-break: keep-all; overflow-wrap: break-word; }

/* phần trang đã cuộn khuất (app.js gắn .anim-off): dừng hiệu ứng chạy mãi cho máy đỡ tốn sức */
.anim-off, .anim-off * { animation-play-state: paused !important; }
