/* ==========================================================================
   定盘星 · 公考专注计时
   A self-contained visual system: warm paper, ink green, cinnabar accent.
   ========================================================================== */


* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  background:
    radial-gradient(ellipse 55% 42% at 98% 2%, rgba(179, 138, 72, 0.16), transparent 68%),
    radial-gradient(ellipse 50% 44% at -5% 90%, rgba(59, 124, 104, 0.11), transparent 64%),
    linear-gradient(155deg, #f8f4eb 0%, var(--paper) 52%, #eee5d4 100%);
  isolation: isolate;
  overflow-x: hidden;
  transition: background-color 0.35s ease, color 0.35s ease;
}

html[data-theme="dark"] body {
  background:
    radial-gradient(ellipse 54% 42% at 98% 2%, rgba(211, 177, 109, 0.11), transparent 68%),
    radial-gradient(ellipse 50% 44% at -5% 90%, rgba(123, 185, 162, 0.08), transparent 64%),
    linear-gradient(155deg, #14221d 0%, var(--paper) 50%, #0b1411 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: radial-gradient(rgba(25, 61, 51, 0.16) 0.7px, transparent 0.7px);
  background-size: 22px 22px;
  opacity: 0.16;
  -webkit-mask-image: radial-gradient(ellipse 80% 70% at 50% 36%, black 0%, transparent 78%);
  mask-image: radial-gradient(ellipse 80% 70% at 50% 36%, black 0%, transparent 78%);
}

html[data-theme="dark"] body::before {
  background-image: radial-gradient(rgba(239, 232, 216, 0.2) 0.7px, transparent 0.7px);
  opacity: 0.1;
}

::selection {
  color: var(--button-text);
  background: var(--cinnabar);
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

button:not(:disabled) {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.72;
}

a {
  color: inherit;
}

h1,
h2,
h3,
p,
dl,
dd,
ul {
  margin: 0;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: 0.04em;
}

ul {
  padding: 0;
  list-style: none;
}

svg {
  display: block;
}

[hidden] {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

:focus-visible {
  outline: 2px solid var(--cinnabar);
  outline-offset: 3px;
}

/* --------------------------------------------------------------------------
   Ambient details
   -------------------------------------------------------------------------- */

.ambient-orb {
  position: fixed;
  top: -22vw;
  right: -12vw;
  z-index: -1;
  width: 48vw;
  min-width: 380px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 42% 42%, rgba(194, 82, 59, 0.13), rgba(179, 138, 72, 0.04) 55%, transparent 70%);
  filter: blur(2px);
  pointer-events: none;
}

html[data-theme="dark"] .ambient-orb {
  background: radial-gradient(circle at 42% 42%, rgba(224, 121, 95, 0.1), rgba(211, 177, 109, 0.03) 55%, transparent 70%);
}

.vertical-note {
  position: fixed;
  top: 50%;
  left: 18px;
  z-index: 0;
  display: none;
  padding-top: 20px;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.42em;
  line-height: 1;
  writing-mode: vertical-rl;
  opacity: 0.55;
  transform: translateY(-50%);
  pointer-events: none;
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: min(var(--shell-max), 100%);
  margin: 0 auto;
  padding: 24px var(--shell-pad) 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
  text-decoration: none;
}

.brand-mark {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 45px;
  height: 45px;
  overflow: hidden;
  border-radius: 13px;
  color: var(--button-text);
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  line-height: 1;
  background: var(--button-bg);
  box-shadow: 0 10px 24px -14px rgba(16, 42, 35, 0.75);
}

.brand-mark::after {
  content: "";
  position: absolute;
  right: 5px;
  bottom: 5px;
  width: 7px;
  height: 7px;
  border: 1px solid rgba(255, 251, 242, 0.65);
  background: var(--cinnabar);
  box-shadow: 0 0 0 2px rgba(194, 82, 59, 0.16);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.brand-copy strong {
  overflow: hidden;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.18em;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-copy span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.3em;
  line-height: 1.4;
  text-transform: uppercase;
}

.header-tools {
  display: flex;
  align-items: center;
  gap: 9px;
}

.live-clock {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  margin-right: 7px;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}

.live-time {
  color: var(--ink-soft);
  font-family: var(--font-num);
  font-size: 14px;
  letter-spacing: 0.09em;
}

.live-date {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.chrome-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 40px;
  min-width: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--ink-soft);
  font-size: 12px;
  letter-spacing: 0.06em;
  background: rgba(255, 253, 248, 0.45);
  box-shadow: 0 4px 14px -10px rgba(32, 54, 44, 0.4);
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

html[data-theme="dark"] .chrome-btn {
  background: rgba(239, 232, 216, 0.04);
}

.chrome-btn:hover {
  color: var(--ink);
  border-color: var(--line-strong);
  background: var(--card-solid);
  transform: translateY(-1px);
}

.chrome-btn .icon {
  width: 18px;
  height: 18px;
}

.icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.icon-sun {
  display: none;
}

html[data-theme="dark"] .icon-moon {
  display: none;
}

html[data-theme="dark"] .icon-sun {
  display: block;
}

/* --------------------------------------------------------------------------
   Shell and mode switch
   -------------------------------------------------------------------------- */

.app-shell {
  width: min(var(--shell-max), 100%);
  margin: 0 auto;
  padding: 0 var(--shell-pad) 28px;
}

.mode-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin: 8px 0 22px;
}

.segmented {
  display: inline-flex;
  gap: 4px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 19px;
  background: rgba(255, 253, 248, 0.5);
  box-shadow: 0 12px 30px -24px rgba(32, 54, 44, 0.55);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

html[data-theme="dark"] .segmented {
  background: rgba(239, 232, 216, 0.045);
}

.segment {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 126px;
  padding: 9px 14px;
  border: 0;
  border-radius: 14px;
  color: var(--muted);
  text-align: left;
  background: transparent;
  transition: color 0.22s ease, background 0.22s ease, box-shadow 0.22s ease, transform 0.22s ease;
}

.segment:hover {
  color: var(--ink);
}

.segment.is-active {
  color: var(--button-text);
  background: var(--button-bg);
  box-shadow: 0 10px 24px -16px rgba(16, 42, 35, 0.8);
}

.segment-icon {
  width: 20px;
  height: 20px;
  opacity: 0.8;
}

.segment-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.segment-copy b {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.segment-copy small {
  margin-top: 2px;
  color: currentColor;
  font-size: 12px;
  letter-spacing: 0.08em;
  opacity: 0.58;
  white-space: nowrap;
}

.mode-live-dot {
  position: absolute;
  top: 9px;
  right: 9px;
  display: none;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cinnabar);
  box-shadow: 0 0 0 4px rgba(194, 82, 59, 0.14);
  animation: mode-pulse 2s ease-out infinite;
}

.segment.is-live:not(.is-active) .mode-live-dot {
  display: block;
}

.mode-note {
  max-width: 33ch;
  padding-left: 18px;
  border-left: 1px solid var(--line);
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.05em;
  line-height: 1.8;
  text-align: right;
}

/* --------------------------------------------------------------------------
   Workspace and sheets
   -------------------------------------------------------------------------- */

.page-grid,
.view-area {
  min-width: 0;
}

.insight-rail {
  display: none;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.37fr) minmax(330px, 0.78fr);
  gap: 20px;
  align-items: start;
}

.side-stack {
  display: grid;
  min-width: 0;
  gap: 20px;
}

.workspace > *,
.side-stack > *,
.sheet,
.question-target,
.metric-grid,
.plan-current {
  min-width: 0;
}

.question-target {
  max-width: 100%;
}

.question-hint,
.plan-current strong,
.pace-note p,
.history-copy {
  overflow-wrap: anywhere;
}

.sheet {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--card);
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px) saturate(1.05);
  -webkit-backdrop-filter: blur(22px) saturate(1.05);
}

.timer-sheet {
  display: flex;
  flex-direction: column;
  min-height: var(--timer-sheet-min-height, 0px);
  padding: 28px 32px 24px;
}

body.is-measuring-timers .view {
  display: block !important;
  position: absolute !important;
  top: 0;
  left: 0;
  width: var(--timer-measure-width, 100%);
  visibility: hidden;
  pointer-events: none;
}

body.is-measuring-timers .timer-sheet {
  min-height: 0 !important;
}

.timer-sheet::after {
  content: "";
  position: absolute;
  top: -100px;
  right: -110px;
  width: 300px;
  height: 300px;
  border: 1px solid var(--line);
  border-radius: 50%;
  box-shadow: 0 0 0 34px rgba(25, 61, 51, 0.018), 0 0 0 70px rgba(25, 61, 51, 0.012);
  pointer-events: none;
}

.sheet-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.sheet-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.eyebrow {
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.28em;
  line-height: 1.4;
  text-transform: uppercase;
}

.sheet-title h1 {
  font-size: 28px;
  line-height: 1.25;
}

.sheet-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.sheet-heading h2 {
  margin-top: 3px;
  font-size: 18px;
  line-height: 1.3;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  margin-top: 2px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 12px;
  letter-spacing: 0.06em;
  white-space: nowrap;
  background: var(--soft);
}

.status-pill i {
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
}

.status-pill.is-running i {
  background: var(--jade);
  box-shadow: 0 0 0 4px var(--jade-soft);
  animation: live-pulse 2s ease-out infinite;
}

.status-pill.is-paused i {
  background: var(--gold);
  box-shadow: 0 0 0 4px var(--gold-soft);
}

.status-pill.is-finished i {
  background: var(--cinnabar);
  box-shadow: 0 0 0 4px var(--cinnabar-soft);
}

/* --------------------------------------------------------------------------
   Exam presets
   -------------------------------------------------------------------------- */

.preset-row {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 22px 0 2px;
}

.preset {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink-soft);
  text-align: left;
  background: rgba(255, 253, 248, 0.28);
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease, color 0.2s ease;
}

html[data-theme="dark"] .preset {
  background: rgba(239, 232, 216, 0.028);
}

.preset:not(:disabled):hover {
  border-color: var(--line-strong);
  background: var(--soft);
  transform: translateY(-1px);
}

.preset b {
  overflow: hidden;
  max-width: 100%;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.05em;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preset span {
  overflow: hidden;
  max-width: 100%;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.preset.is-active {
  border-color: rgba(194, 82, 59, 0.42);
  color: var(--cinnabar-deep);
  background: var(--cinnabar-soft);
  box-shadow: inset 0 0 0 1px rgba(194, 82, 59, 0.06);
}

.preset.is-active span {
  color: var(--cinnabar);
  opacity: 0.82;
}

.preset-custom {
  border-style: dashed;
}

/* --------------------------------------------------------------------------
   Exam composition bar
   -------------------------------------------------------------------------- */

.exam-plan-bar {
  position: relative;
  z-index: 1;
  margin-top: 20px;
  margin-bottom: 6px;
  padding: 12px 14px 11px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--soft);
}

.plan-bar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.plan-current {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 9px;
  min-width: 0;
}

.plan-label {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.plan-current strong {
  overflow: hidden;
  max-width: 28ch;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.04em;
  line-height: 1.35;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plan-current > span:last-child {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.03em;
}

.plan-edit {
  flex: 0 0 auto;
  padding: 5px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--cinnabar);
  font-size: 12px;
  letter-spacing: 0.04em;
  background: var(--card-solid);
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.plan-edit:not(:disabled):hover {
  border-color: var(--cinnabar);
  background: var(--cinnabar-soft);
}

.plan-edit span {
  margin-left: 2px;
}

.plan-edit:disabled {
  color: var(--muted);
}

.plan-chips {
  display: flex;
  gap: 6px;
  margin-top: 9px;
  padding-bottom: 1px;
  overflow-x: auto;
  scrollbar-width: none;
}

.plan-chips::-webkit-scrollbar {
  display: none;
}

.plan-chip {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: baseline;
  gap: 5px;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: var(--card-solid);
  font-size: 12px;
  letter-spacing: 0.02em;
  line-height: 1.5;
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.plan-chip b {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.plan-chip small {
  color: var(--muted);
  font-family: var(--font-num);
  font-size: 12px;
  white-space: nowrap;
}

.plan-chip em {
  color: var(--muted);
  font-family: var(--font-num);
  font-size: 12px;
  font-style: normal;
  white-space: nowrap;
}

.plan-chip.is-current {
  border-color: rgba(194, 82, 59, 0.36);
  color: var(--cinnabar);
  background: var(--cinnabar-soft);
}

.plan-chip.is-current b {
  color: var(--cinnabar-deep);
}

.plan-chip.is-current em {
  color: var(--cinnabar);
}

.plan-chip.is-done {
  opacity: 0.62;
}

/* --------------------------------------------------------------------------
   Practice timer
   -------------------------------------------------------------------------- */

.practice-sheet {
  --ring-color: var(--jade);
  --ring-soft: var(--jade-soft);
}

.practice-band {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 7px 16px;
  margin-top: 20px;
  margin-bottom: 6px;
  padding: 9px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.03em;
  line-height: 1.5;
  background: var(--soft);
}

.practice-band-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.practice-band-item i {
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--jade);
  box-shadow: 0 0 0 3px var(--jade-soft);
}

.practice-band-item:last-child {
  color: var(--ink-soft);
}

.record-btn {
  display: flex;
  flex: 0 0 auto;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  width: 68px;
  height: 52px;
  padding: 0;
  border: 1px solid rgba(59, 124, 104, 0.3);
  border-radius: 15px;
  color: var(--jade);
  background: var(--jade-soft);
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.record-btn span {
  font-family: var(--font-num);
  font-size: 16px;
  font-weight: 500;
  line-height: 1.1;
}

.record-btn small {
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 12px;
  letter-spacing: 0.05em;
  line-height: 1.3;
}

.record-btn:not(:disabled):hover {
  border-color: var(--jade);
  color: var(--ink);
  background: var(--jade-soft);
  transform: translateY(-2px);
}

.record-btn:not(:disabled):active {
  transform: translateY(0);
}

.record-btn.is-active {
  border-color: transparent;
  color: var(--button-text);
  background: var(--jade);
}

.record-btn.is-active small {
  color: var(--button-text);
  opacity: 0.78;
}

.record-btn.is-active:not(:disabled):hover {
  color: var(--button-text);
  background: var(--jade);
  filter: brightness(0.96);
}

/* --------------------------------------------------------------------------
   Timer ring
   -------------------------------------------------------------------------- */

.timer-wrap {
  --timer-min-width: 220px;
  --timer-max-width: 400px;
  position: relative;
  display: grid;
  place-items: center;
  width: min(100%, clamp(var(--timer-min-width), calc(100vh - 524px), var(--timer-max-width)));
  width: min(100%, clamp(var(--timer-min-width), calc(100dvh - 524px), var(--timer-max-width)));
  aspect-ratio: 1;
  margin: auto;
}

.timer-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  transform: rotate(-90deg);
}

.ring-ticks {
  fill: none;
  stroke: var(--line-strong);
  stroke-width: 1.3;
  stroke-dasharray: 1.4 10.6;
  opacity: 0.42;
}

.ring-track {
  fill: none;
  stroke: var(--ring-track);
  stroke-width: 9;
}

.ring-progress {
  fill: none;
  stroke: var(--ring-color);
  stroke-width: 9;
  stroke-linecap: round;
  stroke-dasharray: 100;
  stroke-dashoffset: 100;
  filter: drop-shadow(0 0 9px var(--ring-soft));
  transition: stroke-dashoffset 0.28s linear, stroke 0.3s ease, opacity 0.3s ease;
}

.timer-center {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 73.5%;
  aspect-ratio: 1;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 50%;
  text-align: center;
  background:
    radial-gradient(circle at 50% 34%, rgba(255, 255, 255, 0.52), transparent 65%),
    var(--soft);
  box-shadow:
    inset 0 0 0 10px rgba(255, 253, 248, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.4),
    0 24px 60px -46px rgba(32, 54, 44, 0.7);
}

html[data-theme="dark"] .timer-center {
  background:
    radial-gradient(circle at 50% 34%, rgba(239, 232, 216, 0.055), transparent 65%),
    var(--soft);
  box-shadow:
    inset 0 0 0 10px rgba(239, 232, 216, 0.018),
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 24px 60px -46px rgba(0, 0, 0, 0.9);
}

.timer-kicker {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.24em;
  line-height: 1;
  text-indent: 0.24em;
}

.timer-digits {
  margin-top: 12px;
  color: var(--ink);
  font-family: var(--font-num);
  font-size: clamp(38px, 5vw, 58px);
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.005em;
  line-height: 1;
  white-space: nowrap;
  transition: color 0.3s ease;
}

.timer-sub {
  margin-top: 13px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  line-height: 1.5;
}

.timer-sheet.is-paused .ring-progress {
  opacity: 0.52;
}

.timer-sheet.is-paused .timer-digits {
  color: var(--ink-soft);
}

.timer-sheet.is-finished .ring-progress {
  opacity: 0.28;
}

.timer-sheet.is-urgent .timer-digits {
  color: var(--cinnabar);
}

.timer-sheet.is-urgent .ring-progress {
  filter: drop-shadow(0 0 13px rgba(194, 82, 59, 0.34));
}

/* --------------------------------------------------------------------------
   Controls
   -------------------------------------------------------------------------- */

.control-deck {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 3px;
}

.round-btn {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  color: var(--ink-soft);
  background: var(--soft);
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.round-btn:not(:disabled):hover {
  color: var(--ink);
  border-color: var(--ink-soft);
  background: var(--soft-strong);
  transform: translateY(-2px);
}

.round-btn:not(:disabled):active {
  transform: translateY(0);
}

.round-btn .icon {
  width: 19px;
  height: 19px;
}

.add-time {
  font-family: var(--font-num);
  font-size: 13px;
  letter-spacing: 0.02em;
}

.primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 192px;
  height: 56px;
  padding: 0 22px;
  border: 0;
  border-radius: 18px;
  color: var(--button-text);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.08em;
  background: var(--button-bg);
  box-shadow: 0 16px 34px -18px rgba(16, 42, 35, 0.7);
  transition: background 0.25s ease, color 0.25s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.primary-action:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 38px -18px rgba(16, 42, 35, 0.65);
}

.primary-action:not(:disabled):active {
  transform: translateY(0);
}

.primary-action.is-running {
  color: var(--action-text);
  background: var(--cinnabar);
  box-shadow: 0 16px 34px -18px rgba(194, 82, 59, 0.6);
}

.primary-action.is-running:hover {
  background: var(--cinnabar-deep);
}

.primary-action kbd {
  padding: 3px 6px;
  border: 1px solid rgba(255, 251, 242, 0.22);
  border-radius: 5px;
  color: inherit;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.02em;
  line-height: 1.1;
  opacity: 0.55;
}

.under-controls {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 26px;
  margin-top: 12px;
  padding: 0 6px;
}

.text-btn,
.link-btn {
  padding: 2px 0;
  border: 0;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  background: transparent;
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 4px;
  transition: color 0.2s ease, text-decoration-color 0.2s ease;
}

.text-btn:not(:disabled):hover,
.link-btn:not(:disabled):hover {
  color: var(--cinnabar);
  text-decoration-color: currentColor;
}

.control-hint {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  text-align: right;
}

.text-btn kbd {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 4px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  color: var(--muted);
  font-family: var(--font-num);
  font-size: 12px;
  line-height: 1.3;
  vertical-align: 1px;
}

/* --------------------------------------------------------------------------
   Side cards: answer flow and history
   -------------------------------------------------------------------------- */

.progress-sheet,
.practice-log-sheet,
.history-sheet,
.today-sheet,
.rhythm-sheet {
  padding: 22px 23px;
}

.question-count {
  flex: 0 0 auto;
  padding: 5px 9px;
  border-radius: 9px;
  color: var(--ink-soft);
  font-family: var(--font-num);
  font-size: 12px;
  letter-spacing: 0.02em;
  background: var(--soft);
}

.progress-track {
  position: relative;
  height: 8px;
  margin-top: 18px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--soft-strong);
}

.progress-track::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0, transparent calc(10% - 1px), var(--card-solid) calc(10% - 1px), var(--card-solid) 10%);
  opacity: 0.45;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cinnabar), var(--gold));
  transition: width 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

.question-hint {
  margin-top: 9px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.question-actions {
  display: grid;
  grid-template-columns: 0.9fr 1.35fr;
  gap: 8px;
  margin-top: 15px;
}

.soft-btn,
.ghost-btn,
.small-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  white-space: nowrap;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.soft-btn {
  border: 1px solid var(--line);
  color: var(--ink-soft);
  background: var(--soft);
}

.soft-btn:not(:disabled):hover {
  border-color: var(--line-strong);
  color: var(--ink);
  background: var(--soft-strong);
}

.ghost-btn {
  border: 1px solid var(--line-strong);
  color: var(--ink-soft);
  background: transparent;
}

.ghost-btn:not(:disabled):hover {
  color: var(--ink);
  background: var(--soft);
}

.small-primary {
  border: 1px solid transparent;
  color: var(--button-text);
  background: var(--button-bg);
  box-shadow: 0 10px 22px -16px rgba(16, 42, 35, 0.6);
}

.small-primary:not(:disabled):hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 26px -16px rgba(16, 42, 35, 0.6);
}

.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin-top: 17px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--line);
}

.metric-grid > div {
  min-width: 0;
  padding: 11px 13px 12px;
  background: var(--card-solid);
}

.metric-grid dt {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
  line-height: 1.5;
}

.metric-grid dd {
  margin-top: 3px;
  color: var(--ink);
  font-family: var(--font-num);
  font-size: 19px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
  line-height: 1.25;
}

.metric-grid dd small {
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.02em;
}

.pace-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 13px;
  padding: 9px 11px;
  border-radius: 12px;
  color: var(--ink-soft);
  background: var(--soft);
}

.pace-dot {
  flex: 0 0 auto;
  width: 6px;
  height: 6px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-soft);
}

.pace-note p {
  font-size: 12px;
  line-height: 1.65;
}

.pace-note.is-warning {
  color: var(--cinnabar-deep);
  background: var(--cinnabar-soft);
}

.pace-note.is-warning .pace-dot {
  background: var(--cinnabar);
  box-shadow: 0 0 0 3px rgba(194, 82, 59, 0.12);
}

.pace-note.is-good {
  color: var(--jade);
  background: var(--jade-soft);
}

.pace-note.is-good .pace-dot {
  background: var(--jade);
  box-shadow: 0 0 0 3px rgba(59, 124, 104, 0.12);
}

/* History */

.history-sheet {
  min-height: 208px;
}

.history-list {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--soft);
  animation: item-in 0.3s ease both;
}

.history-mark {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--cinnabar);
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 600;
  background: var(--card-solid);
}

.history-mark.is-practice {
  color: var(--jade);
  background: var(--jade-soft);
}

.history-copy {
  min-width: 0;
  flex: 1;
}

.history-copy b {
  display: block;
  overflow: hidden;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.history-copy span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.history-badge {
  flex: 0 0 auto;
  padding: 3px 6px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  background: var(--soft-strong);
}

.history-badge.is-done {
  color: var(--jade);
  background: var(--jade-soft);
}

.history-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 128px;
  padding: 14px;
  color: var(--muted);
  text-align: center;
}

.history-empty svg {
  width: 30px;
  height: 30px;
  margin-bottom: 5px;
  opacity: 0.45;
}

.history-empty b {
  color: var(--ink-soft);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.05em;
}

.history-empty span {
  font-size: 12px;
  opacity: 0.75;
}

/* --------------------------------------------------------------------------
   Practice log
   -------------------------------------------------------------------------- */

.practice-log-sheet {
  min-height: 330px;
}

.question-target {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
}

.question-target-label {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.06em;
}

.question-target-field {
  position: relative;
  flex: 1;
  min-width: 0;
}

.question-target-field input {
  width: 100%;
  height: 31px;
  padding: 0 25px 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  color: var(--ink);
  font-family: var(--font-num);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  background: var(--card-solid);
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.question-target-field input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

.question-target-field input[type="number"]::-webkit-inner-spin-button,
.question-target-field input[type="number"]::-webkit-outer-spin-button {
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
}

.question-target-field input:hover {
  border-color: var(--ink-soft);
}

.question-target-field input:focus {
  outline: none;
  border-color: var(--cinnabar);
  background: var(--card-raised);
  box-shadow: 0 0 0 3px var(--cinnabar-soft);
}

.question-target-field em {
  position: absolute;
  top: 50%;
  right: 9px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  pointer-events: none;
  transform: translateY(-50%);
}

.question-target-set {
  flex: 0 0 auto;
  min-height: 31px;
  padding: 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  color: var(--ink-soft);
  font-size: 12px;
  letter-spacing: 0.04em;
  background: var(--card-solid);
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.question-target-set:hover {
  border-color: var(--jade);
  color: var(--jade);
  background: var(--jade-soft);
}

.question-target-hint {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.practice-splits {
  margin-top: 16px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.practice-splits-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.practice-splits-head .link-btn {
  font-size: 12px;
}

.split-list {
  display: grid;
  margin: 7px 0 0;
  padding: 0;
  list-style: none;
}

.split-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 29px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.split-item:last-child {
  border-bottom: 0;
}

.split-item span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.split-item span::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--jade);
  opacity: 0.6;
}

.split-item b {
  color: var(--ink-soft);
  font-family: var(--font-num);
  font-size: 12px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.split-empty {
  padding: 13px 0 4px;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.04em;
  opacity: 0.75;
}

.practice-history-sheet {
  min-height: 190px;
}

/* --------------------------------------------------------------------------
   Wide-screen insight rail
   -------------------------------------------------------------------------- */

.glance-sheet,
.shortcut-sheet {
  padding: 20px 20px 19px;
}

.glance-hero {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 20px;
}

.glance-hero strong {
  color: var(--ink);
  font-family: var(--font-num);
  font-size: 56px;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 0.95;
}

.glance-hero span {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.glance-caption {
  margin-top: 7px;
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.6;
}

.glance-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  margin-top: 18px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--line);
}

.glance-grid > div {
  padding: 10px 11px;
  background: var(--card-solid);
}

.glance-grid dt {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.06em;
  line-height: 1.5;
}

.glance-grid dd {
  display: flex;
  align-items: baseline;
  gap: 3px;
  margin-top: 2px;
  color: var(--ink);
  line-height: 1.2;
}

.glance-grid dd b {
  font-family: var(--font-num);
  font-size: 18px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.glance-grid dd small {
  color: var(--muted);
  font-size: 12px;
}

.shortcut-sheet h2 {
  margin-top: 3px;
  font-size: 18px;
}

.shortcut-list {
  display: grid;
  margin-top: 12px;
  border-top: 1px solid var(--line);
}

.shortcut-list > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.shortcut-list dt {
  min-width: 39px;
  padding: 3.5px 6px;
  border: 1px solid var(--line-strong);
  border-radius: 5px;
  color: var(--ink-soft);
  font-family: var(--font-num);
  font-size: 12px;
  letter-spacing: 0.03em;
  text-align: center;
  background: var(--soft);
}

.shortcut-list dd {
  flex: 1;
  color: var(--ink-soft);
  font-size: 12px;
  letter-spacing: 0.02em;
  text-align: right;
}

.shortcut-list dd span {
  margin-left: 4px;
  color: var(--muted);
  font-size: 12px;
}

.rail-quote {
  padding: 2px 4px 0;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.14em;
  line-height: 1.8;
  text-align: center;
  opacity: 0.72;
}

/* --------------------------------------------------------------------------
   Pomodoro
   -------------------------------------------------------------------------- */

.pomo-sheet[data-phase="focus"] {
  --ring-color: var(--cinnabar);
  --ring-soft: var(--cinnabar-soft);
  --phase-soft: var(--cinnabar-soft);
}

.pomo-sheet[data-phase="short"] {
  --ring-color: var(--jade);
  --ring-soft: var(--jade-soft);
  --phase-soft: var(--jade-soft);
}

.pomo-sheet[data-phase="long"] {
  --ring-color: var(--gold);
  --ring-soft: var(--gold-soft);
  --phase-soft: var(--gold-soft);
}

.phase-switch {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  margin-top: 20px;
  margin-bottom: 6px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--soft);
}

.phase-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 12px;
  color: var(--muted);
  background: transparent;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.phase-tab:hover {
  color: var(--ink);
}

.phase-tab b {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 1.4;
}

.phase-tab span {
  font-family: var(--font-num);
  font-size: 12px;
  letter-spacing: 0.02em;
  opacity: 0.7;
}

.phase-tab.is-active {
  border-color: var(--line);
  color: var(--ink);
  background: var(--card-solid);
  box-shadow: var(--shadow-soft);
}

.phase-tab[data-phase="focus"].is-active b {
  color: var(--cinnabar);
}

.phase-tab[data-phase="short"].is-active b {
  color: var(--jade);
}

.phase-tab[data-phase="long"].is-active b {
  color: var(--gold);
}

.cycle-block {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(100%, 380px);
  margin: 8px auto 0;
  padding: 7px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft);
}

.cycle-label {
  display: flex;
  flex: 0 0 auto;
  align-items: baseline;
  justify-content: flex-start;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.cycle-label span:last-child {
  color: var(--ink-soft);
  font-family: var(--font-num);
  font-size: 12px;
}

.round-dots {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 5px;
  min-width: 50px;
  margin-top: 0;
}

.round-dot {
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: var(--soft-strong);
  transition: background 0.3s ease, transform 0.3s ease;
}

.round-dot.is-filled {
  background: var(--ring-color);
}

.round-dot.is-current {
  background: var(--ring-soft);
  box-shadow: inset 0 0 0 1px var(--ring-color);
}

.pomo-sheet[data-phase="short"] .primary-action.is-running {
  background: var(--jade);
  box-shadow: 0 16px 34px -18px rgba(59, 124, 104, 0.55);
}

.pomo-sheet[data-phase="long"] .primary-action.is-running {
  color: var(--action-text);
  background: var(--gold);
  box-shadow: 0 16px 34px -18px rgba(179, 138, 72, 0.55);
}

.pomo-sheet .under-controls {
  margin-top: 14px;
}

.pomo-sheet .control-hint:first-child {
  text-align: left;
}

/* Today */

.today-date {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.today-main {
  display: flex;
  align-items: baseline;
  gap: 7px;
  margin-top: 18px;
}

.today-main strong {
  color: var(--ink);
  font-family: var(--font-num);
  font-size: 62px;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 0.95;
}

.today-main span {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.06em;
}

.today-sessions {
  margin-top: 5px;
  color: var(--ink-soft);
  font-size: 12px;
  letter-spacing: 0.03em;
}

.week-chart {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 94px;
  margin-top: 18px;
  padding-bottom: 1px;
  border-bottom: 1px solid var(--line);
}

.week-chart.is-empty::before {
  content: "完成一个番茄后，这里会长出记录";
  position: absolute;
  top: 24px;
  right: 0;
  left: 0;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.06em;
  line-height: 1.5;
  text-align: center;
  opacity: 0.72;
  pointer-events: none;
}

.week-day {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  height: 100%;
  min-width: 0;
}

.week-bar-slot {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 100%;
  height: 66px;
}

.week-bar {
  width: min(24px, 68%);
  min-height: 4px;
  border-radius: 6px 6px 2px 2px;
  background: var(--soft-strong);
  transition: height 0.45s cubic-bezier(0.22, 1, 0.36, 1), background 0.3s ease;
}

.week-day.is-today .week-bar {
  background: var(--cinnabar);
  box-shadow: 0 6px 18px -10px rgba(194, 82, 59, 0.55);
}

.week-day.has-data:not(.is-today) .week-bar {
  background: var(--jade);
  opacity: 0.65;
}

.week-label {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.02em;
  line-height: 1;
}

.week-day.is-today .week-label {
  color: var(--cinnabar);
  font-weight: 600;
}

.week-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.05em;
}

/* Rhythm */

.rhythm-list {
  display: grid;
  margin-top: 14px;
  border-top: 1px solid var(--line);
}

.rhythm-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.rhythm-list span {
  color: var(--muted);
  letter-spacing: 0.04em;
}

.rhythm-list b {
  color: var(--ink-soft);
  font-family: var(--font-num);
  font-size: 12px;
  font-weight: 400;
  letter-spacing: 0.02em;
}

.rhythm-note {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.full-btn {
  width: 100%;
  margin-top: 15px;
}

/* --------------------------------------------------------------------------
   Footer
   -------------------------------------------------------------------------- */

.site-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: min(var(--shell-max), 100%);
  margin: 0 auto;
  padding: 2px var(--shell-pad) 30px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.05em;
}

.site-footer p {
  display: flex;
  align-items: center;
  gap: 7px;
}

.privacy-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--jade);
  box-shadow: 0 0 0 3px var(--jade-soft);
}

.footer-quote {
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.16em;
  opacity: 0.78;
}

/* --------------------------------------------------------------------------
   Countdown and statistics
   -------------------------------------------------------------------------- */

.countdown-sheet,
.stats-countdown-card {
  padding: 20px 20px 18px;
}

.countdown-main,
.stats-countdown-main {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin-top: 13px;
}

.countdown-main strong,
.stats-countdown-main strong {
  color: var(--ink);
  font-family: var(--font-num);
  font-size: 48px;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 0.95;
}

.countdown-main span,
.stats-countdown-main span {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.countdown-name {
  margin-top: 6px;
  overflow: hidden;
  color: var(--ink-soft);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.countdown-date {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.02em;
  line-height: 1.5;
}

.countdown-sheet.is-past .countdown-main strong,
.stats-countdown-card.is-past .stats-countdown-main strong,
.countdown-single.is-past .countdown-main strong {
  color: var(--muted);
}

.countdown-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.countdown-count {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.countdown-list.is-multi {
  margin-top: 8px;
  border-top: 1px solid var(--line);
}

.countdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  padding: 4px 0;
  border-bottom: 1px solid var(--line);
}

.countdown-item:last-child {
  border-bottom: 0;
}

.countdown-item-copy {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0;
  min-width: 0;
}

.countdown-item-copy b {
  overflow: hidden;
  color: var(--ink-soft);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.03em;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.countdown-item-copy small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.countdown-item-days {
  display: flex;
  flex: 0 0 auto;
  align-items: baseline;
  gap: 3px;
}

.countdown-item-days strong {
  color: var(--ink);
  font-family: var(--font-num);
  font-size: 16px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.countdown-item-days span {
  color: var(--muted);
  font-size: 12px;
}

.countdown-item.is-past .countdown-item-days strong,
.countdown-item.is-past .countdown-item-copy b {
  color: var(--muted);
}

.countdown-empty .countdown-main {
  margin-top: 13px;
}

body[data-mode="stats"] .insight-rail {
  display: none;
}

body[data-mode="stats"] .page-grid {
  grid-template-columns: minmax(0, 1fr);
}

body[data-mode="stats"] .view-area {
  grid-column: 1 / -1;
}

.stats-page {
  display: grid;
  gap: 20px;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
}

.stats-page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding: 2px 2px 0;
}

.stats-page-head h1 {
  margin-top: 3px;
  font-size: 31px;
  line-height: 1.25;
}

.stats-page-head p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.02em;
}

.stats-period {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 3px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
}

.stats-period button {
  padding: 6px 11px;
  border: 0;
  border-radius: 8px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.03em;
  background: transparent;
  transition: color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.stats-period button.is-active {
  color: var(--ink);
  background: var(--card-solid);
  box-shadow: var(--shadow-soft);
}

.stats-top-grid {
  display: grid;
  grid-template-columns: 1.12fr 0.88fr;
  gap: 20px;
}

.stats-bottom-grid {
  display: grid;
  grid-template-columns: 0.78fr 1.22fr;
  gap: 20px;
}

.stats-overview,
.stats-split-card,
.stats-chart-card,
.stats-mode-card-wrap {
  padding: 22px 23px;
}

.stats-total-label {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.stats-total {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px;
  margin-top: 8px;
}

.stats-total strong {
  color: var(--ink);
  font-family: var(--font-num);
  font-size: 52px;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.025em;
  line-height: 0.95;
}

.stats-total span {
  margin-right: 9px;
  color: var(--muted);
  font-size: 12px;
}

.stats-period-caption {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.03em;
}

.stats-mini-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1px;
  margin-top: 19px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--line);
}

.stats-mini-grid > div {
  min-width: 0;
  padding: 10px 10px 11px;
  background: var(--card-solid);
}

.stats-mini-grid dt {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
  line-height: 1.5;
}

.stats-mini-grid dd {
  display: flex;
  align-items: baseline;
  gap: 3px;
  margin-top: 3px;
  color: var(--ink);
  line-height: 1.2;
}

.stats-mini-grid dd b {
  font-family: var(--font-num);
  font-size: 20px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}

.stats-mini-grid dd small {
  color: var(--muted);
  font-size: 12px;
}

.stats-card-note {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.stats-split-body {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  min-height: 190px;
  margin-top: 15px;
}

.stats-donut {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 148px;
  height: 148px;
  border-radius: 50%;
  background: conic-gradient(
    var(--jade) 0 var(--practice),
    var(--cinnabar) var(--practice) calc(var(--practice) + var(--exam)),
    var(--gold) calc(var(--practice) + var(--exam)) 100%
  );
  box-shadow: inset 0 0 0 1px var(--line);
}

.stats-donut.is-empty {
  background: var(--soft-strong);
}

.stats-donut-hole {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 104px;
  height: 104px;
  border-radius: 50%;
  background: var(--card-solid);
  box-shadow: 0 0 0 1px var(--line);
}

.stats-donut-hole strong {
  color: var(--ink);
  font-family: var(--font-num);
  font-size: 27px;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.stats-donut-hole span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.06em;
}

.stats-legend {
  display: grid;
  flex: 1;
  gap: 9px;
  min-width: 130px;
}

.stats-legend > div {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.stats-legend > div:last-child {
  border-bottom: 0;
}

.stats-legend dt {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-soft);
  font-size: 12px;
  letter-spacing: 0.03em;
}

.stats-legend dd {
  color: var(--muted);
  font-family: var(--font-num);
  font-size: 12px;
}

.stats-legend i,
.stats-chart-legend i,
.stats-mode-row > i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--jade);
}

.stats-legend i.exam,
.stats-chart-legend i.exam,
.stats-mode-row > i.exam {
  background: var(--cinnabar);
}

.stats-legend i.pomo,
.stats-chart-legend i.pomo,
.stats-mode-row > i.pomo {
  background: var(--gold);
}

.stats-chart-legend {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--muted);
  font-size: 12px;
}

.stats-chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.stats-chart {
  position: relative;
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 236px;
  margin-top: 17px;
  padding: 12px 2px 0;
  overflow-x: auto;
  overflow-y: hidden;
  border-bottom: 1px solid var(--line);
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.stats-chart::-webkit-scrollbar {
  height: 4px;
}

.stats-chart::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: var(--line-strong);
}

.stats-chart.is-empty::after {
  content: "还没有计时记录，先开始一轮吧";
  position: absolute;
  inset: 60px 0 auto;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.05em;
  text-align: center;
  pointer-events: none;
}

.stats-day {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  min-width: 0;
  height: 100%;
}

.stats-chart[data-range="30"] {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(15px, 1fr);
  align-items: end;
}

.stats-chart[data-range="30"] .stats-day {
  flex: none;
  width: 100%;
  min-width: 0;
}

.stats-bar-slot {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  width: 100%;
  height: 194px;
}

.stats-bar {
  display: flex;
  flex-direction: column-reverse;
  width: min(30px, 74%);
  min-height: 3px;
  overflow: hidden;
  border-radius: 5px 5px 2px 2px;
  background: var(--soft-strong);
  transition: height 0.4s cubic-bezier(0.22, 1, 0.36, 1);
}

.stats-bar span {
  display: block;
  width: 100%;
  min-height: 0;
}

.stats-bar .practice {
  background: var(--jade);
}

.stats-bar .exam {
  background: var(--cinnabar);
}

.stats-bar .pomo {
  background: var(--gold);
}

.stats-day.is-today .stats-bar {
  box-shadow: 0 0 0 1px var(--cinnabar);
}

.stats-label {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.01em;
  line-height: 1;
  white-space: nowrap;
}

.stats-chart[data-range="30"] .stats-label {
  font-size: 12px;
  transform: rotate(-38deg);
  transform-origin: center;
}

.stats-day.is-today .stats-label {
  color: var(--cinnabar);
  font-weight: 600;
}

.stats-countdown-main {
  margin-top: 14px;
}

.stats-countdown-main strong {
  font-size: 58px;
}

.stats-mode-list {
  display: grid;
  gap: 1px;
  margin-top: 15px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--line);
}

.stats-mode-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 11px;
  background: var(--card-solid);
}

.stats-mode-row > i {
  flex: 0 0 auto;
}

.stats-mode-row > div {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.stats-mode-row b {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.03em;
}

.stats-mode-row small {
  color: var(--muted);
  font-size: 12px;
}

.stats-mode-row > strong {
  color: var(--ink);
  font-family: var(--font-num);
  font-size: 12px;
  font-weight: 400;
  white-space: nowrap;
}

.stats-footnote {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.02em;
  line-height: 1.7;
  text-align: center;
}

/* Focus mode */

.focus-exit {
  position: fixed;
  top: calc(18px + env(safe-area-inset-top));
  right: calc(18px + env(safe-area-inset-right));
  z-index: 80;
  display: none;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  color: var(--ink-soft);
  font-size: 12px;
  letter-spacing: 0.04em;
  background: var(--card-solid);
  box-shadow: var(--shadow-soft);
}

.focus-exit .icon {
  width: 15px;
  height: 15px;
}

.focus-exit kbd {
  padding: 2px 4px;
  border: 1px solid var(--line);
  border-radius: 4px;
  color: var(--muted);
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 400;
}

body.is-focus-mode {
  overflow-y: auto;
}

body.is-focus-mode .site-header,
body.is-focus-mode .mode-bar,
body.is-focus-mode .insight-rail,
body.is-focus-mode .side-stack,
body.is-focus-mode .vertical-note,
body.is-focus-mode .site-footer {
  display: none !important;
}

body.is-focus-mode .app-shell {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  width: 100%;
  max-width: none;
  min-height: 100vh;
  min-height: -webkit-fill-available;
  min-height: 100dvh;
  padding: 28px 24px;
}

body.is-focus-mode .page-grid {
  display: block;
  width: 100%;
  max-width: 1400px;
  margin: auto 0;
}

body.is-focus-mode .view-area {
  width: 100%;
}

body.is-focus-mode .workspace {
  display: block;
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
}

body.is-focus-mode .timer-sheet {
  width: 100%;
  max-width: 820px;
  margin: 0 auto;
}

body.is-focus-mode .focus-exit {
  display: inline-flex;
}

body.is-focus-mode .stats-page {
  max-width: 1400px;
}

/* --------------------------------------------------------------------------
   Dialogs
   -------------------------------------------------------------------------- */

dialog {
  max-width: none;
  max-height: none;
  margin: auto;
  padding: 0;
  border: 0;
  color: var(--ink);
  background: transparent;
  overscroll-behavior: contain;
}

dialog:not([open]) {
  display: none;
}

/* Fallback for Safari versions without native <dialog> support. */
dialog.is-fallback-open {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 1000;
  display: block;
  max-width: calc(100vw - 24px);
  height: auto;
  max-height: calc(100vh - 24px);
  margin: 0;
  overflow: auto;
  box-shadow: 0 0 0 100vmax rgba(13, 25, 21, 0.52);
  transform: translate(-50%, -50%);
  animation: none;
}

dialog.is-fallback-open::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--overlay);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

dialog::backdrop {
  background: var(--overlay);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

dialog[open] {
  animation: dialog-in 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

dialog.is-fallback-open[open] {
  animation: none;
}

dialog[open]::backdrop {
  animation: backdrop-in 0.28s ease both;
}

.settings-dialog {
  width: min(780px, calc(100vw - 28px));
}

#settingsForm {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 34px);
  max-height: calc(100dvh - 34px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 27px;
  background: var(--card-solid);
  box-shadow: 0 44px 120px -36px rgba(0, 0, 0, 0.55);
}

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  padding: 25px 28px 18px;
  border-bottom: 1px solid var(--line);
}

.dialog-head h2 {
  margin-top: 3px;
  font-size: 25px;
  line-height: 1.3;
}

.dialog-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.02em;
}

.icon-close {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 11px;
  color: var(--muted);
  background: var(--soft);
  transition: color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.icon-close:hover {
  color: var(--ink);
  background: var(--soft-strong);
  transform: rotate(4deg);
}

.settings-body {
  overflow-y: auto;
  padding: 4px 28px 24px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.settings-body::-webkit-scrollbar {
  width: 6px;
}

.settings-body::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: var(--line-strong);
}

.settings-group {
  padding: 22px 0 2px;
}

.settings-group + .settings-group {
  margin-top: 6px;
  border-top: 1px dashed var(--line);
}

.group-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.group-head h3 {
  font-size: 16px;
  line-height: 1.4;
}

.group-head p {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.02em;
}

.settings-plan-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--soft);
}

.settings-plan-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.settings-plan-copy span {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.06em;
}

.settings-plan-copy b {
  overflow: hidden;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.settings-plan-copy small {
  color: var(--muted);
  font-size: 12px;
}

.settings-plan-card .ghost-btn {
  flex: 0 0 auto;
  min-height: 34px;
  padding: 0 11px;
  font-size: 12px;
}

.settings-add-field {
  max-width: 210px;
  margin-top: 14px;
}

.countdown-fields {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.date-shell input {
  padding-right: 10px;
  font-family: var(--font-sans);
  font-size: 12px;
}

.date-shell input::-webkit-calendar-picker-indicator {
  opacity: 0.8;
  cursor: pointer;
}

.countdown-editor {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.countdown-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 32px;
  gap: 10px;
  align-items: end;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--soft);
}

.countdown-remove {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  margin-bottom: 3px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  color: var(--muted);
  font-size: 17px;
  line-height: 1;
  background: var(--card-solid);
}

.countdown-remove:hover {
  color: var(--cinnabar);
  border-color: var(--cinnabar);
  background: var(--cinnabar-soft);
}

.countdown-add {
  width: 100%;
  margin-top: 10px;
}

.countdown-add:disabled {
  opacity: 0.5;
  cursor: default;
}

.countdown-editor-hint {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field > span:first-child {
  color: var(--ink-soft);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.input-shell,
.select-shell {
  position: relative;
  display: flex;
  align-items: center;
}

.input-shell input,
.select-shell select {
  width: 100%;
  height: 43px;
  padding: 0 38px 0 12px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  color: var(--ink);
  font-family: var(--font-num);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  background: var(--soft);
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.input-shell input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

.input-shell input[type="number"]::-webkit-inner-spin-button,
.input-shell input[type="number"]::-webkit-outer-spin-button {
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
}

.select-shell select {
  padding-right: 30px;
  font-family: var(--font-sans);
  font-size: 12px;
  appearance: none;
  cursor: pointer;
}

.input-shell input:hover,
.select-shell select:hover {
  border-color: var(--ink-soft);
}

.input-shell input:focus,
.select-shell select:focus {
  outline: none;
  border-color: var(--cinnabar);
  background: var(--card-raised);
  box-shadow: 0 0 0 3px var(--cinnabar-soft);
}

.input-shell em {
  position: absolute;
  right: 11px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  pointer-events: none;
}

.select-shell::after {
  content: "";
  position: absolute;
  right: 13px;
  width: 5px;
  height: 5px;
  border-right: 1px solid var(--muted);
  border-bottom: 1px solid var(--muted);
  transform: translateY(-2px) rotate(45deg);
  pointer-events: none;
}

.switch-list {
  display: grid;
  gap: 1px;
  margin-top: 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--line);
}

.switch-row {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 14px;
  background: var(--card-solid);
  cursor: pointer;
  transition: background 0.2s ease;
}

.switch-row:hover {
  background: var(--soft);
}

.switch-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.switch-copy b {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.03em;
}

.switch-copy small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.switch-row input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.switch-ui {
  position: relative;
  flex: 0 0 auto;
  width: 40px;
  height: 23px;
  border: 1px solid var(--input-border);
  border-radius: 999px;
  background: var(--soft-strong);
  transition: background 0.22s ease, border-color 0.22s ease;
}

.switch-ui::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 15px;
  height: 15px;
  border-radius: 50%;
  background: var(--muted);
  box-shadow: 0 2px 6px rgba(16, 42, 35, 0.22);
  transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), background 0.22s ease;
}

.switch-row input:checked + .switch-ui {
  border-color: var(--cinnabar);
  background: var(--cinnabar);
}

.switch-row input:checked + .switch-ui::after {
  background: var(--switch-thumb);
  transform: translateX(17px);
}

.switch-row input:focus-visible + .switch-ui {
  outline: 2px solid var(--cinnabar);
  outline-offset: 3px;
}

.switch-row input:disabled + .switch-ui {
  background: var(--input-disabled);
  border-color: var(--input-border);
}

.switch-row input:disabled + .switch-ui::after {
  background: var(--muted);
}

.volume-row {
  display: grid;
  grid-template-columns: auto minmax(90px, 1fr) 44px auto;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 2px 2px 0;
}

.volume-row label {
  color: var(--ink-soft);
  font-size: 12px;
  letter-spacing: 0.03em;
}

.volume-row output {
  color: var(--muted);
  font-family: var(--font-num);
  font-size: 12px;
  text-align: right;
}

input[type="range"] {
  width: 100%;
  height: 4px;
  margin: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--cinnabar), var(--gold));
  appearance: none;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  width: 16px;
  height: 16px;
  border: 2px solid var(--card-solid);
  border-radius: 50%;
  background: var(--cinnabar);
  box-shadow: 0 2px 8px rgba(16, 42, 35, 0.25);
  appearance: none;
}

input[type="range"]::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 2px solid var(--card-solid);
  border-radius: 50%;
  background: var(--cinnabar);
}

.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 28px;
  border-top: 1px solid var(--line);
  background: var(--card-solid);
}

.dialog-action-group {
  display: flex;
  align-items: center;
  gap: 9px;
}

.dialog-action-group .ghost-btn,
.dialog-action-group .small-primary {
  min-width: 96px;
  height: 42px;
}

/* Exam composition dialog */

.plan-dialog {
  width: min(1040px, calc(100vw - 28px));
}

#planForm {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 30px);
  max-height: calc(100dvh - 30px);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 27px;
  background: var(--card-solid);
  box-shadow: 0 44px 120px -36px rgba(0, 0, 0, 0.55);
}

.plan-dialog-head {
  padding-bottom: 16px;
}

.plan-dialog-body {
  display: grid;
  grid-template-columns: 1.06fr 0.94fr;
  gap: 22px;
  min-height: 0;
  overflow-y: auto;
  padding: 20px 26px 24px;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.plan-dialog-body::-webkit-scrollbar {
  width: 6px;
}

.plan-dialog-body::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: var(--line-strong);
}

.plan-library,
.plan-editor {
  min-width: 0;
}

.plan-library-head,
.plan-editor-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.plan-library h3,
.plan-editor h3 {
  font-size: 16px;
  line-height: 1.4;
}

.plan-library-head > span {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.plan-search {
  position: relative;
  display: flex;
  align-items: center;
  margin-top: 12px;
}

.plan-search .icon {
  position: absolute;
  left: 11px;
  width: 15px;
  height: 15px;
  color: var(--muted);
  pointer-events: none;
}

.plan-search input {
  width: 100%;
  height: 38px;
  padding: 0 12px 0 34px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  font-size: 12px;
  background: var(--soft);
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.plan-search input:focus {
  outline: none;
  border-color: var(--cinnabar);
  background: var(--card-raised);
  box-shadow: 0 0 0 3px var(--cinnabar-soft);
}

.plan-library-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-top: 15px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.08em;
}

.plan-library-label small {
  color: var(--muted);
  font-size: 12px;
  opacity: 0.7;
}

.plan-packages {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
  margin-top: 7px;
}

.plan-package {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink-soft);
  text-align: left;
  background: var(--soft);
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.plan-package:hover {
  border-color: var(--cinnabar);
  background: var(--cinnabar-soft);
  transform: translateY(-1px);
}

.plan-package b {
  overflow: hidden;
  max-width: 100%;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plan-package span {
  overflow: hidden;
  max-width: 100%;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plan-package em {
  color: var(--cinnabar);
  font-size: 12px;
  font-style: normal;
  letter-spacing: 0.04em;
}

.plan-catalog {
  display: grid;
  gap: 13px;
  margin-top: 15px;
}

.plan-group-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.plan-group-head::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--line);
}

.plan-group-items {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px;
}

.plan-catalog-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  min-width: 0;
  padding: 8px 24px 8px 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--ink-soft);
  text-align: left;
  background: var(--card-solid);
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease;
}

.plan-catalog-item:hover {
  border-color: var(--line-strong);
  background: var(--soft);
  transform: translateY(-1px);
}

.plan-catalog-item .catalog-exam {
  overflow: hidden;
  max-width: 100%;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.03em;
  line-height: 1.5;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plan-catalog-item b {
  overflow: hidden;
  max-width: 100%;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.plan-catalog-item .catalog-meta {
  color: var(--muted);
  font-family: var(--font-num);
  font-size: 12px;
  line-height: 1.5;
}

.plan-catalog-item::after {
  content: "+";
  position: absolute;
  top: 7px;
  right: 8px;
  color: var(--jade);
  font-family: var(--font-num);
  font-size: 13px;
  line-height: 1;
}

.plan-source-note {
  margin-top: 15px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.7;
}

.plan-search-empty {
  padding: 18px 4px;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 12px;
  letter-spacing: 0.03em;
  text-align: center;
}

.plan-editor {
  align-self: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--soft);
}

.plan-editor-head .link-btn {
  font-size: 12px;
}

.plan-name-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 12px;
}

.plan-name-field span {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.06em;
}

.plan-name-field input {
  width: 100%;
  height: 34px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font-family: var(--font-display);
  font-size: 12px;
  background: var(--card-solid);
}

.plan-name-field input:focus {
  outline: none;
  border-color: var(--cinnabar);
  box-shadow: 0 0 0 3px var(--cinnabar-soft);
}

.plan-section-list {
  display: grid;
  gap: 6px;
  max-height: 292px;
  margin-top: 11px;
  padding-right: 2px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.plan-section-list::-webkit-scrollbar {
  width: 5px;
}

.plan-section-list::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: var(--line-strong);
}

.plan-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) 70px 62px auto;
  gap: 5px;
  align-items: center;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--card-solid);
}

.plan-row-index {
  color: var(--muted);
  font-family: var(--font-num);
  font-size: 12px;
  text-align: center;
}

.plan-row-name,
.plan-num {
  position: relative;
  display: block;
  min-width: 0;
}

.plan-row input {
  width: 100%;
  height: 30px;
  padding: 0 7px;
  border: 1px solid transparent;
  border-radius: 6px;
  color: var(--ink);
  font-size: 12px;
  background: var(--soft);
  transition: border-color 0.2s ease, background 0.2s ease;
}

.plan-row input:focus {
  outline: none;
  border-color: var(--cinnabar);
  background: var(--card-raised);
}

.plan-num input {
  padding-right: 19px;
  font-family: var(--font-num);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.plan-num em {
  position: absolute;
  top: 50%;
  right: 5px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  transform: translateY(-50%);
  pointer-events: none;
}

.plan-row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 2px;
}

.plan-row-actions button {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
  background: var(--soft);
  transition: color 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}

.plan-row-actions button:not(:disabled):hover {
  border-color: var(--line-strong);
  color: var(--ink);
  background: var(--soft-strong);
}

.plan-row-actions button[data-action="remove"]:not(:disabled):hover {
  border-color: rgba(194, 82, 59, 0.4);
  color: var(--cinnabar);
  background: var(--cinnabar-soft);
}

.plan-row-actions button:disabled {
  opacity: 0.25;
}

.plan-empty {
  padding: 22px 8px;
  border: 1px dashed var(--line-strong);
  border-radius: 9px;
  color: var(--muted);
  font-family: var(--font-display);
  font-size: 12px;
  line-height: 1.7;
  text-align: center;
}

.plan-total {
  margin-top: 11px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink-soft);
  font-family: var(--font-num);
  font-size: 12px;
  letter-spacing: 0.02em;
  text-align: center;
  background: var(--card-solid);
}

.plan-total.is-error {
  border-color: rgba(194, 82, 59, 0.42);
  color: var(--cinnabar-deep);
  background: var(--cinnabar-soft);
}

.plan-continuity {
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.02em;
  line-height: 1.6;
}

.plan-continuity span {
  color: var(--cinnabar);
}

.plan-dialog-actions {
  padding-top: 14px;
  padding-bottom: 14px;
}

/* Finish dialog */

.finish-dialog {
  width: min(480px, calc(100vw - 28px));
  max-height: calc(100vh - 24px);
  max-height: calc(100dvh - 24px);
  padding: 32px 30px 27px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 28px;
  text-align: center;
  background: var(--card-solid);
  box-shadow: 0 44px 120px -36px rgba(0, 0, 0, 0.55);
}

.finish-seal {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  margin: 0 auto 16px;
  border: 1px solid rgba(194, 82, 59, 0.32);
  border-radius: 50%;
  color: var(--cinnabar);
  background: var(--cinnabar-soft);
  box-shadow: 0 0 0 9px rgba(194, 82, 59, 0.045);
}

.finish-seal .icon {
  width: 27px;
  height: 27px;
}

.finish-dialog h2 {
  margin-top: 6px;
  font-size: 27px;
  line-height: 1.35;
}

.finish-summary {
  max-width: 34ch;
  margin: 8px auto 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.75;
}

.finish-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  margin-top: 22px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--line);
}

.finish-stats > div {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 8px;
  background: var(--soft);
}

.finish-stats span {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.06em;
}

.finish-stats strong {
  color: var(--ink);
  font-family: var(--font-num);
  font-size: 17px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}

.finish-question {
  margin-top: 13px;
  padding: 10px 12px 9px;
  border: 1px dashed var(--line-strong);
  border-radius: 13px;
  background: var(--soft);
}

.finish-question-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}

.finish-question-row label {
  color: var(--ink-soft);
  font-size: 12px;
  letter-spacing: 0.04em;
}

.finish-question-field {
  position: relative;
  width: 92px;
}

.finish-question-field input {
  width: 100%;
  height: 33px;
  padding: 0 25px 0 10px;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  color: var(--ink);
  font-family: var(--font-num);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  text-align: center;
  background: var(--card-solid);
  transition: border-color 0.2s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.finish-question-field input[type="number"] {
  appearance: textfield;
  -moz-appearance: textfield;
}

.finish-question-field input[type="number"]::-webkit-inner-spin-button,
.finish-question-field input[type="number"]::-webkit-outer-spin-button {
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
}

.finish-question-field input:focus {
  outline: none;
  border-color: var(--cinnabar);
  background: var(--card-raised);
  box-shadow: 0 0 0 3px var(--cinnabar-soft);
}

.finish-question-field span {
  position: absolute;
  top: 50%;
  right: 9px;
  color: var(--muted);
  font-size: 12px;
  pointer-events: none;
  transform: translateY(-50%);
}

.finish-question-hint {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.finish-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-top: 21px;
}

.finish-actions .small-primary,
.finish-actions .ghost-btn {
  min-width: 128px;
  height: 44px;
}

/* Restore session dialog */

.restore-dialog {
  width: min(500px, calc(100vw - 28px));
  padding: 30px 30px 26px;
  border: 1px solid var(--line);
  border-radius: 27px;
  text-align: center;
  background: var(--card-solid);
  box-shadow: 0 44px 120px -36px rgba(0, 0, 0, 0.55);
}

.restore-icon {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin: 0 auto 15px;
  border: 1px solid rgba(59, 124, 104, 0.3);
  border-radius: 50%;
  color: var(--jade);
  background: var(--jade-soft);
  box-shadow: 0 0 0 8px rgba(59, 124, 104, 0.04);
}

.restore-icon svg {
  width: 25px;
  height: 25px;
}

.restore-dialog h2 {
  margin-top: 6px;
  font-size: 25px;
}

.restore-copy {
  max-width: 36ch;
  margin: 8px auto 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.75;
}

.restore-list {
  display: grid;
  gap: 7px;
  margin-top: 19px;
  padding: 0;
  list-style: none;
  text-align: left;
}

.restore-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--soft);
}

.restore-item > span {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.restore-item b {
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.restore-item small {
  color: var(--muted);
  font-size: 12px;
}

.restore-item em {
  flex: 0 0 auto;
  color: var(--ink);
  font-family: var(--font-num);
  font-size: 12px;
  font-style: normal;
  font-variant-numeric: tabular-nums;
}

.restore-saved {
  margin-top: 12px;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.02em;
}

.restore-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-top: 18px;
}

.restore-actions .ghost-btn,
.restore-actions .small-primary {
  min-width: 132px;
  height: 43px;
}

/* --------------------------------------------------------------------------
   Toast
   -------------------------------------------------------------------------- */

.toast {
  position: fixed;
  bottom: calc(24px + env(safe-area-inset-bottom));
  left: 50%;
  z-index: 100;
  max-width: calc(100vw - 32px);
  padding: 10px 17px;
  border: 1px solid rgba(255, 251, 242, 0.12);
  border-radius: 999px;
  color: var(--button-text);
  font-size: 12px;
  letter-spacing: 0.03em;
  line-height: 1.5;
  text-align: center;
  background: var(--button-bg);
  box-shadow: 0 18px 44px -18px rgba(0, 0, 0, 0.5);
  opacity: 0;
  transform: translate(-50%, 14px);
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.toast.is-show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.boot-error {
  position: fixed;
  top: calc(12px + env(safe-area-inset-top));
  left: 50%;
  z-index: 200;
  width: min(620px, calc(100vw - 24px));
  padding: 11px 14px;
  border: 1px solid rgba(194, 82, 59, 0.32);
  border-radius: 10px;
  color: var(--danger);
  font-size: 12px;
  line-height: 1.55;
  text-align: center;
  background: var(--error-bg);
  box-shadow: var(--shadow-soft);
  transform: translateX(-50%);
}

html[data-theme="dark"] .boot-error {
  color: var(--danger);
  background: var(--error-bg);
}

.boot-error[hidden] {
  display: none;
}

/* --------------------------------------------------------------------------
   Motion
   -------------------------------------------------------------------------- */

@keyframes live-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(59, 124, 104, 0.28);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(59, 124, 104, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(59, 124, 104, 0);
  }
}

@keyframes mode-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(194, 82, 59, 0.3);
  }
  70% {
    box-shadow: 0 0 0 6px rgba(194, 82, 59, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(194, 82, 59, 0);
  }
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes backdrop-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes item-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}


/* Manual practice entry */
.practice-history-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.manual-practice-dialog { width: min(480px, calc(100vw - 28px)); max-height: calc(100dvh - 28px); overflow-y: auto; border: 1px solid var(--line); border-radius: 24px; background: var(--card-solid); box-shadow: 0 32px 90px -30px rgba(0, 0, 0, .5); }
.manual-practice-fields { display: grid; gap: 18px; padding: 24px 28px; }
.manual-practice-fields label { display: grid; gap: 8px; color: var(--ink-soft); font-size: 13px; }
.manual-practice-fields input { width: 100%; min-width: 0; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 10px; color: var(--ink); background: var(--soft); font: inherit; }
.manual-practice-duration { min-width: 0; margin: 0; padding: 0; border: 0; }
.manual-practice-duration legend { margin-bottom: 8px; color: var(--ink-soft); font-size: 13px; }
.manual-practice-duration-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.manual-practice-duration-inputs label { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
.manual-practice-hint { color: var(--muted); font-size: 12px; line-height: 1.6; }
.manual-practice-dialog .dialog-actions { justify-content: flex-end; }
html[data-theme="light"] .finish-stats span,
html[data-theme="light"] .switch-row:hover .switch-copy small { color: var(--ink-soft); }
@media (max-width: 480px) {
  .manual-practice-dialog .dialog-head, .manual-practice-fields { padding: 20px; }
  .practice-history-actions { gap: 10px; }
}
