:root {
  --bg: #0b0908;
  --card: #15110f;
  --line: #2e2622;
  --text: #f1e7dc;
  --muted: #a39587;
  --red: #e3261b;
  --warn: #ffb347;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body {
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: calc(16px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
}
main { max-width: 560px; margin: 0 auto; display: grid; gap: 20px; }
[hidden] { display: none !important; }

header { text-align: center; }
h1 {
  margin: 12px 0 6px;
  font: 700 clamp(26px, 7vw, 38px)/1.1 Georgia, "Times New Roman", serif;
  color: var(--red);
  text-transform: uppercase;
  letter-spacing: .04em;
  text-shadow: 0 0 14px rgba(227, 38, 27, .55);
}
.lead { color: var(--muted); margin: 0; }

.lights { display: flex; justify-content: center; gap: 14px; }
.lights i {
  width: 12px; height: 18px; border-radius: 50% 50% 45% 45%;
  background: var(--c); box-shadow: 0 0 12px var(--c);
  animation: glow 2.4s infinite ease-in-out;
}
.lights i:nth-child(5n+1) { --c: #ff3b1f; }
.lights i:nth-child(5n+2) { --c: #2f6bff; animation-delay: .4s; }
.lights i:nth-child(5n+3) { --c: #22d34a; animation-delay: .9s; }
.lights i:nth-child(5n+4) { --c: #ffb000; animation-delay: 1.3s; }
.lights i:nth-child(5n+5) { --c: #ff2f8a; animation-delay: 1.8s; }
@keyframes glow { 50% { opacity: .35; box-shadow: none; } }

section {
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px;
}
.step { display: block; font-weight: 700; margin-bottom: 8px; }
fieldset { border: 0; padding: 0; margin: 18px 0 0; }
legend { padding: 0; }

input[type=text] {
  width: 100%; font: inherit; font-size: 20px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text); background: #0d0b0a; border: 1px solid var(--line); border-radius: 10px; padding: 12px;
}
input[type=text]:focus { outline: 2px solid var(--red); outline-offset: 1px; }
.meta { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--muted); margin-top: 6px; }
.warn { color: var(--warn); }
.muted { color: var(--muted); }
.error { color: #ff7b6b; font-weight: 600; }

.board { display: flex; flex-wrap: wrap; gap: 4px 2px; min-height: 34px; margin-top: 10px; }
.board .w { display: flex; gap: 2px; margin-right: 12px; }
.board span {
  width: 24px; height: 30px; display: grid; place-items: center;
  font: 700 16px Georgia, serif; color: #1a1a1a; border-radius: 4px;
  background: #e9dcc5;
}
.board span:nth-child(5n+1) { box-shadow: 0 -3px 0 #ff3b1f inset; }
.board span:nth-child(5n+2) { box-shadow: 0 -3px 0 #2f6bff inset; }
.board span:nth-child(5n+3) { box-shadow: 0 -3px 0 #22d34a inset; }
.board span:nth-child(5n+4) { box-shadow: 0 -3px 0 #ffb000 inset; }
.board span:nth-child(5n+5) { box-shadow: 0 -3px 0 #ff2f8a inset; }

.slots { display: grid; gap: 8px; }
.slots label {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; cursor: pointer;
}
.slots label:has(input:checked) { border-color: var(--red); background: rgba(227, 38, 27, .1); }
.slots input { accent-color: var(--red); margin-right: 10px; }
.slots .time { font-weight: 700; font-size: 18px; }
.slots .in { color: var(--muted); font-size: 14px; }

button {
  width: 100%; margin-top: 18px; padding: 14px; font: 700 18px system-ui, sans-serif;
  color: #fff; background: var(--red); border: 0; border-radius: 10px; cursor: pointer;
}
button:disabled { opacity: .5; cursor: default; }

.big { font-size: 20px; font-weight: 700; margin: 14px 0 4px; }
.countdown { font: 700 44px/1 ui-monospace, Menlo, monospace; color: var(--red); margin: 10px 0; text-shadow: 0 0 12px rgba(227, 38, 27, .5); }
#done-view, #closed-view { text-align: center; }
#done-view .board { justify-content: center; }

footer { font-size: 12px; color: var(--muted); text-align: center; }
