:root {
  --bg: #14151a;
  --panel: #1e2028;
  --accent: #b3261e;
  --accent2: #e0463b;
  --text: #eceef2;
  --muted: #8b8f9c;
  --border: #2c2e38;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}

header h1 { font-size: 1.2rem; margin: 0; letter-spacing: 0.5px; }

#userBar { font-size: 0.9rem; color: var(--muted); display: flex; gap: 12px; align-items: center; }
#userBar button {
  background: none; border: 1px solid var(--border); color: var(--text);
  padding: 4px 10px; border-radius: 4px; cursor: pointer;
}

.screen { padding: 24px; max-width: 1100px; margin: 0 auto; }
.hidden { display: none !important; }

/* Auth */
.authBox { max-width: 360px; margin: 60px auto; background: var(--panel); padding: 24px; border-radius: 8px; border: 1px solid var(--border); }
.tabs { display: flex; margin-bottom: 16px; }
.tab { flex: 1; padding: 10px; background: none; border: none; border-bottom: 2px solid var(--border); color: var(--muted); cursor: pointer; }
.tab.active { color: var(--text); border-bottom-color: var(--accent2); }
.authForm { display: flex; flex-direction: column; gap: 10px; }
.authForm input, .authForm textarea { padding: 10px; border-radius: 4px; border: 1px solid var(--border); background: #0f1015; color: var(--text); }
.authForm button { padding: 10px; border-radius: 4px; border: none; background: var(--accent); color: #fff; cursor: pointer; font-weight: 600; }
.authForm button:hover { background: var(--accent2); }
.err { color: #ff6b6b; font-size: 0.85rem; min-height: 1.1em; }
.ok { color: #6bd68b; font-size: 0.85rem; min-height: 1.1em; }

/* Nav */
.mainNav { display: flex; gap: 8px; margin-bottom: 20px; }
.navBtn { padding: 8px 16px; background: var(--panel); border: 1px solid var(--border); color: var(--muted); border-radius: 4px; cursor: pointer; }
.navBtn.active { color: var(--text); border-color: var(--accent2); }

/* Timer layout */
.timerLayout { display: flex; gap: 24px; flex-wrap: wrap; }
.videoPane { flex: 1 1 500px; min-width: 300px; }
.timerPane { flex: 1 1 320px; min-width: 280px; background: var(--panel); padding: 20px; border-radius: 8px; border: 1px solid var(--border); }

#videoForm { display: flex; gap: 8px; margin-bottom: 12px; }
#videoForm input { flex: 1; padding: 10px; border-radius: 4px; border: 1px solid var(--border); background: #0f1015; color: var(--text); }
#videoForm button, .timerControls button { padding: 10px 16px; border-radius: 4px; border: none; background: var(--accent); color: #fff; cursor: pointer; font-weight: 600; }
#videoForm button:hover, .timerControls button:hover { background: var(--accent2); }

#videoEmbed { position: relative; width: 100%; padding-top: 56.25%; background: #000; border-radius: 6px; overflow: hidden; }
#videoEmbed iframe, #videoEmbed > div > iframe { position: absolute; top: 0; left: 0; width: 100% !important; height: 100% !important; border: 0; }
#playerMount { position: absolute; top: 0; left: 0; width: 100%; height: 100%; }
#videoEmbed .placeholder { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--muted); text-align: center; padding: 0 16px; }

.videoClock { text-align: center; color: var(--muted); font-size: 0.85rem; margin-bottom: 12px; font-variant-numeric: tabular-nums; }
.videoClock span { color: var(--text); font-weight: 600; }

.markRow { display: flex; gap: 10px; margin-bottom: 10px; }
.markBox { flex: 1; background: #0f1015; border: 1px solid var(--border); border-radius: 6px; padding: 8px 10px; text-align: center; }
.markLabel { display: block; font-size: 0.7rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.markVal { display: block; font-variant-numeric: tabular-nums; font-weight: 600; margin-top: 2px; }

#timerDisplay { font-size: 2.6rem; font-variant-numeric: tabular-nums; text-align: center; margin-bottom: 16px; font-weight: 700; letter-spacing: 1px; }
.timerControls { display: flex; gap: 8px; margin-bottom: 8px; }
.timerControls button:disabled { opacity: 0.4; cursor: not-allowed; }
.hint { color: var(--muted); font-size: 0.8rem; margin-top: 0; margin-bottom: 16px; }

#saveRunForm { display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--border); padding-top: 16px; }
#saveRunForm input, #saveRunForm textarea { padding: 8px; border-radius: 4px; border: 1px solid var(--border); background: #0f1015; color: var(--text); }
#saveRunForm textarea { min-height: 50px; resize: vertical; }
#saveRunForm button { padding: 10px; border-radius: 4px; border: none; background: var(--accent); color: #fff; cursor: pointer; font-weight: 600; }
#saveRunForm button:disabled { opacity: 0.4; cursor: not-allowed; }

/* Tables */
table { width: 100%; border-collapse: collapse; background: var(--panel); border-radius: 8px; overflow: hidden; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
th { color: var(--muted); font-weight: 600; }
td button { background: none; border: 1px solid var(--border); color: var(--muted); padding: 4px 8px; border-radius: 4px; cursor: pointer; }
td button:hover { color: #ff6b6b; border-color: #ff6b6b; }

#btnNewInvite { margin-bottom: 16px; padding: 10px 16px; border-radius: 4px; border: none; background: var(--accent); color: #fff; cursor: pointer; font-weight: 600; }
