/* ============================================================
   CSS Custom Properties
   ============================================================ */
:root {
  /* Reading Room — warm paper & ink, oxblood accent.
     Browse/UI palette is intentionally warm; the four ANNOTATION colors
     below are product semantics and must stay exactly as-is. */
  --bg: #f4f1e9;               /* warm paper */
  --surface: #faf7f0;          /* faintly raised paper (hover, panels) */
  --card-bg: #faf7f0;          /* used by player/settings surfaces */
  --primary: #7a2e2e;          /* oxblood — brand accent (was #2563eb) */
  --primary-hover: #5f2222;
  --primary-light: #ece0da;    /* soft oxblood tint */
  --text: #26221c;             /* warm ink */
  --text-secondary: #756a5b;   /* muted warm gray-brown */
  --text-tertiary: #a99d8b;    /* faint — kickers, labels, separators */
  --border: #e4ddcf;           /* warm hairline */
  --rule: #ddd4c3;             /* divider rule (slightly stronger) */
  --highlight: #f4e9cf;        /* warm current-segment highlight (was #fef3c7) */

  /* Annotation semantics — DO NOT CHANGE (encode meaning in player text) */
  --annotation-color: #3B82F6;
  --ann-pronunciation: #3B82F6;
  --ann-vocab-grammar: #10B981;
  --ann-spoken-habit: #F59E0B;
  --ann-uk-culture: #8B5CF6;

  /* Type — Latin display from web fonts, CJK from system (never web-load CJK) */
  --font-serif: 'Newsreader', Georgia, 'Times New Roman', 'Songti SC', serif;
  --font-sans: 'Spline Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', system-ui, sans-serif;
}

/* ---- Themes ----------------------------------------------------------------
   The :root values above ARE the default "Reading Room" theme. To add another
   theme, override tokens under its id here AND register it in js/theme.js, e.g.

     :root[data-theme="field-guide"] {
       --bg: #f7f7f4; --primary: #c8503c;
       --font-serif: 'Hanken Grotesk', sans-serif; ...
     }

   Reading Room needs no override block (data-theme="reading-room" → :root).
--------------------------------------------------------------------------- */

/* ============================================================
   Base Reset
   ============================================================ */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg);
  /* faint paper grain — behind all content, no stacking risk */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
  color: var(--text);
  -webkit-text-size-adjust: 100%;
  overflow-x: hidden;
}

html, body {
  height: 100%;
  height: 100dvh;
}

button {
  cursor: pointer;
  font-family: inherit;
}

select {
  font-family: inherit;
}

.hidden {
  display: none !important;
}

/* ============================================================
   View Container
   ============================================================ */
.view {
  min-height: 100vh;
  min-height: 100dvh;
}

#player-view {
  display: flex;
  flex-direction: column;
  height: var(--app-height, 100vh);
  height: 100dvh;
  min-height: 0;
  overflow: hidden;
}

/* ============================================================
   BROWSE VIEW
   ============================================================ */
.browse-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 22px 20px 18px;
  background: rgba(244, 241, 233, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
  position: sticky;
  top: 0;
  z-index: 10;
}

.browse-header .wordmark { min-width: 0; }

.browse-header h1 {
  font-family: var(--font-serif);
  font-size: 27px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.05;
  color: var(--text);
}

.browse-header .tagline {
  margin-top: 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--text-tertiary);
  text-transform: uppercase;
}

#settings-btn {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  margin: -4px -8px 0 0;
  border: none;
  background: transparent;
  font-size: 19px;
  color: var(--text-secondary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, color 0.15s;
}

#settings-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
}

/* Level Toggle — editorial text tabs with an underline indicator */
.level-toggle {
  display: flex;
  gap: 28px;
  padding: 18px 20px 0;
}

.level-btn {
  padding: 4px 0 10px;
  border: none;
  background: transparent;
  color: var(--text-tertiary);
  font-family: var(--font-sans);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
}

.level-btn.active {
  color: var(--text);
  border-bottom-color: var(--primary);
}

.level-btn:hover:not(.active) {
  color: var(--text-secondary);
}

/* Category Bar — quiet text filters with middot separators */
.category-bar {
  display: flex;
  align-items: center;
  gap: 0;
  padding: 14px 20px 16px;
  margin-top: 6px;
  border-bottom: 1px solid var(--rule);
  overflow-x: auto;
  scrollbar-width: none;        /* Firefox */
  -ms-overflow-style: none;    /* IE/Edge */
}

.category-bar::-webkit-scrollbar {
  display: none;               /* Chrome/Safari */
}

.category-btn {
  flex-shrink: 0;
  position: relative;
  padding: 4px 0;
  margin-right: 19px;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
  transition: color 0.15s;
}

/* middot sitting in the gap before every item except the first */
.category-btn:not(:first-child)::before {
  content: "·";
  position: absolute;
  left: -12px;
  color: var(--text-tertiary);
}

.category-btn.active {
  color: var(--primary);
}

.category-btn:hover:not(.active) {
  color: var(--text);
}

/* Track List — editorial contents, hairline-separated, no cards.
   Row layout reserves a right-hand slot (grid col 2) for a future
   per-track status/score badge — see "future features" notes. */
#track-list {
  padding: 6px 20px 48px;
}

.track-card {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-rows: auto auto auto;
  column-gap: 16px;
  align-items: start;
  padding: 20px 16px;
  margin: 0 -16px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.18s ease;
}

/* hairline divider between rows (skips the last) */
.track-card:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 0;
  height: 1px;
  background: var(--rule);
}

.track-card:hover {
  background: var(--surface);
}

.track-title {
  grid-column: 1;
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1.25;
  transition: color 0.15s;
}

.track-card:hover .track-title,
.track-card:active .track-title {
  color: var(--primary);
}

.track-meta {
  grid-column: 1;
  display: flex;
  align-items: baseline;
  gap: 0;
  margin-top: 8px;
  font-family: var(--font-sans);
  font-size: 12px;
  color: var(--text-secondary);
}

.track-meta .source {
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  font-size: 11px;
  color: var(--text-tertiary);
}

.track-meta .duration {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

.track-meta .duration::before {
  content: "·";
  margin: 0 8px;
  color: var(--text-tertiary);
}

.track-tags {
  grid-column: 1;
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.tag {
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 9px;
  border-radius: 3px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
}

.tag.accent {
  border-color: var(--primary-light);
  color: var(--primary);
}

/* Topic tag — the primary "what's this about" signal. Filled oxblood tint so it
   reads ahead of the outline scene-category chip. Oxblood is the brand accent,
   distinct from the four annotation colors (no semantic clash). */
.tag.topic {
  background: var(--primary-light);
  border-color: transparent;
  color: var(--primary);
}

/* Empty state (e.g. switch to 基础 with no A1/A2 tracks) */
.empty-msg {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 17px;
  color: var(--text-tertiary);
  text-align: center;
  padding: 56px 16px;
}

/* ============================================================
   PLAYER VIEW
   ============================================================ */
.player-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  background: rgba(244, 241, 233, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--rule);
  position: sticky;
  top: 0;
  z-index: 10;
}

#back-btn {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border: none;
  background: transparent;
  font-size: 24px;
  color: var(--text);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

#back-btn:hover {
  background: var(--bg);
}

#track-title {
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.01em;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#track-meta {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

/* Text Area */
#text-area {
  padding: 16px;
  padding-bottom: 16px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;        /* Firefox */
}
#text-area::-webkit-scrollbar {
  display: none;                /* Chrome/Safari/Edge */
}

/* Segments */
.segment {
  position: relative;
  padding: 12px 14px;
  border-radius: 8px;
  transition: background 0.2s, opacity 0.2s;
  cursor: pointer;
  margin-bottom: 2px;
}

.segment:hover {
  background: var(--surface);
}

.segment.current {
  background: var(--highlight);
  box-shadow: inset 3px 0 0 var(--primary);
}

.segment.future {
  opacity: 0.38;
}

.segment-text {
  font-family: var(--font-serif);
  font-size: 19px;
  line-height: 1.7;
  letter-spacing: -0.005em;
  color: var(--text);
}

.segment-text.text-hidden {
  display: none;
}

.segment-text.text-hidden ~ .segment-translation.translation-hidden {
  display: none;
}

/* ── Listening-first: both text & translation hidden ──────────────
   Render each segment as a slim, TAPPABLE "redacted" row — NEVER
   collapsed to zero. Users must still be able to tap any sentence to
   jump to it (and feel the transcript's length / their position).
   The marker shows structure, never the hidden text. */
.segment:has(> .segment-text.text-hidden):has(> .segment-translation.translation-hidden) {
  min-height: 40px;
  padding: 8px 14px;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
}
.segment:has(> .segment-text.text-hidden):has(> .segment-translation.translation-hidden)::before {
  content: '';
  width: 40px;
  height: 3px;
  border-radius: 3px;
  background: var(--rule);
}

/* The playing sentence stands out: oxblood label over the highlight row. */
.segment.current:has(> .segment-text.text-hidden):has(> .segment-translation.translation-hidden) {
  min-height: 48px;
}
.segment.current:has(> .segment-text.text-hidden):has(> .segment-translation.translation-hidden)::before {
  content: '♫ 正在播放';
  width: auto;
  height: auto;
  background: none;
  color: var(--primary);
  font-family: var(--font-sans);
  font-size: 13px;
  letter-spacing: 0.02em;
}

.segment-translation {
  display: block;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text-secondary);
  margin-top: 6px;
  line-height: 1.65;
}

.segment-translation.translation-hidden {
  display: none;
}

/* Listening-first hint — shown when text & translation are both hidden */
.listen-hint {
  font-family: var(--font-sans);
  font-size: 13px;
  color: var(--text-tertiary);
  text-align: center;
  padding: 44px 24px;
  line-height: 1.7;
}

/* Track load failure message */
.load-error {
  font-family: var(--font-serif);
  font-size: 17px;
  color: var(--text-secondary);
  text-align: center;
  padding: 56px 24px;
  line-height: 1.8;
}

/* Annotated words — base style */
.annotated {
  cursor: pointer;
  padding-bottom: 2px;
}

/* Category 1: Pronunciation — blue wavy underline */
.annotated[data-ann-type="pronunciation"] {
  text-decoration: underline wavy var(--ann-pronunciation);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  color: var(--ann-pronunciation);
}

/* Category 2: Vocab & Grammar — green solid underline */
.annotated[data-ann-type="vocab_grammar"] {
  text-decoration: underline solid var(--ann-vocab-grammar);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  color: var(--ann-vocab-grammar);
}

/* Category 3: Spoken Habit — orange dashed underline */
.annotated[data-ann-type="spoken_habit"] {
  text-decoration: underline dashed var(--ann-spoken-habit);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  color: var(--ann-spoken-habit);
}

/* Category 4: UK Culture — purple double underline */
.annotated[data-ann-type="uk_culture"] {
  text-decoration: underline double var(--ann-uk-culture);
  text-decoration-thickness: 2px;
  text-underline-offset: 3px;
  color: var(--ann-uk-culture);
}

/* Fallback for old/unknown types */
.annotated:not([data-ann-type]) {
  border-bottom: 2px solid var(--annotation-color);
  color: var(--annotation-color);
}

.annotated:hover {
  background: var(--primary-light);
  border-radius: 2px;
}

/* Playback Controls */
.playback-controls {
  background: var(--card-bg);
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 50;
}

/* Progress bar */
#progress-bar {
  width: 100%;
  height: 4px;
  margin-bottom: 10px;
  appearance: none;
  -webkit-appearance: none;
  background: var(--border);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}

#progress-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  box-shadow: 0 1px 4px rgba(37, 99, 235, 0.4);
  margin-top: -6px;
}

#progress-bar::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--primary);
  cursor: pointer;
  border: none;
}

#progress-bar::-webkit-slider-runnable-track {
  background: linear-gradient(to right, var(--primary) 0%, var(--primary) var(--progress, 0%), var(--border) var(--progress, 0%), var(--border) 100%);
  border-radius: 2px;
  height: 4px;
}

/* Button Row */
.btn-row {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  margin-bottom: 8px;
}

#prev-btn,
#next-btn {
  min-width: 44px;
  min-height: 44px;
  border: none;
  background: transparent;
  font-size: 20px;
  color: var(--text);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

#prev-btn:hover,
#next-btn:hover {
  background: var(--bg);
}

#play-btn {
  width: 56px;
  height: 56px;
  border: none;
  background: var(--primary);
  color: #ffffff;
  border-radius: 50%;
  font-size: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, transform 0.1s;
  box-shadow: 0 2px 8px rgba(37, 99, 235, 0.35);
}

#play-btn:hover {
  background: #1d4ed8;
}

#play-btn:active {
  transform: scale(0.95);
}

/* Speed Row */
.speed-row {
  display: flex;
  justify-content: center;
  gap: 8px;
}

#speed-select {
  padding: 4px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--card-bg);
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
  outline: none;
}

#speed-select:focus {
  border-color: var(--primary);
}

/* Feature Buttons */
.feature-buttons {
  display: flex;
  gap: 8px;
  padding: 8px 16px;
  justify-content: center;
  flex-wrap: wrap;
  background: var(--card-bg);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  right: 0;
  z-index: 49;
}

.feature-buttons button {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--card-bg);
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.feature-buttons button:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.feature-buttons button.active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

/* Annotation Legend */
.annotation-legend {
  display: flex;
  gap: 4px;
  padding: 4px 16px;
  justify-content: center;
  flex-wrap: wrap;
  background: var(--card-bg);
  flex-shrink: 0;
  border-top: 1px solid var(--border);
}
.legend-item {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 8px;
  font-weight: 500;
}
.legend-item[data-legend-type="pronunciation"] {
  background: #DBEAFE; color: var(--ann-pronunciation);
  text-decoration: underline wavy var(--ann-pronunciation);
}
.legend-item[data-legend-type="vocab_grammar"] {
  background: #D1FAE5; color: var(--ann-vocab-grammar);
  text-decoration: underline solid var(--ann-vocab-grammar);
}
.legend-item[data-legend-type="spoken_habit"] {
  background: #FEF3C7; color: var(--ann-spoken-habit);
  text-decoration: underline dashed var(--ann-spoken-habit);
}
.legend-item[data-legend-type="uk_culture"] {
  background: #EDE9FE; color: var(--ann-uk-culture);
  text-decoration: underline double var(--ann-uk-culture);
}

/* Annotation Popup — bottom sheet on mobile */
#annotation-popup-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 99;
}
#annotation-popup-overlay.hidden {
  display: none;
}

#annotation-popup {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--card-bg);
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  padding: 20px 16px;
  padding-bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  z-index: 100;
  max-height: 60vh;
  overflow-y: auto;
}

/* Drag indicator */
#annotation-popup::before {
  content: '';
  display: block;
  width: 36px;
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto 12px;
}

/* Type badge — small colored pill */
.ann-type-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 8px;
}
.ann-type-badge[data-badge-type="pronunciation"] {
  background: #DBEAFE; color: var(--ann-pronunciation);
}
.ann-type-badge[data-badge-type="vocab_grammar"] {
  background: #D1FAE5; color: var(--ann-vocab-grammar);
}
.ann-type-badge[data-badge-type="spoken_habit"] {
  background: #FEF3C7; color: var(--ann-spoken-habit);
}
.ann-type-badge[data-badge-type="uk_culture"] {
  background: #EDE9FE; color: var(--ann-uk-culture);
}

.ann-title {
  font-weight: 600;
  font-size: 17px;
  color: var(--text);
  margin: 4px 0;
}

.ann-type {
  display: none; /* replaced by ann-type-badge */
}

.ann-explanation {
  font-size: 15px;
  line-height: 1.7;
  color: var(--text);
  margin-top: 8px;
}

#annotation-popup .close-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border: none;
  background: var(--bg);
  font-size: 16px;
  color: var(--text-secondary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

#annotation-popup .close-btn:hover {
  background: var(--border);
  color: var(--text);
}

/* ============================================================
   SETTINGS VIEW
   ============================================================ */
.settings-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.settings-header h2 {
  font-size: 18px;
  font-weight: 600;
}

#settings-back-btn {
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border: none;
  background: transparent;
  font-size: 24px;
  color: var(--text);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

#settings-back-btn:hover {
  background: var(--bg);
}

.settings-form {
  padding: 16px;
}

.setting-item {
  margin-bottom: 20px;
}

.setting-item label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  font-size: 15px;
  color: var(--text);
}

.setting-item select {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--card-bg);
  color: var(--text);
  font-size: 15px;
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236b7280' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.setting-item select:focus {
  border-color: var(--primary);
}

.setting-item input[type="checkbox"] {
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: var(--primary);
}

/* ============================================================
   DESKTOP — min-width: 768px
   ============================================================ */
@media (min-width: 768px) {

  /* Center all content areas */
  .browse-header,
  .player-header,
  .settings-header {
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
  }

  /* Wrap inner content for centered layout */
  .level-toggle,
  .category-bar,
  #track-list {
    max-width: 680px;
    margin-left: auto;
    margin-right: auto;
  }

  /* Reading Room — larger editorial type & measure on desktop */
  .browse-header {
    max-width: 680px;
    padding-top: 34px;
    padding-bottom: 22px;
  }
  .browse-header h1 { font-size: 33px; }
  .track-title { font-size: 26px; }
  #track-list { padding-top: 12px; }

  #text-area {
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
    padding-bottom: 40px; /* no fixed controls gap needed */
  }

  .settings-form {
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
  }

  /* Playback controls */
  .playback-controls {
    border-radius: 12px;
    margin: 16px auto;
    max-width: 720px;
    border: 1px solid var(--border);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
  }

  /* Feature buttons */
  .feature-buttons {
    max-width: 720px;
    margin: 0 auto 16px;
    border-radius: 12px;
    border: 1px solid var(--border);
  }

  /* Annotation popup — centered card on desktop */
  #annotation-popup {
    bottom: auto;
    top: 50%;
    left: 50%;
    right: auto;
    transform: translate(-50%, -50%);
    max-width: 420px;
    width: calc(100% - 64px);
    border-radius: 16px;
    padding-bottom: 20px;
  }

  #annotation-popup::before {
    display: none;
  }

  /* Larger reading type in text area on desktop */
  .segment-text {
    font-size: 21px;
  }

  .segment-translation {
    font-size: 15px;
  }
}
