/* ===================================================================
   FONTS
=================================================================== */
@font-face {
  font-family: 'Hanken Grotesk';
  src: url('fonts/hanken-grotesk-var.woff2') format('woff2');
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('fonts/jetbrains-mono-var.woff2') format('woff2');
  font-weight: 100 800;
  font-display: swap;
}

/* ===================================================================
   CSS CUSTOM PROPERTIES — LIGHT (default)
=================================================================== */
:root {
  --bg: #f5f3ee;
  --surface: #ffffff;
  --surface-2: #faf8f3;
  --ink: #1c1b18;
  --muted: #76726a;
  --faint: #a29d92;
  --hairline: #e9e5dc;
  --hairline-2: #d7d2c7;
  --ink-border: #cfcabf;
  --accent: #4f46e5;
  --accent-ink: #ffffff;
  --accent-shadow: rgba(79, 70, 229, 0.26);
  --accent-soft: #eef0ff;
  --done-bg: #eceaff;
  --track: #e7e3da;
  --ad-bg: #f3f1ea;
  --break-bg: #fbf2e2;
  --break-border: #ecd9b6;
  --break-text: #9a6a1c;
  --card-border: #e0dccf;
  --custom-border: #bdb8ab;
  /* urgency cue — digital readout and clock ring */
  --warn: #d97706;   /* amber — ≤ 5 min remaining */
  --urgent: #dc2626; /* red — ≤ 1 min remaining */
  --success: #16a34a;
}

/* ===================================================================
   CSS CUSTOM PROPERTIES — DARK
=================================================================== */
[data-theme="dark"] {
  --bg: #16140f;
  --surface: #1d1b15;
  --surface-2: #1a1813;
  --ink: #f4f1ea;
  --muted: #a39d90;
  --faint: #7a7468;
  --hairline: #312e26;
  --hairline-2: #413d33;
  --ink-border: #454137;
  --accent: #8b90ff;
  --accent-ink: #16140f;
  --accent-shadow: rgba(139, 144, 255, 0.30);
  --accent-soft: #262338;
  --done-bg: #2a2740;
  --track: #2c2920;
  --ad-bg: #1b1914;
  --break-bg: #2a2415;
  --break-border: #4a3a20;
  --break-text: #c49a4a;
  --card-border: #312e26;
  --custom-border: #3a3730;
  --warn: #f59e0b;   /* amber — ≤ 5 min remaining, dark */
  --urgent: #f87171; /* red — ≤ 1 min remaining, dark */
  --success: #22c55e;
}

/* ===================================================================
   RESET + BASE
=================================================================== */
*, *::before, *::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Hanken Grotesk', system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
}

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

/* ===================================================================
   FLASH OVERLAY
=================================================================== */
.flash-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255, 255, 255, 0.7);
  pointer-events: none;
  opacity: 0;
  z-index: 9999;
  transition: opacity 0.1s;
}

.flash-overlay.flash-active {
  opacity: 1;
  animation: flash-anim 0.6s ease-out forwards;
}

@keyframes flash-anim {
  0%   { opacity: 1; }
  100% { opacity: 0; }
}

[data-theme="dark"] .flash-overlay {
  background: rgba(139, 144, 255, 0.25);
}

/* ===================================================================
   PICKER SCREEN
=================================================================== */
.picker-screen {
  max-width: 1120px;
  margin: 0 auto;
  padding: 36px 40px;
  min-height: 100dvh;
  background: var(--bg);
}

/* Header */
.picker-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 24px;
}

.picker-title {
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -0.4px;
  color: var(--ink);
}

.picker-subtitle {
  font-size: 14px;
  color: var(--muted);
  margin-top: 4px;
}

.picker-custom-link {
  font-size: 13.5px;
  color: var(--muted);
  white-space: nowrap;
}

.picker-custom-link strong {
  color: var(--ink);
  font-weight: 700;
}

/* Grid */
.picker-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}

.picker-card {
  position: relative;
  border-radius: 14px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--card-border);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.picker-card:hover {
  border-color: var(--accent);
}

.picker-card.selected {
  border: 2px solid var(--accent);
  background: var(--accent-soft);
}

.picker-card--custom {
  border: 1.5px dashed var(--custom-border);
  background: var(--surface-2);
  cursor: default;
  opacity: 0.6;
}

.picker-card--custom:hover {
  border-color: var(--custom-border);
}

.picker-card-badge {
  display: none;
  position: absolute;
  top: 13px;
  right: 14px;
  font-size: 11px;
  font-weight: 800;
  color: var(--accent);
}

.picker-card.selected .picker-card-badge {
  display: block;
}

.picker-card-name {
  font-size: 23px;
  font-weight: 800;
  color: var(--ink);
}

.picker-card-subtitle {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 6px;
}

/* Plan preview row */
.picker-preview {
  display: flex;
  align-items: center;
  gap: 13px;
  flex-wrap: wrap;
  margin-top: 26px;
}

.preview-label {
  font-size: 11px;
  font-weight: 800;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  white-space: nowrap;
}

.preview-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--surface);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
}

.preview-pill--break {
  background: var(--break-bg);
  border-color: var(--break-border);
  color: var(--break-text);
}

.preview-pill-dur {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  color: var(--muted);
  opacity: 0.9;
}

.preview-pill--break .preview-pill-dur {
  color: var(--break-text);
  opacity: 0.8;
}

.preview-arrow {
  color: var(--custom-border);
  font-size: 14px;
}

.preview-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.preview-ad {
  border: 1px dashed var(--ink-border);
  border-radius: 10px;
  padding: 9px 16px;
  font-size: 10.5px;
  font-weight: 700;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 1px;
  white-space: nowrap;
}

.picker-start-btn {
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 999px;
  padding: 14px 42px;
  font-family: inherit;
  font-size: 16px;
  font-weight: 800;
  border: none;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(79, 70, 229, 0.28);
  transition: opacity 0.15s;
  white-space: nowrap;
}

.picker-start-btn:hover {
  opacity: 0.9;
}

/* ===================================================================
   TIMER APP SHELL
=================================================================== */
.timer-app {
  width: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow: hidden;
}

/* ===================================================================
   TOP BAR
=================================================================== */
.top-bar {
  height: 56px;
  min-height: 56px;
  border-bottom: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  gap: 16px;
  background: var(--bg);
}

.top-left {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-shrink: 0;
}

.brand-dot {
  display: inline-block;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: var(--accent);
}

.brand-name {
  font-size: 16px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.2px;
}

.top-center {
  display: flex;
  align-items: center;
  gap: 0;
  font-size: 13px;
}

.top-exam-name {
  font-weight: 800;
  color: var(--ink);
}

.top-sep {
  color: var(--muted);
}

.top-session {
  font-size: 13px;
  color: var(--muted);
}

.top-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.top-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  font-family: inherit;
  cursor: pointer;
  transition: opacity 0.15s;
}

.top-pill--outline {
  padding: 6px 13px;
  font-size: 12.5px;
  font-weight: 600;
  border: 1px solid var(--hairline);
  color: var(--ink);
  background: transparent;
}

.top-pill--accent {
  padding: 6px 15px;
  font-size: 12.5px;
  font-weight: 700;
  border: 1px solid var(--accent);
  color: var(--accent);
  background: transparent;
}

.top-pill:hover {
  opacity: 0.75;
}

.theme-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}

/* ===================================================================
   MOBILE-ONLY TOP BAR EXAM NAME
=================================================================== */
.mobile-top-exam {
  display: none;
  font-size: 15px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.1px;
}

/* ===================================================================
   SETTINGS GEAR + POPOVER
=================================================================== */
.gear-wrapper {
  position: relative;
}

.settings-gear {
  padding: 6px 10px;
  font-size: 15px;
  line-height: 1;
}

.settings-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: var(--surface);
  border: 1px solid var(--hairline-2);
  border-radius: 12px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.12);
  padding: 14px 16px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 210px;
}

.settings-popover[hidden] {
  display: none;
}

[data-theme="dark"] .settings-popover {
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.settings-row-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--faint);
  flex-shrink: 0;
}

/* ===================================================================
   SECTION STEPPER
=================================================================== */
.section-stepper {
  height: 60px;
  min-height: 60px;
  border-bottom: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 20px;
  overflow: hidden;
}

.stepper-connector {
  width: 18px;
  height: 2px;
  background: var(--accent);
  border-radius: 1px;
  flex-shrink: 0;
}

.stepper-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 10px;
  font-size: 13px;
  flex-shrink: 0;
}

.stepper-pill--done {
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--hairline);
  padding: 8px 15px;
}

.stepper-pill--current {
  background: var(--accent);
  color: var(--accent-ink);
  padding: 9px 18px;
  box-shadow: 0 4px 14px var(--accent-shadow);
}

.stepper-pill--future {
  background: var(--surface-2);
  color: var(--muted);
  border: 1px solid var(--hairline);
  padding: 8px 15px;
}

.stepper-name {
  font-weight: 700;
}

.stepper-name--done {
  text-decoration: line-through;
}

.stepper-dur {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11.5px;
}

.stepper-pill--current .stepper-dur {
  opacity: 0.85;
}

.stepper-check {
  font-weight: 800;
  color: var(--accent);
}

.stepper-pill--current .stepper-check {
  color: var(--accent-ink);
}

.stepper-now {
  font-weight: 800;
  font-size: 10.5px;
  opacity: 0.92;
}

/* ===================================================================
   TIMER BODY
=================================================================== */
.timer-body {
  display: flex;
  flex-direction: row;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* ===================================================================
   CLOCK COLUMN
=================================================================== */
.clock-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 18px;
  overflow: hidden;
}

/* Clock area — holds all display-mode content */
.clock-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
}

.analog-clock-svg {
  display: block;
  flex-shrink: 0;
}

/* ===================================================================
   DIGITAL READOUT
=================================================================== */
.digital-readout {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  font-size: 50px;
  letter-spacing: 1px;
  color: var(--ink);
  margin-top: 14px;
  line-height: 1;
}

.digital-readout--big {
  font-size: 130px;
  line-height: 0.95;
  margin-top: 0;
  letter-spacing: 1px;
}

/* ===================================================================
   URGENCY CLASSES — digital readout
=================================================================== */
.digital-readout.warn { color: var(--warn); }
.digital-readout.urgent { color: var(--urgent); }

/* ===================================================================
   REMAINING LABEL
=================================================================== */
.remaining-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--faint);
  margin-top: 6px;
}

.remaining-label--digital {
  font-size: 12px;
  letter-spacing: 3px;
  margin-top: 6px;
}

/* ===================================================================
   OFF MODE
=================================================================== */
.clock-off {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.clock-off-circle {
  width: 340px;
  height: 340px;
  border-radius: 50%;
  border: 1.5px dashed var(--hairline-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px;
}

.clock-off-chip {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--faint);
}

.clock-off-text {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
  text-align: center;
}

.clock-off-sub {
  font-size: 11.5px;
  color: var(--faint);
  max-width: 180px;
  text-align: center;
  line-height: 1.4;
}

/* ===================================================================
   META ROW
=================================================================== */
.meta-row {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: 9px;
  font-size: 14px;
}

.meta-section {
  font-weight: 800;
  color: var(--accent);
}

.meta-divider {
  width: 1px;
  height: 14px;
  background: var(--hairline-2);
}

.meta-ends {
  color: var(--muted);
  font-size: 14px;
}

.meta-end-time {
  font-family: 'JetBrains Mono', monospace;
  color: var(--ink);
  font-size: 13px;
  margin-left: 3px;
}

/* ===================================================================
   CONTROLS ROW
=================================================================== */
.controls-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.ctrl-circle {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 1px solid var(--hairline);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  transition: border-color 0.15s;
  flex-shrink: 0;
}

.ctrl-circle:hover {
  border-color: var(--ink-border);
  color: var(--ink);
}

.ctrl-pause {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 999px;
  padding: 11px 32px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px var(--accent-shadow);
  transition: opacity 0.15s;
  white-space: nowrap;
}

.ctrl-pause:hover {
  opacity: 0.9;
}

.pause-bars {
  display: inline-flex;
  align-items: center;
  gap: 3.5px;
}

.pause-bars span {
  display: block;
  width: 4px;
  height: 15px;
  background: var(--accent-ink);
  border-radius: 1px;
}

.ctrl-reset {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--ink-border);
  border-radius: 999px;
  padding: 11px 22px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  background: transparent;
  cursor: pointer;
  transition: border-color 0.15s;
}

.ctrl-reset:hover {
  border-color: var(--ink);
}

/* ===================================================================
   DISPLAY SEGMENTED CONTROL
=================================================================== */
.display-control {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-top: 14px;
}

.display-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--faint);
  white-space: nowrap;
}

.display-segs {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--surface-2);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 3px;
}

.display-seg {
  padding: 7px 12px;
  border-radius: 7px;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--muted);
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  white-space: nowrap;
}

.display-seg.active {
  background: var(--accent);
  color: var(--accent-ink);
}

.display-seg:not(.active):hover {
  color: var(--ink);
}

/* ===================================================================
   PLAN PANEL (298px wide)
=================================================================== */
.plan-panel {
  width: 298px;
  min-width: 298px;
  border-left: 1px solid var(--hairline);
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  padding: 20px;
  overflow-y: auto;
}

.plan-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 5px;
}

.plan-panel-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--faint);
}

.plan-collapse-btn {
  font-size: 15px;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  line-height: 1;
  padding: 2px 4px;
}

.plan-collapse-btn:hover {
  color: var(--ink);
}

.plan-subline {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 16px;
}

.plan-sections {
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* Plan rows */
.plan-row {
  border-radius: 11px;
  margin-bottom: 8px;
}

.plan-row--done {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--hairline);
}

.plan-row--current {
  padding: 14px;
  background: var(--accent-soft);
  border: 1.5px solid var(--accent);
}

.plan-row--future {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--hairline);
}

.plan-row-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.plan-done-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--done-bg);
  font-size: 11px;
  font-weight: 800;
  color: var(--accent);
  flex-shrink: 0;
}

.plan-row-name {
  font-size: 13.5px;
  color: var(--muted);
}

.plan-row-name--done {
  text-decoration: line-through;
}

.plan-row--current .plan-row-name {
  font-size: 14px;
  font-weight: 800;
  color: var(--ink);
}

.plan-current-ring {
  display: inline-block;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  flex-shrink: 0;
}

.plan-row-dur {
  font-family: 'JetBrains Mono', monospace;
  font-size: 12px;
  color: var(--faint);
}

.plan-row-dur--accent {
  font-weight: 700;
  color: var(--accent);
}

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

.plan-row-second {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 10px;
  font-size: 11.5px;
}

.plan-row-status {
  color: var(--muted);
}

.plan-row-remaining {
  font-family: 'JetBrains Mono', monospace;
  font-weight: 700;
  color: var(--ink);
  font-size: 12px;
}

.plan-progress-bar {
  height: 5px;
  border-radius: 9px;
  background: var(--track);
  margin-top: 8px;
  overflow: hidden;
}

.plan-progress-fill {
  height: 100%;
  border-radius: 9px;
  background: var(--accent);
  transition: width 0.25s linear;
}

/* Ad slot */
.ad-slot {
  margin-top: auto;
  border: 1px dashed var(--hairline-2);
  border-radius: 11px;
  padding: 15px;
  text-align: center;
  background: var(--ad-bg);
}

.ad-slot.hidden {
  display: none !important;
}

.ad-slot-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--faint);
  text-transform: uppercase;
  letter-spacing: 1.2px;
}

.ad-slot-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 5px;
  line-height: 1.4;
}

/* ===================================================================
   PLAN RAIL (collapsed)
=================================================================== */
.plan-rail {
  display: none;
  width: 42px;
  min-width: 42px;
  border-left: 1px solid var(--hairline);
  background: var(--surface-2);
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-direction: column;
}

.plan-rail:hover .plan-rail-text {
  color: var(--ink);
}

.plan-rail-text {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--muted);
  user-select: none;
}

/* ===================================================================
   FINISHED CARD
=================================================================== */
.finished-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  text-align: center;
  padding: 24px 20px;
  min-height: 320px;
}

.finished-check {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--done-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 40px;
  color: var(--success);
  flex-shrink: 0;
}

.finished-title {
  font-size: 28px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.3px;
}

.finished-sub {
  font-size: 15px;
  color: var(--muted);
}

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

.finished-btn {
  min-height: 44px;
  padding: 12px 20px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s, border-color 0.15s;
}

.finished-btn--primary {
  background: var(--accent);
  color: var(--accent-ink);
  border: none;
}

.finished-btn--primary:hover {
  opacity: 0.9;
}

.finished-btn--ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--hairline);
}

.finished-btn--ghost:hover {
  border-color: var(--ink-border);
}

/* ===================================================================
   PROJECTOR VIEW
=================================================================== */
.projector-view {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 50px;
  z-index: 100;
}

.proj-top-left {
  position: absolute;
  top: 20px;
  left: 24px;
  display: flex;
  align-items: center;
  gap: 9px;
}

.proj-exam-tag {
  font-size: 12px;
  letter-spacing: 2px;
  color: var(--faint);
  font-weight: 800;
  text-transform: uppercase;
}

.proj-room-label {
  border: 1px solid var(--ink-border);
  border-radius: 8px;
  padding: 5px 11px;
  font-size: 12px;
  color: var(--ink);
  font-weight: 700;
  white-space: nowrap;
  outline: none;
  min-width: 60px;
  cursor: text;
}

.proj-room-label:focus {
  border-color: var(--accent);
}

.proj-edit-hint {
  font-size: 10.5px;
  color: var(--faint);
  font-style: italic;
}

.proj-exit {
  position: absolute;
  top: 16px;
  right: 20px;
  background: transparent;
  border: 1px solid var(--ink-border);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
  font-family: 'Hanken Grotesk', system-ui, sans-serif;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.proj-exit:hover,
.proj-exit:focus-visible {
  background: var(--surface-2);
  color: var(--ink);
}
.proj-exit-hint {
  opacity: 0.55;
  font-size: 10px;
  letter-spacing: 0.5px;
}

.proj-center {
  display: flex;
  align-items: center;
  gap: 50px;
}

.proj-text-block {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.proj-section-label {
  font-size: clamp(11px, 1.4vw, 20px);
  letter-spacing: 3px;
  color: var(--faint);
  font-weight: 700;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.proj-section-name {
  font-size: clamp(36px, 6vw, 120px);
  font-weight: 800;
  color: var(--ink);
  line-height: 0.9;
  letter-spacing: -1px;
}

.proj-digital {
  font-family: 'JetBrains Mono', monospace;
  font-size: clamp(56px, 11vw, 200px);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.05;
}

.proj-digital.warn   { color: var(--warn); }
.proj-digital.urgent { color: var(--urgent); }

.proj-ends-line {
  font-size: clamp(14px, 1.6vw, 26px);
  color: var(--muted);
  margin-top: 8px;
}

.proj-end-time {
  color: var(--ink);
  font-family: 'JetBrains Mono', monospace;
}

.proj-clock-svg {
  width: min(58vh, 46vw) !important;
  height: min(58vh, 46vw) !important;
}

/* ===================================================================
   PROJECTOR VIEW — PORTRAIT only (stacked). Landscape (incl. landscape
   phones) keeps the side-by-side layout — see the landscape block below.
=================================================================== */
@media (max-width: 760px) and (orientation: portrait) {
  .proj-center {
    flex-direction: column;
    gap: 22px;
    text-align: center;
  }
  .proj-text-block {
    align-items: center;
  }
  .proj-clock-svg {
    width: min(42vh, 70vw) !important;
    height: min(42vh, 70vw) !important;
  }
  .proj-section-name {
    font-size: clamp(28px, 7vw, 40px);
    line-height: 1;
  }
  .proj-digital {
    font-size: clamp(44px, 12vw, 60px);
  }
  .proj-edit-hint {
    display: none;
  }
}

/* ===================================================================
   RESPONSIVE
=================================================================== */
@media (max-width: 900px) {
  .picker-grid {
    grid-template-columns: repeat(2, 1fr) !important;
  }
}

@media (max-width: 560px) {
  .picker-grid {
    grid-template-columns: 1fr !important;
  }
  .picker-screen {
    padding: 20px 18px;
  }
  .picker-header {
    flex-direction: column;
    gap: 4px;
  }
  .preview-right {
    margin-left: 0;
    flex-wrap: wrap;
  }
  .picker-start-btn {
    width: 100%;
    text-align: center;
  }
}

@media (max-width: 700px) {
  .plan-panel {
    display: none;
  }
}

/* ===================================================================
   MOBILE TIMER VIEW (≤ 480px)
=================================================================== */

/* Elements shown only on mobile */
.mobile-progress,
.mob-meta,
.mobile-ad-note {
  display: none;
}

@media (max-width: 480px) {
  /* Show mobile-only elements */
  .mobile-progress { display: block; padding: 10px 18px 0; }
  .mob-meta        { display: block; font-size: 12px; color: var(--muted); margin-top: 5px; text-align: center; }
  .mobile-ad-note  {
    display: block;
    margin: 8px 12px 0;
    border: 1px dashed var(--ink-border);
    border-radius: 10px;
    padding: 10px;
    text-align: center;
    font-size: 10.5px;
    color: var(--muted);
  }

  /* Hide desktop-only elements */
  .section-stepper { display: none !important; }
  .plan-panel      { display: none !important; }
  .plan-rail       { display: none !important; }
  .meta-row        { display: none !important; }
  .remaining-label { display: none !important; }
  .brand-name      { display: none; }
  .top-center      { display: none !important; }

  /* Show mobile-only top bar exam name */
  .mobile-top-exam { display: inline; }

  /* Single-column body */
  .timer-body { flex-direction: column; overflow-y: auto; }

  /* Clock column fills width, centers content */
  .clock-column {
    flex: 1;
    padding: 12px;
    gap: 6px;
    justify-content: center;
  }

  /* Analog clock: larger on mobile (user feedback: was too small) */
  .analog-clock-svg {
    width: 240px !important;
    height: 240px !important;
  }

  /* Digital readout: smaller on mobile */
  .digital-readout {
    font-size: 42px;
    margin-top: 8px;
  }

  /* Off-mode circle: match mobile clock size */
  .clock-off-circle {
    width: 240px;
    height: 240px;
  }

  /* Controls: full-width, stacked */
  .controls-row {
    width: 100%;
    gap: 10px;
  }
  .ctrl-circle { display: none; }
  .ctrl-pause {
    flex: 1;
    justify-content: center;
    padding: 13px;
    font-size: 15px;
  }
  .ctrl-reset {
    padding: 13px 20px;
    font-size: 14px;
  }

  /* Display control: wrap if needed */
  .display-control {
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
  }

  /* Mobile progress bars */
  .mob-bars {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
  }
  .mob-bar {
    display: block;
    height: 6px;
    border-radius: 9px;
  }
  .mob-bar--done    { width: 20px; background: var(--track); }
  .mob-bar--current { width: 34px; background: var(--accent); }
  .mob-bar--future  { width: 20px; background: var(--track); opacity: 0.6; }

  .mob-caption {
    font-size: 11.5px;
    text-align: center;
    color: var(--muted);
    margin-top: 9px;
    font-weight: 600;
  }

  .mob-end-time {
    font-family: 'JetBrains Mono', monospace;
    color: var(--ink);
  }

  /* Top bar: hide plan toggle from view if it exists */
  .top-bar { padding: 0 14px; }

  /* Finished card — compact on mobile */
  .finished-card  { min-height: 220px; padding: 16px 12px; }
  .finished-check { width: 60px; height: 60px; font-size: 32px; }
  .finished-title { font-size: 24px; }
  .finished-actions { flex-direction: column; width: 100%; }
  .finished-btn   { width: 100%; }
}

/* ===================================================================
   LANDSCAPE / SHORT VIEWPORT (e.g. phone rotated to landscape).
   Width-based breakpoints don't catch a wide-but-short viewport, so the
   full desktop timer overflowed (clock clipped, controls off-screen).
   Compact everything to fit ~375px height. Placed last so it wins.
=================================================================== */
@media (max-height: 540px) {
  .top-bar { height: 44px; min-height: 44px; }

  /* Reclaim vertical space — hide the tall / secondary bits */
  .section-stepper { display: none !important; }
  .mobile-progress { display: none !important; }
  .meta-row        { display: none !important; }
  .remaining-label { display: none !important; }

  /* Keep the compact "remaining · ends HH:MM" line (populated every tick) */
  .mob-meta {
    display: block;
    font-size: 12px;
    color: var(--muted);
    text-align: center;
    margin-top: 4px;
  }

  .timer-body   { min-height: 0; overflow-y: auto; }
  .clock-column { justify-content: center; gap: 4px; padding: 6px 12px; min-height: 0; }

  /* Clock scales to the (short) viewport height */
  .analog-clock-svg,
  .clock-off-circle {
    width: min(46vh, 280px) !important;
    height: min(46vh, 280px) !important;
  }

  .digital-readout { font-size: clamp(28px, 8vh, 44px); margin-top: 2px; }
  .controls-row    { margin-top: 8px; }
  .display-control { margin-top: 6px; }
}

/* ===================================================================
   LANDSCAPE PHONE — side-by-side clock + controls grid.
   Placed after max-height block so it wins in landscape orientation.
=================================================================== */
@media (orientation: landscape) and (max-height: 540px) {
  .clock-column {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-areas: "clock controls" "clock display";
    align-items: center;
    justify-items: center;
    column-gap: 28px;
    row-gap: 8px;
    padding: 6px 16px;
  }
  .clock-area      { grid-area: clock; }
  .controls-row    { grid-area: controls; align-self: end; margin-top: 0; }
  .display-control { grid-area: display; align-self: start; margin-top: 0; }
  .meta-row        { display: none !important; }
  /* Big clock on the LEFT — no longer squeezed by the buttons */
  .analog-clock-svg,
  .clock-off-circle { width: min(70vh, 340px) !important; height: min(70vh, 340px) !important; }

  /* PROJECTOR in landscape-short (e.g. phone rotated): stay side-by-side and
     size the clock to the short height so it fills the screen (was dropping to
     the portrait-stacked 42vh layout → tiny clock). */
  .proj-center { gap: 28px; }
  .proj-clock-svg {
    width: min(82vh, 42vw) !important;
    height: min(82vh, 42vw) !important;
  }
  .proj-section-name { font-size: clamp(24px, 5vw, 56px); }
  .proj-digital      { font-size: clamp(40px, 9vw, 96px); }
  .proj-ends-line    { font-size: clamp(13px, 1.8vw, 20px); }

  /* Finished card — compact in landscape / short viewport */
  .finished-card  { min-height: 160px; gap: 10px; padding: 12px; }
  .finished-check { width: 52px; height: 52px; font-size: 28px; }
  .finished-title { font-size: 20px; }
}

/* ===================================================================
   FOOTER + CONTACT MODAL
=================================================================== */

/* --- Site footer (picker screen only) --- */
.site-footer {
  margin-top: 48px;
  padding: 20px 0 28px;
  border-top: 1px solid var(--hairline);
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

.footer-link {
  color: var(--muted);
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s;
}

.footer-link:hover {
  color: var(--ink);
}

/* --- Contact modal overlay --- */
.contact-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 500;
  padding: 16px;
}

.contact-overlay.is-open {
  display: flex;
}

/* --- Contact dialog card --- */
.contact-dialog {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  padding: 28px;
  max-width: 420px;
  width: 90vw;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.18);
}

[data-theme="dark"] .contact-dialog {
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.5);
}

.contact-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.contact-heading {
  font-size: 20px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.2px;
  margin: 0;
}

.contact-close-x {
  width: 32px;
  height: 32px;
  min-height: 32px;
  border-radius: 50%;
  border: 1px solid var(--hairline);
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  flex-shrink: 0;
  font-family: inherit;
  transition: border-color 0.15s, color 0.15s;
}

.contact-close-x:hover {
  border-color: var(--ink-border);
  color: var(--ink);
}

.contact-sub {
  font-size: 14px;
  color: var(--muted);
  margin: 0 0 20px;
  line-height: 1.5;
}

/* --- Form fields --- */
.contact-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
}

.contact-field label {
  font-size: 11px;
  font-weight: 800;
  color: var(--muted);
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.contact-field input,
.contact-field textarea {
  background: var(--surface-2);
  color: var(--ink);
  border: 1px solid var(--hairline);
  border-radius: 9px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  resize: vertical;
  width: 100%;
  box-sizing: border-box;
}

.contact-field input::placeholder,
.contact-field textarea::placeholder {
  color: var(--faint);
}

.contact-field input:focus,
.contact-field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* --- Honeypot: visually hidden + off-screen --- */
.hp {
  position: absolute;
  left: -9999px;
  opacity: 0;
  height: 0;
  width: 0;
  overflow: hidden;
}

/* --- Status message --- */
.contact-status {
  font-size: 13px;
  color: var(--muted);
  min-height: 18px;
  line-height: 1.4;
  margin-top: 2px;
}

.contact-status--success {
  color: var(--success);
}

.contact-status--error {
  color: #dc2626;
}

[data-theme="dark"] .contact-status--error {
  color: var(--urgent);
}

/* --- Actions row --- */
.contact-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  justify-content: flex-end;
  margin-top: 20px;
}

.contact-submit {
  background: var(--accent);
  color: var(--accent-ink);
  border-radius: 999px;
  padding: 12px 28px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 14px var(--accent-shadow);
  transition: opacity 0.15s;
  min-height: 44px;
  white-space: nowrap;
}

.contact-submit:hover:not(:disabled) {
  opacity: 0.9;
}

.contact-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.contact-cancel {
  padding: 12px 20px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  color: var(--muted);
  border: 1px solid var(--hairline);
  background: transparent;
  cursor: pointer;
  min-height: 44px;
  transition: border-color 0.15s, color 0.15s;
  white-space: nowrap;
}

.contact-cancel:hover {
  border-color: var(--ink-border);
  color: var(--ink);
}

/* --- Mobile responsive --- */
@media (max-width: 480px) {
  .contact-dialog {
    width: 94vw;
    padding: 20px 18px;
    border-radius: 14px;
  }

  .contact-actions {
    flex-direction: column-reverse;
    gap: 8px;
  }

  .contact-submit,
  .contact-cancel {
    width: 100%;
    text-align: center;
    justify-content: center;
  }
}

/* Ad placeholders hidden until AdSense is wired — remove this block when ads go live */
.preview-ad,
.ad-slot,
.mobile-ad-note {
  display: none !important;
}
