
  :root {
    --bg: #02050a;
    --surface: #0d1430;
    --card: #14204a;
    --border: #2f47a1;

    --accent: #3157ff;
    --accent2: #8ea2ff;

    --text: #f4f7ff;
    --muted: #b3c0ff;
    --live: #ff4d4d;
  }

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

  body {
    background: var(--bg);
    color: white;
    font-family: 'DM Sans', sans-serif;
    min-height: 100vh;
    overflow-x: hidden;
  }

  body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
      radial-gradient(ellipse 80% 50% at 50% 0%, rgba(0,100,180,0.12) 0%, transparent 70%),
      radial-gradient(ellipse 40% 30% at 80% 80%, rgba(0,196,255,0.06) 0%, transparent 60%);
    pointer-events: none;
    z-index: 0;
  }

  
  header.app-header {
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    border-bottom: 1px solid rgba(0, 140, 255, 0.18);
    background:
      linear-gradient(
        180deg,
        #021233 0%,
        #000814 100%
      );
    backdrop-filter: blur(12px);
  }

  .header-left {
    display: flex;
    align-items: center;
    gap: 18px;
    min-width: 0;
  }

  .header-logo {
    width: 210px;
    max-width: 32vw;
    height: auto;
    object-fit: contain;
    flex-shrink: 0;
    filter:
      drop-shadow(0 0 10px rgba(0, 170, 255, 0.18))
      drop-shadow(0 0 18px rgba(0, 120, 255, 0.12));
  }

  .header-text {
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  .header-title {
    margin: 0;
    font-size: 1.9rem;
    font-weight: 400;
    line-height: 1.1;
    letter-spacing: 1.8px;
    color: #ffffff;
    text-shadow:
      0 0 8px rgba(0,196,255,0.10),
      0 0 1px rgba(255,255,255,0.10);
    font-family: 'DM Sans', sans-serif;
  }

  .header-subtitle {
    margin-top: 6px;
    color: white;
    font-size: 1rem;
    letter-spacing: 1px;
  }

  .header-controls { display: flex; align-items: center; gap: 12px; }

  @media (max-width: 768px) {
    header.app-header {
      padding: 14px 16px;
    }

    .header-logo {
      width: 140px;
    }

    .header-title {
      font-size: 1.3rem;
    }

    .header-subtitle {
      font-size: 0.9rem;
    }
  }


  #castBtn {
    background: var(--accent);
    border: 1px solid var(--accent);
    color: white;
    padding: 10px 18px;
    border-radius: 10px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: all 0.2s;
    font-size: 15px;
    font-weight: 700;
    min-height: 44px;
  }

  #castBtn svg {
    flex-shrink: 0;
  }
  #castBtn:hover { border-color: white; color: white; }
  #castBtn.casting { border-color: white; color: white; background: rgba(0,196,255,0.1); }

  main {
    position: relative;
    z-index: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px 20px;
  }

  .player-section {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 20px;
    margin-bottom: 24px;
  }

  @media (max-width: 900px) {
    .player-section {
      grid-template-columns: 1fr;
    }

    .sidebar {
      display: flex;
      margin-top: 12px;
      max-height: 260px;
      overflow: hidden;
      background: rgba(13,20,48,0.92);
      border: 1px solid var(--border);
      border-radius: 14px;
      padding: 12px;
    }

  
  .cam-search-wrap {
    padding: 6px 4px 10px;
  }

  .cam-search {
    width: 100%;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    color: white;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 13px;
    outline: none;
    transition: all 0.18s ease;
  }

  .cam-search:focus {
    border-color: white;
    box-shadow: 0 0 0 2px rgba(63,99,255,0.15);
  }

  .cam-search::placeholder {
    color: white;
  }


  .cam-list {
      max-height: 220px;
      width: 100%;
      overflow-y: auto;
      display: flex;
      flex-direction: column;
      gap: 2px;
    }
  }

  .player-wrap {
    background: #000;
    border-radius: 14px;
    overflow: hidden;
    border: 1px solid var(--border);
    position: relative;
  }

  .player-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: rgba(13,20,48,0.92);
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 8px;
  }

  .cam-label { display: flex; align-items: center; gap: 10px; min-width: 0; }

  .live-dot {
    width: 8px; height: 8px; flex-shrink: 0;
    background: var(--live);
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
  }

  @keyframes pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(0.8); }
  }

  .cam-name {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 17px;
    letter-spacing: 1px;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .cam-index { font-size: 11px; color: white; font-weight: 300; flex-shrink: 0; }

  .player-actions { display: flex; gap: 8px; flex-wrap: wrap; }

  .btn {
    background: var(--card);
    border: 1px solid var(--border);
    color: white;
    padding: 7px 14px;
    border-radius: 7px;
    font-family: 'DM Sans', sans-serif;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    display: flex; align-items: center; gap: 6px;
    white-space: nowrap;
  }
  .btn:hover { border-color: white; color: white; }
  .btn.active { background: rgba(0,196,255,0.15); border-color: white; color: white; }
  .btn.accent { background: var(--accent); color: white; border-color: white; font-weight: 700; }
  .btn.accent:hover { background: #00e0ff; }
  .btn.danger { background: rgba(255,59,59,0.15); border-color: white; color: white; }

  .player-frame {
    position: relative;
    width: 100%;
    padding-top: 56.25%;
    background: #000;
  }

  #twitchFrame {
    position: absolute;
    inset: 0;
    width: 100%; height: 100%;
    border: none;
  }

  .player-footer {
    padding: 10px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(13,20,48,0.92);
    border-top: 1px solid var(--border);
    gap: 10px;
  }

  .nav-controls { display: flex; gap: 8px; align-items: center; }

  .nav-btn {
    background: var(--card);
    border: 1px solid var(--border);
    color: white;
    width: 36px; height: 36px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 16px;
    display: flex; align-items: center; justify-content: center;
    transition: all 0.2s;
  }
  .nav-btn:hover { border-color: white; color: white; }

  .timer-bar-wrap {
    flex: 1;
    height: 3px;
    background: var(--border);
    border-radius: 2px;
    overflow: hidden;
  }

  #timerBar {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    width: 0%;
    border-radius: 2px;
  }

  .auto-cycle-label { font-size: 11px; color: white; white-space: nowrap; }

  /* ── Sidebar ── */
  .sidebar {
    display: flex;
    flex-direction: column;
    gap: 4px;
    background: rgba(13,20,48,0.7);
    border-radius: 14px;
    padding: 10px;
    border: 1px solid var(--border);
  }

  .sidebar-header {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 14px;
    letter-spacing: 2px;
    color: white;
    padding: 0 4px 8px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px;
  }


  .cam-search-wrap {
    padding: 6px 4px 10px;
  }

  .cam-search {
    width: 100%;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--border);
    color: white;
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 13px;
    outline: none;
    transition: all 0.18s ease;
  }

  .cam-search:focus {
    border-color: white;
    box-shadow: 0 0 0 2px rgba(63,99,255,0.15);
  }

  .cam-search::placeholder {
    color: white;
  }


  .cam-list {
    overflow-y: auto;
    max-height: calc(100vh - 260px);
    padding-right: 4px;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
  .cam-list::-webkit-scrollbar { width: 4px; }
  .cam-list::-webkit-scrollbar-track { background: transparent; }
  .cam-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

  .cam-item {
    padding: 8px 10px;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid transparent;
    transition: all 0.15s;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .cam-item:hover { background: rgba(49,87,255,0.18); border-color: white; }
  .cam-item.active { background: rgba(49,87,255,0.25); border-color: white; }

   .cam-item-switch {
    position: relative;
    width: 36px;
    height: 20px;
    border-radius: 999px;
    background: rgba(255,255,255,0.08);
    border: 1px solid var(--border);
    flex-shrink: 0;
    transition: all 0.18s ease;
  }

  .cam-item-switch::after {
    content: '';
    position: absolute;
    top: 1px;
    left: 1px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(255,255,255,0.8);
    transition: all 0.18s ease;
  }

  .cam-item.in-cycle .cam-item-switch {
    background: rgba(49,87,255,0.45);
    border-color: white;
    box-shadow: 0 0 10px rgba(49,87,255,0.25);
  }

  .cam-item.in-cycle .cam-item-switch::after {
    left: 17px;
    background: #fff;
  }

  .cam-item-num { font-size: 10px; color: white; width: 18px; text-align: right; flex-shrink: 0; }

  .cam-item-name { font-size: 12px; font-weight: 500; line-height: 1.3; flex: 1; }
  .cam-item.active .cam-item-name { color: white; }
  .cam-item-sub { font-size: 10px; color: white; font-weight: 300; }

  /* ── Cycle Settings Panel ── */
  .cycle-panel {
    background: rgba(13,20,48,0.92);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px;
    margin-bottom: 24px;
  }

  .cycle-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    flex-wrap: wrap;
    gap: 10px;
  }

  .panel-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 18px;
    letter-spacing: 2px;
    color: white;
  }

  .panel-title span { color: white; }

  .cycle-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
  }

  .time-input-wrap {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 16px;
    width: 100%;
    justify-content: space-between;
  }

  .time-input-wrap label {
    font-size: 11px;
    color: white;
    white-space: nowrap;
  }

  .time-slider {
    -webkit-appearance: none;
    appearance: none;
    flex: 1;
    width: 100%;
    min-width: 140px;
    height: 6px;
    background: var(--border);
    border-radius: 4px;
    outline: none;
  }
  .time-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px; height: 16px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    box-shadow: 0 0 6px rgba(0,196,255,0.5);
  }

  .time-display {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 18px;
    color: white;
    min-width: 52px;
    text-align: center;
  }

  .cycle-queue-label {
    font-size: 11px;
    color: white;
    margin-bottom: 10px;
  }

  .cycle-queue-label span { color: white; font-weight: 600; }

  /* Quick-select venue buttons */
  .venue-filters {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 14px;
  }

  .venue-tag {
    background: var(--card);
    border: 1px solid var(--border);
    color: white;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
  }
  .venue-tag:hover { border-color: white; color: white; }
  .venue-tag.all-on { background: rgba(0,196,255,0.15); border-color: white; color: white; }

  /* Cam selection grid inside panel */
  .cam-select-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 6px;
    max-height: 320px;
    overflow-y: auto;
    padding-right: 4px;
  }
  .cam-select-grid::-webkit-scrollbar { width: 4px; }
  .cam-select-grid::-webkit-scrollbar-track { background: transparent; }
  .cam-select-grid::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

  .cam-select-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s;
    user-select: none;
  }
  .cam-select-item:hover { border-color: white; }
  .cam-select-item.selected {
    border-color: white;
    background: rgba(0,196,255,0.08);
  }

  .cam-select-check {
    width: 18px; height: 18px; flex-shrink: 0;
    border: 1.5px solid var(--border);
    border-radius: 4px;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px;
    transition: all 0.15s;
  }
  .cam-select-item.selected .cam-select-check {
    background: var(--accent);
    border-color: white;
    color: white;
  }

  .cam-select-text { flex: 1; min-width: 0; }
  .cam-select-venue { font-size: 10px; color: white; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
  .cam-select-name { font-size: 12px; color: white; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }


  @media (max-width: 768px) {
    .cycle-controls {
      flex-direction: column;
      align-items: stretch;
    }

    .time-input-wrap {
      order: -1;
    }

    .btn {
      justify-content: center;
    }
  }


  /* ── Bottom grid ── */
  .cam-grid-section { margin-top: 8px; }

  .section-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 16px;
    letter-spacing: 2px;
    color: white;
    margin-bottom: 14px;
  }

  .cam-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 10px;
  }

  .cam-card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex; flex-direction: column; gap: 3px;
    position: relative;
  }
  .cam-card:hover { border-color: white; transform: translateY(-2px); }
  .cam-card.active { border-color: white; background: rgba(0,196,255,0.07); }
  .cam-card.in-cycle::after {
    content: '✓';
    position: absolute;
    top: 6px; right: 8px;
    font-size: 10px;
    color: white;
  }

  .cam-card-venue { font-size: 10px; font-weight: 500; text-transform: uppercase; letter-spacing: 1px; color: white; }
  .cam-card-name { font-size: 12px; font-weight: 500; color: white; line-height: 1.3; }
  .cam-card-ch { font-size: 10px; color: white; margin-top: 2px; }

  /* Cast overlay */
  #castOverlay {
    display: none;
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.85);
    align-items: center; justify-content: center; flex-direction: column;
    gap: 12px; z-index: 20;
  }
  #castOverlay.visible { display: flex; }
  .cast-icon { font-size: 48px; }
  .cast-text { font-family: 'Bebas Neue', sans-serif; font-size: 18px; letter-spacing: 2px; color: white; }
  .cast-sub { font-size: 13px; color: white; }

  /* Toast */
  #toast {
    position: fixed;
    bottom: 24px; left: 50%;
    transform: translateX(-50%) translateY(80px);
    background: rgba(13,20,48,0.92);
    border: 1px solid var(--accent);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 13px;
    transition: transform 0.3s ease;
    z-index: 100;
    pointer-events: none;
  }
  #toast.show { transform: translateX(-50%) translateY(0); }

  


  
  /* ── Lake Conditions ── */
  .lake-status {
    margin-top: 22px;
  }

  .lake-card.unified {
    background: linear-gradient(180deg, rgba(13,20,48,0.96), rgba(8,12,28,0.98));
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 18px 22px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.28);
    overflow: hidden;
    position: relative;
  }

  .lake-card.unified::before {
    content: '';
    position: absolute;
    inset: 0;
    background:
      radial-gradient(circle at top right, rgba(90,130,255,0.14), transparent 55%);
    pointer-events: none;
  }

  .lake-card-title {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 18px;
    letter-spacing: 1.5px;
    color: white;
    margin-bottom: 16px;
  }

  .lake-stats {
    display: grid;
    grid-template-columns: repeat(5, minmax(90px, 1fr));
    gap: 14px;
  }

  .lake-stat {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 14px;
    padding: 14px;
    text-align: center;
    backdrop-filter: blur(8px);
  }

  .lake-stat-label {
    font-size: 11px;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: white;
    margin-bottom: 8px;
  }

  .lake-stat-value {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 28px;
    letter-spacing: 1px;
    color: white;
  }

  
  @media (max-width: 700px) {
    .lake-stats {
      grid-template-columns: repeat(2, 1fr);
      gap: 10px;
    }

    .lake-stat:last-child {
      grid-column: span 2;
    }

    .lake-stat {
      min-height: 92px;
      display: flex;
      flex-direction: column;
      justify-content: center;
    }

    .lake-stat-value {
      font-size: 22px;
    }
  }




  .trend-up {
    color: white;
  }

  .trend-down {
    color: white;
  }

  .trend-flat {
    color: white;
  }


  .cam-search-container {
    position: relative;
  }

  .clear-search-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    border: none;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    color: white;
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    line-height: 1;
    transition: all 0.18s ease;
  }

  .clear-search-btn:hover {
    background: rgba(255,255,255,0.14);
    color: white;
  }


  .sidebar-header.panel-title,
  .lake-card-title.panel-title {
    font-size: 18px;
    letter-spacing: 2px;
    color: white;
    margin-bottom: 12px;
  }

  .sidebar-header.panel-title span {
    color: white;
  }


  
  /* ── Main Tabs ── */
  .main-tabs {
    display: flex;
    gap: 24px;
    margin-bottom: 20px;
    padding: 0 6px 10px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
  }

  .main-tab {
    position: relative;
    background: transparent;
    border: none;
    color: white;
    padding: 2px 0 12px;
    cursor: pointer;
    transition: all 0.18s ease;
    font-family: 'Bebas Neue', sans-serif;
    font-size: 20px;
    letter-spacing: 1.5px;
  }

  .main-tab::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 100%;
    height: 2px;
    background: #3f63ff;
    transform: scaleX(0);
    transform-origin: center;
    transition: transform 0.18s ease;
  }

  .main-tab:hover {
    color: white;
  }

  .main-tab.active {
    color: white;
  }

  .main-tab.active::after {
    transform: scaleX(1);
  }

  .tab-panel {
    display: none;
  }

  .tab-panel.active {
    display: block;
  }

  .map-shell {
    background: rgba(13,20,48,0.92);
    border: 1px solid var(--border);
    border-radius: 18px;
    overflow: hidden;
    min-height: 75vh;
  }

  .map-header {
    padding: 18px 22px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
    background: rgba(255,255,255,0.02);
  }

  .map-subtitle {
    color: white;
    font-size: 13px;
    margin-top: 6px;
  }

  .map-frame {
    width: 100%;
    height: 78vh;
    border: none;
    display: block;
  }



.leaflet-container {
  background: #0b1226;
}

.leaflet-container img,
.leaflet-tile {
  max-width: none !important;
}

.leaflet-control-container .leaflet-control {
  z-index: 800;
}


.locate-btn {
  background: rgba(13,20,48,0.92);
  border: 1px solid rgba(255,255,255,0.12);
  width: 42px;
  height: 42px;
  border-radius: 12px;
  color: white;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.28);
  transition: all 0.18s ease;
}

.locate-btn:hover {
  border-color: white;
  color: white;
}

.locate-btn svg {
  width:20px;
  height:20px;
}


.place-list-wrap {
  margin-top: 18px;
  padding: 18px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.place-list-title {
  font-family: 'Bebas Neue', sans-serif;
  letter-spacing: 1px;
  font-size: 22px;
  margin-bottom: 14px;
  color: white;
}

.place-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 10px;
}

.place-item {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.place-item:hover {
  border-color: white;
  background: rgba(63,99,255,0.14);
}

.place-name {
  font-weight: 700;
  color: white;
  font-size: 14px;
}

.place-desc {
  margin-top: 6px;
  color: white;
  font-size: 12px;
  line-height: 1.35;
}




.toolbar {
  display:flex;
  gap:10px;
  margin-bottom:14px;
  flex-wrap:wrap;
  padding:16px 16px 0;
}

.filter-btn {
  background: rgba(255,255,255,0.05);
  color: white;
  border:1px solid rgba(255,255,255,0.1);
  border-radius:999px;
  padding:10px 16px;
  cursor:pointer;
  font-weight:600;
}

.filter-btn.active {
  background: rgba(63,99,255,0.25);
  border-color: white;
}

#lakeMap {
  width:100%;
  height:78vh;
}

.leaflet-popup-content-wrapper {
  background:#101933;
  color: white;
  border-radius:14px;
}

.leaflet-popup-tip {
  background:#101933;
}
