:root {
  color-scheme: dark;
  --bg: #000000;
  --digit: #c8ccd1;
  --muted: #8b9096;
  --dim: #6e7378;
  --amber: #c6a15a;
  --logo-brightness: 0.5;
  --shake: 3px;
  --flash: 0.24;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--digit);
  overflow: hidden;
}

body.is-idle, body.is-idle * { cursor: none; }

.stage {
  position: relative;
  width: 100vw;
  height: 100dvh;
  min-height: 100vh;
  padding: 5vh 5vw;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(12px, 2vh, 28px);
  background: #000;
  overflow: hidden;
  text-align: center;
}

.ambient {
  position: absolute;
  inset: -8%;
  background:
    radial-gradient(circle at 32% 42%, rgba(32, 38, 44, 0.55), transparent 46%),
    radial-gradient(circle at 68% 62%, rgba(40, 34, 24, 0.4), transparent 42%);
  animation: drift 48s ease-in-out infinite alternate;
  pointer-events: none;
  z-index: 0;
}

.fx, canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.core, .ring {
  position: absolute;
  left: 50%;
  top: 46%;
  opacity: 0;
  pointer-events: none;
}

.core {
  width: 42vmin;
  height: 42vmin;
  background: radial-gradient(circle, rgba(214, 168, 64, 0.95), rgba(214, 168, 64, 0) 68%);
}

.ring {
  width: 16vmin;
  height: 16vmin;
  border: 2px solid rgba(214, 176, 84, 0.8);
  border-radius: 50%;
}

.deadline { order: 5; }
.ending-layer { order: 4; }

.brand, .label, .clock, .deadline, .ending-layer, .hud, .link-status, .sr-only {
  position: relative;
  z-index: 2;
}

.brand {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  max-width: 90vw;
}

/* Logo art is near-white on black. Keep it to a header strip and half brightness so a long LED hold does not drive those pixels at full white. */
.logo {
  width: 16vw;
  min-width: 160px;
  max-height: 10vh;
  height: auto;
  object-fit: contain;
  filter: brightness(var(--logo-brightness)) saturate(0.72);
}

.event-title, .label, .deadline, .ending-message, .link-status {
  margin: 0;
  font-family: "Apple SD Gothic Neo", "Pretendard", "Noto Sans KR", sans-serif;
  font-weight: 500;
}

.event-title {
  color: var(--muted);
  font-size: clamp(14px, 2vh, 28px);
  letter-spacing: 0.04em;
}

.label {
  color: #a4a9ae;
  font-size: clamp(18px, 3vh, 40px);
}

.clock {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 1.6vw, 28px);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}

.unit {
  display: flex;
  align-items: baseline;
  gap: 0.12em;
}

.num {
  display: inline-block;
  font-family: "SF Mono", ui-monospace, Menlo, monospace;
  font-weight: 560;
  font-size: clamp(120px, 12vw, 220px);
  line-height: 0.9;
  color: var(--digit);
  font-variant-numeric: tabular-nums;
}

.suf, .colon {
  font-family: "Apple SD Gothic Neo", sans-serif;
  color: var(--muted);
  font-size: clamp(18px, 2.4vw, 36px);
}

.clock:not(.with-days) .days,
.clock:not(.with-days) .suf { display: none; }
.clock.with-days .colon { display: none; }

.deadline {
  color: #9aa0a6;
  font-size: clamp(16px, 2.4vh, 32px);
  font-variant-numeric: tabular-nums;
}

.ending-layer {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
}

.ending-title {
  margin: 0;
  font-family: "SF Pro Display", "Apple SD Gothic Neo", sans-serif;
  font-size: clamp(64px, 8vw, 140px);
  font-weight: 680;
  letter-spacing: 0.06em;
  color: #c8ccd1;
}

.ending-message {
  font-size: clamp(20px, 3vh, 42px);
  color: #b7bcc1;
}

.hud {
  position: absolute;
  left: 50%;
  bottom: 4vh;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 4;
  transition: opacity 0.4s ease;
}

.hud.is-hidden { opacity: 0; pointer-events: none; }

.hud button {
  background: #121212;
  color: #b7bcc1;
  border: 1px solid #2a2a2a;
  border-radius: 999px;
  padding: 0.55rem 0.9rem;
  font: inherit;
  font-size: 14px;
}

.hud button:focus-visible { outline: 2px solid var(--amber); }

.link-status {
  position: absolute;
  left: 5vw;
  bottom: 3vh;
  z-index: 4;
  min-height: 1em;
  color: var(--dim);
  font-size: 13px;
}

.link-status[data-state="ok"]:empty::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #245c38;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

[hidden] { display: none !important; }

@keyframes drift {
  from { transform: translate3d(-1.2%, -0.8%, 0); }
  to { transform: translate3d(1.2%, 0.8%, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .ambient { animation: none; }
}
