/* focus timer — rose-pine moon theme, terminal/cli aesthetic */

:root {
  --rp-base: #232136;
  --rp-surface: #2a273f;
  --rp-overlay: #393552;
  --rp-muted: #6e6a86;
  --rp-subtle: #908caa;
  --rp-text: #e0def4;
  --rp-love: #eb6f92;
  --rp-gold: #f6c177;
  --rp-rose: #ea9a97;
  --rp-pine: #3e8fb0;
  --rp-foam: #9ccfd8;
  --rp-iris: #c4a7e7;
  --rp-hl-low: #2a283e;
  --rp-hl-med: #44415a;
  --rp-hl-high: #56526e;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: 'JetBrainsMono Nerd Font', 'JetBrains Mono', ui-monospace, Menlo, monospace;
  background: var(--rp-base);
  color: var(--rp-text);
  text-transform: lowercase;
  overflow: hidden;
}

/* ---------- main stage ---------- */
.stage {
  height: 100vh;
  display: flex;
  flex-direction: column;
}
.center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.time {
  font-size: clamp(180px, 22vw, 360px);
  font-weight: 300;
  line-height: 0.9;
  letter-spacing: -0.05em;
  font-variant-numeric: tabular-nums;
  color: var(--rp-foam);
  transition: color 0.4s ease;
  user-select: none;
}

/* phase number colors */
body[data-phase="focus"] .time { color: var(--rp-foam); }
body[data-phase="short"] .time { color: var(--rp-iris); }
body[data-phase="long"]  .time { color: var(--rp-gold); }
body[data-finished="1"]  .time { color: var(--rp-muted); }

/* ---------- status bar ---------- */
.statusbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
  padding: 6px 16px;
  border-top: 1px solid var(--rp-hl-med);
  background: var(--rp-surface);
  font-size: 11px;
  color: var(--rp-subtle);
  height: 28px;
  white-space: nowrap;
}
.sb-left, .sb-right { display: flex; align-items: center; gap: 12px; }
.sb-right { justify-content: flex-end; }
.sb-sep { color: var(--rp-muted); }
.sb-strong { color: var(--rp-text); }

.sb-phase { font-weight: 500; }
body[data-phase="focus"] .sb-phase { color: var(--rp-foam); }
body[data-phase="short"] .sb-phase { color: var(--rp-iris); }
body[data-phase="long"]  .sb-phase { color: var(--rp-gold); }

/* dots */
.dots { display: flex; gap: 5px; align-items: center; }
.dot {
  width: 10px; height: 10px; border-radius: 50%;
  border: 1px solid var(--rp-muted); background: transparent;
  transition: background 0.3s, border-color 0.3s;
}
.dot.done { background: var(--rp-pine); border-color: var(--rp-pine); }
.dot.current { background: var(--rp-rose); border-color: var(--rp-rose); }
.dot.long { width: 2px; height: 14px; border: 0; border-radius: 0; background: var(--rp-muted); }
.dot.long.done { background: var(--rp-pine); }
.dot.long.current { background: var(--rp-rose); }

/* clickable bits */
.click { cursor: pointer; user-select: none; }
.click:hover { color: var(--rp-text); }

/* ---------- player ---------- */
.player { display: inline-flex; gap: 6px; align-items: center; }
.player .icon { color: var(--rp-muted); cursor: pointer; }
.player.playing .icon { color: var(--rp-rose); }
.player .name { color: var(--rp-text); min-width: 38px; text-align: center; cursor: pointer; }
.player .arr { color: var(--rp-muted); cursor: pointer; padding: 0 2px; }
.player .arr:hover { color: var(--rp-text); }
.player .vol { display: inline-flex; gap: 1px; align-items: flex-end; margin-left: 4px; }
.player .vol .b { width: 3px; background: var(--rp-hl-med); cursor: pointer; }
.player .vol .b.on { background: var(--rp-foam); }
.player .vol .b:nth-child(1) { height: 4px; }
.player .vol .b:nth-child(2) { height: 6px; }
.player .vol .b:nth-child(3) { height: 8px; }
.player .vol .b:nth-child(4) { height: 10px; }
.player .vol .b:nth-child(5) { height: 12px; }
.player .close { color: var(--rp-muted); cursor: pointer; margin-left: 4px; }
.player .close:hover { color: var(--rp-love); }
.player.collapsed { color: var(--rp-muted); cursor: pointer; }

/* ---------- settings modal ---------- */
.modal-bg {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  display: none;
  align-items: center; justify-content: center;
  z-index: 100;
}
.modal-bg.show { display: flex; }
.modal {
  width: 640px; max-width: 92vw;
  background: var(--rp-surface);
  border: 1px solid var(--rp-hl-med);
  padding: 28px 32px;
  font-size: 13px;
  max-height: 90vh; overflow: auto;
}
.modal-head {
  display: flex; justify-content: space-between;
  border-bottom: 1px solid var(--rp-hl-med);
  padding-bottom: 12px; margin-bottom: 20px;
  color: var(--rp-subtle);
}
.modal-head .esc { color: var(--rp-muted); }
.modal section { margin-bottom: 18px; }
.modal h3 {
  color: var(--rp-gold);
  font-size: 12px; font-weight: 500;
  margin: 0 0 8px;
  letter-spacing: 0.05em;
}
.modal .grid {
  display: grid; grid-template-columns: 160px 1fr;
  gap: 8px 14px;
  color: var(--rp-subtle);
  align-items: center;
}
/* hide native number inputs — we render our own steppers */
.modal .stepper input[type=number] { display: none; }

/* segmented selector */
.seg {
  display: inline-flex;
  background: var(--rp-overlay);
  border: 1px solid var(--rp-hl-med);
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
}
.seg button {
  font: inherit; text-transform: lowercase;
  background: transparent;
  color: var(--rp-subtle);
  border: 0;
  padding: 5px 12px;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
}
.seg button:hover { color: var(--rp-text); }
.seg button.active {
  background: var(--rp-hl-high);
  color: var(--rp-foam);
}
.seg-sm button { padding: 3px 10px; font-size: 12px; }

/* stepper (replaces number input) */
.stepper {
  display: inline-flex;
  align-items: center;
  background: var(--rp-overlay);
  border: 1px solid var(--rp-hl-med);
  border-radius: 6px;
  overflow: hidden;
}
.stepper button {
  width: 24px; height: 26px;
  background: transparent;
  border: 0;
  color: var(--rp-subtle);
  cursor: pointer;
  font-size: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.12s, color 0.12s;
}
.stepper button:hover:not(:disabled) { background: var(--rp-hl-med); color: var(--rp-foam); }
.stepper button:disabled { opacity: 0.35; cursor: not-allowed; }
.stepper.locked { opacity: 0.55; }
.seg button:disabled { opacity: 0.4; cursor: not-allowed; }
.stepper .val {
  min-width: 36px;
  text-align: center;
  color: var(--rp-text);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
}
.stepper .sx {
  color: var(--rp-muted);
  font-size: 11px;
  padding: 0 8px 0 4px;
}

/* toggle switch */
.switch { display: inline-flex; cursor: pointer; user-select: none; }
.switch input { display: none; }
.switch .track {
  width: 36px; height: 20px;
  background: var(--rp-overlay);
  border: 1px solid var(--rp-hl-med);
  border-radius: 999px;
  position: relative;
  transition: background 0.18s, border-color 0.18s;
}
.switch .track::after {
  content: '';
  position: absolute;
  top: 2px; left: 2px;
  width: 14px; height: 14px;
  background: var(--rp-subtle);
  border-radius: 50%;
  transition: left 0.18s, background 0.18s;
}
.switch input:checked + .track {
  background: var(--rp-pine);
  border-color: var(--rp-pine);
}
.switch input:checked + .track::after {
  left: 18px;
  background: var(--rp-text);
}

/* ghost button */
.ghost-btn {
  font: inherit; text-transform: lowercase;
  background: transparent;
  color: var(--rp-subtle);
  border: 1px solid var(--rp-hl-med);
  border-radius: 6px;
  padding: 4px 12px;
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s;
}
.ghost-btn:hover { border-color: var(--rp-foam); color: var(--rp-foam); }

/* ---------- done banner ---------- */
.done-banner {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: var(--rp-surface); border: 1px solid var(--rp-gold);
  padding: 24px 36px; font-size: 16px;
  color: var(--rp-text);
  display: none; z-index: 50;
  text-align: center;
}
.done-banner.show { display: block; }
.done-banner button {
  margin-top: 14px;
  font: inherit; text-transform: lowercase;
  background: transparent; color: var(--rp-gold);
  border: 1px solid var(--rp-gold);
  padding: 6px 14px; cursor: pointer;
}
.done-banner button:hover { background: var(--rp-gold); color: var(--rp-base); }

/* ---------- helper visibility classes ---------- */
.hidden { display: none !important; }

/* keyboard hint corner */
.kbd-hint {
  position: fixed; bottom: 36px; right: 16px;
  font-size: 10px; color: var(--rp-muted);
  opacity: 0.5; pointer-events: none;
}
