/* Clock: one big countdown and the time to be back. Sizes follow the window, so it reads in a small frame
   on the home page and across a projector in full screen. Colours are the theme tokens only. */
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; display: flex; flex-direction: column; background: var(--page); color: var(--ink);
  font: 16px/26px var(--font); -webkit-font-smoothing: antialiased; transition: background-color .4s;
}
p { margin: 0; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

.topbar { display: flex; align-items: center; gap: 16px; padding: 16px 24px; border-bottom: 1px solid var(--hairline); }
/* In a frame on the home page, the panel bar is the header */
[data-framed] .topbar { display: none; }

main {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(12px, 3vh, 32px); padding: 24px 16px; text-align: center;
}

.status {
  font: 600 clamp(12px, 2.2vmin, 20px)/1.3 var(--font-cond); letter-spacing: var(--label-tracking);
  text-transform: uppercase; color: var(--kicker);
}
.display {
  font: 500 clamp(56px, min(22vw, 30vh), 360px)/1 var(--font-mono); font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em; transition: color .4s;
}
.bar { width: min(100%, 720px); height: 6px; background: var(--surface-300); border-radius: 3px; overflow: hidden; }
.bar span { display: block; height: 100%; width: 100%; background: var(--redline); transform-origin: left; transition: background-color .4s; }

.back { display: flex; align-items: baseline; justify-content: center; gap: 12px; flex-wrap: wrap; }
.back-label { font: 600 clamp(12px, 2.2vmin, 20px)/1.3 var(--font-cond); letter-spacing: var(--label-tracking); text-transform: uppercase; color: var(--ink-muted); }
.back-time { font: var(--display-weight) clamp(28px, min(8vw, 10vh), 120px)/1 var(--font-display); font-variant-numeric: tabular-nums; }

button {
  font: 600 15px/1 var(--font); color: var(--ink); cursor: pointer; padding: 12px 18px; min-height: 44px;
  background: var(--surface-200); border: 1px solid var(--border); border-radius: var(--radius);
}
button:hover { border-color: var(--ink); }
button[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
button.primary { background: var(--redline); color: var(--on-redline); border-color: var(--redline); min-width: 160px; }

.setup { display: grid; gap: 16px; justify-items: center; }
.presets, .controls { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.custom { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: center; color: var(--ink-muted); font-size: 14px; }
.custom label { display: inline-flex; align-items: center; gap: 8px; }
.custom input {
  font: 16px/20px var(--font); color: var(--ink); background: var(--surface-100);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px;
}
.custom input[type="number"] { width: 5em; text-align: center; }
.or { font-style: italic; }

.hint { color: var(--ink-muted); font-size: 13px; }

/* The last minute */
body.ending .display { color: var(--status-amber); }
body.ending .bar span { background: var(--status-amber); }
/* Past the time to be back: count up until the host ends the break */
body.over { background: var(--status-red-wash); }
body.over .display { color: var(--status-red); animation: pulse 1s ease-in-out infinite; }
body.over .status { color: var(--status-red); }
@keyframes pulse { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { body.over .display { animation: none; } }

/* A short frame: drop what the countdown can do without */
@media (max-height: 520px) { .hint, .topbar { display: none; } }
