:root {
  --bg: #0b1220;
  --panel: #111a2b;
  --panel-2: #182338;
  --line: #2a3956;
  --text: #edf2fb;
  --muted: #a9b8d1;
  --accent: #58a6ff;
  --danger: #ff6b6b;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}
button, input, textarea, select { font: inherit; }
button {
  cursor: pointer;
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 10px;
}
button:hover { border-color: var(--accent); }
button.secondary { opacity: 0.9; }
button.danger { border-color: #5a2e33; }
input, textarea, select {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0d1524;
  color: var(--text);
}
.site-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--line);
  background: #0d1524;
}
.site-header h1 { margin: 0 0 6px; font-size: 28px; }
.site-header p { margin: 0; color: var(--muted); }
.layout {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  grid-template-areas:
    "viewer games"
    "viewer sidebar";
  gap: 18px;
  padding: 18px;
  align-items: start;
}
.viewer-panel { grid-area: viewer; }
.game-picker-panel { grid-area: games; }
.sidebar { grid-area: sidebar; }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
}
.player-shell {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.zoom-stage {
  position: absolute;
  inset: 0;
  transform-origin: center center;
  will-change: transform;
}
.player-shell.pan-active {
  cursor: grab;
}
.player-shell.pan-active.panning {
  cursor: grabbing;
}
.player-shell.pan-active #youtubePlayer {
  pointer-events: none;
}
.player-shell:fullscreen {
  width: 100vw;
  height: 100vh;
  aspect-ratio: auto;
  border-radius: 0;
}
.player-shell:fullscreen .zoom-stage {
  inset: 0;
}
#youtubePlayer {
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
  object-fit: contain;
}
#markupCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
#markupCanvas.markup-active {
  pointer-events: auto;
  cursor: crosshair;
}
.markup-status {
  margin: 10px 0;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0d1524;
  color: var(--muted);
  font-size: 13px;
}
button.active-control {
  outline: 2px solid var(--accent);
}
.transport-row, .mark-row, .inline-row, .timeline-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}
.inline-row > * { flex: 1; }
.timeline-row .time-box {
  flex: 1;
  min-width: 140px;
  background: #0d1524;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}
.timeline-row span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}
.sidebar .stack {
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 14px;
  margin-top: 14px;
}
.sidebar .stack:first-child {
  border-top: none;
  padding-top: 0;
  margin-top: 0;
}
.sidebar h2, .game-picker-panel h2 {
  margin: 0 0 12px;
  font-size: 18px;
}
label {
  display: block;
  margin: 10px 0 6px;
  color: var(--muted);
  font-size: 13px;
}
.tool-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.tool-btn.active { outline: 2px solid var(--accent); }
.note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}
.file-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  cursor: pointer;
}
.file-label.wide { min-width: 210px; }
#videoSelect {
  min-height: 260px;
  font-family: Consolas, monospace;
}
.clip-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  max-height: 480px;
  overflow: auto;
}
.clip-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #0d1524;
}
.clip-card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}
.clip-actions {
  display: flex;
  gap: 8px;
}
.clip-tag { font-weight: 700; }
.clip-time, .clip-meta { color: var(--muted); font-size: 13px; }
.clip-notes { margin-top: 8px; white-space: pre-wrap; }

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
    grid-template-areas:
      "games"
      "viewer"
      "sidebar";
    padding: 12px;
    gap: 14px;
  }

  .game-picker-panel {
    order: -1;
  }

  .site-header {
    padding: 16px 14px;
  }

  .site-header h1 {
    font-size: 30px;
    line-height: 1.05;
  }
}


/* YouTube Film Room deployment adjustments */
#youtubePlayer { width: 100%; height: 100%; display:block; background:#000; }
#videoSelect { min-height: 52px; font-family: Arial, Helvetica, sans-serif; }
.site-header .top-nav { margin-top: 10px; display:flex; gap:12px; flex-wrap:wrap; }
.site-header .top-nav a { color: var(--accent); text-decoration:none; border:1px solid var(--line); padding:7px 10px; border-radius:999px; }
.site-header .top-nav a.active { background: var(--panel-2); color: var(--text); }
.player-shell.pan-active #youtubePlayer { pointer-events: none; }
