:root {
  --bg: #0b1018;
  --panel: rgba(18, 25, 37, 0.72);
  --panel-border: rgba(255, 255, 255, 0.09);
  --text: #e8edf4;
  --muted: #93a0b3;
  --accent: #7cc4ff;
  --now: #38d6f5;
  --lvl0: #e5534b;
  --lvl1: #f2a23a;
  --lvl2: #4cb963;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  touch-action: none;
  outline: none;
}
#scene.grabbing { cursor: grabbing; }

/* ---------- panels ---------- */
.topbar, .summary {
  position: fixed;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 14px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.topbar {
  top: 16px;
  left: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 16px;
}
.brand h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.brand p {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.date-field {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}
input[type="date"], button {
  font: inherit;
  font-size: 13px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 6px 10px;
  color-scheme: dark;
}
button { cursor: pointer; }
button:hover { background: rgba(255, 255, 255, 0.12); }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.seg { display: flex; }
.seg button { border-radius: 0; }
.seg button:first-child { border-radius: 8px 0 0 8px; }
.seg button:last-child { border-radius: 0 8px 8px 0; border-left: none; }
.seg button[aria-pressed="true"] {
  background: rgba(124, 196, 255, 0.22);
  border-color: rgba(124, 196, 255, 0.5);
}

/* ---------- bottom summary ---------- */
.summary {
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 10px 12px 10px 18px;
  max-width: calc(100% - 32px);
  font-size: 14px;
}
.when {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.live {
  color: var(--now);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.live[hidden] { display: none; }
.verdict {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  white-space: nowrap;
}
.verdict .chip { display: inline-flex; align-items: center; gap: 6px; }
.verdict .chip i {
  width: 10px; height: 10px; border-radius: 50%; display: inline-block;
}
.verdict .all-good { color: var(--lvl2); font-weight: 600; }
.verdict .weekend-note { color: var(--lvl0); font-weight: 600; }
#copy {
  background: rgba(124, 196, 255, 0.16);
  border-color: rgba(124, 196, 255, 0.45);
  white-space: nowrap;
}

/* ---------- floating ribbon labels ---------- */
#labels {
  position: fixed;
  inset: 0;
  pointer-events: none;
}
.rlabel {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -100%);
  text-align: center;
  white-space: nowrap;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}
.rlabel .code {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.06em;
}
.rlabel .name {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}
.rlabel .time {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 3px 10px 3px 8px;
  border-radius: 999px;
  font-size: 17px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.12);
  text-shadow: none;
}
.rlabel .time i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.rlabel .day {
  font-size: 12px;
  color: var(--muted);
  margin-top: 3px;
}
.rlabel .tag {
  display: none;
  margin-top: 3px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--lvl0);
}
.rlabel.weekend .tag { display: block; }
.rlabel[data-level="0"] .time { border-color: color-mix(in srgb, var(--lvl0) 70%, transparent); }
.rlabel[data-level="1"] .time { border-color: color-mix(in srgb, var(--lvl1) 70%, transparent); }
.rlabel[data-level="2"] .time { border-color: color-mix(in srgb, var(--lvl2) 70%, transparent); }
.rlabel.overlap .code { font-size: 13px; color: var(--muted); }
.rlabel.overlap .time { font-size: 14px; }

/* ---------- toast & error ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%) translateY(8px);
  padding: 8px 14px;
  border-radius: 10px;
  background: rgba(20, 28, 40, 0.95);
  border: 1px solid var(--panel-border);
  font-size: 13px;
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.error {
  position: fixed;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
  padding: 24px;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.5;
}
.error[hidden] { display: none; }
.error small { color: var(--muted); }

@media (max-width: 860px) {
  .brand p { display: none; }
  .summary { flex-wrap: wrap; justify-content: center; gap: 8px 14px; }
}
@media (max-width: 600px) {
  .topbar { flex-direction: column; align-items: stretch; gap: 8px; }
  .controls { justify-content: space-between; }
  .rlabel .name, .rlabel .day { display: none; }
  .rlabel .code { font-size: 12px; }
  .rlabel .time { font-size: 12px; padding: 2px 7px 2px 6px; gap: 5px; }
  .rlabel .time i { width: 7px; height: 7px; }
  .rlabel.overlap { display: none; }
}
