:root {
  --bg: #0b0f17;
  --panel: #121826;
  --panel-2: #182033;
  --line: #243049;
  --ink: #e8edf6;
  --muted: #8d9ab3;
  --blue: #2f80ed;
  --blue-2: #5aa2ff;
  --live: #ff3b4e;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.55 "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}
a { color: var(--blue-2); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }

/* Header */
.top { position: sticky; top: 0; z-index: 20; background: rgba(11, 15, 23, .88); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top .wrap { display: flex; align-items: center; gap: 16px; height: 62px; }
.logo { display: inline-flex; align-items: center; gap: 2px; font-weight: 800; font-size: 22px; letter-spacing: -.02em; color: var(--ink); }
.logo:hover { text-decoration: none; }
.logo .bubble { position: relative; background: var(--blue); color: #fff; padding: 1px 10px 3px; border-radius: 999px; margin-left: 3px; }
.logo .bubble::after { content: ""; position: absolute; left: 8px; bottom: -6px; border: 7px solid transparent; border-top-color: var(--blue); border-bottom: 0; transform: skewX(20deg); }
.nav { display: flex; gap: 4px; margin-left: auto; align-items: center; }
.nav a { color: var(--muted); padding: 8px 10px; border-radius: 8px; font-size: 15px; }
.nav a:hover { color: var(--ink); background: var(--panel); text-decoration: none; }
.btn { display: inline-flex; align-items: center; gap: 8px; border: 0; cursor: pointer; font: inherit; font-weight: 700;
  padding: 10px 16px; border-radius: 10px; background: var(--blue); color: #fff; text-decoration: none; white-space: nowrap; }
.btn:hover { background: #2a72d4; text-decoration: none; }
.btn.ghost { background: var(--panel-2); color: var(--ink); border: 1px solid var(--line); }
.btn.ghost:hover { background: #1d2740; }
.btn.big { padding: 14px 22px; font-size: 18px; border-radius: 12px; }
.dice { font-size: 1.1em; line-height: 1; }

/* Hero */
.hero { padding: 48px 0 24px; display: grid; grid-template-columns: 1.05fr 1fr; gap: 32px; align-items: center; }
.hero h1 { font-size: clamp(32px, 5vw, 54px); line-height: 1.05; margin: 0 0 14px; letter-spacing: -.03em; }
.hero h1 em { font-style: normal; color: var(--blue-2); }
.hero p { color: var(--muted); font-size: 18px; margin: 0 0 24px; max-width: 34em; }
.hero .actions { display: flex; flex-wrap: wrap; gap: 10px; }
.stats { display: flex; gap: 22px; margin-top: 22px; color: var(--muted); font-size: 14px; }
.stats b { display: block; color: var(--ink); font-size: 22px; }

/* Player */
.player { position: relative; aspect-ratio: 16 / 9; background: #000; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); border: 1px solid var(--line); }
.player iframe, .player img { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; object-fit: cover; }
.player img.contain { object-fit: contain; background: #000; }
.pill { position: absolute; top: 12px; left: 12px; z-index: 2; display: inline-flex; align-items: center; gap: 6px; background: rgba(0, 0, 0, .65);
  color: #fff; font-size: 12px; font-weight: 800; letter-spacing: .06em; padding: 4px 9px; border-radius: 999px; }
.pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--live); box-shadow: 0 0 0 0 rgba(255, 59, 78, .7); animation: pulse 1.8s infinite; }
.pill.snap .dot { background: #f5b301; animation: none; }
@keyframes pulse { 70% { box-shadow: 0 0 0 8px rgba(255, 59, 78, 0); } 100% { box-shadow: 0 0 0 0 rgba(255, 59, 78, 0); } }
.player .clock { position: absolute; top: 12px; right: 12px; z-index: 2; background: rgba(0, 0, 0, .65); color: #fff; font-size: 13px; font-weight: 600; padding: 4px 9px; border-radius: 999px; }

/* Filters + grid */
.section-head { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin: 36px 0 14px; flex-wrap: wrap; }
.section-head h2 { margin: 0; font-size: 24px; letter-spacing: -.01em; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--panel); color: var(--muted); padding: 7px 12px; border-radius: 999px; font: inherit; font-size: 14px; cursor: pointer; }
.chip:hover { color: var(--ink); text-decoration: none; }
.chip.on { background: var(--blue); border-color: var(--blue); color: #fff; }
.search { flex: 1 1 220px; max-width: 320px; background: var(--panel); border: 1px solid var(--line); color: var(--ink); border-radius: 10px; padding: 9px 12px; font: inherit; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; color: var(--ink); transition: transform .15s, border-color .15s; }
.card:hover { transform: translateY(-3px); border-color: #34446a; text-decoration: none; }
.card .thumb { position: relative; aspect-ratio: 16 / 9; background: #05070b; }
.card .thumb img { width: 100%; height: 100%; object-fit: cover; }
.card .thumb .pill { top: 8px; left: 8px; font-size: 11px; }
.card .meta { padding: 10px 12px 12px; }
.card .meta b { display: block; font-size: 15px; line-height: 1.3; }
.card .meta span { color: var(--muted); font-size: 13px; }
.empty { color: var(--muted); padding: 30px 0; }

/* Cam page */
.cam { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; padding: 24px 0 8px; }
.cam h1 { font-size: clamp(24px, 3.4vw, 34px); margin: 16px 0 4px; letter-spacing: -.02em; line-height: 1.15; }
.cam .where { color: var(--muted); margin: 0 0 14px; }
.cam .controls { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0; }
.cam .about { color: #c5cede; max-width: 46em; }
.side { display: flex; flex-direction: column; gap: 16px; }
.box { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.box h3 { margin: 0 0 10px; font-size: 15px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .06em; }
.facts { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.mini { display: flex; gap: 10px; align-items: center; color: var(--ink); padding: 6px 0; }
.mini:hover { text-decoration: none; color: var(--blue-2); }
.mini img { width: 84px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 8px; flex: none; background: #05070b; }
.mini span { font-size: 14px; line-height: 1.3; }
.credit { font-size: 13px; color: var(--muted); }

/* Page text */
.page { max-width: 760px; padding: 36px 0; }
.page h1 { font-size: 36px; letter-spacing: -.02em; margin: 0 0 12px; }
.page p, .page li { color: #c5cede; }

footer { border-top: 1px solid var(--line); margin-top: 48px; padding: 24px 0 40px; color: var(--muted); font-size: 14px; }
footer .wrap { display: flex; gap: 16px; flex-wrap: wrap; justify-content: space-between; }
footer a { color: var(--muted); }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; padding-top: 28px; }
  .cam { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .nav a.hide-sm { display: none; }
  .top .btn { padding: 8px 12px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 12px; }
  .card .meta b { font-size: 14px; }
}

/* --- polish pass --- */
.controls-top { margin: 0 0 14px; align-items: center; }
.kbd-hint { color: var(--muted); font-size: 13px; margin-left: auto; }
.kbd-hint kbd { background: var(--panel-2); border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; font: inherit; font-size: 12px; }
@media (max-width: 720px) { .kbd-hint { display: none; } .controls-top .btn { flex: 1; justify-content: center; } }

.hero-player img { transition: opacity .25s ease; }
.hero-cap { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; padding: 22px 14px 12px; font-weight: 700; color: #fff;
  background: linear-gradient(to top, rgba(0,0,0,.72), rgba(0,0,0,0)); font-size: 15px; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tile { display: flex; align-items: center; justify-content: space-between; gap: 8px; background: var(--panel); border: 1px solid var(--line);
  border-radius: 10px; padding: 12px 14px; color: var(--ink); }
.tile:hover { border-color: #34446a; background: var(--panel-2); text-decoration: none; }
.tile b { font-weight: 600; font-size: 14px; }
.tile span { color: var(--muted); font-size: 13px; background: var(--bg); border-radius: 999px; padding: 1px 8px; }

/* --- channel surf --- */
#surfbar { position: fixed; top: 0; left: 0; right: 0; height: 4px; background: rgba(255,255,255,.08); z-index: 60; display: none; }
#surfbar.on { display: block; }
#surfbar > span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--blue), var(--live)); box-shadow: 0 0 12px var(--blue); }
.btn.on, .btn.ghost.on { background: var(--live); color: #fff; border-color: var(--live); }
.btn.on::before { content: ""; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: #fff; margin-right: 2px; animation: pulse 1.6s infinite; }

/* --- mobile header fit --- */
html, body { overflow-x: hidden; max-width: 100%; }
@media (max-width: 560px) {
  .top .wrap { gap: 8px; height: 56px; }
  .logo { font-size: 18px; }
  .logo .bubble { padding: 1px 7px 3px; }
  .nav { gap: 2px; }
  .nav a:not(.btn) { display: none; }      /* Browse/About reachable via hero + tiles */
  .nav .btn { padding: 8px 12px; font-size: 14px; }
}

/* --- auto surf speed --- */
.surf-speed { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); font-size: 13px; }
.surf-speed em { font-style: normal; margin-right: 2px; }
.surf-speed button { background: var(--panel-2); border: 1px solid var(--line); color: var(--muted); border-radius: 7px; padding: 5px 9px; font: inherit; font-size: 13px; cursor: pointer; }
.surf-speed button:hover { color: var(--ink); }
.surf-speed button.on { background: var(--blue); border-color: var(--blue); color: #fff; }

/* --- cam actions: save / fullscreen / share --- */
.cam-actions { display: flex; gap: 8px; margin: 12px 0 4px; flex-wrap: wrap; }
.iconbtn { background: var(--panel); border: 1px solid var(--line); color: var(--muted); border-radius: 9px;
  padding: 8px 14px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; }
.iconbtn:hover { color: var(--ink); background: var(--panel-2); }
.iconbtn.on { color: #ff6b7d; border-color: #ff6b7d33; background: #ff3b4e14; }
.player:fullscreen { aspect-ratio: auto; }
.player:fullscreen iframe, .player:fullscreen img { object-fit: contain; }

/* --- thrills / smart / map --- */
.iconbtn.sm { padding: 6px 10px; font-size: 13px; }
.iconbtn.sm.on { color: #ffd27d; border-color: #ffd27d44; background: #f5b30114; }
.muted-h { color: var(--muted); font-weight: 400; font-size: .7em; }
#map { height: 70vh; min-height: 420px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: #0b0f17; }
.leaflet-popup-content-wrapper, .leaflet-popup-tip { background: #121826; color: var(--ink); }

/* Darken keyless OSM tiles to match the theme (markers/popups are not .leaflet-tile, so unaffected) */
.leaflet-tile-pane { filter: invert(1) hue-rotate(180deg) brightness(.92) contrast(.9) !important; }

.surf-speed[hidden] { display: none !important; }

.localtime { color: var(--muted); }

/* --- retro TV-static channel flip --- */
#tvstatic { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 200; display: none; background: #000; image-rendering: pixelated; }
#tvch { position: fixed; right: 22px; top: 18px; z-index: 201; display: none; font: 800 22px/1 'Courier New', monospace; color: #9bff9b; text-shadow: 0 0 8px rgba(100,255,120,.7); letter-spacing: 3px; }

#minimap { height: 180px; border-radius: 10px; overflow: hidden; }

/* --- The Wall --- */
.wall { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.wtile { position: relative; aspect-ratio: 16/9; background: #000; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; display: block; }
.wtile iframe, .wtile img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; border: 0; }
.wtile .wlabel { position: absolute; left: 0; right: 0; bottom: 0; padding: 16px 8px 6px; font-size: 12px; font-weight: 600; color: #fff; background: linear-gradient(to top, rgba(0,0,0,.8), transparent); text-decoration: none; z-index: 2; }
a.wlabel:hover { text-decoration: underline; }
@media (max-width: 820px) { .wall { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 480px) { .wall { grid-template-columns: 1fr; } }

.wcover { position: absolute; inset: 0; z-index: 1; }
.wtile .wlabel { pointer-events: none; }
.wtile:hover .wcover { box-shadow: inset 0 0 0 2px var(--blue-2); }

.cotd { display: flex; gap: 14px; align-items: center; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; margin: 16px 0 4px; color: var(--ink); text-decoration: none; }
.cotd:hover { border-color: #34446a; }
.cotd img { width: 200px; height: 112px; object-fit: cover; flex: none; background: #05070b; }
.cotd-text { padding: 8px 14px; }
.cotd-badge { display: inline-block; background: #f5b3011f; color: #f5b301; font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; margin-bottom: 6px; }
.cotd-text b { display: block; font-size: 18px; letter-spacing: -.01em; }
.cotd-text span { color: var(--muted); font-size: 14px; }
@media (max-width: 560px) { .cotd img { width: 128px; height: 82px; } .cotd-text b { font-size: 15px; } }
select.search option { background: var(--panel); }

/* --- Wall ambient (fullscreen) mode --- */
body.ambient { overflow: hidden; }
body.ambient .top, body.ambient footer, body.ambient .section-head, body.ambient main > p { display: none !important; }
body.ambient main { max-width: none; margin: 0; padding: 0; }
body.ambient .wall { gap: 2px; height: 100vh; grid-auto-rows: 1fr; margin: 0; }
body.ambient .wtile { aspect-ratio: auto; border: 0; border-radius: 0; }
