/* ————————————————————————————————————————
   THE TRAIN.ING — gym brutalism
   phases: idle→amber · prep→amber · work→red · rest→teal · done→green
   ———————————————————————————————————————— */

:root {
  --bg: #0A0A0A;
  --surface: #141414;
  --line: #262626;
  --text: #F5F5F2;
  --muted: #8F8F88;
  --phase: #FFB020;
  --display: "Archivo Black", "Arial Black", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  --body: "Inter", system-ui, sans-serif;
}

body[data-phase="idle"],
body[data-phase="prep"]  { --phase: #FFB020; }
body[data-phase="work"]  { --phase: #FF3B3B; }
body[data-phase="rest"]  { --phase: #2ED3C6; }
body[data-phase="done"]  { --phase: #5DE380; }
body[data-phase="paused"] { --phase: #9AA0B0; }

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--body);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  transition: background 0.4s;
}

.phase-glow {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(75% 55% at 50% 46%, color-mix(in srgb, var(--phase) 17%, transparent), transparent 70%);
  transition: background 0.5s;
}

::selection { background: var(--phase); color: var(--bg); }

a { color: var(--phase); }

:focus-visible {
  outline: 2px solid var(--phase);
  outline-offset: 3px;
  border-radius: 6px;
}

/* progress */

.progress {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 5px;
  z-index: 60;
  background: #181818;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--phase);
  transition: width 0.2s linear, background 0.4s;
}

/* header */

.site-header {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px clamp(16px, 4vw, 40px) 8px;
}

.wordmark {
  font-family: var(--display);
  font-size: 19px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.tld { color: var(--phase); transition: color 0.4s; }

.mute {
  cursor: pointer;
  font-size: 19px;
  line-height: 1;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 13px;
  transition: border-color 0.2s, transform 0.15s;
}

.mute:hover { border-color: var(--phase); transform: translateY(-1px); }

/* presets */

.presets {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  padding: 16px clamp(16px, 4vw, 40px) 0;
}

.preset {
  cursor: pointer;
  display: grid;
  gap: 3px;
  text-align: center;
  font-family: var(--display);
  font-size: 15px;
  letter-spacing: 0.04em;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 20px;
  transition: border-color 0.2s, background 0.2s, transform 0.15s;
}

.preset span {
  font-family: var(--body);
  font-size: 11.5px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.preset:hover { transform: translateY(-2px); border-color: #3A3A3A; }

.preset.active {
  border-color: var(--phase);
  background: color-mix(in srgb, var(--phase) 12%, var(--surface));
}

.preset.active span { color: var(--text); }

/* custom panel */

.custom-panel {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  padding: 14px clamp(16px, 4vw, 40px) 0;
}

.custom-panel[hidden] { display: none; }

.custom-panel label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 14px;
}

.custom-panel input {
  width: 72px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 700;
  text-align: center;
  padding: 7px 4px;
}

.custom-panel input:focus { outline: 2px solid var(--phase); border-color: transparent; }

.custom-panel span { color: var(--muted); font-weight: 500; text-transform: none; letter-spacing: 0; }

/* stage */

.stage {
  position: relative;
  z-index: 1;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px clamp(16px, 4vw, 40px) 34px;
}

.phase-label {
  font-family: var(--display);
  font-size: clamp(17px, 2.6vw, 26px);
  letter-spacing: 0.34em;
  text-indent: 0.34em;
  text-transform: uppercase;
  color: var(--phase);
  transition: color 0.4s;
}

.time {
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(108px, 27vw, 320px);
  line-height: 1;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  text-shadow: 0 0 90px color-mix(in srgb, var(--phase) 42%, transparent);
  margin: 6px 0 10px;
}

.round {
  font-family: var(--display);
  font-size: clamp(14px, 2vw, 20px);
  letter-spacing: 0.22em;
  text-indent: 0.22em;
  text-transform: uppercase;
  color: var(--text);
}

.subline { margin-top: 8px; font-size: 14px; color: var(--muted); }

/* controls */

.controls {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 34px;
}

.btn {
  cursor: pointer;
  font-family: var(--display);
  font-size: 17px;
  letter-spacing: 0.1em;
  text-indent: 0.1em;
  border-radius: 14px;
  padding: 18px 34px;
  transition: transform 0.15s, filter 0.2s, border-color 0.2s, background 0.4s, color 0.4s;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  border: none;
  color: #0A0A0A;
  background: var(--phase);
  box-shadow: 0 10px 34px color-mix(in srgb, var(--phase) 38%, transparent);
  min-width: 190px;
}

.btn-primary:hover { filter: brightness(1.1); transform: translateY(-2px); }

.btn-ghost {
  border: 1px solid var(--line);
  color: var(--text);
  background: transparent;
}

.btn-ghost:hover { border-color: var(--phase); transform: translateY(-2px); }

/* hints + footer */

.hints {
  margin-top: 26px;
  font-size: 12.5px;
  color: var(--muted);
}

kbd {
  font-family: var(--mono);
  font-size: 11px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 6px;
  padding: 2px 7px;
}

.site-footer {
  position: relative;
  z-index: 1;
  text-align: center;
  padding: 18px 16px 30px;
  font-size: 13px;
  color: var(--muted);
  display: grid;
  gap: 4px;
}

/* flash on phase change */

@keyframes flash {
  0% { opacity: 0.55; }
  100% { opacity: 0; }
}

.flash::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
  background: var(--phase);
  animation: flash 0.45s ease-out forwards;
}

@media (prefers-reduced-motion: reduce) {
  .flash::after { display: none; }
  .btn:hover, .preset:hover, .mute:hover { transform: none; }
  body, .phase-glow, .progress-fill, .tld, .phase-label { transition: none; }
}

@media (max-width: 560px) {
  .hints { display: none; }
  .controls { width: 100%; }
  .btn-primary { flex: 1 1 100%; }
  .btn-ghost { flex: 1; }
}
