:root {
      --bg-dark: #070a10;
      --bg-card: #0d121c;
      --bg-card-hover: #131b2a;
      --bg-surface: #0a0e17;
      --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;
      --accent-purple: #e040fb;
      --accent-amber: #ff9100;
      --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;
      --radius-sm: 6px;
      --radius-md: 10px;
      --radius-lg: 16px;
    }

    html[data-theme="light"] {
      --bg-dark: #f1f5f9;
      --bg-card: #ffffff;
      --bg-card-hover: #f8fafc;
      --bg-surface: #e2e8f0;
      --border-subtle: rgba(0, 0, 0, 0.08);
      --border-focus: rgba(2, 132, 199, 0.35);
      --accent-cyan: #0284c7;
      --text-main: #0f172a;
      --text-muted: #475569;
      --text-dim: #94a3b8;
    }

    * {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
      -webkit-tap-highlight-color: transparent;
    }

    body {
      background: var(--bg-dark);
      color: var(--text-main);
      font-family: var(--font-main);
      min-height: 100vh;
      overflow-x: hidden;
      display: flex;
      flex-direction: column;
    }

    /* Ambient Background Track Glow */
    .bg-grid-overlay {
      position: fixed;
      inset: 0;
      background-image: 
        radial-gradient(ellipse 60% 50% at 50% -10%, rgba(0, 229, 255, 0.08), transparent 75%),
        linear-gradient(rgba(255, 255, 255, 0.015) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.015) 1px, transparent 1px);
      background-size: 100% 100%, 36px 36px, 36px 36px;
      pointer-events: none;
      z-index: 0;
    }

    /* Header Bar - Identical sleek styling to live.html */
    .live-header {
      position: relative;
      z-index: 50;
      background: rgba(7, 10, 16, 0.88);
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
      border-bottom: 1px solid var(--border-subtle);
      padding: 0.65rem 1.25rem;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 0.75rem;
    }

    html[data-theme="light"] .live-header {
      background: rgba(255, 255, 255, 0.92);
      border-bottom-color: rgba(0, 0, 0, 0.08);
    }

    .brand-wrap {
      display: flex;
      align-items: center;
      gap: 0.55rem;
      text-decoration: none;
      color: inherit;
    }

    .brand-logo-img {
      content: url('/v1/logo-light.png?v=7');
      height: 26px;
      width: auto;
      max-width: 110px;
      object-fit: contain;
      vertical-align: middle;
      filter: none;
    }

    html[data-theme="dark"] .brand-logo-img {
      background: rgba(255, 255, 255, 0.92);
      padding: 2px 6px;
      border-radius: 5px;
    }

    .brand-text {
      font-family: var(--font-display);
      font-weight: 800;
      font-size: 1.05rem;
      letter-spacing: 0.02em;
      color: var(--text-main);
    }

    .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-center-controls {
      display: flex;
      align-items: center;
      gap: 0.5rem;
    }

    .circuit-select-btn {
      display: inline-flex;
      align-items: center;
      gap: 0.5rem;
      min-width: 160px;
      min-height: 34px;
      padding: 0.35rem 0.85rem;
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid var(--border-subtle);
      border-radius: 9999px;
      color: var(--text-main);
      font-family: var(--font-display);
      font-size: 0.88rem;
      font-weight: 700;
      cursor: pointer;
      transition: all 0.2s ease;
    }

    html[data-theme="light"] .circuit-select-btn {
      background: #ffffff;
      border-color: rgba(0, 0, 0, 0.12);
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    }

    .circuit-select-btn:hover {
      border-color: var(--accent-cyan);
      background: rgba(0, 229, 255, 0.08);
      box-shadow: 0 0 12px rgba(0, 229, 255, 0.2);
    }

    .circuit-flag-icon {
      font-size: 1.05rem;
      line-height: 1;
    }

    .circuit-active-badge {
      font-family: var(--font-mono);
      font-size: 0.72rem;
      padding: 0.12rem 0.45rem;
      background: rgba(0, 229, 255, 0.15);
      color: var(--accent-cyan);
      border-radius: 9999px;
      font-weight: 800;
      letter-spacing: -0.02em;
    }

    .circuit-active-badge.live-active {
      background: rgba(255, 23, 68, 0.2);
      color: var(--accent-red);
      border: 1px solid rgba(255, 23, 68, 0.4);
    }

    .header-controls {
      display: flex;
      align-items: center;
      gap: 0.45rem;
    }

    .viewers-pill {
      display: inline-flex;
      align-items: center;
      gap: 0.35rem;
      font-size: 0.72rem;
      font-weight: 700;
      color: var(--text-muted);
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid var(--border-subtle);
      padding: 0.28rem 0.65rem;
      border-radius: 9999px;
      font-family: var(--font-mono);
    }

    html[data-theme="light"] .viewers-pill {
      background: #ffffff;
      border-color: rgba(0, 0, 0, 0.1);
    }

    .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;
    }

    html[data-theme="light"] .icon-btn {
      background: #ffffff;
      border-color: rgba(0, 0, 0, 0.1);
      color: var(--text-main);
    }

    .icon-btn:hover {
      background: rgba(255, 255, 255, 0.12);
      border-color: var(--accent-cyan);
      color: var(--accent-cyan);
    }

    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; }

    /* Main Grid Layout */
    .race-control-container {
      position: relative;
      z-index: 1;
      display: grid;
      grid-template-columns: minmax(0, 1fr) minmax(440px, 480px);
      gap: 1rem;
      padding: 1rem 1.25rem;
      flex: 1;
      min-height: 0;
    }

    @media (max-width: 1080px) {
      .race-control-container {
        grid-template-columns: minmax(0, 1fr);
        padding: 0.75rem;
        gap: 0.75rem;
      }
    }

    /* Track Radar Viewport */
    .track-viewport-card {
      background: var(--bg-card);
      border: 1px solid var(--border-subtle);
      border-radius: var(--radius-md);
      position: relative;
      display: flex;
      flex-direction: column;
      overflow: hidden;
      min-height: 480px;
      box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
    }

    .track-viewport-header {
      padding: 0.75rem 1rem;
      border-bottom: 1px solid var(--border-subtle);
      display: flex;
      align-items: center;
      justify-content: space-between;
      background: rgba(0, 0, 0, 0.2);
    }

    .tv-title {
      font-family: var(--font-display);
      font-size: 0.95rem;
      font-weight: 700;
      letter-spacing: 0.05em;
      color: var(--text-main);
      display: flex;
      align-items: center;
      gap: 0.5rem;
    }

    .tv-controls {
      display: flex;
      align-items: center;
      gap: 0.4rem;
    }

    .canvas-wrapper {
      position: relative;
      flex: 1;
      width: 100%;
      height: 100%;
      min-height: 400px;
      background: #05070c;
      overflow: hidden;
    }

    html[data-theme="light"] .canvas-wrapper {
      background: #eef2f6;
    }

    #radar-canvas {
      display: block;
      width: 100%;
      height: 100%;
      cursor: crosshair;
    }

    /* Floating Driver Telemetry Quick HUD */
    .floating-driver-hud {
      position: absolute;
      bottom: 1rem;
      left: 1rem;
      background: rgba(13, 18, 28, 0.88);
      backdrop-filter: blur(12px);
      border: 1px solid rgba(0, 229, 255, 0.4);
      border-radius: var(--radius-sm);
      padding: 0.75rem 1rem;
      display: none;
      min-width: 260px;
      z-index: 20;
      box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    }

    .fdh-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      border-bottom: 1px solid var(--border-subtle);
      padding-bottom: 0.4rem;
      margin-bottom: 0.5rem;
    }

    .fdh-driver-name {
      font-family: var(--font-display);
      font-weight: 800;
      font-size: 1rem;
      color: var(--accent-cyan);
    }

    .fdh-car-name {
      font-size: 0.75rem;
      color: var(--text-muted);
    }

    .fdh-metrics-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 0.5rem;
    }

    .fdh-metric-item {
      display: flex;
      flex-direction: column;
    }

    .fdh-label {
      font-size: 0.72rem;
      font-weight: 700;
      color: var(--text-dim);
      text-transform: uppercase;
    }

    .fdh-val {
      font-family: var(--font-mono);
      font-size: 0.95rem;
      font-weight: 800;
      color: var(--text-main);
    }

    /* Right Timing Tower Card */
    .timing-tower-card {
      background: var(--bg-card);
      border: 1px solid var(--border-subtle);
      border-radius: var(--radius-md);
      display: flex;
      flex-direction: column;
      overflow: hidden;
      box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
    }

    .tower-header {
      padding: 0.75rem 1rem;
      border-bottom: 1px solid var(--border-subtle);
      background: rgba(0, 0, 0, 0.2);
      display: flex;
      align-items: center;
      justify-content: space-between;
    }

    .tower-title {
      font-family: var(--font-display);
      font-size: 0.95rem;
      font-weight: 800;
      letter-spacing: 0.05em;
      color: var(--text-main);
      display: flex;
      align-items: center;
      gap: 0.5rem;
    }

    .tower-table-container {
      flex: 1;
      overflow-y: auto;
      max-height: calc(100vh - 170px);
      scrollbar-width: none; /* Firefox */
      -ms-overflow-style: none; /* IE and Edge */
    }

    .tower-table-container::-webkit-scrollbar {
      display: none; /* Chrome, Safari, Opera - completely hidden */
      width: 0;
      height: 0;
    }

    .timing-table {
      width: 100%;
      border-collapse: collapse;
      text-align: left;
      table-layout: auto;
    }

    .timing-table th {
      position: sticky;
      top: 0;
      background: var(--bg-surface);
      padding: 0.55rem 0.42rem;
      font-family: var(--font-display);
      font-size: 0.72rem;
      font-weight: 800;
      letter-spacing: 0.04em;
      color: var(--text-dim);
      text-transform: uppercase;
      border-bottom: 1px solid var(--border-subtle);
      white-space: nowrap;
      z-index: 5;
    }

    .timing-table th:first-child,
    .timing-table td:first-child {
      padding-left: 0.75rem;
    }

    .timing-table th:last-child,
    .timing-table td:last-child {
      padding-right: 0.85rem;
    }

    .timing-table td {
      padding: 0.6rem 0.42rem;
      border-bottom: 1px solid var(--border-subtle);
      font-size: 0.8rem;
      vertical-align: middle;
      white-space: nowrap;
      transition: background 0.15s;
    }

    .timing-row {
      cursor: pointer;
    }

    .timing-row:hover {
      background: var(--bg-card-hover);
    }

    .timing-row.selected {
      background: rgba(0, 229, 255, 0.12);
      border-left: 3px solid var(--accent-cyan);
    }

    .pos-badge {
      font-family: var(--font-display);
      font-weight: 800;
      font-size: 0.95rem;
      color: var(--text-muted);
      width: 24px;
      display: inline-block;
      text-align: center;
    }

    .timing-row:nth-child(1) .pos-badge { color: var(--accent-gold); font-size: 1.1rem; }
    .timing-row:nth-child(2) .pos-badge { color: #e2e8f0; }
    .timing-row:nth-child(3) .pos-badge { color: #cd7f32; }

    .driver-color-dot {
      width: 10px;
      height: 10px;
      border-radius: 50%;
      display: inline-block;
      margin-right: 0.4rem;
      vertical-align: middle;
      box-shadow: 0 0 6px currentColor;
    }

    .driver-meta-wrap {
      display: flex;
      flex-direction: column;
    }

    .driver-name-text {
      font-family: var(--font-main);
      font-weight: 700;
      font-size: 0.84rem;
      color: var(--text-main);
      display: flex;
      align-items: center;
      max-width: 125px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .time-mono {
      font-family: var(--font-mono);
      font-weight: 700;
      letter-spacing: -0.02em;
    }

    .time-best-purple {
      color: var(--accent-purple);
      font-weight: 800;
    }

    .time-current {
      color: var(--accent-cyan);
    }

    .status-pill {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 0.25rem;
      font-size: 0.72rem;
      font-weight: 800;
      padding: 0.1rem 0.32rem;
      border-radius: var(--radius-sm);
      text-transform: uppercase;
      white-space: nowrap;
    }

    .status-pill.on-track {
      background: rgba(0, 230, 118, 0.15);
      color: var(--accent-green);
      border: 1px solid rgba(0, 230, 118, 0.3);
    }

    .status-pill.in-pit {
      background: rgba(255, 145, 0, 0.15);
      color: var(--accent-amber);
      border: 1px solid rgba(255, 145, 0, 0.3);
    }

    .status-pill.standby {
      background: rgba(148, 163, 184, 0.14);
      color: var(--text-muted);
      border: 1px solid rgba(148, 163, 184, 0.28);
    }

    .status-pill.stopped {
      background: rgba(255, 23, 68, 0.2);
      color: #ff1744;
      border: 1px solid rgba(255, 23, 68, 0.55);
      animation: pulse-stopped 1.1s infinite ease-in-out;
    }

    @keyframes pulse-stopped {
      0%, 100% { opacity: 1; transform: scale(1); }
      50% { opacity: 0.55; transform: scale(0.97); }
    }

    .driver-layout-badge {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      font-size: 0.72rem;
      font-weight: 700;
      padding: 1px 5px;
      border-radius: 3px;
      background: rgba(0, 229, 255, 0.12);
      border: 1px solid rgba(0, 229, 255, 0.35);
      color: var(--accent-cyan);
      font-family: var(--font-mono);
      letter-spacing: 0.3px;
      white-space: nowrap;
      vertical-align: middle;
      line-height: 1.2;
    }
    html[data-theme="light"] .driver-layout-badge {
      background: rgba(2, 132, 199, 0.1);
      border-color: rgba(2, 132, 199, 0.35);
      color: #0284c7;
    }
    .driver-sim-badge {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      font-family: var(--font-mono, monospace);
      font-size: 0.72rem;
      font-weight: 800;
      letter-spacing: 0.5px;
      padding: 0.08rem 0.3rem;
      border-radius: var(--radius-sm);
      background: rgba(0, 229, 255, 0.15);
      color: var(--accent-cyan, #00e5ff);
      border: 1px solid rgba(0, 229, 255, 0.4);
      flex-shrink: 0;
      line-height: 1.15;
      vertical-align: middle;
      text-transform: uppercase;
    }

    html[data-theme="light"] .driver-sim-badge {
      background: rgba(2, 132, 199, 0.12);
      color: #0284c7;
      border: 1px solid rgba(2, 132, 199, 0.35);
    }

    /* Circuit Search Bar in Modal */
    .circuit-search-bar-wrap {
      padding: 0.85rem 1.25rem 0.5rem;
      border-bottom: 1px solid var(--border-subtle);
      background: rgba(0, 0, 0, 0.15);
    }

    html[data-theme="light"] .circuit-search-bar-wrap {
      background: #f8fafc;
    }

    .circuit-search-box {
      position: relative;
      display: flex;
      align-items: center;
      width: 100%;
    }

    .circuit-search-icon {
      position: absolute;
      left: 12px;
      width: 16px;
      height: 16px;
      color: var(--text-dim);
      pointer-events: none;
    }

    .circuit-search-input {
      width: 100%;
      height: 38px;
      padding: 0 2rem 0 2.3rem;
      font-size: 0.86rem;
      font-weight: 600;
      font-family: var(--font-main);
      color: var(--text-main);
      background: rgba(0, 0, 0, 0.35);
      border: 1px solid var(--border-subtle);
      border-radius: var(--radius-sm);
      outline: none;
      transition: all 0.2s ease;
    }

    html[data-theme="light"] .circuit-search-input {
      background: #ffffff;
      border-color: rgba(0, 0, 0, 0.15);
      color: #0f172a;
    }

    .circuit-search-input:focus {
      border-color: var(--accent-cyan);
      box-shadow: 0 0 10px rgba(0, 229, 255, 0.25);
      background: rgba(0, 0, 0, 0.5);
    }

    html[data-theme="light"] .circuit-search-input:focus {
      background: #ffffff;
      border-color: var(--accent-cyan);
    }

    .circuit-search-clear {
      position: absolute;
      right: 8px;
      width: 22px;
      height: 22px;
      display: flex;
      align-items: center;
      justify-content: center;
      background: none;
      border: none;
      color: var(--text-dim);
      font-size: 0.8rem;
      cursor: pointer;
      border-radius: 50%;
    }

    .circuit-search-clear:hover {
      color: var(--accent-cyan);
    }

    .modal-group-label {
      padding: 0.4rem 0.65rem 0.2rem;
      font-family: var(--font-display);
      font-size: 0.72rem;
      font-weight: 800;
      letter-spacing: 0.06em;
      color: var(--text-dim);
      text-transform: uppercase;
      display: flex;
      align-items: center;
      gap: 0.4rem;
    }

    .modal-group-label.live-active {
      color: var(--accent-red);
    }

    .circuit-option-card.live-glow {
      border-color: rgba(255, 23, 68, 0.4);
      background: rgba(255, 23, 68, 0.06);
      box-shadow: 0 0 14px rgba(255, 23, 68, 0.12);
    }

    .circuit-option-card.live-glow:hover {
      border-color: var(--accent-red);
      background: rgba(255, 23, 68, 0.12);
    }

    /* Circuit Dropdown Modal / Drawer */
    .circuit-modal-overlay {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.75);
      backdrop-filter: blur(8px);
      z-index: 100;
      display: none;
      align-items: center;
      justify-content: center;
      padding: 1rem;
    }

    .circuit-modal-overlay.active {
      display: flex;
    }

    .circuit-modal-box {
      background: var(--bg-card);
      border: 1px solid var(--border-subtle);
      border-radius: var(--radius-lg);
      width: 100%;
      max-width: 580px;
      max-height: 80vh;
      display: flex;
      flex-direction: column;
      box-shadow: 0 25px 60px rgba(0, 0, 0, 0.7);
      overflow: hidden;
    }

    .circuit-modal-header {
      padding: 1rem 1.25rem;
      border-bottom: 1px solid var(--border-subtle);
      display: flex;
      align-items: center;
      justify-content: space-between;
    }

    .circuit-cards-list {
      padding: 1rem 1.25rem;
      overflow-y: auto;
      display: flex;
      flex-direction: column;
      gap: 0.65rem;
    }

    .circuit-option-card {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0.85rem 1rem;
      background: var(--bg-surface);
      border: 1px solid var(--border-subtle);
      border-radius: var(--radius-sm);
      cursor: pointer;
      transition: all 0.15s ease;
    }

    .circuit-option-card:hover {
      border-color: var(--accent-cyan);
      background: var(--bg-card-hover);
      transform: translateY(-1px);
    }

    .circuit-option-card.active {
      border-color: var(--accent-cyan);
      background: rgba(0, 229, 255, 0.08);
    }

    .coc-info {
      display: flex;
      align-items: center;
      gap: 0.75rem;
      min-width: 0;
      flex: 1;
    }

    .coc-name {
      font-family: var(--font-display);
      font-weight: 700;
      font-size: 0.95rem;
      color: var(--text-main);
    }

    .coc-meta {
      font-size: 0.75rem;
      color: var(--text-dim);
    }

    .empty-state-notice {
      padding: 2.25rem 1rem;
      text-align: center;
      color: var(--text-dim);
      font-size: 0.86rem;
      line-height: 1.55;
    }

    .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;
    }

    .close-rc-btn:hover {
      background: rgba(255, 23, 68, 0.22);
      border-color: var(--accent-red);
    }

    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-rc-btn:hover {
      background: rgba(225, 29, 72, 0.22) !important;
      border-color: #e11d48 !important;
      color: #e11d48 !important;
    }

    .track-empty-overlay {
      position: absolute;
      inset: 0;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      text-align: center;
      padding: 1.25rem;
      z-index: 10;
      pointer-events: none;
    }

    .teo-icon-wrap {
      width: 48px;
      height: 48px;
      border-radius: 50%;
      background: rgba(0, 229, 255, 0.08);
      border: 1px solid var(--border-subtle);
      color: var(--accent-cyan);
      display: flex;
      align-items: center;
      justify-content: center;
      margin-bottom: 0.75rem;
    }

    .teo-title {
      font-family: var(--font-display);
      font-weight: 800;
      font-size: 0.96rem;
      letter-spacing: 0.05em;
      color: var(--text-main);
      margin-bottom: 0.35rem;
    }

    .teo-desc {
      font-size: 0.8rem;
      color: var(--text-dim);
      max-width: 360px;
      line-height: 1.5;
    }

    /* Mobile Optimization */
    @media (max-width: 768px) {
      .live-header {
        flex-wrap: wrap;
        padding: max(0.5rem, env(safe-area-inset-top)) 0.75rem 0.5rem;
        gap: 0.45rem;
      }

      .brand-wrap {
        gap: 0.35rem;
      }

      .brand-logo-img {
        height: 22px;
      }

      .brand-text {
        font-size: 0.92rem;
      }

      .brand-rc-title {
        font-size: 0.75rem !important;
      }

      .brand-live-badge {
        font-size: 0.72rem;
        padding: 0.08rem 0.3rem;
        gap: 0.22rem;
      }

      .header-controls {
        margin-left: auto;
        gap: 0.32rem;
      }

      .viewers-pill {
        font-size: 0.72rem;
        padding: 0.22rem 0.5rem;
      }

      .icon-btn {
        width: 30px;
        height: 30px;
      }

      .close-rc-btn {
        height: 30px;
        padding: 0 0.52rem;
        font-size: 0.72rem;
      }

      #fullscreen-toggle-btn {
        display: none;
      }

      .teo-icon-wrap {
        width: 38px;
        height: 38px;
        margin-bottom: 0.5rem;
      }

      .teo-title {
        font-size: 0.84rem;
      }

      .teo-desc {
        font-size: 0.74rem;
        max-width: 290px;
      }

      .header-center-controls {
        order: 3;
        width: 100%;
      }

      .circuit-select-btn {
        width: 100%;
        min-height: 36px;
        padding: 0.35rem 0.75rem;
        border-radius: 8px;
        font-size: 0.84rem;
        justify-content: space-between;
      }

      #active-circuit-name {
        flex: 1;
        text-align: left;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
      }

      .race-control-container {
        display: flex;
        flex-direction: column;
        padding: 0.5rem;
        gap: 0.5rem;
      }

      .track-viewport-card {
        min-height: 235px;
        flex-shrink: 0;
      }

      .track-viewport-header,
      .tower-header {
        padding: 0.5rem 0.75rem;
      }

      .tv-title,
      .tower-title {
        font-size: 0.82rem;
        gap: 0.4rem;
      }

      .canvas-wrapper {
        min-height: 200px;
        height: 33dvh;
        max-height: 265px;
      }

      .floating-driver-hud {
        left: 0.5rem;
        right: 0.5rem;
        bottom: 0.5rem;
        min-width: 0;
        padding: 0.5rem 0.65rem;
      }

      .fdh-header {
        padding-bottom: 0.25rem;
        margin-bottom: 0.35rem;
      }

      .fdh-driver-name {
        font-size: 0.85rem;
      }

      .fdh-metrics-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 0.35rem;
      }

      .fdh-label {
        font-size: 0.72rem;
      }

      .fdh-val {
        font-size: 0.76rem;
      }

      .timing-tower-card {
        flex: 1;
        min-height: 220px;
      }

      .tower-table-container {
        max-height: none;
        overflow-x: auto;
      }

      .timing-table th {
        padding: 0.45rem 0.2rem;
        font-size: 0.72rem;
      }

      .timing-table td {
        padding: 0.48rem 0.26rem;
        font-size: 0.73rem;
      }

      .timing-table th:first-child,
      .timing-table td:first-child {
        padding-left: 0.45rem;
        width: 26px !important;
      }

      .timing-table th:last-child,
      .timing-table td:last-child {
        padding-right: 0.45rem;
        width: 64px !important;
      }

      .pos-badge {
        font-size: 0.82rem;
        width: 18px;
      }

      .timing-row:nth-child(1) .pos-badge {
        font-size: 0.92rem;
      }

      .driver-color-dot {
        width: 8px;
        height: 8px;
        margin-right: 0.28rem;
      }

      .driver-name-text {
        font-size: 0.76rem;
        max-width: 88px;
      }

      .status-pill {
        font-size: 0.72rem;
        padding: 0.08rem 0.28rem;
      }

      .circuit-modal-overlay {
        padding: 0.5rem;
        align-items: flex-end;
      }

      .circuit-modal-box {
        max-height: 85dvh;
        border-radius: 14px 14px 10px 10px;
      }

      .circuit-modal-header {
        padding: 0.8rem 1rem;
      }

      .circuit-search-bar-wrap {
        padding: 0.65rem 1rem 0.45rem;
      }

      .circuit-search-input {
        font-size: 16px;
      }

      .circuit-cards-list {
        padding: 0.75rem 1rem;
        gap: 0.5rem;
      }

      .circuit-option-card {
        padding: 0.65rem 0.75rem;
      }

      .coc-name {
        font-size: 0.85rem;
      }

      .coc-meta {
        font-size: 0.72rem;
      }
    }

    @media (max-width: 390px) {
      .brand-text {
        display: none;
      }

      .brand-divider {
        display: none;
      }

      .timing-table td {
        font-size: 0.72rem;
        padding: 0.44rem 0.2rem;
      }

      .driver-name-text {
        max-width: 70px;
        font-size: 0.72rem;
      }
    }

    /* 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);
    }
