:root {
  color-scheme: dark;
  --bg-main: radial-gradient(circle at top, #203b69 0%, #0f1726 46%, #070b12 100%);
  --bg-panel: rgba(14, 20, 34, 0.78);
  --bg-panel-strong: rgba(20, 29, 47, 0.94);
  --text-main: #eef4ff;
  --text-soft: #c2cedf;
  --text-faint: #8aa1bb;
  --border: rgba(160, 184, 219, 0.16);
  --shadow: 0 20px 54px rgba(0, 0, 0, 0.28);
  --primary: #94d6ff;
  --primary-strong: #1d84c4;
  --danger: #ef7f86;
  --warn: #f0c669;
  --success: #64d7aa;
  --panel-surface: rgba(255, 255, 255, 0.04);
  --fade-shadow: rgba(0, 0, 0, 0.36);
  --due-accent: #ffb15a;
  --due-accent-strong: #de6f26;
}

body[data-theme="light"] {
  color-scheme: light;
  --bg-main: radial-gradient(circle at top, #fff3d2 0%, #f7eee2 40%, #edf2f8 100%);
  --bg-panel: rgba(255, 255, 255, 0.78);
  --bg-panel-strong: rgba(255, 255, 255, 0.95);
  --text-main: #182433;
  --text-soft: #536170;
  --text-faint: #76889c;
  --border: rgba(66, 93, 129, 0.12);
  --shadow: 0 18px 42px rgba(78, 95, 123, 0.16);
  --primary: #266fa8;
  --primary-strong: #195884;
  --danger: #ce5961;
  --warn: #b68423;
  --success: #1c7e5d;
  --panel-surface: rgba(17, 38, 67, 0.04);
  --fade-shadow: rgba(23, 37, 59, 0.22);
  --due-accent: #c9781d;
  --due-accent-strong: #9d4f14;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  background: var(--bg-main);
  color: var(--text-main);
  font-family: "Segoe UI Variable", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  border: none;
  border-radius: 999px;
  cursor: pointer;
  transition: transform 160ms ease, opacity 160ms ease, background 160ms ease, border-color 160ms ease;
}

button:hover:not(:disabled) {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

button:focus {
  outline: none;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  box-shadow: 0 0 0 2px rgba(148, 214, 255, 0.24);
}

.hidden,
.is-hidden {
  display: none !important;
}

.app-shell {
  width: 100vw;
  height: 100vh;
  overflow: auto;
  scrollbar-width: none;
}

.app-shell::-webkit-scrollbar,
.answer-scroll::-webkit-scrollbar,
.modal-panel::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.answer-scroll,
.modal-panel {
  scrollbar-width: none;
}

.page-frame {
  width: min(1280px, calc(100vw - 36px));
  margin: 0 auto;
  padding: 18px 0 28px;
}

.scroll-fade {
  position: relative;
}

.scroll-fade::before,
.scroll-fade::after {
  content: "";
  position: sticky;
  left: 0;
  right: 0;
  height: 18px;
  display: block;
  pointer-events: none;
  opacity: 0;
  transition: opacity 160ms ease;
  z-index: 2;
}

.scroll-fade::before {
  top: 0;
  margin-bottom: -18px;
  background: linear-gradient(180deg, var(--fade-shadow), transparent);
}

.scroll-fade::after {
  bottom: 0;
  margin-top: -18px;
  background: linear-gradient(0deg, var(--fade-shadow), transparent);
}

.scroll-fade.has-top-shadow::before {
  opacity: 1;
}

.scroll-fade.has-bottom-shadow::after {
  opacity: 1;
}

.settings-modal {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.settings-scroll {
  min-height: 0;
  overflow: auto;
  scrollbar-width: none;
}

.settings-scroll::-webkit-scrollbar {
  width: 0;
  height: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 14px;
}

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

.topbar h1 {
  margin: 0;
  font-size: clamp(28px, 2.7vw, 38px);
  font-family: "Times New Roman", Times, serif;
  font-style: italic;
  letter-spacing: 0.02em;
}

.eyebrow,
.modal-eyebrow {
  margin: 0 0 4px;
  color: var(--primary);
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}

.status-chip,
.task-type-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--text-soft);
  background: var(--bg-panel);
}

.status-chip[data-state="known"] {
  color: #0e241c;
  background: var(--success);
}

.status-chip[data-state="vague"] {
  color: #241b09;
  background: var(--warn);
}

.status-chip[data-state="unknown"] {
  color: #2b1013;
  background: var(--danger);
}

.task-type-chip[data-type="new"] {
  color: #0c2230;
  background: var(--primary);
}

.task-type-chip[data-type="review"] {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.08);
}

.task-type-chip[data-type="done"] {
  color: var(--text-soft);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat-card,
.word-card,
.transition-card,
.tips-panel,
.modal-panel,
.stats-section {
  border: 1px solid var(--border);
  background: var(--bg-panel);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.stat-card {
  border-radius: 18px;
  padding: 14px 16px;
}

.stat-card span,
.stat-card small {
  display: block;
}

.stat-card span {
  color: var(--text-soft);
  font-size: 13px;
  margin-bottom: 6px;
}

.stat-card strong {
  font-size: 24px;
}

.stat-card small {
  margin-top: 5px;
  color: var(--text-faint);
  font-size: 11px;
  line-height: 1.4;
}

.workspace {
  display: grid;
  gap: 14px;
}

.word-card {
  border-radius: 30px;
  padding: 22px 28px 24px;
  height: min(560px, calc(100vh - 300px));
  min-height: 500px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  gap: 16px;
  background: linear-gradient(180deg, var(--bg-panel-strong), var(--bg-panel));
}

.transition-card {
  border-radius: 30px;
  min-height: 560px;
  padding: 34px 28px;
  display: grid;
  place-items: center;
  text-align: center;
  gap: 18px;
  background: linear-gradient(180deg, var(--bg-panel-strong), var(--bg-panel));
}

.transition-eyebrow {
  color: var(--primary);
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.transition-card h2 {
  margin: 0;
  font-size: clamp(34px, 4.8vw, 58px);
  font-family: Georgia, "Times New Roman", serif;
}

.transition-card p {
  margin: 0;
  max-width: 620px;
  color: var(--text-soft);
  line-height: 1.8;
}

.transition-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.card-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  color: var(--text-soft);
  font-size: 14px;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.word-core {
  display: grid;
  gap: 12px;
  text-align: center;
  align-self: start;
}

#wordText {
  margin: 0;
  font-size: clamp(42px, 6vw, 76px);
  line-height: 1;
  letter-spacing: 0.02em;
  font-family: Georgia, "Times New Roman", serif;
}

.answer-scroll {
  min-height: 0;
  overflow: auto;
  width: min(900px, 100%);
  margin: 0 auto;
  padding: 2px 6px 10px 36px;
}

.answer-placeholder {
  min-height: 100%;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--text-soft);
  padding-right: 24px;
}

.answer-content {
  text-align: left;
}

.phonetic-line {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin: 0 0 10px;
  color: var(--primary);
  font-size: 17px;
  flex-wrap: wrap;
}

.phonetic-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.phonetic-audio-button {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(148, 214, 255, 0.08);
  color: var(--primary);
  font-size: 13px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.phonetic-audio-button:hover,
.phonetic-audio-button:focus-visible {
  background: rgba(148, 214, 255, 0.16);
  outline: none;
}

.phonetic-audio-button[data-state="playing"] {
  background: rgba(148, 214, 255, 0.18);
  color: var(--primary);
  border-color: color-mix(in srgb, var(--primary) 58%, var(--border));
  box-shadow:
    0 0 0 3px rgba(37, 127, 204, 0.12),
    0 0 16px rgba(37, 127, 204, 0.28);
}

.meanings-list {
  display: grid;
  gap: 7px;
}

.meaning-line {
  margin: 0;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  line-height: 1.55;
  color: var(--text-main);
}

.meaning-pos {
  flex: 0 0 auto;
  min-width: 42px;
  font-size: 17px;
  font-weight: 700;
  color: var(--primary);
}

.meaning-definitions,
.meaning-empty {
  margin: 0;
  color: var(--text-main);
}

.examples-block {
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.examples-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
}

.example-item {
  display: grid;
  gap: 4px;
}

.example-english-row {
  display: flex;
  align-items: flex-start;
  gap: 7px;
}

.example-english,
.example-chinese {
  margin: 0;
  line-height: 1.5;
}

.example-english {
  color: var(--text-main);
}

.example-chinese {
  color: var(--text-soft);
  font-size: 14px;
}

.example-audio-button {
  flex: 0 0 auto;
  width: 24px;
  height: 24px;
  margin-top: 1px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(148, 214, 255, 0.08);
  color: var(--primary);
  font-size: 12px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.example-audio-button:hover,
.example-audio-button:focus-visible {
  background: rgba(148, 214, 255, 0.16);
  outline: none;
}

.example-audio-button[data-state="playing"] {
  background: rgba(148, 214, 255, 0.18);
  border-color: color-mix(in srgb, var(--primary) 58%, var(--border));
  box-shadow:
    0 0 0 3px rgba(37, 127, 204, 0.1),
    0 0 14px rgba(37, 127, 204, 0.24);
}

.nav-strip,
.review-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.primary-button,
.ghost-button,
.review-button,
.icon-button,
.segment {
  min-height: 48px;
  padding: 0 20px;
  font-size: 15px;
}

.primary-button {
  background: var(--primary);
  color: #08131d;
  font-weight: 700;
}

.ghost-button,
.icon-button,
.segment {
  background: transparent;
  color: var(--text-main);
  border: 1px solid var(--border);
}

.topbar-button {
  min-height: 42px;
}

.icon-button {
  min-width: 48px;
  width: 48px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-button svg {
  width: 19px;
  height: 19px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.review-button {
  min-width: 150px;
  min-height: 44px;
  color: #08131d;
  font-weight: 700;
}

.nav-strip .primary-button,
.nav-strip .ghost-button {
  min-height: 44px;
}

.review-button.danger {
  background: var(--danger);
}

.review-button.warn {
  background: var(--warn);
}

.review-button.success {
  background: var(--success);
}

.tips-panel {
  border-radius: 20px;
  padding: 10px 16px;
  color: var(--text-soft);
}

.tips-row {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
}

.tips-row span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--panel-surface);
}

code {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(148, 214, 255, 0.12);
  color: var(--primary);
  font-family: "Consolas", "SFMono-Regular", monospace;
  font-size: 0.92em;
}

.overlay {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  z-index: 50;
}

.overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 11, 20, 0.62);
}

.modal-panel {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  overflow: auto;
  border-radius: 28px;
  padding: 24px;
  background: linear-gradient(180deg, var(--bg-panel-strong), var(--bg-panel));
}

.modal-header,
.section-header,
.stats-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.modal-header {
  margin-bottom: 20px;
}

.modal-header h2,
.section-header h3 {
  margin: 0;
  white-space: nowrap;
  flex: 0 0 auto;
}

.stats-toolbar {
  margin-bottom: 18px;
}

.stats-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  gap: 18px;
}

.stats-section {
  border-radius: 22px;
  padding: 18px;
  background: var(--panel-surface);
}

.calendar-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.calendar-controls span {
  min-width: 108px;
  text-align: center;
  color: var(--text-soft);
}

.small-button {
  min-height: 38px;
  min-width: 38px;
  padding: 0;
}

.calendar-weekdays {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  color: var(--text-soft);
  font-size: 13px;
  text-align: center;
}

.calendar-grid {
  margin-top: 10px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.calendar-cell {
  min-height: 72px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--stats-accent, var(--primary)) calc(10% + (var(--heat, 0) * 42%)), transparent);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  padding: 10px;
  color: var(--text-main);
}

.calendar-cell.is-blank {
  border-style: dashed;
  background: transparent;
}

.calendar-day {
  font-size: 14px;
}

.calendar-count {
  font-size: 19px;
  font-weight: 700;
}

.chart-area {
  min-height: 280px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding-top: 18px;
}

.chart-bar-item {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.chart-bar-count {
  min-height: 22px;
  font-size: 12px;
  color: var(--text-soft);
}

.chart-bar {
  width: 100%;
  min-height: 4px;
  border-radius: 14px 14px 6px 6px;
  background: linear-gradient(180deg, var(--stats-accent, var(--primary)), var(--stats-accent-strong, var(--primary-strong)));
}

.chart-bar-label {
  min-height: 18px;
  font-size: 12px;
  color: var(--text-faint);
}

.chart-caption,
.settings-help,
.empty-state {
  margin: 14px 0 0;
  color: var(--text-soft);
}

.compact-help {
  font-size: 13px;
}

.empty-state {
  width: 100%;
  text-align: center;
}

.segmented {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
  width: 100%;
}

.segment {
  min-height: 42px;
}

.segment.is-active {
  background: var(--primary);
  color: #08131d;
  border-color: transparent;
  font-weight: 700;
}

.segment-due {
  margin-left: auto;
}

#statsModal {
  --stats-accent: var(--primary);
  --stats-accent-strong: var(--primary-strong);
}

#statsModal[data-category="due"] {
  --stats-accent: var(--due-accent);
  --stats-accent-strong: var(--due-accent-strong);
}

#statsModal[data-category="due"] #statsCategorySwitch .segment[data-category="due"].is-active {
  background: var(--due-accent);
  color: #2f1403;
}

#statsModal[data-category="due"] #chartRangeSwitch .segment.is-active {
  background: var(--due-accent);
  color: #2f1403;
}

.segment.is-disabled,
.segment:disabled {
  background: transparent;
  color: var(--text-soft);
  border-color: var(--border);
  opacity: 0.5;
  transform: none;
}

.compact .segment {
  min-height: 38px;
  padding: 0 16px;
}

.settings-panels {
  display: grid;
  padding: 2px 6px 6px 0;
}

.settings-group + .settings-group {
  margin-top: 24px;
}

.settings-group h3 {
  margin: 0 0 8px;
}

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

.setting-field {
  display: grid;
  gap: 8px;
}

.setting-field span {
  color: var(--text-soft);
  font-size: 14px;
}

.info-card {
  display: grid;
  gap: 6px;
  min-height: 46px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--panel-surface);
}

.info-card strong {
  color: var(--text-main);
  font-size: 15px;
}

.info-card small {
  color: var(--text-soft);
  line-height: 1.5;
}

.settings-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 16px;
}

#dataActionHint {
  display: none;
}

.toggle-panel {
  display: grid;
  gap: 14px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--panel-surface);
}

.toggle-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0;
}

.toggle-copy {
  display: grid;
  gap: 6px;
}

.toggle-title {
  color: var(--text-main);
  font-size: 16px;
  font-weight: 700;
}

.toggle-description {
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.6;
}

.toggle-note {
  margin: 0;
  padding-top: 4px;
  color: var(--text-faint);
  font-size: 13px;
  line-height: 1.6;
}

.toggle-switch {
  position: relative;
  flex: 0 0 auto;
  display: inline-flex;
  cursor: pointer;
}

.toggle-switch input {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.toggle-slider {
  position: relative;
  width: 54px;
  height: 32px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.08);
  transition: background 160ms ease, border-color 160ms ease;
}

.toggle-slider::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--text-main);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
  transition: transform 160ms ease;
}

.toggle-switch input:checked + .toggle-slider {
  background: var(--primary);
  border-color: transparent;
}

.toggle-switch input:checked + .toggle-slider::after {
  transform: translateX(22px);
  background: #08131d;
}

.toggle-switch input:disabled + .toggle-slider {
  opacity: 0.45;
}

.number-field {
  min-height: 46px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(148, 214, 255, 0.08), rgba(148, 214, 255, 0.02));
  color: var(--text-main);
  padding: 0 16px;
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease, transform 160ms ease;
}

.custom-select {
  position: relative;
  display: grid;
  isolation: isolate;
  z-index: 2;
}

.custom-select.is-open {
  z-index: 220;
}

.select-trigger {
  width: 100%;
  min-height: 46px;
  padding: 0 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(148, 214, 255, 0.08), rgba(148, 214, 255, 0.02));
  color: var(--text-main);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease, transform 160ms ease;
}

.select-trigger span:first-child {
  line-height: 1.2;
}

.select-trigger-icon {
  flex: 0 0 auto;
  width: 10px;
  height: 10px;
  border-right: 2px solid color-mix(in srgb, var(--text-soft) 88%, transparent);
  border-bottom: 2px solid color-mix(in srgb, var(--text-soft) 88%, transparent);
  transform: translateY(-1px) rotate(45deg);
  opacity: 0.9;
  transition: transform 160ms ease, opacity 160ms ease, border-color 160ms ease;
}

.number-field:focus,
.select-trigger:focus-visible {
  border-color: var(--primary);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 0 4px rgba(37, 127, 204, 0.12);
  background: linear-gradient(180deg, rgba(148, 214, 255, 0.12), rgba(148, 214, 255, 0.04));
}

.select-trigger:hover {
  background: linear-gradient(180deg, rgba(148, 214, 255, 0.1), rgba(148, 214, 255, 0.03));
}

.custom-select.is-open .select-trigger {
  border-color: var(--primary);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 0 4px rgba(37, 127, 204, 0.12);
  background: linear-gradient(180deg, rgba(148, 214, 255, 0.12), rgba(148, 214, 255, 0.04));
  position: relative;
  z-index: 121;
}

.custom-select.is-open .select-trigger-icon {
  transform: translateY(1px) rotate(225deg);
  border-color: var(--primary);
}

.select-menu {
  position: absolute;
  top: calc(100% + 10px);
  left: 0;
  right: 0;
  z-index: 221;
  display: grid;
  gap: 4px;
  padding: 8px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: var(--bg-panel-strong);
  backdrop-filter: blur(18px);
  box-shadow: 0 22px 48px rgba(15, 23, 42, 0.18);
  pointer-events: auto;
}

.select-option {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text-main);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-align: left;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.select-option:hover,
.select-option:focus-visible {
  background: rgba(148, 214, 255, 0.12);
  border-color: rgba(37, 127, 204, 0.16);
  outline: none;
}

.select-option.is-selected {
  background: rgba(37, 127, 204, 0.14);
  border-color: rgba(37, 127, 204, 0.24);
  font-weight: 700;
}

.select-option-check {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(37, 127, 204, 0.16);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 10px;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 140ms ease, transform 140ms ease;
}

.select-option.is-selected .select-option-check {
  opacity: 1;
  transform: scale(1);
}

.about-panel {
  margin-top: 0;
}

.about-content {
  color: var(--text-main);
  line-height: 1.8;
}

.about-content h3,
.about-content h4 {
  margin: 0 0 10px;
}

.about-content h4 {
  margin-top: 18px;
  color: var(--primary);
}

.about-content p {
  margin: 0 0 12px;
}

.about-content ul {
  margin: 0 0 12px;
  padding-left: 22px;
}

.about-content li + li {
  margin-top: 8px;
}

@media (max-width: 1160px) {
  .stats-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 860px) {
  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }

  .toggle-card {
    align-items: flex-start;
  }

  .stats-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .page-frame {
    width: min(100vw - 20px, 1280px);
    padding-top: 18px;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .word-card {
    height: 620px;
    padding: 22px;
  }

  .transition-card {
    min-height: 620px;
    padding: 24px 22px;
  }

  #wordText {
    font-size: clamp(38px, 13vw, 60px);
  }

  .answer-scroll {
    width: 100%;
    padding-left: 10px;
    padding-right: 2px;
  }

  .meaning-line {
    flex-direction: column;
    gap: 4px;
  }

  .review-button,
  .primary-button,
  .ghost-button,
  .topbar-button {
    width: 100%;
  }

  .icon-button {
    width: 48px;
  }

  .modal-panel {
    padding: 18px;
  }

  .toggle-card {
    flex-direction: column;
  }

  .toggle-switch {
    width: 100%;
    justify-content: flex-end;
  }

  .calendar-cell {
    min-height: 62px;
    padding: 8px;
  }

  .chart-area {
    overflow-x: auto;
  }
}

/* 朗读按钮：仅手机端固定底栏中显示，桌面端隐藏 */
.review-actions .speak-toggle {
  display: none;
}

/* ============================================================
   手机端自适应层（≤720px 视口；桌面端与平板横屏布局不受影响）
   ============================================================ */
@media (max-width: 720px) {
  .app-shell {
    height: 100dvh;
    overflow-x: hidden;
  }

  .page-frame {
    width: min(100vw - 16px, 1280px);
    padding-top: 10px;
    /* 给固定的底部评分栏留出空间 */
    padding-bottom: calc(88px + env(safe-area-inset-bottom));
  }

  .topbar {
    gap: 8px;
    margin-bottom: 10px;
  }

  .topbar h1 {
    font-size: clamp(20px, 6vw, 28px);
  }

  .topbar-actions {
    gap: 8px;
  }

  .topbar-button {
    width: auto;
    min-height: 38px;
    padding: 0 12px;
    font-size: 13px;
  }

  .icon-button {
    width: 38px;
    min-width: 38px;
  }

  /* 统计信息压缩成一行细条，可横滑，不占纵向空间 */
  .stats-grid {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: auto;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .stats-grid::-webkit-scrollbar {
    width: 0;
    height: 0;
  }

  .stat-card {
    padding: 7px 12px;
    border-radius: 12px;
    white-space: nowrap;
    display: flex;
    align-items: baseline;
  }

  .stat-card span {
    display: inline;
    font-size: 11px;
    margin: 0 6px 0 0;
  }

  .stat-card strong {
    font-size: 15px;
  }

  .stat-card small {
    display: none;
  }

  .workspace {
    gap: 10px;
  }

  /* 单词卡：改为随页面滚动，不再内部滚动 */
  .word-card {
    height: auto;
    min-height: 0;
    padding: 16px 16px 18px;
    border-radius: 22px;
    gap: 12px;
  }

  .answer-scroll {
    overflow: visible;
    padding: 0 2px;
  }

  .answer-placeholder {
    min-height: 180px;
    font-size: 14px;
  }

  #wordText {
    font-size: clamp(30px, 9.5vw, 48px);
  }

  .phonetic-line {
    font-size: 15px;
    gap: 10px;
  }

  /* 上一个 / 显示答案 / 下一个：单行等宽 */
  .nav-strip {
    display: flex;
    gap: 8px;
  }

  .nav-strip .ghost-button,
  .nav-strip .primary-button {
    flex: 1 1 0;
    min-width: 0;
    padding: 0 6px;
    min-height: 46px;
    font-size: 14px;
  }

  .nav-strip .primary-button {
    flex: 1.3 1 0;
  }

  /* 评分栏固定在屏幕底部，展开释义后也始终可见可按 */
  .review-actions {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    flex-wrap: nowrap;
    gap: 8px;
    margin: 0;
    padding: 10px 12px max(10px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--border);
    border-radius: 0;
    background: var(--bg-panel-strong);
    backdrop-filter: blur(18px);
    box-shadow: 0 -10px 26px rgba(3, 9, 16, 0.35);
  }

  .review-button {
    flex: 1 1 0;
    min-width: 0;
    min-height: 52px;
    font-size: 16px;
    padding: 0 4px;
  }

  /* 常驻朗读按钮 */
  .review-actions .speak-toggle {
    display: inline-flex;
    flex: 0 0 58px;
    align-items: center;
    justify-content: center;
    min-height: 52px;
    font-size: 20px;
    padding: 0;
  }

  /* 批次切换卡 */
  .transition-card {
    min-height: min(440px, 58dvh);
    padding: 22px 16px;
    border-radius: 22px;
  }

  .transition-card h2 {
    font-size: clamp(26px, 8vw, 40px);
  }

  .transition-card p {
    font-size: 14px;
  }

  .transition-actions {
    flex-wrap: nowrap;
    width: 100%;
    gap: 8px;
  }

  .transition-actions .ghost-button,
  .transition-actions .primary-button {
    flex: 1 1 0;
    min-width: 0;
  }

  /* 统计 / 设置弹层：全屏面板 */
  .overlay {
    place-items: stretch;
  }

  .modal-panel {
    width: 100vw;
    max-width: 100vw;
    height: 100dvh;
    max-height: 100dvh;
    border-radius: 0;
    padding: 14px 14px 20px;
  }

  .modal-header h2,
  .section-header h3 {
    font-size: 20px;
  }

  .stats-toolbar {
    flex-wrap: wrap;
  }

  .calendar-cell {
    min-height: 54px;
    padding: 6px;
  }

  /* 避免 iOS 聚焦输入框时自动放大 */
  .settings-grid input,
  .settings-grid select,
  .settings-scroll input,
  .settings-scroll select {
    font-size: 16px;
  }
}

/* 触屏设备上隐藏键盘快捷键提示 */
@media (max-width: 720px), (pointer: coarse) {
  .tips-panel {
    display: none;
  }
}
