/* ==========================================================================
   题岛 · TIDAO
   A warm, paper-like, colourful personal quiz app.
   ========================================================================== */

:root {
  --bg: #f6f1e9;
  --bg-soft: #f0e9df;
  --surface: #fffdf8;
  --surface-raised: #ffffff;
  --surface-deep: #f8f2e9;
  --ink: #2c2520;
  --ink-soft: #4d433b;
  --muted: #7d7167;
  --faint: #a99b8e;
  --line: #eadfd3;
  --line-strong: #dfd1c2;
  --coral: #ff6b57;
  --coral-deep: #e95743;
  --coral-soft: #fff0eb;
  --teal: #0fb5a3;
  --teal-deep: #078d80;
  --teal-soft: #e7faf6;
  --violet: #8269f7;
  --violet-soft: #f0edff;
  --blue: #5387f4;
  --blue-soft: #eef4ff;
  --amber: #e9a127;
  --amber-soft: #fff6e0;
  --pink: #e06594;
  --pink-soft: #fff0f6;
  --success: #11a26e;
  --success-deep: #087e54;
  --success-soft: #e9faf2;
  --danger: #e64d57;
  --danger-deep: #c4313b;
  --danger-soft: #ffeff0;
  --radius-xl: 30px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 12px;
  --shadow-card: 0 1px 0 rgba(88, 62, 42, 0.04), 0 16px 38px -28px rgba(66, 45, 28, 0.5);
  --shadow-float: 0 24px 60px -34px rgba(54, 35, 20, 0.55);
  --font-sans: "Avenir Next", "PingFang SC", "Hiragino Sans GB", "HarmonyOS Sans SC", "Microsoft YaHei", "Noto Sans SC", sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", "Songti SC", "Noto Serif SC", var(--font-sans);
  --nav-height: 76px;
  --ease-spring: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  background:
    radial-gradient(circle at 8% -4%, rgba(255, 178, 151, 0.26), transparent 34%),
    radial-gradient(circle at 93% 4%, rgba(119, 218, 203, 0.16), transparent 27%),
    radial-gradient(circle at 50% 100%, rgba(150, 129, 246, 0.09), transparent 36%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.42;
  background-image: radial-gradient(rgba(75, 54, 37, 0.16) 0.55px, transparent 0.55px);
  background-size: 15px 15px;
  mask-image: linear-gradient(to bottom, black, transparent 65%);
}

body.modal-open,
body.has-sheet {
  overflow: hidden;
}

::selection {
  color: #3d1f14;
  background: rgba(255, 147, 122, 0.4);
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

img,
svg {
  display: block;
  max-width: 100%;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

ul,
ol {
  padding: 0;
  margin: 0;
  list-style: none;
}

em,
i {
  font-style: normal;
}

.hidden,
[hidden] {
  display: none !important;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

.icon {
  width: 21px;
  height: 21px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 50%;
  z-index: 5000;
  transform: translate(-50%, -150%);
  padding: 10px 18px;
  border-radius: 12px;
  color: white;
  background: var(--ink);
  font-weight: 700;
  transition: transform 0.2s ease;
}

.skip-link:focus {
  transform: translate(-50%, 0);
}

:focus-visible {
  outline: 3px solid rgba(255, 107, 87, 0.55);
  outline-offset: 2px;
}

/* --------------------------------------------------------------------------
   Splash & boot
   -------------------------------------------------------------------------- */

.splash {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at 50% 35%, rgba(255, 235, 220, 0.95), transparent 44%),
    var(--bg);
  transition: opacity 0.45s ease, visibility 0.45s;
}

.splash.is-hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.splash-orbit {
  position: absolute;
  width: 430px;
  height: 430px;
  border: 1px dashed rgba(200, 145, 116, 0.25);
  border-radius: 50%;
  animation: splashSpin 22s linear infinite;
}

.splash-orbit::before,
.splash-orbit::after {
  content: "";
  position: absolute;
  border-radius: 50%;
}

.splash-orbit::before {
  top: 48px;
  left: 22px;
  width: 10px;
  height: 10px;
  background: var(--teal);
}

.splash-orbit::after {
  right: 38px;
  bottom: 72px;
  width: 15px;
  height: 15px;
  background: var(--amber);
}

.splash-brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  z-index: 1;
}

.brand-mark--splash {
  width: 74px !important;
  height: 74px !important;
  margin-bottom: 3px;
  filter: drop-shadow(0 18px 26px rgba(190, 81, 53, 0.2));
  animation: splashBob 2.2s var(--ease-spring) infinite;
}

.splash-brand strong {
  font-size: 28px;
  font-weight: 850;
  letter-spacing: 0.08em;
}

.splash-brand > span:last-child {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.boot-loader {
  min-height: 55vh;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-content: center;
  gap: 7px;
  color: var(--muted);
}

.boot-loader span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--coral);
  animation: loadingDot 1.1s ease-in-out infinite;
}

.boot-loader span:nth-child(2) {
  background: var(--teal);
  animation-delay: 0.12s;
}

.boot-loader span:nth-child(3) {
  background: var(--violet);
  animation-delay: 0.24s;
}

.boot-loader p {
  width: 100%;
  margin-top: 8px;
  text-align: center;
  font-size: 12px;
  letter-spacing: 0.05em;
}

.noscript-note {
  position: fixed;
  inset: 24px;
  z-index: 3000;
  display: grid;
  place-items: center;
  padding: 30px;
  text-align: center;
  background: var(--surface);
  border-radius: 24px;
  box-shadow: var(--shadow-float);
}

/* --------------------------------------------------------------------------
   App shell & sidebar
   -------------------------------------------------------------------------- */

.app-shell {
  display: grid;
  grid-template-columns: 274px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 16px;
  display: flex;
  flex-direction: column;
  align-self: start;
  width: calc(100% - 24px);
  height: calc(100dvh - 32px);
  margin: 16px 0 16px 16px;
  padding: 24px 18px 18px;
  overflow-y: auto;
  border: 1px solid rgba(224, 210, 195, 0.82);
  border-radius: 28px;
  background:
    linear-gradient(170deg, rgba(255, 253, 248, 0.94), rgba(251, 246, 238, 0.9)),
    rgba(255, 253, 248, 0.86);
  box-shadow: 0 24px 64px -48px rgba(64, 43, 27, 0.55), inset 0 1px 0 #fff;
  backdrop-filter: blur(16px);
  scrollbar-width: thin;
  scrollbar-color: rgba(150, 124, 102, 0.24) transparent;
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(150, 124, 102, 0.24);
  border-radius: 99px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 2px 8px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 45px;
  height: 45px;
  flex: 0 0 auto;
  filter: drop-shadow(0 7px 9px rgba(205, 82, 56, 0.17));
}

.brand-mark svg {
  width: 100%;
  height: 100%;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.brand-copy strong {
  font-size: 22px;
  font-weight: 850;
  letter-spacing: 0.09em;
}

.brand-copy small {
  margin-top: 4px;
  color: var(--faint);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
}

.side-add {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin: 25px 0 22px;
  padding: 14px;
  overflow: hidden;
  text-align: left;
  color: #fffaf4;
  border: 0;
  border-radius: 20px;
  background:
    radial-gradient(circle at 100% 0, rgba(255, 123, 96, 0.42), transparent 47%),
    linear-gradient(135deg, #2e2722, #3d3028);
  box-shadow: 0 16px 26px -20px rgba(36, 24, 16, 0.9);
  transition: transform 0.22s var(--ease-spring), box-shadow 0.22s ease;
}

.side-add::after {
  content: "";
  position: absolute;
  right: -21px;
  bottom: -36px;
  width: 92px;
  height: 92px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
}

.side-add:hover {
  transform: translateY(-2px);
  box-shadow: 0 23px 32px -24px rgba(36, 24, 16, 0.95);
}

.side-add-icon {
  display: grid;
  place-items: center;
  width: 39px;
  height: 39px;
  flex: 0 0 auto;
  border-radius: 13px;
  color: #321e17;
  background: var(--coral);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.side-add-icon .icon {
  width: 23px;
  height: 23px;
  stroke-width: 2.2;
}

.side-add > span:nth-child(2) {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.side-add strong {
  font-size: 14px;
  font-weight: 750;
}

.side-add small {
  margin-top: 1px;
  color: rgba(255, 248, 240, 0.55);
  font-size: 10px;
}

.side-add-arrow {
  width: 16px;
  height: 16px;
  margin-left: auto;
  color: rgba(255, 248, 240, 0.5);
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 47px;
  padding: 0 14px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 600;
  border-radius: 14px;
  transition: color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.nav-link .icon {
  width: 20px;
  height: 20px;
  color: var(--faint);
  transition: color 0.18s ease;
}

.nav-link:hover {
  color: var(--ink);
  background: rgba(245, 236, 225, 0.75);
}

.nav-link.is-active {
  color: var(--ink);
  font-weight: 750;
  background: #fff;
  box-shadow: 0 6px 18px -14px rgba(74, 50, 33, 0.55), inset 0 0 0 1px rgba(233, 221, 209, 0.8);
}

.nav-link.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 15px;
  bottom: 15px;
  width: 3px;
  border-radius: 0 4px 4px 0;
  background: var(--coral);
}

.nav-link.is-active .icon {
  color: var(--coral);
}

.nav-count {
  min-width: 23px;
  height: 20px;
  margin-left: auto;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  border-radius: 99px;
  background: var(--surface-deep);
}

.nav-count--wrong {
  color: var(--danger-deep);
  background: var(--danger-soft);
}

.nav-count.is-pulse {
  animation: countPulse 0.45s var(--ease-spring);
}

.side-spacer {
  flex: 1 1 auto;
  min-height: 28px;
}

.daily-card {
  position: relative;
  padding: 15px;
  overflow: hidden;
  border: 1px solid rgba(232, 214, 195, 0.85);
  border-radius: 18px;
  background:
    radial-gradient(circle at 100% 0, rgba(255, 188, 120, 0.22), transparent 48%),
    #fbf5ec;
}

.daily-card::after {
  content: "";
  position: absolute;
  right: -13px;
  top: -16px;
  width: 58px;
  height: 58px;
  border: 1px solid rgba(196, 139, 103, 0.16);
  border-radius: 50%;
}

.daily-top {
  display: flex;
  align-items: center;
  gap: 7px;
}

.daily-icon {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  color: var(--coral);
  border-radius: 9px;
  background: #fff;
  box-shadow: 0 3px 10px -7px rgba(128, 64, 43, 0.5);
}

.daily-icon .icon {
  width: 15px;
  height: 15px;
}

.daily-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.daily-top strong {
  margin-left: auto;
  font-size: 12px;
  font-weight: 800;
}

.daily-track {
  height: 5px;
  margin: 12px 0 9px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(210, 188, 166, 0.3);
}

.daily-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--amber), var(--coral));
  transition: width 0.7s var(--ease-spring);
}

.daily-card p {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
}

.side-bottom {
  margin-top: 15px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.side-quiet {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 38px;
  padding: 0 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  background: transparent;
  border: 0;
  border-radius: 10px;
}

.side-quiet:hover {
  color: var(--ink);
  background: rgba(246, 238, 228, 0.8);
}

.side-quiet .icon {
  width: 17px;
  height: 17px;
  color: var(--faint);
}

.side-quiet-arrow {
  width: 14px !important;
  height: 14px !important;
  margin-left: auto;
}

.side-signature {
  padding: 8px 10px 3px;
  color: var(--faint);
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.08em;
}

.app-area {
  min-width: 0;
}

.view {
  width: 100%;
  max-width: 1240px;
  margin: 0 auto;
  padding: 34px 42px 90px;
  outline: none;
}

.mobile-header,
.bottom-nav {
  display: none;
}

/* --------------------------------------------------------------------------
   Shared page pieces
   -------------------------------------------------------------------------- */

.view-page {
  animation: pageIn 0.46s var(--ease-spring) both;
}

.page-top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 26px;
}

.page-top-copy {
  min-width: 0;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 750;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.eyebrow-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 0 0 4px rgba(255, 107, 87, 0.12);
}

.page-title {
  font-size: clamp(30px, 3vw, 42px);
  font-weight: 850;
  line-height: 1.16;
  letter-spacing: -0.045em;
}

.page-title .title-accent {
  color: var(--coral);
}

.page-subtitle {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.65;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.section {
  margin-top: 34px;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 15px;
}

.section-title {
  font-size: 19px;
  font-weight: 820;
  letter-spacing: -0.025em;
}

.section-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-kicker {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11.5px;
}

.section-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 2px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 650;
  background: transparent;
  border: 0;
  border-radius: 6px;
}

.section-link:hover {
  color: var(--coral-deep);
}

.section-link .icon {
  width: 14px;
  height: 14px;
}

.section-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.section-actions .section-link + .section-link::before {
  content: "·";
  margin-right: 4px;
  color: var(--faint);
}

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 21px 22px 0;
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 800;
}

.panel-title .icon {
  width: 18px;
  height: 18px;
  color: var(--coral);
}

.panel-subtitle {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11.5px;
}

/* --------------------------------------------------------------------------
   Buttons, tags, inputs
   -------------------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 17px;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 720;
  letter-spacing: -0.01em;
  border: 1px solid transparent;
  border-radius: 13px;
  background: transparent;
  transition:
    transform 0.18s var(--ease-spring),
    box-shadow 0.18s ease,
    background 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0) scale(0.985);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn .icon {
  width: 18px;
  height: 18px;
}

.btn-primary {
  color: #fff;
  background: linear-gradient(135deg, #ff7d64, var(--coral));
  box-shadow: 0 12px 22px -17px rgba(200, 59, 35, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #ff8c74, #fb624d);
  box-shadow: 0 16px 28px -18px rgba(200, 59, 35, 0.95);
}

.btn-dark {
  color: #fff9f2;
  background: var(--ink);
  box-shadow: 0 12px 22px -17px rgba(35, 25, 18, 0.9);
}

.btn-dark:hover {
  background: #3c322b;
}

.btn-secondary {
  color: var(--ink-soft);
  border-color: var(--line-strong);
  background: rgba(255, 253, 248, 0.8);
}

.btn-secondary:hover {
  border-color: #cdb9a6;
  background: #fff;
}

.btn-soft {
  color: var(--coral-deep);
  background: var(--coral-soft);
}

.btn-soft:hover {
  background: #ffe5dd;
}

.btn-ghost {
  color: var(--muted);
  background: transparent;
}

.btn-ghost:hover {
  color: var(--ink);
  background: rgba(239, 229, 217, 0.62);
}

.btn-danger {
  color: var(--danger-deep);
  border-color: #f0c7c9;
  background: var(--danger-soft);
}

.btn-danger:hover {
  background: #ffe5e6;
}

.btn-success {
  color: #fff;
  background: linear-gradient(135deg, #22b47e, var(--success));
  box-shadow: 0 12px 22px -17px rgba(6, 112, 75, 0.9);
}

.btn-light {
  color: var(--ink);
  background: #fff9f0;
  box-shadow: 0 12px 24px -20px rgba(255, 255, 255, 0.65);
}

.btn-light:hover {
  background: #fff;
}

.btn-glass {
  color: #fff7ee;
  border-color: rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(8px);
}

.btn-glass:hover {
  background: rgba(255, 255, 255, 0.13);
}

.btn-sm {
  min-height: 36px;
  padding: 0 12px;
  font-size: 11.5px;
  border-radius: 10px;
}

.btn-sm .icon {
  width: 15px;
  height: 15px;
}

.btn-lg {
  min-height: 50px;
  padding: 0 22px;
  font-size: 14px;
  border-radius: 15px;
}

.btn-block {
  width: 100%;
}

.btn-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px;
  color: var(--coral-deep);
  font-size: 11.5px;
  font-weight: 700;
  border: 0;
  background: transparent;
}

.btn-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

.btn-link .icon {
  width: 14px;
  height: 14px;
}

.icon-button,
.avatar-button {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 42px;
  padding: 0;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 13px;
  background: rgba(255, 253, 248, 0.8);
  transition: all 0.18s ease;
}

.icon-button:hover,
.avatar-button:hover {
  color: var(--coral-deep);
  border-color: #e6c8bb;
  background: #fff;
}

.icon-button .icon,
.avatar-button .icon {
  width: 19px;
  height: 19px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 23px;
  padding: 0 8px;
  color: var(--tag-color, var(--muted));
  font-size: 10px;
  font-weight: 720;
  line-height: 1;
  white-space: nowrap;
  border: 1px solid transparent;
  border-radius: 7px;
  background: var(--tag-soft, var(--surface-deep));
}

.tag .icon {
  width: 12px;
  height: 12px;
}

.tag--outline {
  color: var(--muted);
  border-color: var(--line);
  background: transparent;
}

.tag--success {
  color: var(--success-deep);
  background: var(--success-soft);
}

.tag--danger {
  color: var(--danger-deep);
  background: var(--danger-soft);
}

.tag--muted {
  color: var(--muted);
  background: var(--surface-deep);
}

.tag--new {
  color: #9a5a00;
  background: var(--amber-soft);
}

.tag-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.dot-separator {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--faint);
}

.meta-text {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 550;
}

.meta-text .icon {
  width: 12px;
  height: 12px;
}

.count-badge {
  display: inline-grid;
  min-width: 21px;
  height: 21px;
  padding: 0 6px;
  place-items: center;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  border-radius: 99px;
  background: var(--surface-deep);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.field-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 700;
}

.field-label em {
  color: var(--coral);
}

.field-hint {
  color: var(--faint);
  font-size: 10.5px;
  line-height: 1.5;
}

.input,
.select,
.textarea {
  width: 100%;
  padding: 11px 13px;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.55;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  background: #fffdfa;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.input::placeholder,
.textarea::placeholder {
  color: #b5a799;
}

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: rgba(255, 107, 87, 0.65);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(255, 107, 87, 0.09);
}

.textarea {
  min-height: 100px;
  resize: vertical;
}

.select {
  appearance: none;
  padding-right: 35px;
  cursor: pointer;
}

.select-wrap {
  position: relative;
}

.select-wrap::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 14px;
  width: 7px;
  height: 7px;
  pointer-events: none;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  transform: translateY(-65%) rotate(45deg);
}

.search-field {
  position: relative;
  flex: 1;
  min-width: 180px;
}

.search-field .icon {
  position: absolute;
  top: 50%;
  left: 14px;
  width: 17px;
  height: 17px;
  color: var(--faint);
  pointer-events: none;
  transform: translateY(-50%);
}

.search-field .input {
  height: 45px;
  padding-left: 41px;
  background: rgba(255, 253, 248, 0.85);
}

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 13px 0;
  border-bottom: 1px solid var(--line);
}

.switch-row:last-child {
  border-bottom: 0;
}

.switch-copy {
  min-width: 0;
}

.switch-copy strong {
  display: block;
  font-size: 12.5px;
  font-weight: 700;
}

.switch-copy span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.5;
}

.switch {
  position: relative;
  width: 46px;
  height: 27px;
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  border-radius: 99px;
  background: #d9cfc4;
  transition: background 0.22s ease;
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 7px rgba(62, 42, 27, 0.18);
  transition: transform 0.24s var(--ease-spring);
}

.switch[aria-checked="true"] {
  background: var(--teal);
}

.switch[aria-checked="true"]::after {
  transform: translateX(19px);
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.5;
  cursor: pointer;
}

.check-row input {
  width: 16px;
  height: 16px;
  margin: 1px 0 0;
  accent-color: var(--coral);
  flex: 0 0 auto;
}

.segmented {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-deep);
}

.segmented button {
  min-height: 32px;
  padding: 0 12px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  border: 0;
  border-radius: 8px;
  background: transparent;
}

.segmented button.is-active {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 3px 10px -7px rgba(63, 43, 28, 0.5);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  padding: 0 11px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: rgba(255, 253, 248, 0.72);
}

.filter-chip:hover {
  border-color: #d8c5b3;
  color: var(--ink);
}

.filter-chip.is-active {
  color: #fff;
  border-color: var(--ink);
  background: var(--ink);
}

/* --------------------------------------------------------------------------
   Home
   -------------------------------------------------------------------------- */

.home-top {
  align-items: center;
}

.home-greeting-title {
  font-size: clamp(28px, 3.15vw, 42px);
}

.home-actions .btn {
  min-height: 42px;
}

.hero-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.06fr) minmax(300px, 0.94fr);
  min-height: 328px;
  padding: 38px 38px 30px;
  overflow: hidden;
  color: #fff8f0;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 32px;
  background:
    radial-gradient(circle at 84% 2%, rgba(255, 120, 89, 0.44), transparent 36%),
    radial-gradient(circle at 100% 100%, rgba(38, 191, 169, 0.19), transparent 37%),
    linear-gradient(128deg, #2c2520 0%, #332821 51%, #403026 100%);
  box-shadow: 0 32px 70px -46px rgba(48, 29, 16, 0.95), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.hero-card::before {
  content: "";
  position: absolute;
  top: -110px;
  right: 23%;
  width: 300px;
  height: 300px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 50%;
}

.hero-card::after {
  content: "";
  position: absolute;
  left: -70px;
  bottom: -140px;
  width: 320px;
  height: 320px;
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: 50%;
}

.hero-content {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
}

.hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 25px;
  padding: 0 10px;
  color: #ffd6c9;
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 1px solid rgba(255, 178, 154, 0.24);
  border-radius: 99px;
  background: rgba(255, 127, 96, 0.08);
}

.hero-kicker .icon {
  width: 12px;
  height: 12px;
}

.hero-title {
  max-width: 520px;
  margin: 17px 0 12px;
  font-size: clamp(30px, 3.2vw, 45px);
  font-weight: 820;
  line-height: 1.2;
  letter-spacing: -0.05em;
}

.hero-title em {
  color: #ff9881;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  letter-spacing: -0.035em;
}

.hero-copy {
  max-width: 430px;
  color: rgba(255, 247, 238, 0.6);
  font-size: 12.5px;
  line-height: 1.75;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 22px;
}

.hero-metrics {
  display: flex;
  gap: 0;
  width: 100%;
  max-width: 430px;
  margin-top: 27px;
  padding-top: 19px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.hero-metric {
  flex: 1;
  min-width: 0;
  padding-right: 17px;
}

.hero-metric + .hero-metric {
  padding-left: 17px;
  border-left: 1px solid rgba(255, 255, 255, 0.09);
}

.hero-metric strong {
  display: block;
  font-size: 21px;
  font-weight: 820;
  line-height: 1.15;
  letter-spacing: -0.03em;
}

.hero-metric strong small {
  margin-left: 2px;
  font-size: 10px;
  font-weight: 600;
  opacity: 0.55;
}

.hero-metric span {
  display: block;
  margin-top: 4px;
  overflow: hidden;
  color: rgba(255, 247, 238, 0.45);
  font-size: 9.5px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Hero's little question stack */
.hero-art {
  position: relative;
  z-index: 1;
  min-height: 255px;
  align-self: stretch;
}

.hero-orbit {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 286px;
  height: 286px;
  border: 1px dashed rgba(255, 231, 213, 0.18);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: slowSpin 38s linear infinite;
}

.hero-orbit::before,
.hero-orbit::after {
  content: "";
  position: absolute;
  border-radius: 50%;
}

.hero-orbit::before {
  top: 6px;
  left: 61px;
  width: 8px;
  height: 8px;
  background: var(--amber);
}

.hero-orbit::after {
  right: 9px;
  bottom: 62px;
  width: 6px;
  height: 6px;
  background: var(--teal);
}

.hero-card-stack {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 250px;
  height: 238px;
  transform: translate(-50%, -50%);
}

.art-question-card {
  position: absolute;
  top: 8px;
  left: 22px;
  z-index: 2;
  width: 221px;
  padding: 17px 17px 14px;
  color: var(--ink);
  border-radius: 20px;
  background: #fffaf2;
  box-shadow: 0 26px 45px -25px rgba(0, 0, 0, 0.6);
  transform: rotate(-4deg);
  animation: artFloat 6s ease-in-out infinite;
}

.art-question-card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  border: 1px solid rgba(255, 255, 255, 0.8);
}

.art-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.art-card-tag {
  padding: 3px 7px;
  color: var(--teal-deep);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.06em;
  border-radius: 5px;
  background: var(--teal-soft);
}

.art-card-number {
  color: var(--faint);
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
}

.art-question-text {
  margin: 10px 0 10px;
  font-size: 11.5px;
  font-weight: 750;
  line-height: 1.55;
}

.art-options {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.art-option {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 7px;
  color: var(--muted);
  font-size: 8.5px;
  border: 1px solid #eee4d8;
  border-radius: 7px;
  background: #fffdf9;
}

.art-option b {
  display: grid;
  place-items: center;
  width: 14px;
  height: 14px;
  color: var(--muted);
  font-size: 7px;
  font-weight: 800;
  border-radius: 4px;
  background: #f3ece3;
}

.art-option.is-right {
  color: var(--success-deep);
  font-weight: 700;
  border-color: #bfe9da;
  background: var(--success-soft);
}

.art-option.is-right b {
  color: #fff;
  background: var(--success);
}

.art-option.is-right .icon {
  width: 10px;
  height: 10px;
  margin-left: auto;
}

.art-question-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 11px;
  padding-top: 9px;
  border-top: 1px dashed #ede2d5;
}

.art-dots {
  display: flex;
  gap: 3px;
}

.art-dots i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #ded1c3;
}

.art-dots i:first-child {
  width: 11px;
  border-radius: 99px;
  background: var(--coral);
}

.art-streak {
  display: flex;
  align-items: center;
  gap: 3px;
  color: var(--faint);
  font-size: 7.5px;
}

.art-streak .icon {
  width: 9px;
  height: 9px;
  color: var(--amber);
}

.art-back-card {
  position: absolute;
  top: 26px;
  right: 1px;
  z-index: 1;
  width: 205px;
  height: 190px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 19px;
  background: linear-gradient(150deg, rgba(255, 172, 135, 0.4), rgba(255, 106, 86, 0.16));
  transform: rotate(9deg);
}

.art-result-chip {
  position: absolute;
  right: -7px;
  bottom: 31px;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px 8px 8px;
  color: var(--success-deep);
  font-size: 9px;
  font-weight: 800;
  border: 1px solid #c5ecdd;
  border-radius: 12px;
  background: #f6fffb;
  box-shadow: 0 15px 30px -17px rgba(0, 0, 0, 0.55);
  transform: rotate(3deg);
  animation: artFloat 5.2s 0.7s ease-in-out infinite;
}

.art-result-chip span {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  color: #fff;
  border-radius: 8px;
  background: var(--success);
}

.art-result-chip .icon {
  width: 14px;
  height: 14px;
  stroke-width: 2.4;
}

.art-result-chip small {
  display: block;
  color: var(--faint);
  font-size: 7px;
  font-weight: 600;
}

.art-star {
  position: absolute;
  z-index: 5;
  display: grid;
  place-items: center;
  color: var(--amber);
  filter: drop-shadow(0 8px 12px rgba(0, 0, 0, 0.2));
  animation: starTwinkle 3.4s ease-in-out infinite;
}

.art-star--one {
  top: 3px;
  right: 5px;
  width: 21px;
  height: 21px;
}

.art-star--two {
  left: 4px;
  bottom: 33px;
  width: 13px;
  height: 13px;
  color: #ffad89;
  animation-delay: 0.8s;
}

.art-star .icon {
  width: 100%;
  height: 100%;
  fill: currentColor;
  stroke: currentColor;
}

.hero-art-note {
  position: absolute;
  bottom: -3px;
  left: 13px;
  color: rgba(255, 248, 240, 0.3);
  font-family: var(--font-display);
  font-size: 9px;
  letter-spacing: 0.05em;
  transform: rotate(-4deg);
}

/* Mode cards */
.mode-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.mode-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 175px;
  padding: 18px;
  overflow: hidden;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
  transition: transform 0.22s var(--ease-spring), box-shadow 0.22s ease, border-color 0.22s ease;
}

.mode-card::before {
  content: "";
  position: absolute;
  top: -50px;
  right: -47px;
  width: 125px;
  height: 125px;
  border-radius: 50%;
  background: var(--mode-soft);
  opacity: 0.8;
}

.mode-card:hover {
  border-color: var(--mode-border, var(--line-strong));
  transform: translateY(-3px);
  box-shadow: 0 22px 36px -30px rgba(62, 40, 24, 0.62);
}

.mode-icon {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: var(--mode-color);
  border-radius: 13px;
  background: var(--mode-soft);
}

.mode-icon .icon {
  width: 21px;
  height: 21px;
}

.mode-name {
  position: relative;
  z-index: 1;
  margin-top: 14px;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.mode-description {
  position: relative;
  z-index: 1;
  margin-top: 4px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.58;
}

.mode-footer {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: auto;
  padding-top: 12px;
  color: var(--mode-color);
  font-size: 10.5px;
  font-weight: 750;
}

.mode-footer .icon {
  width: 14px;
  height: 14px;
  transition: transform 0.2s ease;
}

.mode-card:hover .mode-footer .icon {
  transform: translateX(3px);
}

/* Chapter cards */
.chapter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.chapter-card {
  position: relative;
  display: flex;
  flex-direction: column;
  min-height: 190px;
  padding: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 21px;
  background:
    radial-gradient(circle at 100% 0%, var(--chapter-soft), transparent 46%),
    var(--surface);
  box-shadow: var(--shadow-card);
  transition: transform 0.22s var(--ease-spring), box-shadow 0.22s ease;
}

.chapter-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 24px 42px -31px rgba(64, 40, 22, 0.66);
}

.chapter-card::after {
  content: "";
  position: absolute;
  right: -31px;
  bottom: -51px;
  width: 128px;
  height: 128px;
  border: 1px solid var(--chapter-soft);
  border-radius: 50%;
  pointer-events: none;
}

.chapter-card-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  gap: 11px;
}

.chapter-glyph {
  display: grid;
  place-items: center;
  width: 43px;
  height: 43px;
  flex: 0 0 auto;
  color: #fff;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 800;
  border-radius: 13px;
  background: linear-gradient(145deg, var(--chapter-light), var(--chapter));
  box-shadow: 0 8px 16px -10px var(--chapter);
}

.chapter-name {
  padding-top: 1px;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.35;
  letter-spacing: -0.015em;
}

.chapter-count {
  margin-top: 3px;
  color: var(--muted);
  font-size: 10px;
}

.chapter-actions-mini {
  display: flex;
  align-items: center;
  margin-left: auto;
  gap: 2px;
  opacity: 0;
  transform: translateY(-3px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.chapter-card:hover .chapter-actions-mini,
.chapter-actions-mini:focus-within {
  opacity: 1;
  transform: translateY(0);
}

.mini-icon-btn {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  padding: 0;
  color: var(--faint);
  border: 0;
  border-radius: 7px;
  background: transparent;
}

.mini-icon-btn:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.75);
}

.mini-icon-btn .icon {
  width: 15px;
  height: 15px;
}

.chapter-middle {
  position: relative;
  z-index: 1;
  margin-top: 17px;
}

.chapter-progress-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 9.5px;
}

.chapter-progress-top strong {
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 750;
}

.chapter-progress-track {
  height: 5px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(180, 156, 135, 0.2);
}

.chapter-progress-track > span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--chapter);
  transition: width 0.8s var(--ease-spring);
}

.chapter-card-bottom {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding-top: 14px;
}

.chapter-stat {
  display: flex;
  align-items: baseline;
  gap: 3px;
  color: var(--muted);
  font-size: 9px;
}

.chapter-stat strong {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 750;
}

.chapter-start {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 31px;
  margin-left: auto;
  padding: 0 11px;
  color: var(--chapter);
  font-size: 10px;
  font-weight: 750;
  border: 1px solid var(--chapter-soft);
  border-radius: 9px;
  background: #fff;
  transition: all 0.2s ease;
}

.chapter-start:hover {
  color: #fff;
  border-color: var(--chapter);
  background: var(--chapter);
}

.chapter-start .icon {
  width: 13px;
  height: 13px;
}

.chapter-add {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 190px;
  padding: 18px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed #d8c9ba;
  border-radius: 21px;
  background: rgba(255, 253, 248, 0.45);
  transition: all 0.2s ease;
}

.chapter-add:hover {
  color: var(--ink);
  border-color: #c8ab97;
  background: rgba(255, 253, 248, 0.8);
}

.chapter-add-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  color: var(--coral);
  border: 1px solid #edd6ca;
  border-radius: 50%;
  background: #fff8f1;
}

.chapter-add strong {
  font-size: 12px;
}

.chapter-add span {
  font-size: 10px;
}

.home-lower-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, 0.9fr);
  gap: 14px;
  margin-top: 34px;
}

.today-panel {
  padding: 20px 21px 17px;
}

.today-bars {
  display: flex;
  align-items: flex-end;
  gap: 9px;
  height: 108px;
  margin-top: 17px;
  padding-top: 8px;
}

.today-bar-col {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  height: 100%;
}

.today-bar-track {
  position: relative;
  width: 100%;
  max-width: 33px;
  height: 100%;
  border-radius: 7px 7px 4px 4px;
  background: rgba(232, 221, 209, 0.55);
}

.today-bar-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  min-height: 4px;
  border-radius: inherit;
  background: linear-gradient(180deg, var(--coral), #ffb092);
  animation: barRise 0.7s var(--ease-spring) both;
}

.today-bar-col.is-today .today-bar-fill {
  background: linear-gradient(180deg, var(--teal), #82d9ca);
}

.today-bar-label {
  color: var(--faint);
  font-size: 8.5px;
  font-weight: 600;
}

.today-bar-col.is-today .today-bar-label {
  color: var(--teal-deep);
  font-weight: 800;
}

.today-tip {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: 12px;
  padding-top: 12px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.55;
  border-top: 1px dashed var(--line);
}

.today-tip .icon {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  margin-top: 1px;
  color: var(--amber);
}

.recent-panel {
  padding: 20px 21px;
}

.recent-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 11px;
}

.recent-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid rgba(234, 223, 211, 0.7);
}

.recent-item:last-child {
  border-bottom: 0;
}

.recent-item-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  color: var(--mode-color, var(--teal));
  border-radius: 9px;
  background: var(--mode-soft, var(--teal-soft));
}

.recent-item-icon .icon {
  width: 15px;
  height: 15px;
}

.recent-item-copy {
  min-width: 0;
  flex: 1;
}

.recent-item-copy strong {
  display: block;
  overflow: hidden;
  font-size: 10.5px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-item-copy span {
  display: block;
  color: var(--faint);
  font-size: 9px;
}

.recent-result {
  font-size: 10px;
  font-weight: 750;
  color: var(--success-deep);
}

.recent-result.is-low {
  color: var(--danger-deep);
}

/* Empty / onboarding */
.empty-home {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(260px, 0.8fr);
  gap: 25px;
  padding: 38px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 30px;
  background:
    radial-gradient(circle at 100% 0, rgba(255, 194, 165, 0.32), transparent 45%),
    var(--surface);
  box-shadow: var(--shadow-card);
}

.empty-home::before {
  content: "";
  position: absolute;
  right: -80px;
  bottom: -100px;
  width: 300px;
  height: 300px;
  border: 1px dashed rgba(205, 155, 123, 0.25);
  border-radius: 50%;
}

.empty-home-copy {
  position: relative;
  z-index: 1;
}

.empty-home h2 {
  max-width: 450px;
  margin: 10px 0 12px;
  font-size: clamp(28px, 3.2vw, 41px);
  font-weight: 850;
  line-height: 1.2;
  letter-spacing: -0.045em;
}

.empty-home h2 em {
  color: var(--coral);
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
}

.empty-home p {
  max-width: 480px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.75;
}

.empty-steps {
  display: grid;
  gap: 7px;
  max-width: 400px;
  margin-top: 19px;
}

.empty-step {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 11px;
}

.empty-step b {
  display: grid;
  place-items: center;
  width: 19px;
  height: 19px;
  flex: 0 0 auto;
  color: var(--coral-deep);
  font-size: 9px;
  font-weight: 800;
  border-radius: 6px;
  background: var(--coral-soft);
}

.empty-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 22px;
}

.empty-fineprint {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 15px !important;
  color: var(--faint) !important;
  font-size: 9px !important;
  line-height: 1.5 !important;
}

.empty-fineprint .icon {
  width: 13px;
  height: 13px;
  color: var(--teal);
}

.first-steps {
  margin-top: 22px;
}

.first-steps-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 17px;
  border: 1px dashed #ddcbb9;
  border-radius: 16px;
  background: rgba(255, 252, 246, 0.55);
}

.first-steps-mark {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  flex: 0 0 auto;
  color: var(--amber);
  border-radius: 11px;
  background: var(--amber-soft);
}

.first-steps-mark .icon {
  width: 18px;
  height: 18px;
}

.first-steps-inner > div:nth-child(2) {
  flex: 1;
  min-width: 0;
}

.first-steps-inner strong {
  display: block;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 750;
}

.first-steps-inner p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.55;
}

.recent-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 178px;
  padding: 12px;
  margin-top: 6px;
  text-align: center;
}

.recent-empty-art {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: var(--violet);
  border-radius: 12px;
  background: var(--violet-soft);
}

.recent-empty-art .icon {
  width: 18px;
  height: 18px;
}

.recent-empty strong {
  margin-top: 9px;
  font-size: 11px;
  font-weight: 750;
}

.recent-empty p {
  margin: 2px 0 10px;
  color: var(--faint);
  font-size: 9px;
}

.empty-illustration {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  min-height: 230px;
}

.empty-stack {
  position: relative;
  width: 220px;
  height: 190px;
}

.empty-sheet {
  position: absolute;
  top: 20px;
  left: 17px;
  width: 184px;
  padding: 15px;
  border: 1px solid #eddfd2;
  border-radius: 17px;
  background: #fffdf8;
  box-shadow: 0 24px 36px -28px rgba(65, 42, 24, 0.55);
  transform: rotate(-5deg);
}

.empty-sheet--back {
  top: 32px;
  left: 31px;
  z-index: -1;
  height: 155px;
  background: #ffe7da;
  transform: rotate(7deg);
}

.empty-sheet-head {
  display: flex;
  gap: 4px;
}

.empty-sheet-head i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #e3d4c5;
}

.empty-sheet-head i:first-child {
  width: 15px;
  border-radius: 99px;
  background: var(--coral);
}

.empty-line {
  height: 7px;
  margin-top: 11px;
  border-radius: 99px;
  background: #f1e8dc;
}

.empty-line--short {
  width: 62%;
}

.empty-option {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  margin-top: 7px;
  padding: 0 7px;
  color: var(--muted);
  font-size: 8px;
  border: 1px solid #eee3d7;
  border-radius: 6px;
  background: #fffcf7;
}

.empty-option b {
  display: grid;
  place-items: center;
  width: 13px;
  height: 13px;
  font-size: 6px;
  color: var(--muted);
  border-radius: 3px;
  background: #f4ece2;
}

.empty-option.is-active {
  color: var(--success-deep);
  border-color: #c2e9db;
  background: var(--success-soft);
}

.empty-option.is-active b {
  color: white;
  background: var(--success);
}

.empty-paste {
  position: absolute;
  right: -2px;
  bottom: 8px;
  z-index: 3;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 11px;
  color: #fff;
  font-size: 9px;
  font-weight: 750;
  border-radius: 10px;
  background: var(--coral);
  box-shadow: 0 12px 22px -14px rgba(191, 55, 31, 0.8);
  transform: rotate(4deg);
}

.empty-paste .icon {
  width: 13px;
  height: 13px;
}

/* --------------------------------------------------------------------------
   Library
   -------------------------------------------------------------------------- */

.library-toolbar {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  margin-bottom: 13px;
}

.library-toolbar .search-field {
  flex: 1 1 220px;
}

.toolbar-select {
  flex: 0 0 auto;
  min-width: 128px;
}

.toolbar-select .select {
  height: 45px;
  font-size: 11.5px;
  background: rgba(255, 253, 248, 0.85);
}

.library-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
  padding: 0 2px;
}

.library-count {
  color: var(--muted);
  font-size: 10.5px;
}

.library-count strong {
  color: var(--ink);
  font-weight: 800;
}

.result-count-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 23px;
  padding: 0 8px;
  color: var(--muted);
  font-size: 9.5px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: rgba(255, 253, 248, 0.7);
}

.question-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.question-row {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  padding: 17px 17px 16px 20px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 1px 0 rgba(88, 62, 42, 0.025);
  cursor: pointer;
  transition: transform 0.18s var(--ease-spring), border-color 0.18s ease, box-shadow 0.18s ease;
}

.question-row::before {
  content: "";
  position: absolute;
  top: 17px;
  bottom: 17px;
  left: 0;
  width: 3px;
  border-radius: 0 4px 4px 0;
  background: var(--type-color, var(--teal));
  opacity: 0.75;
}

.question-row:hover {
  border-color: #ddcbbb;
  box-shadow: 0 15px 28px -27px rgba(67, 43, 25, 0.5);
  transform: translateY(-1px);
}

.question-row-main {
  min-width: 0;
}

.question-row-tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 7px;
}

.question-stem {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 680;
  line-height: 1.65;
  letter-spacing: -0.012em;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.question-options-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 7px;
}

.option-preview {
  max-width: 180px;
  overflow: hidden;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.6;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.option-preview b {
  margin-right: 2px;
  color: var(--faint);
  font-weight: 750;
}

.question-stats {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 9px;
}

.question-stat {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--faint);
  font-size: 9.5px;
}

.question-stat .icon {
  width: 12px;
  height: 12px;
}

.question-stat strong {
  color: var(--muted);
  font-weight: 700;
}

.question-row-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: space-between;
  gap: 9px;
  min-width: 118px;
}

.accuracy-box {
  display: flex;
  align-items: center;
  gap: 7px;
}

.mini-donut {
  --pct: 0;
  position: relative;
  display: grid;
  place-items: center;
  width: 37px;
  height: 37px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: conic-gradient(var(--ring-color, var(--teal)) calc(var(--pct) * 1%), #eee6dc 0);
}

.mini-donut::before {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: var(--surface);
}

.mini-donut span {
  position: relative;
  z-index: 1;
  font-size: 8px;
  font-weight: 800;
  color: var(--ink-soft);
}

.mini-donut.is-empty {
  background: #eee6dc;
}

.mini-donut.is-empty::before {
  background: var(--surface);
}

.mini-donut.is-empty span {
  color: var(--faint);
  font-size: 11px;
}

.panel-empty-note {
  padding: 18px 22px;
  color: var(--faint);
  font-size: 9.5px;
  line-height: 1.6;
}

.stats-encourage {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 16px 20px;
  margin-top: 13px;
}

.stats-encourage-icon {
  display: grid;
  place-items: center;
  width: 39px;
  height: 39px;
  flex: 0 0 auto;
  color: var(--violet);
  border-radius: 12px;
  background: var(--violet-soft);
}

.stats-encourage-icon .icon {
  width: 19px;
  height: 19px;
}

.stats-encourage > div {
  flex: 1;
  min-width: 0;
}

.stats-encourage strong {
  display: block;
  font-size: 11px;
  font-weight: 750;
}

.stats-encourage p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.55;
}

.manage-empty {
  padding: 22px;
  color: var(--faint);
  font-size: 10.5px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: 12px;
  background: #fdfaf5;
}

.settings-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 0 2px;
  flex-wrap: wrap;
}

.settings-inline .switch-copy {
  flex: 1;
  min-width: 180px;
}

.settings-small-note {
  margin-top: 8px;
  color: var(--faint);
  font-size: 8.5px;
  line-height: 1.6;
}

.settings-note .icon,
.settings-note > .icon {
  display: inline-block;
  width: 12px;
  height: 12px;
  margin-right: 3px;
  vertical-align: -2px;
}

.install-guide {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

.install-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.install-steps li {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.install-steps li > span {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  flex: 0 0 auto;
  color: var(--coral-deep);
  font-size: 10px;
  font-weight: 800;
  border-radius: 8px;
  background: var(--coral-soft);
}

.install-steps strong {
  display: block;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 750;
}

.install-steps p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.55;
}

.install-success {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px;
  border: 1px solid #cdeade;
  border-radius: 11px;
  background: var(--success-soft);
}

.install-success > .icon {
  width: 24px;
  height: 24px;
  color: var(--success);
  flex: 0 0 auto;
}

.install-success strong {
  display: block;
  color: var(--success-deep);
  font-size: 12px;
  font-weight: 750;
}

.install-success p {
  margin-top: 2px;
  color: var(--success-deep);
  font-size: 9.5px;
  opacity: 0.8;
}

.install-actions {
  margin-top: 3px;
}

.accuracy-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.accuracy-copy small {
  color: var(--faint);
  font-size: 8px;
}

.accuracy-copy strong {
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 750;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 5px;
}

.row-actions .btn {
  min-height: 31px;
  font-size: 10px;
  border-radius: 9px;
}

.row-more {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  color: var(--faint);
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
}

.row-more:hover {
  color: var(--ink);
  background: var(--surface-deep);
}

.row-more .icon {
  width: 14px;
  height: 14px;
}

.load-more {
  display: flex;
  justify-content: center;
  margin-top: 18px;
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 280px;
  padding: 38px 22px;
  text-align: center;
  border: 1px dashed #d8c7b6;
  border-radius: 24px;
  background: rgba(255, 253, 248, 0.55);
}

.empty-state-icon {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  color: var(--coral);
  border-radius: 20px;
  background: var(--coral-soft);
  transform: rotate(-5deg);
}

.empty-state-icon .icon {
  width: 28px;
  height: 28px;
}

.empty-state h3 {
  margin-top: 15px;
  font-size: 16px;
  font-weight: 800;
}

.empty-state p {
  max-width: 390px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.65;
}

.empty-state .btn {
  margin-top: 16px;
}

/* Question detail modal */
.detail-type-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 13px;
}

.detail-stem {
  color: var(--ink);
  font-size: 19px;
  font-weight: 730;
  line-height: 1.6;
  letter-spacing: -0.02em;
  white-space: pre-wrap;
}

.detail-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 18px;
}

.detail-option {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 9px 11px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.55;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fffdfa;
}

.detail-option b {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  border-radius: 7px;
  background: var(--surface-deep);
}

.detail-option.is-correct {
  color: var(--success-deep);
  border-color: #bce7d7;
  background: var(--success-soft);
}

.detail-option.is-correct b {
  color: #fff;
  background: var(--success);
}

.detail-option .check-mark {
  width: 15px;
  height: 15px;
  margin-left: auto;
  color: var(--success);
}

.detail-answer {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 16px;
  padding: 11px 13px;
  color: var(--success-deep);
  font-size: 12px;
  font-weight: 650;
  line-height: 1.55;
  border: 1px solid #cdeade;
  border-radius: 11px;
  background: var(--success-soft);
}

.detail-answer-label {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.07em;
  opacity: 0.7;
}

.detail-explanation {
  margin-top: 17px;
  padding: 14px;
  border-radius: 12px;
  background: #fbf6ee;
}

.detail-explanation h4 {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 5px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 800;
}

.detail-explanation h4 .icon {
  width: 14px;
  height: 14px;
  color: var(--amber);
}

.detail-explanation p {
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.75;
  white-space: pre-wrap;
}

.detail-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-top: 17px;
}

.detail-stat {
  padding: 10px;
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fffdf9;
}

.detail-stat strong {
  display: block;
  font-size: 17px;
  font-weight: 820;
  line-height: 1.2;
}

.detail-stat span {
  display: block;
  margin-top: 2px;
  color: var(--faint);
  font-size: 8.5px;
}

.detail-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 15px;
  color: var(--faint);
  font-size: 9.5px;
}

.detail-meta .tag {
  margin-left: auto;
}

/* --------------------------------------------------------------------------
   Wrong book
   -------------------------------------------------------------------------- */

.wrong-hero {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 24px;
  padding: 27px 29px;
  overflow: hidden;
  color: #fff9f2;
  border-radius: 26px;
  background:
    radial-gradient(circle at 86% 15%, rgba(255, 124, 106, 0.36), transparent 32%),
    linear-gradient(120deg, #2b2420, #3d2a26 66%, #4b2d26);
  box-shadow: 0 25px 54px -44px rgba(48, 27, 18, 0.9);
}

.wrong-hero::before {
  content: "";
  position: absolute;
  right: 23%;
  top: -100px;
  width: 250px;
  height: 250px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 50%;
}

.wrong-hero::after {
  content: "×";
  position: absolute;
  right: 30px;
  bottom: -33px;
  color: rgba(255, 129, 107, 0.1);
  font-family: var(--font-display);
  font-size: 190px;
  font-weight: 700;
  line-height: 1;
  pointer-events: none;
}

.wrong-hero-copy {
  position: relative;
  z-index: 1;
}

.wrong-hero-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #ffb8a7;
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.wrong-hero-kicker .icon {
  width: 14px;
  height: 14px;
}

.wrong-hero h2 {
  margin-top: 10px;
  font-size: clamp(24px, 2.7vw, 35px);
  font-weight: 830;
  line-height: 1.25;
  letter-spacing: -0.04em;
}

.wrong-hero h2 em {
  color: #ff9682;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
}

.wrong-hero p {
  max-width: 480px;
  margin-top: 8px;
  color: rgba(255, 247, 239, 0.55);
  font-size: 11.5px;
  line-height: 1.7;
}

.wrong-hero-side {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 16px;
}

.wrong-number {
  text-align: right;
}

.wrong-number strong {
  display: block;
  font-size: 45px;
  font-weight: 880;
  line-height: 1;
  letter-spacing: -0.05em;
}

.wrong-number span {
  display: block;
  margin-top: 3px;
  color: rgba(255, 246, 236, 0.5);
  font-size: 9px;
  letter-spacing: 0.08em;
}

.wrong-filter-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  margin: 18px 0 12px;
}

.wrong-filter-bar .select-wrap {
  min-width: 130px;
}

.wrong-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.wrong-row {
  padding: 17px 18px;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--surface);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.wrong-row:hover {
  border-color: #e1cdbf;
  box-shadow: 0 12px 26px -29px rgba(63, 40, 23, 0.55);
}

.wrong-row-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.wrong-row-main {
  min-width: 0;
  flex: 1;
}

.wrong-row h3 {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 680;
  line-height: 1.6;
}

.wrong-stats-line {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.wrong-row-side {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
}

.wrong-row-side .btn {
  min-height: 32px;
  font-size: 10px;
  border-radius: 9px;
}

.wrong-answer-details {
  margin-top: 11px;
  border-top: 1px dashed var(--line);
}

.wrong-answer-details summary {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 9px 0 2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 650;
  cursor: pointer;
  list-style: none;
}

.wrong-answer-details summary::-webkit-details-marker {
  display: none;
}

.wrong-answer-details summary .icon {
  width: 13px;
  height: 13px;
  transition: transform 0.2s ease;
}

.wrong-answer-details[open] summary .icon {
  transform: rotate(90deg);
}

.wrong-answer-inner {
  padding: 8px 0 2px;
}

.wrong-answer-inner .detail-answer {
  margin-top: 0;
}

.wrong-answer-inner .detail-explanation {
  margin-top: 8px;
}

.wrong-empty {
  margin-top: 18px;
}

/* --------------------------------------------------------------------------
   Stats
   -------------------------------------------------------------------------- */

.stats-summary {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(0, 1.4fr);
  gap: 13px;
}

.accuracy-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 23px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 25px;
  background:
    radial-gradient(circle at 100% 0%, rgba(151, 124, 255, 0.16), transparent 45%),
    var(--surface);
  box-shadow: var(--shadow-card);
}

.accuracy-dial {
  --pct: 0;
  position: relative;
  display: grid;
  place-items: center;
  width: 112px;
  height: 112px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: conic-gradient(from 220deg, var(--violet) calc(var(--pct) * 1%), #f0e9e0 0);
  transition: background 0.4s ease;
}

.accuracy-dial.is-empty {
  background: #f0e9e0;
}

.accuracy-dial::before {
  content: "";
  position: absolute;
  inset: 9px;
  border-radius: 50%;
  background: var(--surface);
  box-shadow: inset 0 0 0 1px rgba(232, 222, 213, 0.7);
}

.accuracy-dial-inner {
  position: relative;
  z-index: 1;
  text-align: center;
}

.accuracy-dial-inner strong {
  display: block;
  font-size: 25px;
  font-weight: 850;
  line-height: 1.1;
  letter-spacing: -0.05em;
}

.accuracy-dial-inner span {
  display: block;
  margin-top: 2px;
  color: var(--faint);
  font-size: 8px;
  letter-spacing: 0.04em;
}

.accuracy-copy h3 {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.accuracy-copy p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.6;
}

.accuracy-highlight {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 9px;
  padding: 4px 8px;
  color: var(--violet);
  font-size: 9px;
  font-weight: 700;
  border-radius: 6px;
  background: var(--violet-soft);
}

.accuracy-highlight .icon {
  width: 12px;
  height: 12px;
}

.stat-tiles {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.stat-tile {
  position: relative;
  padding: 15px 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 17px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.stat-tile::after {
  content: "";
  position: absolute;
  right: -18px;
  bottom: -23px;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: var(--tile-soft, var(--coral-soft));
  opacity: 0.8;
}

.stat-tile-top {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 9.5px;
}

.stat-tile-top .icon {
  width: 13px;
  height: 13px;
  color: var(--tile-color, var(--coral));
}

.stat-tile strong {
  display: block;
  margin-top: 6px;
  font-size: 24px;
  font-weight: 850;
  line-height: 1.1;
  letter-spacing: -0.045em;
}

.stat-tile strong small {
  margin-left: 2px;
  font-size: 9px;
  font-weight: 650;
  color: var(--faint);
}

.stat-tile-foot {
  position: relative;
  z-index: 1;
  margin-top: 2px;
  color: var(--faint);
  font-size: 8.5px;
}

.stats-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.18fr) minmax(280px, 0.82fr);
  gap: 13px;
  margin-top: 13px;
}

.stats-grid--even {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.activity-panel {
  padding-bottom: 19px;
}

.activity-chart {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  height: 150px;
  margin: 21px 22px 0;
  padding: 16px 15px 11px;
  border-radius: 14px;
  background:
    linear-gradient(to top, rgba(235, 224, 211, 0.35) 1px, transparent 1px) 0 0 / 100% 33.33%,
    #fffcf8;
  border: 1px solid #f0e5da;
}

.activity-bar-col {
  display: flex;
  align-items: center;
  flex: 1;
  flex-direction: column;
  justify-content: flex-end;
  gap: 6px;
  height: 100%;
}

.activity-bar-count {
  color: var(--faint);
  font-size: 8px;
  font-weight: 650;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.activity-bar-col:hover .activity-bar-count {
  opacity: 1;
}

.activity-bar-count.is-visible {
  opacity: 1;
}

.activity-bar {
  width: 100%;
  max-width: 28px;
  min-height: 3px;
  border-radius: 6px 6px 3px 3px;
  background: linear-gradient(180deg, #f7b18f, var(--coral));
  animation: barRise 0.75s var(--ease-spring) both;
}

.activity-bar-col.is-today .activity-bar {
  background: linear-gradient(180deg, #64d6c4, var(--teal));
}

.activity-bar.is-empty {
  background: #e6dbcf;
}

.activity-bar-label {
  color: var(--faint);
  font-size: 8.5px;
}

.activity-bar-col.is-today .activity-bar-label {
  color: var(--teal-deep);
  font-weight: 800;
}

.activity-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 12px 22px 0;
  color: var(--faint);
  font-size: 9.5px;
}

.activity-legend {
  display: flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--coral);
}

.legend-dot--teal {
  background: var(--teal);
}

.type-panel {
  padding-bottom: 16px;
}

.type-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 14px 21px 0;
}

.type-stat-row {
  display: flex;
  align-items: center;
  gap: 9px;
}

.type-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--type-color);
}

.type-stat-main {
  min-width: 0;
  flex: 1;
}

.type-stat-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--ink-soft);
  font-size: 10.5px;
  font-weight: 650;
}

.type-stat-top span {
  color: var(--faint);
  font-size: 9px;
}

.type-track {
  height: 4px;
  margin-top: 5px;
  overflow: hidden;
  border-radius: 99px;
  background: #f0e8de;
}

.type-track span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--type-color);
  transition: width 0.8s var(--ease-spring);
}

.type-stat-pct {
  width: 35px;
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  text-align: right;
}

.chapter-mastery-panel {
  padding-bottom: 18px;
}

.mastery-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 17px 22px 0;
}

.mastery-row {
  display: grid;
  grid-template-columns: minmax(86px, 0.8fr) minmax(0, 2fr) auto;
  align-items: center;
  gap: 11px;
}

.mastery-name {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--ink-soft);
  font-size: 10.5px;
  font-weight: 650;
}

.mastery-name i {
  width: 6px;
  height: 6px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--chapter-color);
}

.mastery-name span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mastery-track {
  height: 6px;
  overflow: hidden;
  border-radius: 99px;
  background: #f0e7dc;
}

.mastery-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--chapter-color);
  transition: width 0.8s var(--ease-spring);
}

.mastery-value {
  min-width: 37px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  text-align: right;
}

.mastery-value.is-empty {
  color: var(--faint);
  font-weight: 500;
}

.challenging-panel {
  padding-bottom: 13px;
}

.challenge-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 9px 12px 0;
}

.challenge-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 0;
  border-radius: 10px;
  background: transparent;
  text-align: left;
  transition: background 0.18s ease;
}

.challenge-item:hover {
  background: var(--surface-deep);
}

.challenge-rank {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  color: var(--faint);
  font-family: var(--font-display);
  font-size: 10px;
  font-weight: 700;
  border-radius: 7px;
  background: var(--surface-deep);
}

.challenge-item:first-child .challenge-rank {
  color: var(--coral-deep);
  background: var(--coral-soft);
}

.challenge-copy {
  min-width: 0;
  flex: 1;
}

.challenge-copy strong {
  display: block;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 10.5px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.challenge-copy span {
  display: block;
  margin-top: 1px;
  color: var(--faint);
  font-size: 8.5px;
}

.challenge-acc {
  flex: 0 0 auto;
  color: var(--danger-deep);
  font-size: 10px;
  font-weight: 750;
}

.recent-sessions-panel {
  margin-top: 13px;
  padding-bottom: 9px;
}

.session-list {
  display: flex;
  flex-direction: column;
  margin: 6px 20px 0;
}

.session-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 2px;
  border-bottom: 1px solid rgba(234, 223, 211, 0.7);
}

.session-row:last-child {
  border-bottom: 0;
}

.session-icon {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  flex: 0 0 auto;
  color: var(--mode-color);
  border-radius: 9px;
  background: var(--mode-soft);
}

.session-icon .icon {
  width: 15px;
  height: 15px;
}

.session-copy {
  min-width: 0;
  flex: 1;
}

.session-copy strong {
  display: block;
  color: var(--ink-soft);
  font-size: 10.5px;
}

.session-copy span {
  display: block;
  color: var(--faint);
  font-size: 8.5px;
}

.session-score {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--faint);
  font-size: 9px;
}

.session-score strong {
  color: var(--ink-soft);
  font-size: 11px;
}

.session-percent {
  display: grid;
  min-width: 38px;
  height: 24px;
  place-items: center;
  padding: 0 7px;
  color: var(--success-deep);
  font-size: 9px;
  font-weight: 750;
  border-radius: 6px;
  background: var(--success-soft);
}

.session-percent.is-low {
  color: var(--danger-deep);
  background: var(--danger-soft);
}

.stats-empty {
  margin-top: 13px;
}

/* --------------------------------------------------------------------------
   Import
   -------------------------------------------------------------------------- */

.import-header {
  align-items: center;
}

.import-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
}

.import-back:hover {
  color: var(--ink);
}

.import-back .icon {
  width: 14px;
  height: 14px;
}

.import-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(330px, 0.92fr);
  align-items: start;
  gap: 14px;
}

.import-editor {
  position: relative;
  padding: 21px;
}

.import-editor-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
}

.import-editor h2 {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 15px;
  font-weight: 800;
}

.import-editor h2 .icon {
  width: 18px;
  height: 18px;
  color: var(--coral);
}

.import-editor p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10.5px;
}

.import-textarea-wrap {
  position: relative;
}

.import-textarea {
  display: block;
  width: 100%;
  min-height: 385px;
  padding: 16px;
  color: var(--ink-soft);
  font-family: "SFMono-Regular", "Cascadia Code", "Consolas", "PingFang SC", monospace;
  font-size: 12px;
  line-height: 1.8;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background:
    linear-gradient(to right, rgba(239, 229, 217, 0.5) 1px, transparent 1px) 44px 0 / 100% 100% no-repeat,
    #fffdf9;
  resize: vertical;
  tab-size: 2;
}

.import-textarea::placeholder {
  color: #baaa9c;
}

.import-textarea:focus {
  outline: none;
  border-color: rgba(255, 107, 87, 0.6);
  box-shadow: 0 0 0 4px rgba(255, 107, 87, 0.08);
}

.import-textarea-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 7px;
  color: var(--faint);
  font-size: 9px;
}

.import-options {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 13px;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px dashed var(--line);
}

.import-option {
  min-width: 0;
}

.import-option .field-label {
  margin-bottom: 5px;
  font-size: 10.5px;
}

.import-option .select {
  height: 39px;
  font-size: 11px;
}

.import-check-row {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 6px;
}

.import-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 17px;
}

.import-actions .btn-primary {
  margin-left: auto;
}

.import-file-btn {
  position: relative;
}

.import-file-btn input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.format-help {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fbf6ee;
}

.format-help summary {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 12px;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  list-style: none;
}

.format-help summary::-webkit-details-marker {
  display: none;
}

.format-help summary .icon {
  width: 13px;
  height: 13px;
  color: var(--amber);
}

.format-help summary .help-chevron {
  width: 13px;
  height: 13px;
  margin-left: auto;
  color: var(--faint);
  transition: transform 0.2s ease;
}

.format-help[open] summary .help-chevron {
  transform: rotate(180deg);
}

.format-example {
  margin: 0 10px 10px;
  padding: 11px 12px;
  overflow-x: auto;
  color: var(--ink-soft);
  font-family: "SFMono-Regular", "Cascadia Code", "Consolas", "PingFang SC", monospace;
  font-size: 10px;
  line-height: 1.75;
  white-space: pre;
  border-radius: 8px;
  background: #fffdf9;
}

.format-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 0 12px 11px;
}

.format-hints span {
  padding: 3px 6px;
  color: var(--muted);
  font-size: 8.5px;
  border: 1px solid #eadccd;
  border-radius: 5px;
  background: #fffdf9;
}

.import-preview {
  position: sticky;
  top: 22px;
  display: flex;
  flex-direction: column;
  max-height: calc(100dvh - 44px);
  overflow: hidden;
  padding: 20px;
}

.import-preview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 13px;
  border-bottom: 1px solid var(--line);
}

.import-preview-head h2 {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 800;
}

.import-preview-head h2 .icon {
  width: 17px;
  height: 17px;
  color: var(--violet);
}

.import-preview-head p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9.5px;
}

.preview-count {
  display: grid;
  min-width: 49px;
  height: 42px;
  place-items: center;
  padding: 0 10px;
  color: var(--ink);
  font-size: 19px;
  font-weight: 830;
  line-height: 1;
  border-radius: 11px;
  background: var(--teal-soft);
}

.preview-count small {
  display: block;
  color: var(--teal-deep);
  font-size: 7px;
  font-weight: 650;
}

.preview-stats {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin: 12px 0;
}

.preview-stat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 7px;
  color: var(--muted);
  font-size: 9px;
  border-radius: 6px;
  background: var(--surface-deep);
}

.preview-stat strong {
  color: var(--ink-soft);
  font-weight: 800;
}

.preview-stat--warn strong {
  color: var(--danger-deep);
}

.preview-stat--new strong {
  color: var(--teal-deep);
}

.import-preview-scroll {
  flex: 1;
  min-height: 100px;
  margin: 0 -7px;
  padding: 0 7px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(151, 124, 102, 0.24) transparent;
}

.preview-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 230px;
  padding: 24px;
  text-align: center;
  border: 1px dashed var(--line-strong);
  border-radius: 13px;
  background: #fdfaf5;
}

.preview-empty-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: var(--violet);
  border-radius: 14px;
  background: var(--violet-soft);
}

.preview-empty-icon .icon {
  width: 21px;
  height: 21px;
}

.preview-empty strong {
  margin-top: 10px;
  font-size: 12px;
  font-weight: 750;
}

.preview-empty p {
  max-width: 240px;
  margin-top: 3px;
  color: var(--faint);
  font-size: 9.5px;
  line-height: 1.6;
}

.preview-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.preview-item {
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fffdf9;
}

.preview-item.is-warning {
  border-color: #f0d1a7;
  background: #fffaf1;
}

.preview-item.is-error {
  border-color: #f0c7c9;
  background: #fff7f7;
}

.preview-item.is-duplicate {
  border-color: #d8d1fa;
  background: #fbfaff;
}

.preview-item-top {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.preview-index {
  color: var(--faint);
  font-family: var(--font-display);
  font-size: 9px;
  font-weight: 700;
}

.preview-type {
  padding: 2px 5px;
  font-size: 7.5px;
  font-weight: 750;
  border-radius: 4px;
}

.preview-status {
  margin-left: auto;
  font-size: 8px;
  font-weight: 750;
}

.preview-status--ok {
  color: var(--success-deep);
}

.preview-status--warn {
  color: #a66506;
}

.preview-status--error {
  color: var(--danger-deep);
}

.preview-status--duplicate {
  color: #6550cf;
}

.preview-stem {
  display: -webkit-box;
  margin-top: 6px;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.55;
  white-space: pre-wrap;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.preview-options {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 5px;
}

.preview-option {
  color: var(--muted);
  font-size: 8.5px;
}

.preview-option.is-correct {
  color: var(--success-deep);
  font-weight: 650;
}

.preview-answer {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 5px;
  color: var(--success-deep);
  font-size: 8.5px;
  font-weight: 600;
}

.preview-answer .icon {
  width: 11px;
  height: 11px;
}

.preview-error-text {
  margin-top: 6px;
  color: var(--danger-deep);
  font-size: 8.5px;
  line-height: 1.5;
}

.preview-warning-text {
  margin-top: 5px;
  color: #99630e;
  font-size: 8px;
  line-height: 1.5;
}

.preview-more {
  display: block;
  margin: 10px auto 0;
  color: var(--muted);
  font-size: 9px;
  font-weight: 650;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  padding: 6px 12px;
  background: transparent;
}

.preview-footer {
  padding-top: 11px;
  border-top: 1px solid var(--line);
}

.preview-footer .btn {
  width: 100%;
}

.preview-footnote {
  margin-top: 7px;
  color: var(--faint);
  font-size: 8.5px;
  line-height: 1.5;
  text-align: center;
}

/* --------------------------------------------------------------------------
   Practice
   -------------------------------------------------------------------------- */

body.in-practice {
  overflow-x: hidden;
  background:
    radial-gradient(circle at 8% 8%, rgba(255, 184, 155, 0.22), transparent 30%),
    radial-gradient(circle at 92% 12%, rgba(116, 220, 203, 0.12), transparent 26%),
    var(--bg);
}

body.in-practice .app-shell {
  display: block;
}

body.in-practice .sidebar,
body.in-practice .mobile-header,
body.in-practice .bottom-nav {
  display: none !important;
}

body.in-practice .view {
  max-width: none;
  padding: 0;
}

.practice-view {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  animation: pageIn 0.35s var(--ease-spring) both;
}

.practice-top {
  position: sticky;
  top: 0;
  z-index: 20;
  padding-top: env(safe-area-inset-top);
  background: rgba(246, 241, 233, 0.82);
  border-bottom: 1px solid rgba(231, 219, 206, 0.72);
  backdrop-filter: blur(18px);
}

.practice-top-inner {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 1020px;
  height: 64px;
  margin: 0 auto;
  padding: 0 28px;
}

.practice-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 39px;
  height: 39px;
  flex: 0 0 auto;
  color: var(--ink-soft);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 253, 248, 0.7);
  transition: all 0.18s ease;
}

.practice-back:hover {
  color: var(--coral-deep);
  border-color: #e6c8bb;
  background: #fff;
}

.practice-back .icon {
  width: 19px;
  height: 19px;
}

.practice-context {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.practice-context-top {
  display: flex;
  align-items: center;
  gap: 7px;
}

.practice-mode-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-height: 21px;
  padding: 0 7px;
  color: var(--mode-color);
  font-size: 8.5px;
  font-weight: 800;
  border-radius: 5px;
  background: var(--mode-soft);
}

.practice-mode-pill .icon {
  width: 11px;
  height: 11px;
}

.practice-context strong {
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.practice-context > span {
  overflow: hidden;
  color: var(--faint);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.practice-top-side {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-left: auto;
}

.practice-timer {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--faint);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.practice-timer .icon {
  width: 13px;
  height: 13px;
}

.practice-counter {
  display: flex;
  align-items: baseline;
  gap: 2px;
  color: var(--faint);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.practice-counter strong {
  color: var(--ink);
  font-size: 15px;
  font-weight: 820;
}

.practice-exit {
  display: inline-grid;
  place-items: center;
  width: 35px;
  height: 35px;
  padding: 0;
  color: var(--faint);
  border: 0;
  border-radius: 9px;
  background: transparent;
}

.practice-exit:hover {
  color: var(--danger-deep);
  background: var(--danger-soft);
}

.practice-exit .icon {
  width: 17px;
  height: 17px;
}

.progress-track {
  position: relative;
  width: 100%;
  height: 3px;
  overflow: hidden;
  background: rgba(224, 211, 198, 0.5);
}

.progress-track > span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 0 99px 99px 0;
  background: linear-gradient(90deg, var(--coral), #ffad83);
  transition: width 0.55s var(--ease-spring);
}

.progress-track > span.is-review {
  background: linear-gradient(90deg, var(--violet), #b99cff);
}

.progress-track > span.is-blitz {
  background: linear-gradient(90deg, var(--coral), #ffb14c);
}

.practice-main {
  display: flex;
  flex: 1;
  justify-content: center;
  width: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 28px 45px;
}

.question-card {
  position: relative;
  width: 100%;
  align-self: flex-start;
  padding: 30px 32px 26px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background:
    radial-gradient(circle at 100% 0, rgba(255, 242, 225, 0.68), transparent 30%),
    var(--surface);
  box-shadow: 0 25px 64px -47px rgba(66, 45, 28, 0.6), inset 0 1px 0 #fff;
}

.question-card::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 32px;
  width: 58px;
  height: 4px;
  border-radius: 0 0 5px 5px;
  background: var(--mode-color, var(--teal));
}

.qcard-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 13px;
  margin-bottom: 17px;
}

.qcard-info {
  min-width: 0;
}

.qcard-tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.qcard-number {
  margin-left: auto;
  color: rgba(172, 154, 139, 0.5);
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 700;
  line-height: 0.9;
  letter-spacing: -0.04em;
}

.qcard-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 7px;
  color: var(--faint);
  font-size: 9.5px;
}

.qcard-meta .meta-text {
  font-size: 9.5px;
}

.qcard-meta strong {
  color: var(--muted);
  font-weight: 700;
}

.practice-stem {
  margin: 3px 0 23px;
  color: var(--ink);
  font-size: clamp(19px, 2.2vw, 24px);
  font-weight: 720;
  line-height: 1.65;
  letter-spacing: -0.022em;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.practice-options {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.option {
  --key-color: var(--coral);
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 12px 14px;
  overflow: hidden;
  text-align: left;
  color: var(--ink-soft);
  border: 1.5px solid var(--line);
  border-radius: 15px;
  background: #fffdfa;
  cursor: pointer;
  touch-action: pan-y;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  transition:
    border-color 0.18s ease,
    background 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.18s var(--ease-spring),
    opacity 0.18s ease;
}

.option:hover:not(:disabled) {
  border-color: var(--line-strong);
  background: #fff;
  transform: translateY(-1px);
  box-shadow: 0 8px 19px -18px rgba(63, 42, 25, 0.5);
}

.option-key {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  flex: 0 0 auto;
  color: var(--key-color);
  font-size: 11px;
  font-weight: 850;
  line-height: 1;
  border-radius: 9px;
  background: color-mix(in srgb, var(--key-color) 12%, white);
  transition: all 0.2s var(--ease-spring);
}

.option-text {
  flex: 1;
  padding-top: 3px;
  font-size: 13.5px;
  font-weight: 500;
  line-height: 1.6;
  overflow-wrap: anywhere;
}

.option-mark {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  flex: 0 0 auto;
  margin-top: 2px;
  color: var(--faint);
  border: 1px solid var(--line);
  border-radius: 7px;
  transition: all 0.2s var(--ease-spring);
}

.option-mark .icon {
  width: 14px;
  height: 14px;
}

.option-dot {
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.22;
}

.option.is-selected .option-dot,
.option.is-correct .option-dot,
.option.is-wrong .option-dot {
  opacity: 1;
}

.practice-text-input {
  min-height: 58px;
  padding: 15px 17px;
  font-size: 16px;
  font-weight: 550;
}

.desktop-hint {
  display: inline;
}

.option.is-selected {
  border-color: var(--key-color);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--key-color) 7%, #fffdfa), #fffdfa 66%);
  box-shadow: 0 7px 18px -18px color-mix(in srgb, var(--key-color) 80%, transparent);
}

.option.is-selected .option-key {
  color: #fff;
  background: var(--key-color);
  box-shadow: 0 5px 11px -7px var(--key-color);
  transform: scale(1.03);
}

.option.is-selected .option-mark {
  color: #fff;
  border-color: var(--key-color);
  background: var(--key-color);
}

.option.is-excluded {
  color: var(--faint);
  border-style: dashed;
  border-color: var(--line-strong);
  background: #f8f4ee;
  opacity: 0.65;
}

.option.is-excluded .option-text {
  text-decoration: line-through;
  text-decoration-thickness: 1px;
}

.option.is-excluded .option-key {
  color: var(--faint);
  background: #ede5db;
}

.option.is-excluded .option-mark {
  color: var(--faint);
  border-style: dashed;
}

.option.is-excluded::after {
  content: "已排除";
  position: absolute;
  top: 9px;
  right: 47px;
  padding: 1px 5px;
  color: var(--faint);
  font-size: 7.5px;
  font-weight: 650;
  border-radius: 4px;
  background: #fffdf9;
}

.option.is-correct {
  color: var(--success-deep);
  border-color: #35b88b;
  border-style: solid;
  background: linear-gradient(90deg, rgba(220, 249, 238, 0.9), #fbfffd 70%);
  opacity: 1;
  box-shadow: 0 8px 21px -21px rgba(11, 137, 91, 0.7);
}

.option.is-correct .option-key {
  color: #fff;
  background: var(--success);
}

.option.is-correct .option-text {
  font-weight: 650;
  text-decoration: none;
}

.option.is-correct .option-mark {
  color: #fff;
  border-color: var(--success);
  background: var(--success);
}

.option.is-correct::after {
  display: none;
}

.option.is-wrong {
  color: var(--danger-deep);
  border-color: #ea7b82;
  border-style: solid;
  background: linear-gradient(90deg, rgba(255, 235, 236, 0.92), #fffafb 70%);
  opacity: 1;
  animation: optionShake 0.34s ease both;
}

.option.is-wrong .option-key {
  color: #fff;
  background: var(--danger);
}

.option.is-wrong .option-text {
  text-decoration: none;
}

.option.is-wrong .option-mark {
  color: #fff;
  border-color: var(--danger);
  background: var(--danger);
}

.option.is-wrong::after {
  display: none;
}

.option:disabled {
  cursor: default;
}

.option:disabled:hover {
  transform: none;
  box-shadow: none;
}

.option.is-pressing {
  border-color: color-mix(in srgb, var(--key-color) 40%, var(--line));
  transform: scale(0.996);
}

.option.is-pressing::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--key-color) 10%, transparent),
    transparent 70%
  );
  animation: pressSweep var(--longpress, 0.46s) linear;
}

.option-tip {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  color: var(--faint);
  font-size: 9px;
  line-height: 1.5;
}

.option-tip .icon {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
}

.option-tip strong {
  color: var(--muted);
  font-weight: 650;
}

.option-tip .excluded-count {
  margin-left: auto;
  padding: 2px 6px;
  color: var(--muted);
  font-size: 8.5px;
  border-radius: 5px;
  background: var(--surface-deep);
}

.text-answer {
  margin-top: 4px;
}

.text-answer-label {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 650;
}

.text-answer-label .icon {
  width: 13px;
  height: 13px;
}

.text-answer-input {
  width: 100%;
  min-height: 61px;
  padding: 14px 16px;
  color: var(--ink);
  font-size: 15px;
  font-weight: 550;
  border: 1.5px solid var(--line-strong);
  border-radius: 14px;
  background: #fffdfa;
  resize: vertical;
}

.text-answer-input::placeholder {
  color: #b6a799;
  font-weight: 400;
  font-size: 12px;
}

.text-answer-input:focus {
  outline: none;
  border-color: var(--teal);
  box-shadow: 0 0 0 4px rgba(15, 181, 163, 0.1);
}

.text-answer-input:disabled {
  color: var(--ink-soft);
  background: #fbf6ee;
}

.text-answer-hint {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  color: var(--faint);
  font-size: 8.5px;
}

.practice-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 22px;
  padding-top: 17px;
  border-top: 1px dashed var(--line);
}

.practice-actions .btn-primary,
.practice-actions .btn-success {
  min-width: 137px;
}

.practice-actions-note {
  margin-right: auto;
  color: var(--faint);
  font-size: 9px;
}

.kbd {
  display: inline-grid;
  min-width: 20px;
  height: 19px;
  place-items: center;
  padding: 0 4px;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 8px;
  font-weight: 650;
  border: 1px solid var(--line-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: #fffdf9;
}

.feedback-card:focus {
  outline: none;
}

.feedback-card {
  position: relative;
  margin-top: 22px;
  padding: 18px;
  overflow: hidden;
  border: 1px solid #caeadd;
  border-radius: 20px;
  background:
    radial-gradient(circle at 100% 0, rgba(99, 214, 181, 0.2), transparent 32%),
    linear-gradient(140deg, #f3fdf8, #fdfffe);
  animation: feedbackIn 0.45s var(--ease-spring) both;
}

.feedback-card.is-wrong {
  border-color: #f1c9cc;
  background:
    radial-gradient(circle at 100% 0, rgba(245, 138, 143, 0.18), transparent 32%),
    linear-gradient(140deg, #fff8f8, #fffdfd);
}

.feedback-banner {
  display: flex;
  align-items: center;
  gap: 12px;
}

.feedback-icon {
  display: grid;
  place-items: center;
  width: 47px;
  height: 47px;
  flex: 0 0 auto;
  color: #fff;
  border-radius: 15px;
  background: linear-gradient(145deg, #3ecb9b, var(--success));
  box-shadow: 0 9px 21px -13px rgba(17, 162, 110, 0.8);
}

.feedback-card.is-wrong .feedback-icon {
  background: linear-gradient(145deg, #f27d84, var(--danger));
  box-shadow: 0 9px 21px -13px rgba(214, 63, 73, 0.8);
}

.feedback-icon svg {
  width: 25px;
  height: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.feedback-icon .draw-path {
  stroke-dasharray: 30;
  stroke-dashoffset: 30;
  animation: drawIn 0.5s 0.12s ease forwards;
}

.feedback-copy {
  flex: 1;
  min-width: 0;
}

.feedback-copy h3 {
  color: var(--success-deep);
  font-size: 17px;
  font-weight: 830;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

.feedback-card.is-wrong .feedback-copy h3 {
  color: var(--danger-deep);
}

.feedback-copy p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.55;
}

.feedback-score {
  display: flex;
  align-items: center;
  flex-direction: column;
  color: var(--success-deep);
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 700;
  line-height: 1;
}

.feedback-score small {
  margin-top: 2px;
  color: var(--faint);
  font-family: var(--font-sans);
  font-size: 7.5px;
  font-weight: 500;
}

.feedback-card.is-wrong .feedback-score {
  color: var(--danger);
}

.feedback-card.is-review {
  border-color: #ddd4ff;
  background:
    radial-gradient(circle at 100% 0, rgba(151, 124, 255, 0.16), transparent 34%),
    linear-gradient(140deg, #f7f4ff, #fdfcff);
}

.feedback-card.is-review .feedback-icon {
  color: #fff;
  background: linear-gradient(145deg, #a18aff, var(--violet));
  box-shadow: 0 9px 21px -13px rgba(112, 84, 231, 0.75);
}

.feedback-card.is-review .feedback-icon svg {
  width: 23px;
  height: 23px;
  stroke-width: 2;
}

.feedback-card.is-review .feedback-copy h3 {
  color: #5944c7;
}

.feedback-card.is-review .answer-reveal {
  border-color: #e1d9ff;
}

.feedback-card.is-review .answer-reveal-label .icon {
  color: var(--violet);
}

.feedback-card.is-review .blitz-next-hint {
  color: var(--violet);
}

.feedback-card.is-review .btn-primary {
  background: linear-gradient(135deg, #a087ff, var(--violet));
  box-shadow: 0 12px 22px -17px rgba(103, 74, 221, 0.9), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.feedback-card.is-review .btn-primary:hover {
  background: linear-gradient(135deg, #af98ff, #765ce9);
}

.btn-coral {
  color: var(--coral-deep);
  border-color: rgba(255, 107, 87, 0.25);
  background: rgba(255, 107, 87, 0.12);
}

.btn-coral:hover {
  color: #fff;
  background: var(--coral);
}

.answer-reveal {
  margin-top: 15px;
  padding: 12px 13px;
  border: 1px solid rgba(176, 229, 211, 0.8);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.68);
}

.feedback-card.is-wrong .answer-reveal {
  border-color: #f2d0d2;
}

.answer-reveal-label {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 6px;
  color: var(--faint);
  font-size: 8.5px;
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.answer-reveal-label .icon {
  width: 12px;
  height: 12px;
  color: var(--success);
}

.answer-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.answer-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  color: var(--success-deep);
  font-size: 10.5px;
  font-weight: 650;
  line-height: 1.4;
  border: 1px solid #c3e9dc;
  border-radius: 7px;
  background: #f5fffb;
}

.answer-chip b {
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  color: #fff;
  font-size: 7.5px;
  font-weight: 800;
  border-radius: 4px;
  background: var(--success);
}

.answer-chip.is-text {
  padding: 7px 9px;
  font-size: 12px;
  color: var(--ink-soft);
  border-color: #e7dacb;
  background: #fffdf8;
}

.answer-note-wrong {
  margin-top: 8px;
  color: var(--danger-deep);
  font-size: 10px;
  line-height: 1.55;
}

.answer-note-wrong strong {
  font-weight: 750;
}

.feedback-explanation {
  margin-top: 10px;
  padding: 13px;
  border: 1px solid rgba(235, 220, 203, 0.85);
  border-radius: 12px;
  background: rgba(255, 253, 247, 0.75);
}

.feedback-explanation-head {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 5px;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 800;
}

.feedback-explanation-head .icon {
  width: 14px;
  height: 14px;
  color: var(--amber);
}

.feedback-explanation p {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.8;
  white-space: pre-wrap;
}

.feedback-explanation p.is-empty {
  color: var(--faint);
  font-style: italic;
}

.feedback-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 13px;
}

.feedback-stat {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
  color: var(--faint);
  font-size: 9px;
}

.feedback-stat strong {
  color: var(--muted);
  font-weight: 700;
}

.feedback-actions {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.wrong-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 32px;
  padding: 0 9px;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 600;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf9;
}

.wrong-toggle:hover {
  color: var(--ink);
  border-color: var(--line-strong);
}

.wrong-toggle.is-active {
  color: #aa4e0c;
  border-color: #f0d3ae;
  background: #fffaf0;
}

.wrong-toggle .icon {
  width: 13px;
  height: 13px;
}

.blitz-next-hint {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--success-deep);
  font-size: 9.5px;
  font-weight: 650;
  opacity: 0;
  animation: fadeIn 0.3s 0.3s ease forwards;
}

.blitz-next-hint::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--success);
  animation: softPulse 1s infinite;
}

.review-banner {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: 15px;
  padding: 11px 13px;
  color: #5f4ac2;
  font-size: 10.5px;
  line-height: 1.6;
  border: 1px solid #ddd4ff;
  border-radius: 11px;
  background: #f7f4ff;
}

.review-banner .icon {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  margin-top: 1px;
}

.review-answer {
  margin-top: 20px;
  animation: feedbackIn 0.4s var(--ease-spring) both;
}

.practice-footer-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 24px calc(25px + env(safe-area-inset-bottom));
  color: rgba(155, 139, 126, 0.65);
  font-size: 8.5px;
  letter-spacing: 0.04em;
}

.practice-footer-note .icon {
  width: 12px;
  height: 12px;
}

/* --------------------------------------------------------------------------
   Result
   -------------------------------------------------------------------------- */

.result-view {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  width: 100%;
  min-height: 100dvh;
  padding: 38px 24px 55px;
}

.result-card {
  position: relative;
  width: 100%;
  max-width: 690px;
  margin-block: auto;
  padding: 34px;
  overflow: hidden;
  color: #fff9f1;
  border-radius: 30px;
  background:
    radial-gradient(circle at 85% 0, rgba(255, 123, 96, 0.42), transparent 36%),
    radial-gradient(circle at 0 100%, rgba(16, 181, 163, 0.22), transparent 36%),
    linear-gradient(135deg, #2b2420, #382a23);
  box-shadow: 0 35px 80px -50px rgba(43, 28, 18, 0.95);
  animation: resultIn 0.55s var(--ease-spring) both;
}

.result-card:focus {
  outline: none;
}

.result-card::before {
  content: "";
  position: absolute;
  top: -110px;
  right: -50px;
  width: 280px;
  height: 280px;
  border: 1px dashed rgba(255, 255, 255, 0.11);
  border-radius: 50%;
  animation: slowSpin 60s linear infinite;
}

.result-card::after {
  content: "";
  position: absolute;
  left: -80px;
  bottom: -130px;
  width: 280px;
  height: 280px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 50%;
}

.result-copy {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 23px;
}

.result-kicker {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #ffc3b3;
  font-size: 9.5px;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.result-kicker .icon {
  width: 14px;
  height: 14px;
}

.result-title {
  margin-top: 10px;
  font-size: clamp(27px, 4vw, 41px);
  font-weight: 820;
  line-height: 1.18;
  letter-spacing: -0.04em;
}

.result-title em {
  color: #ff9a83;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
}

.result-subtitle {
  margin-top: 7px;
  color: rgba(255, 247, 238, 0.5);
  font-size: 11px;
  line-height: 1.7;
}

.result-ring {
  --pct: 0;
  position: relative;
  display: grid;
  place-items: center;
  width: 124px;
  height: 124px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: conic-gradient(from 200deg, #ff8b70 calc(var(--pct) * 1%), rgba(255, 255, 255, 0.12) 0);
}

.result-ring::before {
  content: "";
  position: absolute;
  inset: 11px;
  border-radius: 50%;
  background: #322721;
}

.result-ring-inner {
  position: relative;
  z-index: 1;
  text-align: center;
}

.result-ring-inner strong {
  display: block;
  font-size: 31px;
  font-weight: 870;
  line-height: 1;
  letter-spacing: -0.06em;
}

.result-ring-inner strong small {
  font-size: 11px;
  font-weight: 600;
  opacity: 0.5;
}

.result-ring-inner span {
  display: block;
  margin-top: 3px;
  color: rgba(255, 247, 238, 0.42);
  font-size: 7.5px;
  letter-spacing: 0.06em;
}

.result-stats {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-top: 28px;
  padding: 15px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.result-stat {
  padding: 0 14px;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.result-stat:last-child {
  border-right: 0;
}

.result-stat strong {
  display: block;
  font-size: 27px;
  font-weight: 820;
  line-height: 1;
  letter-spacing: -0.045em;
}

.result-stat span {
  display: block;
  margin-top: 5px;
  color: rgba(255, 247, 238, 0.42);
  font-size: 8.5px;
}

.result-actions {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 22px;
}

.result-wrong {
  position: relative;
  z-index: 1;
  margin-top: 23px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.result-wrong summary {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 12px 0 4px;
  color: rgba(255, 247, 238, 0.48);
  font-size: 10px;
  cursor: pointer;
  list-style: none;
}

.result-wrong summary::-webkit-details-marker {
  display: none;
}

.result-wrong summary .icon {
  width: 14px;
  height: 14px;
}

.result-wrong-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

.result-wrong-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  color: rgba(255, 247, 238, 0.72);
  font-size: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
}

.result-wrong-item .result-wrong-mark {
  display: grid;
  place-items: center;
  width: 17px;
  height: 17px;
  flex: 0 0 auto;
  color: #ff9a83;
  border-radius: 4px;
  background: rgba(255, 107, 87, 0.12);
}

.result-wrong-item .icon {
  width: 10px;
  height: 10px;
}

.result-wrong-item span {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
}

.result-wrong-item small {
  margin-left: auto;
  color: rgba(255, 247, 238, 0.35);
  flex: 0 0 auto;
}

.result-decoration {
  position: absolute;
  top: 30px;
  right: 194px;
  color: var(--amber);
  opacity: 0.8;
  animation: starTwinkle 3s ease-in-out infinite;
}

.result-decoration .icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.result-again {
  position: relative;
  z-index: 1;
}

/* --------------------------------------------------------------------------
   Modals & sheets
   -------------------------------------------------------------------------- */

.modal-root {
  position: relative;
  z-index: 900;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(38, 28, 21, 0.45);
  backdrop-filter: blur(10px) saturate(0.9);
  animation: backdropIn 0.22s ease both;
}

.modal-backdrop.is-sheet {
  align-items: flex-end;
  padding: 0;
}

.modal {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 580px;
  max-height: min(88dvh, 860px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 26px;
  background: var(--surface);
  box-shadow: 0 42px 100px -35px rgba(33, 19, 10, 0.7);
  animation: modalIn 0.32s var(--ease-spring) both;
}

.modal--wide {
  max-width: 760px;
}

.modal--xl {
  max-width: 860px;
}

.modal--small {
  max-width: 420px;
}

.modal--sheet {
  max-width: 650px;
  margin-bottom: 16px;
  border-radius: 28px;
  animation: sheetIn 0.38s var(--ease-spring) both;
}

.modal-backdrop.is-sheet .modal {
  margin-bottom: 16px;
}

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 22px 24px 15px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(circle at 100% 0, rgba(255, 217, 199, 0.33), transparent 45%),
    var(--surface);
}

.modal-head-copy {
  min-width: 0;
}

.modal-eyebrow {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
  color: var(--coral-deep);
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.modal-title {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 20px;
  font-weight: 830;
  line-height: 1.3;
  letter-spacing: -0.03em;
}

.modal-title .icon {
  width: 21px;
  height: 21px;
  color: var(--coral);
}

.modal-subtitle {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.55;
}

.modal-close {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  flex: 0 0 auto;
  padding: 0;
  color: var(--faint);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 253, 248, 0.7);
  transition: all 0.18s ease;
}

.modal-close:hover {
  color: var(--ink);
  background: #fff;
}

.modal-close .icon {
  width: 17px;
  height: 17px;
}

.modal-body {
  flex: 1;
  min-height: 0;
  padding: 20px 24px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(151, 124, 102, 0.24) transparent;
}

.modal-body--flush {
  padding: 0;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  padding: 15px 24px calc(17px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.modal-footer .footer-spacer {
  margin-right: auto;
}

.modal-footer .btn {
  min-height: 42px;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-grid--three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.option-editor-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.option-editor-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

.option-editor-key {
  display: grid;
  place-items: center;
  width: 31px;
  height: 35px;
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-deep);
}

.option-editor-row .input {
  flex: 1;
  min-width: 0;
}

.answer-toggle {
  display: grid;
  place-items: center;
  width: 35px;
  height: 35px;
  flex: 0 0 auto;
  color: var(--faint);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf9;
}

.answer-toggle:hover {
  color: var(--success);
  border-color: #bfe7d8;
}

.answer-toggle.is-active {
  color: #fff;
  border-color: var(--success);
  background: var(--success);
}

.answer-toggle .icon {
  width: 15px;
  height: 15px;
}

.option-remove {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  flex: 0 0 auto;
  padding: 0;
  color: var(--faint);
  border: 0;
  border-radius: 7px;
  background: transparent;
}

.option-remove:hover {
  color: var(--danger-deep);
  background: var(--danger-soft);
}

.option-remove .icon {
  width: 14px;
  height: 14px;
}

.option-editor-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.editor-section {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fdfaf4;
}

.editor-section-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 750;
}

.editor-section-title .icon {
  width: 14px;
  height: 14px;
  color: var(--coral);
}

.editor-section-title span {
  margin-left: auto;
  color: var(--faint);
  font-size: 8.5px;
  font-weight: 500;
}

.inline-add {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 7px;
}

.inline-add .input {
  height: 35px;
  font-size: 11px;
}

.inline-add .btn {
  min-height: 35px;
  font-size: 10px;
}

.form-error {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  padding: 9px 10px;
  color: var(--danger-deep);
  font-size: 10px;
  line-height: 1.5;
  border: 1px solid #f0c9cb;
  border-radius: 8px;
  background: var(--danger-soft);
}

.form-error .icon {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  margin-top: 1px;
}

/* Start sheet */
.start-sheet .modal-head {
  padding-bottom: 16px;
}

.start-sheet-body {
  display: flex;
  flex-direction: column;
  gap: 17px;
}

.start-section-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 750;
}

.start-section-label span {
  color: var(--faint);
  font-size: 8.5px;
  font-weight: 500;
}

.start-scope-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.start-scope-row .select {
  height: 42px;
  font-size: 11.5px;
}

.scope-note {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 2px;
  color: var(--faint);
  font-size: 9px;
}

.scope-note .icon {
  width: 12px;
  height: 12px;
}

.mode-pick-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.mode-pick {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-height: 124px;
  padding: 12px;
  text-align: left;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: #fffdfa;
  transition: all 0.2s var(--ease-spring);
}

.mode-pick:hover {
  border-color: var(--line-strong);
  background: #fff;
}

.mode-pick.is-active {
  border-color: var(--mode-color);
  background:
    linear-gradient(155deg, var(--mode-soft), #fffdfa 78%);
  box-shadow: 0 8px 20px -19px var(--mode-color);
}

.mode-pick-icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  color: var(--mode-color);
  border-radius: 9px;
  background: var(--mode-soft);
}

.mode-pick.is-active .mode-pick-icon {
  color: #fff;
  background: var(--mode-color);
}

.mode-pick-icon .icon {
  width: 17px;
  height: 17px;
}

.mode-pick strong {
  margin-top: 8px;
  font-size: 11.5px;
  font-weight: 750;
}

.mode-pick-desc {
  margin-top: 2px;
  color: var(--muted);
  font-size: 8.5px;
  line-height: 1.45;
}

.mode-pick-desc--short {
  display: none;
}

.mode-pick-check {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  place-items: center;
  width: 16px;
  height: 16px;
  color: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: transparent;
}

.mode-pick.is-active .mode-pick-check {
  border-color: var(--mode-color);
  background: var(--mode-color);
}

.mode-pick-check .icon {
  width: 10px;
  height: 10px;
}

.start-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 13px;
}

.start-choice-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.start-choice {
  min-height: 35px;
  padding: 0 12px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 650;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fffdf9;
}

.start-choice:hover {
  border-color: var(--line-strong);
}

.start-choice.is-active {
  color: #fff;
  border-color: var(--ink);
  background: var(--ink);
}

.start-summary {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 12px;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.55;
  border-radius: 9px;
  background: var(--surface-deep);
}

.start-summary .icon {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  color: var(--amber);
}

.start-summary strong {
  color: var(--ink-soft);
  font-weight: 750;
}

.start-sheet .modal-footer {
  justify-content: space-between;
}

.start-sheet .modal-footer .btn-primary {
  flex: 1;
  max-width: 260px;
}

/* Manage list */
.manage-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.manage-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fffdf9;
}

.manage-row:hover {
  border-color: var(--line-strong);
}

.manage-swatch {
  width: 10px;
  height: 26px;
  flex: 0 0 auto;
  border-radius: 99px;
  background: var(--swatch);
}

.manage-name {
  min-width: 0;
  flex: 1;
}

.manage-name input {
  width: 100%;
  padding: 2px 0;
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 650;
  border: 0;
  border-bottom: 1px solid transparent;
  background: transparent;
}

.manage-name input:focus {
  outline: none;
  border-bottom-color: var(--line-strong);
}

.manage-subline {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--faint);
  font-size: 8.5px;
}

.manage-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: 0 0 auto;
}

.manage-icon {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  padding: 0;
  color: var(--faint);
  border: 0;
  border-radius: 6px;
  background: transparent;
}

.manage-icon:hover {
  color: var(--ink);
  background: var(--surface-deep);
}

.manage-icon.is-danger:hover {
  color: var(--danger-deep);
  background: var(--danger-soft);
}

.manage-icon:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

.manage-icon .icon {
  width: 14px;
  height: 14px;
}

.add-strip {
  display: flex;
  align-items: flex-end;
  gap: 7px;
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}

.add-strip .field {
  flex: 1;
}

.add-strip .select {
  height: 37px;
  font-size: 10.5px;
}

.add-strip .btn {
  min-height: 37px;
}

.type-manager-row .tag {
  margin-left: 2px;
}

.color-swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.color-swatch {
  width: 22px;
  height: 22px;
  padding: 0;
  border: 2px solid transparent;
  border-radius: 50%;
  background: var(--swatch);
  box-shadow: inset 0 0 0 2px var(--surface);
}

.color-swatch.is-active {
  border-color: var(--ink);
}

.type-preview {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 9px 11px;
  color: var(--muted);
  font-size: 9.5px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: #fdfaf5;
}

.type-preview strong {
  color: var(--tag-color, var(--ink));
}

/* Settings */
.settings-section {
  padding-bottom: 17px;
  border-bottom: 1px solid var(--line);
}

.settings-section:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.settings-section + .settings-section {
  margin-top: 17px;
}

.settings-title {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 800;
}

.settings-title .icon {
  width: 15px;
  height: 15px;
  color: var(--coral);
}

.settings-note {
  padding: 10px 11px;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.65;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #fbf7f1;
}

.data-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.storage-meter {
  margin-top: 11px;
}

.storage-meter-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--faint);
  font-size: 8.5px;
}

.storage-meter-track {
  height: 5px;
  margin-top: 5px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--surface-deep);
}

.storage-meter-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: var(--teal);
}

.settings-about {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 13px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #fdfaf5;
}

.settings-about-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  color: var(--coral);
  border-radius: 11px;
  background: var(--coral-soft);
}

.settings-about-icon .icon {
  width: 19px;
  height: 19px;
}

.settings-about strong {
  display: block;
  font-size: 11px;
  font-weight: 750;
}

.settings-about p {
  color: var(--faint);
  font-size: 8.5px;
  line-height: 1.5;
}

.danger-zone {
  padding: 13px;
  border: 1px solid #f0cfd1;
  border-radius: 11px;
  background: #fff8f8;
}

.danger-zone strong {
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--danger-deep);
  font-size: 10.5px;
  font-weight: 750;
}

.danger-zone strong .icon {
  width: 13px;
  height: 13px;
}

.danger-zone p {
  margin-top: 3px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.55;
}

.danger-zone .btn {
  margin-top: 9px;
}

/* Confirm */
.confirm-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 26px 24px 9px;
  text-align: center;
}

.confirm-icon {
  display: grid;
  place-items: center;
  width: 55px;
  height: 55px;
  color: var(--coral-deep);
  border-radius: 18px;
  background: var(--coral-soft);
}

.confirm-icon.is-danger {
  color: var(--danger-deep);
  background: var(--danger-soft);
}

.confirm-icon .icon {
  width: 25px;
  height: 25px;
}

.confirm-title {
  margin-top: 14px;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.confirm-text {
  max-width: 330px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.65;
}

.confirm-actions {
  display: flex;
  gap: 8px;
  width: 100%;
  margin-top: 20px;
}

.confirm-actions .btn {
  flex: 1;
}

/* Quick actions menu */
.quick-menu {
  position: absolute;
  z-index: 40;
  min-width: 150px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  box-shadow: var(--shadow-float);
  animation: popIn 0.16s var(--ease-spring) both;
}

.quick-menu button {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  min-height: 33px;
  padding: 0 9px;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 600;
  text-align: left;
  border: 0;
  border-radius: 7px;
  background: transparent;
}

.quick-menu button:hover {
  background: var(--surface-deep);
}

.quick-menu button.is-danger {
  color: var(--danger-deep);
}

.quick-menu .icon {
  width: 14px;
  height: 14px;
  color: var(--faint);
}

.quick-menu button.is-danger .icon {
  color: var(--danger);
}

/* --------------------------------------------------------------------------
   Toasts & confetti
   -------------------------------------------------------------------------- */

.toast-root {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1500;
  display: flex;
  flex-direction: column;
  gap: 7px;
  width: min(340px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 11px 13px;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.5;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 253, 248, 0.95);
  box-shadow: 0 18px 40px -24px rgba(45, 29, 18, 0.55);
  backdrop-filter: blur(12px);
  pointer-events: auto;
  animation: toastIn 0.32s var(--ease-spring) both;
}

.toast.is-leaving {
  animation: toastOut 0.24s ease forwards;
}

.toast-icon {
  display: grid;
  place-items: center;
  width: 23px;
  height: 23px;
  flex: 0 0 auto;
  color: var(--success-deep);
  border-radius: 7px;
  background: var(--success-soft);
}

.toast-icon .icon {
  width: 13px;
  height: 13px;
}

.toast--error .toast-icon {
  color: var(--danger-deep);
  background: var(--danger-soft);
}

.toast--info .toast-icon {
  color: var(--teal-deep);
  background: var(--teal-soft);
}

.toast-copy strong {
  display: block;
  font-size: 10.5px;
  font-weight: 750;
}

.toast-copy span {
  display: block;
  color: var(--muted);
  font-size: 9.5px;
  line-height: 1.5;
}

.toast-copy strong:only-child {
  color: var(--ink-soft);
}

.toast-action {
  margin-left: auto;
  padding: 2px;
  color: var(--coral-deep);
  font-size: 9.5px;
  font-weight: 700;
  border: 0;
  background: transparent;
}

.confetti-root {
  position: fixed;
  inset: 0;
  z-index: 1600;
  overflow: hidden;
  pointer-events: none;
}

.confetti-piece {
  position: absolute;
  top: -12px;
  left: var(--x);
  width: var(--size);
  height: calc(var(--size) * 1.55);
  border-radius: 2px;
  background: var(--color);
  transform: rotate(var(--rotate));
  animation: confettiFall var(--duration) var(--delay) cubic-bezier(0.16, 0.8, 0.45, 1) forwards;
}

/* --------------------------------------------------------------------------
   Animations
   -------------------------------------------------------------------------- */

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes backdropIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes sheetIn {
  from {
    opacity: 0;
    transform: translateY(40px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes feedbackIn {
  from {
    opacity: 0;
    transform: translateY(11px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes resultIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes drawIn {
  to { stroke-dashoffset: 0; }
}

@keyframes optionShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  55% { transform: translateX(3px); }
  80% { transform: translateX(-1px); }
}

@keyframes pressSweep {
  from { opacity: 1; clip-path: inset(0 100% 0 0); }
  to { opacity: 1; clip-path: inset(0 0 0 0); }
}

@keyframes loadingDot {
  0%, 100% { transform: translateY(0); opacity: 0.45; }
  50% { transform: translateY(-5px); opacity: 1; }
}

@keyframes splashSpin {
  to { transform: rotate(360deg); }
}

@keyframes slowSpin {
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

@keyframes splashBob {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-7px) rotate(2deg); }
}

@keyframes artFloat {
  0%, 100% { transform: translateY(0) rotate(-4deg); }
  50% { transform: translateY(-6px) rotate(-2.5deg); }
}

@keyframes starTwinkle {
  0%, 100% { opacity: 0.55; transform: scale(0.88) rotate(0); }
  50% { opacity: 1; transform: scale(1.08) rotate(12deg); }
}

@keyframes barRise {
  from { height: 0; opacity: 0.5; }
}

@keyframes countPulse {
  0%, 100% { transform: scale(1); }
  45% { transform: scale(1.22); }
}

@keyframes softPulse {
  0%, 100% { opacity: 0.35; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.15); }
}

@keyframes fadeIn {
  to { opacity: 1; }
}

@keyframes popIn {
  from { opacity: 0; transform: translateY(-4px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastIn {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes toastOut {
  to { opacity: 0; transform: translateY(6px) scale(0.98); }
}

@keyframes confettiFall {
  0% { transform: translate3d(0, -10px, 0) rotate(var(--rotate)); opacity: 1; }
  100% { transform: translate3d(var(--drift), 105vh, 0) rotate(calc(var(--rotate) + 420deg)); opacity: 0.15; }
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 252px minmax(0, 1fr);
  }

  .view {
    padding-left: 30px;
    padding-right: 30px;
  }

  .hero-card {
    grid-template-columns: minmax(0, 1.1fr) minmax(265px, 0.9fr);
    padding: 32px 30px 27px;
  }

  .hero-title {
    font-size: clamp(28px, 3.2vw, 39px);
  }

  .hero-art {
    transform: scale(0.92);
    transform-origin: center right;
  }

  .chapter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chapter-add {
    min-height: 180px;
  }
}

@media (max-width: 1040px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    display: none;
  }

  .mobile-header {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: calc(62px + env(safe-area-inset-top));
    padding: env(safe-area-inset-top) 20px 0;
    border-bottom: 1px solid rgba(233, 221, 209, 0.7);
    background: rgba(246, 241, 233, 0.82);
    backdrop-filter: blur(18px);
  }

  .brand--mobile {
    padding: 0;
  }

  .brand--mobile .brand-mark {
    width: 36px;
    height: 36px;
  }

  .brand--mobile .brand-copy strong {
    font-size: 18px;
  }

  .brand--mobile .brand-copy small {
    font-size: 7.5px;
  }

  .mobile-actions {
    display: flex;
    align-items: center;
    gap: 7px;
  }

  .mobile-actions .icon-button,
  .avatar-button {
    width: 38px;
    height: 38px;
    border-radius: 11px;
  }

  .bottom-nav {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: calc(10px + env(safe-area-inset-bottom));
    z-index: 80;
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    align-items: end;
    height: 66px;
    padding: 0 6px 5px;
    border: 1px solid rgba(229, 216, 203, 0.9);
    border-radius: 22px;
    background: rgba(255, 252, 247, 0.92);
    box-shadow: 0 20px 50px -25px rgba(49, 31, 18, 0.45), inset 0 1px 0 #fff;
    backdrop-filter: blur(20px) saturate(1.15);
  }

  .bottom-link {
    position: relative;
    display: flex;
    align-items: center;
    flex-direction: column;
    justify-content: flex-end;
    gap: 2px;
    height: 56px;
    padding-bottom: 4px;
    color: var(--faint);
    font-size: 8.5px;
    font-weight: 600;
  }

  .bottom-link .icon {
    width: 21px;
    height: 21px;
    transition: color 0.18s ease, transform 0.18s var(--ease-spring);
  }

  .bottom-link.is-active {
    color: var(--coral-deep);
  }

  .bottom-link.is-active .icon {
    color: var(--coral);
    transform: translateY(-1px) scale(1.05);
  }

  .bottom-link.is-active::before {
    content: "";
    position: absolute;
    top: 4px;
    width: 22px;
    height: 3px;
    border-radius: 99px;
    background: var(--coral);
  }

  .bottom-icon-wrap {
    position: relative;
    display: grid;
    place-items: center;
  }

  .bottom-dot {
    position: absolute;
    top: 1px;
    right: -3px;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--danger);
    box-shadow: 0 0 0 2px rgba(255, 252, 247, 0.92);
  }

  .bottom-add {
    display: flex;
    align-items: center;
    flex-direction: column;
    align-self: end;
    gap: 2px;
    padding-bottom: 2px;
    color: var(--coral-deep);
    font-size: 8.5px;
    font-weight: 650;
  }

  .bottom-add > span {
    display: grid;
    place-items: center;
    width: 49px;
    height: 49px;
    margin-top: -23px;
    color: #fff;
    border: 4px solid rgba(246, 241, 233, 0.95);
    border-radius: 50%;
    background: linear-gradient(145deg, #ff866d, var(--coral));
    box-shadow: 0 12px 25px -12px rgba(194, 61, 36, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  }

  .bottom-add > span .icon {
    width: 25px;
    height: 25px;
    stroke-width: 2.2;
  }

  .bottom-add em {
    font-style: normal;
  }

  .view {
    padding: 25px 24px 112px;
  }

  .page-top {
    margin-bottom: 22px;
  }

  .page-title {
    font-size: clamp(28px, 4.3vw, 37px);
  }

  .hero-card {
    min-height: 305px;
  }

  .hero-art {
    transform: scale(0.87);
  }

  .import-preview {
    position: relative;
    top: 0;
    max-height: none;
  }

  .import-preview-scroll {
    max-height: 460px;
  }

  .toast-root {
    bottom: calc(88px + env(safe-area-inset-bottom));
  }

  body.in-practice .toast-root {
    bottom: calc(20px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 820px) {
  .hero-card {
    grid-template-columns: minmax(0, 1fr) minmax(220px, 0.78fr);
    min-height: 292px;
    padding: 28px 25px 23px;
  }

  .hero-copy {
    font-size: 11.5px;
  }

  .hero-title {
    font-size: clamp(27px, 4.3vw, 36px);
  }

  .hero-art {
    transform: scale(0.78);
    transform-origin: center right;
  }

  .hero-metrics {
    margin-top: 21px;
    padding-top: 15px;
  }

  .mode-grid {
    grid-template-columns: 1fr;
  }

  .mode-card {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    align-items: center;
    column-gap: 12px;
    min-height: 0;
    padding: 13px 15px;
  }

  .mode-card::before {
    width: 95px;
    height: 95px;
    top: -55px;
  }

  .mode-icon {
    grid-row: 1 / 3;
    width: 38px;
    height: 38px;
    border-radius: 11px;
  }

  .mode-name {
    margin-top: 0;
    font-size: 13px;
  }

  .mode-description {
    margin-top: 1px;
    font-size: 10px;
  }

  .mode-footer {
    grid-row: 1 / 3;
    grid-column: 3;
    margin-top: 0;
    padding-top: 0;
    font-size: 0;
  }

  .mode-footer .icon {
    width: 17px;
    height: 17px;
  }

  .home-lower-grid {
    grid-template-columns: 1fr;
  }

  .stats-summary {
    grid-template-columns: 1fr;
  }

  .stats-grid,
  .stats-grid--even {
    grid-template-columns: 1fr;
  }

  .import-layout {
    grid-template-columns: 1fr;
  }

  .import-preview {
    order: 2;
  }

  .wrong-hero {
    grid-template-columns: minmax(0, 1fr);
    gap: 18px;
    padding: 23px;
  }

  .wrong-hero-side {
    justify-content: flex-start;
  }

  .wrong-number {
    text-align: left;
  }

  .wrong-number strong {
    font-size: 34px;
  }

  .question-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    padding: 14px 14px 13px 17px;
  }

  .question-row-side {
    min-width: 84px;
  }

  .accuracy-copy {
    display: none;
  }

  .question-options-preview {
    display: none;
  }

  .empty-home {
    grid-template-columns: 1fr;
    padding: 29px;
  }

  .empty-illustration {
    min-height: 195px;
    order: -1;
    transform: scale(0.87);
    margin: -15px 0;
  }

  .empty-home h2 {
    font-size: clamp(27px, 5.2vw, 35px);
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .form-grid--three {
    grid-template-columns: 1fr 1fr;
  }

  .start-grid {
    grid-template-columns: 1fr;
  }

  .practice-main {
    padding: 22px 20px 38px;
  }

  .question-card {
    padding: 23px 20px 21px;
    border-radius: 22px;
  }

  .question-card::before {
    left: 22px;
  }

  .practice-stem {
    margin-bottom: 18px;
  }

  .practice-top-inner {
    padding: 0 17px;
    height: 60px;
  }

  .result-view {
    padding: 22px 15px 36px;
  }

  .result-card {
    padding: 25px;
    border-radius: 24px;
  }

  .result-copy {
    align-items: flex-start;
    flex-direction: column;
  }

  .result-ring {
    width: 98px;
    height: 98px;
  }

  .result-ring-inner strong {
    font-size: 25px;
  }

  .result-decoration {
    display: none;
  }

  .modal-backdrop {
    padding: 14px;
  }

  .modal {
    max-height: 92dvh;
    border-radius: 22px;
  }

  .modal--sheet {
    max-height: 92dvh;
    border-radius: 24px 24px 0 0;
    margin-bottom: 0;
  }

  .modal-backdrop.is-sheet {
    padding: 0;
  }

  .modal-backdrop.is-sheet .modal {
    margin-bottom: 0;
  }

  .modal-head {
    padding: 18px 18px 13px;
  }

  .modal-body {
    padding: 17px 18px;
  }

  .modal-footer {
    padding: 13px 18px calc(14px + env(safe-area-inset-bottom));
  }

  .modal-title {
    font-size: 18px;
  }

  .start-sheet-body {
    gap: 15px;
  }

  .mode-pick-grid {
    gap: 6px;
  }

  .mode-pick {
    min-height: 116px;
    padding: 10px;
  }

  .mode-pick span {
    font-size: 8px;
  }

  .start-sheet .modal-footer .btn-primary {
    max-width: none;
  }

  .type-manager .add-strip {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .add-strip .field {
    flex-basis: 100%;
  }
}

@media (max-width: 600px) {
  .view {
    padding: 19px 15px 108px;
  }

  .mobile-header {
    padding-left: 15px;
    padding-right: 15px;
  }

  .page-top {
    align-items: flex-start;
    flex-direction: column;
    gap: 13px;
    margin-bottom: 18px;
  }

  .page-top .top-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .page-subtitle {
    font-size: 11.5px;
  }

  .eyebrow {
    font-size: 9px;
  }

  .home-top {
    align-items: flex-start;
  }

  .home-actions {
    width: 100%;
  }

  .home-actions .btn {
    flex: 1;
  }

  .hero-card {
    display: block;
    min-height: 0;
    padding: 24px 21px 22px;
    border-radius: 26px;
  }

  .hero-card::before {
    right: -80px;
    width: 230px;
    height: 230px;
  }

  .hero-kicker {
    font-size: 8px;
  }

  .hero-title {
    margin-top: 14px;
    font-size: clamp(28px, 8.3vw, 37px);
  }

  .hero-copy {
    max-width: 310px;
    font-size: 11px;
    line-height: 1.65;
  }

  .hero-actions {
    margin-top: 17px;
  }

  .hero-actions .btn {
    min-height: 41px;
    padding: 0 14px;
    font-size: 11.5px;
  }

  .hero-metrics {
    margin-top: 20px;
    padding-top: 14px;
  }

  .hero-metric {
    padding-right: 10px;
  }

  .hero-metric + .hero-metric {
    padding-left: 10px;
  }

  .hero-metric strong {
    font-size: 18px;
  }

  .hero-metric span {
    font-size: 8px;
  }

  .hero-art {
    display: none;
  }

  .section {
    margin-top: 26px;
  }

  .section-title {
    font-size: 17px;
  }

  .section-head {
    margin-bottom: 11px;
  }

  .mode-grid,
  .chapter-grid {
    gap: 8px;
  }

  .chapter-card {
    min-height: 168px;
    padding: 15px;
    border-radius: 18px;
  }

  .chapter-glyph {
    width: 38px;
    height: 38px;
    font-size: 17px;
    border-radius: 11px;
  }

  .chapter-name {
    font-size: 13px;
  }

  .chapter-actions-mini {
    display: none;
  }

  .chapter-middle {
    margin-top: 13px;
  }

  .chapter-card-bottom {
    padding-top: 11px;
  }

  .chapter-start {
    min-height: 29px;
    padding: 0 9px;
    font-size: 9px;
  }

  .chapter-add {
    min-height: 120px;
    border-radius: 18px;
  }

  .home-lower-grid {
    margin-top: 26px;
    gap: 9px;
  }

  .today-panel,
  .recent-panel {
    padding: 16px;
    border-radius: 18px;
  }

  .today-bars {
    height: 85px;
    gap: 6px;
    margin-top: 12px;
  }

  .today-bar-label {
    font-size: 7.5px;
  }

  .today-tip {
    font-size: 9px;
  }

  .empty-home {
    padding: 21px;
    border-radius: 24px;
  }

  .empty-illustration {
    min-height: 165px;
    transform: scale(0.75);
    margin: -30px 0 -20px;
  }

  .empty-home h2 {
    font-size: 28px;
  }

  .empty-home p {
    font-size: 11px;
  }

  .empty-actions .btn {
    flex: 1;
    min-width: 0;
    padding: 0 12px;
    font-size: 11px;
  }

  .library-toolbar {
    gap: 7px;
  }

  .library-toolbar .search-field {
    flex-basis: 100%;
  }

  .toolbar-select {
    flex: 1;
    min-width: 0;
  }

  .library-meta-row {
    font-size: 9.5px;
  }

  .question-row {
    grid-template-columns: minmax(0, 1fr);
    padding: 14px 14px 12px 16px;
    border-radius: 15px;
  }

  .question-row-side {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    min-width: 0;
    margin-top: 2px;
  }

  .accuracy-copy {
    display: flex;
  }

  .row-actions {
    margin-left: auto;
  }

  .question-stem {
    font-size: 12.5px;
  }

  .question-stats {
    gap: 8px;
  }

  .empty-state {
    min-height: 240px;
    padding: 30px 17px;
  }

  .wrong-hero {
    padding: 21px;
    border-radius: 22px;
  }

  .wrong-hero h2 {
    font-size: 26px;
  }

  .wrong-hero-side {
    align-items: flex-end;
    justify-content: space-between;
  }

  .wrong-row {
    padding: 14px;
    border-radius: 15px;
  }

  .wrong-row-top {
    flex-direction: column;
    gap: 9px;
  }

  .wrong-row-side {
    width: 100%;
    justify-content: flex-end;
  }

  .wrong-row h3 {
    font-size: 12.5px;
  }

  .wrong-filter-bar .select-wrap {
    flex: 1;
    min-width: 0;
  }

  .accuracy-card {
    flex-direction: column;
    align-items: flex-start;
    padding: 18px;
    gap: 14px;
  }

  .accuracy-dial {
    width: 96px;
    height: 96px;
  }

  .accuracy-card .accuracy-copy {
    display: block;
  }

  .stat-tiles {
    gap: 7px;
  }

  .stat-tile {
    padding: 12px 13px;
    border-radius: 14px;
  }

  .stat-tile strong {
    font-size: 21px;
  }

  .stats-grid {
    gap: 9px;
    margin-top: 9px;
  }

  .activity-chart {
    height: 125px;
    margin: 14px 14px 0;
    gap: 6px;
    padding: 13px 10px 8px;
  }

  .activity-bar {
    max-width: 23px;
  }

  .panel-head {
    padding: 17px 16px 0;
  }

  .activity-foot {
    margin-left: 16px;
    margin-right: 16px;
  }

  .type-list {
    padding-left: 16px;
    padding-right: 16px;
  }

  .mastery-list {
    padding-left: 16px;
    padding-right: 16px;
    gap: 10px;
  }

  .mastery-row {
    grid-template-columns: minmax(76px, 0.9fr) minmax(0, 1.6fr) auto;
    gap: 7px;
  }

  .challenge-list {
    padding-left: 8px;
    padding-right: 8px;
  }

  .session-list {
    margin-left: 14px;
    margin-right: 14px;
  }

  .import-editor {
    padding: 16px;
  }

  .import-textarea {
    min-height: 290px;
    padding: 12px;
    font-size: 11px;
    line-height: 1.75;
  }

  .import-options {
    grid-template-columns: 1fr;
    gap: 11px;
  }

  .import-check-row {
    gap: 9px;
  }

  .import-actions .btn-primary {
    width: 100%;
    margin-left: 0;
    order: 2;
  }

  .import-actions .btn-secondary {
    flex: 1;
  }

  .import-preview {
    padding: 15px;
    border-radius: 18px;
  }

  .preview-count {
    min-width: 45px;
    height: 39px;
  }

  .preview-stat {
    font-size: 8.5px;
  }

  .practice-top-inner {
    height: 56px;
    padding: 0 13px;
    gap: 8px;
  }

  .practice-back {
    width: 36px;
    height: 36px;
    border-radius: 10px;
  }

  .practice-context strong {
    max-width: 122px;
    font-size: 10.5px;
  }

  .practice-context > span {
    max-width: 122px;
    font-size: 8px;
  }

  .practice-mode-pill {
    font-size: 7.5px;
    padding: 0 5px;
  }

  .practice-timer {
    display: none;
  }

  .practice-counter strong {
    font-size: 13px;
  }

  .practice-exit {
    width: 32px;
    height: 32px;
  }

  .practice-main {
    padding: 14px 11px 33px;
  }

  .question-card {
    padding: 20px 15px 16px;
    border-radius: 20px;
  }

  .question-card::before {
    left: 18px;
    width: 44px;
    height: 3px;
  }

  .qcard-top {
    margin-bottom: 11px;
  }

  .qcard-number {
    font-size: 26px;
  }

  .qcard-meta {
    gap: 6px;
    margin-top: 5px;
    font-size: 8.5px;
  }

  .qcard-meta .meta-text {
    font-size: 8.5px;
  }

  .practice-stem {
    margin: 6px 0 17px;
    font-size: 18px;
    line-height: 1.68;
  }

  .practice-options {
    gap: 7px;
  }

  .option {
    min-height: 52px;
    padding: 10px 11px;
    gap: 9px;
    border-radius: 12px;
  }

  .option-key {
    width: 28px;
    height: 28px;
    font-size: 10px;
    border-radius: 8px;
  }

  .option-text {
    padding-top: 2px;
    font-size: 12.5px;
    line-height: 1.6;
  }

  .option-mark {
    width: 22px;
    height: 22px;
    margin-top: 3px;
    border-radius: 6px;
  }

  .option-mark .icon {
    width: 12px;
    height: 12px;
  }

  .option.is-excluded::after {
    right: 41px;
    top: 7px;
    font-size: 7px;
  }

  .option-tip {
    font-size: 8px;
    margin-top: 8px;
  }

  .practice-actions {
    margin-top: 16px;
    padding-top: 14px;
    flex-wrap: wrap;
  }

  .practice-actions-note {
    order: 3;
    width: 100%;
    margin: 2px 0 0;
    text-align: right;
  }

  .desktop-hint {
    display: none;
  }

  .practice-actions .btn-primary,
  .practice-actions .btn-success {
    flex: 1;
    min-width: 0;
  }

  .feedback-card {
    margin-top: 15px;
    padding: 14px;
    border-radius: 16px;
  }

  .feedback-icon {
    width: 41px;
    height: 41px;
    border-radius: 12px;
  }

  .feedback-icon svg {
    width: 22px;
    height: 22px;
  }

  .feedback-copy h3 {
    font-size: 15px;
  }

  .feedback-copy p {
    font-size: 9.5px;
  }

  .feedback-score {
    font-size: 21px;
  }

  .answer-reveal {
    margin-top: 12px;
    padding: 10px;
  }

  .answer-chip {
    font-size: 9.5px;
  }

  .feedback-explanation {
    padding: 10px;
  }

  .feedback-explanation p {
    font-size: 10.5px;
  }

  .feedback-bottom {
    align-items: flex-start;
    flex-direction: column;
    gap: 9px;
  }

  .feedback-actions {
    width: 100%;
    justify-content: space-between;
  }

  .feedback-actions .btn {
    margin-left: auto;
  }

  .blitz-next-hint {
    width: 100%;
    margin-bottom: 2px;
  }

  .practice-footer-note {
    display: none;
  }

  .result-card {
    padding: 22px 18px;
  }

  .result-title {
    font-size: 28px;
  }

  .result-stats {
    margin-top: 22px;
    padding: 13px 0;
  }

  .result-stat {
    padding: 0 8px;
  }

  .result-stat strong {
    font-size: 22px;
  }

  .result-stat span {
    font-size: 7.5px;
  }

  .result-actions .btn {
    flex: 1;
    min-width: 110px;
  }

  .modal-backdrop {
    padding: 0;
    align-items: flex-end;
  }

  .modal {
    max-height: 93dvh;
    border-radius: 22px 22px 0 0;
    animation: sheetIn 0.35s var(--ease-spring) both;
  }

  .modal-head {
    padding: 16px 16px 12px;
  }

  .modal-body {
    padding: 16px;
  }

  .modal-footer {
    padding: 12px 16px calc(13px + env(safe-area-inset-bottom));
  }

  .modal-close {
    width: 32px;
    height: 32px;
  }

  .modal-title {
    font-size: 17px;
  }

  .modal-subtitle {
    font-size: 9.5px;
  }

  .form-grid--three {
    grid-template-columns: 1fr;
  }

  .start-grid {
    gap: 12px;
  }

  .mode-pick {
    min-height: 109px;
    padding: 9px;
  }

  .mode-pick-icon {
    width: 27px;
    height: 27px;
    border-radius: 8px;
  }

  .mode-pick-icon .icon {
    width: 15px;
    height: 15px;
  }

  .mode-pick strong {
    font-size: 10.5px;
  }

  .mode-pick-desc {
    font-size: 8px;
    line-height: 1.4;
  }

  .mode-pick-desc--long {
    display: none;
  }

  .mode-pick-desc--short {
    display: block;
  }

  .library-view .top-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    width: 100%;
  }

  .library-view .top-actions .btn {
    width: 100%;
    min-height: 40px;
    padding: 0 9px;
    font-size: 11.5px;
  }

  .mode-pick-check {
    top: 7px;
    right: 7px;
    width: 14px;
    height: 14px;
  }

  .start-scope-row {
    grid-template-columns: 1fr;
  }

  .start-sheet .modal-footer {
    flex-wrap: nowrap;
  }

  .start-sheet .modal-footer .btn-primary {
    flex: 1;
  }

  .start-sheet .modal-footer .btn-ghost {
    flex: 0 0 auto;
  }

  .option-editor-row {
    gap: 5px;
  }

  .option-editor-key {
    width: 27px;
    height: 33px;
  }

  .answer-toggle {
    width: 33px;
    height: 33px;
  }

  .option-remove {
    width: 27px;
  }

  .manage-row {
    padding: 8px;
    gap: 6px;
  }

  .manage-actions {
    gap: 0;
  }

  .manage-icon {
    width: 25px;
    height: 25px;
  }

  .manage-name input {
    font-size: 11px;
  }

  .manage-subline {
    font-size: 8px;
  }

  .settings-section + .settings-section {
    margin-top: 14px;
  }

  .data-actions .btn {
    flex: 1;
    min-width: 92px;
    padding: 0 10px;
    font-size: 10px;
  }

  .toast-root {
    right: 12px;
    left: 12px;
    bottom: calc(84px + env(safe-area-inset-bottom));
    width: auto;
  }

  body.in-practice .toast-root {
    bottom: calc(14px + env(safe-area-inset-bottom));
  }

  .toast {
    border-radius: 11px;
  }

  .bottom-nav {
    left: 8px;
    right: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    height: 62px;
    border-radius: 19px;
  }

  .bottom-add > span {
    width: 46px;
    height: 46px;
    margin-top: -21px;
  }

  .bottom-link {
    height: 52px;
    font-size: 8px;
  }

  .bottom-link .icon {
    width: 19px;
    height: 19px;
  }

  .mini-donut {
    width: 32px;
    height: 32px;
  }
}

@media (max-width: 380px) {
  .page-title {
    font-size: 28px;
  }

  .hero-title {
    font-size: 27px;
  }

  .hero-actions .btn {
    flex: 1;
    padding: 0 10px;
    font-size: 10.5px;
  }

  .mode-pick {
    min-height: 105px;
  }

  .mode-pick-desc {
    display: none;
  }

  .mode-pick strong {
    font-size: 9.5px;
  }

  .stat-tiles {
    grid-template-columns: 1fr 1fr;
  }

  .stat-tile strong {
    font-size: 19px;
  }

  .practice-actions .btn {
    font-size: 11px;
  }

  .feedback-actions {
    flex-wrap: wrap;
  }

  .feedback-actions .btn {
    width: 100%;
    margin-left: 0;
  }

  .wrong-row-side .btn span {
    display: none;
  }
}

@media (pointer: coarse) {
  .desktop-hint {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

  .confetti-piece {
    display: none;
  }
}

@media print {
  .sidebar,
  .mobile-header,
  .bottom-nav,
  .toast-root,
  .confetti-root,
  .modal-root,
  .course-bar {
    display: none !important;
  }

  .app-shell {
    display: block;
  }

  .view {
    max-width: none;
    padding: 0;
  }

  body {
    background: white;
  }
}

/* --------------------------------------------------------------------------
   Courses (books)
   -------------------------------------------------------------------------- */

.course-bar {
  position: relative;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 22px;
  padding: 8px 10px;
  border: 1px solid rgba(223, 209, 194, 0.82);
  border-radius: 20px;
  background: rgba(255, 253, 248, 0.82);
  box-shadow: 0 10px 26px -24px rgba(66, 45, 28, 0.55);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.course-bar-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  padding-left: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.course-bar-label .icon {
  width: 16px;
  height: 16px;
  color: var(--coral);
}

.course-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1 1 auto;
  min-width: 0;
  overflow-x: auto;
  padding: 2px;
  scrollbar-width: none;
}

.course-tabs::-webkit-scrollbar {
  display: none;
}

.course-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: 0 0 auto;
  max-width: 220px;
  padding: 7px 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: 12.5px;
  font-weight: 650;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.course-tab > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.course-tab i {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--course-color, var(--coral));
  box-shadow: 0 0 0 3px var(--course-soft, var(--coral-soft));
}

.course-tab:hover {
  background: var(--surface-deep);
}

.course-tab.is-active {
  border-color: color-mix(in srgb, var(--course-color, var(--coral)) 24%, transparent);
  background: var(--course-soft, var(--coral-soft));
  color: var(--ink);
}

.course-tab:active {
  transform: scale(0.98);
}

.course-manage-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-raised);
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}

.course-manage-btn:hover {
  border-color: var(--coral);
  background: var(--coral-soft);
  color: var(--coral-deep);
}

.course-manage-btn .icon {
  width: 14px;
  height: 14px;
}

.manage-row.is-active-course {
  border-color: rgba(255, 107, 87, 0.24);
  background: linear-gradient(135deg, rgba(255, 240, 235, 0.7), rgba(255, 253, 248, 0.9));
}

.tag--success {
  color: var(--success-deep);
  background: var(--success-soft);
}

.import-course-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 650;
}

.import-course-chip span {
  width: 9px;
  height: 9px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--swatch, var(--coral));
  box-shadow: 0 0 0 4px rgba(255, 107, 87, 0.1);
}

.detail-page-ref {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 15px;
  padding: 7px 11px;
  border: 1px dashed var(--line-strong);
  border-radius: 999px;
  background: var(--surface-deep);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.detail-page-ref .icon {
  width: 14px;
  height: 14px;
  color: var(--amber);
}

/* Move question */

.move-intro {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background:
    radial-gradient(circle at 100% 0, rgba(255, 107, 87, 0.09), transparent 42%),
    var(--surface-deep);
}

.move-intro > div {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.move-intro strong {
  color: var(--ink);
  font-size: 14px;
}

.move-intro > span {
  max-width: 340px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
  text-align: right;
}

.move-course {
  margin-top: 18px;
}

.move-course-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 9px;
  color: var(--ink);
  font-size: 13px;
}

.move-course-head i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--swatch, var(--coral));
  box-shadow: 0 0 0 4px rgba(255, 107, 87, 0.08);
}

.move-course-head span {
  margin-left: auto;
  color: var(--faint);
  font-size: 11px;
  font-weight: 500;
}

.move-chapter-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.move-chapter {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-raised);
  color: var(--ink-soft);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.16s ease;
}

.move-chapter span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12.5px;
  font-weight: 650;
}

.move-chapter small {
  color: var(--faint);
  font-size: 10.5px;
}

.move-chapter:hover:not(:disabled) {
  border-color: rgba(255, 107, 87, 0.45);
  background: var(--coral-soft);
}

.move-chapter:active:not(:disabled) {
  transform: scale(0.985);
}

.move-chapter.is-current {
  border-color: transparent;
  background: var(--surface-deep);
  opacity: 0.55;
}

@media (max-width: 860px) {
  .course-bar {
    margin-bottom: 16px;
    border-radius: 16px;
  }

  .course-tab {
    max-width: 165px;
    padding: 7px 10px;
    font-size: 12px;
  }

  .move-chapter-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .move-intro {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .move-intro > span {
    max-width: none;
    text-align: left;
  }
}

@media (max-width: 560px) {
  .course-bar {
    gap: 6px;
    padding: 6px 7px;
  }

  .course-bar-label {
    padding-left: 2px;
  }

  .course-bar-label > span {
    display: none;
  }

  .course-tab {
    max-width: 132px;
    padding: 7px 9px;
  }

  .course-manage-btn {
    width: 34px;
    height: 34px;
    justify-content: center;
    padding: 0;
  }

  .course-manage-btn > span {
    display: none;
  }

  .move-chapter-grid {
    grid-template-columns: 1fr;
  }
}

/* --------------------------------------------------------------------------
   Subjective answer scoring
   -------------------------------------------------------------------------- */

.text-answer-area {
  width: 100%;
  min-height: 148px;
  padding: 14px 16px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  line-height: 1.85;
  outline: none;
  resize: vertical;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
  transition: border-color 0.18s ease, box-shadow 0.18s ease;
}

.text-answer-area:focus {
  border-color: var(--coral);
  box-shadow: 0 0 0 4px rgba(255, 107, 87, 0.1);
}

.text-answer-area:disabled {
  color: var(--muted);
  background: var(--surface-deep);
  opacity: 0.9;
}

.text-answer--rubric .text-answer-label {
  color: var(--blue);
}

.feedback-score--rubric {
  min-width: 78px;
  height: auto;
  padding: 9px 13px;
  border-radius: 16px;
  background: var(--blue-soft);
  color: var(--blue);
  font-family: var(--font-display);
  font-size: 26px;
  font-weight: 700;
  line-height: 1;
  text-align: center;
}

.feedback-score--rubric small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.04em;
}

.is-rubric-feedback .feedback-icon {
  background: var(--blue-soft);
  color: var(--blue);
}

.rubric-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 4px 0 10px;
}

.rubric-summary-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.rubric-summary-item span {
  color: var(--faint);
  font-size: 10.5px;
}

.rubric-summary-item strong {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 700;
}

.rubric-review {
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.rubric-review-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.rubric-review-head > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.rubric-review-head .icon {
  width: 15px;
  height: 15px;
  color: var(--blue);
}

.rubric-review-head small {
  color: var(--faint);
  font-size: 10px;
  font-weight: 500;
}

.rubric-points {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.rubric-point {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 34px;
  padding: 6px 9px;
  border-radius: 10px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.55;
}

.rubric-point.is-hit {
  background: var(--success-soft);
}

.rubric-point.is-missing {
  background: var(--danger-soft);
}

.rubric-point-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--surface-deep);
  color: var(--faint);
}

.rubric-point.is-hit .rubric-point-state {
  background: var(--success);
  color: white;
}

.rubric-point.is-missing .rubric-point-state {
  background: var(--danger);
  color: white;
}

.rubric-point-state .icon {
  width: 12px;
  height: 12px;
}

.rubric-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--faint);
}

.rubric-point-label {
  flex: 1 1 auto;
  min-width: 0;
}

.rubric-point > strong {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
}

.rubric-point > strong small {
  margin-left: 2px;
  font-size: 9px;
  font-weight: 500;
}

.rubric-empty {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin-top: 13px;
  padding: 11px 13px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-deep);
  color: var(--muted);
  font-size: 11.5px;
  line-height: 1.65;
}

.rubric-empty .icon {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  margin-top: 1px;
  color: var(--amber);
}

.your-answer-block {
  margin-top: 12px;
  padding-top: 11px;
  border-top: 1px dashed var(--line);
}

.your-answer-block > span {
  display: block;
  margin-bottom: 5px;
  color: var(--faint);
  font-size: 10.5px;
  font-weight: 650;
}

.your-answer-block p {
  margin: 0;
  white-space: pre-wrap;
  color: var(--ink-soft);
  font-size: 12.5px;
  line-height: 1.75;
}

@media (max-width: 640px) {
  .rubric-summary {
    gap: 6px;
  }

  .rubric-summary-item {
    padding: 8px 9px;
  }

  .rubric-summary-item strong {
    font-size: 16px;
  }

  .rubric-summary-item span {
    font-size: 9.5px;
  }

  .rubric-review {
    padding: 11px 12px;
  }

  .feedback-banner {
    flex-wrap: wrap;
  }

  .feedback-score--rubric {
    margin-left: auto;
  }
}

/* Question extras: notes, comments, history */

.question-extras {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px dashed var(--line);
}

.extra-section {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.extra-head {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.extra-head .icon {
  width: 15px;
  height: 15px;
  color: var(--coral);
}

.extra-head span {
  margin-left: auto;
  color: var(--faint);
  font-size: 10px;
  font-weight: 500;
}

.extra-textarea {
  width: 100%;
  margin-top: 9px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-raised);
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  line-height: 1.7;
  outline: none;
  resize: vertical;
}

.extra-textarea:focus {
  border-color: var(--coral);
}

.extra-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 8px;
}

.extra-saved {
  color: var(--success-deep);
  font-size: 11px;
}

.comment-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 9px;
}

.comment-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 9px;
  background: var(--surface-deep);
}

.comment-item > div {
  min-width: 0;
  flex: 1 1 auto;
}

.comment-item p {
  margin: 0;
  white-space: pre-wrap;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.65;
}

.comment-item small {
  display: block;
  margin-top: 3px;
  color: var(--faint);
  font-size: 9.5px;
}

.comment-delete {
  flex: 0 0 auto;
  padding: 3px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--faint);
  cursor: pointer;
}

.comment-delete:hover {
  color: var(--danger);
  background: var(--danger-soft);
}

.comment-delete .icon {
  width: 13px;
  height: 13px;
}

.comment-compose {
  display: flex;
  align-items: flex-end;
  gap: 7px;
  margin-top: 9px;
}

.comment-compose .extra-textarea {
  margin-top: 0;
  flex: 1 1 auto;
}

.extra-empty {
  margin: 9px 0 0;
  color: var(--faint);
  font-size: 11px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 9px;
}

.history-item {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-raised);
  overflow: hidden;
}

.history-item summary {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  color: var(--muted);
  font-size: 10px;
  cursor: pointer;
  list-style: none;
}

.history-item summary::-webkit-details-marker {
  display: none;
}

.history-item summary strong {
  margin-left: auto;
  color: var(--ink-soft);
  font-size: 11px;
}

.history-item summary small {
  color: var(--faint);
  font-size: 9px;
}

.history-item > p {
  margin: 0;
  padding: 0 10px 10px;
  white-space: pre-wrap;
  color: var(--ink-soft);
  font-size: 11.5px;
  line-height: 1.7;
}

/* Course materials */

.material-filter-bar {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.material-filter {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.material-filter em {
  color: var(--faint);
  font-size: 10px;
  font-style: normal;
}

.material-filter:hover {
  border-color: var(--coral);
}

.material-filter.is-active {
  border-color: transparent;
  background: var(--coral-soft);
  color: var(--coral-deep);
}

.material-filter.is-active em {
  color: var(--coral-deep);
}

.material-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.material-card {
  display: flex;
  align-items: flex-start;
  gap: 13px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.material-file-icon {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 50px;
  height: 58px;
  flex: 0 0 auto;
  border-radius: 10px;
  background: var(--blue-soft);
  color: var(--blue);
}

.material-file-icon .icon {
  width: 22px;
  height: 22px;
  opacity: 0.7;
}

.material-file-icon span {
  position: absolute;
  right: 4px;
  bottom: 4px;
  padding: 1px 3px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.8);
  font-size: 7px;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.material-file-icon[data-kind="pdf"] {
  background: var(--coral-soft);
  color: var(--coral-deep);
}

.material-file-icon[data-kind="image"] {
  background: var(--success-soft);
  color: var(--success-deep);
}

.material-card-body {
  min-width: 0;
  flex: 1 1 auto;
}

.material-card-top {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.material-card-top h3 {
  min-width: 0;
  flex: 1 1 auto;
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
}

.material-card-top .tag {
  flex: 0 0 auto;
  font-size: 9px;
}

.material-file-meta {
  margin: 5px 0 0;
  color: var(--faint);
  font-size: 10px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.material-note {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.material-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}

.material-actions .btn {
  padding: 5px 8px;
  font-size: 10.5px;
}

.material-delete:hover {
  color: var(--danger);
}

@media (max-width: 760px) {
  .material-grid {
    grid-template-columns: 1fr;
  }
}

/* Private cloud sync */

.settings-status {
  float: right;
  color: var(--faint);
  font-size: 10px;
  font-weight: 500;
  line-height: 1.8;
}

.cloud-connection-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 11px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.cloud-connection-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 10px;
  background: var(--teal-soft);
  color: var(--teal-deep);
}

.cloud-connection-icon .icon {
  width: 17px;
  height: 17px;
}

.cloud-connection-row > div {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cloud-connection-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-size: 12px;
}

.cloud-connection-row small {
  color: var(--faint);
  font-size: 10px;
}

.cloud-conflict {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.cloud-conflict-item {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.cloud-conflict-item span,
.cloud-conflict-item small {
  color: var(--faint);
  font-size: 10px;
}

.cloud-conflict-item strong {
  color: var(--ink);
  font-size: 15px;
}

.cloud-conflict-note {
  margin: 13px 0 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}

.cloud-backup-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cloud-backup-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.cloud-backup-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  border-radius: 8px;
  background: var(--blue-soft);
  color: var(--blue);
}

.cloud-backup-icon .icon {
  width: 14px;
  height: 14px;
}

.cloud-backup-row > div {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cloud-backup-row strong {
  color: var(--ink-soft);
  font-size: 11.5px;
}

.cloud-backup-row small {
  color: var(--faint);
  font-size: 9.5px;
}

/* Chapter drill-down: course → chapter → type → questions */

.chapter-card-actions {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.chapter-card-actions .chapter-start {
  padding: 7px 9px;
}

.library-breadcrumb {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  margin: 4px 0 9px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.library-breadcrumb button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
}

.library-breadcrumb button:hover {
  background: var(--surface-deep);
  color: var(--ink);
}

.library-breadcrumb button.is-current {
  background: var(--coral-soft);
  color: var(--coral-deep);
}

.library-breadcrumb .icon {
  width: 13px;
  height: 13px;
}

.breadcrumb-sep {
  display: inline-flex;
  color: var(--faint);
}

.breadcrumb-current {
  padding: 5px 8px;
  color: var(--coral-deep);
  font-weight: 700;
}

.library-type-browser {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding: 1px 0 12px;
  scrollbar-width: none;
}

.library-type-browser::-webkit-scrollbar {
  display: none;
}

.library-type-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.library-type-chip i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--type-color, var(--teal));
}

.library-type-chip em {
  color: var(--faint);
  font-size: 9.5px;
  font-style: normal;
}

.library-type-chip:hover {
  border-color: var(--type-color, var(--coral));
}

.library-type-chip.is-active {
  border-color: var(--type-color, var(--coral));
  background: var(--type-soft, var(--coral-soft));
  color: var(--ink);
}

.merge-chapter-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
  max-height: 340px;
  overflow-y: auto;
  padding-right: 3px;
}

.merge-chapter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: pointer;
}

.merge-chapter-row:has(input:checked) {
  border-color: rgba(255, 107, 87, 0.45);
  background: var(--coral-soft);
}

.merge-chapter-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--coral);
}

.merge-chapter-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.merge-chapter-copy strong {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 12px;
}

.merge-chapter-copy small {
  overflow-wrap: anywhere;
  color: var(--faint);
  font-size: 9.5px;
  line-height: 1.5;
}

.bulk-move-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.bulk-move-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-height: 320px;
  overflow-y: auto;
  padding: 2px 3px 2px 0;
}

.bulk-move-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  cursor: pointer;
}

.bulk-move-row:has(input:checked) {
  border-color: rgba(255, 107, 87, 0.42);
  background: var(--coral-soft);
}

.bulk-move-row input {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
  margin-top: 1px;
  accent-color: var(--coral);
}

.bulk-move-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.bulk-move-copy strong {
  overflow-wrap: anywhere;
  color: var(--ink-soft);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.5;
}

.bulk-move-copy small {
  color: var(--faint);
  font-size: 9.5px;
}

@media (max-width: 640px) {
  .bulk-move-list {
    max-height: 260px;
  }
}

/* Home chapters: one horizontal row per chapter */

.chapter-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chapter-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.chapter-row-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 12px;
  background: var(--chapter-soft);
  color: var(--chapter);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 700;
}

.chapter-row-body {
  flex: 1 1 auto;
  min-width: 0;
}

.chapter-row-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.chapter-row-title h3 {
  min-width: 0;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.chapter-row-title span {
  flex: 0 0 auto;
  color: var(--faint);
  font-size: 9.5px;
}

.chapter-row-progress {
  height: 4px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-deep);
}

.chapter-row-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--chapter);
  transition: width 0.35s var(--ease-spring);
}

.chapter-row-meta {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
  margin-top: 5px;
  color: var(--faint);
  font-size: 9.5px;
}

.chapter-row-meta span + span::before {
  content: '·';
  margin-right: 9px;
  color: var(--line-strong);
}

.chapter-row-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex: 0 0 auto;
}

.chapter-row-actions .btn {
  padding: 6px 9px;
  font-size: 10.5px;
}

.chapter-add-row {
  display: flex;
  align-items: center;
  gap: 7px;
  width: 100%;
  padding: 11px 14px;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.chapter-add-row .icon {
  width: 14px;
  height: 14px;
  color: var(--coral);
}

.chapter-add-row small {
  margin-left: auto;
  color: var(--faint);
  font-size: 9.5px;
  font-weight: 500;
}

.chapter-add-row:hover {
  border-color: var(--coral);
  background: var(--coral-soft);
  color: var(--coral-deep);
}

.chapter-layout-toggle {
  display: inline-flex;
  align-items: center;
  gap: 1px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.chapter-layout-toggle button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 24px;
  padding: 0;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--faint);
  cursor: pointer;
}

.chapter-layout-toggle button.is-active {
  background: var(--surface-deep);
  color: var(--ink);
}

.chapter-layout-toggle .icon {
  width: 13px;
  height: 13px;
}

.chapter-list {
  gap: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.chapter-line {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.16s ease;
}

.chapter-line:hover {
  background: var(--surface-deep);
}

.chapter-line-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--chapter);
  box-shadow: 0 0 0 3px var(--chapter-soft);
}

.chapter-line-copy {
  min-width: 0;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chapter-line-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-size: 12.5px;
  font-weight: 700;
}

.chapter-line-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--faint);
  font-size: 9px;
  font-weight: 500;
}

.chapter-line-progress {
  width: 66px;
  height: 4px;
  flex: 0 0 auto;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-deep);
}

.chapter-line-progress i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--chapter);
}

.chapter-line-count {
  width: 44px;
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  text-align: right;
}

.chapter-line-arrow {
  display: inline-flex;
  color: var(--faint);
}

.chapter-line-arrow .icon {
  width: 14px;
  height: 14px;
}

.chapter-list .chapter-add-row {
  border: 0;
  border-radius: 0;
  background: transparent;
}

.chapter-list .chapter-add-row:hover {
  background: var(--coral-soft);
}

@media (max-width: 620px) {
  .chapter-line {
    min-height: 49px;
    padding: 10px 12px;
  }

  .chapter-line-copy strong {
    font-size: 12px;
  }

  .chapter-line-progress {
    width: 48px;
  }

  .chapter-line-count {
    width: 38px;
    font-size: 9.5px;
  }

  .chapter-line-copy small {
    font-size: 8.5px;
  }

  .chapter-list .chapter-add-row {
    padding: 10px 12px;
  }
}

@media (max-width: 620px) {
  .chapter-row {
    flex-wrap: wrap;
    gap: 9px;
    padding: 11px 12px;
  }

  .chapter-row-mark {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    font-size: 12px;
  }

  .chapter-row-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .chapter-row-actions .btn {
    padding: 6px 8px;
  }

  .chapter-add-row small {
    display: none;
  }
}

/* Chapter detail: filters + answer-card circles */

.chapter-summary-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 14px;
}

.chapter-summary-row > div {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
}

.chapter-summary-row strong {
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 700;
}

.chapter-summary-row span {
  color: var(--faint);
  font-size: 9.5px;
}

.chapter-filter-panel {
  margin-bottom: 14px;
  padding: 4px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.chapter-filter-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
}

.chapter-filter-row:last-child {
  border-bottom: 0;
}

.chapter-filter-label {
  flex: 0 0 55px;
  padding-top: 5px;
  color: var(--faint);
  font-size: 10.5px;
  font-weight: 600;
}

.chapter-filter-label--order {
  flex-basis: auto;
  margin-left: auto;
  padding-top: 5px;
}

.chapter-filter-options {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 5px;
  min-width: 0;
}

.chapter-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.chapter-filter-pill em {
  color: var(--faint);
  font-size: 9px;
  font-style: normal;
}

.chapter-filter-pill i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--pill-color, var(--teal));
}

.chapter-filter-pill:hover {
  background: var(--surface-deep);
}

.chapter-filter-pill.is-active {
  border-color: var(--pill-color, var(--coral));
  background: var(--pill-soft, var(--coral-soft));
  color: var(--pill-color, var(--coral-deep));
}

.chapter-filter-pill.is-active em {
  color: inherit;
}

.chapter-filter-add {
  color: var(--coral-deep);
}

.chapter-filter-add .icon {
  width: 12px;
  height: 12px;
}

.chapter-answer-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-card);
}

.chapter-answer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 15px;
}

.chapter-answer-head h2 {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0;
  color: var(--ink);
  font-size: 14px;
}

.chapter-answer-head h2 .icon {
  width: 16px;
  height: 16px;
  color: var(--coral);
}

.chapter-answer-head p {
  margin: 4px 0 0;
  color: var(--faint);
  font-size: 10.5px;
}

.chapter-answer-tools {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 7px;
  flex: 0 0 auto;
}

.chapter-view-toggle {
  display: inline-flex;
  align-items: center;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface-deep);
}

.chapter-view-toggle button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--faint);
  font: inherit;
  font-size: 10px;
  font-weight: 600;
  cursor: pointer;
}

.chapter-view-toggle button.is-active {
  background: var(--surface-raised);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(54, 35, 20, 0.08);
}

.chapter-view-toggle .icon {
  width: 12px;
  height: 12px;
}

.chapter-detail-list {
  margin-top: 3px;
}

@media (max-width: 720px) {
  .chapter-answer-tools {
    align-items: flex-start;
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }
}

.chapter-number-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(44px, 1fr));
  gap: 8px;
}

.chapter-number {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  min-width: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-deep);
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, color 0.16s ease;
}

.chapter-number:hover {
  border-color: var(--coral);
  transform: translateY(-1px);
}

.chapter-number.is-done {
  border-color: rgba(15, 181, 163, 0.25);
  background: var(--teal-soft);
  color: var(--teal-deep);
}

.chapter-number.is-wrong {
  border-color: rgba(230, 77, 87, 0.25);
  background: var(--danger-soft);
  color: var(--danger-deep);
}

.chapter-number.is-wrong::after {
  content: '';
  position: absolute;
  right: 5px;
  top: 5px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--danger);
}

.chapter-answer-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 30px 12px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

.chapter-answer-empty p {
  margin: 0;
}

.chapter-answer-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 10.5px;
}

.chapter-answer-foot > span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.chapter-answer-foot .icon {
  width: 14px;
  height: 14px;
}

.chapter-footnote {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 12px 2px 0;
  color: var(--faint);
  font-size: 10px;
}

.chapter-footnote .icon {
  width: 13px;
  height: 13px;
  color: var(--amber);
}

@media (max-width: 720px) {
  .chapter-summary-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .chapter-summary-row > div:nth-child(4),
  .chapter-summary-row > div:nth-child(5) {
    display: none;
  }

  .chapter-filter-panel {
    padding: 3px 12px;
  }

  .chapter-filter-row {
    flex-wrap: wrap;
    gap: 4px;
    padding: 9px 0;
  }

  .chapter-filter-label {
    flex-basis: 100%;
    padding-top: 0;
  }

  .chapter-filter-label--order {
    flex-basis: auto;
    margin-left: 0;
  }

  .chapter-filter-options {
    flex: 1 1 auto;
  }

  .chapter-filter-pill {
    padding: 5px 8px;
    font-size: 10.5px;
  }

  .chapter-filter-label--order + .chapter-filter-options {
    flex-basis: auto;
  }

  .chapter-answer-card {
    padding: 13px 12px;
  }

  .chapter-answer-head {
    flex-direction: column;
    gap: 7px;
  }

  .chapter-number-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 7px;
  }

  .chapter-number {
    font-size: 11px;
  }

  .chapter-answer-foot {
    align-items: flex-start;
    flex-direction: column;
    gap: 9px;
  }

  .chapter-answer-foot .btn {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 640px) {
  .chapter-card-actions .chapter-start {
    padding: 7px;
    font-size: 10px;
  }

  .library-breadcrumb {
    margin-bottom: 7px;
  }

  .library-type-browser {
    padding-bottom: 9px;
  }

  .merge-chapter-list {
    max-height: 280px;
  }
}
