:root {
      --bg-dark: #070a10;
      --bg-card: #0d121c;
      --bg-card-hover: #131b2a;
      --border-subtle: rgba(255, 255, 255, 0.08);
      --border-focus: rgba(0, 229, 255, 0.35);
      --accent-cyan: #00e5ff;
      --accent-green: #00e676;
      --accent-red: #ff1744;
      --accent-gold: #ffd600;
      --text-main: #f8fafc;
      --text-muted: #94a3b8;
      --text-dim: #64748b;
      --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
      --font-display: 'Chakra Petch', 'Inter', sans-serif;
      --font-mono: 'JetBrains Mono', monospace;
    }

    * {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
      -webkit-tap-highlight-color: transparent;
    }

    html, body {
      width: 100%;
      max-width: 100%;
      overflow-x: hidden;
    }

    body {
      background-color: var(--bg-dark);
      color: var(--text-main);
      font-family: var(--font-main);
      min-height: 100vh;
      min-height: 100dvh;
      display: flex;
      flex-direction: column;
      position: relative;
    }

    /* Ambient Trackday Glow */
    body::before {
      content: '';
      position: fixed;
      top: -20%;
      left: 50%;
      transform: translateX(-50%);
      width: min(600px, 100vw);
      height: 400px;
      background: radial-gradient(circle, rgba(0, 229, 255, 0.08) 0%, rgba(7, 10, 16, 0) 70%);
      z-index: 0;
      pointer-events: none;
    }

    /* Live Header Bar */
    .live-header {
      position: sticky;
      top: 0;
      z-index: 100;
      background: rgba(7, 10, 16, 0.88);
      backdrop-filter: blur(14px);
      -webkit-backdrop-filter: blur(14px);
      border-bottom: 1px solid var(--border-subtle);
      padding: calc(0.6rem + env(safe-area-inset-top, 0px)) 1rem 0.6rem;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 0.5rem;
      width: 100%;
      max-width: 100%;
    }

    .brand-wrap {
      display: flex;
      align-items: center;
      gap: 0.45rem;
      text-decoration: none;
      color: inherit;
      min-width: 0;
      flex-shrink: 1;
    }

    .brand-icon {
      font-size: 1.2rem;
    }

    .brand-text {
      font-family: var(--font-display);
      font-weight: 800;
      font-size: 1.05rem;
      letter-spacing: 0.02em;
      color: #fff;
    }

    .brand-live-badge {
      font-size: 0.72rem;
      font-weight: 800;
      padding: 0.15rem 0.45rem;
      border-radius: 9999px;
      background: rgba(255, 23, 68, 0.2);
      border: 1px solid var(--accent-red);
      color: var(--accent-red);
      text-transform: uppercase;
      letter-spacing: 0.05em;
      display: inline-flex;
      align-items: center;
      gap: 0.3rem;
    }

    .live-dot-pulse {
      width: 6px;
      height: 6px;
      border-radius: 50%;
      background-color: var(--accent-red);
      box-shadow: 0 0 8px var(--accent-red);
      animation: pulse-dot 1.4s infinite ease-in-out;
    }

    @keyframes pulse-dot {
      0% { transform: scale(0.9); opacity: 0.7; }
      50% { transform: scale(1.3); opacity: 1; }
      100% { transform: scale(0.9); opacity: 0.7; }
    }

    .header-controls {
      display: flex;
      align-items: center;
      gap: 0.45rem;
      flex-shrink: 0;
    }

    .close-live-btn,
    .close-rc-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 0.3rem;
      height: 32px;
      padding: 0 0.65rem;
      border-radius: 8px;
      background: rgba(255, 23, 68, 0.12);
      border: 1px solid rgba(255, 23, 68, 0.35);
      color: var(--accent-red);
      font-family: var(--font-display);
      font-size: 0.74rem;
      font-weight: 800;
      letter-spacing: 0.04em;
      cursor: pointer;
      transition: all 0.2s ease;
      text-decoration: none;
      white-space: nowrap;
      flex-shrink: 0;
    }

    .close-live-btn:hover,
    .close-live-btn:active,
    .close-rc-btn:hover {
      background: rgba(255, 23, 68, 0.22);
      border-color: var(--accent-red);
      color: var(--accent-red);
    }

    html[data-theme="light"] .close-live-btn,
    html[data-theme="light"] .close-rc-btn {
      background: rgba(225, 29, 72, 0.12) !important;
      border: 1px solid rgba(225, 29, 72, 0.35) !important;
      color: #e11d48 !important;
    }

    html[data-theme="light"] .close-live-btn:hover,
    html[data-theme="light"] .close-live-btn:active,
    html[data-theme="light"] .close-rc-btn:hover {
      background: rgba(225, 29, 72, 0.22) !important;
      border-color: #e11d48 !important;
      color: #e11d48 !important;
    }

    .viewers-pill {
      display: inline-flex;
      align-items: center;
      gap: 0.35rem;
      font-size: 0.75rem;
      font-weight: 700;
      color: var(--text-muted);
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid var(--border-subtle);
      padding: 0.3rem 0.65rem;
      border-radius: 9999px;
    }

    .icon-btn {
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid var(--border-subtle);
      color: var(--text-main);
      width: 32px;
      height: 32px;
      border-radius: 8px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      transition: all 0.2s;
    }

    .icon-btn:hover {
      background: rgba(255, 255, 255, 0.12);
      border-color: var(--accent-cyan);
      color: var(--accent-cyan);
    }

    /* Main Container */
    .live-main {
      position: relative;
      z-index: 1;
      width: 100%;
      max-width: 960px;
      margin: 0 auto;
      padding: 0.85rem 1rem 7.5rem;
      display: flex;
      flex-direction: column;
      gap: 1rem;
    }

    /* Circuit & Driver Info Banner */
    .circuit-banner {
      background: var(--bg-card);
      border: 1px solid var(--border-subtle);
      border-radius: 14px;
      padding: 0.85rem 1.15rem;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 1rem;
      flex-wrap: wrap;
    }

    .circuit-info-left {
      display: flex;
      align-items: center;
      gap: 0.75rem;
    }

    .circuit-flag {
      font-size: 1.8rem;
      line-height: 1;
    }

    .circuit-name {
      font-family: var(--font-display);
      font-size: 1.15rem;
      font-weight: 800;
      color: #fff;
    }

    .circuit-layout-meta {
      font-size: 0.8rem;
      color: var(--text-muted);
      display: flex;
      align-items: center;
      gap: 0.4rem;
      margin-top: 0.15rem;
    }

    .driver-status-badge {
      display: inline-flex;
      align-items: center;
      gap: 0.4rem;
      padding: 0.35rem 0.75rem;
      border-radius: 9999px;
      font-size: 0.75rem;
      font-weight: 800;
      text-transform: uppercase;
      letter-spacing: 0.04em;
    }

    .driver-status-badge.on-track {
      background: rgba(0, 230, 118, 0.15);
      border: 1px solid var(--accent-green);
      color: var(--accent-green);
    }

    .driver-status-badge.standby {
      background: rgba(255, 214, 0, 0.15);
      border: 1px solid var(--accent-gold);
      color: var(--accent-gold);
    }

    .driver-status-badge.offline {
      background: rgba(148, 163, 184, 0.15);
      border: 1px solid var(--text-dim);
      color: var(--text-dim);
    }

    /* Primary Big Lap Timer Gauge Card */
    .timer-gauge-card {
      background: linear-gradient(180deg, #0e1524 0%, #080c14 100%);
      border: 1px solid var(--border-focus);
      border-radius: 16px;
      padding: 1.5rem 1.25rem;
      text-align: center;
      position: relative;
      overflow: hidden;
      min-height: 295px;
      box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    }

    .timer-top-pills {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 0.5rem;
    }

    .lap-num-pill {
      font-family: var(--font-display);
      font-size: 0.85rem;
      font-weight: 800;
      background: rgba(0, 229, 255, 0.15);
      border: 1px solid var(--accent-cyan);
      color: var(--accent-cyan);
      padding: 0.25rem 0.75rem;
      border-radius: 9999px;
      letter-spacing: 0.05em;
    }

    .pred-lap-pill {
      font-size: 0.75rem;
      color: var(--text-muted);
      font-weight: 700;
      display: flex;
      align-items: center;
      gap: 0.35rem;
    }

    .pred-lap-val {
      font-family: var(--font-mono);
      font-weight: 800;
      color: var(--accent-green);
    }

    /* Giant Digital Timer Display */
    .big-lap-time {
      font-family: var(--font-mono);
      font-size: clamp(3.3rem, 16.0vw, 4.8rem);
      font-weight: 800;
      letter-spacing: -0.02em;
      color: #ffffff;
      text-shadow: 0 0 25px rgba(0, 229, 255, 0.3);
      line-height: 1.1;
      margin: 0.25rem 0 0.85rem;
    }

    /* Predictive Split Delta Bar */
    .delta-section {
      width: 100%;
      max-width: 460px;
      margin: 0 auto;
    }

    .delta-scale-labels {
      display: flex;
      justify-content: space-between;
      font-size: 0.72rem;
      font-family: var(--font-mono);
      color: var(--text-dim);
      margin-bottom: 0.25rem;
    }

    .delta-bar-track {
      position: relative;
      height: 10px;
      background: rgba(255, 255, 255, 0.08);
      border-radius: 5px;
      overflow: hidden;
      display: flex;
    }

    .delta-bar-half {
      flex: 1;
      height: 100%;
      position: relative;
    }

    .delta-bar-gain-fill {
      position: absolute;
      right: 0;
      top: 0;
      height: 100%;
      width: 0%;
      background: var(--accent-green);
      box-shadow: 0 0 10px var(--accent-green);
      transition: width 0.1s linear;
    }

    .delta-bar-loss-fill {
      position: absolute;
      left: 0;
      top: 0;
      height: 100%;
      width: 0%;
      background: var(--accent-red);
      box-shadow: 0 0 10px var(--accent-red);
      transition: width 0.1s linear;
    }

    .delta-center-pin {
      position: absolute;
      left: 50%;
      top: 0;
      width: 2px;
      height: 100%;
      background: #ffffff;
      transform: translateX(-50%);
      z-index: 2;
    }

    .delta-numeric-badge {
      margin-top: 0.5rem;
      font-family: var(--font-mono);
      font-size: 1.05rem;
      font-weight: 800;
      color: var(--text-muted);
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 0.4rem;
    }

    .delta-numeric-badge.faster {
      color: var(--accent-green);
    }

    .delta-numeric-badge.slower {
      color: var(--accent-red);
    }

    /* Telemetry Stats Grid */
    .telemetry-grid {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 0.75rem;
    }

    .stat-card {
      background: var(--bg-card);
      border: 1px solid var(--border-subtle);
      border-radius: 12px;
      padding: 0.75rem 0.6rem;
      text-align: center;
    }

    .stat-label {
      font-size: 0.72rem;
      font-weight: 800;
      text-transform: uppercase;
      letter-spacing: 0.05em;
      color: var(--text-dim);
      margin-bottom: 0.2rem;
    }

    .stat-val {
      font-family: var(--font-mono);
      font-size: clamp(1.15rem, 3.5vw, 1.6rem);
      font-weight: 800;
      color: #fff;
    }

    .stat-sub {
      font-size: 0.72rem;
      color: var(--text-dim);
      margin-top: 0.15rem;
    }

    /* Live Vector Track Map */
    .map-card {
      background: var(--bg-card);
      border: 1px solid var(--border-subtle);
      border-radius: 14px;
      overflow: hidden;
      position: relative;
    }

    .map-header {
      padding: 0.6rem 1rem;
      display: flex;
      align-items: center;
      justify-content: space-between;
      border-bottom: 1px solid var(--border-subtle);
      background: rgba(0, 0, 0, 0.2);
    }

    .map-title {
      font-size: 0.75rem;
      font-weight: 700;
      color: var(--text-muted);
      text-transform: uppercase;
      letter-spacing: 0.05em;
      display: flex;
      align-items: center;
      gap: 0.35rem;
    }

    .map-canvas-container {
      position: relative;
      width: 100%;
      height: 320px;
      background: radial-gradient(circle at center, #0f1624 0%, #070a10 100%);
    }

    #live-circuit-canvas {
      width: 100%;
      height: 100%;
      display: block;
    }

    .map-speed-overlay {
      position: absolute;
      bottom: 12px;
      right: 12px;
      background: rgba(7, 10, 16, 0.85);
      border: 1px solid var(--border-subtle);
      backdrop-filter: blur(8px);
      padding: 0.3rem 0.65rem;
      border-radius: 8px;
      font-family: var(--font-mono);
      font-size: 1.1rem;
      font-weight: 800;
      color: var(--accent-cyan);
    }

    /* Live Laps History */
    .history-card {
      background: var(--bg-card);
      border: 1px solid var(--border-subtle);
      border-radius: 14px;
      padding: 1rem;
    }

    .history-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 0.75rem;
    }

    .history-title {
      font-size: 0.8rem;
      font-weight: 700;
      color: var(--text-muted);
      text-transform: uppercase;
      letter-spacing: 0.05em;
      display: flex;
      align-items: center;
      gap: 0.4rem;
    }

    .laps-table {
      width: 100%;
      border-collapse: collapse;
      font-size: 0.82rem;
    }

    .laps-table th {
      text-align: left;
      padding: 0.5rem 0.6rem;
      color: var(--text-dim);
      font-weight: 700;
      font-size: 0.72rem;
      border-bottom: 1px solid var(--border-subtle);
    }

    .laps-table td {
      padding: 0.55rem 0.6rem;
      border-bottom: 1px solid rgba(255, 255, 255, 0.04);
      font-family: var(--font-mono);
    }

    .laps-table tr.best-lap td {
      color: var(--accent-green);
      font-weight: 800;
      background: rgba(0, 230, 118, 0.05);
    }

    .crown-icon {
      color: var(--accent-gold);
      margin-right: 0.25rem;
    }

    /* Pit-Wall Tactical Command Center Dock */
    .pit-command-dock {
      position: fixed;
      bottom: 0;
      left: 0;
      right: 0;
      background: rgba(10, 14, 22, 0.96);
      backdrop-filter: blur(20px);
      -webkit-backdrop-filter: blur(20px);
      border-top: 1px solid var(--border-focus);
      padding: 0.65rem 1rem 0.85rem;
      display: flex;
      flex-direction: column;
      gap: 0.5rem;
      box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.7);
      z-index: 100;
      max-width: 960px;
      margin: 0 auto;
      border-radius: 16px 16px 0 0;
    }

    .dock-top-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 0.5rem;
    }

    .dock-title {
      font-size: 0.72rem;
      font-weight: 800;
      color: var(--text-muted);
      text-transform: uppercase;
      letter-spacing: 0.05em;
      display: flex;
      align-items: center;
      gap: 0.35rem;
    }

    .dock-status-tag {
      font-size: 0.72rem;
      font-family: var(--font-mono);
      font-weight: 700;
      color: var(--accent-cyan);
      background: rgba(0, 229, 255, 0.1);
      padding: 0.15rem 0.5rem;
      border-radius: 4px;
      border: 1px solid rgba(0, 229, 255, 0.25);
      transition: all 0.2s;
    }

    .signal-grid {
      display: grid;
      grid-template-columns: repeat(5, 1fr);
      gap: 0.45rem;
    }

    .sig-btn {
      border: 1px solid rgba(255, 255, 255, 0.15);
      border-radius: 8px;
      padding: 0.45rem 0.2rem;
      font-family: var(--font-display);
      font-weight: 800;
      font-size: 0.78rem;
      cursor: pointer;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 0.15rem;
      transition: all 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
      position: relative;
    }

    
    /* Active Toggle Button Highlight Strobe */
    .sig-btn.active {
      transform: scale(1.03);
      border-width: 2px !important;
      animation: sig-active-glow 1.2s infinite ease-in-out;
    }

    @keyframes sig-active-glow {
      0% { box-shadow: 0 0 12px currentColor, inset 0 0 8px currentColor; }
      50% { box-shadow: 0 0 26px currentColor, inset 0 0 14px currentColor; }
      100% { box-shadow: 0 0 12px currentColor, inset 0 0 8px currentColor; }
    }

    .sig-btn.active.sig-pit { background: rgba(0, 229, 255, 0.35) !important; border-color: #00e5ff !important; color: #fff !important; }
    .sig-btn.active.sig-yellow { background: rgba(255, 214, 0, 0.35) !important; border-color: #ffd600 !important; color: #fff !important; }
    .sig-btn.active.sig-sc { background: rgba(255, 145, 0, 0.35) !important; border-color: #ff9100 !important; color: #fff !important; }
    .sig-btn.active.sig-red { background: rgba(255, 23, 68, 0.42) !important; border-color: #ff1744 !important; color: #fff !important; }
    .sig-btn.active.sig-green { background: rgba(0, 230, 118, 0.35) !important; border-color: #00e676 !important; color: #fff !important; }

    .sig-btn:active {
      transform: scale(0.92);
    }

    .sig-badge-label {
      font-size: 0.72rem;
      letter-spacing: 0.05em;
      opacity: 0.85;
      text-transform: uppercase;
      font-family: var(--font-mono);
    }

    /* Signal Variations */
    .sig-pit {
      background: rgba(0, 229, 255, 0.12);
      border-color: #00e5ff;
      color: #00e5ff;
    }
    .sig-pit:hover { background: rgba(0, 229, 255, 0.25); box-shadow: 0 0 15px rgba(0,229,255,0.4); }

    .sig-yellow {
      background: rgba(255, 214, 0, 0.12);
      border-color: #ffd600;
      color: #ffd600;
    }
    .sig-yellow:hover { background: rgba(255, 214, 0, 0.25); box-shadow: 0 0 15px rgba(255,214,0,0.4); }

    .sig-sc {
      background: rgba(255, 145, 0, 0.12);
      border-color: #ff9100;
      color: #ff9100;
    }
    .sig-sc:hover { background: rgba(255, 145, 0, 0.25); box-shadow: 0 0 15px rgba(255,145,0,0.4); }

    .sig-red {
      background: rgba(255, 23, 68, 0.15);
      border-color: #ff1744;
      color: #ff1744;
    }
    .sig-red:hover { background: rgba(255, 23, 68, 0.3); box-shadow: 0 0 15px rgba(255,23,68,0.5); }

    .sig-green {
      background: rgba(0, 230, 118, 0.12);
      border-color: #00e676;
      color: #00e676;
    }
    .sig-green:hover { background: rgba(0, 230, 118, 0.25); box-shadow: 0 0 15px rgba(0,230,118,0.4); }

    .dock-custom-row {
      display: flex;
      gap: 0.45rem;
      align-items: center;
    }

    .dock-input {
      flex: 1;
      min-width: 0;
      background: rgba(255, 255, 255, 0.06);
      border: 1px solid var(--border-subtle);
      border-radius: 8px;
      padding: 0.4rem 0.65rem;
      font-size: 0.8rem;
      color: #fff;
      font-family: var(--font-main);
      outline: none;
      transition: border-color 0.2s;
    }

    .dock-input:focus {
      border-color: var(--accent-cyan);
    }

    .dock-send-btn {
      background: var(--accent-cyan);
      color: #070a10;
      border: none;
      border-radius: 8px;
      padding: 0.4rem 0.75rem;
      font-family: var(--font-display);
      font-weight: 800;
      font-size: 0.78rem;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 0.25rem;
      transition: opacity 0.2s;
    }
    .dock-send-btn:hover { opacity: 0.9; }

    .dock-cheers {
      display: flex;
      gap: 0.15rem;
      background: rgba(255, 255, 255, 0.04);
      padding: 0.15rem 0.35rem;
      border-radius: 8px;
      border: 1px solid var(--border-subtle);
    }

    .dock-cheer-btn {
      background: none;
      border: none;
      font-size: 1.15rem;
      cursor: pointer;
      padding: 0.15rem 0.25rem;
      border-radius: 4px;
      transition: transform 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    }
    .dock-cheer-btn:active { transform: scale(1.35); }

    /* Floating Animated Emojis */
    .floating-emoji {
      position: fixed;
      bottom: 70px;
      font-size: 2rem;
      pointer-events: none;
      z-index: 999;
      animation: float-up 1.8s ease-out forwards;
    }

    @keyframes float-up {
      0% { opacity: 1; transform: translateY(0) scale(0.7); }
      50% { opacity: 0.9; transform: translateY(-100px) scale(1.2); }
      100% { opacity: 0; transform: translateY(-220px) scale(1.5); }
    }

    /* Fullscreen Connection / Standby Overlay */
    .overlay-backdrop {
      position: absolute;
      inset: 0;
      background: rgba(7, 10, 16, 0.94);
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      z-index: 50;
      border-radius: 16px;
      padding: 1rem;
      transition: opacity 0.3s;
      overflow: hidden;
      box-sizing: border-box;
    }

    .overlay-spinner {
      display: none;
    }

    .overlay-title {
      display: none;
    }

    .overlay-desc {
      display: none;
    }

    /* Mobile adjustments & Zero Horizontal Scroll Guarantee */
    @media (max-width: 768px) {
      .live-header {
        flex-wrap: wrap;
        padding: max(0.5rem, env(safe-area-inset-top, 0px)) 0.75rem 0.5rem;
        gap: 0.45rem;
      }
      .brand-wrap {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: flex-start;
        gap: 0.35rem;
        min-width: 0;
      }
      .brand-logo-img {
        height: 22px !important;
      }
      .brand-text {
        display: inline-block;
        font-size: 0.92rem;
      }
      .brand-divider {
        display: inline-block;
        color: var(--text-dim);
        opacity: 0.6;
      }
      .brand-sub-title {
        font-size: 0.75rem !important;
      }
      .brand-live-badge {
        font-size: 0.72rem;
        padding: 0.08rem 0.32rem;
        gap: 0.22rem;
        margin-left: auto;
      }
      .header-controls {
        width: 100%;
        display: flex;
        align-items: center;
        justify-content: flex-end;
        margin-left: auto;
        gap: 0.35rem;
      }
      .wakelock-badge {
        font-size: 0.72rem;
        padding: 0.22rem 0.5rem;
        height: 30px;
        box-sizing: border-box;
      }
      .viewers-pill {
        font-size: 0.72rem;
        padding: 0.22rem 0.5rem;
        height: 30px;
        box-sizing: border-box;
      }
      #fullscreen-toggle-btn {
        display: none;
      }
      .icon-btn {
        width: 30px;
        height: 30px;
      }
      .close-live-btn {
        height: 30px;
        padding: 0 0.52rem;
        font-size: 0.72rem;
        gap: 0.2rem;
      }
      .header-disconnect-btn {
        height: 30px;
        padding: 0 0.45rem;
        font-size: 0.72rem;
        gap: 0.2rem;
      }
      .live-main {
        padding: 0.55rem 0.65rem calc(8.5rem + env(safe-area-inset-bottom, 0px));
        gap: 0.75rem;
      }
      .circuit-banner {
        padding: 0.75rem 0.85rem;
        gap: 0.6rem;
      }
      .circuit-info-left {
        min-width: 0;
        flex: 1 1 180px;
      }
      .circuit-info-left > div {
        min-width: 0;
      }
      .circuit-name {
        font-size: 1rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }
      .circuit-layout-meta {
        font-size: 0.74rem;
        flex-wrap: wrap;
      }
      .timer-gauge-card {
        padding: 1.15rem 0.75rem;
      }
      .telemetry-grid {
        gap: 0.45rem;
      }
      .stat-card {
        padding: 0.65rem 0.35rem;
        min-width: 0;
        overflow: hidden;
      }
      .stat-val {
        font-size: clamp(0.95rem, 3.6vw, 1.35rem);
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }
      .stat-sub {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }
      .map-header {
        padding: 0.55rem 0.75rem;
        gap: 0.4rem;
      }
      #map-coords-readout {
        font-size: 0.72rem !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 55%;
      }
      .map-canvas-container {
        height: 240px;
      }
      .history-card {
        padding: 0.75rem;
        overflow-x: hidden;
      }
      .laps-table th,
      .laps-table td {
        padding: 0.45rem 0.35rem;
        font-size: 0.76rem;
      }
      .pit-command-dock {
        padding: 0.55rem 0.65rem calc(0.7rem + env(safe-area-inset-bottom, 0px));
        width: 100%;
        max-width: 100%;
      }
      .signal-grid {
        gap: 0.3rem;
      }
      .sig-btn {
        padding: 0.4rem 0.1rem;
        font-size: 0.72rem;
      }
      .dock-custom-row {
        gap: 0.3rem;
      }
      .dock-input {
        padding: 0.38rem 0.5rem;
        font-size: 16px; /* Prevents iOS auto-zoom on input focus */
      }
      .dock-send-btn {
        padding: 0.4rem 0.55rem;
        font-size: 0.72rem;
        flex-shrink: 0;
      }
      .dock-cheers {
        padding: 0.1rem 0.2rem;
        gap: 0.05rem;
        flex-shrink: 0;
      }
      .dock-cheer-btn {
        font-size: 1rem;
        padding: 0.12rem 0.18rem;
      }
    }

    @media (max-width: 400px) {
      .watching-text-label {
        display: none;
      }
      .dock-send-btn span {
        display: none;
      }
    }

    @media (max-width: 380px) {
      .brand-text,
      .brand-divider {
        display: none;
      }
    }
  
    /* =========================================================================
       LIGHT THEME TOKEN OVERRIDES (Soft Cool-Gray & High Contrast)
       ========================================================================= */
    html[data-theme="light"] {
      --bg-main: #f1f5f9;
      --bg-surface: #ffffff;
      --bg-card: #ffffff;
      --bg-card-hover: #f8fafc;
      --bg-glass: rgba(255, 255, 255, 0.95);

      --border-subtle: rgba(15, 23, 42, 0.09);
      --border-bright: rgba(15, 23, 42, 0.18);
      --border-strong: rgba(2, 132, 199, 0.4);

      --accent-red: #e11d48;
      --accent-cyan: #0284c7;
      --accent-green: #059669;
      --accent-orange: #d97706;
      --accent-amber: #d97706;

      --text-main: #0f172a;
      --text-muted: #334155;
      --text-dim: #475569;

      color-scheme: light;
    }

    /* Base Body & Layout */
    html[data-theme="light"] body {
      background-color: var(--bg-main) !important;
      background-image: 
        radial-gradient(ellipse at 50% 0%, rgba(2, 132, 199, 0.05) 0%, transparent 60%),
        radial-gradient(circle at 85% 15%, rgba(225, 29, 72, 0.03) 0%, transparent 45%) !important;
      color: var(--text-main) !important;
    }

    /* Headings & High-Contrast Typography */
    html[data-theme="light"] h1,
    html[data-theme="light"] h2,
    html[data-theme="light"] h3,
    html[data-theme="light"] h4,
    html[data-theme="light"] h5,
    html[data-theme="light"] h6 {
      color: #0f172a !important;
    }

    /* Main Titles, Badges, Labels & Dynamic Telemetry Readings */
    html[data-theme="light"] .brand-title,
    html[data-theme="light"] .brand-text,
    html[data-theme="light"] .footer-brand-title,
    html[data-theme="light"] .section-title,
    html[data-theme="light"] .card-title,
    html[data-theme="light"] .graph-title,
    html[data-theme="light"] .modal-title,
    html[data-theme="light"] .article-title,
    html[data-theme="light"] .guide-h2,
    html[data-theme="light"] .catalog-hero h1,
    html[data-theme="light"] .session-track-name,
    html[data-theme="light"] .session-track-title,
    html[data-theme="light"] .stat-banner-val,
    html[data-theme="light"] .hud-big-lap-time,
    html[data-theme="light"] .hud-stat-val,
    html[data-theme="light"] .hud-select,
    html[data-theme="light"] .q-val,
    html[data-theme="light"] .big-ms,
    html[data-theme="light"] .sub-status,
    html[data-theme="light"] .lhm-circuit-name,
    html[data-theme="light"] .phm-circuit-name,
    html[data-theme="light"] .lap-history-title,
    html[data-theme="light"] .pit-history-title,
    html[data-theme="light"] .rank-card-title,
    html[data-theme="light"] .tire-psi-val,
    html[data-theme="light"] .calib-input,
    html[data-theme="light"] .pit-target-current-pill,
    html[data-theme="light"] .user-name-text,
    html[data-theme="light"] .policy-title,
    html[data-theme="light"] .ltf-main-title,
    html[data-theme="light"] .ltf-feat-content h4,
    html[data-theme="light"] .ltf-gallery-caption h5,
    html[data-theme="light"] .seo-info-title,
    html[data-theme="light"] .seo-feature-card h3,
    html[data-theme="light"] .seo-faq-section h3,
    html[data-theme="light"] .seo-faq-summary,
    html[data-theme="light"] .seo-faq-answer strong,
    html[data-theme="light"] .app-cta-banner h3,
    html[data-theme="light"] .dropdown-circuit-item,
    html[data-theme="light"] .filter-track-dropdown-btn,
    html[data-theme="light"] .filter-track-dropdown,
    html[data-theme="light"] .nav-more-menu-label,
    html[data-theme="light"] .nav-more-menu-item {
      color: #0f172a !important;
    }

    /* Paragraphs, descriptions, secondary text */
    html[data-theme="light"] .article-body,
    html[data-theme="light"] .article-body p,
    html[data-theme="light"] .article-body li,
    html[data-theme="light"] .markdown-rendered-body,
    html[data-theme="light"] .markdown-rendered-body p,
    html[data-theme="light"] .markdown-rendered-body li,
    html[data-theme="light"] .policy-card p,
    html[data-theme="light"] .section-desc,
    html[data-theme="light"] .guide-callout,
    html[data-theme="light"] .ltf-description,
    html[data-theme="light"] .ltf-feat-content p,
    html[data-theme="light"] .ltf-gallery-caption p,
    html[data-theme="light"] .seo-faq-answer,
    html[data-theme="light"] .seo-faq-formula,
    html[data-theme="light"] .guide-card-desc,
    html[data-theme="light"] .records-table td,
    html[data-theme="light"] .guide-table td {
      color: #1e293b !important;
    }

    html[data-theme="light"] .article-body strong,
    html[data-theme="light"] .markdown-rendered-body strong {
      color: #0f172a !important;
    }

    /* Captions, subtle labels, timestamps */
    html[data-theme="light"] .session-vehicle-inline,
    html[data-theme="light"] .session-title-sep,
    html[data-theme="light"] .section-subtitle,
    html[data-theme="light"] .q-label,
    html[data-theme="light"] .img-source-caption,
    html[data-theme="light"] .source-label,
    html[data-theme="light"] .img-alt-only,
    html[data-theme="light"] .dropdown-group-title,
    html[data-theme="light"] .dropdown-nearby-prompt,
    html[data-theme="light"] .nav-more-menu-sub,
    html[data-theme="light"] .footer-tagline,
    html[data-theme="light"] .site-footer p,
    html[data-theme="light"] .site-footer a,
    html[data-theme="light"] .policy-meta,
    html[data-theme="light"] .policy-meta span {
      color: #475569 !important;
    }

    html[data-theme="light"] .img-source-caption a {
      color: #0284c7 !important;
    }

    /* Badges */
    html[data-theme="light"] .brand-badge {
      color: #0284c7 !important;
      background: rgba(2, 132, 199, 0.12) !important;
      border: 1px solid rgba(2, 132, 199, 0.3) !important;
    }
    html[data-theme="light"] .footer-brand-badge {
      color: #0f172a !important;
      background: rgba(15, 23, 42, 0.08) !important;
      border: 1px solid rgba(15, 23, 42, 0.15) !important;
    }
    html[data-theme="light"] .policy-badge {
      color: #0284c7 !important;
      background: rgba(2, 132, 199, 0.1) !important;
      border-color: rgba(2, 132, 199, 0.25) !important;
    }

    /* Logo Image Swapping in Light Mode - Exactly matching Dark Mode Dimensions */
    html[data-theme="light"] .brand-logo-img {
      content: url('/v1/logo-light.png?v=7') !important;
      height: 26px !important;
      width: auto !important;
      max-width: 110px !important;
      object-fit: contain !important;
      filter: drop-shadow(0 1px 2px rgba(15, 23, 42, 0.08)) !important;
    }
    .footer-brand-logo {
      height: 26px;
      width: auto;
      max-width: 90px;
      object-fit: contain;
      vertical-align: middle;
      filter: drop-shadow(0 0 6px rgba(0, 240, 255, 0.3));
    }html[data-theme="light"] .footer-brand-logo {
      content: url('/v1/logo.png?v=5');
      height: 26px !important;
      width: auto !important;
      max-width: 90px !important;
      object-fit: contain !important;
      vertical-align: middle !important;
      border-radius: var(--radius-sm, 6px) !important;
      filter: none !important;
      box-shadow: none !important;
    }

    /* Navigation & Topbar */
    html[data-theme="light"] .topbar,
    html[data-theme="light"] .live-header {
      background: rgba(255, 255, 255, 0.94) !important;
      border-bottom: 1px solid var(--border-subtle);
      box-shadow: 0 1px 12px rgba(15, 23, 42, 0.05);
    }
    html[data-theme="light"] .nav-tabs-desktop {
      background: rgba(15, 23, 42, 0.04) !important;
      border-color: rgba(15, 23, 42, 0.08) !important;
    }
    html[data-theme="light"] .nav-tab-btn {
      color: var(--text-muted) !important;
    }
    html[data-theme="light"] .nav-tab-btn:hover {
      color: #0f172a !important;
      background: rgba(15, 23, 42, 0.06) !important;
    }
    html[data-theme="light"] .nav-tab-btn.active {
      color: #0284c7 !important;
      background: rgba(2, 132, 199, 0.1) !important;
      border-color: #0284c7 !important;
      box-shadow: 0 0 12px rgba(2, 132, 199, 0.15) !important;
    }

    /* Cards, Panels, Modals */
    html[data-theme="light"] .session-card,
    html[data-theme="light"] .card,
    html[data-theme="light"] .graph-card,
    html[data-theme="light"] .records-card,
    html[data-theme="light"] .stat-card,
    html[data-theme="light"] .ble-status-tile,
    html[data-theme="light"] .control-strip,
    html[data-theme="light"] .app-cta-banner,
    html[data-theme="light"] .article-share-card,
    html[data-theme="light"] .article-header,
    html[data-theme="light"] .policy-card,
    html[data-theme="light"] .guide-card {
      background: #ffffff !important;
      border-color: rgba(15, 23, 42, 0.09) !important;
      box-shadow: 0 4px 18px rgba(15, 23, 42, 0.04) !important;
      color: #0f172a !important;
    }
    html[data-theme="light"] .session-card:hover,
    html[data-theme="light"] .guide-card:hover {
      background: #f8fafc !important;
      border-color: rgba(2, 132, 199, 0.4) !important;
      box-shadow: 0 10px 25px rgba(15, 23, 42, 0.08) !important;
    }
    html[data-theme="light"] .modal-card {
      background: #ffffff !important;
      border-color: rgba(15, 23, 42, 0.14) !important;
      box-shadow: 0 20px 60px rgba(15, 23, 42, 0.18) !important;
      color: #0f172a !important;
    }
    html[data-theme="light"] .modal-header,
    html[data-theme="light"] .modal-footer {
      background: #f8fafc !important;
      border-color: rgba(15, 23, 42, 0.08) !important;
    }

    /* Form Controls & Inputs */
    html[data-theme="light"] .form-input,
    html[data-theme="light"] .form-select,
    html[data-theme="light"] .form-textarea,
    html[data-theme="light"] .search-input,
    html[data-theme="light"] .dropdown-search-input,
    html[data-theme="light"] .hud-track-search-input,
    html[data-theme="light"] .input-stepper-wrap input {
      background: #ffffff !important;
      border-color: rgba(15, 23, 42, 0.18) !important;
      color: #0f172a !important;
    }
    html[data-theme="light"] .form-input::placeholder,
    html[data-theme="light"] .form-textarea::placeholder,
    html[data-theme="light"] .search-input::placeholder,
    html[data-theme="light"] .dropdown-search-input::placeholder,
    html[data-theme="light"] .hud-track-search-input::placeholder {
      color: #64748b !important;
    }
    html[data-theme="light"] .form-input:focus,
    html[data-theme="light"] .form-select:focus,
    html[data-theme="light"] .form-textarea:focus,
    html[data-theme="light"] .search-input:focus {
      background: #ffffff !important;
      border-color: #0284c7 !important;
      box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15) !important;
    }

    /* Buttons */
    html[data-theme="light"] .btn-outline {
      background: #ffffff !important;
      border-color: rgba(15, 23, 42, 0.22) !important;
      color: #0f172a !important;
    }
    html[data-theme="light"] .btn-outline:hover {
      background: #f1f5f9 !important;
      color: #0284c7 !important;
      border-color: #0284c7 !important;
    }
    html[data-theme="light"] .btn-step {
      background: #e2e8f0 !important;
      color: #0f172a !important;
      border-color: rgba(15, 23, 42, 0.15) !important;
    }
    html[data-theme="light"] .icon-btn {
      background: rgba(15, 23, 42, 0.04) !important;
      border-color: rgba(15, 23, 42, 0.1) !important;
      color: #475569 !important;
    }
    html[data-theme="light"] .icon-btn:hover {
      background: rgba(15, 23, 42, 0.08) !important;
      color: #0f172a !important;
    }
    html[data-theme="light"] .mode-btn {
      background: rgba(15, 23, 42, 0.04) !important;
      color: #475569 !important;
      border-color: rgba(15, 23, 42, 0.08) !important;
    }
    html[data-theme="light"] .mode-btn.active {
      background: #0284c7 !important;
      color: #ffffff !important;
      border-color: #0284c7 !important;
      box-shadow: 0 2px 10px rgba(2, 132, 199, 0.25) !important;
    }
    html[data-theme="light"] .filter-chip {
      background: #ffffff !important;
      border-color: rgba(15, 23, 42, 0.15) !important;
      color: #334155 !important;
    }
    html[data-theme="light"] .filter-chip:hover {
      border-color: #0284c7 !important;
      color: #0f172a !important;
    }
    html[data-theme="light"] .filter-chip.active {
      background: #0284c7 !important;
      color: #ffffff !important;
      border-color: #0284c7 !important;
    }

    /* Menu Popup & Navigation */
    html[data-theme="light"] .nav-more-menu-panel {
      background: rgba(255, 255, 255, 0.98) !important;
      border-color: rgba(15, 23, 42, 0.12) !important;
      box-shadow: 0 16px 40px rgba(15, 23, 42, 0.14) !important;
    }
    html[data-theme="light"] .nav-more-menu-header {
      border-color: rgba(15, 23, 42, 0.08) !important;
    }
    html[data-theme="light"] .nav-more-menu-item {
      background: rgba(15, 23, 42, 0.02) !important;
      border-color: rgba(15, 23, 42, 0.06) !important;
      color: #0f172a !important;
    }
    html[data-theme="light"] .nav-more-menu-item:hover {
      background: rgba(15, 23, 42, 0.05) !important;
      border-color: #0284c7 !important;
      color: #0284c7 !important;
    }
    html[data-theme="light"] .nav-more-menu-arrow {
      color: #64748b !important;
    }
    html[data-theme="light"] .mobile-bottom-nav {
      background: rgba(255, 255, 255, 0.95) !important;
      border-top: 1px solid rgba(15, 23, 42, 0.08) !important;
    }
    html[data-theme="light"] .mob-nav-item {
      color: #64748b !important;
    }
    html[data-theme="light"] .mob-nav-item.active {
      color: #0284c7 !important;
    }
    html[data-theme="light"] footer.site-footer,
    html[data-theme="light"] .app-footer {
      background: #e2e8f0 !important;
      border-top: 1px solid rgba(15, 23, 42, 0.08) !important;
      color: #475569 !important;
    }

    /* Training Page Specifics */
    html[data-theme="light"] .q-stat {
      background: rgba(15, 23, 42, 0.03) !important;
      border-color: rgba(15, 23, 42, 0.07) !important;
    }
    html[data-theme="light"] .start-pill-btn {
      color: #ffffff !important;
    }

    /* Desktop Theme Toggle Button */
    .btn-theme-toggle-desktop {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 36px;
      height: 36px;
      border-radius: var(--radius-sm, 8px);
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
      color: var(--text-muted, #94a3b8);
      cursor: pointer;
      transition: all var(--transition-fast, 0.15s ease);
      flex-shrink: 0;
    }
    .btn-theme-toggle-desktop:hover {
      background: rgba(255, 255, 255, 0.1);
      color: var(--text-main, #fff);
      border-color: var(--border-bright, rgba(255, 255, 255, 0.2));
    }
    html[data-theme="light"] .btn-theme-toggle-desktop {
      background: rgba(15, 23, 42, 0.04);
      border-color: rgba(15, 23, 42, 0.12);
      color: #475569;
    }
    html[data-theme="light"] .btn-theme-toggle-desktop:hover {
      background: rgba(15, 23, 42, 0.08);
      color: #0f172a;
    }
    @media (max-width: 768px) {
      .btn-theme-toggle-desktop {
        display: none !important;
      }
    }

    /* Universal Toggle in header for pages without full popup menu */
    .btn-theme-toggle-universal {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 34px;
      height: 34px;
      border-radius: var(--radius-sm, 8px);
      background: rgba(255, 255, 255, 0.06);
      border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
      color: var(--text-muted, #94a3b8);
      cursor: pointer;
      transition: all var(--transition-fast, 0.15s ease);
      flex-shrink: 0;
    }
    .btn-theme-toggle-universal:hover {
      background: rgba(255, 255, 255, 0.12);
      color: var(--text-main, #fff);
    }
    html[data-theme="light"] .btn-theme-toggle-universal {
      background: rgba(15, 23, 42, 0.04);
      border-color: rgba(15, 23, 42, 0.12);
      color: #475569;
    }
    html[data-theme="light"] .btn-theme-toggle-universal:hover {
      background: rgba(15, 23, 42, 0.08);
      color: #0f172a;
    }

    /* Theme Switch Inside Menu Panel (Mobile & Desktop) */
    .nav-more-menu-theme-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      width: 100%;
      padding: 0.55rem 0.65rem;
      border-radius: var(--radius-sm, 8px);
      background: rgba(255, 255, 255, 0.03);
      border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
      cursor: pointer;
      transition: all var(--transition-fast, 0.15s ease);
      margin-top: 0.2rem;
      user-select: none;
    }
    .nav-more-menu-theme-info {
      display: flex;
      align-items: center;
      gap: 0.7rem;
      flex: 1;
      min-width: 0;
    }
    .nav-more-menu-theme-row:hover {
      background: rgba(255, 255, 255, 0.08);
      border-color: var(--accent-cyan, #00f0ff);
    }
    html[data-theme="light"] .nav-more-menu-theme-row {
      background: rgba(15, 23, 42, 0.03);
      border-color: rgba(15, 23, 42, 0.08);
    }
    html[data-theme="light"] .nav-more-menu-theme-row:hover {
      background: rgba(15, 23, 42, 0.06);
      border-color: #0284c7;
    }
    .theme-switch-capsule {
      display: inline-flex;
      align-items: center;
      position: relative;
      width: 50px;
      height: 26px;
      border-radius: 9999px;
      background: rgba(255, 255, 255, 0.1);
      border: 1px solid var(--border-bright, rgba(255, 255, 255, 0.2));
      padding: 2px;
      transition: background 0.25s ease, border-color 0.25s ease;
    }
    html[data-theme="light"] .theme-switch-capsule {
      background: #e2e8f0;
      border-color: rgba(15, 23, 42, 0.15);
    }
    .theme-switch-thumb,
    .theme-switch-knob {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 20px;
      height: 20px;
      border-radius: 50%;
      background: var(--accent-cyan, #00f0ff);
      color: #06090e;
      transform: translateX(0);
      transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), background 0.25s ease, color 0.25s ease;
      box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
    }
    html[data-theme="light"] .theme-switch-thumb,
    html[data-theme="light"] .theme-switch-knob {
      transform: translateX(24px);
      background: #d97706;
      color: #ffffff;
    }
    .theme-icon-indicator {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      font-size: 0.72rem;
    }
    html[data-theme="dark"] .icon-sun { display: block; }
    html[data-theme="dark"] .icon-moon { display: none; }
    html[data-theme="light"] .icon-sun { display: none; }
    html[data-theme="light"] .icon-moon { display: block; }
    .icon-sun { display: block; }
    .icon-moon { display: none; }
  
    /* =========================================================================
       LIVE SPECTATOR / LIVE.HTML LIGHT MODE OVERRIDES
       ========================================================================= */
    html[data-theme="light"] {
      --bg-dark: #f1f5f9;
      --bg-card: #ffffff;
      --bg-card-hover: #f8fafc;
      --border-subtle: rgba(15, 23, 42, 0.12);
      --border-focus: rgba(2, 132, 199, 0.4);
      --text-main: #0f172a;
      --text-muted: #475569;
      --text-dim: #64748b;
    }

    html[data-theme="light"] body::before {
      background: radial-gradient(circle, rgba(2, 132, 199, 0.05) 0%, rgba(241, 245, 249, 0) 70%) !important;
    }

    /* Live Header */
    html[data-theme="light"] .live-header {
      background: rgba(255, 255, 255, 0.92) !important;
      border-bottom: 1px solid rgba(15, 23, 42, 0.1) !important;
      backdrop-filter: blur(14px) !important;
      -webkit-backdrop-filter: blur(14px) !important;
    }
    html[data-theme="light"] .brand-text {
      color: #0f172a !important;
    }
    html[data-theme="light"] .viewers-pill {
      background: #f1f5f9 !important;
      border: 1px solid rgba(15, 23, 42, 0.12) !important;
      color: #334155 !important;
    }
    html[data-theme="light"] .icon-btn {
      background: #ffffff !important;
      border: 1px solid rgba(15, 23, 42, 0.16) !important;
      color: #0f172a !important;
    }
    html[data-theme="light"] .icon-btn:hover {
      background: #f1f5f9 !important;
      border-color: #0284c7 !important;
      color: #0284c7 !important;
    }

    /* Circuit & Driver Banner */
    html[data-theme="light"] .circuit-banner {
      background: #ffffff !important;
      border: 1px solid rgba(15, 23, 42, 0.12) !important;
      box-shadow: 0 4px 20px rgba(15, 23, 42, 0.04) !important;
    }
    html[data-theme="light"] .circuit-name {
      color: #0f172a !important;
    }
    html[data-theme="light"] .circuit-layout-meta {
      color: #475569 !important;
    }
    html[data-theme="light"] .driver-status-badge.standby {
      background: rgba(217, 119, 6, 0.12) !important;
      border: 1px solid #d97706 !important;
      color: #b45309 !important;
    }
    html[data-theme="light"] .driver-status-badge.on-track {
      background: rgba(5, 150, 105, 0.12) !important;
      border: 1px solid #059669 !important;
      color: #047857 !important;
    }
    html[data-theme="light"] .driver-status-badge.offline {
      background: #f1f5f9 !important;
      border: 1px solid rgba(15, 23, 42, 0.18) !important;
      color: #64748b !important;
    }

    /* Primary Lap Timer Hero Card & Standby Overlay */
    html[data-theme="light"] .timer-gauge-card {
      background: #ffffff !important;
      border: 1px solid rgba(15, 23, 42, 0.12) !important;
      box-shadow: 0 10px 30px rgba(15, 23, 42, 0.06) !important;
    }
    html[data-theme="light"] .overlay-backdrop {
      background: rgba(255, 255, 255, 0.94) !important;
      backdrop-filter: blur(12px) !important;
      -webkit-backdrop-filter: blur(12px) !important;
    }
    html[data-theme="light"] .overlay-title {
      color: #0f172a !important;
    }
    html[data-theme="light"] .overlay-desc {
      color: #475569 !important;
    }
    html[data-theme="light"] .overlay-spinner {
      border: 3px solid rgba(2, 132, 199, 0.2) !important;
      border-top-color: #0284c7 !important;
    }
    html[data-theme="light"] .big-lap-time {
      color: #0284c7 !important;
      text-shadow: none !important;
    }
    html[data-theme="light"] .lap-num-pill {
      background: #e0f2fe !important;
      border-color: #0284c7 !important;
      color: #0369a1 !important;
    }
    html[data-theme="light"] .pred-lap-pill {
      color: #475569 !important;
    }
    html[data-theme="light"] .pred-lap-val {
      color: #059669 !important;
    }
    html[data-theme="light"] .delta-scale-labels {
      color: #64748b !important;
    }
    html[data-theme="light"] .delta-bar-track {
      background: #e2e8f0 !important;
    }
    html[data-theme="light"] .delta-center-pin {
      background: #0f172a !important;
    }
    html[data-theme="light"] .delta-numeric-badge {
      color: #64748b !important;
    }
    html[data-theme="light"] .delta-numeric-badge.faster {
      color: #059669 !important;
    }
    html[data-theme="light"] .delta-numeric-badge.slower {
      color: #e11d48 !important;
    }

    /* Telemetry Stats Grid */
    html[data-theme="light"] .stat-card {
      background: #ffffff !important;
      border: 1px solid rgba(15, 23, 42, 0.12) !important;
      box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04) !important;
    }
    html[data-theme="light"] .stat-label {
      color: #64748b !important;
    }
    html[data-theme="light"] .stat-val {
      color: #0f172a !important;
    }
    html[data-theme="light"] .stat-sub {
      color: #64748b !important;
    }

    /* Live Vector Track Map */
    html[data-theme="light"] .map-card {
      background: #ffffff !important;
      border: 1px solid rgba(15, 23, 42, 0.12) !important;
      box-shadow: 0 4px 20px rgba(15, 23, 42, 0.04) !important;
    }
    html[data-theme="light"] .map-header {
      background: #f8fafc !important;
      border-bottom: 1px solid rgba(15, 23, 42, 0.08) !important;
    }
    html[data-theme="light"] .map-title {
      color: #0f172a !important;
    }
    html[data-theme="light"] .map-canvas-container {
      background: radial-gradient(circle at center, #f8fafc 0%, #edf2f7 100%) !important;
    }
    html[data-theme="light"] .map-speed-overlay {
      background: rgba(255, 255, 255, 0.92) !important;
      border: 1px solid rgba(15, 23, 42, 0.14) !important;
      color: #0284c7 !important;
      box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08) !important;
    }

    /* Completed Laps History Table */
    html[data-theme="light"] .history-card {
      background: #ffffff !important;
      border: 1px solid rgba(15, 23, 42, 0.12) !important;
      box-shadow: 0 4px 20px rgba(15, 23, 42, 0.04) !important;
    }
    html[data-theme="light"] .history-title {
      color: #0f172a !important;
    }
    html[data-theme="light"] .laps-table th {
      color: #64748b !important;
      border-bottom: 1px solid rgba(15, 23, 42, 0.1) !important;
    }
    html[data-theme="light"] .laps-table td {
      color: #0f172a !important;
      border-bottom: 1px solid rgba(15, 23, 42, 0.06) !important;
    }
    html[data-theme="light"] .laps-table tr.best-lap td {
      color: #047857 !important;
      background: #f0fdf4 !important;
    }

    /* Pit-Wall Tactical Command Center Dock */
    html[data-theme="light"] .pit-command-dock {
      background: rgba(255, 255, 255, 0.96) !important;
      border-top: 1px solid rgba(15, 23, 42, 0.12) !important;
      box-shadow: 0 -10px 30px rgba(15, 23, 42, 0.08) !important;
    }
    html[data-theme="light"] .dock-title {
      color: #0f172a !important;
    }
    html[data-theme="light"] .dock-status-tag {
      background: #f0fdf4 !important;
      border-color: #86efac !important;
      color: #16a34a !important;
    }
    html[data-theme="light"] .dock-input {
      background: #f8fafc !important;
      border: 1px solid rgba(15, 23, 42, 0.16) !important;
      color: #0f172a !important;
    }
    html[data-theme="light"] .dock-input:focus {
      background: #ffffff !important;
      border-color: #0284c7 !important;
      box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15) !important;
    }
    html[data-theme="light"] .dock-send-btn {
      background: #0284c7 !important;
      color: #ffffff !important;
    }
    html[data-theme="light"] .dock-cheers {
      background: #f1f5f9 !important;
      border: 1px solid rgba(15, 23, 42, 0.12) !important;
    }
    html[data-theme="light"] .sig-btn {
      background: #ffffff !important;
      border-width: 1.5px !important;
      box-shadow: 0 2px 6px rgba(15, 23, 42, 0.04) !important;
    }
    html[data-theme="light"] .sig-pit {
      border-color: #0284c7 !important;
      color: #0284c7 !important;
      background: #f0f9ff !important;
    }
    html[data-theme="light"] .sig-yellow {
      border-color: #d97706 !important;
      color: #b45309 !important;
      background: #fffbeb !important;
    }
    html[data-theme="light"] .sig-sc {
      border-color: #ea580c !important;
      color: #c2410c !important;
      background: #fff7ed !important;
    }
    html[data-theme="light"] .sig-red {
      border-color: #e11d48 !important;
      color: #be123c !important;
      background: #fff1f2 !important;
    }
    html[data-theme="light"] .sig-green {
      border-color: #059669 !important;
      color: #047857 !important;
      background: #f0fdf4 !important;
    }

    /* Header Key Pill */
    .header-key-pill {
      display: inline-flex;
      align-items: center;
      gap: 0.35rem;
      background: rgba(0, 229, 255, 0.08);
      border: 1px solid rgba(0, 229, 255, 0.3);
      padding: 0.28rem 0.65rem;
      border-radius: 9999px;
      font-size: 0.72rem;
      font-weight: 700;
      color: var(--accent-cyan);
      cursor: pointer;
      transition: all 0.2s ease;
      font-family: var(--font-mono);
      white-space: nowrap;
    }
    .header-key-pill:hover {
      background: rgba(0, 229, 255, 0.18);
      border-color: var(--accent-cyan);
      box-shadow: 0 0 12px rgba(0, 229, 255, 0.3);
      transform: translateY(-1px);
    }
    html[data-theme="light"] .header-key-pill {
      background: #e0f2fe !important;
      border-color: rgba(2, 132, 199, 0.35) !important;
      color: #0284c7 !important;
    }
    html[data-theme="light"] .header-key-pill:hover {
      background: #bae6fd !important;
      border-color: #0284c7 !important;
      box-shadow: 0 2px 8px rgba(2, 132, 199, 0.2) !important;
    }

    /* Circuit Banner Key Pill Button */
    .room-key-pill-btn {
      display: inline-flex;
      align-items: center;
      gap: 0.3rem;
      background: rgba(0, 229, 255, 0.08);
      border: 1px solid rgba(0, 229, 255, 0.25);
      border-radius: 6px;
      padding: 0.15rem 0.45rem;
      font-size: 0.75rem;
      font-weight: 700;
      font-family: var(--font-mono);
      color: var(--accent-cyan);
      cursor: pointer;
      transition: all 0.2s ease;
      vertical-align: middle;
    }
    .room-key-pill-btn:hover {
      background: rgba(0, 229, 255, 0.18);
      border-color: var(--accent-cyan);
      box-shadow: 0 0 10px rgba(0, 229, 255, 0.25);
    }
    html[data-theme="light"] .room-key-pill-btn {
      background: #f0f9ff !important;
      border-color: rgba(2, 132, 199, 0.25) !important;
      color: #0284c7 !important;
    }
    html[data-theme="light"] .room-key-pill-btn:hover {
      background: #e0f2fe !important;
      border-color: #0284c7 !important;
    }

    /* Direct Telemetry Key Card inside Standby Overlay */
    .overlay-key-card {
      width: 100%;
      max-width: 440px;
      background: rgba(13, 20, 32, 0.92);
      border: 1px solid rgba(0, 229, 255, 0.35);
      border-radius: 14px;
      padding: 0.95rem 1.15rem;
      box-shadow: 0 10px 40px rgba(0, 0, 0, 0.65), 0 0 20px rgba(0, 229, 255, 0.1);
      text-align: left;
      box-sizing: border-box;
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
    }
    html[data-theme="light"] .overlay-key-card {
      background: #ffffff !important;
      border-color: rgba(2, 132, 199, 0.3) !important;
      box-shadow: 0 10px 30px rgba(15, 23, 42, 0.1) !important;
    }
    .overlay-key-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 0.5rem;
      margin-bottom: 0.65rem;
    }
    .overlay-key-title {
      display: inline-flex;
      align-items: center;
      gap: 0.45rem;
      font-size: 0.82rem;
      font-weight: 800;
      color: var(--accent-cyan);
      letter-spacing: 0.04em;
      text-transform: uppercase;
      font-family: var(--font-display);
    }
    html[data-theme="light"] .overlay-key-title {
      color: #0284c7 !important;
    }
    .overlay-status-pill {
      display: inline-flex;
      align-items: center;
      gap: 0.35rem;
      font-size: 0.72rem;
      font-weight: 800;
      font-family: var(--font-mono);
      background: rgba(255, 255, 255, 0.08);
      color: var(--text-muted);
      border: 1px solid rgba(255, 255, 255, 0.12);
      padding: 0.15rem 0.5rem;
      border-radius: 9999px;
      white-space: nowrap;
    }
    .overlay-status-pill.active {
      background: rgba(0, 229, 255, 0.15);
      color: var(--accent-cyan);
      border-color: rgba(0, 229, 255, 0.4);
    }
    html[data-theme="light"] .overlay-status-pill {
      background: #f1f5f9 !important;
      color: #64748b !important;
      border-color: rgba(15, 23, 42, 0.12) !important;
    }
    html[data-theme="light"] .overlay-status-pill.active {
      background: #e0f2fe !important;
      color: #0284c7 !important;
      border-color: rgba(2, 132, 199, 0.35) !important;
    }
    .overlay-status-pill.connecting {
      background: rgba(255, 171, 0, 0.15);
      color: #ffab00;
      border-color: rgba(255, 171, 0, 0.4);
    }
    .overlay-status-pill.error {
      background: rgba(255, 51, 75, 0.18) !important;
      color: #ff334b !important;
      border-color: rgba(255, 51, 75, 0.45) !important;
    }
    .overlay-status-pill.error .live-dot-pulse {
      background: #ff334b !important;
      animation: none !important;
    }
    html[data-theme="light"] .overlay-status-pill.connecting {
      background: #fef3c7 !important;
      color: #d97706 !important;
      border-color: rgba(217, 119, 6, 0.35) !important;
    }
    html[data-theme="light"] .overlay-status-pill.error {
      background: #fee2e2 !important;
      color: #dc2626 !important;
      border-color: #fca5a5 !important;
    }
    html[data-theme="light"] .overlay-status-pill.error .live-dot-pulse {
      background: #dc2626 !important;
    }
    .overlay-key-form {
      display: flex;
      flex-direction: column;
      gap: 0.5rem;
    }
    .overlay-input-wrap {
      position: relative;
      width: 100%;
    }
    .overlay-input-icon {
      position: absolute;
      left: 12px;
      top: 50%;
      transform: translateY(-50%);
      width: 16px;
      height: 16px;
      color: var(--accent-cyan);
      pointer-events: none;
      opacity: 0.85;
    }
    html[data-theme="light"] .overlay-input-icon {
      color: #0284c7 !important;
    }
    .overlay-key-input {
      width: 100%;
      box-sizing: border-box;
      background: rgba(0, 0, 0, 0.65);
      border: 1.5px solid rgba(0, 229, 255, 0.28);
      border-radius: 8px;
      padding: 0.6rem 0.85rem 0.6rem 2.3rem;
      font-family: var(--font-mono);
      font-weight: 800;
      font-size: 1.15rem;
      color: #ffffff;
      letter-spacing: 2px;
      text-transform: uppercase;
      outline: none;
      transition: all 0.2s ease;
    }
    .overlay-key-input::placeholder {
      font-size: 0.95rem;
      letter-spacing: 1px;
      color: rgba(255, 255, 255, 0.35);
      font-weight: 600;
    }
    .overlay-key-input:focus {
      border-color: var(--accent-cyan);
      box-shadow: 0 0 14px rgba(0, 229, 255, 0.35);
      background: rgba(0, 0, 0, 0.85);
    }
    html[data-theme="light"] .overlay-key-input {
      background: #ffffff !important;
      border-color: rgba(2, 132, 199, 0.35) !important;
      color: #0f172a !important;
    }
    html[data-theme="light"] .overlay-key-input::placeholder {
      color: #94a3b8 !important;
    }
    html[data-theme="light"] .overlay-key-input:focus {
      border-color: #0284c7 !important;
      box-shadow: 0 0 10px rgba(2, 132, 199, 0.25) !important;
    }
    .overlay-btn-group {
      display: flex;
      gap: 0.5rem;
      align-items: center;
    }
    .overlay-key-submit-btn {
      flex: 1;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 0.4rem;
      background: linear-gradient(135deg, var(--accent-cyan), #00b4d8);
      color: #000000;
      border: none;
      border-radius: 8px;
      padding: 0.6rem 1.1rem;
      font-size: 0.86rem;
      font-weight: 800;
      font-family: var(--font-display);
      letter-spacing: 0.04em;
      cursor: pointer;
      transition: all 0.2s ease;
    }
    .overlay-key-submit-btn:hover {
      filter: brightness(1.12);
      box-shadow: 0 0 18px rgba(0, 229, 255, 0.45);
      transform: translateY(-1px);
    }
    .overlay-key-submit-btn:active {
      transform: translateY(0);
    }
    /* Header & Banner Disconnect Buttons (Visible only when connected) */
    .header-disconnect-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 0.3rem;
      height: 32px;
      padding: 0 0.65rem;
      border-radius: 8px;
      background: rgba(239, 68, 68, 0.15);
      border: 1px solid rgba(239, 68, 68, 0.45);
      color: #ff6b6b;
      font-family: var(--font-display);
      font-size: 0.74rem;
      font-weight: 800;
      letter-spacing: 0.04em;
      cursor: pointer;
      transition: all 0.2s ease;
      white-space: nowrap;
      flex-shrink: 0;
    }
    .header-disconnect-btn:hover {
      background: rgba(239, 68, 68, 0.3);
      border-color: #ef4444;
      color: #ffffff;
      box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
    }
    html[data-theme="light"] .header-disconnect-btn {
      background: #fee2e2 !important;
      border-color: #fca5a5 !important;
      color: #dc2626 !important;
    }
    html[data-theme="light"] .header-disconnect-btn:hover {
      background: #fecaca !important;
      color: #b91c1c !important;
    }

    .banner-disconnect-btn {
      display: inline-flex;
      align-items: center;
      gap: 0.25rem;
      background: rgba(239, 68, 68, 0.12);
      border: 1px solid rgba(239, 68, 68, 0.35);
      border-radius: 6px;
      padding: 0.15rem 0.45rem;
      font-size: 0.72rem;
      font-weight: 700;
      color: #ff6b6b;
      cursor: pointer;
      transition: all 0.2s ease;
      vertical-align: middle;
      font-family: var(--font-display);
    }
    .banner-disconnect-btn:hover {
      background: rgba(239, 68, 68, 0.25);
      border-color: #ef4444;
      color: #ffffff;
    }
    html[data-theme="light"] .banner-disconnect-btn {
      background: #fee2e2 !important;
      border-color: #fca5a5 !important;
      color: #dc2626 !important;
    }
    .overlay-key-helper {
      font-size: 0.72rem;
      color: var(--text-dim);
      line-height: 1.45;
      padding: 0.1rem 0.2rem;
    }
    .overlay-key-helper.error {
      display: block !important;
      color: #ff334b !important;
      background: rgba(255, 51, 75, 0.12);
      border: 1px solid rgba(255, 51, 75, 0.35);
      border-radius: 6px;
      padding: 0.45rem 0.65rem;
      margin-top: 0.5rem;
      font-size: 0.76rem;
      font-weight: 600;
      line-height: 1.4;
      text-align: left;
    }
    html[data-theme="light"] .overlay-key-helper {
      color: #64748b !important;
    }
    html[data-theme="light"] .overlay-key-helper.error {
      background: #fee2e2 !important;
      border-color: #fca5a5 !important;
      color: #dc2626 !important;
    }
    .modal-key-error {
      color: #ff334b !important;
      background: rgba(255, 51, 75, 0.12);
      border: 1px solid rgba(255, 51, 75, 0.35);
      border-radius: 6px;
      padding: 0.45rem 0.65rem;
      margin-bottom: 0.8rem;
      font-size: 0.76rem;
      font-weight: 600;
      line-height: 1.4;
      text-align: left;
    }
    html[data-theme="light"] .modal-key-error {
      background: #fee2e2 !important;
      border-color: #fca5a5 !important;
      color: #dc2626 !important;
    }
    .input-error {
      border-color: #ff334b !important;
      box-shadow: 0 0 0 2px rgba(255, 51, 75, 0.3) !important;
    }

    /* Driver Lap Timer Code Generator Link Box */
    .overlay-driver-link-box {
      margin-top: 0.7rem;
      padding-top: 0.65rem;
      border-top: 1px solid rgba(255, 255, 255, 0.08);
      display: flex;
      flex-direction: column;
      gap: 0.35rem;
      align-items: center;
      text-align: center;
    }
    html[data-theme="light"] .overlay-driver-link-box {
      border-top-color: rgba(15, 23, 42, 0.08);
    }
    .overlay-driver-link-text {
      font-size: 0.72rem;
      color: var(--text-dim);
      line-height: 1.35;
    }
    html[data-theme="light"] .overlay-driver-link-text {
      color: #64748b !important;
    }
    .overlay-driver-link-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 0.3rem;
      font-size: 0.74rem;
      font-weight: 700;
      color: var(--accent-cyan);
      background: rgba(0, 229, 255, 0.08);
      border: 1px solid rgba(0, 229, 255, 0.32);
      padding: 0.38rem 0.8rem;
      border-radius: 6px;
      text-decoration: none;
      transition: all 0.2s ease;
    }
    .overlay-driver-link-btn:hover {
      background: rgba(0, 229, 255, 0.18);
      border-color: var(--accent-cyan);
      color: #ffffff;
      box-shadow: 0 0 12px rgba(0, 229, 255, 0.35);
      transform: translateY(-1px);
    }
    html[data-theme="light"] .overlay-driver-link-btn {
      background: #e0f2fe !important;
      border-color: #7dd3fc !important;
      color: #0284c7 !important;
    }
    html[data-theme="light"] .overlay-driver-link-btn:hover {
      background: #bae6fd !important;
      color: #0369a1 !important;
    }

    .modal-driver-link-box {
      margin-top: 0.9rem;
      padding-top: 0.75rem;
      border-top: 1px solid rgba(255, 255, 255, 0.08);
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 0.5rem;
      font-size: 0.74rem;
      color: var(--text-dim);
    }
    html[data-theme="light"] .modal-driver-link-box {
      border-top-color: rgba(15, 23, 42, 0.08);
      color: #64748b !important;
    }
    .modal-driver-link {
      display: inline-flex;
      align-items: center;
      gap: 0.25rem;
      color: var(--accent-cyan);
      font-weight: 700;
      text-decoration: none;
      transition: all 0.15s;
    }
    .modal-driver-link:hover {
      color: #ffffff;
      text-decoration: underline;
    }
    html[data-theme="light"] .modal-driver-link {
      color: #0284c7 !important;
    }
    html[data-theme="light"] .modal-driver-link:hover {
      color: #0369a1 !important;
    }

    /* Modal Disconnect button */
    .btn-modal-disconnect {
      background: rgba(255, 42, 75, 0.12);
      border: 1px solid rgba(255, 42, 75, 0.4);
      color: #ff3355;
      padding: 0.45rem 0.85rem;
      border-radius: 6px;
      font-size: 0.8rem;
      font-weight: 700;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 0.35rem;
      transition: all 0.15s;
    }
    .btn-modal-disconnect:hover {
      background: rgba(255, 42, 75, 0.22);
      border-color: #ff3355;
    }
    html[data-theme="light"] .btn-modal-disconnect {
      background: #fff1f2 !important;
      border-color: rgba(225, 29, 72, 0.35) !important;
      color: #e11d48 !important;
    }
    html[data-theme="light"] .btn-modal-disconnect:hover {
      background: #ffe4e6 !important;
      border-color: #e11d48 !important;
    }

    @media (max-width: 480px) {
      .overlay-btn-group {
        flex-direction: column;
      }
      .overlay-key-submit-btn,
      .overlay-key-disconnect-btn {
        width: 100%;
      }
      .overlay-key-input {
        font-size: 1.1rem;
        padding: 0.65rem 0.85rem 0.65rem 2.4rem;
      }
    }

    /* Live Modal Dialog */
    .live-modal-overlay {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.78);
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 9999;
      padding: 1rem;
      animation: fadeIn 0.15s ease-out;
    }
    .live-modal-card {
      width: 100%;
      max-width: 400px;
      background: #0f172a;
      border: 1px solid rgba(0, 229, 255, 0.3);
      border-radius: 14px;
      box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
      overflow: hidden;
      animation: scaleUp 0.18s ease-out;
    }
    html[data-theme="light"] .live-modal-card {
      background: #ffffff !important;
      border-color: rgba(15, 23, 42, 0.14) !important;
      box-shadow: 0 20px 60px rgba(15, 23, 42, 0.18) !important;
    }
    .live-modal-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0.9rem 1.1rem;
      border-bottom: 1px solid rgba(255, 255, 255, 0.08);
      background: rgba(255, 255, 255, 0.02);
    }
    html[data-theme="light"] .live-modal-header {
      border-bottom-color: rgba(15, 23, 42, 0.08) !important;
      background: #f8fafc !important;
    }
    .live-modal-title {
      display: flex;
      align-items: center;
      gap: 0.45rem;
      font-size: 0.92rem;
      font-weight: 800;
      color: #fff;
      font-family: var(--font-display);
    }
    html[data-theme="light"] .live-modal-title {
      color: #0f172a !important;
    }
    .live-modal-close {
      background: transparent;
      border: none;
      color: var(--text-dim);
      cursor: pointer;
      padding: 0.25rem;
      border-radius: 4px;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: all 0.15s;
    }
    .live-modal-close:hover {
      color: #fff;
      background: rgba(255, 255, 255, 0.1);
    }
    html[data-theme="light"] .live-modal-close:hover {
      color: #0f172a !important;
      background: #f1f5f9 !important;
    }
    .live-modal-body {
      padding: 1.1rem;
    }
    .live-modal-input-wrap {
      margin-bottom: 0.4rem;
    }
    .live-modal-input {
      width: 100%;
      background: rgba(0, 0, 0, 0.5);
      border: 1px solid rgba(255, 255, 255, 0.16);
      border-radius: 8px;
      padding: 0.65rem 0.85rem;
      font-family: var(--font-mono);
      font-weight: 800;
      font-size: 1.05rem;
      color: #ffffff;
      letter-spacing: 1px;
      text-transform: uppercase;
      outline: none;
      transition: all 0.2s ease;
      box-sizing: border-box;
    }
    .live-modal-input:focus {
      border-color: var(--accent-cyan);
      box-shadow: 0 0 12px rgba(0, 229, 255, 0.35);
      background: rgba(0, 0, 0, 0.7);
    }
    html[data-theme="light"] .live-modal-input {
      background: #ffffff !important;
      border-color: rgba(15, 23, 42, 0.2) !important;
      color: #0f172a !important;
    }
    html[data-theme="light"] .live-modal-input:focus {
      border-color: #0284c7 !important;
      box-shadow: 0 0 8px rgba(2, 132, 199, 0.25) !important;
    }
    .live-modal-actions {
      display: flex;
      gap: 0.5rem;
      justify-content: flex-end;
      align-items: center;
    }
    .btn-modal-cancel {
      background: transparent;
      border: 1px solid rgba(255, 255, 255, 0.15);
      color: var(--text-dim);
      padding: 0.45rem 0.85rem;
      border-radius: 6px;
      font-size: 0.8rem;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.15s;
    }
    .btn-modal-cancel:hover {
      background: rgba(255, 255, 255, 0.05);
      color: #fff;
    }
    html[data-theme="light"] .btn-modal-cancel {
      border-color: rgba(15, 23, 42, 0.15) !important;
      color: #64748b !important;
    }
    html[data-theme="light"] .btn-modal-cancel:hover {
      background: #f1f5f9 !important;
      color: #0f172a !important;
    }
    .btn-modal-connect {
      background: linear-gradient(135deg, var(--accent-cyan), #00b4d8);
      color: #000;
      border: none;
      padding: 0.45rem 1rem;
      border-radius: 6px;
      font-size: 0.82rem;
      font-weight: 800;
      font-family: var(--font-display);
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 0.35rem;
      transition: all 0.15s;
    }
    .btn-modal-connect:hover {
      filter: brightness(1.1);
      box-shadow: 0 0 14px rgba(0, 229, 255, 0.4);
    }

    /* Live Toast Notification */
    .live-toast-container {
      position: fixed;
      bottom: 24px;
      left: 50%;
      transform: translateX(-50%);
      z-index: 10000;
      display: flex;
      flex-direction: column;
      gap: 8px;
      pointer-events: none;
    }
    .live-toast {
      background: rgba(15, 23, 42, 0.94);
      color: #fff;
      border: 1px solid rgba(0, 229, 255, 0.35);
      box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
      backdrop-filter: blur(8px);
      padding: 0.55rem 1rem;
      border-radius: 8px;
      font-size: 0.82rem;
      font-weight: 600;
      display: inline-flex;
      align-items: center;
      gap: 0.45rem;
      animation: toastSlideUp 0.25s ease-out forwards;
      pointer-events: auto;
    }
    .live-toast.success { border-color: rgba(0, 230, 118, 0.5); color: #00e676; }
    .live-toast.warning { border-color: rgba(255, 171, 0, 0.5); color: #ffab00; }
    .live-toast.info { border-color: rgba(0, 229, 255, 0.5); color: var(--accent-cyan); }
    .live-toast.error { border-color: rgba(255, 51, 75, 0.6); color: #ff334b; }
    html[data-theme="light"] .live-toast {
      background: rgba(255, 255, 255, 0.96) !important;
      color: #0f172a !important;
      box-shadow: 0 8px 24px rgba(15, 23, 42, 0.15) !important;
    }
    html[data-theme="light"] .live-toast.success { border-color: rgba(16, 185, 129, 0.4) !important; color: #059669 !important; }
    html[data-theme="light"] .live-toast.warning { border-color: rgba(245, 158, 11, 0.4) !important; color: #d97706 !important; }
    html[data-theme="light"] .live-toast.info { border-color: rgba(2, 132, 199, 0.4) !important; color: #0284c7 !important; }
    html[data-theme="light"] .live-toast.error { border-color: rgba(239, 68, 68, 0.4) !important; color: #dc2626 !important; }
    @keyframes toastSlideUp {
      from { opacity: 0; transform: translateY(12px) scale(0.96); }
      to { opacity: 1; transform: translateY(0) scale(1); }
    }

    /* Screen Wake Lock Badge */
    .wakelock-badge {
      cursor: pointer;
      user-select: none;
      transition: all 0.2s ease;
      display: inline-flex;
      align-items: center;
      gap: 0.3rem;
      padding: 0.25rem 0.55rem;
      border-radius: var(--radius-sm, 6px);
      font-size: 0.75rem;
      font-weight: 700;
      font-family: inherit;
      outline: none;
    }

    .wakelock-badge.active {
      background: rgba(0, 230, 118, 0.14);
      border: 1px solid rgba(0, 230, 118, 0.45);
      color: #00e676;
      text-shadow: 0 0 8px rgba(0, 230, 118, 0.4);
    }

    .wakelock-badge.inactive {
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid rgba(255, 255, 255, 0.15);
      color: var(--text-dim, #888);
    }

    .wakelock-badge:hover {
      filter: brightness(1.2);
    }
