/* ─────────────────────────────────────────────────────────────────
   Frame & wall — minimal Vestaboard-style enclosure
   ───────────────────────────────────────────────────────────────── */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Surface tokens */
  --wall: #f1ede5;
  --wall-shadow: rgba(40, 32, 22, 0.10);
  --ink: #1a1a1a;
  --ink-soft: #545454;
  --ink-mute: #8a8a8a;
  --hairline: rgba(0, 0, 0, 0.08);
  --hairline-strong: rgba(0, 0, 0, 0.14);
  --surface: #ffffff;
  --surface-2: #f7f5f0;

  /* The frame & tiles (dark theme — Vestaboard "Black") */
  --frame: #0e0e0e;
  --frame-edge: #181818;
  --tile-bg: #0e0e0e;
  --tile-text: #f1ede5;

  /* Curated palette — Vestaboard's 7 tile colors */
  --p-white:  #f1ede5;
  --p-red:    #ef4b3b;
  --p-orange: #f3833a;
  --p-yellow: #efc742;
  --p-green:  #4ea14e;
  --p-blue:   #1c75bc;
  --p-violet: #8a3fa3;

  --accent: var(--ink);

  /* Type */
  --sans: 'Inter Tight', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

/* Light theme — Vestaboard "White" variant */
body[data-theme="light"] {
  --wall: #e8e3d8;
  --frame: #ffffff;
  --frame-edge: #ebe6db;
  --tile-bg: #f5f1e8;
  --tile-text: #1a1a1a;
  --wall-shadow: rgba(80, 60, 40, 0.12);
}

html, body {
  height: 100%;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--wall);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(ellipse 90% 70% at 50% 30%, transparent, rgba(0,0,0,0.04) 100%),
    var(--wall);
  transition: background 400ms ease, color 400ms ease;
}

button { font: inherit; cursor: pointer; border: none; outline: none; background: none; color: inherit; }
input  { font: inherit; }

/* ── Boot — minimal fade-in ─────────────────────────────────── */

.boot {
  position: fixed; inset: 0;
  background: var(--wall);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 700ms ease;
}
.boot.gone { opacity: 0; pointer-events: none; }

.boot-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--ink);
  animation: bootPulse 1.4s ease-in-out infinite;
}
@keyframes bootPulse {
  0%, 100% { opacity: 0.25; transform: scale(0.8); }
  50%      { opacity: 1;    transform: scale(1.1); }
}

/* ── Top bar (brand + status) ─────────────────────────────────── */

.topbar {
  position: relative;
  z-index: 5;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 32px 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--sans);
}
.brand-mark {
  width: 14px; height: 14px;
  background: var(--ink);
  border-radius: 1px;
  position: relative;
}
.brand-mark::after {
  content: '';
  position: absolute;
  inset: 0;
  border-top: 1px solid var(--wall);
  border-bottom: 1px solid var(--wall);
}
.brand-name {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--ink);
}

.status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
}
.status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--p-green);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--p-green) 22%, transparent);
  animation: statusPulse 2.6s ease-in-out infinite;
}
@keyframes statusPulse {
  0%, 100% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--p-green) 22%, transparent); }
  50%      { box-shadow: 0 0 0 5px color-mix(in srgb, var(--p-green) 10%, transparent); }
}
.status-sep { opacity: 0.4; }
.status-label, .status-meta { color: var(--ink-soft); }

/* ── Stage ───────────────────────────────────────────────────── */

.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 24px 32px 32px;
  min-height: 0;
}

/* ── Frame (minimal matte bezel + soft wall shadow) ──────────── */

.frame {
  --frame-w: min(1200px, 95vw);
  width: var(--frame-w);
  padding: 16px;
  background: var(--frame);
  border-radius: 4px;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.06),
    0 8px 24px var(--wall-shadow),
    0 24px 60px rgba(0, 0, 0, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.04),
    0 0 0 1px var(--frame-edge);
  transition: background 400ms ease;
  position: relative;
}

.frame::before,
.frame::after {
  content: '';
  position: absolute;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.03);
  pointer-events: none;
}
.frame::before { top: 6px; left: 6px; }
.frame::after  { bottom: 6px; right: 6px; }

.frame-inset {
  background: var(--tile-bg);
  border-radius: 2px;
  padding: 8px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.02),
    inset 0 -1px 0 rgba(0, 0, 0, 0.3);
  overflow: hidden;
}

.board-host {
  position: relative;
}

body[data-theme="light"] .frame {
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 8px 24px var(--wall-shadow),
    0 24px 60px rgba(0, 0, 0, 0.10),
    inset 0 1px 0 rgba(0, 0, 0, 0.03),
    0 0 0 1px rgba(0, 0, 0, 0.06);
}

/* ── Channel selector (below the frame) ───────────────────── */

.channels {
  display: flex;
  align-items: center;
  gap: 4px;
  background: transparent;
  padding: 0;
  flex-wrap: wrap;
  justify-content: center;
}
.channel {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 12px 7px 9px;
  border-radius: 100px;
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.005em;
  white-space: nowrap;
  transition: background 180ms ease, color 180ms ease;
}
.channel:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--ink);
}
.channel.active {
  background: var(--ink);
  color: var(--wall);
}
body[data-theme="light"] .channel.active {
  background: var(--ink);
  color: #fff;
}
.channel.active:hover {
  background: var(--ink);
  color: var(--wall);
}
.channel-key {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.06);
  border-radius: 4px;
  color: var(--ink-soft);
}
.channel.active .channel-key {
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.85);
}

/* ── Dock (floating control cluster, bottom-right) ──────────── */

.dock {
  position: fixed;
  right: 24px;
  bottom: 24px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-radius: 100px;
  border: 1px solid var(--hairline);
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.04),
    0 8px 24px rgba(0, 0, 0, 0.06);
  z-index: 100;
}
body[data-theme="light"] .dock {
  background: rgba(255, 255, 255, 0.7);
}

.dock-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-soft);
  transition: background 160ms ease, color 160ms ease;
}
.dock-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: var(--ink);
}
.dock-btn:active {
  background: rgba(0, 0, 0, 0.10);
  transform: scale(0.96);
}

.dock-btn .ico-mute { display: none; }
.dock-btn[aria-pressed="true"] .ico-sound { display: none; }
.dock-btn[aria-pressed="true"] .ico-mute  { display: inline-block; }

/* ── Toast ─────────────────────────────────────────────────── */

.toast {
  position: fixed;
  bottom: 88px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  padding: 10px 16px;
  background: rgba(20, 20, 20, 0.92);
  border-radius: 100px;
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.95);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms, transform 220ms;
  z-index: 200;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.06),
    0 8px 24px rgba(0, 0, 0, 0.15);
}
.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Responsive ───────────────────────────────────────────── */

@media (max-width: 1100px) {
  .frame { --frame-w: 94vw; padding: 12px; }
  .topbar { padding: 18px 22px 0; }
  .stage { padding: 20px 22px 24px; }
}

@media (max-width: 720px) {
  .topbar { padding: 14px 16px 0; flex-direction: column; align-items: stretch; gap: 6px; }
  .status { justify-content: flex-start; }
  .frame { --frame-w: 96vw; padding: 10px; }
  .frame-inset { padding: 6px; }
  .channels { gap: 2px; }
  .channel { font-size: 12px; padding: 6px 10px 6px 7px; }
  .channel-name { display: none; }
  .channel { padding: 8px; }
  .dock { right: 12px; bottom: 12px; }
}

@media (max-width: 480px) {
  .frame { padding: 8px; }
}

/* Fullscreen */
:fullscreen body { background: #000; }
:fullscreen .topbar,
:fullscreen .channels,
:fullscreen .dock { display: none; }
:fullscreen .stage { padding: 0; }
:fullscreen .frame {
  width: 100vw;
  height: 100vh;
  padding: 24px;
  border-radius: 0;
  background: #000;
  box-shadow: none;
}
:fullscreen .frame-inset {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}
