/* ---------- base ---------- */
:root {
  --bg: #06060a;
  --fg: #f5f4ee;
  --muted: rgba(245, 244, 238, 0.55);
  --faint: rgba(245, 244, 238, 0.18);
  --line: rgba(245, 244, 238, 0.08);
  --accent: #f5f4ee;
  --serif: 'Cormorant Garamond', 'Source Han Serif SC', 'Noto Serif SC', 'Songti SC', ui-serif, Georgia, serif;
  --sans: -apple-system, 'SF Pro Text', 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  width: 100%; height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  display: block;
  position: relative;
  min-height: 100dvh;
}

/* ---------- canvas + overlays ---------- */
#vis {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  display: block;
  z-index: 0;
}

.grain {
  position: fixed; inset: -10%;
  pointer-events: none; z-index: 1;
  opacity: 0.06;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1   0 0 0 0 1   0 0 0 0 1   0 0 0 1 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
  animation: grain 7s steps(7) infinite;
}
@keyframes grain {
  0%   { transform: translate(0, 0); }
  10%  { transform: translate(-3%, 1%); }
  25%  { transform: translate(2%, -2%); }
  40%  { transform: translate(-1%, 3%); }
  60%  { transform: translate(3%, 0); }
  80%  { transform: translate(-2%, -1%); }
  100% { transform: translate(0, 0); }
}

.vignette {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 2;
  background:
    radial-gradient(ellipse at center, transparent 40%, rgba(0,0,0,0.55) 100%),
    linear-gradient(180deg, rgba(0,0,0,0.25) 0%, transparent 25%, transparent 70%, rgba(0,0,0,0.45) 100%);
}

/* ---------- topbar ---------- */
.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 28px;
  pointer-events: none;
}

.brand {
  display: flex; align-items: baseline; gap: 10px;
  pointer-events: auto;
}
.brand__mark {
  font-family: var(--serif);
  font-size: 22px;
  letter-spacing: 0.02em;
  font-weight: 500;
  font-style: italic;
}

.topbar__hint {
  font-size: 11px;
  letter-spacing: 0.18em;
  color: var(--muted);
  font-feature-settings: "tnum";
  transition: opacity 0.6s ease;
}
.topbar__hint.is-hidden { opacity: 0; }

/* ---------- stage ---------- */
.stage {
  position: fixed; inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

/* play button in dock */
.play {
  position: relative;
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--faint);
  background: rgba(8, 8, 12, 0.4);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--fg);
  cursor: pointer;
  display: grid; place-items: center;
  transition: transform 0.25s ease, border-color 0.4s ease, background 0.4s ease;
  flex-shrink: 0;
}
.play:hover { background: rgba(20, 20, 26, 0.55); border-color: rgba(245,244,238,0.3); transform: scale(1.05); }
.play:active { transform: scale(0.95); }
.play__icon {
  position: absolute;
  width: 14px; height: 14px;
  fill: currentColor;
  transition: opacity 0.25s ease, transform 0.25s ease;
}
.play__icon--play   { opacity: 1; transform: translateX(1px); }
.play__icon--pause  { opacity: 0; }
.play__icon--loading {
  opacity: 0;
  fill: none;
  stroke: currentColor; stroke-width: 2;
  stroke-dasharray: 18 30;
  animation: spin 1.4s linear infinite;
}
.play[data-state="playing"] .play__icon--play { opacity: 0; }
.play[data-state="playing"] .play__icon--pause { opacity: 1; }
.play[data-state="loading"] .play__icon--play { opacity: 0; }
.play[data-state="loading"] .play__icon--loading { opacity: 1; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- dock ---------- */
.dock {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 5;
  padding: 22px 28px 26px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  pointer-events: none;
}

.dock__hint {
  font-family: var(--serif);
  font-style: italic;
  font-size: 16px;
  color: var(--muted);
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}
.dock__hint.is-show {
  opacity: 1;
}

.dock__actions {
  pointer-events: auto;
  display: flex; gap: 10px; align-items: center;
  margin-left: auto;
}
.iconbtn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 14px;
  font-size: 11px;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--fg);
  background: rgba(8, 8, 12, 0.4);
  border: 1px solid var(--faint);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.25s ease, border-color 0.25s ease, transform 0.2s ease;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.iconbtn:hover { background: rgba(20, 20, 26, 0.55); border-color: rgba(245,244,238,0.3); }
.iconbtn:active { transform: translateY(1px); }
.iconbtn svg { width: 14px; height: 14px; fill: currentColor; }
.iconbtn--ghost { padding: 10px; }
.iconbtn--ghost span { display: none; }

/* tooltips */
[data-tooltip] {
  position: relative;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translate(-50%, -8px);
  padding: 6px 10px;
  background: rgba(8, 8, 12, 0.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  border: 1px solid var(--faint);
  z-index: 10;
}
[data-tooltip]:hover::after {
  opacity: 1;
  transform: translate(-50%, -12px);
}

/* responsive */
@media (max-width: 640px) {
  .topbar { padding: 16px 18px; }
  .topbar__hint { display: none; }
  .dock { flex-direction: column; align-items: stretch; padding: 14px 16px 18px; gap: 14px; }
  .dock__actions { justify-content: flex-end; }
}

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