/* Reachy Beat Robots — We Are the Robots */

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

:root {
  --bg: #0a0a0f;
  --bg2: #12121a;
  --border: rgba(255,255,255,0.08);
  --accent: #8b5cf6;
  --accent2: #06b6d4;
  --text: #e8e8f0;
  --muted: #6b6b80;
  --grid: rgba(139,92,246,0.06);
  --beat: #a78bfa;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Space Grotesk", "SF Mono", ui-monospace, monospace;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow-x: hidden;
}

/* Grid background */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 40px 40px;
  pointer-events: none;
  z-index: 0;
}

.container {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 900px;
  padding: 32px 20px 60px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}

/* Header */
header {
  text-align: center;
}
.eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--accent);
  margin-bottom: 8px;
}
h1 {
  font-size: 36px;
  font-weight: 700;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent2) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.subtitle {
  font-size: 14px;
  color: var(--muted);
  margin-top: 6px;
}

/* Login panel */
.login-panel {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 40px;
  text-align: center;
  max-width: 440px;
  width: 100%;
}
.login-panel h2 { font-size: 20px; margin-bottom: 8px; }
.login-panel p { font-size: 13px; color: var(--muted); margin-bottom: 24px; }

/* Main layout */
.app-grid {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 20px;
  width: 100%;
}

/* Video panel — matches YouTube's 16:9 iframe; tiny inset (2px each side)
   trims the visible column padding without making the panel look small. */
.video-panel {
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  aspect-ratio: 16/9;
  width: calc(100% - 4px);
  margin: 0 auto;
}
.video-panel iframe {
  width: 100%;
  height: 100%;
  display: block;
}
.video-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg2);
  border-radius: 16px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  padding: 20px;
  pointer-events: none;
  transition: opacity 0.3s;
}
.video-overlay.hidden { opacity: 0; }

/* Video column wraps the video panel + the director-quote panel */
.video-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

/* Director's notes panel — Reachy mascot + the per-song director quote.
   Same width as the video panel above so the two stack cleanly. */
.director-panel {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  width: calc(100% - 4px);
  margin: 0 auto;
  box-sizing: border-box;
}
.director-mascot {
  width: 200px;
  height: auto;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.5));
}
.director-quote {
  margin: 0;
  padding: 0;
  font-size: 13px;
  line-height: 1.55;
  font-style: italic;
  color: var(--text);
  border-left: 3px solid var(--accent);
  padding-left: 12px;
}

/* Control panel */
.control-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}
.panel-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--muted);
  margin-bottom: 12px;
}

/* Robot selector */
select {
  width: 100%;
  background: rgba(255,255,255,0.05);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  padding: 8px 10px;
  font-family: inherit;
  cursor: pointer;
}
select option { background: #1a1a2e; }

/* Beat indicator */
.beat-row {
  display: flex;
  gap: 5px;
  justify-content: center;
  margin: 8px 0;
}
.beat-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--border);
  border: 1px solid rgba(255,255,255,0.1);
  transition: background 0.08s, transform 0.08s;
}
.beat-dot.active {
  background: var(--beat);
  transform: scale(1.4);
  box-shadow: 0 0 8px var(--beat);
}

/* Status */
.status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
}
.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--muted);
  flex-shrink: 0;
  transition: background 0.3s;
}
.status-dot.connected { background: #22c55e; box-shadow: 0 0 6px #22c55e; }
.status-dot.dancing { background: var(--beat); box-shadow: 0 0 6px var(--beat); }

/* Current move display */
.move-display {
  font-size: 11px;
  color: var(--accent);
  font-family: ui-monospace, monospace;
  min-height: 16px;
  text-align: center;
  letter-spacing: 0.5px;
}

/* Buttons */
button {
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: 100%;
  padding: 11px;
}
.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: white;
}
.btn-primary:hover { filter: brightness(1.15); transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; filter: none; }
.btn-ghost {
  background: rgba(255,255,255,0.05);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: rgba(255,255,255,0.09); }
.btn-stop {
  background: rgba(239,68,68,0.15);
  color: #f87171;
  border: 1px solid rgba(239,68,68,0.3);
}
.btn-stop:hover { background: rgba(239,68,68,0.25); }

/* Move name animation */
@keyframes pulse {
  0% { opacity: 1; }
  50% { opacity: 0.5; }
  100% { opacity: 1; }
}
.dancing .move-display { animation: pulse 0.5s ease-in-out infinite; }

/* Credits */
.credits {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  line-height: 2.1;
  max-width: 640px;
  margin: 28px auto 0;
}
.credits a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px dotted var(--border);
  padding-bottom: 1px;
  font-weight: inherit;
  transition: color 0.2s, font-weight 0.2s, border-color 0.2s;
}
.credits a:hover {
  color: var(--text);
  font-weight: 700;
  border-bottom-color: var(--text);
}
/* Music attribution line: separated visually as the standard disclaimer */
.credits .music-attribution {
  display: block;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 10.5px;
  opacity: 0.75;
}

/* Responsive */
@media (max-width: 640px) {
  h1 { font-size: 26px; }
  .app-grid { grid-template-columns: 1fr; }
  .control-panel { order: -1; }
}
