:root {
  --bg: #f3efe7;
  --bg-deep: #e7e0d3;
  --ink: #182029;
  --muted: #5c6673;
  --line: #d2cbbd;
  --brand: #0d5c4b;
  --brand-2: #1a7a64;
  --brand-soft: #d5ebe4;
  --warn: #9a5518;
  --ok: #1b6b3c;
  --bad: #a13333;
  --card: #fffcf8;
  --shadow: 0 12px 36px rgba(24, 32, 41, 0.07);
  --radius: 20px;
  --font-sans: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  --font-serif: "Source Serif 4", "Noto Serif SC", "Songti SC", Georgia, serif;
  --max: 1180px;
  --header-h: 3.5rem;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
a, button, input, select, textarea, summary, label, .btn, .choice, .chip, .nav a, .nav-toggle {
  -webkit-tap-highlight-color: transparent;
}
a:focus:not(:focus-visible),
button:focus:not(:focus-visible) {
  outline: none;
}
body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--ink);
  background:
    radial-gradient(ellipse 80% 50% at 0% -10%, rgba(26, 122, 100, 0.16), transparent 55%),
    radial-gradient(ellipse 60% 40% at 100% 0%, rgba(154, 85, 24, 0.1), transparent 50%),
    linear-gradient(180deg, #f7f3ec 0%, var(--bg) 40%, #efe9df 100%);
  line-height: 1.65;
  min-height: 100dvh;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(14px) saturate(1.1);
  background: rgba(247, 243, 236, 0.88);
  border-bottom: 1px solid var(--line);
}
.site-header-inner {
  max-width: var(--max);
  margin: 0 auto;
  padding: 0.65rem 1rem;
  display: flex;
  gap: 0.75rem;
  align-items: center;
  justify-content: space-between;
  position: relative;
}
.brand {
  font-weight: 750;
  letter-spacing: 0.02em;
  color: var(--ink);
  font-size: 1.02rem;
  flex-shrink: 0;
}
.brand span { color: var(--brand); }
.nav-wrap {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  flex: 1 1 0;
  justify-content: flex-end;
  overflow: hidden;
}
.nav-toggle { display: none; }
.nav-backdrop { display: none !important; }
.nav {
  display: flex;
  flex: 1 1 auto;
  flex-wrap: nowrap;
  gap: 0.15rem;
  font-size: 0.84rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  width: 100%;
  max-width: 100%;
  padding-bottom: 2px;
  justify-content: space-evenly;
}
.nav::-webkit-scrollbar { display: none; }
.nav a {
  color: var(--muted);
  padding: 0.35rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
  transition: background 0.2s var(--ease), color 0.2s var(--ease), transform 0.2s var(--ease);
  flex: 0 1 auto;
  text-align: center;
  touch-action: manipulation;
}
.nav a:active {
  transform: scale(0.96);
  background: var(--brand-soft);
  color: var(--brand);
}
.nav a:hover, .nav a.active {
  color: var(--brand);
  background: var(--brand-soft);
  text-decoration: none;
}
.nav a.active { font-weight: 650; }
.nav-short { display: none; }

.wrap {
  max-width: var(--max);
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}
.wrap.practice-wrap {
  max-width: 1280px;
  padding-bottom: 1.5rem;
}

.hero { padding: 1.1rem 0 0.4rem; }
.hero h1 {
  font-family: var(--font-serif);
  font-size: clamp(1.7rem, 4vw, 2.45rem);
  line-height: 1.18;
  margin: 0 0 0.65rem;
  animation: rise 0.55s var(--ease) both;
}
.hero p {
  margin: 0 0 0.65rem;
  color: var(--muted);
  max-width: 46rem;
  animation: rise 0.55s var(--ease) 0.05s both;
}
@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin: 0.85rem 0 1.25rem;
}
.badge {
  display: inline-flex;
  align-items: center;
  padding: 0.22rem 0.7rem;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  font-size: 0.82rem;
  color: var(--muted);
}
.badge.strong {
  background: var(--brand-soft);
  color: var(--brand);
  border-color: transparent;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.9rem;
}
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.05rem 1.15rem;
  box-shadow: var(--shadow);
  transition: transform 0.25s var(--ease), box-shadow 0.25s var(--ease), border-color 0.2s;
  display: block;
  color: inherit;
  text-decoration: none;
  animation: rise 0.5s var(--ease) both;
}
.card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 40px rgba(24, 32, 41, 0.1);
  border-color: #c5dcd4;
  text-decoration: none;
}
.card h2, .card h3 { margin: 0 0 0.45rem; font-size: 1.02rem; }
.card p { margin: 0; color: var(--muted); font-size: 0.92rem; }
.card .meta { font-size: 0.8rem; color: var(--warn); margin-top: 0.55rem; }
.card.featured {
  background: linear-gradient(145deg, #e7f5f0, #fffcf8 55%);
  border-color: #b8d9cf;
}

.section { margin-top: 1.75rem; }
.section > h2 {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  margin: 0 0 0.65rem;
}
.section > .lead { color: var(--muted); margin: 0 0 0.9rem; }

.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--line);
}
th, td {
  padding: 0.65rem 0.8rem;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 0.9rem;
}
th { background: var(--bg-deep); font-weight: 650; }
tr:last-child td { border-bottom: none; }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.85rem;
}
.practice-toolbar {
  position: sticky;
  top: 0;
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto 0.75rem;
  padding: 0.2rem 0;
  background: transparent;
}
.tool-seg {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.3rem;
  border-radius: 999px;
  background: rgba(255, 252, 248, 0.97);
  border: 1px solid rgba(210, 203, 189, 0.85);
  box-shadow:
    0 10px 28px rgba(24, 32, 41, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
}
.tool-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.48rem 1rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.18s var(--ease), color 0.18s var(--ease), transform 0.15s var(--ease), box-shadow 0.18s;
}
.tool-btn:hover {
  color: var(--brand);
  background: var(--brand-soft);
}
.tool-btn:active { transform: scale(0.97); }
.tool-btn.active {
  background: var(--brand-soft);
  color: var(--brand);
}
.tool-btn-primary.active {
  background: linear-gradient(135deg, var(--brand-2), #219078);
  color: #fff;
}
.tool-btn-primary {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: #fff;
  box-shadow: 0 6px 16px rgba(13, 92, 75, 0.28);
}
.tool-btn-primary:hover {
  color: #fff;
  background: linear-gradient(135deg, var(--brand-2), #219078);
}
input[type="search"], input[type="text"], select {
  border: 1px solid rgba(210, 203, 189, 0.9);
  background: rgba(255, 252, 248, 0.98);
  border-radius: 999px;
  padding: 0.58rem 1rem;
  font: inherit;
  min-width: 160px;
  box-shadow: 0 8px 22px rgba(24, 32, 41, 0.05);
  transition: border-color 0.15s, box-shadow 0.15s;
}
input[type="search"]:focus, input[type="text"]:focus, select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 8px 22px rgba(13, 92, 75, 0.1);
}
input[type="search"]::-webkit-search-cancel-button {
  -webkit-appearance: none;
}
.btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  border-radius: 999px;
  padding: 0.52rem 1rem;
  font: inherit;
  cursor: pointer;
  transition: transform 0.15s var(--ease), background 0.15s, border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.btn:hover { border-color: var(--brand); color: var(--brand); }
.btn:active { transform: scale(0.97); }
.btn.primary {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}
.btn.primary:hover { background: var(--brand-2); color: #fff; }
.btn.ghost { background: transparent; }
.btn.pass {
  background: linear-gradient(135deg, #1b6b3c, #249456);
  color: #fff;
  border: none;
}
.btn.warn-soft { background: #fff4e8; border-color: #efd2b0; color: var(--warn); }
.btn.danger-soft { background: #fff0f0; border-color: #efc4c4; color: var(--bad); }

.alpha-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 0.75rem;
}
.alpha-bar button {
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
}
.alpha-bar button.active, .alpha-bar button:hover {
  background: var(--brand-soft);
  border-color: transparent;
  color: var(--brand);
}

.word-list { display: grid; gap: 0.4rem; }
.word-item {
  display: grid;
  grid-template-columns: minmax(110px, 170px) 1fr auto;
  gap: 0.65rem;
  padding: 0.7rem 0.9rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  align-items: center;
  transition: background 0.2s, transform 0.15s var(--ease), box-shadow 0.2s;
}
.word-item:hover {
  box-shadow: 0 8px 20px rgba(24, 32, 41, 0.05);
}
.word-item.passed { background: #eef8f2; border-color: #c5e4d1; }
.word-item .w { font-weight: 700; color: var(--brand); }
.word-item .m { color: var(--muted); font-size: 0.9rem; }
.word-item .st { font-size: 0.75rem; color: var(--ok); font-weight: 650; }
.pager {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.9rem;
  flex-wrap: wrap;
}

.knowledge-list, .tip-list, .prompt-list { display: grid; gap: 0.75rem; }
.k-card details, .tip-card details, .prompt-card details {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.8rem 1rem;
  transition: border-color 0.2s;
}
.k-card details[open], .tip-card details[open], .prompt-card details[open] {
  border-color: #b9d7cd;
}
.k-card summary, .tip-card summary, .prompt-card summary {
  cursor: pointer;
  font-weight: 650;
}
.tag {
  display: inline-block;
  font-size: 0.72rem;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: var(--bg-deep);
  color: var(--muted);
  margin-right: 0.35rem;
}
.k-body, .tip-body, .prompt-body {
  margin-top: 0.7rem;
  white-space: pre-wrap;
}

/* ===== Reading split practice ===== */
.practice-shell { display: grid; gap: 0.85rem; }
.passage-tabs {
  display: flex;
  gap: 0.4rem;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 0.15rem 0.15rem 0.35rem;
  margin: 0 -0.15rem;
  scroll-snap-type: x proximity;
  position: sticky;
  top: calc(var(--header-h) + 0.1rem);
  z-index: 6;
  background: linear-gradient(180deg, #f7f3ec 78%, rgba(247, 243, 236, 0));
}
.passage-tabs::-webkit-scrollbar { display: none; }
.passage-tabs button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
  color: var(--muted);
  transition: all 0.2s var(--ease);
  flex-shrink: 0;
  scroll-snap-align: start;
}
.passage-tabs button.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.split-practice {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
  min-height: 0;
}
.split-pane {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  animation: rise 0.45s var(--ease) both;
}
.split-pane-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fbf8f2, #f4efe6);
  flex-shrink: 0;
}
.split-pane-head h3 {
  margin: 0;
  font-size: 0.98rem;
}
.split-pane-body {
  padding: 1rem;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  flex: 1;
}
.passage-text {
  white-space: pre-wrap;
  font-family: var(--font-serif);
  font-size: 1.03rem;
  line-height: 1.75;
}
.passage-annotatable {
  cursor: text;
  user-select: text;
  -webkit-user-select: text;
}
.anno-mark {
  position: relative;
  background: linear-gradient(180deg, rgba(255, 214, 102, 0.55), rgba(255, 196, 60, 0.72));
  border-radius: 3px;
  padding: 0 0.12em;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  cursor: text;
  transition: box-shadow 0.2s var(--ease), background 0.2s;
}
.anno-mark.has-note {
  background: linear-gradient(180deg, rgba(143, 210, 185, 0.45), rgba(90, 180, 150, 0.55));
  box-shadow: inset 0 -2px 0 rgba(13, 92, 75, 0.35);
}
.anno-mark.flash {
  animation: markFlash 0.9s var(--ease);
}
.para.flash {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  background: var(--brand-soft);
  border-radius: 8px;
  transition: background 0.3s;
}
@keyframes markFlash {
  0%, 100% { box-shadow: none; }
  40% { box-shadow: 0 0 0 3px rgba(13, 92, 75, 0.35); }
}
.anno-del {
  display: none;
  position: absolute;
  top: -0.55rem;
  right: -0.55rem;
  width: 1.1rem;
  height: 1.1rem;
  padding: 0;
  margin: 0;
  border: 0;
  border-radius: 50%;
  background: #1c2430;
  color: #fff;
  font-size: 0.78rem;
  line-height: 1.1rem;
  text-align: center;
  cursor: pointer;
  z-index: 3;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}
.anno-mark:hover .anno-del { display: inline-block; }
.anno-del:hover { background: var(--bad); }
.anno-tip {
  position: fixed;
  z-index: 110;
  max-width: min(280px, 80vw);
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  background: #1c2430;
  color: #fff;
  font-size: 0.88rem;
  line-height: 1.45;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.25);
  pointer-events: none;
  animation: rise 0.15s var(--ease);
}
.anno-tip[hidden] { display: none !important; }
.anno-tip.show { display: block; }
.anno-popover {
  position: fixed;
  z-index: 100;
  display: flex;
  gap: 0.25rem;
  padding: 0.35rem;
  background: #1c2430;
  border-radius: 999px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.28);
  animation: rise 0.18s var(--ease);
  pointer-events: auto;
}
.anno-popover[hidden] { display: none !important; }
.anno-popover.show { display: flex; }
.anno-popover button {
  border: 0;
  background: transparent;
  color: #fff;
  font: inherit;
  font-size: 0.86rem;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}
.anno-popover button:hover { background: rgba(255, 255, 255, 0.14); }
.anno-panel {
  margin-top: 0.9rem;
  padding-top: 0.85rem;
  border-top: 1px dashed var(--line);
}
.anno-panel-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 0.5rem;
}
.anno-empty {
  margin: 0;
  font-size: 0.85rem;
  color: var(--muted);
}
.anno-item {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.45rem;
  cursor: pointer;
  transition: border-color 0.15s;
}
.anno-item:hover { border-color: #b8d9cf; }
.anno-quote {
  font-family: var(--font-serif);
  font-weight: 650;
  color: var(--ink);
  font-size: 0.95rem;
}
.anno-note {
  margin-top: 0.3rem;
  font-size: 0.88rem;
  color: var(--brand);
}
.anno-note.muted { color: var(--muted); font-weight: 400; }
.anno-item-actions {
  display: flex;
  gap: 0.35rem;
  margin-top: 0.4rem;
}
.anno-item-actions .btn { padding: 0.25rem 0.55rem; font-size: 0.78rem; }
.blank {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.8rem;
  margin: 0 0.1rem;
  padding: 0 0.28rem;
  border-bottom: 2px solid var(--brand);
  color: var(--brand);
  font-weight: 750;
  font-family: var(--font-sans);
  font-size: 0.92rem;
}
.word-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.85rem;
  padding-top: 0.85rem;
  border-top: 1px dashed var(--line);
}
.opt-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  background: #fff;
  font-size: 0.86rem;
  transition: transform 0.15s, background 0.15s;
}
.opt-chip:hover { transform: translateY(-1px); background: var(--brand-soft); }

.para-grid { display: grid; gap: 0.65rem; }
.para {
  padding: 0.65rem 0.8rem;
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--line);
  border-left: 3px solid var(--brand);
}
.para .label {
  font-weight: 750;
  color: var(--brand);
  margin-right: 0.35rem;
}

.q-list { display: grid; gap: 0.75rem; }
.q-item {
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0.85rem 0.95rem;
  background: #fff;
  transition: border-color 0.2s, background 0.2s, transform 0.2s var(--ease);
}
.q-item.correct { border-color: #8fcaa5; background: #f1faf5; }
.q-item.wrong { border-color: #e3a4a4; background: #fff6f6; }
.q-stem { font-weight: 650; margin-bottom: 0.55rem; }
.choices {
  display: grid;
  gap: 0.4rem;
}
.choice {
  display: flex;
  gap: 0.55rem;
  align-items: flex-start;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: #fbfaf7;
  border-radius: 16px;
  padding: 0.6rem 0.75rem;
  font: inherit;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.15s var(--ease);
}
.choice:hover { border-color: #a8cfc3; background: #f2faf6; }
.choice:focus-visible {
  outline: 2px solid rgba(13, 92, 75, 0.35);
  outline-offset: 2px;
}
.choice.selected {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: inset 0 0 0 1px rgba(13, 92, 75, 0.15);
}
.choice .key {
  flex-shrink: 0;
  width: 1.45rem;
  height: 1.45rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
}
.choice.selected .key {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}
.choice-grid-compact {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(7.5rem, 1fr));
  gap: 0.35rem;
}
.choice-grid-compact .choice { padding: 0.4rem 0.5rem; font-size: 0.88rem; }

.explain {
  margin-top: 0.55rem;
  padding: 0.55rem 0.7rem;
  border-radius: 0 14px 14px 0;
  border-left: 3px solid var(--brand);
  background: var(--bg-deep);
  color: var(--muted);
  font-size: 0.9rem;
  display: none;
  animation: rise 0.3s var(--ease);
}
.explain.show { display: block; }
.q-item.correct .explain { border-left-color: var(--ok); }
.q-item.wrong .explain { border-left-color: var(--bad); }

.notice {
  border: 1px dashed var(--warn);
  background: #fff8ef;
  color: var(--warn);
  padding: 0.8rem 1rem;
  border-radius: 12px;
  margin: 0.85rem 0;
}

.site-footer {
  border-top: 1px solid var(--line);
  padding: 1.35rem 1rem 2.2rem;
  color: var(--muted);
  font-size: 0.86rem;
}
.site-footer .inner { max-width: var(--max); margin: 0 auto; }

/* ===== Drill (Baicizhan-like) ===== */
.drill-layout {
  max-width: 520px;
  margin: 0 auto;
}
.drill-last-pass {
  margin: 0.75rem 0 0;
  padding: 0.65rem 0.85rem;
  text-align: center;
  font-size: 0.88rem;
  color: var(--muted);
  background: rgba(255, 252, 248, 0.72);
  border: 1px dashed var(--line);
  border-radius: 14px;
  line-height: 1.55;
  animation: fadeUp 0.25s var(--ease);
}
.drill-last-pass .last-pass-word {
  color: var(--ink);
  font-weight: 700;
}
.drill-last-pass .last-pass-mean {
  color: var(--brand);
  font-weight: 600;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}
.drill-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.55rem;
  margin-bottom: 1rem;
}
.stat-pill {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.75rem 0.6rem;
  text-align: center;
  box-shadow: var(--shadow);
}
.stat-pill .n {
  display: block;
  font-size: 1.35rem;
  font-weight: 750;
  color: var(--brand);
  line-height: 1.2;
}
.stat-pill .l { font-size: 0.75rem; color: var(--muted); }

.progress-track {
  height: 8px;
  background: var(--bg-deep);
  border-radius: 999px;
  overflow: hidden;
  margin: 0.5rem 0 1rem;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--brand), #2a9b7c);
  border-radius: inherit;
  transition: width 0.35s var(--ease);
}

.drill-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow);
  padding: 1.6rem 1.25rem 1.25rem;
  text-align: center;
  position: relative;
  overflow: hidden;
  min-height: min(62dvh, 420px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  animation: cardIn 0.4s var(--ease);
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.drill-card::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 4px;
  background: linear-gradient(90deg, transparent, var(--brand), transparent);
}
.drill-word {
  font-family: var(--font-serif);
  font-size: clamp(2.4rem, 11vw, 3.4rem);
  font-weight: 750;
  letter-spacing: 0.02em;
  margin: 0.55rem 0 0.35rem;
  line-height: 1.15;
  word-break: break-word;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.drill-word:active { opacity: 0.75; }
.drill-sub {
  color: var(--muted);
  font-size: 0.92rem;
  min-height: 1.4em;
}
.drill-meaning {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border-radius: 18px;
  background: var(--brand-soft);
  color: var(--ink);
  font-size: 1.02rem;
  animation: rise 0.3s var(--ease);
}
.drill-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 0.5rem;
  margin-top: 1.1rem;
}
.drill-actions .btn { padding: 0.75rem 0.4rem; font-weight: 650; }
.drill-quiz {
  display: grid;
  gap: 0.45rem;
  margin-top: 1rem;
  text-align: left;
}
.speak-btn {
  margin: 0.15rem auto 0;
  min-width: 4.6rem;
  height: 2.55rem;
  padding: 0 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 650;
  color: var(--brand);
  transition: transform 0.15s, background 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.speak-btn .speak-ico { font-size: 1rem; line-height: 1; }
.speak-btn:hover,
.speak-btn.speaking {
  background: var(--brand-soft);
  transform: scale(1.04);
  box-shadow: 0 6px 16px rgba(13, 92, 75, 0.15);
}
.speak-btn:active { transform: scale(0.97); }
.slash-fx {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  overflow: hidden;
  z-index: 6;
}
.slash-beam {
  position: absolute;
  width: 155%;
  height: 7px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(61, 220, 132, 0.15) 12%,
    #2ecc71 42%,
    #fff 50%,
    #2ecc71 58%,
    rgba(61, 220, 132, 0.15) 88%,
    transparent 100%
  );
  transform: rotate(-34deg) scaleX(0);
  opacity: 0;
  filter: drop-shadow(0 0 12px rgba(46, 204, 113, 0.85));
}
.slash-ring {
  position: absolute;
  width: 7.5rem;
  height: 7.5rem;
  border: 2px solid rgba(46, 204, 113, 0.75);
  border-radius: 50%;
  transform: scale(0.2);
  opacity: 0;
  box-shadow:
    0 0 24px rgba(46, 204, 113, 0.45),
    inset 0 0 18px rgba(46, 204, 113, 0.2);
}
.slash-glow {
  position: absolute;
  width: 12rem;
  height: 12rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(61, 220, 132, 0.45) 0%, transparent 68%);
  transform: scale(0.3);
  opacity: 0;
}
.slash-text {
  position: relative;
  z-index: 2;
  font-size: clamp(3.2rem, 15vw, 5.2rem);
  font-weight: 900;
  letter-spacing: 0.08em;
  color: #fff;
  -webkit-text-stroke: 2px #157a42;
  text-shadow:
    0 0 20px rgba(61, 220, 132, 1),
    0 0 45px rgba(46, 204, 113, 0.75),
    0 4px 0 rgba(21, 122, 66, 0.35);
  transform: scale(0.45) rotate(-18deg);
  opacity: 0;
}
.slash-spark {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 10px 2px rgba(61, 220, 132, 0.9);
  opacity: 0;
  transform: rotate(var(--a, 0deg)) translateX(0);
}
.slash-fx.show .slash-beam {
  animation: slashBeam 0.52s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.slash-fx.show .slash-ring {
  animation: slashRing 0.68s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.slash-fx.show .slash-glow {
  animation: slashGlow 0.62s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
.slash-fx.show .slash-text {
  animation: slashText 0.58s cubic-bezier(0.34, 1.45, 0.64, 1) forwards;
}
.slash-fx.show .slash-spark {
  animation: slashSpark 0.55s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes slashBeam {
  0% { opacity: 0; transform: rotate(-34deg) scaleX(0); }
  18% { opacity: 1; }
  55% { opacity: 1; transform: rotate(-34deg) scaleX(1); }
  100% { opacity: 0; transform: rotate(-34deg) scaleX(1.08); }
}
@keyframes slashRing {
  0% { opacity: 0; transform: scale(0.2); }
  35% { opacity: 0.95; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.55); }
}
@keyframes slashGlow {
  0% { opacity: 0; transform: scale(0.3); }
  40% { opacity: 0.85; transform: scale(1.1); }
  100% { opacity: 0; transform: scale(1.45); }
}
@keyframes slashText {
  0% { opacity: 0; transform: scale(0.45) rotate(-18deg); }
  38% { opacity: 1; transform: scale(1.12) rotate(-6deg); }
  62% { opacity: 1; transform: scale(1) rotate(-8deg); }
  100% { opacity: 0; transform: scale(1.25) rotate(-4deg); }
}
@keyframes slashSpark {
  0% { opacity: 0; transform: rotate(var(--a, 0deg)) translateX(0) scale(0.5); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: rotate(var(--a, 0deg)) translateX(5.5rem) scale(0); }
}
.drill-card.pass-flash {
  animation: cardPassFlash 0.65s var(--ease);
}
@keyframes cardPassFlash {
  0%, 100% {
    box-shadow: var(--shadow);
    border-color: var(--line);
  }
  35% {
    box-shadow:
      0 0 0 3px rgba(61, 220, 132, 0.35),
      0 22px 48px rgba(46, 204, 113, 0.28);
    border-color: rgba(46, 204, 113, 0.55);
  }
}

.setup-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem;
  box-shadow: var(--shadow);
  margin-bottom: 1rem;
}
.setup-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
  margin-top: 0.65rem;
}

@media (min-width: 960px) {
  .split-practice {
    grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
    height: calc(100dvh - var(--header-h) - 7.5rem);
  }
  .split-pane { height: 100%; }
}

@media (max-width: 959px) {
  :root { --header-h: 3.35rem; }
  .site-header {
    z-index: 80;
  }
  .site-header-inner {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 0.55rem;
    padding: 0.45rem 0.75rem;
  }
  .brand {
    padding: 0;
    font-size: 0.95rem;
  }
  .nav-wrap {
    flex: 0 0 auto;
    width: auto;
    justify-content: flex-end;
    position: relative;
  }
  .nav-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    border: 1px solid rgba(210, 203, 189, 0.95);
    background: #fffcf8;
    color: var(--ink);
    border-radius: 999px;
    padding: 0.4rem 0.75rem 0.4rem 0.9rem;
    font: inherit;
    font-size: 0.84rem;
    font-weight: 650;
    cursor: pointer;
    box-shadow: 0 6px 16px rgba(24, 32, 41, 0.06);
    touch-action: manipulation;
  }
  .nav-toggle:active {
    background: var(--brand-soft);
    transform: scale(0.97);
  }
  .nav-toggle-now { color: var(--brand); }
  .nav-toggle-chevron {
    width: 0.45rem;
    height: 0.45rem;
    border-right: 2px solid var(--muted);
    border-bottom: 2px solid var(--muted);
    transform: rotate(45deg);
    margin-top: -0.15rem;
    transition: transform 0.2s var(--ease);
  }
  .site-header.nav-open .nav-toggle {
    border-color: rgba(13, 92, 75, 0.35);
    background: var(--brand-soft);
  }
  .site-header.nav-open .nav-toggle-chevron {
    transform: rotate(-135deg);
    margin-top: 0.12rem;
    border-color: var(--brand);
  }
  .nav {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    top: var(--header-h);
    width: 100%;
    z-index: 90;
    flex-wrap: wrap;
    gap: 0.4rem;
    max-height: min(72dvh, 420px);
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    padding: 0.75rem 0.65rem 0.85rem;
    border-radius: 0 0 20px 20px;
    background: #fffcf8;
    border: 1px solid rgba(210, 203, 189, 0.95);
    border-top: 0;
    box-shadow: 0 18px 42px rgba(24, 32, 41, 0.16);
    font-size: 0.86rem;
    animation: navPop 0.2s var(--ease);
    justify-content: center;
  }
  @keyframes navPop {
    from { opacity: 0; transform: translateY(-6px) scale(0.98); }
    to { opacity: 1; transform: none; }
  }
  .site-header.nav-open .nav { display: flex; }
  .nav-backdrop { display: none !important; }
  .nav-full { display: none; }
  .nav-short { display: inline; }
  .nav a {
    flex: 1 1 calc(20% - 0.32rem);
    min-width: calc(20% - 0.32rem);
    max-width: none;
    text-align: center;
    padding: 0.52rem 0.35rem;
    background: #f3efe7;
    border: 1px solid transparent;
    border-radius: 999px;
  }
  .nav a:active {
    background: var(--brand-soft);
    color: var(--brand);
    transform: scale(0.96);
  }
  .nav a.active {
    background: linear-gradient(135deg, var(--brand), var(--brand-2));
    color: #fff;
    box-shadow: 0 6px 14px rgba(13, 92, 75, 0.22);
  }

  .practice-wrap { padding: 0.65rem 0.75rem 1.25rem; }
  .practice-wrap .hero-compact {
    padding: 0.35rem 0 0.15rem;
    margin-bottom: 0.35rem;
  }
  .practice-wrap .hero-compact h1 {
    font-size: 1.25rem;
    margin-bottom: 0;
  }
  .practice-toolbar {
    top: calc(var(--header-h) + 0.15rem);
    justify-content: center;
    width: fit-content;
    margin-left: auto;
    margin-right: auto;
    background: transparent;
  }
  .tool-seg {
    width: auto;
    max-width: 100%;
    justify-content: center;
    padding: 0.28rem;
  }
  .tool-btn {
    flex: 0 0 auto;
    text-align: center;
    padding: 0.52rem 0.85rem;
    font-size: 0.86rem;
  }
  .split-passage {
    max-height: 36dvh;
    position: sticky;
    top: calc(var(--header-h) + 0.25rem);
    z-index: 5;
    border-radius: 18px;
  }
  .split-passage .split-pane-body {
    max-height: calc(36dvh - 2.8rem);
  }
  .split-pane {
    border-radius: 18px;
  }
  .split-pane-head {
    padding: 0.55rem 0.75rem;
  }
  .split-pane-head h3 {
    font-size: 0.92rem;
  }
  .q-item {
    border-radius: 16px;
    padding: 0.75rem;
  }
  .choice {
    border-radius: 14px;
    padding: 0.55rem 0.65rem;
  }
  .word-item {
    grid-template-columns: 1fr;
    gap: 0.35rem;
    border-radius: 16px;
    padding: 0.75rem 0.85rem;
  }
  .drill-actions { grid-template-columns: 1fr; }
  .passage-tabs {
    margin: 0 -0.15rem;
    padding-left: 0.1rem;
    padding-right: 1rem;
    gap: 0.3rem;
  }
  .passage-tabs button {
    padding: 0.36rem 0.65rem;
    font-size: 0.78rem;
    max-width: 9.5rem;
    overflow: hidden;
    text-overflow: ellipsis;
    border-radius: 999px;
  }
  .sticky-tools {
    gap: 0.4rem;
  }
  .sticky-tools input[type="search"],
  .sticky-tools select {
    width: 100%;
  }
  .sticky-tools select {
    flex: 1 1 auto;
  }
  .alpha-bar button {
    border-radius: 999px;
  }
  .chip-row { gap: 0.35rem; }
  .prompt-card details,
  .k-card details,
  .tip-card details {
    border-radius: 18px;
  }
  .btn {
    border-radius: 999px;
  }
  .pager {
    gap: 0.5rem;
  }
  .pager .btn,
  .pager button {
    border-radius: 999px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* Custom modal (replaces alert/confirm/prompt) */
body.ui-modal-open { overflow: hidden; }
.ui-modal {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.ui-modal[hidden] { display: none !important; }
.ui-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(24, 32, 41, 0.45);
  backdrop-filter: blur(4px);
}
.ui-modal-card {
  position: relative;
  width: min(420px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(24, 32, 41, 0.22);
  padding: 1.15rem 1.2rem 1.1rem;
  transform: translateY(10px) scale(0.98);
  opacity: 0;
  transition: transform 0.22s var(--ease), opacity 0.22s var(--ease);
}
.ui-modal.show .ui-modal-card {
  transform: none;
  opacity: 1;
}
.ui-modal-title {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.55rem;
}
.ui-modal-msg {
  margin: 0 0 0.75rem;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.55;
}
.ui-modal-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 0.7rem 0.8rem;
  font: inherit;
  resize: vertical;
  min-height: 6rem;
  background: #fff;
  margin-bottom: 0.85rem;
}
.ui-modal-input:focus {
  outline: 2px solid rgba(13, 92, 75, 0.25);
  border-color: var(--brand);
}
.ui-modal-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.ui-modal-actions [data-ui="danger"] {
  margin-right: auto;
}
.ui-modal-card:focus {
  outline: none;
}

/* Compact heroes & chips */
.hero-compact {
  padding: 1.1rem 0 0.85rem;
  margin-bottom: 0.85rem;
}
.hero-compact h1 {
  margin-bottom: 0.25rem;
  font-size: clamp(1.55rem, 4vw, 2rem);
}
.hero-compact p { margin: 0; }
.hero-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}
.sticky-tools {
  position: sticky;
  top: calc(var(--header-h) + 0.25rem);
  z-index: 8;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  margin: 0 0 0.75rem;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  backdrop-filter: none;
}
.sticky-tools input[type="search"],
.sticky-tools input[type="text"] {
  flex: 1 1 14rem;
  min-width: 0;
}
.sticky-tools select {
  flex: 0 1 auto;
  min-width: 5.5rem;
}
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 0.9rem;
}
.chip {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.35rem 0.85rem;
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.chip:hover { border-color: var(--brand); color: var(--brand); }
.chip.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
.empty-hint {
  color: var(--muted);
  text-align: center;
  padding: 2rem 1rem;
}

/* Drill polish */
.drill-actions-solo {
  grid-template-columns: 1fr;
  max-width: 280px;
  margin-left: auto;
  margin-right: auto;
}
.drill-actions-solo .btn {
  padding: 0.85rem 1rem;
  font-size: 1.02rem;
}
.drill-reset-link {
  position: absolute;
  right: 0.85rem;
  bottom: 0.65rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.75rem;
  opacity: 0.55;
  cursor: pointer;
  padding: 0.2rem 0.35rem;
}
.drill-reset-link:hover { opacity: 1; color: var(--bad); }

/* Writing / translation practice */
.practice-label {
  display: grid;
  gap: 0.4rem;
  margin: 0.85rem 0 0.5rem;
  font-weight: 650;
  font-size: 0.92rem;
}
.practice-area {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 0.85rem 1rem;
  font: inherit;
  line-height: 1.6;
  resize: vertical;
  background: #fff;
  min-height: 8rem;
}
.practice-area:focus {
  outline: 2px solid rgba(13, 92, 75, 0.22);
  border-color: var(--brand);
}
.reveal-row { margin: 0.65rem 0; }
.ref-panel {
  margin-top: 0.5rem;
  padding-top: 0.65rem;
  border-top: 1px dashed var(--line);
}
.ref-panel[hidden] { display: none !important; }
.prompt-block { margin: 0.65rem 0 0.85rem; }
.prompt-label {
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
  margin-bottom: 0.35rem;
}
.prompt-text {
  margin: 0;
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 0.95rem;
  line-height: 1.65;
}
.prompt-body ul {
  margin: 0.2rem 0 0;
  padding-left: 1.15rem;
}
.scoring-fold {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.75rem 1rem 1rem;
}
.scoring-fold summary {
  cursor: pointer;
  font-weight: 650;
  list-style: none;
}
.scoring-fold summary::-webkit-details-marker { display: none; }
.scoring-fold .table-wrap { margin-top: 0.75rem; }

.practice-wrap .hero-compact {
  padding-bottom: 0.35rem;
  margin-bottom: 0.5rem;
}

@media (max-width: 959px) {
  .drill-actions-solo { max-width: none; }
}

/* ===== Final polish: feedback, FAB, counters, empty states ===== */
.check-summary {
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--muted);
  min-height: 1.25em;
  text-align: center;
}
.check-summary.good { color: var(--ok); }
.check-summary.warn { color: var(--warn); }

.fab-top {
  position: fixed;
  right: max(1rem, env(safe-area-inset-right, 0px));
  bottom: max(1.1rem, env(safe-area-inset-bottom, 0px));
  z-index: 40;
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid rgba(210, 203, 189, 0.9);
  border-radius: 999px;
  background: rgba(255, 252, 248, 0.96);
  color: var(--brand);
  font: inherit;
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(24, 32, 41, 0.12);
  transition: transform 0.18s var(--ease), opacity 0.18s;
}
.fab-top:hover { transform: translateY(-2px); }
.fab-top:active { transform: scale(0.94); }
.fab-top[hidden] { display: none !important; }

.badge-click {
  cursor: pointer;
  transition: transform 0.15s var(--ease), box-shadow 0.15s;
}
.badge-click:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(13, 92, 75, 0.14);
}
.badge-click:active { transform: scale(0.98); }

.empty-sub {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--muted);
  opacity: 0.85;
}

.w-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.icon-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  width: 2rem;
  height: 2rem;
  padding: 0;
  font-size: 0.95rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, transform 0.15s var(--ease);
}
.icon-btn:hover {
  background: var(--brand-soft);
  border-color: #a8cfc3;
}
.icon-btn:active { transform: scale(0.92); }

.wc-line {
  display: flex;
  justify-content: flex-end;
  margin: 0.15rem 0 0.35rem;
}
.wc-count {
  font-size: 0.82rem;
  font-weight: 650;
  color: var(--muted);
}
.wc-count.wc-ok { color: var(--ok); }

.drill-keys {
  margin: 0.65rem 0 0;
  font-size: 0.75rem;
  color: var(--muted);
  opacity: 0.72;
  text-align: center;
}
@media (max-width: 959px) {
  .drill-keys { display: none; }
}

.k-card summary,
.tip-card summary,
.prompt-card summary {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.k-card summary::-webkit-details-marker,
.tip-card summary::-webkit-details-marker,
.prompt-card summary::-webkit-details-marker { display: none; }
.k-card summary::after,
.tip-card summary::after,
.prompt-card summary::after {
  content: "+";
  margin-left: auto;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--muted);
  line-height: 1;
}
.k-card details[open] summary::after,
.tip-card details[open] summary::after,
.prompt-card details[open] summary::after { content: "−"; }

