/* Nǐ hǎo Bangladesh — mobile first. Tokens first, then layout, then components. */
/* Colours come from the Nǐ hǎo Bangladesh logo: its red is the brand and action colour,
   its charcoal is the text colour, and backgrounds are near-white with a faint warm tint. */
:root {
  --paper: #F7F5F5;      /* page background */
  --surface: #FFFFFF;    /* cards, word page on desktop */
  --ink: #222222;        /* logo charcoal: text, active tab */
  --ink-2: #4D4747;
  --muted: #756D6D;
  --line: #E8E1E1;
  --brand: #D32628;      /* logo red: buttons, practice grid, highlights */
  --brand-strong: #B01E21; /* red text on light red, pressed states */
  --brand-soft: #FBE4E4;
  --on-brand: #FFFFFF;
  --brand-fill: #D32628;  /* selected tabs and options: red pill, white text */
  --shadow: rgba(34, 34, 34, .28);
  --art-opacity: .18;    /* background scene: soft, kept faint enough that text over it stays readable */
  --art-filter: none;
  --evo-filter: none;    /* ancient-script drawings are black ink */
  --glass: rgba(247, 245, 245, .82);  /* sticky bars over the scene */
  --glass-surface: rgba(255, 255, 255, .72);
  --t1: #D23A2E; --t2: #C9820A; --t3: #1E8A4C; --t4: #2C5FD4; --t5: #857D7D;
  --radius-s: 8px;
  --radius-m: 14px;
  --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --f-ui: "Hind Siliguri", "Noto Sans", system-ui, sans-serif;
  --f-py: "Noto Sans", "Hind Siliguri", system-ui, sans-serif;
  --f-han: "Noto Serif SC", "Noto Serif CJK SC", "Songti SC", "SimSun", serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #171414; --surface: #211D1D; --ink: #F0EDED; --ink-2: #C7C0C0; --muted: #9C9393;
    --line: #362F2F; --brand: #EF4B47; --brand-strong: #FF7A75; --brand-soft: #3B1F1F; --on-brand: #FFFFFF; --brand-fill: #C8302E;
    --shadow: rgba(0, 0, 0, .5);
    --art-opacity: .10; --art-filter: invert(1) hue-rotate(180deg) saturate(.8); --evo-filter: invert(.92);
    --glass: rgba(23, 20, 20, .82); --glass-surface: rgba(33, 29, 29, .74);
    --t1: #F0675C; --t2: #E5A73A; --t3: #4CC17F; --t4: #6E95F2; --t5: #9C9393;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #171414; --surface: #211D1D; --ink: #F0EDED; --ink-2: #C7C0C0; --muted: #9C9393;
  --line: #362F2F; --brand: #EF4B47; --brand-strong: #FF7A75; --brand-soft: #3B1F1F; --on-brand: #FFFFFF; --brand-fill: #C8302E;
  --shadow: rgba(0, 0, 0, .5);
  --art-opacity: .10; --art-filter: invert(1) hue-rotate(180deg) saturate(.8); --evo-filter: invert(.92);
  --glass: rgba(23, 20, 20, .82); --glass-surface: rgba(33, 29, 29, .74);
  --t1: #F0675C; --t2: #E5A73A; --t3: #4CC17F; --t4: #6E95F2; --t5: #9C9393;
  color-scheme: dark;
}
:root.no-tones { --t1: var(--ink); --t2: var(--ink); --t3: var(--ink); --t4: var(--ink); --t5: var(--ink-2); }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--paper); color: var(--ink);
  font: 400 16px/1.55 var(--f-ui);
  -webkit-font-smoothing: antialiased; -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
svg { width: 22px; height: 22px; flex: none; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
/* Background scene (pagoda, plum blossom, lanterns, misty mountains), washed out */
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background: url("../images/bg-scene-sm.webp") left bottom / 100% auto no-repeat;
  opacity: var(--art-opacity); filter: var(--art-filter);
}
@media (min-width: 600px) {
  body::after { background-image: url("../images/bg-scene.webp"); background-size: cover; background-position: center bottom; }
}
.han { font-family: var(--f-han); }
.py { font-family: var(--f-py); }
.tone-1 { color: var(--t1); } .tone-2 { color: var(--t2); } .tone-3 { color: var(--t3); }
.tone-4 { color: var(--t4); } .tone-5 { color: var(--t5); }
[hidden] { display: none !important; }

/* ---------- Layout ---------- */
.shell { min-height: 100%; }
.pane { min-height: 100dvh; padding-bottom: calc(var(--nav-h) + var(--safe-b) + 16px); }
.detail-pane { display: none; }
body.show-detail .list-pane { display: none; }
body.show-detail .detail-pane { display: block; }

.brandbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 6px;
}
.brand { display: flex; align-items: center; }
.logo { height: 52px; width: auto; display: block; }
.logo-dark { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .logo-light { display: none; }
  :root:not([data-theme="light"]) .logo-dark { display: block; }
}
:root[data-theme="dark"] .logo-light { display: none; }
:root[data-theme="dark"] .logo-dark { display: block; }
.tabs { display: none; }

.searchbar {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5;
  display: flex; align-items: center; gap: 8px;
  margin: 0; padding: 10px 16px 12px; background: var(--glass);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.searchbar::before {
  content: ""; position: absolute; inset: 10px 16px 12px; border-radius: 999px;
  background: var(--surface); border: 1.5px solid var(--line); z-index: -1;
  transition: border-color .15s;
}
.searchbar:focus-within::before { border-color: var(--brand); }
.sb-icon { color: var(--muted); margin-left: 16px; }
#q {
  flex: 1; min-width: 0; height: 50px; border: 0; background: transparent; color: var(--ink);
  font: 400 17px var(--f-ui); outline: none;
}
#q::placeholder { color: var(--muted); }
#q::-webkit-search-cancel-button { display: none; }
.sb-clear { margin-right: 8px; }

.list-body { padding: 0 16px; }

/* ---------- Bottom nav (phone) ---------- */
.bottom-nav {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(10px + var(--safe-b)); z-index: 20;
  display: flex; gap: 4px; padding: 6px;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--line); border-radius: 999px;
  box-shadow: 0 8px 28px -12px var(--shadow);
}
.nav-btn {
  display: flex; align-items: center; gap: 6px; height: 44px; padding: 0 14px;
  border-radius: 999px; color: var(--ink-2); font-size: 14px; font-weight: 500;
}
.nav-btn .lbl { display: none; }
.nav-btn[aria-current="page"] { background: var(--brand-fill); color: var(--on-brand); box-shadow: 0 4px 12px -6px var(--brand); }
.nav-btn:not([aria-current="page"]):hover { color: var(--brand); }
.nav-btn[aria-current="page"] .lbl { display: inline; }
body.show-detail .bottom-nav { display: none; }

/* ---------- Generic bits ---------- */
.icon-btn {
  width: 40px; height: 40px; display: grid; place-items: center; border-radius: 999px; color: var(--ink-2);
}
.icon-btn:hover { background: var(--brand-soft); color: var(--brand-strong); }
.section-h {
  display: flex; align-items: baseline; justify-content: space-between;
  margin: 22px 0 8px; font-size: 15px; font-weight: 600; color: var(--ink-2);
}
.section-h .link { font-weight: 500; color: var(--brand); font-size: 14px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--line);
  font-size: 15px; color: var(--ink);
}
.chip:hover { border-color: var(--brand); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.badge {
  display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 6px;
  font-size: 12.5px; font-weight: 500; background: var(--brand-soft); color: var(--brand-strong); white-space: nowrap;
}
.badge.red { background: var(--brand-soft); color: var(--brand); }
.badge.plain { background: transparent; border: 1px solid var(--line); color: var(--ink-2); }
.empty { color: var(--muted); padding: 28px 4px; text-align: center; line-height: 1.7; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 46px; padding: 0 20px;
  border-radius: 999px; background: var(--brand); color: var(--on-brand); font-weight: 600;
}
.btn.ghost { background: transparent; color: var(--brand); border: 1.5px solid var(--brand); }
.setting .btn { flex: none; height: 40px; padding: 0 16px; white-space: nowrap; text-decoration: none; font-size: 14.5px; }
.setting .btn svg { width: 20px; height: 20px; }
.btn[hidden] { display: none; }
/* only on very small phones: let a row's button drop under its text instead of pushing the page sideways */
@media (max-width: 359px) {
  .setting:has(> .btn) { flex-wrap: wrap; row-gap: 10px; }
  .setting:has(> .btn) > span:first-child { flex: 1 1 180px; min-width: 0; }
}
.offline-row .btn:disabled { opacity: .85; cursor: default; }
/* Facebook icon: shown when app/icons/facebook.svg exists (official file from Meta), otherwise the message icon */
.btn-fb .fb-icon { width: 20px; height: 20px; display: block; }
.btn-fb .fb-icon + svg { display: none; }

/* ---------- Result rows (Quizlet-like terms list, quiet) ---------- */
.rows { list-style: none; margin: 0; padding: 0; }
.row {
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 14px;
  padding: 12px 4px; border-bottom: 1px solid var(--line);
}
.row:last-child { border-bottom: 0; }
.row:hover .row-han { color: var(--brand); }
.row[aria-current="true"] .row-han { color: var(--brand); }
.row-han { font: 400 26px/1.15 var(--f-han); min-width: 2ch; }
.row-main { min-width: 0; }
.row-py { font: 500 14.5px/1.3 var(--f-py); }
.row-mean { color: var(--ink-2); font-size: 15px; line-height: 1.4;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-mean .en { color: var(--muted); }
.row-side { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.row-via { font-size: 12px; color: var(--muted); }
.result-meta { color: var(--muted); font-size: 13.5px; margin: 4px 4px 2px; }

/* home */
.wod {
  display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: center;
  padding: 16px; border-radius: var(--radius-m); background: var(--surface); border: 1px solid var(--line);
}
.wod-han { font: 600 44px/1 var(--f-han); color: var(--brand); }
.wod-sub { font-size: 13px; color: var(--muted); }
.wod-bn { font-size: 18px; font-weight: 500; }
.install-card {
  display: flex; gap: 12px; align-items: center; justify-content: space-between;
  padding: 14px 16px; margin-top: 16px; border-radius: var(--radius-m);
  background: var(--brand-soft); color: var(--ink);
}
.install-card p { margin: 0; font-size: 14.5px; }

/* tab bar: HSK 3.0 / HSK 2.0 */
.vtabs { display: flex; border-bottom: 1px solid var(--line); margin: 0 0 14px; }
.vtabs button {
  flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 10px 8px 12px; color: var(--muted);
}
.vtabs .vt-name { font: 600 17px/1.2 var(--f-py); }
.vtabs .vt-sub { font-size: 12.5px; }
.vtabs button:hover { color: var(--ink-2); }
.vtabs button[aria-selected="true"] { color: var(--brand); }
.vtabs button.locked { cursor: not-allowed; color: var(--muted); }
.vtabs button.locked .vt-name { opacity: .6; }
.vtabs .vt-soon {
  margin-top: 3px; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 500;
  background: var(--brand-soft); color: var(--brand-strong);
}
.vtabs button[aria-selected="true"] .vt-sub { color: var(--ink-2); }
.vtabs button[aria-selected="true"]::after {
  content: ""; position: absolute; left: 18%; right: 18%; bottom: -1px; height: 3px;
  border-radius: 3px 3px 0 0; background: var(--brand);
}
/* segmented control */
.seg { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button {
  flex: none; height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); font-size: 14.5px; color: var(--ink-2); font-weight: 500;
}
.seg button[aria-pressed="true"] { background: var(--brand-fill); color: var(--on-brand); border-color: var(--brand-fill); }
.seg.small button { height: 32px; font-size: 13.5px; }

/* settings */
.setting {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 0; border-bottom: 1px solid var(--line);
}
.setting .s-title { font-weight: 500; }
.setting .s-help { font-size: 13.5px; color: var(--muted); }
.switch { position: relative; width: 48px; height: 28px; flex: none; }
/* switches are buttons (role="switch"), so a tap anywhere on the row toggles them on every browser */
.setting-sw { width: 100%; background: none; border: 0; border-bottom: 1px solid var(--line); border-radius: 0;
  color: inherit; font: inherit; text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.setting-sw:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: background .15s; pointer-events: none; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
[aria-checked="true"] .switch span { background: var(--brand); }
[aria-checked="true"] .switch span::after { transform: translateX(20px); }
/* settings: live sample word */
.set-preview {
  position: relative; display: flex; align-items: center; gap: 14px; margin: 4px 0 6px; padding: 12px 14px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface);
}
.set-preview .sp-grid { --size: 64px; flex: none; border-width: 1.5px; }
.sp-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sp-han { font: 400 28px/1.2 var(--f-han); }
.sp-trad { color: var(--muted); font-size: 22px; }
.sp-py { font-size: 16px; font-weight: 500; }
.sp-label { position: absolute; top: 8px; right: 12px; font-size: 12px; color: var(--muted); }
.about { margin: 28px 0 8px; text-align: center; }
.about-link { background: none; border: 0; font: inherit; font-size: 13px; color: var(--muted); padding: 10px 12px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.about-link:hover { color: var(--ink); }
.about-dlg { width: min(420px, calc(100vw - 32px)); max-height: 80vh; border: 0; border-radius: 18px; padding: 20px 22px 22px; background: var(--surface); color: var(--ink); box-shadow: 0 18px 50px var(--shadow); }
.about-dlg::backdrop { background: rgba(0, 0, 0, .45); }
.about-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.about-head h2 { margin: 0; font-size: 18px; }
.about-x { width: 40px; height: 40px; border: 0; border-radius: 50%; background: transparent; color: var(--muted); font-size: 26px; line-height: 1; cursor: pointer; }
.about-x:hover { background: var(--line); color: var(--ink); }
.credits { font-size: 14px; color: var(--muted); line-height: 1.7; margin: 12px 0 6px; }
.credits-list { margin: 0; padding: 0; list-style: none; font-size: 14px; color: var(--muted); line-height: 1.6; }
.credits-list li { padding: 7px 0; border-top: 1px solid var(--line); }
.credits-list a, .credits a { color: var(--brand); text-decoration: underline; }

/* ---------- Word page ---------- */
.w-top {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 5; display: flex; align-items: center; justify-content: space-between;
  padding: 8px 8px; background: var(--glass);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.w-top .acts { display: flex; gap: 2px; }
.icon-btn.saved { color: var(--brand); }
.w-body { padding: 0 16px; max-width: 720px; margin: 0 auto; }

/* The memorable part: characters drawn inside a red 田字格 practice grid */
.grids { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin: 6px 0 4px; }
.cell { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.tzg {
  --size: min(42vw, 176px);
  position: relative; width: var(--size); height: var(--size);
  border: 2px solid var(--brand); background: var(--surface); border-radius: 4px; cursor: pointer;
}
.grids.n3 .tzg { --size: min(28vw, 128px); }
.grids.n4 .tzg { --size: min(21vw, 108px); }
.grids.n5 .tzg { --size: min(17vw, 92px); }
.tzg::before, .tzg::after {
  content: ""; position: absolute; pointer-events: none;
  background-image: linear-gradient(var(--brand) 50%, transparent 50%);
  opacity: .35;
}
.tzg::before { left: 50%; top: 0; bottom: 0; width: 1px; background-size: 1px 10px; }
.tzg::after { top: 50%; left: 0; right: 0; height: 1px; background-image: linear-gradient(90deg, var(--brand) 50%, transparent 50%); background-size: 10px 1px; }
.tzg .glyph {
  position: absolute; inset: 0; display: grid; place-items: center;
  font: 400 calc(var(--size) * .78)/1 var(--f-han); color: var(--ink);
}
.tzg .writer { position: absolute; inset: 0; }
.tzg .writer svg { width: 100%; height: 100%; display: block; }   /* override the 22px icon size */
.tzg .glyph.tone-1 { color: var(--t1); } .tzg .glyph.tone-2 { color: var(--t2); } .tzg .glyph.tone-3 { color: var(--t3); }
.tzg .glyph.tone-4 { color: var(--t4); } .tzg .glyph.tone-5 { color: var(--t5); }
.tzg.ready .glyph { visibility: hidden; }
.tzg .replay {
  position: absolute; right: 4px; bottom: 4px; width: 28px; height: 28px; border-radius: 999px;
  display: grid; place-items: center; color: var(--brand); opacity: .75;
}
.tzg .replay svg { width: 18px; height: 18px; }
.cell .py { font-size: 18px; font-weight: 500; }
.w-head-plain { font: 400 48px/1.2 var(--f-han); text-align: center; margin: 10px 0; }

.w-line {
  display: flex; align-items: center; justify-content: center; gap: 14px; margin: 14px 0 6px; flex-wrap: wrap;
}
.play {
  width: 52px; height: 52px; border-radius: 999px; display: grid; place-items: center;
  background: var(--brand); color: var(--on-brand); box-shadow: 0 6px 18px -8px var(--brand);
}
.play svg { width: 26px; height: 26px; }
.play.speaking { animation: pulse 1s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.06); } }
.w-py { font: 500 26px/1.2 var(--f-py); }
.w-trad { color: var(--muted); font-size: 14.5px; }
.w-trad .han { font-size: 20px; color: var(--ink-2); }
.badges { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 10px 0 4px; }
.badges .badge { height: 30px; padding: 0 12px; border-radius: 8px; font-size: 14.5px; }   /* word page: a bit larger than in lists */

.block { margin-top: 26px; }
/* pictograph: picture -> ancient scripts -> modern.
   Light card with a dashed border (echoes the practice grid), big artwork, labels below, arrows between. */
.picto {
  margin: 26px 0 0; padding: 16px 18px 14px;
  border: 1.5px dashed color-mix(in srgb, var(--brand) 35%, var(--line));
  border-radius: 18px; background: var(--surface); color: var(--ink);
}
.picto-title {
  display: flex; align-items: center; gap: 8px; margin: 0 0 14px;
  font-size: 13.5px; font-weight: 600; color: var(--brand-strong);
}
.picto-title::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--brand); }
.evo {
  list-style: none; margin: 0; padding: 0;
  display: flex; justify-content: center; align-items: flex-start; gap: 6px;
}
.evo-step { flex: 0 1 84px; display: flex; flex-direction: column; align-items: center; gap: 8px; min-width: 0; }
.evo-arrow {                                         /* arrow between steps, level with the artwork */
  flex: none; width: 16px; height: 10px; margin-top: 31px;
  background: var(--brand); opacity: .45;
  clip-path: polygon(0 35%, 60% 35%, 60% 0, 100% 50%, 60% 100%, 60% 65%, 0 65%);
}
.evo-art { height: 72px; display: grid; place-items: center; }
.evo-emoji { font-size: 50px; line-height: 1; }
.evo-img { width: 58px; height: 58px; object-fit: contain; filter: var(--evo-filter); }
.evo-step .han { font-size: 54px; line-height: 1; color: var(--brand); }
.evo-label { font-size: 12px; line-height: 1.25; color: var(--muted); text-align: center; }
.evo-step:last-child .evo-label { color: var(--brand-strong); font-weight: 600; }
.picto-hint {
  margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--line);
  font-size: 15px; line-height: 1.5; color: var(--ink-2); text-align: center;
}
@media (max-width: 420px) {   /* phones: smaller artwork so five steps fit */
  .picto { padding-inline: 12px; }
  .evo-art { height: 56px; }
  .evo-emoji { font-size: 38px; }
  .evo-img { width: 44px; height: 44px; }
  .evo-step .han { font-size: 42px; }
  .evo { gap: 3px; }
  .evo-arrow { width: 12px; margin-top: 23px; }
  .evo-label { font-size: 11px; }
}
  .evo-step { width: 52px; }
  .evo-art { width: 46px; height: 46px; }
  .evo-step + .evo-step::before { left: -7px; }
}
.block h2 { font-size: 15px; font-weight: 600; color: var(--ink-2); margin: 0 0 10px; }
.bn-mean { font-size: 24px; line-height: 1.5; font-weight: 500; margin: 0; }
.bn-missing {
  font-size: 14.5px; color: var(--ink-2); background: var(--surface); border: 1px dashed var(--line);
  padding: 12px 14px; border-radius: var(--radius-s);
}
.en-list { margin: 0; padding-left: 20px; }
.en-list li { margin: 4px 0; }
.en-list li::marker { color: var(--muted); }
.trad-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 16px; margin: 0; }
.trad-han { font-size: 34px; line-height: 1.2; color: var(--ink); }
.trad-note { font-size: 13.5px; color: var(--muted); }
.kv { display: flex; flex-wrap: wrap; gap: 8px; }

.ex { padding: 14px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; }
.ex:last-child { border-bottom: 0; }
.ex-zh { font: 400 21px/1.5 var(--f-han); }
.ex-zh mark { background: none; color: var(--brand); }
.ex-py { font: 400 14px/1.4 var(--f-py); color: var(--ink-2); grid-column: 1; }
.ex-bn { font-size: 16px; grid-column: 1; }
.ex-en { font-size: 14px; color: var(--muted); grid-column: 1; }
.ex .icon-btn { grid-row: 1 / span 2; grid-column: 2; align-self: start; width: 44px; height: 44px;
  color: var(--brand); background: var(--brand-soft); }
.ex .icon-btn svg { width: 24px; height: 24px; }
.ex .icon-btn:hover { background: var(--brand); color: #fff; }
.ex .icon-btn.speaking { background: var(--brand); color: #fff; }

/* characters of a multi-character word */
.cc-list { display: grid; gap: 10px; }
.cc { display: flex; align-items: center; gap: 14px; padding: 12px 14px; color: inherit; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); }
.cc:hover { border-color: var(--brand); }
.cc-han { font: 400 40px/1 var(--f-han); min-width: 1.2em; text-align: center; }
.cc-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.cc-top { font-size: 15px; }
.cc-top .py { font-weight: 600; margin-right: 4px; }
.cc-mean { color: var(--ink-2); }
.cc-facts { display: flex; flex-wrap: wrap; gap: 6px; }
.cc-fact { font-size: 13.5px; color: var(--ink-2); background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 3px 10px; }
.cc-fact b { color: var(--ink); font-weight: 600; }
.cc-fact b.han { color: var(--brand); font-weight: 400; font-size: 15px; }
.facts { display: grid; grid-template-columns: minmax(96px, 1fr) 2.4fr; gap: 8px; }
.fact-radical { display: grid; grid-template-columns: auto 1fr; column-gap: 14px; align-items: center; }
.fact-radical > b { grid-row: 1 / span 2; font-size: 34px; color: var(--brand); }
.fact-radical .kx { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; margin-top: 6px; grid-column: 2; color: var(--ink); }
.fact-radical a.kx[href]:hover .kx-form .han { color: var(--brand); }
.fact .kx-num { font-size: 14px; font-weight: 600; color: var(--ink); }
.fact .kx-form { font-size: 14px; color: var(--ink-2); }
.fact .kx-form .han { font-size: 18px; }
.fact .kx-name { flex-basis: 100%; font-size: 13px; color: var(--muted); }
.fact { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 10px 12px; }
.fact b { display: block; font-size: 20px; font-weight: 600; line-height: 1.2; }
.fact .han { font-weight: 400; }
.fact span { font-size: 13px; color: var(--muted); }

.detail-empty { display: none; }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: calc(var(--nav-h) + 24px + var(--safe-b)); transform: translate(-50%, 20px);
  background: var(--ink); color: var(--paper); padding: 10px 16px; border-radius: 10px; font-size: 14.5px;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 50; max-width: calc(100vw - 32px);
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

/* ---------- Desktop / tablet: two panes ---------- */
@media (min-width: 900px) {
  .shell { display: grid; grid-template-columns: minmax(360px, 420px) 1fr; height: 100dvh; }
  .pane { height: 100dvh; overflow-y: auto; padding-bottom: 32px; min-height: 0; }
  .list-pane { display: block !important; border-right: 1px solid var(--line); background: transparent; }
  .detail-pane { display: block !important; background: var(--glass-surface); }
  .bottom-nav { display: none !important; }
  .brandbar { flex-direction: column; align-items: stretch; gap: 12px; padding-top: 18px; }
  .tabs { display: flex; gap: 4px; }
  .tabs .nav-btn { height: 36px; padding: 0 12px; }
  .tabs .nav-btn .lbl { display: inline; }
  .tabs .nav-btn svg { width: 18px; height: 18px; }
  .w-top .back { visibility: hidden; }
  .w-top { background: transparent; backdrop-filter: none; -webkit-backdrop-filter: none; padding: 12px 16px 0; }
  .w-body { padding: 0 32px; }
  .tzg { --size: 188px; }
  .grids.n3 .tzg { --size: 150px; }
  .grids.n4 .tzg { --size: 124px; }
  .grids.n5 .tzg { --size: 100px; }
  .detail-empty {
    display: grid; place-items: center; height: 100%; text-align: center; color: var(--muted); padding: 32px;
  }
  .detail-empty .big { width: 140px; height: auto; opacity: .22; margin: 0 auto 16px; display: block; }
  .toast { bottom: 28px; }
}

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