@font-face {
  font-family: "Noto Sans KR";
  src: url("../fonts/NotoSansKR-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --ink: #e8f1ff;
  --muted: rgba(214, 228, 248, 0.78);
  --line: rgba(176, 208, 255, 0.28);
  --panel: rgba(8, 14, 28, 0.62);
  --accent: #8ec4ff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #070b14;
  color: var(--ink);
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  overflow: hidden;
}

#stage {
  position: fixed;
  inset: 0;
  touch-action: none;
}

#stage canvas { display: block; }

.labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

#ui {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  padding:
    calc(14px + env(safe-area-inset-top))
    calc(14px + env(safe-area-inset-right))
    calc(14px + env(safe-area-inset-bottom))
    calc(14px + env(safe-area-inset-left));
}

button { font: inherit; color: inherit; }

.top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.status, .modes, .presets, .delivery, .card, .hint {
  pointer-events: auto;
}

.status {
  padding: 10px 14px 11px;
  border-radius: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(16px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
}

.count {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 18px;
  letter-spacing: -0.03em;
}

.count::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9ad7ff;
  box-shadow: 0 0 10px #9ad7ff;
  animation: pulse 2.4s ease-in-out infinite;
}

.clock {
  margin-top: 2px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  letter-spacing: 0.04em;
}

.modes {
  display: flex;
  padding: 4px;
  gap: 4px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.modes button, .presets button {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  cursor: pointer;
}

.modes button {
  min-width: 52px;
  padding: 8px 12px;
}

.modes button.on, .presets button.on {
  background: rgba(70, 140, 255, 0.38);
  color: white;
  box-shadow: inset 0 0 0 1px rgba(170, 210, 255, 0.55);
}

.hint {
  position: absolute;
  left: 50%;
  top: 42%;
  transform: translate(-50%, -50%);
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(8, 14, 28, 0.45);
  border: 1px solid var(--line);
  color: var(--muted);
  letter-spacing: -0.02em;
  transition: opacity 0.8s ease;
}

.hint.gone { opacity: 0; }

.bottom {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: calc(12px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.card {
  width: min(420px, 100%);
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 40px 12px 14px;
  border-radius: 16px;
  background: rgba(10, 22, 44, 0.78);
  border: 1px solid rgba(170, 210, 255, 0.45);
  backdrop-filter: blur(16px);
  position: relative;
  pointer-events: auto;
}

.card[hidden] { display: none; }

.card-name { font-size: 16px; letter-spacing: -0.03em; }
.card-role { color: var(--muted); font-size: 13px; line-height: 1.45; }

#card-x {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  cursor: pointer;
}

.delivery {
  width: min(560px, 100%);
  text-align: center;
  padding: 11px 16px;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(18px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
  letter-spacing: -0.02em;
}

.delivery.pop { animation: pop 0.35s ease; }

.presets {
  display: flex;
  gap: 8px;
  max-width: 100%;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
  touch-action: pan-x;
}

.presets::-webkit-scrollbar { display: none; }

.presets button {
  flex: 0 0 auto;
  padding: 9px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.name-tag, .zone-tag {
  pointer-events: none;
  white-space: nowrap;
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
}

.name-tag {
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(8, 14, 28, 0.72);
  border: 1px solid rgba(160, 198, 255, 0.38);
  color: white;
  font-size: 12px;
  letter-spacing: -0.03em;
}

.name-tag.on {
  background: rgba(36, 104, 196, 0.88);
  border-color: rgba(198, 226, 255, 0.95);
}

.zone-tag {
  font-size: 13px;
  letter-spacing: 0.14em;
  color: rgba(198, 224, 255, 0.88);
  text-shadow: 0 0 12px rgba(70, 140, 255, 0.85);
}

#boot {
  position: fixed;
  inset: 0;
  z-index: 8;
  display: grid;
  place-items: center;
  background: #070b14;
  transition: opacity 0.45s ease;
}

#boot.hide {
  opacity: 0;
  pointer-events: none;
}

.boot-card {
  text-align: center;
  letter-spacing: -0.03em;
}

.boot-card p, .boot-card strong { display: block; }

.boot-card p {
  margin: 8px 0 0;
  color: var(--muted);
}

.vignette {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  background: radial-gradient(ellipse at center, transparent 52%, rgba(2, 6, 14, 0.45) 100%);
}

@keyframes pulse {
  0%, 100% { opacity: 0.45; }
  50% { opacity: 1; }
}

@keyframes pop {
  from { transform: translateY(4px); opacity: 0.4; }
  to { transform: none; opacity: 1; }
}

@media (max-width: 640px) {
  .count { font-size: 15px; }
  .status { padding: 8px 10px; }
  .presets button, .modes button { padding: 8px 10px; font-size: 13px; }
  .delivery, .card-role { font-size: 12px; }
  .hint { font-size: 13px; }
}
