:root {
  --paper: #f4efe4;
  --paper-deep: #ebe3d4;
  --card: #fffcf5;
  --card-soft: #faf5ea;
  --ink: #1d2b27;
  --ink-soft: #4b5a54;
  --muted: #7f8a83;
  --line: #e4dccd;
  --line-strong: #d4c9b5;
  --green: #176b58;
  --green-deep: #123f35;
  --green-soft: #e2efe9;
  --amber: #b46a1d;
  --amber-soft: #f8ecd9;
  --red: #b0443c;
  --red-soft: #f8e4df;
  --blue: #3c647e;
  --shadow-sm: 0 1px 2px rgba(38, 47, 43, .05), 0 5px 16px rgba(60, 51, 36, .05);
  --shadow-md: 0 10px 30px rgba(48, 42, 31, .09), 0 2px 6px rgba(48, 42, 31, .05);
  --shadow-lg: 0 24px 70px rgba(38, 34, 26, .18);
  --radius: 18px;
  --radius-sm: 12px;
  --sidebar-w: 248px;
  --sans: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --serif: "Source Han Serif SC", "Noto Serif CJK SC", "Songti SC", "STSong", "SimSun", serif;
  --ease: cubic-bezier(.22, .8, .22, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 1em; height: 1em; display: inline-block; vertical-align: middle; flex: 0 0 auto; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
::selection { background: #cfe3d9; color: var(--green-deep); }

.paper-grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .55;
  background-image:
    radial-gradient(circle at 18% 12%, rgba(180, 106, 29, .045), transparent 28%),
    radial-gradient(circle at 88% 4%, rgba(23, 107, 88, .045), transparent 26%),
    radial-gradient(circle at 50% 100%, rgba(86, 74, 51, .04), transparent 42%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.035'/%3E%3C/svg%3E");
}

.app-shell { position: relative; z-index: 1; display: flex; min-height: 100vh; }
.sidebar {
  position: fixed;
  z-index: 40;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  padding: 26px 20px 18px;
  color: #f2ecdf;
  background:
    radial-gradient(circle at 10% 0%, rgba(255, 255, 255, .07), transparent 32%),
    linear-gradient(165deg, #1a463c 0%, #13372f 55%, #0f2d27 100%);
  border-right: 1px solid rgba(0, 0, 0, .08);
  overflow-y: auto;
}
.sidebar::after {
  content: "";
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(235, 221, 190, .1);
  border-radius: 15px;
  pointer-events: none;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 6px 24px; position: relative; }
.brand-seal {
  width: 48px; height: 48px;
  flex: 0 0 48px;
  display: grid; place-items: center;
  font-family: var(--serif);
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -.5px;
  color: #173f36;
  background: #ead9b8;
  border: 1px solid #f6ebd1;
  border-radius: 12px;
  box-shadow: inset 0 0 0 3px rgba(23, 63, 54, .1), 0 6px 16px rgba(0, 0, 0, .16);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-family: var(--serif); font-size: 21px; letter-spacing: 2px; font-weight: 700; }
.brand-text small { margin-top: 4px; color: #b9cabf; font-size: 10.5px; letter-spacing: 1.4px; }

.side-nav { display: flex; flex-direction: column; gap: 5px; position: relative; }
.nav-item {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  padding: 11px 13px;
  min-height: 46px;
  color: #bfd0c6;
  border-radius: 11px;
  font-size: 14px;
  letter-spacing: .3px;
  transition: background .18s var(--ease), color .18s var(--ease), transform .18s var(--ease);
}
.nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff7e8; }
.nav-item.active { background: #f1e8d5; color: #163d34; font-weight: 600; box-shadow: 0 7px 20px rgba(0, 0, 0, .14); }
.nav-item.active::before {
  content: ""; position: absolute; left: -20px; top: 12px; bottom: 12px; width: 3px;
  background: #d5b477; border-radius: 0 4px 4px 0;
}
.nav-ico { width: 20px; height: 20px; display: inline-flex; }
.nav-ico svg { width: 20px; height: 20px; }
.nav-badge {
  margin-left: auto; min-width: 22px; height: 20px; padding: 0 7px;
  display: grid; place-items: center;
  font-size: 11px; font-weight: 700;
  color: #6d3614; background: #eccb94; border-radius: 99px;
  font-variant-numeric: tabular-nums;
}
.nav-item.active .nav-badge { background: #e8d2a8; }
.side-divider { height: 1px; margin: 22px 8px; background: linear-gradient(90deg, transparent, rgba(235, 221, 190, .22), transparent); }
.side-quote { padding: 0 10px 24px; }
.side-quote p { margin: 0 0 8px; font-family: var(--serif); font-size: 13px; line-height: 1.9; color: #b9c9bf; letter-spacing: .4px; }
.side-quote span { font-size: 10.5px; color: #819b8d; letter-spacing: 2px; }
.sync-card {
  margin-top: auto;
  display: flex; align-items: center; gap: 9px;
  width: 100%; padding: 12px 12px;
  text-align: left;
  color: #eadfc9;
  background: rgba(255, 255, 255, .055);
  border: 1px solid rgba(235, 221, 190, .14);
  border-radius: 12px;
  transition: background .2s, border-color .2s;
}
.sync-card:hover { background: rgba(255, 255, 255, .1); border-color: rgba(235, 221, 190, .28); }
.sync-dot { width: 8px; height: 8px; border-radius: 50%; background: #b7a88e; box-shadow: 0 0 0 3px rgba(183, 168, 142, .14); flex: 0 0 auto; }
.sync-dot.online { background: #76c7a7; box-shadow: 0 0 0 3px rgba(118, 199, 167, .16); }
.sync-dot.syncing { background: #ecc27f; animation: pulse 1s infinite; }
.sync-dot.error { background: #e08f82; }
.sync-copy { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.sync-copy strong { font-size: 12px; font-weight: 600; white-space: nowrap; }
.sync-copy small { margin-top: 2px; color: #92a99d; font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sync-arrow { margin-left: auto; opacity: .6; }
.side-version { padding: 14px 6px 0; color: #738f81; font-size: 9.5px; letter-spacing: 1px; text-align: center; }

.app-body { flex: 1; min-width: 0; margin-left: var(--sidebar-w); }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px;
  height: 68px; padding: 0 38px;
  background: rgba(244, 239, 228, .86);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid rgba(212, 201, 181, .62);
}
.topbar-title { font-family: var(--serif); font-weight: 700; font-size: 15px; letter-spacing: 1px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.topbar-date { color: var(--muted); font-size: 12px; letter-spacing: .5px; margin-right: 4px; }
.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center;
  color: var(--ink-soft); background: transparent; border: 1px solid transparent; border-radius: 11px;
  transition: background .18s, border-color .18s, color .18s;
}
.icon-btn svg { width: 19px; height: 19px; }
.icon-btn:hover { background: var(--card); border-color: var(--line); color: var(--green); }
.avatar-btn {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--serif); font-weight: 700; font-size: 14px;
  color: #f5edda; background: var(--green-deep); border: 1px solid #2c5b4e;
}
.mobile-menu { display: none; }
.view { padding: 34px 38px 80px; max-width: 1280px; margin: 0 auto; outline: none; }
.sync-banner {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  margin: 12px auto 0; max-width: 900px; padding: 9px 16px;
  border: 1px solid #cfe4da; border-radius: 10px;
  background: #eaf6ef; color: #245d4e; font-size: 11.5px;
}
.sync-banner svg { width: 15px; height: 15px; animation: spin 1.2s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (max-width: 860px) {
  .sync-banner { margin: 10px 14px 0; }
}

.boot-loading { min-height: 60vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; color: var(--muted); }
.boot-seal { width: 64px; height: 64px; display: grid; place-items: center; border-radius: 16px; background: var(--green-deep); color: #f1e4c8; font-family: var(--serif); font-weight: 800; font-size: 22px; animation: float 2.2s ease-in-out infinite; }
.boot-loading p { font-family: var(--serif); letter-spacing: 3px; font-size: 13px; }

.page { animation: pageIn .42s var(--ease) both; }
@keyframes pageIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }

.page-head { display: flex; align-items: flex-end; gap: 22px; margin-bottom: 26px; flex-wrap: wrap; }
.page-head-copy { flex: 1; min-width: 240px; }
.eyebrow { display: flex; align-items: center; gap: 9px; margin-bottom: 8px; color: var(--amber); font-size: 10.5px; font-weight: 700; letter-spacing: 2.2px; text-transform: uppercase; }
.eyebrow::before { content: ""; width: 22px; height: 1px; background: currentColor; opacity: .6; }
h1, h2, h3, h4 { margin: 0; font-family: var(--serif); font-weight: 700; line-height: 1.3; }
.display-title { font-size: clamp(26px, 3.1vw, 38px); letter-spacing: .5px; }
.page-sub { margin: 9px 0 0; color: var(--muted); font-size: 13px; max-width: 680px; }
.head-actions { display: flex; gap: 10px; flex-wrap: wrap; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 40px; padding: 9px 17px;
  border-radius: 11px;
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--ink);
  font-size: 13px; font-weight: 600; letter-spacing: .2px;
  transition: transform .16s var(--ease), box-shadow .16s, background .16s, border-color .16s;
}
.btn:hover { transform: translateY(-1px); box-shadow: var(--shadow-sm); border-color: #cbbb9f; }
.btn:active { transform: translateY(0); }
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--green); border-color: var(--green); color: #fbf4e4; box-shadow: 0 6px 18px rgba(23, 107, 88, .18); }
.btn-primary:hover { background: #125a4a; border-color: #125a4a; }
.btn-dark { background: var(--green-deep); border-color: var(--green-deep); color: #f7efdd; }
.btn-soft { background: var(--green-soft); border-color: #cfe2d9; color: var(--green-deep); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink-soft); }
.btn-danger { background: var(--card); color: var(--red); border-color: #e9c7c0; }
.btn-sm { min-height: 32px; padding: 5px 11px; font-size: 11.5px; border-radius: 8px; }
.btn-lg { min-height: 50px; padding: 12px 24px; font-size: 14px; border-radius: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; box-shadow: none; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.card-pad { padding: 24px; }
.section-head { display: flex; align-items: center; gap: 14px; margin: 30px 0 14px; }
.section-head h2 { font-size: 19px; letter-spacing: .5px; }
.section-head .line { flex: 1; height: 1px; background: var(--line); }
.section-head .more { color: var(--muted); font-size: 11.5px; display: inline-flex; align-items: center; gap: 4px; }
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 9px; border-radius: 99px; font-size: 10.5px; font-weight: 600; letter-spacing: .3px; background: var(--card-soft); border: 1px solid var(--line); color: var(--ink-soft); }
.chip.green { color: var(--green); background: var(--green-soft); border-color: #cfe4da; }
.chip.amber { color: var(--amber); background: var(--amber-soft); border-color: #ecd9b8; }
.chip.red { color: var(--red); background: var(--red-soft); border-color: #ecd0c9; }
.muted { color: var(--muted); }
.tnum { font-variant-numeric: tabular-nums; }

.progress { height: 7px; border-radius: 99px; background: var(--paper-deep); overflow: hidden; }
.progress > i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #2a8b71, var(--green)); transition: width .5s var(--ease); }
.progress.thin { height: 4px; }
.progress.amber > i { background: linear-gradient(90deg, #d9a153, var(--amber)); }

/* Home */
.home-hero {
  position: relative;
  display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(260px, .8fr); gap: 20px;
  margin-bottom: 28px;
  align-items: start;
}
.hero-side .countdown-card { flex: none; }
.hero-main {
  position: relative; overflow: hidden;
  padding: 30px 32px;
  border-radius: 22px;
  color: #f6efdf;
  background:
    radial-gradient(circle at 85% 18%, rgba(232, 201, 143, .2), transparent 30%),
    radial-gradient(circle at 10% 100%, rgba(45, 135, 112, .5), transparent 45%),
    linear-gradient(135deg, #173f36 0%, #1c5144 72%, #246453 100%);
  box-shadow: 0 16px 38px rgba(20, 62, 52, .18);
}
.hero-main::before {
  content: "333"; position: absolute; right: 12px; bottom: -54px;
  font-family: var(--serif); font-weight: 800; font-size: 210px; line-height: 1; letter-spacing: -14px;
  color: rgba(255, 255, 255, .045); pointer-events: none;
}
.hero-top { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; }
.hero-kicker { font-size: 10.5px; letter-spacing: 2.4px; color: #b8cfc2; text-transform: uppercase; }
.hero-line { width: 26px; height: 1px; background: rgba(235, 221, 190, .5); }
.hero-main h1 { font-size: clamp(25px, 2.7vw, 34px); color: #fff7e8; letter-spacing: 1px; }
.hero-main h1 em { font-style: normal; color: #e8c88d; }
.hero-main .hero-sub { margin: 10px 0 24px; color: #b4c9be; font-size: 12.5px; max-width: 460px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; position: relative; z-index: 1; }
.hero-actions .btn-primary { background: #ead9b8; border-color: #ead9b8; color: #1b453b; box-shadow: 0 8px 20px rgba(0, 0, 0, .15); }
.hero-actions .btn-primary:hover { background: #f3e6ca; }
.hero-actions .btn-ghost { color: #e7ddc9; border-color: rgba(235, 221, 190, .3); }
.hero-actions .btn-ghost:hover { background: rgba(255, 255, 255, .07); }
.hero-meta { display: flex; gap: 24px; margin-top: 28px; padding-top: 18px; border-top: 1px solid rgba(235, 221, 190, .14); }
.hero-meta div { display: flex; flex-direction: column; }
.hero-meta strong { font-family: var(--serif); font-size: 20px; color: #f7edd9; font-variant-numeric: tabular-nums; line-height: 1.2; }
.hero-meta span { margin-top: 2px; font-size: 10px; color: #9db6a9; letter-spacing: .8px; }
.hero-side { display: flex; flex-direction: column; gap: 14px; }
.countdown-card { flex: 1; padding: 22px 22px 18px; display: flex; flex-direction: column; justify-content: space-between; }
.countdown-top { display: flex; align-items: center; justify-content: space-between; }
.countdown-label { font-size: 10px; letter-spacing: 2px; color: var(--muted); }
.countdown-num { margin-top: 6px; font-family: var(--serif); font-size: 50px; line-height: 1; color: var(--green-deep); letter-spacing: -2px; font-variant-numeric: tabular-nums; }
.countdown-num small { font-size: 13px; letter-spacing: 1px; color: var(--muted); margin-left: 6px; }
.countdown-foot { display: flex; align-items: center; gap: 8px; margin-top: 14px; color: var(--muted); font-size: 11px; }
.today-card { padding: 18px 20px; display: flex; align-items: center; gap: 16px; }
.ring { --p: 0; width: 58px; height: 58px; flex: 0 0 58px; border-radius: 50%; display: grid; place-items: center; background: conic-gradient(var(--green) calc(var(--p) * 1%), var(--paper-deep) 0); position: relative; }
.ring::before { content: ""; position: absolute; inset: 6px; border-radius: 50%; background: var(--card); }
.ring b { position: relative; font-size: 12px; font-variant-numeric: tabular-nums; color: var(--green-deep); }
.today-copy strong { display: block; font-family: var(--serif); font-size: 15px; }
.today-copy span { color: var(--muted); font-size: 11px; }

.stat-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 28px; }
.stat-card { padding: 18px 20px; display: flex; align-items: center; gap: 13px; transition: transform .18s var(--ease), box-shadow .18s; }
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-ico { width: 40px; height: 40px; flex: 0 0 40px; display: grid; place-items: center; border-radius: 12px; background: var(--green-soft); color: var(--green); }
.stat-ico.amber { background: var(--amber-soft); color: var(--amber); }
.stat-ico.red { background: var(--red-soft); color: var(--red); }
.stat-ico.blue { background: #e6eef2; color: var(--blue); }
.stat-ico svg { width: 19px; height: 19px; }
.stat-copy strong { display: block; font-family: var(--serif); font-size: 23px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-copy span { color: var(--muted); font-size: 10.5px; letter-spacing: .5px; }

.subject-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.subject-card {
  --accent: var(--green);
  position: relative; overflow: hidden;
  padding: 23px 24px 20px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform .2s var(--ease), box-shadow .2s, border-color .2s;
}
.subject-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.subject-card::after { content: ""; position: absolute; right: -35px; top: -35px; width: 130px; height: 130px; border-radius: 50%; background: color-mix(in srgb, var(--accent) 8%, transparent); }
.subject-head { display: flex; align-items: flex-start; gap: 12px; position: relative; z-index: 1; }
.subject-num { font-family: var(--serif); font-size: 11px; letter-spacing: 2px; color: var(--accent); padding-top: 4px; }
.subject-title { font-family: var(--serif); font-size: 20px; letter-spacing: .5px; }
.subject-meta { display: flex; gap: 8px; margin: 9px 0 20px; color: var(--muted); font-size: 10.5px; letter-spacing: .4px; }
.subject-row { display: flex; align-items: center; gap: 12px; margin-top: 11px; }
.subject-row .progress { flex: 1; }
.subject-row span { min-width: 42px; text-align: right; color: var(--muted); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.subject-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 19px; padding-top: 15px; border-top: 1px solid var(--line); }
.subject-foot span { color: var(--muted); font-size: 10.5px; }
.subject-go { display: inline-flex; align-items: center; gap: 5px; color: var(--accent); font-size: 11.5px; font-weight: 700; }
.subject-go svg { width: 14px; height: 14px; transition: transform .18s; }
.subject-card:hover .subject-go svg { transform: translateX(3px); }

.continue-card { display: flex; align-items: center; gap: 18px; padding: 18px 20px; margin-top: 0; }
.continue-cover { width: 52px; height: 64px; flex: 0 0 52px; border-radius: 8px; background: linear-gradient(145deg, var(--green-deep), #2d6c5a); position: relative; box-shadow: 4px 5px 12px rgba(18, 63, 53, .18); }
.continue-cover::after { content: ""; position: absolute; left: 7px; top: 0; bottom: 0; width: 1px; background: rgba(255, 255, 255, .18); }
.continue-cover span { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--serif); color: #e9d7ae; font-size: 13px; letter-spacing: 1px; }
.continue-copy { flex: 1; min-width: 0; }
.continue-copy small { color: var(--amber); font-size: 10px; letter-spacing: 1.5px; font-weight: 700; }
.continue-copy h3 { margin: 3px 0 3px; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.continue-copy p { margin: 0; color: var(--muted); font-size: 11px; }

.recent-list { display: flex; flex-direction: column; gap: 9px; }
.recent-item { display: flex; align-items: center; gap: 12px; padding: 13px 15px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; cursor: pointer; transition: border-color .16s, transform .16s; }
.recent-item:hover { border-color: var(--line-strong); transform: translateX(2px); }
.recent-subject { flex: 0 0 auto; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 9px; background: var(--red-soft); color: var(--red); font-family: var(--serif); font-size: 13px; }
.recent-copy { flex: 1; min-width: 0; }
.recent-copy p { margin: 0; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.recent-copy small { color: var(--muted); font-size: 10px; }
.empty-mini { padding: 26px; text-align: center; color: var(--muted); font-size: 12px; border: 1px dashed var(--line-strong); border-radius: 14px; background: rgba(255, 252, 245, .5); }

/* Subjects */
.subject-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 22px; }
.subject-tab { display: inline-flex; align-items: center; gap: 8px; padding: 9px 15px; border: 1px solid var(--line); border-radius: 99px; background: var(--card); color: var(--ink-soft); font-size: 12px; font-weight: 600; transition: all .18s; }
.subject-tab .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--tab-accent, var(--green)); }
.subject-tab:hover { border-color: var(--line-strong); }
.subject-tab.active { color: #fff8e9; background: var(--green-deep); border-color: var(--green-deep); }
.subject-tab.active .dot { background: #e8c88d; }
.overview-band { display: grid; grid-template-columns: 1.6fr 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; margin-bottom: 24px; }
.overview-band > div { background: var(--card); padding: 18px 22px; }
.overview-band strong { display: block; font-family: var(--serif); font-size: 22px; font-variant-numeric: tabular-nums; }
.overview-band span { color: var(--muted); font-size: 10.5px; }
.overview-band .progress { margin-top: 10px; }

.chapter-list { display: flex; flex-direction: column; gap: 11px; }
.chapter-card { background: var(--card); border: 1px solid var(--line); border-radius: 15px; overflow: hidden; transition: border-color .2s, box-shadow .2s; }
.chapter-card.open { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.chapter-head { display: flex; align-items: center; gap: 14px; padding: 16px 18px; cursor: pointer; user-select: none; }
.chapter-index { width: 35px; height: 35px; flex: 0 0 35px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line-strong); color: var(--amber); font-family: var(--serif); font-size: 12px; background: var(--card-soft); }
.chapter-info { flex: 1; min-width: 0; }
.chapter-info h3 { font-size: 14.5px; font-weight: 600; font-family: var(--sans); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chapter-info p { margin: 3px 0 0; color: var(--muted); font-size: 10.5px; }
.chapter-progress { width: 110px; flex: 0 0 110px; }
.chapter-progress span { display: flex; justify-content: space-between; color: var(--muted); font-size: 9.5px; margin-bottom: 5px; font-variant-numeric: tabular-nums; }
.chapter-caret { width: 28px; height: 28px; display: grid; place-items: center; color: var(--muted); transition: transform .22s; }
.chapter-card.open .chapter-caret { transform: rotate(180deg); }
.chapter-body { display: none; padding: 0 18px 17px; border-top: 1px dashed var(--line); }
.chapter-card.open .chapter-body { display: block; animation: fadeIn .2s; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.section-row { display: flex; align-items: center; gap: 12px; padding: 13px 0 0; flex-wrap: wrap; }
.section-label { flex: 1; min-width: 160px; }
.section-label strong { display: flex; align-items: center; gap: 7px; font-size: 12.5px; }
.section-label strong::before { content: ""; width: 3px; height: 13px; border-radius: 2px; background: var(--amber); }
.section-label span { display: block; margin: 2px 0 0 10px; color: var(--muted); font-size: 10px; }
.section-actions { display: flex; gap: 7px; flex-wrap: wrap; }

/* Practice */
.practice-page { max-width: 940px; margin: 0 auto; }
.practice-top { display: flex; align-items: center; gap: 15px; margin-bottom: 18px; }
.practice-back { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 11.5px; background: none; border: 0; padding: 5px 0; }
.practice-back:hover { color: var(--green); }
.practice-back svg { width: 15px; height: 15px; }
.practice-mode { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 10.5px; letter-spacing: .5px; }
.practice-mode .btn { padding: 5px 9px; font-size: 10.5px; line-height: 1.2; }
.sheet-legend { display: flex; flex-wrap: wrap; gap: 14px; margin: 6px 0 14px; color: var(--muted); font-size: 11px; }
.sheet-legend span { display: inline-flex; align-items: center; gap: 5px; }
.sheet-legend .dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: var(--line); }
.sheet-legend .dot.ok { background: var(--green); }
.sheet-legend .dot.no { background: var(--red); }
.sheet-legend .dot.empty { background: var(--line-strong); }
.sheet-legend .dot.current { background: var(--amber); }
.answer-sheet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 7px; max-height: 48vh; overflow: auto; padding: 2px; }
.sheet-btn { border: 1px solid var(--line); background: var(--card); color: var(--ink-soft); border-radius: 9px; padding: 8px 0; font-family: var(--sans); font-size: 11.5px; font-weight: 600; cursor: pointer; transition: transform .12s var(--ease), border-color .12s, background .12s; }
.sheet-btn:hover { transform: translateY(-1px); border-color: var(--line-strong); }
.sheet-btn.ok { background: var(--green-soft); border-color: #bfd9ce; color: var(--green-deep); }
.sheet-btn.no { background: var(--red-soft); border-color: #e7c3bc; color: var(--red); }
.sheet-btn.current { outline: 2px solid var(--amber); outline-offset: 1px; background: var(--amber-soft); color: var(--amber); }
.sheet-btn.empty { color: var(--muted); }
.practice-count { font-family: var(--serif); color: var(--ink); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.practice-progress { height: 5px; background: var(--paper-deep); border-radius: 99px; margin-bottom: 22px; overflow: hidden; }
.practice-progress i { display: block; height: 100%; background: linear-gradient(90deg, #2c8b72, #1a5d4d); border-radius: inherit; transition: width .4s var(--ease); }
.practice-card { position: relative; padding: 32px 36px 28px; border-radius: 20px; box-shadow: var(--shadow-md); }
.q-meta { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 15px; }
.q-index { font-family: var(--serif); font-size: 11px; color: var(--amber); letter-spacing: 1.5px; }
.q-type { padding: 2px 7px; border-radius: 4px; background: var(--card-soft); border: 1px solid var(--line); color: var(--muted); font-size: 9.5px; }
.q-stem { font-size: clamp(16px, 1.55vw, 18px); line-height: 1.95; font-weight: 500; color: #20312b; letter-spacing: .15px; }
.q-stem .blank { display: inline-block; min-width: 42px; border-bottom: 1px solid var(--ink-soft); margin: 0 3px; }
.options { display: flex; flex-direction: column; gap: 10px; margin-top: 24px; }
.option {
  position: relative; display: flex; align-items: flex-start; gap: 13px;
  width: 100%; padding: 14px 16px;
  text-align: left;
  background: #fffdf8;
  border: 1px solid var(--line);
  border-radius: 12px;
  font-size: 14px; line-height: 1.65;
  transition: border-color .16s, background .16s, transform .16s var(--ease), box-shadow .16s;
}
.option:hover:not(.locked) { border-color: #b9cdc2; background: #fbfdf9; transform: translateX(2px); }
.option .letter {
  width: 27px; height: 27px; flex: 0 0 27px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--card-soft);
  font-family: Georgia, var(--serif); font-weight: 700; font-size: 12px;
  color: var(--ink-soft);
  transition: all .16s;
}
.option .opt-text { padding-top: 1px; }
.option.selected { border-color: var(--green); background: #f0f8f4; box-shadow: 0 0 0 1px var(--green) inset; }
.option.selected .letter { background: var(--green); border-color: var(--green); color: #fff8e8; }
.option.correct { border-color: #2f8b6e; background: #eaf6ef; box-shadow: 0 0 0 1px #2f8b6e inset; }
.option.correct .letter { background: #2f8b6e; border-color: #2f8b6e; color: #fff; }
.option.wrong { border-color: #c46a5e; background: #fbefec; box-shadow: 0 0 0 1px #c46a5e inset; }
.option.wrong .letter { background: #c46a5e; border-color: #c46a5e; color: #fff; }
.option.locked { cursor: default; }
.option .mark { margin-left: auto; padding-top: 2px; font-size: 11px; font-weight: 700; display: inline-flex; align-items: center; gap: 4px; }
.option.correct .mark { color: #24725b; }
.option.wrong .mark { color: #a94b40; }
.option .mark svg { width: 15px; height: 15px; }
.q-toolbar { display: flex; align-items: center; gap: 9px; margin-top: 24px; padding-top: 18px; border-top: 1px dashed var(--line); }
.q-toolbar .hint { flex: 1; color: var(--muted); font-size: 10px; }
.q-toolbar .hint kbd { display: inline-block; min-width: 17px; padding: 0 4px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; background: var(--card-soft); font-family: inherit; font-size: 9px; text-align: center; color: var(--ink-soft); }
.submit-area { display: flex; gap: 10px; margin-top: 20px; }
.submit-area .btn { flex: 1; }
.submit-area .btn-primary { flex: 2; }

.explain { margin-top: 22px; border-radius: 14px; border: 1px solid #cfe4da; background: linear-gradient(180deg, #f4faf6, #fbfdf8); padding: 20px 22px; animation: explainIn .32s var(--ease) both; }
@keyframes explainIn { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
.explain-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.explain-head h3 { font-size: 14px; }
.answer-pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 99px; background: var(--green); color: #fff8e8; font-size: 10.5px; font-weight: 700; letter-spacing: .5px; }
.result-pill { display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 700; }
.result-pill.ok { color: var(--green); }
.result-pill.no { color: var(--red); }
.explain-body { color: #40534b; font-size: 13px; line-height: 1.9; white-space: pre-wrap; }
.explain-body strong { color: var(--ink); }
.explain-note { margin-top: 12px; padding-top: 11px; border-top: 1px dashed #cfe0d6; color: var(--muted); font-size: 10px; display: flex; align-items: center; gap: 6px; }

/* Result */
.result-wrap { max-width: 720px; margin: 0 auto; text-align: center; padding-top: 18px; }
.result-emblem { width: 88px; height: 88px; margin: 0 auto 18px; border-radius: 50%; display: grid; place-items: center; background: var(--green-deep); color: #ead7ac; font-family: var(--serif); font-size: 27px; box-shadow: 0 12px 30px rgba(18, 63, 53, .2); }
.result-wrap h1 { font-size: 31px; }
.result-wrap > p { color: var(--muted); font-size: 12.5px; }
.result-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin: 25px 0; }
.result-stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 17px 12px; }
.result-stat strong { display: block; font-family: var(--serif); font-size: 25px; font-variant-numeric: tabular-nums; color: var(--green-deep); }
.result-stat span { color: var(--muted); font-size: 10px; letter-spacing: .5px; }
.result-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.result-review { text-align: left; margin-top: 30px; }
.result-review h2 { font-size: 17px; margin-bottom: 12px; }
.review-item { display: flex; gap: 12px; padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 11px; margin-bottom: 8px; font-size: 12px; }
.review-item .n { color: var(--red); font-family: var(--serif); flex: 0 0 auto; }
.review-item p { margin: 0; color: var(--ink-soft); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Random setup */
.random-page { max-width: 900px; margin: 0 auto; }
.random-grid { display: grid; grid-template-columns: 1.35fr .8fr; gap: 18px; align-items: start; }
.setup-card { padding: 26px 28px; }
.form-block { margin-bottom: 23px; }
.form-label { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; font-size: 11px; font-weight: 700; letter-spacing: 1px; color: var(--ink-soft); }
.form-label small { font-weight: 400; color: var(--muted); letter-spacing: 0; }
.select-wrap { position: relative; }
.select-wrap select { width: 100%; height: 44px; padding: 0 38px 0 13px; border: 1px solid var(--line-strong); border-radius: 10px; background: #fffdf8; appearance: none; font-size: 12.5px; outline: none; }
.select-wrap::after { content: ""; position: absolute; right: 14px; top: 50%; width: 7px; height: 7px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.select-wrap select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(23, 107, 88, .1); }
.preset-row { display: flex; gap: 8px; flex-wrap: wrap; }
.preset { min-width: 54px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fffdf8; color: var(--ink-soft); font-size: 11.5px; font-weight: 600; }
.preset:hover { border-color: var(--line-strong); }
.preset.active { background: var(--green-deep); border-color: var(--green-deep); color: #fbf2de; }
.count-input { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
.count-input input { width: 100%; height: 44px; padding: 0 13px; border: 1px solid var(--line-strong); border-radius: 10px; background: #fffdf8; font-size: 13px; font-variant-numeric: tabular-nums; outline: none; }
.count-input input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(23, 107, 88, .1); }
.count-input span { color: var(--muted); font-size: 11px; white-space: nowrap; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 0; border-bottom: 1px dashed var(--line); }
.toggle-row:last-child { border-bottom: 0; }
.toggle-copy strong { display: block; font-size: 12px; }
.toggle-copy span { color: var(--muted); font-size: 10px; }
.switch { position: relative; width: 42px; height: 24px; flex: 0 0 42px; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; background: #d9d2c4; border-radius: 99px; transition: background .2s; pointer-events: none; }
.switch i::after { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .16); transition: transform .2s var(--ease); }
.switch input:checked + i { background: var(--green); }
.switch input:checked + i::after { transform: translateX(18px); }
.random-preview { padding: 22px 22px; position: sticky; top: 90px; }
.random-preview h3 { font-size: 16px; margin-bottom: 5px; }
.preview-scope { color: var(--muted); font-size: 11px; line-height: 1.8; }
.preview-big { margin: 18px 0 6px; font-family: var(--serif); font-size: 54px; line-height: 1; color: var(--green-deep); font-variant-numeric: tabular-nums; letter-spacing: -2px; }
.preview-big small { font-size: 12px; color: var(--muted); letter-spacing: 0; margin-left: 4px; }
.preview-note { padding: 11px 12px; border-radius: 9px; background: var(--amber-soft); color: #7a4f1d; font-size: 10.5px; line-height: 1.7; margin-top: 16px; }
.preview-note.green { background: var(--green-soft); color: #245d4e; }

/* Wrong book */
.wrong-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.wrong-toolbar { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 17px; }
.wrong-toolbar .grow { flex: 1; }
.filter-chip { padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--card); font-size: 11px; color: var(--ink-soft); }
.filter-chip.active { background: var(--green-deep); color: #fbf3df; border-color: var(--green-deep); }
.wrong-list { display: flex; flex-direction: column; gap: 11px; }
.wrong-card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 17px 19px; transition: border-color .16s, box-shadow .16s; }
.wrong-card:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.wrong-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.wrong-stem { font-size: 13.5px; line-height: 1.75; color: #2b3a34; }
.wrong-foot { display: flex; align-items: center; gap: 8px; margin-top: 11px; flex-wrap: wrap; }
.wrong-foot .muted { margin-right: auto; font-size: 10px; }
.wrong-answer { display: none; margin-top: 12px; padding: 13px 14px; border-radius: 10px; background: #f5f9f5; border: 1px dashed #cfe0d6; font-size: 12px; line-height: 1.8; color: #3c5047; white-space: pre-wrap; }
.wrong-card.open .wrong-answer { display: block; animation: fadeIn .18s; }
.wrong-expand { background: none; border: 0; color: var(--green); font-size: 10.5px; padding: 4px 0; margin-right: auto; }

/* Stats */
.stats-hero { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 14px; margin-bottom: 22px; }
.big-stat { padding: 22px 24px; }
.big-stat strong { display: block; margin-top: 7px; font-family: var(--serif); font-size: 36px; line-height: 1; color: var(--green-deep); font-variant-numeric: tabular-nums; }
.big-stat span { color: var(--muted); font-size: 10.5px; letter-spacing: .5px; }
.big-stat .sub { margin-top: 9px; color: var(--muted); font-size: 10px; }
.chart-card { padding: 23px 25px; }
.chart-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.chart-head h2 { font-size: 17px; }
.chart-head span { color: var(--muted); font-size: 10.5px; }
.bar-chart { display: flex; align-items: flex-end; gap: 12px; height: 150px; padding-top: 10px; }
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; height: 100%; justify-content: flex-end; }
.bar { width: min(38px, 70%); min-height: 4px; border-radius: 6px 6px 3px 3px; background: linear-gradient(180deg, #3b9b7f, #1a5f4e); transition: height .5s var(--ease); position: relative; }
.bar.empty { background: var(--paper-deep); }
.bar-col span { color: var(--muted); font-size: 9.5px; }
.bar-col b { font-size: 9.5px; color: var(--ink-soft); font-weight: 600; font-variant-numeric: tabular-nums; }
.subject-stat-row { display: flex; align-items: center; gap: 12px; padding: 13px 0; border-bottom: 1px dashed var(--line); }
.subject-stat-row:last-child { border-bottom: 0; }
.subject-stat-row strong { width: 100px; flex: 0 0 100px; font-size: 12px; font-weight: 600; }
.subject-stat-row .progress { flex: 1; }
.subject-stat-row span { width: 70px; text-align: right; color: var(--muted); font-size: 10.5px; font-variant-numeric: tabular-nums; }

/* Modal */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(17, 35, 30, .45); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; padding: 20px; animation: fadeIn .18s; }
.modal { width: min(480px, 100%); max-height: 88vh; overflow-y: auto; background: var(--card); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-lg); padding: 26px 27px; animation: modalIn .26s var(--ease); }
.modal.wide { width: min(620px, 100%); }
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.modal-head-copy { flex: 1; }
.modal-head h2 { font-size: 21px; }
.modal-head p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.modal-close { width: 31px; height: 31px; display: grid; place-items: center; border: 1px solid var(--line); border-radius: 8px; background: transparent; color: var(--muted); }
.modal-close:hover { background: var(--card-soft); }
.modal-close svg { width: 15px; height: 15px; }
.modal-actions { display: flex; gap: 9px; justify-content: flex-end; margin-top: 22px; }
.modal-actions .btn { min-width: 88px; }
.sync-code-box { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border: 1px dashed var(--line-strong); border-radius: 12px; background: var(--card-soft); margin: 12px 0; }
.sync-code-box code { flex: 1; font-family: "Cascadia Code", Consolas, monospace; font-size: 19px; letter-spacing: 2px; color: var(--green-deep); font-weight: 700; }
.sync-hint { color: var(--muted); font-size: 10.5px; line-height: 1.8; }
.sync-steps { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.sync-step { display: flex; gap: 10px; align-items: flex-start; font-size: 11.5px; color: var(--ink-soft); }
.sync-step b { width: 20px; height: 20px; flex: 0 0 20px; display: grid; place-items: center; border-radius: 50%; background: var(--green-soft); color: var(--green); font-size: 10px; }
.sync-status-line { display: flex; align-items: center; gap: 7px; margin-top: 15px; padding-top: 13px; border-top: 1px dashed var(--line); color: var(--muted); font-size: 10.5px; }
.code-input { width: 100%; height: 48px; padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 10px; background: #fffdf8; font-family: "Cascadia Code", Consolas, monospace; font-size: 17px; letter-spacing: 3px; text-transform: uppercase; outline: none; }
.code-input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(23, 107, 88, .1); }
.tab-row { display: flex; gap: 5px; padding: 4px; border-radius: 10px; background: var(--paper-deep); margin-bottom: 18px; }
.tab-btn { flex: 1; padding: 8px 10px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 11.5px; font-weight: 600; }
.tab-btn.active { background: var(--card); color: var(--ink); box-shadow: 0 1px 4px rgba(0, 0, 0, .07); }

/* Toast + confetti */
.toast-root { position: fixed; z-index: 200; left: 50%; bottom: 26px; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; width: min(400px, 90vw); }
.toast { display: flex; align-items: center; gap: 9px; padding: 10px 15px; border-radius: 10px; background: var(--green-deep); color: #f8f0dd; font-size: 11.5px; box-shadow: var(--shadow-md); animation: toastIn .24s var(--ease); }
.toast.err { background: #7c312c; }
.toast svg { width: 15px; height: 15px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.confetti-root { position: fixed; inset: 0; pointer-events: none; z-index: 150; overflow: hidden; }
.confetti { position: absolute; width: 7px; height: 11px; border-radius: 1px; animation: confettiFall 1.8s cubic-bezier(.2,.7,.3,1) forwards; }
@keyframes confettiFall { 0% { transform: translateY(-20px) rotate(0); opacity: 1; } 100% { transform: translateY(75vh) rotate(540deg); opacity: 0; } }

/* Focus mode */
body.focus-mode { --paper: #eee7da; }
body.focus-mode .sidebar { transform: translateX(-100%); }
body.focus-mode .app-body { margin-left: 0; }
body.focus-mode .view { max-width: 1040px; }

/* Responsive */
@media (max-width: 1080px) {
  .home-hero { grid-template-columns: 1fr; }
  .hero-side { display: grid; grid-template-columns: 1fr 1fr; }
  .subject-grid { grid-template-columns: 1fr; }
  .random-grid { grid-template-columns: 1fr; }
  .random-preview { position: static; }
  .overview-band { grid-template-columns: 1fr 1fr; }
  .overview-band > div:first-child { grid-column: span 2; }
}
@media (max-width: 860px) {
  :root { --sidebar-w: 0px; }
  .sidebar { transform: translateX(-100%); transition: transform .25s var(--ease); box-shadow: var(--shadow-lg); width: 248px; }
  .sidebar.open { transform: none; }
  .app-body { margin-left: 0; }
  .mobile-menu { display: grid; }
  .topbar { padding: 0 18px; height: 60px; }
  .topbar-date { display: none; }
  .view { padding: 24px 18px 92px; }
  .bottom-nav {
    position: fixed; z-index: 50; left: 0; right: 0; bottom: 0;
    display: flex; justify-content: space-around;
    padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
    background: rgba(255, 252, 245, .94);
    border-top: 1px solid var(--line);
    backdrop-filter: blur(14px);
  }
  .bottom-nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; min-width: 56px; padding: 4px 6px; color: var(--muted); border-radius: 8px; }
  .bottom-nav a.active { color: var(--green-deep); background: var(--green-soft); }
  .bottom-nav svg { width: 19px; height: 19px; }
  .bottom-nav em { font-style: normal; font-size: 9.5px; font-weight: 600; }
  .stat-strip { grid-template-columns: 1fr 1fr; }
  .hero-main { padding: 26px 24px; }
  .hero-main::before { font-size: 160px; right: -14px; bottom: -38px; }
  .hero-meta { gap: 18px; }
  .practice-card { padding: 24px 20px 22px; }
  .q-stem { line-height: 1.9; }
  .chapter-progress { display: none; }
  .stats-hero { grid-template-columns: 1fr 1fr; }
  .wrong-summary { grid-template-columns: 1fr 1fr 1fr; }
  .modal { padding: 22px 20px; }
}
@media (min-width: 861px) {
  .bottom-nav { display: none; }
}
@media (max-width: 560px) {
  .view { padding: 20px 14px 90px; }
  .topbar { padding: 0 14px; }
  .display-title { font-size: 26px; }
  .page-head { margin-bottom: 20px; }
  .page-head .head-actions { width: 100%; }
  .page-head .head-actions .btn { flex: 1; }
  .home-hero { margin-bottom: 20px; }
  .hero-side { grid-template-columns: 1fr; }
  .hero-main { padding: 23px 20px; border-radius: 17px; }
  .hero-actions .btn { flex: 1; }
  .hero-meta { gap: 14px; }
  .hero-meta strong { font-size: 17px; }
  .countdown-card { padding: 18px 20px; }
  .countdown-num { font-size: 40px; }
  .stat-card { padding: 14px; gap: 10px; }
  .stat-ico { width: 34px; height: 34px; flex-basis: 34px; }
  .stat-copy strong { font-size: 20px; }
  .subject-card { padding: 19px 18px 17px; }
  .continue-card { align-items: flex-start; padding: 15px; }
  .continue-cover { width: 44px; height: 54px; flex-basis: 44px; }
  .overview-band { grid-template-columns: 1fr 1fr; }
  .overview-band > div { padding: 14px 16px; }
  .overview-band > div:first-child { grid-column: span 2; }
  .chapter-head { padding: 14px; gap: 10px; }
  .chapter-index { width: 30px; height: 30px; flex-basis: 30px; font-size: 11px; }
  .chapter-info h3 { font-size: 13px; }
  .chapter-body { padding: 0 14px 14px; }
  .section-label { min-width: 100%; }
  .section-actions { width: 100%; }
  .section-actions .btn { flex: 1; }
  .practice-top { gap: 8px; flex-wrap: wrap; }
  .practice-mode { margin-left: 0; width: 100%; justify-content: space-between; gap: 6px; }
  .practice-mode .mode-text { display: none; }
  .practice-mode .chip { display: none; }
  .practice-mode .btn { padding: 5px 7px; }
  .practice-card { border-radius: 15px; }
  .option { padding: 12px 12px; gap: 10px; font-size: 13.5px; }
  .option .letter { width: 24px; height: 24px; flex-basis: 24px; font-size: 11px; }
  .q-toolbar .hint { display: none; }
  .submit-area .btn { min-height: 46px; }
  .result-stats { gap: 8px; }
  .result-stat { padding: 13px 8px; }
  .result-stat strong { font-size: 21px; }
  .random-grid { gap: 13px; }
  .setup-card { padding: 21px 19px; }
  .wrong-summary { gap: 8px; }
  .wrong-summary .stat-card { padding: 12px 10px; }
  .wrong-summary .stat-ico { display: none; }
  .wrong-card { padding: 14px; }
  .stats-hero { grid-template-columns: 1fr 1fr; gap: 9px; }
  .big-stat { padding: 16px; }
  .big-stat strong { font-size: 29px; }
  .chart-card { padding: 18px 16px; }
  .modal-backdrop { padding: 12px; align-items: flex-end; }
  .modal { width: 100%; border-radius: 18px 18px 14px 14px; max-height: 92vh; }
  .modal-actions .btn { flex: 1; }
  .sync-code-box code { font-size: 16px; letter-spacing: 1px; }
  .toast-root { bottom: 82px; }
}
.health-ok { color: #176b58; font-weight: 700; }
.health-bad { color: #a44a3f; font-weight: 700; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
