:root {
  --bg: #04060c;
  --fg: #d7e3ff;
  --dim: #6b7a99;
  --accent: #ffd84d;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, "DejaVu Sans Mono", monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

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

.hud {
  position: fixed;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  z-index: 2;
}

.hud.top {
  display: none;   /* 제목은 캔버스에 ASCII로 그림 (main.js buildTitleCells) */
  top: 0;
  flex-direction: column;
  gap: 2px;
  padding: calc(env(safe-area-inset-top) + 12px) 12px 0;
  pointer-events: none;
}

.title {
  font-size: clamp(13px, 3.6vw, 18px);
  letter-spacing: 0.2em;
  color: var(--accent);
  text-shadow: 0 0 8px rgba(255, 216, 77, 0.6);
}

.dday {
  font-size: clamp(11px, 3vw, 14px);
  color: var(--dim);
  letter-spacing: 0.1em;
}

.hud.bottom {
  bottom: 0;
  flex-wrap: wrap;
  padding: 0 10px calc(env(safe-area-inset-bottom) + 14px);
}

.hud.bottom button {
  font: inherit;
  font-size: clamp(12px, 3.4vw, 14px);
  color: var(--dim);
  background: rgba(4, 6, 12, 0.55);
  border: 1px solid rgba(107, 122, 153, 0.35);
  border-radius: 6px;
  padding: 9px 8px;
  min-height: 40px;
  cursor: pointer;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: color 0.15s, border-color 0.15s;
}

.hud.bottom button[aria-pressed="true"] {
  color: var(--fg);
  border-color: rgba(215, 227, 255, 0.55);
}

.hud.bottom button:active { transform: translateY(1px); }

@media (hover: hover) {
  .hud.bottom button:hover { color: var(--fg); }
}

.hint {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom) + 20px);
  transform: translateX(-50%);
  z-index: 2;
  font-size: clamp(11px, 3vw, 13px);
  color: var(--dim);
  white-space: nowrap;
  pointer-events: none;
  transition: opacity 0.8s;
}
.hint.hidden { opacity: 0; }

/* ---------- 토스트 ---------- */
.toast {
  position: fixed;
  left: 50%;
  top: calc(env(safe-area-inset-top) + 64px);
  transform: translate(-50%, -6px);
  z-index: 3;
  padding: 7px 14px;
  font-size: clamp(12px, 3.4vw, 14px);
  color: var(--accent);
  background: rgba(4, 6, 12, 0.7);
  border: 1px solid rgba(255, 216, 77, 0.35);
  border-radius: 999px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.5s, transform 0.5s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 크리스마스 당일 ---------- */
body.xmas .title {
  background: linear-gradient(90deg, #ff4d4d, #ffd84d, #7dff6a, #4dc3ff, #ff7ae0, #ff4d4d);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 0 6px rgba(255, 216, 77, 0.55));
  animation: rainbow 4s linear infinite;
}
body.xmas .dday { color: var(--accent); }
@keyframes rainbow { to { background-position: 300% 0; } }

/* ---------- 날짜 미리보기 (?dev) ---------- */
.devbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(env(safe-area-inset-bottom) + 100px);
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--fg);
}
.devbar[hidden] { display: none; }
.devbar button {
  font: inherit;
  color: var(--fg);
  background: rgba(4, 6, 12, 0.6);
  border: 1px solid rgba(215, 227, 255, 0.4);
  border-radius: 6px;
  width: 36px;
  height: 36px;
  cursor: pointer;
}
#dev-day { min-width: 52px; text-align: center; }

/* ---------- 갤러리 임베드 (?embed) ---------- */
body.embed .hud.bottom, body.embed .hint, body.embed .toast { display: none; }
