/* =========================================================================
   Học tiếng Trung — HyperOS Monochrome UI Theme
   Tối giản đơn sắc (Đen / Trắng / Xám trung tính), bo góc squircle đặc trưng HyperOS.
   Chỉ đổi cách hiển thị — giữ nguyên mọi tên class đang dùng trong mã.
   ========================================================================= */
[hidden] { display: none !important; }
:root {
  --red: #0d0d0f;
  --red-strong: #2c2c30;
  --red-soft: rgba(20, 20, 22, .07);
  --red-tint: rgba(20, 20, 22, .035);
  --on-red: #ffffff;
  --primary: var(--red);
  --danger: #2c2c30;
  --danger-soft: rgba(20, 20, 22, .09);
  --gold: #3a3a3e;
  --green: #141416;
  --ink: #0d0d0f;
  --ink-2: #434347;
  --muted: #5c5c63;
  --line: rgba(0, 0, 0, .08);
  --line-strong: rgba(0, 0, 0, .17);
  --border: var(--line);
  --bg: #f1f1f3;
  --bg-page: #f1f1f3;
  --bg-soft: rgba(0, 0, 0, .035);
  --surface-2: #ededf0;
  --card: #ffffff;
  --card-border: transparent;
  --input-bg: #ededf0;
  --hover: #e8e8ec;
  --ok: #141416;
  --ok-soft: rgba(20, 20, 22, .07);
  --warn: #434347;
  --radius: 26px;
  --radius-sm: 14px;
  --shadow-sm: none;
  --shadow: 0 6px 20px rgba(0, 0, 0, .06);
  --shadow-lg: 0 14px 36px rgba(0, 0, 0, .10);
  --ring: 0 0 0 3px rgba(20, 20, 22, .16);
  --tabbar-h: 0px;
  --sidebar-w: 232px;
  --hanzi-font: "Noto Sans SC", "PingFang SC", "Microsoft YaHei", "Source Han Sans SC", sans-serif;
  --ui-font: "MiSans", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, Roboto, "Helvetica Neue", Arial, sans-serif;
  font-family: var(--ui-font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
@media (prefers-color-scheme: dark) {
  :root {
    --red: #f2f2f5;
    --red-strong: #ffffff;
    --on-red: #0a0a0b;
    --red-soft: rgba(255, 255, 255, .10);
    --red-tint: rgba(255, 255, 255, .05);
    --primary: var(--red);
    --danger: #d1d1d6;
    --danger-soft: rgba(255, 255, 255, .10);
    --gold: #c7c7cc;
    --green: #f2f2f5;
    --ink: #f5f5f7;
    --ink-2: #c7c7cc;
    --muted: #8e8e93;
    --line: rgba(255, 255, 255, .09);
    --line-strong: rgba(255, 255, 255, .20);
    --border: var(--line);
    --bg: #0a0a0b;
    --bg-page: linear-gradient(180deg, #0a0a0b 0%, #0e0e10 100%);
    --bg-soft: rgba(255, 255, 255, .05);
    --surface-2: #222225;
    --card: #18181a;
    --card-border: rgba(255, 255, 255, .08);
    --input-bg: #222225;
    --hover: #2a2a2e;
    --ok: #f2f2f5;
    --ok-soft: rgba(255, 255, 255, .10);
    --warn: #c7c7cc;
    --shadow-sm: none;
    --shadow: 0 8px 24px rgba(0, 0, 0, .45);
    --shadow-lg: 0 14px 36px rgba(0, 0, 0, .65);
    --ring: 0 0 0 3px rgba(255, 255, 255, .22);
  }
}
* { box-sizing: border-box; }
html { scroll-padding-top: calc(76px + env(safe-area-inset-top)); min-height: 100%; background: var(--bg-page) fixed; }
body { margin: 0; min-height: 100vh; padding-bottom: calc(28px + env(safe-area-inset-bottom)); background: transparent; }
body.mobile-only-shell { padding-bottom: calc(28px + env(safe-area-inset-bottom)); }
a { color: var(--ink); text-underline-offset: 3px; }
a:hover { color: var(--ink-2); }
::selection { background: var(--red-soft); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 10px; }

/* ---------- Khung trang: Thanh kính mờ HyperOS Monochrome ---------- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: calc(56px + env(safe-area-inset-top)); height: auto;
  padding: calc(env(safe-area-inset-top) + 8px) max(14px, env(safe-area-inset-right)) 8px max(14px, env(safe-area-inset-left));
  background: rgba(241, 241, 243, .86); -webkit-backdrop-filter: blur(24px) saturate(1.1); backdrop-filter: blur(24px) saturate(1.1);
  color: var(--ink); border-bottom: 1px solid var(--line); }
@media (prefers-color-scheme: dark) {
  .topbar { background: rgba(10, 10, 11, .82); border-bottom-color: var(--line); }
}
.topbar-left { display: flex; align-items: center; gap: 6px; min-width: 0; flex: 1; }
.brand { font-weight: 700; text-decoration: none; color: var(--ink); display: flex; gap: 9px; align-items: center; letter-spacing: -.015em; min-width: 0; flex-shrink: 1; font-size: 1rem; }
.brand:hover { color: var(--ink); }
.brand-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-mark { background: var(--red); color: var(--on-red); border-radius: 11px; width: 32px; height: 32px; flex: none;
  display: grid; place-items: center; font-family: var(--hanzi-font); font-size: 1rem; font-weight: 700; box-shadow: var(--shadow-sm); }
.topbar-actions { display: flex; align-items: center; gap: 4px; flex-wrap: nowrap; flex-shrink: 0; }
.topbar-icon-btn { appearance: none; border: 1px solid transparent; background: transparent; color: var(--ink); width: 38px; height: 38px; border-radius: 999px;
  display: inline-grid; place-items: center; cursor: pointer; text-decoration: none; padding: 0; flex: none;
  transition: background .14s ease, color .14s ease, transform .08s ease; }
.topbar-icon-btn:hover { background: var(--red-soft); color: var(--ink); }
.topbar-icon-btn:active { background: var(--hover); transform: scale(.94); }
.topbar-pill-btn { background: var(--red) !important; color: var(--on-red) !important; border-color: transparent !important; min-height: 32px !important; padding: 4px 12px !important; font-size: .8rem !important; border-radius: 999px !important; }
.topbar-badge { background: var(--surface-2) !important; color: var(--ink-2) !important; border-color: var(--line) !important; font-size: .74rem !important; padding: 3px 10px !important; }
.topbar-badge.warn { background: var(--red) !important; color: var(--on-red) !important; border-color: var(--red) !important; }

/* ---------- Chỉ báo vuốt ngang từ rìa trái / phải để trở về (không chữ) ---------- */
.edge-back-indicator { position: fixed; left: 0; top: 50%; z-index: 40; pointer-events: none;
  width: 38px; height: 46px; display: grid; place-items: center;
  border-radius: 0 999px 999px 0; background: var(--card); color: var(--ink);
  border: 1px solid var(--line-strong); border-left: 0; box-shadow: var(--shadow-lg);
  font-size: 1.5rem; font-weight: 700; line-height: 1;
  opacity: 0; transform: translate(-100%, -50%); transition: opacity .15s ease, transform .18s ease, background .15s ease, color .15s ease; }
.edge-back-indicator.from-right { left: auto; right: 0; border-radius: 999px 0 0 999px; border-left: 1px solid var(--line-strong); border-right: 0; transform: translate(100%, -50%); }
.edge-back-indicator.dragging { transition: background .12s ease, color .12s ease; }
.edge-back-indicator.ready { background: var(--red); color: var(--on-red); border-color: var(--red); }
main { max-width: 780px; margin: 0 auto; padding: 18px 16px 28px; outline: none; overflow-wrap: anywhere; }
h1 { font-size: 1.6rem; line-height: 1.22; margin: 6px 0 14px; letter-spacing: -.025em; font-weight: 750; }
h2 { font-size: 1.1rem; margin: 26px 0 10px; letter-spacing: -.015em; font-weight: 700; }
h3 { font-size: 1rem; margin: 16px 0 8px; font-weight: 650; }
p { margin: .4em 0; }
main > a:first-child { display: inline-flex; align-items: center; gap: 4px; font-size: .92rem; color: var(--muted); font-weight: 550; text-decoration: none; margin-bottom: 2px; }
main > a:first-child:hover { color: var(--ink); text-decoration: underline; }
.muted { color: var(--muted); }
.center { text-align: center; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
/* Hàng từ trong bộ thẻ: trên màn hẹp, nút xuống dòng thay vì bóp cột pinyin/nghĩa. */
.deck-word { padding-bottom: 8px; }
.deck-word > .grow { flex: 1 1 240px; }
.deck-word > .btn:first-of-type { margin-left: auto; }

/* ---------- Thẻ (card) HyperOS Squircle ---------- */
.card { background: var(--card); border: 1px solid var(--card-border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-sm); }
a.card, .menu-item, .shortcut, .hsk-tile, .journal-card { transition: transform .14s ease, box-shadow .16s ease, border-color .16s ease, background .14s ease; }
a.card:hover, .menu-item:hover, .shortcut:hover, .hsk-tile:hover, .journal-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow); transform: translateY(-1px); color: inherit; }
a.card:active { transform: scale(.99); }
.stack > * + * { margin-top: 10px; }
.grid-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.stat { position: relative; overflow: hidden; }
.stat .num { font-size: 1.9rem; font-weight: 750; letter-spacing: -.025em; line-height: 1.15; font-variant-numeric: tabular-nums; color: var(--ink); }
.stat .lbl { color: var(--muted); font-size: .86rem; margin-top: 2px; }
.stat:first-child .num { color: var(--ink); }

/* ---------- Nút (HyperOS Pill & Squircle) ---------- */
.btn { appearance: none; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); border-radius: var(--radius-sm);
  padding: 9px 16px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; display: inline-flex; gap: 6px; align-items: center;
  justify-content: center; min-height: 44px; line-height: 1.25; transition: background .12s, border-color .12s, box-shadow .12s, transform .08s; }
.btn:hover { background: var(--hover); border-color: var(--line-strong); color: var(--ink); }
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--red); color: var(--on-red); border-color: var(--red); box-shadow: 0 3px 10px rgba(0, 0, 0, .14); }
.btn.primary:hover { background: var(--red-strong); border-color: var(--red-strong); color: var(--on-red); }
.btn.danger { background: var(--card); color: var(--ink); border-color: var(--line-strong); }
.btn.danger:hover { background: var(--hover); color: var(--ink); }
.btn.small { padding: 5px 12px; min-height: 36px; font-size: .88rem; border-radius: 999px; }
.btn:disabled { opacity: .42; cursor: default; transform: none; box-shadow: none; }
.btn.primary small { color: inherit; opacity: .8; }
@media (prefers-color-scheme: dark) {
  .btn.primary { box-shadow: none; }
}

/* ---------- Biểu mẫu ---------- */
label { display: block; font-weight: 600; margin-bottom: 5px; font-size: .94rem; }
input, textarea, select { width: 100%; font: inherit; padding: 11px 14px; border-radius: var(--radius-sm); border: 1px solid transparent;
  background: var(--input-bg); color: var(--ink); min-height: 46px; transition: border-color .14s, box-shadow .14s, background .14s; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .82; }
input:hover, textarea:hover, select:hover { border-color: var(--line-strong); }
input:focus, textarea:focus, select:focus { outline: none; background: var(--card); border-color: var(--ink); box-shadow: var(--ring); }
input[type="checkbox"], input[type="radio"] { width: auto; min-height: 0; accent-color: var(--red); box-shadow: none; }
input[type="range"] { accent-color: var(--red); padding: 0; border: 0; box-shadow: none; min-height: 28px; background: transparent; }
select { cursor: pointer; }
textarea { min-height: 90px; resize: vertical; }
.field { margin-bottom: 4px; }
.field-error { color: var(--ink); font-weight: 600; font-size: .9rem; margin-top: 4px; text-decoration: underline wavy var(--muted); text-underline-offset: 3px; }
.voice-notice { width: 100%; margin: 10px 0; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius-sm); background: var(--surface-2); font-size: .9rem; }
.voice-notice > button { margin-top: 8px; }
.hint { color: var(--muted); font-size: .85rem; margin-top: 4px; }
.hanzi-input { font-family: var(--hanzi-font); font-size: 1.45rem; }

/* ---------- Danh sách từ ---------- */
.list { list-style: none; padding: 0; margin: 0; }
.list li { border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }
.list-card { padding: 0; overflow: hidden; }
.list-card > .list li, .list-card > .dict-row { border-bottom: 1px solid var(--line); }
.list-card > .list li:last-child, .list-card > .dict-row:last-child { border-bottom: 0; }
.list-card .word-row { margin: 0; padding: 12px 16px; border-radius: 0; }
.list-card .dict-row { padding-right: 14px; }
.word-row { display: flex; gap: 14px; align-items: center; padding: 10px 10px; margin: 0 -10px; border-radius: 14px; text-decoration: none; color: inherit; transition: background .12s; }
a.word-row:hover { background: var(--hover); color: inherit; }
.word-row .hz { font-family: var(--hanzi-font); font-size: 1.55rem; min-width: 3.1em; line-height: 1.2; color: var(--ink); font-weight: 550; }
.word-row .py { color: var(--ink-2); font-weight: 600; display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; }
.word-row .meaning { color: var(--muted); font-size: .94rem; margin-top: 2px; }
.word-row .chev { color: var(--muted); font-size: 1.2rem; flex: none; opacity: .7; }
.tag { display: inline-block; font-size: .74rem; font-weight: 650; padding: 2px 9px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); border: 1px solid var(--line); white-space: nowrap; }
.badge { font-size: .8rem; padding: 3px 10px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink-2); }

/* ---------- Thanh tab con (Underline kiểu HyperOS) & Bộ lọc pill cho Từ vựng ---------- */
.seg-tabs { display: flex; flex-wrap: nowrap; gap: 0; padding: 0; margin: 2px 0 16px; border-radius: 0;
  background: transparent; border: 0; border-bottom: 1.5px solid var(--line); max-width: 100%; }
.seg-tab { flex: 1; text-align: center; padding: 10px 10px 9px; border-radius: 0; text-decoration: none; color: var(--muted); font-size: .92rem; font-weight: 600;
  line-height: 1.3; border-bottom: 2.5px solid transparent; margin-bottom: -1.5px; transition: color .14s, border-color .14s; white-space: nowrap; }
.seg-tab:hover { color: var(--ink); }
.seg-tab.active { background: transparent; color: var(--ink); font-weight: 700; border-bottom-color: var(--ink); box-shadow: none; }
.vocab-toolbar { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.search-wrap { position: relative; flex: 1; min-width: 0; }
.search-wrap .search-ic { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; display: grid; place-items: center; }
.search-wrap input { padding-left: 38px; }
.pill-row { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.pill-row::-webkit-scrollbar { display: none; }
.pill-row .chip { flex: none; padding: 5px 12px; min-height: 32px; font-size: .85rem; }
.vocab-meta { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin: 0 2px 8px; font-size: .86rem; color: var(--muted); }
@media (max-width: 520px) {
  .seg-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); width: 100%; }
  .seg-tab { display: grid; place-items: center; min-height: 44px; padding: 7px 6px; font-size: .84rem; white-space: normal; }
  .list-card .word-row { padding: 11px 12px; gap: 10px; }
  .word-row .hz { font-size: 1.4rem; min-width: 2.7em; }
}

/* ---------- Trạng thái trống ---------- */
.empty { text-align: center; padding: 34px 18px; }
.empty .big { font-size: 2.2rem; font-family: var(--hanzi-font); color: var(--ink); width: 72px; height: 72px; margin: 0 auto;
  display: grid; place-items: center; border-radius: 22px; background: var(--surface-2); border: 1px solid var(--line); }
.empty h2 { margin-top: 14px; }
.empty p { max-width: 46ch; margin-left: auto; margin-right: auto; }

/* ---------- Thẻ ôn (flashcard) ---------- */
.flash { min-height: 320px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px;
  cursor: pointer; user-select: none; box-shadow: var(--shadow-lg); border-radius: 26px; border: 1px solid var(--card-border);
  background: radial-gradient(120% 90% at 50% 0%, var(--red-tint), var(--card) 65%); transition: transform .15s; }
.flash:hover { transform: translateY(-1px); }
.flash .hz { font-family: var(--hanzi-font); font-size: clamp(3.2rem, 14vw, 6rem); line-height: 1.1; font-weight: 500; }
.flash .py { font-size: 1.45rem; color: var(--ink-2); font-weight: 600; }
.flash .mn { font-size: 1.2rem; font-weight: 550; }
.rate { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.rate .btn { flex-direction: column; justify-content: center; min-height: 58px; gap: 1px; }
.rate small { color: var(--muted); font-size: .72rem; font-weight: 500; }
.progress { height: 7px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.progress > div { height: 100%; background: var(--red); border-radius: 99px; transition: width .3s ease; }

/* ---------- Thanh tab (mobile) ---------- */
.banner { padding: 10px 16px; font-size: .9rem; }
.banner.warn { background: var(--surface-2); color: var(--ink); border-bottom: 1px solid var(--line-strong); }
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: repeat(4, 1fr);
  background: rgba(246, 246, 247, .86); -webkit-backdrop-filter: saturate(1.1) blur(22px); backdrop-filter: saturate(1.1) blur(22px);
  border-top: 1px solid var(--line); box-shadow: 0 -2px 14px rgba(0, 0, 0, .04);
  padding: 7px 6px calc(6px + env(safe-area-inset-bottom)); z-index: 15; }
@media (prefers-color-scheme: dark) {
  .tabbar { background: rgba(16, 16, 18, .88); box-shadow: 0 -2px 14px rgba(0, 0, 0, .4); }
}
.tabbar.mobile-tabbar-3 { grid-template-columns: repeat(3, 1fr); }
.tabbar.mobile-tabbar-4 { grid-template-columns: repeat(4, 1fr); }
.tabbar a { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 2px 0; text-decoration: none; color: var(--muted); font-size: .73rem; font-weight: 600; transition: color .14s; }
.tabbar a .ti, .tabbar a > span:first-child { display: grid; place-items: center; width: 46px; height: 28px; border-radius: 99px; transition: background .15s, color .15s; font-family: var(--hanzi-font); font-size: 1.15rem; }
.tabbar a:hover { color: var(--ink); }
.tabbar a.active { color: var(--ink); font-weight: 700; }
.tabbar a.active .ti, .tabbar a.active > span:first-child { background: var(--red); color: var(--on-red); }
.toast { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom)); transform: translate(-50%, 8px);
  background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 999px; box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; max-width: min(92vw, 520px); z-index: 10; font-size: .92rem; font-weight: 550; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.checkbox-row { display: flex; gap: 10px; align-items: center; padding: 9px 4px; border-bottom: 1px solid var(--line); font-weight: 500; cursor: pointer; }
.checkbox-row input { width: 20px; min-height: 20px; height: 20px; flex: none; }

/* ---------- Máy tính: khung gọn căn giữa ---------- */
@media (min-width: 1000px) {
  body:not(.mobile-only-shell) .topbar { padding: 0 28px; }
  body:not(.mobile-only-shell) main { max-width: 820px; padding: 26px 28px 48px; }
  body:not(.mobile-only-shell) h1 { font-size: 1.7rem; margin-bottom: 14px; }
  body:not(.mobile-only-shell) .toast { bottom: 28px; }
  body:not(.mobile-only-shell) .sticky-actions { bottom: 0 !important; }
  body.mobile-only-shell { max-width: 480px; margin: 0 auto; border-left: 1px solid var(--line); border-right: 1px solid var(--line); min-height: 100vh; box-shadow: var(--shadow-lg); }
  body.mobile-only-shell .tabbar { max-width: 480px; margin: 0 auto; }
}

/* ---------- Âm thanh, luyện nghe/nói (Monochrome) ---------- */
.chips { margin: 4px 0 14px; gap: 6px; }
.chip { padding: 6px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); text-decoration: none; color: var(--ink-2);
  font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 5px; min-height: 34px; transition: background .12s, border-color .12s, color .12s; }
.chip:hover { background: var(--hover); border-color: var(--line-strong); color: var(--ink); }
.chip.active { background: var(--red); border-color: var(--red); color: var(--on-red); box-shadow: var(--shadow-sm); }
.chip.active:hover { background: var(--red-strong); color: var(--on-red); }
.practice-zh { font-family: var(--hanzi-font); font-size: clamp(2.5rem, 11vw, 4.2rem); line-height: 1.2; }
.practice-zh.small { font-size: 1.8rem; }
.practice-py { color: var(--ink-2); font-size: 1.25rem; font-weight: 600; }
.tone-chip { font-size: .8rem; padding: 2px 9px; border-radius: 99px; border: 1.5px solid var(--line-strong); color: var(--ink-2); }
.tone-1 { border-style: solid; border-color: var(--ink); }
.tone-2 { border-style: dashed; border-color: var(--ink-2); }
.tone-3 { border-style: dotted; border-color: var(--ink-2); }
.tone-4 { border-style: double; border-width: 3px; border-color: var(--ink); }
.audio-controls { justify-content: center; }
.audio-controls.playing { opacity: .85; }
.rec-btn { min-width: 170px; justify-content: center; }
.rec-btn.recording { background: var(--ink); color: var(--bg); animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px var(--red-soft); } }
.meter { height: 8px; }
.waveform { width: 100%; height: 40px; fill: var(--ink); opacity: .65; }
.contour-chart { width: 100%; display: block; }
.chart-grid { stroke: var(--line); stroke-width: .5; }
.chart-label { fill: var(--muted); font-size: 8px; }
.chart-expected { fill: none; stroke: var(--muted); stroke-width: 3; stroke-dasharray: 5 4; stroke-linecap: round; }
.chart-mine { fill: none; stroke: var(--ink); stroke-width: 2.6; stroke-linejoin: round; stroke-linecap: round; }
.chart-ref { fill: none; stroke: var(--ink-2); stroke-width: 2; stroke-dasharray: 2 2; opacity: .75; }
.chart-legend { font-size: .8rem; color: var(--muted); gap: 14px; }
.lg { display: inline-block; width: 18px; height: 0; margin-right: 6px; vertical-align: middle; border-top: 3px solid var(--ink); }
.lg-expected { border-top: 3px dashed var(--muted); } .lg-chart-ref { border-top: 2px dotted var(--ink-2); }
.tone-feedback { margin: 0; padding-left: 18px; }
.tone-feedback li.ok { color: var(--ink); font-weight: 600; } .tone-feedback li.bad { color: var(--muted); }
.ok-text { color: var(--ink); font-weight: 650; } .warn-text { color: var(--ink-2); font-weight: 600; }
.big-ear { font-size: 2.4rem; width: 76px; height: 76px; margin: 0 auto; display: grid; place-items: center; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line); }
.btn.option { width: 100%; justify-content: flex-start; font-size: 1.05rem; font-weight: 500; padding: 13px 18px; min-height: 54px; border-radius: 16px; text-align: left; background: var(--card); border-color: var(--line); box-shadow: var(--shadow-sm); }
.btn.option:hover:not(:disabled) { border-color: var(--ink); background: var(--surface-2); }
.btn.option[lang="zh-CN"] { font-family: var(--hanzi-font); font-size: 1.45rem; }
.btn.option.correct { border: 2px solid var(--ink); background: var(--red-soft); color: var(--ink); font-weight: 700; opacity: 1; }
.btn.option.wrong { border: 1.5px dashed var(--muted); background: var(--surface-2); color: var(--muted); opacity: .88; text-decoration: line-through; }
.simple-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.simple-table th, .simple-table td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.simple-table th { color: var(--muted); font-weight: 600; font-size: .82rem; text-transform: uppercase; letter-spacing: .03em; }

/* ---------- Menu, lối tắt, tiến độ, nhật ký, bài tập (Monochrome) ---------- */
.menu-item { text-decoration: none; color: inherit; gap: 14px; padding: 13px 16px; flex-wrap: nowrap; }
.menu-item > :last-child { color: var(--muted); font-size: 1.3rem; }
.menu-item strong { font-weight: 650; }
.menu-item .muted { font-size: .9rem; }
.menu-icon { width: 42px; height: 42px; flex: none; border-radius: 14px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink); display: grid; place-items: center; font-family: var(--hanzi-font); font-size: 1.15rem; }
.shortcuts { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 12px; }
.shortcut { text-decoration: none; color: inherit; display: flex; gap: 12px; align-items: center; font-weight: 600; padding: 14px; }
.shortcut span { font-family: var(--hanzi-font); color: var(--ink); font-size: 1.2rem; width: 38px; height: 38px; flex: none; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); display: grid; place-items: center; }
.bar-chart { width: 100%; display: block; }
.bar-good { fill: #141416; } .bar-easy { fill: #52525b; } .bar-hard { fill: #a1a1aa; } .bar-again { fill: #d4d4d8; }
.sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 4px; vertical-align: middle; }
.sw.bar-good { background: #141416; } .sw.bar-easy { background: #52525b; } .sw.bar-hard { background: #a1a1aa; } .sw.bar-again { background: #d4d4d8; border: 1px solid var(--line-strong); }
.hbar { display: grid; grid-template-columns: 140px 1fr 54px; gap: 10px; align-items: center; font-size: .9rem; padding: 2px 0; }
.hbar-track { height: 10px; background: var(--surface-2); border-radius: 99px; overflow: hidden; }
.hbar-fill { display: block; height: 100%; background: var(--ink); border-radius: 99px; }
.hbar-fill.lvl-new { background: #d4d4d8; } .hbar-fill.lvl-0 { background: #a1a1aa; } .hbar-fill.lvl-1, .hbar-fill.lvl-2 { background: #71717a; }
.hbar-fill.lvl-3, .hbar-fill.lvl-4 { background: #3f3f46; } .hbar-fill.lvl-5 { background: #141416; }
@media (prefers-color-scheme: dark) {
  .bar-good { fill: #f4f4f5; } .bar-easy { fill: #a1a1aa; } .bar-hard { fill: #52525b; } .bar-again { fill: #27272a; }
  .sw.bar-good { background: #f4f4f5; } .sw.bar-easy { background: #a1a1aa; } .sw.bar-hard { background: #52525b; } .sw.bar-again { background: #27272a; }
  .hbar-fill.lvl-new { background: #3f3f46; } .hbar-fill.lvl-0 { background: #52525b; } .hbar-fill.lvl-1, .hbar-fill.lvl-2 { background: #71717a; }
  .hbar-fill.lvl-3, .hbar-fill.lvl-4 { background: #d4d4d8; } .hbar-fill.lvl-5 { background: #ffffff; }
}
.hbar-num { text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.journal-card { text-decoration: none; color: inherit; display: block; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-line; }
.kind-grammar { background: var(--red); color: var(--on-red); } .kind-note { background: var(--surface-2); color: var(--ink-2); }
.chip.small { font-size: .85rem; padding: 2px 10px; min-height: 28px; font-family: var(--hanzi-font); }
.chip-x { border: 0; background: none; color: inherit; font-size: 1rem; cursor: pointer; padding: 0 0 0 6px; min-height: 0; }
.linklike { border: 0; background: none; color: var(--ink); padding: 8px 0; font: inherit; font-weight: 600; cursor: pointer; text-align: left; width: 100%; }
.linklike:hover { text-decoration: underline; }
details summary { cursor: pointer; color: var(--ink); padding: 6px 0; font-weight: 600; }
.quiz-prompt { font-size: 1.18rem; white-space: pre-line; line-height: 1.55; }
.quiz-prompt, .btn.option { font-family: var(--ui-font), var(--hanzi-font); }
.sticky-actions { position: sticky; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px); padding: 10px 0; margin-top: 12px; border-top: 1px solid var(--line); z-index: 4; }
pre.code { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; overflow: auto; color: var(--ink); font-size: .85rem; }
.badge.warn { background: var(--red); color: var(--on-red); border-color: var(--red); cursor: pointer; }
button.badge { font: inherit; font-size: .8rem; background: var(--surface-2); color: var(--ink-2); cursor: pointer; }

/* ---------- Từ điển ---------- */
.dict-row { border-bottom: 1px solid var(--line); gap: 6px; }
.dict-row .word-row { min-width: 0; }
.meanings { margin: 0; padding-left: 22px; } .meanings li { margin: 5px 0; }
.note-list { margin: 10px 0 0; padding-left: 18px; font-size: .9rem; }
.dict-hint { margin-top: 6px; display: grid; gap: 6px; }
.hsk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.hsk-tile { display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: inherit; padding: 13px 14px; position: relative; overflow: hidden; }
.hsk-tile::after { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--ink); opacity: .7; }
.hsk-tile strong { color: var(--ink); font-size: 1.15rem; }
.update-card { border-color: var(--line-strong); margin-bottom: 12px; background: var(--surface-2); }
.backup-reminder { border-color: var(--line-strong); background: var(--surface-2); margin-bottom: 14px; }

/* ---------- Hán–Việt, chiết tự, nét chữ ---------- */
.hv { color: var(--muted); font-size: .85em; font-style: italic; }
.hv-text { color: var(--muted); letter-spacing: .04em; font-size: .95rem; }
.hv-badge { margin: 4px 0 10px; }
.char-card .char-big { font-family: var(--hanzi-font); font-size: 3rem; line-height: 1; min-width: 1.2em; text-align: center; }
.zh-inline { font-family: var(--hanzi-font); font-size: 1.15em; }
.stroke-panel { margin-top: 8px; }
.stroke-box { position: relative; background:
  linear-gradient(to right, transparent calc(50% - .5px), var(--line) calc(50% - .5px), var(--line) calc(50% + .5px), transparent calc(50% + .5px)),
  linear-gradient(to bottom, transparent calc(50% - .5px), var(--line) calc(50% - .5px), var(--line) calc(50% + .5px), transparent calc(50% + .5px)), var(--card);
  border: 1px solid var(--line-strong); border-radius: 14px; touch-action: none; margin: 0 auto; }
.write-slot { font-family: var(--hanzi-font); font-size: 1.6rem; width: 2em; height: 2em; display: grid; place-items: center; border: 1px dashed var(--line-strong); border-radius: 12px; color: var(--muted); }
.write-slot.done { color: var(--ink); border-style: solid; border-color: var(--ink); background: var(--surface-2); font-weight: 700; }
.write-slot.now { border-color: var(--ink); color: var(--ink); background: var(--red-tint); }
.write-details summary { font-size: .9rem; }
.order-line { min-height: 60px; border: 2px dashed var(--line-strong); border-radius: 14px; padding: 8px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; background: var(--card); }
.order-bank { display: flex; flex-wrap: wrap; gap: 8px; }
.order-token { font-family: var(--hanzi-font); font-size: 1.3rem; min-width: 52px; justify-content: center; }
.order-token.placed { background: var(--red); border-color: var(--red); color: var(--on-red); }
.order-token:disabled { opacity: .28; }

/* ---------- Trang chính: HyperOS Monochrome Contrast Hero + Thẻ Squircle ---------- */
.home-hero-band { position: relative; margin: -18px -16px 0; padding: 14px 16px 68px; overflow: hidden;
  background: linear-gradient(145deg, #141416 0%, #242428 100%); color: #ffffff; text-align: center; }
.home-hero-band::after { content: ""; position: absolute; right: -22%; top: -30%; width: 72%; height: 190%;
  background: radial-gradient(ellipse at center, rgba(255,255,255,.10) 0%, rgba(255,255,255,0) 68%);
  transform: rotate(-22deg); pointer-events: none; }
.home-hero-logo { position: relative; z-index: 1; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; color: #ffffff; }
.home-hero-mark { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center;
  background: rgba(255,255,255,.14); border: 1.5px solid rgba(255,255,255,.28); font-family: var(--hanzi-font); font-size: 1.25rem; }
.home-hero-sub { position: relative; z-index: 1; margin-top: 4px; font-size: .86rem; color: rgba(255,255,255,.78); }

.home-quick-card { position: relative; z-index: 2; margin: -52px 0 16px; display: grid; grid-template-columns: repeat(2, 1fr);
  background: var(--card); border-radius: 22px; overflow: hidden; border: 1px solid var(--card-border); box-shadow: var(--shadow-lg); }
.home-quick-item { display: flex; align-items: center; gap: 11px; padding: 16px 14px; text-decoration: none; color: var(--ink);
  font-weight: 650; font-size: .95rem; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); transition: background .14s; }
.home-quick-item:nth-child(2n) { border-right: 0; }
.home-quick-item:nth-last-child(-n+2) { border-bottom: 0; }
.home-quick-item:hover { background: var(--hover); color: var(--ink); }
.home-quick-item.is-featured { background: var(--surface-2); }
.home-quick-ic { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; flex: none;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink); }
.home-quick-text { min-width: 0; }
.home-quick-text strong { display: block; font-size: .95rem; line-height: 1.25; }
.home-quick-text span { display: block; font-size: .76rem; font-weight: 500; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.home-cta-box { text-align: center; padding: 18px 16px; }
.home-cta-box .today-num { font-size: 1.25rem; font-weight: 780; color: var(--ink); letter-spacing: -.015em; }
.home-cta-box .today-sub { color: var(--muted); font-size: .88rem; margin: 4px 0 14px; }
.home-cta-box .btn.primary { width: 100%; max-width: 320px; border-radius: 14px; font-weight: 700; min-height: 46px; }
.home-cta-meter { max-width: 320px; margin: 12px auto 0; height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.home-cta-meter > div { height: 100%; background: var(--ink); border-radius: 99px; }

.home-banner { position: relative; margin-top: 14px; border-radius: 22px; padding: 20px 18px; overflow: hidden; color: #ffffff;
  text-decoration: none; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: linear-gradient(135deg, #161618 0%, #2a2a2e 100%); box-shadow: var(--shadow); border: 1px solid rgba(255, 255, 255, .08); }
.home-banner::after { content: "学"; position: absolute; right: 12px; bottom: -26px; font-family: var(--hanzi-font); font-size: 6.2rem; line-height: 1; opacity: .09; pointer-events: none; }
.home-banner:hover { color: #ffffff; transform: translateY(-1px); }
.home-banner strong { display: block; font-size: 1.08rem; font-weight: 750; }
.home-banner span { display: block; font-size: .84rem; opacity: .8; margin-top: 2px; }

.today { display: grid; grid-template-columns: 1fr auto; gap: 10px 14px; align-items: center; padding: 18px;
  border: 1px solid rgba(255, 255, 255, .10); color: #ffffff; border-radius: 24px; box-shadow: var(--shadow);
  background: linear-gradient(145deg, #151517 0%, #27272b 100%);
  position: relative; overflow: hidden; }
.today::after { content: "学"; position: absolute; right: -8px; bottom: -42px; font-family: var(--hanzi-font); font-size: 7.5rem; line-height: 1; opacity: .07; pointer-events: none; }
.today .today-num { font-size: clamp(1.12rem, 4vw, 1.35rem); font-weight: 750; line-height: 1.2; letter-spacing: -.015em; }
.today .today-sub { color: rgba(255, 255, 255, .74); font-size: .85rem; margin-top: 3px; }
.today .btn { background: #ffffff; color: #111113; border-color: #ffffff; font-weight: 700; min-height: 40px; padding: 8px 16px; font-size: .9rem; border-radius: 999px; position: relative; z-index: 1; }
.today .btn:hover { background: #e8e8ec; border-color: #e8e8ec; color: #111113; }
.today-meter { grid-column: 1 / -1; height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .18); overflow: hidden; }
.today-meter > div { height: 100%; background: #ffffff; border-radius: 99px; }
@media (prefers-color-scheme: dark) {
  .today { background: linear-gradient(145deg, #222226 0%, #161618 100%); border-color: var(--line-strong); }
  .today .btn { background: #f5f5f7; color: #0a0a0b; border-color: #f5f5f7; }
}

.home-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.home-stats .stat { padding: 14px 10px; text-align: center; }
.home-stats .stat .num { font-size: 1.45rem; color: var(--ink); }
.home-stats .stat:first-child .num { color: var(--ink); }
.home-stats .stat:nth-child(2) .num { color: var(--ink-2); }
.home-stats .stat:last-child .num { color: var(--muted); }

@media (min-width: 1000px) {
  body:not(.mobile-only-shell) .home-hero-band { margin: -26px 0 0; border-radius: 0 0 24px 24px; }
  body:not(.mobile-only-shell) .tabbar { max-width: 820px; margin: 0 auto; border-left: 1px solid var(--line); border-right: 1px solid var(--line); border-radius: 16px 16px 0 0; }
}

.home-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 14px; }
.home-tile { text-decoration: none; color: inherit; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 18px 14px; }
.home-tile .tile-ic { width: 48px; height: 48px; border-radius: 16px; display: grid; place-items: center; flex: none;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink); }
.home-tile .tile-ic.tone-blue,
.home-tile .tile-ic.tone-ok,
.home-tile .tile-ic.tone-amber { background: var(--surface-2); color: var(--ink); }
.home-tile strong { font-size: .96rem; line-height: 1.3; font-weight: 650; }
.home-tile .tile-sub { font-size: .78rem; color: var(--muted); line-height: 1.35; }
@media (max-width: 600px) {
  .home-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .home-tile { padding: 15px 10px; }
}

/* ---------- Danh sách bộ thẻ dạng list ---------- */
.deck-list-row { display: flex; align-items: center; gap: 14px; padding: 13px 16px; border-bottom: 1px solid var(--line); }
.deck-list-row:last-child { border-bottom: 0; }
.deck-list-row .deck-ic { width: 42px; height: 42px; flex: none; border-radius: 14px; display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink); font-family: var(--hanzi-font); font-size: 1.25rem; font-weight: 600; }
.deck-list-row .deck-main { flex: 1; min-width: 0; text-decoration: none; color: inherit; }
.deck-list-row .deck-main:hover strong { text-decoration: underline; text-underline-offset: 3px; }
.deck-list-row .deck-meta { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; font-size: .85rem; color: var(--muted); margin-top: 2px; }
.deck-list-row .deck-meta .due { color: var(--ink); font-weight: 650; }
.deck-list-row .deck-meta .done { color: var(--muted); font-weight: 550; }
.deck-list-row .deck-prog { display: flex; align-items: center; gap: 8px; margin-top: 6px; max-width: 240px; }
.deck-list-row .deck-bar { flex: 1; height: 5px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 0; }
.deck-list-row .deck-bar > div { height: 100%; background: var(--ink); border-radius: 99px; }
.deck-list-row .deck-pct { font-size: .76rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.deck-card { display: flex; align-items: center; gap: 14px; }
.deck-card .deck-ic { width: 44px; height: 44px; flex: none; border-radius: 14px; display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink); font-family: var(--hanzi-font); font-size: 1.3rem; }
.deck-card .deck-bar { height: 5px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 6px; max-width: 260px; }
.deck-card .deck-bar > div { height: 100%; background: var(--ink); border-radius: 99px; }

/* ---------- Màn hình Luyện: dạng list bấm xổ xuống ---------- */
.acc-list { padding: 0; overflow: hidden; }
.acc-item { border-bottom: 1px solid var(--line); }
.acc-item:last-child { border-bottom: 0; }
.acc-item > summary { list-style: none; display: flex; align-items: center; gap: 14px; padding: 14px 16px; cursor: pointer; color: inherit; font-weight: 400; transition: background .12s; }
.acc-item > summary::-webkit-details-marker { display: none; }
.acc-item > summary:hover { background: var(--hover); }
.acc-item .acc-ic { width: 42px; height: 42px; flex: none; border-radius: 14px; display: grid; place-items: center; font-family: var(--hanzi-font); font-size: 1.15rem; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink); }
.acc-item .acc-ic.tone-blue,
.acc-item .acc-ic.tone-ok,
.acc-item .acc-ic.tone-amber { background: var(--surface-2); color: var(--ink); }
.acc-item .acc-ic.tone-muted { background: var(--surface-2); color: var(--muted); }
.acc-item .acc-text { flex: 1; min-width: 0; }
.acc-item .acc-text strong { display: block; font-size: .98rem; font-weight: 650; }
.acc-item .acc-text span { display: block; font-size: .83rem; color: var(--muted); margin-top: 1px; }
.acc-item .acc-chev { color: var(--muted); font-size: 1.25rem; transition: transform .16s ease; flex: none; }
.acc-item[open] > summary .acc-chev { transform: rotate(90deg); }
.acc-body { padding: 12px 16px 16px; border-top: 1px solid var(--line); background: var(--bg-soft); }
.acc-deck-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.acc-deck-row:last-child { border-bottom: 0; padding-bottom: 2px; }
.acc-deck-info { min-width: 0; flex: 1 1 180px; }
.acc-deck-info strong { display: block; font-size: .94rem; }
.acc-deck-info span { font-size: .82rem; color: var(--muted); }
@media (max-width: 480px) {
  .today { grid-template-columns: 1fr; }
  .today .btn { width: 100%; }
  .deck-list-row { padding: 12px; gap: 10px; }
  .deck-list-row .deck-detail-btn { display: none; }
  .shortcut { padding: 12px; font-size: .95rem; }
  .rate .btn { min-height: 54px; padding: 6px 4px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* ---------- 6.10: nút viên thuốc, điều hướng chính, trang chính ---------- */
.btn { border-radius: 999px; }
.btn.option, .btn.order-token { border-radius: 16px; }
.rate .btn { border-radius: 18px; }
:root { --tabbar-h: 66px; }

.appnav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; display: flex; background: var(--card);
  border-top: 1px solid var(--line); height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding: 4px 4px env(safe-area-inset-bottom); }
.appnav-brand, .appnav-long { display: none; }
.appnav-item { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-decoration: none; color: var(--muted); font-size: .75rem; font-weight: 600; white-space: nowrap; }
.appnav-item:hover { color: var(--ink); }
.appnav-ic { width: 52px; height: 30px; border-radius: 99px; display: grid; place-items: center; }
.appnav-item.active { color: var(--ink); font-weight: 700; }
.appnav-item.active .appnav-ic { background: var(--red); color: var(--on-red); }
body.has-appnav, body.has-appnav.mobile-only-shell { padding-bottom: calc(var(--tabbar-h) + 16px + env(safe-area-inset-bottom)); }
/* Các nút Trang chính / Tra từ / Tiện ích trên thanh đầu đã có trong thanh điều hướng */
body.has-appnav .topbar-actions > a { display: none; }
.wb-sticky { bottom: calc(var(--tabbar-h) + 8px + env(safe-area-inset-bottom)) !important; }
body.has-appnav .tk-pop { bottom: calc(var(--tabbar-h) + 8px + env(safe-area-inset-bottom)) !important; }

.hm-title { margin-bottom: 14px; }
.hm-title h1 { margin: 0; }
.hm-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.hm-tile { display: flex; flex-direction: column; gap: 14px; padding: 18px; min-width: 0; }
.hm-head { display: flex; align-items: center; gap: 12px; }
.hm-head h2 { margin: 0; font-size: 1.05rem; }
.hm-head-ic { width: 42px; height: 42px; flex: none; border-radius: 15px; display: grid; place-items: center; background: var(--red); color: var(--on-red); }
.hm-num { font-size: 1.9rem; font-weight: 750; letter-spacing: -.02em; line-height: 1.2; }
.hm-sub { color: var(--muted); font-size: .85rem; }
.hm-meter { margin-top: 8px; height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.hm-meter > div { height: 100%; background: var(--red); border-radius: 99px; }
.hm-search { margin: 0; }
.hm-search input { height: 69px; border: 2px solid var(--ink); border-radius: 20px; background: var(--card); }
.hm-rows { display: none; }
.hm-line { display: flex; align-items: center; justify-content: space-between; gap: 8px; height: 60px; padding: 0 14px;
  border-radius: 16px; background: var(--bg-soft); text-decoration: none; color: var(--ink); }
.hm-line:hover { background: var(--hover); color: var(--ink); }
.hm-line-text { min-width: 0; }
.hm-line-text strong, .hm-line-text span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hm-line-text strong { font-size: .9rem; }
.hm-line-text span, .hm-chev { font-size: .78rem; color: var(--muted); }
.hm-cta { margin-top: auto; width: 100%; min-height: 50px; }
.hm-minis { display: none; }
.hm-mini { display: flex; align-items: center; gap: 12px; min-height: 96px; text-decoration: none; color: var(--ink); font-weight: 650; font-size: .93rem; }
.hm-mini-ic { display: grid; place-items: center; flex: none; }

@media (min-width: 700px) {
  body:not(.mobile-only-shell) .hm-rows { display: flex; flex-direction: column; gap: 8px; }
  body:not(.mobile-only-shell) .hm-minis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 12px; }
}

@media (min-width: 1000px) {
  body.has-appnav.mobile-only-shell .appnav { max-width: 480px; margin: 0 auto; }
  body.has-appnav:not(.mobile-only-shell) { --tabbar-h: 0px; padding: 0 0 0 216px; }
  body.has-appnav:not(.mobile-only-shell) .appnav { right: auto; top: 0; width: 216px; height: auto; flex-direction: column; gap: 6px;
    padding: 18px 12px; border-top: 0; }
  body:not(.mobile-only-shell) .appnav-brand { display: flex; align-items: center; gap: 9px; padding: 0 8px 14px; text-decoration: none; color: var(--ink); font-weight: 700; font-size: .95rem; white-space: nowrap; }
  body:not(.mobile-only-shell) .appnav-item { flex: none; flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 48px; padding: 0 16px; border-radius: 99px; font-size: .95rem; color: var(--ink); }
  body:not(.mobile-only-shell) .appnav-item:hover { background: var(--hover); }
  body:not(.mobile-only-shell) .appnav-item.active { background: var(--red); color: var(--on-red); }
  body:not(.mobile-only-shell) .appnav-ic { width: auto; height: auto; }
  body:not(.mobile-only-shell) .appnav-item.active .appnav-ic { background: transparent; }
  body:not(.mobile-only-shell) .appnav-long { display: inline; }
  body:not(.mobile-only-shell) .appnav-short { display: none; }
  body.has-appnav:not(.mobile-only-shell) .topbar { background: var(--bg); border-bottom: 0; min-height: 52px; }
  body.has-appnav:not(.mobile-only-shell) .brand { display: none; }
  body.has-appnav.is-home:not(.mobile-only-shell) main { max-width: 1080px; }
  body:not(.mobile-only-shell) .hm-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
  body:not(.mobile-only-shell) .hm-tile { min-height: 500px; padding: 22px; }
  body:not(.mobile-only-shell) .hm-minis { grid-template-columns: repeat(4, 1fr); gap: 16px; margin-top: 16px; }
}
@media (max-width: 699px) {
  .hm-tile { gap: 10px; padding: 14px 16px; }
  .hm-head-ic { width: 34px; height: 34px; border-radius: 12px; }
  .hm-num { font-size: 1.55rem; }
  .hm-search input { height: 50px; border-radius: 16px; }
  .hm-cta { min-height: 46px; }
}
@media (min-width: 1000px) {
  body.has-appnav.is-home:not(.mobile-only-shell) .topbar { min-height: 14px; }
}
