/* StreamRadar — shared styles (login + watch) */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #07090d;
  --bg2: #0d1117;
  --panel: #11161f;
  --border: #1e2632;
  --text: #e6edf3;
  --muted: #8b98a9;
  --accent: #38bdf8;
  --accent2: #818cf8;
  --green: #4ade80;
  --red: #f87171;
}

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* ---------- brand ---------- */
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.brand h1 { font-size: 28px; font-weight: 800; letter-spacing: -0.5px; }
.brand h1 span { background: linear-gradient(90deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.brand-sm h1 { font-size: 18px; }

/* ---------- login ---------- */
.login-body { display: flex; align-items: center; justify-content: center; padding: 20px; overflow: hidden; position: relative; }

.bg-glow {
  position: fixed; inset: 0; pointer-events: none;
  background:
    radial-gradient(600px 400px at 20% 15%, rgba(56, 189, 248, 0.10), transparent 60%),
    radial-gradient(700px 500px at 80% 85%, rgba(129, 140, 248, 0.10), transparent 60%);
}

.login-card {
  position: relative;
  width: 100%; max-width: 400px;
  background: linear-gradient(180deg, var(--panel), var(--bg2));
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px 34px 34px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.55);
}
.login-card .brand { justify-content: center; margin-bottom: 10px; }
.login-sub { text-align: center; color: var(--muted); font-size: 14px; margin-bottom: 26px; }

.pw-wrap { position: relative; }
.pw-wrap input {
  width: 100%;
  background: #0a0e14;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  font-size: 17px;
  padding: 14px 48px 14px 16px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.pw-wrap input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15); }
.pw-eye {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--muted); cursor: pointer;
  padding: 10px; border-radius: 10px; display: flex;
}
.pw-eye:hover { color: var(--text); }

.login-error { color: var(--red); font-size: 13px; min-height: 22px; padding: 4px 2px 2px; }

.btn-primary {
  width: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  color: #04121c;
  border: none; border-radius: 12px;
  font-size: 16px; font-weight: 700;
  padding: 14px;
  cursor: pointer;
  transition: filter 0.15s, transform 0.05s;
}
.btn-primary:hover { filter: brightness(1.1); }
.btn-primary:active { transform: scale(0.985); }
.btn-primary:disabled { opacity: 0.6; cursor: default; }

@keyframes shake { 20%, 60% { transform: translateX(-7px); } 40%, 80% { transform: translateX(7px); } }
.login-card.shake { animation: shake 0.35s; }

/* ---------- watch ---------- */
.watch-body { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px;
  background: rgba(13, 17, 23, 0.85);
  border-bottom: 1px solid var(--border);
  flex: 0 0 auto;
}
.topbar-right { display: flex; align-items: center; gap: 10px; }

.badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12.5px; font-weight: 700; letter-spacing: 0.5px;
  padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}
.badge-viewers { color: var(--muted); }
.badge-stats { color: var(--muted); font-family: Consolas, monospace; font-weight: 600; letter-spacing: 0; }
.badge-live { color: var(--red); border-color: rgba(248, 113, 113, 0.4); background: rgba(248, 113, 113, 0.08); }
.badge-live .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); animation: pulse 1.4s infinite; }
.badge-live.off { color: var(--muted); border-color: var(--border); background: rgba(255, 255, 255, 0.03); }
.badge-live.off .dot { background: var(--muted); animation: none; }
.badge-live.small { font-size: 11.5px; padding: 5px 10px; }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }

.stage {
  flex: 1 1 auto;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  min-height: 0;
}

/* widescreen player: fill available width, keep 16:9, never overflow viewport */
.player {
  position: relative;
  width: 100%;
  max-width: calc((100dvh - 120px) * 16 / 9);
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: 14px;
  border: 1px solid var(--border);
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.player video {
  width: 100%; height: 100%;
  object-fit: contain; display: block; background: #000;
  transform-origin: 0 0;
  touch-action: none; /* pinch/pan handled in JS */
}
.player.pannable video { cursor: grab; }
.player.pannable.panning video { cursor: grabbing; }

.player:fullscreen { max-width: none; border-radius: 0; border: none; aspect-ratio: auto; }
.player:-webkit-full-screen { max-width: none; border-radius: 0; border: none; }

.overlay {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  background: radial-gradient(500px 300px at 50% 40%, rgba(56, 189, 248, 0.07), transparent 70%), #05070b;
  text-align: center; padding: 20px;
}
.radar-spin { width: 96px; height: 96px; margin-bottom: 12px; }
.radar-spin .sweep { transform-origin: 48px 48px; animation: sweep 2.4s linear infinite; }
@keyframes sweep { to { transform: rotate(360deg); } }
.overlay-title { font-size: 20px; font-weight: 700; }
.overlay-sub { font-size: 13.5px; color: var(--muted); }

.controls {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.65));
  opacity: 0; transition: opacity 0.25s;
  pointer-events: none;
}
.player.show-controls .controls, .player:hover .controls { opacity: 1; pointer-events: auto; }
.controls-left, .controls-right { display: flex; align-items: center; gap: 8px; }

.ctl-btn {
  background: rgba(255, 255, 255, 0.12);
  border: none; border-radius: 10px;
  color: #fff; cursor: pointer;
  width: 44px; height: 44px;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s;
  -webkit-tap-highlight-color: transparent;
}
.ctl-btn:hover { background: rgba(255, 255, 255, 0.22); }
.ctl-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.ctl-btn.is-active { color: var(--accent); background: rgba(56, 189, 248, 0.2); }

.opacity-control {
  display: flex; align-items: center; gap: 7px;
  height: 40px; padding: 0 10px;
  background: rgba(255, 255, 255, 0.08); border-radius: 12px;
  color: #fff; font-size: 11px; font-weight: 600;
}
.opacity-control input { width: 78px; accent-color: var(--accent); cursor: pointer; }
.opacity-control output { width: 34px; font-family: Consolas, monospace; font-size: 11px; }

.zoom-group {
  display: flex; align-items: center; gap: 4px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 2px;
}
.zoom-group .ctl-btn { width: 40px; height: 40px; background: transparent; }
.zoom-group .ctl-btn:hover { background: rgba(255, 255, 255, 0.15); }
.zoom-label {
  background: transparent; border: none;
  color: #fff; cursor: pointer;
  font-family: Consolas, monospace;
  font-size: 12.5px; font-weight: 700;
  min-width: 46px; text-align: center;
  padding: 0 2px;
  -webkit-tap-highlight-color: transparent;
}
.zoom-label:hover { color: var(--accent); }

/* ---------- mobile ---------- */
@media (max-width: 640px) {
  .topbar { padding: 8px 12px; }
  .brand-sm h1 { font-size: 16px; }
  .badge-stats { font-size: 10.5px; padding: 5px 8px; }
  .stage { padding: 8px; }
  .player { border-radius: 10px; }
  .overlay-title { font-size: 16px; }
  .overlay-sub { font-size: 12px; }
  .radar-spin { width: 70px; height: 70px; }
  .ctl-btn { width: 48px; height: 48px; }
  .opacity-control { height: 48px; padding: 0 8px; }
  .opacity-control span { display: none; }
  .opacity-control input { width: 62px; }
  .login-card { padding: 32px 22px 26px; }
}

/* landscape phones: hide chrome, maximize player */
@media (max-height: 480px) and (orientation: landscape) {
  .topbar { display: none; }
  .stage { padding: 0; }
  .player { border-radius: 0; border: none; max-width: none; height: 100%; aspect-ratio: auto; }
}
