/* --- 1. CSS DESIGN SYSTEM & TOKENS (High-Contrast Motorsport Theme) --- */

    :root {
      --bg-main: #070a10;
      --bg-surface: #0e131d;
      --bg-card: rgba(18, 24, 38, 0.78);
      --bg-card-hover: rgba(26, 34, 52, 0.9);
      --bg-glass: rgba(14, 20, 32, 0.65);
      --border-subtle: rgba(255, 255, 255, 0.08);
      --border-bright: rgba(255, 255, 255, 0.18);
      /* Motorsport Accent Colors */
      --accent-red: #ff2a4b;         /* APEX Red */
      --accent-cyan: #00f0ff;        /* Telemetry & GPS Cyan */
      --accent-green: #00e676;       /* Podium Green / Lap Best / GO */
      --accent-amber: #ffb300;       /* Pit Amber / Caution */
      --accent-purple: #b388ff;      /* Sector 3 Purple */
      --text-main: #f8fafc;
      --text-light: #f8fafc;
      --text-muted: #94a3b8;
      --text-dim: #64748b;
      --font-display: 'Chakra Petch', 'Noto Sans KR', sans-serif;
      --font-timer: 'Roboto Mono', 'SF Mono', Consolas, 'Share Tech Mono', monospace;
      --font-mono: 'Roboto Mono', 'SF Mono', Consolas, 'Share Tech Mono', monospace;
      --font-sans: 'Inter', 'Noto Sans KR', sans-serif;
      --radius-sm: 6px;
      --radius-md: 10px;
      --radius-lg: 16px;
      --radius-xl: 22px;
      --radius-full: 9999px;
      --transition-fast: 0.15s ease;
      --transition-normal: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    }

    * {
      box-sizing: border-box;
      margin: 0;
      padding: 0;
      -webkit-tap-highlight-color: transparent;
    }

    html {
      width: 100%;
      max-width: 100%;
      overflow-x: hidden;
      position: relative;
      -webkit-text-size-adjust: 100%;
      scroll-behavior: smooth;
    }

    body {
      width: 100%;
      max-width: 100%;
      background-color: var(--bg-main);
      color: var(--text-main);
      font-family: var(--font-sans);
      font-size: 15px;
      line-height: 1.5;
      min-height: 100vh;
      min-height: 100dvh;
      overflow-x: hidden;
      position: relative;
      background-image: 
        radial-gradient(ellipse at 50% 0%, rgba(0, 240, 255, 0.06) 0%, transparent 60%),
        radial-gradient(circle at 85% 15%, rgba(255, 42, 75, 0.05) 0%, transparent 45%);
      background-attachment: fixed;
    }

    body.modal-open {
      overflow: hidden !important;
      touch-action: none;
    }

    /* Scrollbars */

    ::-webkit-scrollbar { width: 6px; height: 6px; }

    ::-webkit-scrollbar-track { background: var(--bg-main); }

    ::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.15); border-radius: 4px; }

    ::-webkit-scrollbar-thumb:hover { background: var(--accent-cyan); }

        /* --- 2. TOPBAR & NAVIGATION --- */

    .topbar {
      position: sticky;
      top: 0;
      z-index: 100;
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: max(0.65rem, env(safe-area-inset-top)) 1.25rem 0.65rem;
      background: rgba(7, 10, 16, 0.88);
      backdrop-filter: blur(18px);
      -webkit-backdrop-filter: blur(18px);
      border-bottom: 1px solid var(--border-subtle);
      gap: 0.75rem;
    }

    .brand-cluster {
      display: flex;
      align-items: center;
      gap: 0.6rem;
      text-decoration: none;
      cursor: pointer;
      flex-shrink: 0;
    }

            .brand-logo-img {
      height: 26px;
      width: auto;
      max-width: 110px;
      object-fit: contain;
      filter: drop-shadow(0 0 8px rgba(0, 240, 255, 0.35));
    }
    .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));
    }.brand-text {

      display: flex;

      flex-direction: column;

    }

    .brand-title {
      font-family: var(--font-display);
      font-size: 1.15rem;
      font-weight: 900;
      letter-spacing: 0.5px;
      color: #fff;
      display: flex;
      align-items: center;
      gap: 0.35rem;
      line-height: 1.15;
    }
    .brand-badge {
      background: var(--accent-red);
      color: #fff;
      font-size: 0.72rem;
      font-weight: 900;
      padding: 0.08rem 0.32rem;
      border-radius: var(--radius-full);
      font-family: 'Roboto Mono', 'SF Mono', Consolas, 'Share Tech Mono', monospace !important;
      letter-spacing: 0.5px;
      line-height: normal;
    }

    .brand-subtitle {
      font-size: 0.72rem;
      color: var(--text-muted);
      letter-spacing: 0.2px;
    }

    @media (max-width: 1450px) {
      .brand-subtitle { display: none !important; }
      .nav-tab-btn { padding: 0.45rem 0.6rem !important; font-size: 0.82rem !important; gap: 0.35rem !important; }
      .nav-tabs-desktop { gap: 0.2rem !important; }
    }

    /* Desktop Navigation Tabs */

    .nav-tabs-desktop {
      display: flex;
      align-items: center;
      gap: 0.35rem;
      background: rgba(255, 255, 255, 0.04);
      padding: 0.25rem;
      border-radius: var(--radius-md);
      border: 1px solid var(--border-subtle);
    }

    .nav-tab-btn {
      display: inline-flex;
      text-decoration: none !important;
      align-items: center;
      justify-content: center;
      gap: 0.45rem;
      padding: 0.45rem 0.85rem;
      border-radius: var(--radius-sm);
      font-family: var(--font-display) !important;
      font-size: 0.88rem !important;
      font-weight: 700 !important;
      line-height: normal !important;
      color: var(--text-muted);
      background: transparent;
      border: 1px solid transparent;
      cursor: pointer;
      transition: all var(--transition-fast);
      white-space: nowrap;
      text-decoration: none !important;
      box-sizing: border-box;
      outline: none;
      vertical-align: middle;
      -webkit-appearance: none;
      appearance: none;
    }

    .nav-tab-btn:hover {
      color: #fff !important;
      background: rgba(255, 255, 255, 0.06) !important;
      text-decoration: none !important;
    }

    .nav-tab-btn.active {
      color: #fff !important;
      background: linear-gradient(135deg, rgba(0, 240, 255, 0.2), rgba(255, 42, 75, 0.2)) !important;
      border: 1px solid var(--accent-cyan) !important;
      box-shadow: 0 0 16px rgba(0, 240, 255, 0.25) !important;
      text-decoration: none !important;
    }

    .nav-tab-btn i,
    .nav-tab-btn svg {
      width: 16px;
      height: 16px;
      flex-shrink: 0;
    }

    .nav-tab-btn span {
      line-height: normal;
    }

    .topbar-actions {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      flex-shrink: 0;
    }

    /* Buttons */

    .btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 0.4rem;
      padding: 0.5rem 0.9rem;
      border-radius: var(--radius-sm);
      font-family: var(--font-display);
      font-size: 0.85rem;
      font-weight: 700;
      border: 1px solid transparent;
      cursor: pointer;
      transition: all var(--transition-fast);
      text-decoration: none;
      white-space: nowrap;
      min-height: 38px;
      touch-action: manipulation;
      user-select: none;
      -webkit-user-select: none;
    }

    .btn > * {
      pointer-events: none;
    }

    .btn:active {
      transform: scale(0.96);
    }

    .btn-primary {
      background: linear-gradient(135deg, var(--accent-red), #d61f3d);
      color: #fff;
      border-color: rgba(255, 42, 75, 0.5);
      box-shadow: 0 4px 14px rgba(255, 42, 75, 0.35);
    }

    .btn-primary:hover {
      background: linear-gradient(135deg, #ff4763, #ff2a4b);
      box-shadow: 0 6px 20px rgba(255, 42, 75, 0.5);
    }

    .btn-cyan {
      background: linear-gradient(135deg, rgba(0, 240, 255, 0.2), rgba(0, 240, 255, 0.08));
      color: var(--accent-cyan);
      border-color: rgba(0, 240, 255, 0.45);
    }

    .btn-cyan:hover {
      background: rgba(0, 240, 255, 0.25);
      box-shadow: 0 0 16px rgba(0, 240, 255, 0.3);
    }

    .btn-amber {
      background: linear-gradient(135deg, rgba(255, 179, 0, 0.25), rgba(255, 179, 0, 0.1));
      color: var(--accent-amber);
      border-color: rgba(255, 179, 0, 0.45);
    }

    .btn-amber:hover {
      background: rgba(255, 179, 0, 0.32);
      box-shadow: 0 0 16px rgba(255, 179, 0, 0.35);
    }

    .btn-outline {
      background: rgba(255, 255, 255, 0.05);
      color: #f1f5f9;
      border-color: var(--border-subtle);
    }

    .btn-outline:hover {
      background: rgba(255, 255, 255, 0.1);
      border-color: var(--border-bright);
    }

    .btn-sm {
      padding: 0.35rem 0.65rem;
      font-size: 0.78rem;
      min-height: 32px;
    }

    /* Social Login Buttons & Divider */

    .btn-social {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 0.5rem;
      width: 100%;
      min-height: 44px;
      padding: 0.65rem 1rem;
      border-radius: var(--radius-sm);
      font-size: 0.88rem;
      font-weight: 600;
      cursor: pointer;
      transition: filter 0.15s ease, transform 0.15s ease;
      border: none;
      outline: none;
      user-select: none;
      box-sizing: border-box;
      text-decoration: none;
    }

    .btn-social:hover {
      filter: brightness(0.95);
      transform: translateY(-1px);
    }

    .btn-social:active {
      transform: translateY(0);
    }

    .btn-social-kakao {
      background-color: #FEE500;
      color: #191919;
    }

    .btn-social-google {
      background-color: #FFFFFF;
      color: #3c4043;
      border: 1px solid rgba(0, 0, 0, 0.15);
    }

    /* Passkey Social Button & Signup Box Base Styles */
    .btn-passkey-social {
      background: linear-gradient(135deg, rgba(16, 185, 129, 0.22), rgba(0, 240, 255, 0.18));
      border: 1px solid rgba(16, 185, 129, 0.7);
      color: #ffffff;
      font-weight: 700;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 0.5rem;
      box-shadow: 0 0 12px rgba(16, 185, 129, 0.25);
      cursor: pointer;
    }
    .btn-passkey-social svg {
      stroke: #10b981;
    }
    .btn-passkey-social:hover {
      background: linear-gradient(135deg, rgba(16, 185, 129, 0.32), rgba(0, 240, 255, 0.28));
      border-color: rgba(16, 185, 129, 0.9);
    }
    .auth-passkey-signup-box {
      margin-bottom: 0.75rem;
      padding: 0.65rem 0.75rem;
      background: rgba(16, 185, 129, 0.12);
      border: 1px solid rgba(16, 185, 129, 0.45);
      border-radius: var(--radius-sm);
      text-align: center;
    }
    .auth-passkey-signup-title {
      font-size: 0.78rem;
      color: #ffffff;
      margin-bottom: 0.45rem;
      font-weight: 700;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 4px;
    }
    .auth-passkey-signup-title i,
    .auth-passkey-signup-title svg {
      width: 13px;
      height: 13px;
      color: #10b981;
    }
    #btn-passkey-signup {
      width: 100%;
      height: 34px;
      background: #10b981;
      color: #042f2e;
      font-weight: 800;
      font-size: 0.82rem;
      border: none;
      border-radius: var(--radius-sm);
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 0.4rem;
      cursor: pointer;
      box-shadow: 0 0 12px rgba(16, 185, 129, 0.35);
    }
    #btn-passkey-signup i,
    #btn-passkey-signup svg {
      width: 15px;
      height: 15px;
    }
    #btn-passkey-signup:hover {
      filter: brightness(1.08);
    }


    .auth-divider {
      display: flex;
      align-items: center;
      text-align: center;
      margin: 0.85rem 0;
      color: var(--text-muted);
      font-size: 0.75rem;
    }

    .auth-divider::before,

    .auth-divider::after {
      content: '';
      flex: 1;
      border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    }

    .auth-divider span {
      padding: 0 0.65rem;
    }

    .user-pill {
      display: inline-flex;
      align-items: center;
      gap: 0.45rem;
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid var(--border-subtle);
      border-radius: var(--radius-full);
      padding: 0.22rem 0.65rem 0.22rem 0.25rem;
      cursor: pointer;
      transition: all var(--transition-fast);
      min-height: 32px;
      white-space: nowrap;
      flex-shrink: 0;
      flex-wrap: nowrap;
      line-height: 1;
    }

    .user-pill:hover {
      border-color: var(--accent-cyan);
      background: rgba(0, 240, 255, 0.08);
    }

    .user-avatar-badge {
      width: 26px;
      height: 26px;
      min-width: 26px;
      border-radius: var(--radius-full);
      background: linear-gradient(135deg, var(--accent-cyan), var(--accent-red));
      color: #fff;
      font-family: var(--font-display);
      font-size: 0.72rem;
      font-weight: 900;
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      line-height: 1;
    }

    .user-name-text {
      font-size: 0.8rem;
      font-weight: 600;
      color: #fff;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      max-width: 120px;
      display: inline-block;
      line-height: 1.2;
      vertical-align: middle;
    }

        /* --- 3. MAIN CONTAINER & VIEWS --- */

    .app-container {
      max-width: 1280px;
      margin: 0 auto;
      padding: 1.25rem;
      padding-bottom: 1.5rem; /* Clean tight spacing before footer */
    }

    .tab-view {
      display: none;
      animation: fadeIn 0.22s ease;
    }

    .tab-view.active {
      display: block;
    }

    /* Instant Zero-Flicker Routing Preload Rules */
    html.tab-preload-lap-timer #view-sessions { display: none !important; }
    html.tab-preload-lap-timer #view-lap-timer { display: block !important; }
    html.tab-preload-pit-timer #view-sessions { display: none !important; }
    html.tab-preload-pit-timer #view-pit-timer { display: block !important; }
    html.tab-preload-rank #view-sessions { display: none !important; }
    html.tab-preload-rank #view-rank { display: block !important; }

    @keyframes fadeIn {
      from { opacity: 0; transform: translateY(4px); }

      to { opacity: 1; transform: translateY(0); }

    }

    @keyframes slideInFromRight {
      from { opacity: 0.6; transform: translateX(28px); }
      to { opacity: 1; transform: translateX(0); }
    }

    @keyframes slideInFromLeft {
      from { opacity: 0.6; transform: translateX(-28px); }
      to { opacity: 1; transform: translateX(0); }
    }

    .slide-in-right {
      animation: slideInFromRight 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
    }

    .slide-in-left {
      animation: slideInFromLeft 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
    }

    /* Section Headers */

    .section-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 1.15rem;
      flex-wrap: wrap;
      gap: 0.65rem;
    }

    .section-title {
      font-family: var(--font-display);
      font-size: 1.35rem;
      font-weight: 800;
      color: #fff;
      display: flex;
      align-items: center;
      gap: 0.45rem;
      letter-spacing: 0.3px;
    }

    .section-subtitle {
      font-size: 0.8rem;
      color: var(--text-muted);
      margin-top: 0.15rem;
    }

        /* --- LIVE TEAM TELEMETRY & TIMING SUITE SHOWCASE BANNER --- */
    .live-telemetry-feature-card {
      position: relative;
      background: linear-gradient(135deg, rgba(15, 23, 42, 0.94) 0%, rgba(7, 10, 16, 0.98) 100%);
      border: 1px solid rgba(0, 240, 255, 0.3);
      border-radius: var(--radius-lg);
      padding: 1.25rem 1.4rem;
      margin-top: 1.5rem;
      margin-bottom: 1.5rem;
      box-shadow: 0 10px 32px rgba(0, 0, 0, 0.65), 0 0 24px rgba(0, 240, 255, 0.08);
      backdrop-filter: blur(20px);
      -webkit-backdrop-filter: blur(20px);
      overflow: hidden;
      transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    }

    .live-telemetry-feature-card:hover {
      border-color: rgba(0, 240, 255, 0.5);
      box-shadow: 0 14px 40px rgba(0, 0, 0, 0.75), 0 0 32px rgba(0, 240, 255, 0.15);
    }

    .ltf-glow-edge {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      height: 2px;
      background: linear-gradient(90deg, transparent, var(--accent-cyan), var(--accent-red), transparent);
      opacity: 0.9;
    }

    .ltf-header {
      margin-bottom: 1rem;
    }

    .ltf-title-group {
      width: 100%;
    }

    .ltf-badge {
      display: inline-flex;
      align-items: center;
      gap: 0.45rem;
      background: rgba(255, 42, 75, 0.12);
      border: 1px solid rgba(255, 42, 75, 0.45);
      padding: 0.2rem 0.6rem;
      border-radius: var(--radius-full);
      font-family: var(--font-mono);
      font-size: 0.72rem;
      font-weight: 800;
      color: #ff4d6d;
      letter-spacing: 0.06em;
      margin-bottom: 0.45rem;
    }

    .ltf-pulse-dot {
      width: 7px;
      height: 7px;
      background: var(--accent-red);
      border-radius: 50%;
      box-shadow: 0 0 8px var(--accent-red);
      animation: ltf-pulse 1.6s infinite ease-in-out;
    }

    @keyframes ltf-pulse {
      0%, 100% { opacity: 1; transform: scale(1); }
      50% { opacity: 0.35; transform: scale(0.75); }
    }

    .ltf-main-title {
      font-family: var(--font-display);
      font-size: 1.2rem;
      font-weight: 800;
      color: #fff;
      letter-spacing: -0.01em;
      margin: 0 0 0.35rem 0;
      line-height: 1.35;
    }

    .ltf-description {
      font-size: 0.84rem;
      color: #94a3b8;
      line-height: 1.55;
      margin: 0;
    }

    .ltf-features-grid {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 0.75rem;
      padding-top: 0.85rem;
      border-top: 1px solid rgba(255, 255, 255, 0.08);
    }

    .ltf-feat-item {
      display: flex;
      gap: 0.65rem;
      align-items: flex-start;
      background: rgba(10, 15, 26, 0.55);
      padding: 0.75rem 0.85rem;
      border-radius: var(--radius-sm);
      border: 1px solid rgba(255, 255, 255, 0.05);
    }

    .ltf-feat-icon {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 32px;
      height: 32px;
      border-radius: var(--radius-sm);
      flex-shrink: 0;
    }

    .ltf-feat-icon i,
    .ltf-feat-icon svg {
      width: 17px;
      height: 17px;
    }

    .ltf-feat-content h4 {
      font-family: var(--font-display);
      font-size: 0.84rem;
      font-weight: 700;
      color: #f1f5f9;
      margin: 0 0 0.25rem 0;
      letter-spacing: 0.01em;
    }

    .ltf-feat-content p {
      font-size: 0.75rem;
      color: #94a3b8;
      line-height: 1.45;
      margin: 0;
    }

    /* Live Telemetry Screenshots Gallery */
    .ltf-gallery {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 1rem;
      margin-top: 1rem;
      padding-top: 1rem;
      border-top: 1px solid rgba(255, 255, 255, 0.08);
    }

    .ltf-gallery-item {
      display: flex;
      flex-direction: column;
      background: rgba(10, 15, 26, 0.6);
      border: 1px solid rgba(255, 255, 255, 0.08);
      border-radius: var(--radius-md);
      overflow: hidden;
      transition: transform var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
    }

    .ltf-gallery-item:hover {
      border-color: rgba(0, 240, 255, 0.4);
      transform: translateY(-2px);
      box-shadow: 0 10px 24px rgba(0, 0, 0, 0.6);
    }

    .ltf-gallery-img-wrap {
      position: relative;
      width: 100%;
      background: #05080e;
      display: flex;
      justify-content: center;
      align-items: center;
      padding: 0.85rem 0.6rem;
    }

    .ltf-gallery-img {
      width: 100%;
      max-width: 360px;
      height: auto;
      display: block;
      object-fit: contain;
      border-radius: var(--radius-md);
      box-shadow: 0 8px 28px rgba(0, 0, 0, 0.85), 0 0 1px rgba(255, 255, 255, 0.25);
    }

    .ltf-gallery-badge {
      position: absolute;
      top: 0.6rem;
      left: 0.6rem;
      display: inline-flex;
      align-items: center;
      gap: 0.35rem;
      padding: 0.2rem 0.55rem;
      border-radius: var(--radius-full);
      font-family: var(--font-mono);
      font-size: 0.72rem;
      font-weight: 800;
      letter-spacing: 0.05em;
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      z-index: 2;
    }

    .ltf-gallery-badge.pitwall {
      background: rgba(255, 42, 75, 0.85);
      color: #fff;
      box-shadow: 0 2px 8px rgba(255, 42, 75, 0.4);
    }

    .ltf-gallery-badge.cockpit {
      background: rgba(0, 240, 255, 0.85);
      color: #070a10;
      box-shadow: 0 2px 8px rgba(0, 240, 255, 0.4);
    }

    .ltf-gallery-badge i,
    .ltf-gallery-badge svg {
      width: 12px;
      height: 12px;
    }

    .ltf-gallery-caption {
      padding: 0.85rem 1rem;
      background: rgba(7, 10, 16, 0.7);
      border-top: 1px solid rgba(255, 255, 255, 0.05);
    }

    .ltf-gallery-caption h5 {
      font-family: var(--font-display);
      font-size: 0.88rem;
      font-weight: 700;
      color: #f1f5f9;
      margin: 0 0 0.25rem 0;
    }

    .ltf-gallery-caption p {
      font-size: 0.76rem;
      color: #94a3b8;
      line-height: 1.45;
      margin: 0;
    }

    @media (max-width: 900px) {
      .ltf-features-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
      }
    }

    @media (max-width: 768px) {
      .ltf-gallery {
        grid-template-columns: 1fr;
        gap: 1.25rem;
      }
      .ltf-gallery-img {
        max-width: 320px;
      }
    }

    /* Mobile Quick Stats Banner */

    .mobile-stats-banner {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 0.5rem;
      margin-bottom: 1rem;
    }

    .stat-banner-card {
      background: var(--bg-card);
      border: 1px solid var(--border-subtle);
      border-radius: var(--radius-md);
      padding: 0.65rem 0.5rem;
      text-align: center;
      position: relative;
      min-width: 0;
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: center;
    }

    a.stat-banner-card.stat-card-link {
      display: flex;
      text-decoration: none;
      color: inherit;
      cursor: pointer;
      transition: all 0.2s ease;
    }

    a.stat-banner-card.stat-card-link:hover,
    a.stat-banner-card.stat-card-link:active {
      border-color: var(--accent-cyan);
      background: rgba(0, 229, 255, 0.06);
      transform: translateY(-1px);
    }

    .stat-live-dot {
      display: inline-block;
      width: 6px;
      height: 6px;
      border-radius: 50%;
      background: var(--accent-green);
      box-shadow: 0 0 6px var(--accent-green);
      margin-right: 3px;
      vertical-align: middle;
      flex-shrink: 0;
    }

    .stat-live-dot.on-air {
      background: var(--accent-red);
      box-shadow: 0 0 6px var(--accent-red);
    }

    .stat-banner-label {
      font-size: 0.72rem;
      font-family: var(--font-display);
      text-transform: uppercase;
      color: var(--text-dim);
      letter-spacing: 0.2px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      max-width: 100%;
      line-height: 1.3;
    }

    .stat-banner-val {
      font-family: var(--font-mono);
      font-size: 1.15rem;
      font-weight: 800;
      color: #fff;
      margin-top: 0.15rem;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      max-width: 100%;
      line-height: 1.25;
    }

        /* --- 4. SESSION LOGS TAB COMPONENTS --- */

    .filter-chips-cluster {
      display: flex;
      align-items: center;
      gap: 0.4rem;
      overflow-x: auto;
      overscroll-behavior-x: contain;
      padding-bottom: 0.5rem;
      margin-bottom: 1rem;
      scrollbar-width: none;
      -webkit-overflow-scrolling: touch;
      touch-action: pan-x pan-y;
      width: 100%;
      max-width: 100%;
    }

    .filter-chips-cluster::-webkit-scrollbar { display: none; }

    .filter-chip {
      padding: 0.4rem 0.85rem;
      border-radius: var(--radius-full);
      font-size: 0.8rem;
      font-weight: 600;
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid var(--border-subtle);
      color: var(--text-muted);
      cursor: pointer;
      white-space: nowrap;
      transition: all var(--transition-fast);
      min-height: 34px;
      flex-shrink: 0;
    }

    .filter-chip:hover {
      color: #fff;
      background: rgba(255, 255, 255, 0.09);
    }

    .filter-chip.active {
      background: rgba(0, 240, 255, 0.18);
      color: var(--accent-cyan);
      border-color: var(--accent-cyan);
      box-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
    }

    /* Session Card Grid */

    .sessions-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
      gap: 1rem;
    }

    .session-card {
      background: var(--bg-card);
      border: 1px solid var(--border-subtle);
      border-radius: var(--radius-md);
      padding: 1.1rem;
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      transition: all var(--transition-normal);
      display: flex;
      flex-direction: column;
      gap: 0.85rem;
      position: relative;
      overflow: hidden;
    }

    .session-card:hover {
      border-color: rgba(0, 240, 255, 0.4);
      background: var(--bg-card-hover);
      transform: translateY(-2px);
      box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 240, 255, 0.1);
    }

    .session-card::before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      width: 4px;
      height: 100%;
      background: linear-gradient(180deg, var(--accent-red), var(--accent-cyan));
    }

    .session-card-header {
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      gap: 0.6rem;
    }

    .session-track-name {
      font-family: var(--font-display);
      font-size: 1.05rem;
      font-weight: 700;
      color: #fff;
      display: flex;
      align-items: center;
      gap: 0.4rem;
      flex-wrap: nowrap;
      flex: 1;
      min-width: 0;
      line-height: 1.35;
    }

    .session-track-title {
      color: #ffffff;
      font-weight: 700;
      letter-spacing: -0.2px;
    }

    .session-title-sep {
      color: rgba(255, 255, 255, 0.28);
      font-size: 0.75rem;
      margin: 0 0.1rem;
      user-select: none;
    }

    .session-vehicle-inline {
      display: inline-flex;
      align-items: center;
      gap: 0.35rem;
      font-size: 0.84rem;
      font-weight: 600;
      color: #cbd5e1;
      font-family: var(--font-body);
      background: rgba(255, 255, 255, 0.05);
      padding: 0.12rem 0.5rem;
      border-radius: var(--radius-sm);
      border: 1px solid rgba(255, 255, 255, 0.08);
      white-space: nowrap;
    }

    .session-vehicle-inline i {
      width: 13px;
      height: 13px;
      color: var(--accent-amber);
      flex-shrink: 0;
    }

    .session-country-badge {
      display: inline-flex;
      align-items: center;
      font-family: var(--font-body);
      font-size: 0.72rem;
      font-weight: 600;
      color: var(--accent-cyan);
      background: rgba(0, 240, 255, 0.08);
      border: 1px solid rgba(0, 240, 255, 0.22);
      padding: 1px 6px;
      border-radius: 4px;
      letter-spacing: 0.3px;
      text-transform: uppercase;
    }

    .session-layout-badge {
      display: inline-flex;
      align-items: center;
      font-family: var(--font-mono);
      font-size: 0.72rem;
      font-weight: 700;
      color: var(--accent-amber);
      background: rgba(255, 170, 0, 0.08);
      border: 1px solid rgba(255, 170, 0, 0.28);
      padding: 1px 6px;
      border-radius: 4px;
      letter-spacing: 0.2px;
      white-space: nowrap;
    }

    .hud-layout-row {
      display: flex;
      align-items: center;
      gap: 0.45rem;
      width: 100%;
      margin-top: 0.35rem;
    }

    .hud-layout-select {
      flex: 1;
      background: rgba(0, 0, 0, 0.55);
      border: 1px solid rgba(0, 240, 255, 0.25);
      color: #fff;
      font-family: var(--font-display);
      font-size: 0.82rem;
      font-weight: 700;
      padding: 0.35rem 0.65rem;
      border-radius: var(--radius-sm);
      outline: none;
      cursor: pointer;
      min-height: 34px;
      height: 34px;
      min-width: 0;
    }

    .hud-layout-select:focus {
      border-color: var(--accent-cyan);
      box-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
    }

    .filter-track-dropdown {
      background: rgba(15, 23, 42, 0.85);
      border: 1px solid var(--border-subtle);
      color: #f1f5f9;
      padding: 0.38rem 0.75rem;
      border-radius: var(--radius-full);
      font-size: 0.78rem;
      font-weight: 600;
      outline: none;
      cursor: pointer;
      min-height: 34px;
      transition: all var(--transition-fast);
    }

    .filter-track-dropdown:hover, .filter-track-dropdown:focus {
      border-color: var(--accent-cyan);
      box-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
    }

    /* --- Custom Searchable Circuit Combobox (Session Logs) --- */
    .session-circuit-combobox {
      position: relative;
      display: inline-block;
      flex-shrink: 0;
    }

    .filter-track-dropdown-btn {
      display: inline-flex;
      align-items: center;
      gap: 0.45rem;
      background: rgba(15, 23, 42, 0.88);
      border: 1px solid var(--border-subtle);
      color: #f1f5f9;
      padding: 0.38rem 0.8rem;
      border-radius: var(--radius-full);
      font-size: 0.78rem;
      font-weight: 600;
      cursor: pointer;
      min-height: 34px;
      transition: all var(--transition-fast);
      user-select: none;
      white-space: nowrap;
      box-sizing: border-box;
    }

    .filter-track-dropdown-btn:hover,
    .filter-track-dropdown-btn.open {
      border-color: var(--accent-cyan);
      box-shadow: 0 0 12px rgba(0, 240, 255, 0.25);
      background: rgba(24, 32, 50, 0.95);
    }

    .filter-track-dropdown-btn.has-filter {
      border-color: var(--accent-cyan);
      color: #00f0ff;
      background: rgba(0, 240, 255, 0.12);
      box-shadow: 0 0 10px rgba(0, 240, 255, 0.15);
    }

    .hud-track-dropdown-btn {
      width: 100%;
      max-width: 100%;
      justify-content: space-between;
      border-radius: var(--radius-md);
      background: rgba(13, 19, 33, 0.95);
      font-size: 0.82rem;
      padding: 0.42rem 0.85rem;
      min-height: 36px;
    }

    .hud-track-dropdown-btn span {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      text-align: left;
    }

    .dropdown-chevron {
      width: 14px;
      height: 14px;
      transition: transform 0.2s ease;
      opacity: 0.75;
      flex-shrink: 0;
    }

    .filter-track-dropdown-btn.open .dropdown-chevron {
      transform: rotate(180deg);
      opacity: 1;
      color: var(--accent-cyan);
    }

        /* --- MORE MENU POPUP (Desktop Header & Mobile Bottom Nav) --- */
    .nav-more-menu-backdrop {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.55);
      backdrop-filter: blur(3px);
      -webkit-backdrop-filter: blur(3px);
      z-index: 9999997;
    }

    .nav-more-menu-panel {
      position: fixed !important;
      display: flex;
      flex-direction: column;
      width: 260px;
      background: rgba(13, 19, 33, 0.96);
      backdrop-filter: blur(20px);
      -webkit-backdrop-filter: blur(20px);
      border: 1px solid rgba(0, 240, 255, 0.35);
      border-radius: var(--radius-lg);
      box-shadow: 0 16px 40px rgba(0, 0, 0, 0.75), 0 0 20px rgba(0, 240, 255, 0.15);
      z-index: 9999999 !important;
      padding: 0.45rem;
      gap: 0.3rem;
      animation: menuFadeIn 0.15s ease-out;
    }

    @keyframes menuFadeIn {
      from { opacity: 0; transform: translateY(-4px) scale(0.97); }
      to { opacity: 1; transform: translateY(0) scale(1); }
    }

    @keyframes menuFadeInMobile {
      from { opacity: 0; transform: translateY(8px) scale(0.97); }
      to { opacity: 1; transform: translateY(0) scale(1); }
    }

    .nav-more-menu-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0.3rem 0.5rem 0.35rem 0.5rem;
      border-bottom: 1px solid rgba(255, 255, 255, 0.08);
      margin-bottom: 0.2rem;
    }

    .nav-more-menu-title {
      font-size: 0.74rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      color: var(--text-muted);
    }

    .nav-more-menu-close {
      background: none;
      border: none;
      color: var(--text-muted);
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 0.2rem;
      border-radius: var(--radius-sm);
      transition: all var(--transition-fast);
    }

    .nav-more-menu-close:hover {
      color: #fff;
      background: rgba(255, 255, 255, 0.1);
    }

    .nav-more-menu-item {
      display: flex;
      align-items: center;
      gap: 0.7rem;
      width: 100%;
      background: rgba(255, 255, 255, 0.02);
      border: 1px solid transparent;
      border-radius: var(--radius-md);
      padding: 0.55rem 0.65rem;
      cursor: pointer;
      text-align: left;
      transition: all var(--transition-fast);
      color: #f1f5f9;
    }

    .nav-more-menu-item:hover {
      background: rgba(255, 255, 255, 0.07);
      border-color: rgba(0, 240, 255, 0.3);
      transform: translateX(2px);
    }

    .nav-more-menu-item.active {
      background: rgba(0, 240, 255, 0.12);
      border-color: var(--accent-cyan);
    }

    .nav-more-menu-icon {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 32px;
      height: 32px;
      border-radius: var(--radius-md);
      background: rgba(255, 255, 255, 0.06);
      flex-shrink: 0;
    }

    .nav-more-menu-icon svg {
      width: 17px;
      height: 17px;
    }

    .nav-more-menu-text {
      display: flex;
      flex-direction: column;
      flex: 1;
      min-width: 0;
    }

    .nav-more-menu-label {
      font-size: 0.85rem;
      font-weight: 700;
      color: #fff;
      line-height: 1.2;
    }

    .nav-more-menu-sub {
      font-size: 0.72rem;
      color: var(--text-muted);
      margin-top: 0.1rem;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .nav-more-menu-arrow {
      width: 14px;
      height: 14px;
      color: rgba(255, 255, 255, 0.35);
      flex-shrink: 0;
    }

    /* Mobile / Global Backdrop for Circuit Dropdown */
    .session-circuit-backdrop {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.65);
      z-index: 9999998;
      backdrop-filter: blur(4px);
      -webkit-backdrop-filter: blur(4px);
      touch-action: none;
    }

    /* Fixed positioning and portaled to document.body ensures it escapes all stacking contexts */

    /* Dedicated Modal Track Dropdown and Isolated Backdrop (Above modal-overlay z-index: 10000000) */
    #modal-track-dropdown-panel {
      position: fixed !important;
      z-index: 10000050 !important;
    }
    #modal-track-dropdown-panel .dropdown-circuit-list {
      max-height: 340px !important;
    }
    .modal-circuit-backdrop {
      display: none;
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.5);
      z-index: 10000040 !important;
      backdrop-filter: blur(3px);
      -webkit-backdrop-filter: blur(3px);
      touch-action: none;
    }

    .session-circuit-dropdown-panel {
      position: fixed !important;
      z-index: 9999999 !important;
      width: min(350px, calc(100vw - 20px));
      max-height: 420px;
      background: #0f172a;
      border: 1px solid rgba(0, 240, 255, 0.45);
      border-radius: 12px;
      box-shadow: 0 16px 48px rgba(0, 0, 0, 0.95), 0 0 24px rgba(0, 240, 255, 0.25);
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
      display: flex;
      flex-direction: column;
      overflow: hidden;
      animation: dropdownSlideIn 0.16s cubic-bezier(0.16, 1, 0.3, 1);
    }

    @media (max-width: 640px) {
    .session-circuit-dropdown-panel {
        width: calc(100vw - 24px) !important;
        left: 12px !important;
        max-height: 75vh !important;
      }
      .dropdown-circuit-list {
        max-height: calc(75vh - 75px) !important;
      }
    }

    @keyframes dropdownSlideIn {
      from { opacity: 0; transform: translateY(-6px); }
      to { opacity: 1; transform: translateY(0); }
    }

    /* Pinned Search Header inside Dropdown */
    .dropdown-search-header {
      padding: 0.6rem 0.65rem 0.5rem 0.65rem;
      border-bottom: 1px solid rgba(255, 255, 255, 0.08);
      background: rgba(15, 23, 42, 0.98);
      position: sticky;
      top: 0;
      z-index: 2;
      flex-shrink: 0;
      display: flex;
      align-items: center;
      gap: 0.45rem;
    }

    .dropdown-search-input-box {
      flex: 1;
      position: relative;
      display: flex;
      align-items: center;
      background: rgba(30, 41, 59, 0.9);
      border: 1px solid rgba(255, 255, 255, 0.12);
      border-radius: 8px;
      padding: 0.4rem 0.65rem;
      gap: 0.4rem;
      transition: all 0.15s ease;
    }

    .dropdown-close-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 32px;
      height: 32px;
      padding: 0;
      border-radius: 8px;
      background: rgba(255, 255, 255, 0.06);
      border: 1px solid rgba(255, 255, 255, 0.12);
      color: #94a3b8;
      cursor: pointer;
      flex-shrink: 0;
      transition: all 0.15s ease;
    }

    .dropdown-close-btn:hover {
      background: rgba(239, 68, 68, 0.18);
      border-color: rgba(239, 68, 68, 0.45);
      color: #f87171;
    }

    .dropdown-close-icon {
      width: 16px;
      height: 16px;
      pointer-events: none;
    }

    .dropdown-search-input-box:focus-within {
      border-color: var(--accent-cyan);
      box-shadow: 0 0 10px rgba(0, 240, 255, 0.25);
      background: rgba(30, 41, 59, 1);
    }

    .dropdown-search-input-box .search-icon {
      width: 14px;
      height: 14px;
      color: var(--accent-cyan);
      flex-shrink: 0;
    }

    .dropdown-search-input {
      flex: 1;
      background: transparent;
      border: none;
      outline: none;
      color: #f8fafc;
      font-size: 0.8rem;
      font-family: inherit;
    }

    .dropdown-search-input::placeholder {
      color: #64748b;
      font-size: 0.76rem;
    }

    .dropdown-search-clear-btn {
      background: transparent;
      border: none;
      color: #94a3b8;
      cursor: pointer;
      font-size: 0.75rem;
      padding: 0 3px;
      line-height: 1;
      display: none;
      align-items: center;
      justify-content: center;
    }

    .dropdown-search-clear-btn:hover {
      color: #fff;
    }

    /* Scrollable Circuit List */
    .dropdown-circuit-list {
      flex: 1;
      overflow-y: auto;
      max-height: 310px;
      padding: 0.35rem;
    }

    .dropdown-circuit-list::-webkit-scrollbar {
      width: 6px;
    }
    .dropdown-circuit-list::-webkit-scrollbar-track {
      background: transparent;
    }
    .dropdown-circuit-list::-webkit-scrollbar-thumb {
      background: rgba(255, 255, 255, 0.15);
      border-radius: 3px;
    }

    .dropdown-group-title {
      font-size: 0.72rem;
      font-weight: 700;
      color: #94a3b8;
      padding: 0.45rem 0.6rem 0.2rem 0.6rem;
      text-transform: uppercase;
      letter-spacing: 0.04em;
    }

    .dropdown-circuit-item {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 0.5rem;
      padding: 0.45rem 0.65rem;
      border-radius: 6px;
      font-size: 0.78rem;
      color: #e2e8f0;
      cursor: pointer;
      transition: all 0.12s ease;
      user-select: none;
    }

    .dropdown-circuit-item:hover {
      background: rgba(0, 240, 255, 0.1);
      color: #00f0ff;
    }

    .dropdown-circuit-item.active {
      background: linear-gradient(135deg, rgba(0, 240, 255, 0.2), rgba(0, 240, 255, 0.08));
      color: #00f0ff;
      font-weight: 700;
      border-left: 2px solid var(--accent-cyan);
    }

    .dropdown-circuit-item .item-meta {
      font-size: 0.72rem;
      color: #64748b;
      margin-left: auto;
      flex-shrink: 0;
    }

    .dropdown-no-results {
      padding: 1.5rem 0.8rem;
      text-align: center;
      color: #64748b;
      font-size: 0.8rem;
    }

    .dropdown-nearby-prompt {
      padding: 0.55rem 0.65rem;
      border-radius: 6px;
      background: rgba(0, 240, 255, 0.06);
      border: 1px dashed rgba(0, 240, 255, 0.28);
      font-size: 0.75rem;
      color: #cbd5e1;
      cursor: pointer;
      display: flex;
      align-items: center;
      gap: 0.4rem;
      margin: 0.2rem 0 0.4rem 0;
      transition: all 0.15s ease;
      user-select: none;
    }

    .dropdown-nearby-prompt:hover {
      background: rgba(0, 240, 255, 0.14);
      color: #00f0ff;
      border-color: var(--accent-cyan);
    }

    /* --- Circuit Quick Search Filter Bar --- */

    .hud-track-search-box {
      position: relative;
      display: flex;
      align-items: center;
      width: 100%;
      margin-bottom: 0.35rem;
    }

    .hud-track-search-box.mini {
      width: 100%;
      min-width: 175px;
      margin-bottom: 0;
    }

    .hud-track-search-input {
      width: 100%;
      padding: 0.42rem 1.8rem 0.42rem 0.75rem;
      font-size: 0.82rem;
      font-family: var(--font-main);
      background: rgba(10, 15, 29, 0.85);
      border: 1px solid rgba(0, 240, 255, 0.35);
      border-radius: var(--radius-sm);
      color: #fff;
      transition: all 0.2s ease;
      outline: none;
    }

    .hud-track-search-input.mini {
      padding: 0.3rem 1.6rem 0.3rem 0.6rem;
      font-size: 0.78rem;
      height: 32px;
    }

    .hud-track-search-input::placeholder {
      color: rgba(255, 255, 255, 0.45);
    }

    .hud-track-search-input:focus {
      border-color: var(--accent-cyan);
      box-shadow: 0 0 10px rgba(0, 240, 255, 0.35);
      background: rgba(10, 15, 29, 0.98);
    }

    .hud-track-search-clear {
      position: absolute;
      right: 6px;
      top: 50%;
      transform: translateY(-50%);
      background: transparent;
      border: none;
      color: var(--text-muted);
      font-size: 0.85rem;
      cursor: pointer;
      padding: 2px 6px;
      border-radius: 4px;
      display: none;
      line-height: 1;
    }

    .hud-track-search-clear:hover {
      color: var(--accent-cyan);
    }

    .session-date-badge {
      font-size: 0.72rem;
      color: var(--text-muted);
      background: rgba(255, 255, 255, 0.05);
      padding: 0.18rem 0.55rem;
      border-radius: var(--radius-sm);
      font-family: var(--font-mono);
      white-space: nowrap;
      flex-shrink: 0;
    }

    .session-vehicle-line {
      display: flex;
      align-items: center;
      gap: 0.45rem;
      font-size: 0.82rem;
      color: var(--text-muted);
    }

    .session-vehicle-line i {
      width: 14px;
      height: 14px;
      color: var(--accent-cyan);
    }

    .session-best-lap-box,

    .session-perf-banner {
      background: rgba(0, 0, 0, 0.4);
      border: 1px solid rgba(255, 255, 255, 0.07);
      border-radius: var(--radius-sm);
      padding: 0.65rem 0.75rem;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 0.55rem;
    }

    .session-perf-stat {
      display: flex;
      flex-direction: column;
      gap: 0.15rem;
      min-width: 0;
      flex: 1.15 0 auto;
    }

    .session-perf-stat.session-laps-stat {
      flex: 0.9 1 auto;
      align-items: center;
      text-align: center;
    }

    .session-perf-stat.session-speed-stat {
      flex: 1 1 auto;
      align-items: flex-end;
      text-align: right;
    }

    .session-perf-divider {
      width: 1px;
      height: 32px;
      background: rgba(255, 255, 255, 0.12);
      flex-shrink: 0;
      margin: 0 0.15rem;
    }

    .best-lap-label,

    .session-perf-label {
      font-size: 0.72rem;
      font-family: var(--font-display);
      text-transform: uppercase;
      letter-spacing: 0.3px;
      color: var(--text-dim);
      font-weight: 700;
      display: flex;
      align-items: center;
      gap: 0.25rem;
      white-space: nowrap !important;
      flex-shrink: 0;
    }

    .best-lap-time,

    .session-perf-val {
      font-family: var(--font-mono);
      font-size: clamp(1.05rem, 2.2vw, 1.32rem);
      font-weight: 900;
      line-height: 1.2;
      white-space: nowrap;
    }

    .best-lap-time,

    .session-perf-val.best-lap-time {
      color: var(--accent-green);
      text-shadow: 0 0 16px rgba(0, 230, 118, 0.35);
      letter-spacing: 0.2px;
    }

    .session-perf-val.top-speed-val {
      color: var(--accent-cyan);
      text-shadow: 0 0 16px rgba(0, 240, 255, 0.35);
      font-size: clamp(1.0rem, 2vw, 1.24rem);
      letter-spacing: 0.2px;
    }

    .session-perf-val.total-laps-val {
      color: #f1f5f9;
      font-size: clamp(1.0rem, 2vw, 1.24rem);
      letter-spacing: 0.2px;
    }

    .session-perf-val.total-laps-val small,
    .session-perf-val.total-laps-val .total-laps-unit {
      font-size: 0.72rem;
      color: var(--text-dim);
      font-weight: 700;
    }

    /* 4-Wheel Mini PSI Pill Grid */

    .tire-psi-mini-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 0.45rem;
      background: rgba(0, 0, 0, 0.22);
      padding: 0.55rem;
      border-radius: var(--radius-sm);
      font-family: var(--font-mono);
      font-size: 0.76rem;
    }

    .tire-psi-cell {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 0.3rem 0.5rem;
      background: rgba(255, 255, 255, 0.03);
      border-radius: 4px;
    }

    .tire-wheel-tag {
      color: var(--text-dim);
      font-weight: 700;
      font-size: 0.72rem;
    }

    .tire-psi-val {
      color: #fff;
      font-weight: 700;
    }

    .tire-psi-val span.hot {
      color: var(--accent-amber);
    }

    .session-actions-bar {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      margin-top: auto;
      padding-top: 0.6rem;
      border-top: 1px solid var(--border-subtle);
    }

    .btn-session-lock {
      transition: all var(--transition-fast);
    }
    .btn-session-lock.locked {
      color: var(--accent-amber, #ffb300) !important;
      border-color: rgba(255, 179, 0, 0.5) !important;
      background: rgba(255, 179, 0, 0.12) !important;
    }
    .btn-session-lock:hover {
      border-color: var(--accent-amber, #ffb300) !important;
      color: var(--accent-amber, #ffb300) !important;
    }
    .session-locked-badge {
      display: inline-flex;
      align-items: center;
      gap: 3px;
      font-size: 0.7rem;
      font-weight: 700;
      padding: 1px 6px;
      border-radius: 4px;
      background: rgba(255, 179, 0, 0.15);
      color: var(--accent-amber, #ffb300);
      border: 1px solid rgba(255, 179, 0, 0.4);
    }

    /* Session Visibility & Friend Access Controls */

    .session-vis-bar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 0.5rem;
      padding-top: 0.55rem;
      border-top: 1px dashed rgba(255, 255, 255, 0.08);
      flex-wrap: wrap;
    }

    .session-vis-selector {
      display: inline-flex;
      align-items: center;
      background: rgba(0, 0, 0, 0.5);
      border: 1px solid rgba(255, 255, 255, 0.08);
      border-radius: var(--radius-full);
      padding: 2px;
      gap: 2px;
    }

    .vis-pill {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      background: transparent;
      border: none;
      color: var(--text-muted);
      font-family: var(--font-display);
      font-size: 0.72rem;
      font-weight: 700;
      padding: 0.22rem 0.55rem;
      border-radius: var(--radius-full);
      cursor: pointer;
      transition: all var(--transition-fast, 0.15s ease);
      touch-action: manipulation;
      white-space: nowrap;
    }

    .vis-pill i {
      width: 12px;
      height: 12px;
    }

    .vis-pill:hover {
      color: #fff;
    }

    .vis-pill.active.public {
      background: rgba(0, 240, 255, 0.18);
      color: var(--accent-cyan);
      box-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
    }

    .vis-pill.active.friends {
      background: rgba(255, 184, 48, 0.2);
      color: #ffb830;
      box-shadow: 0 0 10px rgba(255, 184, 48, 0.35);
    }

    .vis-pill.active.private {
      background: rgba(255, 255, 255, 0.14);
      color: #f1f5f9;
    }

    .btn-manage-friends {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      background: rgba(255, 184, 48, 0.12);
      border: 1px solid rgba(255, 184, 48, 0.38);
      color: #ffb830;
      font-family: var(--font-display);
      font-size: 0.72rem;
      font-weight: 700;
      padding: 0.24rem 0.65rem;
      border-radius: var(--radius-full);
      cursor: pointer;
      transition: all 0.15s ease;
      touch-action: manipulation;
    }

    /* Friend Management & Invite Modal Components */

    .friends-invite-card {
      background: rgba(0, 0, 0, 0.45);
      border: 1px solid rgba(255, 184, 48, 0.3);
      border-radius: var(--radius-md);
      padding: 0.95rem;
      box-shadow: 0 0 16px rgba(255, 184, 48, 0.06);
    }

    .friends-invite-title {
      font-size: 0.8rem;
      font-weight: 700;
      color: #ffb830;
      margin-bottom: 0.35rem;
      display: flex;
      align-items: center;
      gap: 0.4rem;
    }

    .friends-invite-desc {
      font-size: 0.75rem;
      color: var(--text-muted);
      margin-bottom: 0.65rem;
      line-height: 1.45;
    }

    .friends-section-title {
      font-size: 0.82rem;
      font-weight: 700;
      color: #fff;
      display: flex;
      align-items: center;
      gap: 0.35rem;
    }

    .friends-input {
      background: rgba(0, 0, 0, 0.6);
      border: 1px solid var(--border-subtle);
      color: #f1f5f9;
      padding: 0.45rem 0.75rem;
      border-radius: var(--radius-sm);
      font-size: 0.8rem;
      outline: none;
      width: 100%;
      transition: all var(--transition-fast);
    }

    .friends-input:focus {
      border-color: var(--accent-cyan);
      box-shadow: 0 0 8px rgba(0, 240, 255, 0.2);
    }

    .friend-item-card {
      display: flex;
      justify-content: space-between;
      align-items: center;
      background: rgba(0, 0, 0, 0.35);
      border: 1px solid rgba(255, 255, 255, 0.06);
      border-radius: var(--radius-sm);
      padding: 0.45rem 0.65rem;
    }

    .friend-item-name {
      font-size: 0.8rem;
      font-weight: 700;
      color: #fff;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .friend-item-email {
      font-size: 0.72rem;
      color: var(--text-dim);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .friend-remove-btn {
      border: 1px solid rgba(255, 42, 75, 0.3);
      color: var(--accent-red);
      padding: 0.2rem 0.45rem;
      font-size: 0.72rem;
      background: transparent;
      border-radius: var(--radius-sm);
      cursor: pointer;
      transition: all 0.15s ease;
    }

    .friend-remove-btn:hover {
      background: rgba(255, 42, 75, 0.15);
      color: #fff;
    }

    .friend-search-item {
      display: flex;
      justify-content: space-between;
      align-items: center;
      background: rgba(0, 0, 0, 0.45);
      border: 1px solid rgba(0, 240, 255, 0.18);
      border-radius: var(--radius-sm);
      padding: 0.4rem 0.6rem;
      margin-bottom: 0.35rem;
    }

    .friend-search-name {
      font-size: 0.78rem;
      color: #fff;
    }

    .friend-search-email {
      font-size: 0.72rem;
      color: var(--text-dim);
      margin-left: 4px;
    }

    .friends-empty-state {
      text-align: center;
      padding: 1.25rem 0.5rem;
      background: rgba(0, 0, 0, 0.25);
      border-radius: var(--radius-sm);
      border: 1px dashed var(--border-subtle);
      color: var(--text-muted);
      font-size: 0.78rem;
    }

    .btn-manage-friends:hover {
      background: rgba(255, 184, 48, 0.25);
      transform: translateY(-1px);
      box-shadow: 0 0 12px rgba(255, 184, 48, 0.4);
    }

    .btn-manage-friends i {
      width: 13px;
      height: 13px;
    }

    /* Batch Session Visibility Panel */

    .batch-visibility-panel {
      background: linear-gradient(145deg, rgba(17, 24, 39, 0.75), rgba(15, 23, 42, 0.85));
      border: 1px solid rgba(255, 255, 255, 0.08);
      border-radius: 12px;
      padding: 1.1rem 1.4rem;
      margin-top: 1.5rem;
      margin-bottom: 2rem;
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 1.25rem;
      flex-wrap: wrap;
      box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    }

    .batch-visibility-info {
      flex: 1;
      min-width: 260px;
    }

    .batch-visibility-title {
      font-size: 0.92rem;
      font-weight: 700;
      color: var(--text-light);
      display: flex;
      align-items: center;
      gap: 0.5rem;
      margin-bottom: 0.25rem;
    }

    .batch-visibility-desc {
      font-size: 0.78rem;
      color: var(--text-dim);
      line-height: 1.4;
    }

    .batch-visibility-actions {
      display: flex;
      gap: 0.5rem;
      align-items: center;
      flex-wrap: wrap;
    }

    .batch-vis-btn {
      display: inline-flex;
      align-items: center;
      gap: 0.35rem;
      font-size: 0.78rem;
      font-weight: 600;
      padding: 0.45rem 0.85rem;
      border-radius: 8px;
      transition: all 0.2s ease;
      background: rgba(255, 255, 255, 0.04);
      border: 1px solid rgba(255, 255, 255, 0.12);
      color: var(--text-muted);
      cursor: pointer;
    }

    .batch-vis-icon {
      width: 14px;
      height: 14px;
      flex-shrink: 0;
    }

    .batch-vis-btn.public .batch-vis-icon { color: var(--accent-cyan); }

    .batch-vis-btn.friends .batch-vis-icon { color: #ffb830; }

    .batch-vis-btn.private .batch-vis-icon { color: #f1f5f9; }

    .batch-vis-btn.manage-friends .batch-vis-icon { color: #ffb830; }

    .batch-vis-btn:hover {
      background: rgba(255, 255, 255, 0.08);
      color: #fff;
    }

    .batch-vis-btn.public:hover {
      border-color: var(--accent-cyan);
      color: var(--accent-cyan);
      background: rgba(0, 240, 255, 0.08);
    }

    .batch-vis-btn.friends:hover {
      border-color: #ffb830;
      color: #ffb830;
      background: rgba(255, 184, 48, 0.1);
    }

    .batch-vis-btn.private:hover {
      border-color: #f1f5f9;
      color: #f1f5f9;
      background: rgba(255, 255, 255, 0.1);
    }

    .batch-vis-btn.active.public {
      background: rgba(0, 240, 255, 0.18) !important;
      border-color: var(--accent-cyan) !important;
      color: var(--accent-cyan) !important;
      box-shadow: 0 0 12px rgba(0, 240, 255, 0.35) !important;
      font-weight: 700;
    }

    .batch-vis-btn.active.friends {
      background: rgba(255, 184, 48, 0.2) !important;
      border-color: #ffb830 !important;
      color: #ffb830 !important;
      box-shadow: 0 0 12px rgba(255, 184, 48, 0.4) !important;
      font-weight: 700;
    }

    .batch-vis-btn.active.private {
      background: rgba(255, 255, 255, 0.18) !important;
      border-color: #f1f5f9 !important;
      color: #ffffff !important;
      box-shadow: 0 0 12px rgba(255, 255, 255, 0.25) !important;
      font-weight: 700;
    }

    .batch-vis-btn.manage-friends {
      border-color: rgba(255, 184, 48, 0.35);
      background: rgba(255, 184, 48, 0.08);
      color: #ffb830;
      margin-left: 0.25rem;
    }

    .batch-vis-btn.manage-friends:hover {
      border-color: #ffb830;
      background: rgba(255, 184, 48, 0.2);
      color: #ffc95c;
      transform: translateY(-1px);
      box-shadow: 0 0 12px rgba(255, 184, 48, 0.35);
    }

    @media (max-width: 640px) {
      .batch-visibility-panel {
        flex-direction: column;
        align-items: stretch;
        padding: 1rem;
        gap: 0.85rem;
      }

      .batch-visibility-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.45rem;
      }

      .batch-vis-btn {
        width: 100%;
        justify-content: center;
        padding: 0.5rem 0.4rem;
        font-size: 0.76rem;
        margin-left: 0 !important;
      }

    }

    /* Empty state */

    .empty-state-box {
      text-align: center;
      padding: 3.5rem 1.5rem;
      background: var(--bg-card);
      border: 1px dashed var(--border-bright);
      border-radius: var(--radius-lg);
      margin: 1rem 0;
    }

    .empty-state-box i {
      width: 48px;
      height: 48px;
      color: var(--text-dim);
      margin-bottom: 0.75rem;
    }

        /* --- DYNAMIC GUIDES SHOWCASE BANNER (SESSION LOGS) --- */
    .session-guide-banner-card {
      background: linear-gradient(135deg, rgba(14, 21, 37, 0.92) 0%, rgba(9, 13, 23, 0.96) 100%);
      border: 1px solid rgba(0, 240, 255, 0.35);
      border-radius: var(--radius-md);
      box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45), 0 0 20px rgba(0, 240, 255, 0.08);
      backdrop-filter: blur(14px);
      -webkit-backdrop-filter: blur(14px);
      overflow: hidden;
      margin-bottom: 1.25rem;
      position: relative;
      transition: all var(--transition-normal);
    }

    .session-guide-banner-card:hover {
      border-color: rgba(0, 240, 255, 0.6);
      box-shadow: 0 6px 26px rgba(0, 0, 0, 0.55), 0 0 24px rgba(0, 240, 255, 0.16);
    }

    .guide-banner-inner {
      display: flex;
      flex-direction: row;
      align-items: stretch;
      min-height: 170px;
    }

    .guide-banner-media {
      position: relative;
      width: 270px;
      min-width: 230px;
      max-width: 300px;
      overflow: hidden;
      display: block;
      background: #050811;
      text-decoration: none;
      flex-shrink: 0;
    }

    .guide-banner-media img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
      transition: transform 0.4s ease;
    }

    .guide-banner-media:hover img {
      transform: scale(1.05);
    }

    .guide-banner-media-overlay {
      position: absolute;
      inset: 0;
      background: linear-gradient(90deg, rgba(0, 0, 0, 0) 60%, rgba(9, 13, 23, 0.9) 100%);
      pointer-events: none;
    }

    .guide-banner-pulse-badge {
      position: absolute;
      top: 0.75rem;
      left: 0.75rem;
      background: rgba(7, 10, 16, 0.88);
      border: 1px solid rgba(0, 240, 255, 0.55);
      backdrop-filter: blur(8px);
      padding: 0.22rem 0.6rem;
      border-radius: 9999px;
      font-size: 0.72rem;
      font-weight: 700;
      letter-spacing: 0.04em;
      color: var(--accent-cyan);
      display: inline-flex;
      align-items: center;
      gap: 0.4rem;
      box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
      z-index: 2;
    }

    .guide-pulse-dot {
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: var(--accent-cyan);
      box-shadow: 0 0 8px var(--accent-cyan);
      animation: guidePulseKeyframes 1.8s infinite;
    }

    @keyframes guidePulseKeyframes {
      0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 240, 255, 0.7); }
      70% { transform: scale(1.2); box-shadow: 0 0 0 6px rgba(0, 240, 255, 0); }
      100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(0, 240, 255, 0); }
    }

    .guide-banner-content {
      flex: 1;
      padding: 1.05rem 1.25rem;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
      gap: 0.55rem;
      min-width: 0;
    }

    .guide-banner-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 0.5rem;
    }

    .guide-banner-tags {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      flex-wrap: wrap;
    }

    .guide-cat-tag {
      font-size: 0.74rem;
      font-weight: 700;
      color: var(--accent-cyan);
      background: rgba(0, 240, 255, 0.12);
      border: 1px solid rgba(0, 240, 255, 0.25);
      padding: 0.15rem 0.55rem;
      border-radius: 4px;
      display: inline-flex;
      align-items: center;
      gap: 0.25rem;
      text-transform: uppercase;
      letter-spacing: 0.03em;
    }

    .guide-time-tag {
      font-size: 0.74rem;
      color: var(--text-muted);
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid rgba(255, 255, 255, 0.08);
      padding: 0.15rem 0.5rem;
      border-radius: 4px;
      display: inline-flex;
      align-items: center;
      gap: 0.25rem;
    }

    .guide-banner-close-btn {
      background: transparent;
      border: 1px solid transparent;
      color: var(--text-dim);
      border-radius: 4px;
      width: 26px;
      height: 26px;
      display: flex;
      align-items: center;
      justify-content: center;
      cursor: pointer;
      transition: all 0.2s ease;
      flex-shrink: 0;
    }

    .guide-banner-close-btn:hover {
      color: var(--accent-red);
      background: rgba(255, 42, 75, 0.12);
      border-color: rgba(255, 42, 75, 0.25);
    }

    .guide-banner-title {
      font-family: var(--font-display);
      font-size: 1.1rem;
      font-weight: 700;
      line-height: 1.35;
      margin: 0;
      color: var(--text-main);
    }

    .guide-banner-title a {
      color: var(--text-main);
      text-decoration: none;
      transition: color 0.2s ease;
    }

    .guide-banner-title a:hover {
      color: var(--accent-cyan);
    }

    .guide-banner-excerpt {
      font-size: 0.84rem;
      color: var(--text-muted);
      line-height: 1.45;
      margin: 0;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
    }

    .guide-banner-footer {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 0.75rem;
      margin-top: 0.2rem;
      flex-wrap: wrap;
    }

    .guide-banner-author {
      font-size: 0.78rem;
      color: var(--text-dim);
      display: inline-flex;
      align-items: center;
      gap: 0.35rem;
    }

    .guide-banner-actions {
      display: inline-flex;
      align-items: center;
      gap: 0.5rem;
    }

    .btn-all-guides {
      padding: 0.35rem 0.7rem;
      font-size: 0.78rem;
      font-weight: 600;
      color: var(--text-muted);
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid rgba(255, 255, 255, 0.12);
      border-radius: var(--radius-sm);
      text-decoration: none;
      display: inline-flex;
      align-items: center;
      transition: all 0.2s ease;
    }

    .btn-all-guides:hover {
      color: #fff;
      background: rgba(255, 255, 255, 0.1);
      border-color: rgba(255, 255, 255, 0.25);
    }

    .btn-read-guide {
      padding: 0.38rem 0.88rem;
      font-size: 0.82rem;
      font-weight: 700;
      color: #070a10 !important;
      background: linear-gradient(135deg, #00f0ff 0%, #00e676 100%);
      border: none;
      border-radius: var(--radius-sm);
      text-decoration: none;
      display: inline-flex;
      align-items: center;
      gap: 0.35rem;
      transition: all 0.2s ease;
      box-shadow: 0 2px 10px rgba(0, 240, 255, 0.3);
    }

    .btn-read-guide:hover {
      box-shadow: 0 4px 16px rgba(0, 240, 255, 0.55);
      transform: translateY(-1px);
      filter: brightness(1.1);
    }

    @media (max-width: 768px) {
      .guide-banner-inner {
        flex-direction: column;
      }

      .guide-banner-media {
        width: 100%;
        max-width: 100%;
        height: 155px;
      }

      .guide-banner-media-overlay {
        background: linear-gradient(0deg, rgba(9, 13, 23, 0.95) 0%, rgba(0, 0, 0, 0) 60%);
      }

      .guide-banner-content {
        padding: 0.9rem;
      }

      .guide-banner-title {
        font-size: 1.02rem;
      }

      .guide-banner-excerpt {
        font-size: 0.82rem;
      }
    }

/* Session Card Grid */
    .sessions-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(330px, 1fr));
      gap: 1rem;
    }

    .session-card {
      background: var(--bg-card);
      border: 1px solid var(--border-subtle);
      border-radius: var(--radius-md);
      padding: 1.1rem;
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
      transition: all var(--transition-normal);
      display: flex;
      flex-direction: column;
      gap: 0.85rem;
      position: relative;
      overflow: hidden;
    }

    .session-card:hover {
      border-color: rgba(0, 240, 255, 0.4);
      background: var(--bg-card-hover);
      transform: translateY(-2px);
      box-shadow: 0 10px 28px rgba(0, 0, 0, 0.5), 0 0 20px rgba(0, 240, 255, 0.1);
    }

    .session-card::before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      width: 4px;
      height: 100%;
      background: linear-gradient(180deg, var(--accent-red), var(--accent-cyan));
    }

    .session-card-header {
      display: flex;
      flex-direction: column;
      gap: 0.35rem;
      width: 100%;
      min-width: 0;
    }

    .session-card-top-row {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 0.5rem;
      width: 100%;
      min-width: 0;
    }

    .session-card-meta-row {
      display: flex;
      align-items: center;
      gap: 0.45rem;
      flex-wrap: wrap;
      width: 100%;
      min-width: 0;
    }

    .session-badges-wrap {
      display: inline-flex;
      align-items: center;
      gap: 0.35rem;
      flex-wrap: wrap;
      max-width: 100%;
      min-width: 0;
      flex-shrink: 1;
    }

    .session-track-name {
      font-family: var(--font-display);
      font-size: 1.05rem;
      font-weight: 700;
      color: #fff;
      display: flex;
      align-items: center;
      gap: 0.45rem;
      flex-wrap: nowrap !important;
      flex: 1;
      width: auto;
      min-width: 0;
      line-height: 1.35;
    }

    .btn-session-lock-top {
      display: inline-flex;
      align-items: center;
      gap: 0.3rem;
      padding: 0.22rem 0.55rem;
      font-size: 0.72rem;
      font-weight: 700;
      font-family: var(--font-display, sans-serif);
      border-radius: var(--radius-full, 9999px);
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid rgba(255, 255, 255, 0.16);
      color: var(--text-muted, #94a3b8);
      cursor: pointer;
      transition: all var(--transition-fast, 0.15s ease);
      flex-shrink: 0;
      white-space: nowrap;
      line-height: 1.2;
    }

    .btn-session-lock-top:hover {
      background: rgba(255, 179, 0, 0.12);
      border-color: rgba(255, 179, 0, 0.45);
      color: var(--accent-amber, #ffb300);
    }

    .btn-session-lock-top.locked {
      background: rgba(255, 179, 0, 0.15) !important;
      border: 1px solid rgba(255, 179, 0, 0.5) !important;
      color: var(--accent-amber, #ffb300) !important;
      box-shadow: 0 0 10px rgba(255, 179, 0, 0.25);
    }

    .btn-session-lock-top i,
    .btn-session-lock-top svg {
      width: 12px;
      height: 12px;
      flex-shrink: 0;
    }

    .session-track-title {
      color: #ffffff;
      font-weight: 700;
      letter-spacing: -0.2px;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      flex: 1;
      min-width: 0;
    }

    .session-title-sep {
      color: rgba(255, 255, 255, 0.28);
      font-size: 0.75rem;
      margin: 0 0.1rem;
      user-select: none;
    }

    .session-vehicle-inline {
      display: inline-flex;
      align-items: center;
      gap: 0.35rem;
      font-size: 0.84rem;
      font-weight: 600;
      color: #cbd5e1;
      font-family: var(--font-body);
      background: rgba(255, 255, 255, 0.05);
      padding: 0.12rem 0.5rem;
      border-radius: var(--radius-sm);
      border: 1px solid rgba(255, 255, 255, 0.08);
      white-space: nowrap;
    }

    .session-vehicle-inline i {
      width: 13px;
      height: 13px;
      color: var(--accent-amber);
      flex-shrink: 0;
    }

    .session-country-badge {
      display: inline-flex;
      align-items: center;
      font-family: var(--font-body);
      font-size: 0.72rem;
      font-weight: 600;
      color: var(--accent-cyan);
      background: rgba(0, 240, 255, 0.08);
      border: 1px solid rgba(0, 240, 255, 0.22);
      padding: 1px 6px;
      border-radius: 4px;
      letter-spacing: 0.3px;
      text-transform: uppercase;
    }

    .session-layout-badge {
      display: inline-flex;
      align-items: center;
      font-family: var(--font-mono);
      font-size: 0.72rem;
      font-weight: 700;
      color: var(--accent-amber);
      background: rgba(255, 170, 0, 0.08);
      border: 1px solid rgba(255, 170, 0, 0.28);
      padding: 1px 6px;
      border-radius: 4px;
      letter-spacing: 0.2px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      min-width: 0;
      flex-shrink: 1;
    }

    .session-sim-badge {
      display: inline-flex;
      align-items: center;
      font-family: var(--font-mono);
      font-size: 0.72rem;
      font-weight: 800;
      color: var(--accent-cyan);
      background: rgba(0, 229, 255, 0.14);
      border: 1px solid rgba(0, 229, 255, 0.42);
      padding: 1px 6px;
      border-radius: 4px;
      letter-spacing: 0.4px;
      text-transform: uppercase;
      flex-shrink: 0;
    }

    /* Creation Origin Badge (GPS Timer, Simulation, Manual Entry) */
    .session-source-badge {
      display: inline-flex;
      align-items: center;
      gap: 3.5px;
      font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
      font-size: 0.72rem;
      font-weight: 700;
      padding: 1.5px 6.5px;
      border-radius: 4px;
      letter-spacing: 0.2px;
      line-height: 1.3;
      white-space: nowrap;
      flex-shrink: 0;
      cursor: default;
    }
    .session-source-badge i {
      width: 11px;
      height: 11px;
      stroke-width: 2.2;
      flex-shrink: 0;
    }

    /* 1. In-App GPS Lap Timer (Suppressed on session cards in favor of Verified badge to protect track title) */
    .session-source-gps,
    .session-track-name .session-source-gps {
      display: none !important;
    }

    /* 2. In-App Simulation (Cyan / Tech accent) */
    .session-source-sim {
      color: #00f0ff;
      background: rgba(0, 240, 255, 0.12);
      border: 1px solid rgba(0, 240, 255, 0.38);
    }
    [data-theme="light"] .session-source-sim {
      color: #0284c7;
      background: rgba(14, 165, 233, 0.12);
      border-color: rgba(14, 165, 233, 0.35);
    }

    /* 3. Manual Entry (Muted Slate / Light Gray accent) */
    .session-source-manual {
      color: #cbd5e1;
      background: rgba(148, 163, 184, 0.12);
      border: 1px solid rgba(148, 163, 184, 0.3);
    }
    [data-theme="light"] .session-source-manual {
      color: #475569;
      background: rgba(100, 116, 139, 0.1);
      border-color: rgba(100, 116, 139, 0.25);
    }

    /* Verified Session Lock Banner & High-Visibility Color Styling */
    .source-lock-banner {
      display: none;
      align-items: center;
      gap: 0.65rem;
      background: rgba(245, 158, 11, 0.1);
      border: 1px solid rgba(245, 158, 11, 0.4);
      border-radius: var(--radius-sm, 6px);
      padding: 0.6rem 0.9rem;
      margin-bottom: 0.85rem;
      font-size: 0.8rem;
      color: #fef3c7;
    }
    .source-lock-banner .lock-shield-icon {
      width: 20px;
      height: 20px;
      color: #f59e0b;
      flex-shrink: 0;
    }
    .source-lock-banner .lock-title {
      display: block;
      font-weight: 700;
      color: #fbbf24;
      font-size: 0.83rem;
    }
    .source-lock-banner .lock-desc {
      display: block;
      font-size: 0.73rem;
      color: rgba(254, 243, 199, 0.8);
      margin-top: 1px;
    }
    [data-theme="light"] .source-lock-banner {
      background: rgba(245, 158, 11, 0.12);
      border-color: rgba(217, 119, 6, 0.4);
      color: #78350f;
    }
    [data-theme="light"] .source-lock-banner .lock-title {
      color: #92400e;
    }
    [data-theme="light"] .source-lock-banner .lock-desc {
      color: #a16207;
    }

    /* Distinctive Locked / Read-Only Form Fields (Deep Recessed Disabled Theme with Amber Lock & Pattern) */
    .form-input-locked,
    .best-lap-hero-input.form-input-locked,
    #modal-log-session .form-input-locked,
    #modal-log-session input.form-input-locked,
    #modal-log-session select.form-input-locked {
      background-color: #0b0f19 !important;
      background-image: 
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23f59e0b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='11' width='18' height='11' rx='2' ry='2'%3E%3C/rect%3E%3Cpath d='M7 11V7a5 5 0 0 1 10 0v4'%3E%3C/path%3E%3C/svg%3E"),
        repeating-linear-gradient(135deg, rgba(245, 158, 11, 0.04) 0, rgba(245, 158, 11, 0.04) 10px, transparent 10px, transparent 20px) !important;
      background-repeat: no-repeat, repeat !important;
      background-position: right 12px center, 0 0 !important;
      background-size: 16px 16px, auto !important;
      border: 1px dashed rgba(245, 158, 11, 0.5) !important;
      border-left: 4px solid #f59e0b !important;
      color: #94a3b8 !important;
      text-shadow: none !important;
      cursor: not-allowed !important;
      caret-color: transparent !important;
      user-select: none !important;
      box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.55) !important;
      opacity: 0.9 !important;
    }
    .form-input-locked:focus,
    .form-input-locked:hover,
    #modal-log-session .form-input-locked:focus,
    #modal-log-session .form-input-locked:hover {
      outline: none !important;
      border-color: rgba(245, 158, 11, 0.5) !important;
      box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.55) !important;
    }
    [data-theme="light"] .form-input-locked,
    [data-theme="light"] .best-lap-hero-input.form-input-locked,
    [data-theme="light"] #modal-log-session .form-input-locked,
    [data-theme="light"] #modal-log-session input.form-input-locked,
    [data-theme="light"] #modal-log-session select.form-input-locked {
      background-color: #e2e8f0 !important;
      background-image: 
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23d97706' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='11' width='18' height='11' rx='2' ry='2'%3E%3C/rect%3E%3Cpath d='M7 11V7a5 5 0 0 1 10 0v4'%3E%3C/path%3E%3C/svg%3E"),
        repeating-linear-gradient(135deg, rgba(217, 119, 6, 0.05) 0, rgba(217, 119, 6, 0.05) 10px, transparent 10px, transparent 20px) !important;
      background-repeat: no-repeat, repeat !important;
      background-position: right 12px center, 0 0 !important;
      background-size: 16px 16px, auto !important;
      border: 1px dashed rgba(217, 119, 6, 0.5) !important;
      border-left: 4px solid #d97706 !important;
      color: #64748b !important;
      text-shadow: none !important;
      box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.12) !important;
    }

    .btn-locked,
    #modal-log-session .btn-locked {
      cursor: not-allowed !important;
      pointer-events: none !important;
      background-color: #0b0f19 !important;
      background-image: 
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23f59e0b' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='11' width='18' height='11' rx='2' ry='2'%3E%3C/rect%3E%3Cpath d='M7 11V7a5 5 0 0 1 10 0v4'%3E%3C/path%3E%3C/svg%3E"),
        repeating-linear-gradient(135deg, rgba(245, 158, 11, 0.04) 0, rgba(245, 158, 11, 0.04) 10px, transparent 10px, transparent 20px) !important;
      background-repeat: no-repeat, repeat !important;
      background-position: right 12px center, 0 0 !important;
      background-size: 16px 16px, auto !important;
      border: 1px dashed rgba(245, 158, 11, 0.5) !important;
      border-left: 4px solid #f59e0b !important;
      color: #94a3b8 !important;
      text-shadow: none !important;
      box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.55) !important;
      opacity: 0.9 !important;
    }
    [data-theme="light"] .btn-locked,
    [data-theme="light"] #modal-log-session .btn-locked {
      background-color: #e2e8f0 !important;
      background-image: 
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23d97706' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='11' width='18' height='11' rx='2' ry='2'%3E%3C/rect%3E%3Cpath d='M7 11V7a5 5 0 0 1 10 0v4'%3E%3C/path%3E%3C/svg%3E"),
        repeating-linear-gradient(135deg, rgba(217, 119, 6, 0.05) 0, rgba(217, 119, 6, 0.05) 10px, transparent 10px, transparent 20px) !important;
      background-repeat: no-repeat, repeat !important;
      background-position: right 12px center, 0 0 !important;
      background-size: 16px 16px, auto !important;
      border: 1px dashed rgba(217, 119, 6, 0.5) !important;
      border-left: 4px solid #d97706 !important;
      color: #64748b !important;
      text-shadow: none !important;
      box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.12) !important;
    }

    /* Locked Field Label Indicator Badge */
    .field-lock-tag {
      display: inline-flex;
      align-items: center;
      gap: 3.5px;
      font-family: var(--font-mono, monospace);
      font-size: 0.72rem;
      font-weight: 800;
      color: #fbbf24;
      background: rgba(245, 158, 11, 0.16);
      border: 1px solid rgba(245, 158, 11, 0.45);
      padding: 1px 6px;
      border-radius: 4px;
      margin-left: 6px;
      letter-spacing: 0.3px;
      vertical-align: middle;
      text-transform: uppercase;
      line-height: 1.25;
    }
    [data-theme="light"] .field-lock-tag {
      color: #92400e;
      background: rgba(245, 158, 11, 0.18);
      border-color: rgba(217, 119, 6, 0.45);
    }

    /* Required Field Label Badges (Clean Red Tag) */
    .field-req-tag {
      display: inline-flex;
      align-items: center;
      font-family: var(--font-mono, monospace);
      font-size: 0.72rem;
      font-weight: 700;
      color: #fde047;
      background: rgba(250, 204, 21, 0.15);
      border: 1px solid rgba(250, 204, 21, 0.45);
      padding: 1px 6px;
      border-radius: 4px;
      margin-left: 6px;
      letter-spacing: 0.3px;
      vertical-align: middle;
      line-height: 1.25;
      white-space: nowrap;
    }
    [data-theme="light"] .field-req-tag {
      color: #854d0e;
      background: rgba(254, 240, 138, 0.55);
      border-color: rgba(202, 138, 4, 0.5);
    }
    .field-req-tag-mini {
      display: inline-flex;
      align-items: center;
      font-family: var(--font-mono, monospace);
      font-size: 0.72rem;
      font-weight: 700;
      color: #fde047;
      background: rgba(250, 204, 21, 0.16);
      border: 1px solid rgba(250, 204, 21, 0.45);
      padding: 0 4px;
      border-radius: 3px;
      margin-left: 4px;
      line-height: 1.2;
      vertical-align: middle;
      text-transform: none;
      white-space: nowrap;
    }
    [data-theme="light"] .field-req-tag-mini {
      color: #854d0e;
      background: rgba(254, 240, 138, 0.55);
      border-color: rgba(202, 138, 4, 0.5);
    }

    /* Auto-Filled Field Label Badge (Emerald Green Tag) */
    .field-autofill-tag {
      display: inline-flex;
      align-items: center;
      font-family: var(--font-mono, monospace);
      font-size: 0.72rem;
      font-weight: 700;
      color: #00e676;
      background: rgba(0, 230, 118, 0.12);
      border: 1px solid rgba(0, 230, 118, 0.35);
      padding: 1px 6px;
      border-radius: 4px;
      margin-left: 6px;
      letter-spacing: 0.3px;
      vertical-align: middle;
      text-transform: none;
      line-height: 1.25;
    }
    [data-theme="light"] .field-autofill-tag {
      color: #059669;
      background: rgba(5, 150, 105, 0.12);
      border-color: rgba(5, 150, 105, 0.35);
    }

    /* Track Date & Time "NOW" Pill Button */
    .btn-now-pill {
      display: inline-flex;
      align-items: center;
      gap: 3px;
      background: rgba(0, 240, 255, 0.12);
      color: var(--accent-cyan, #00f0ff);
      border: 1px solid rgba(0, 240, 255, 0.4);
      border-radius: 4px;
      padding: 1px 7px;
      font-size: 0.68rem;
      font-weight: 700;
      letter-spacing: 0.5px;
      cursor: pointer;
      line-height: 1.35;
      transition: all 0.15s ease;
      user-select: none;
      flex-shrink: 0;
      margin-left: auto;
    }
    .btn-now-pill:hover {
      background: rgba(0, 240, 255, 0.25);
      border-color: var(--accent-cyan, #00f0ff);
      transform: translateY(-1px);
      box-shadow: 0 0 8px rgba(0, 240, 255, 0.35);
    }
    .btn-now-pill:active {
      transform: translateY(0);
    }
    [data-theme="light"] .btn-now-pill {
      background: rgba(0, 112, 243, 0.1);
      color: #0070f3;
      border-color: rgba(0, 112, 243, 0.4);
    }
    [data-theme="light"] .btn-now-pill:hover {
      background: rgba(0, 112, 243, 0.2);
      border-color: #0070f3;
    }
    .btn-now-pill:disabled,
    .btn-now-pill[disabled],
    .btn-now-pill.disabled {
      opacity: 0.35 !important;
      cursor: not-allowed !important;
      pointer-events: none !important;
      border-color: rgba(255, 255, 255, 0.15) !important;
      color: var(--text-muted, #71717a) !important;
      background: rgba(255, 255, 255, 0.05) !important;
      transform: none !important;
      box-shadow: none !important;
    }

    /* Distinctive Field Accents: Required vs Autofill */
    .form-field-required {
      border-left: 3.5px solid #f59e0b !important;
      border-color: rgba(251, 191, 36, 0.38) !important;
      background-color: rgba(254, 240, 138, 0.08) !important;
    }
    .form-field-required:focus {
      border-color: #fbbf24 !important;
      box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.22) !important;
    }
    [data-theme="light"] .form-field-required {
      border-left: 3.5px solid #d97706 !important;
      border-color: rgba(234, 179, 8, 0.45) !important;
      background-color: #fefce8 !important;
      color: #0f172a !important;
    }
    [data-theme="light"] .form-field-required:focus {
      border-color: #d97706 !important;
      box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.18) !important;
    }

    .form-field-autofill {
      border-left: 3.5px solid #00e676 !important;
      background-color: rgba(0, 230, 118, 0.02) !important;
    }
    .form-field-autofill:focus {
      border-color: #00e676 !important;
      box-shadow: 0 0 0 3px rgba(0, 230, 118, 0.18) !important;
    }
    [data-theme="light"] .form-field-autofill {
      border-left: 3.5px solid #059669 !important;
      background-color: rgba(5, 150, 105, 0.03) !important;
    }
    [data-theme="light"] .form-field-autofill:focus {
      border-color: #059669 !important;
      box-shadow: 0 0 0 3px rgba(5, 150, 105, 0.15) !important;
    }

    /* Cold PSI Stepper Highlight (Soft Light Yellow Fill) */
    .wheel-input-item.cold-required .input-stepper-wrap {
      border-left: 3.5px solid #f59e0b;
      border-color: rgba(251, 191, 36, 0.42);
      background-color: rgba(254, 240, 138, 0.08);
    }
    .wheel-input-item.cold-required .input-stepper-wrap:focus-within {
      border-color: #fbbf24;
      box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.22);
    }
    [data-theme="light"] .wheel-input-item.cold-required .input-stepper-wrap {
      border-left: 3.5px solid #d97706;
      border-color: rgba(234, 179, 8, 0.45);
      background-color: #fefce8;
    }
    [data-theme="light"] .wheel-input-item.cold-required .input-stepper-wrap:focus-within {
      border-color: #d97706;
      box-shadow: 0 0 0 2px rgba(217, 119, 6, 0.18);
    }

    /* Dimmed Placeholder Values for Distinct Contrast With User-Entered Data */
    #modal-log-session input::placeholder,
    #modal-log-session textarea::placeholder {
      color: rgba(148, 163, 184, 0.32) !important;
      -webkit-text-fill-color: rgba(148, 163, 184, 0.32) !important;
      opacity: 0.65 !important;
      font-weight: 400 !important;
    }
    [data-theme="light"] #modal-log-session input::placeholder,
    [data-theme="light"] #modal-log-session textarea::placeholder {
      color: rgba(100, 116, 139, 0.4) !important;
      -webkit-text-fill-color: rgba(100, 116, 139, 0.4) !important;
      opacity: 0.7 !important;
      font-weight: 400 !important;
    }
    #modal-log-session .best-lap-hero-input::placeholder {
      color: rgba(0, 230, 118, 0.28) !important;
      -webkit-text-fill-color: rgba(0, 230, 118, 0.28) !important;
      text-shadow: none !important;
      font-weight: 500 !important;
      opacity: 0.6 !important;
    }
    [data-theme="light"] #modal-log-session .best-lap-hero-input::placeholder {
      color: rgba(5, 150, 105, 0.32) !important;
      -webkit-text-fill-color: rgba(5, 150, 105, 0.32) !important;
      text-shadow: none !important;
      font-weight: 500 !important;
      opacity: 0.65 !important;
    }

    /* Share Session Card Modal & Preview Styling */
    .share-session-preview-box {
      background: #08090d;
      border: 1px solid var(--border-subtle);
      border-radius: var(--radius-md);
      padding: 0.4rem;
      display: flex;
      justify-content: center;
      align-items: center;
      overflow: hidden;
      box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5);
    }
    [data-theme="light"] .share-session-preview-box {
      background: #e2e8f0;
      border-color: rgba(15, 23, 42, 0.12);
      box-shadow: 0 12px 28px rgba(15, 23, 42, 0.08);
    }
    .share-modal-highlight {
      color: #ffffff;
    }
    [data-theme="light"] .share-modal-highlight {
      color: #0f172a;
    }

    /* Sessions Pagination Bar */
    .sessions-pagination-wrapper {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 0.75rem;
      margin-top: 1.5rem;
      margin-bottom: 2rem;
      padding: 0.5rem;
    }
    .sessions-pagination-controls {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 0.35rem;
      flex-wrap: wrap;
    }
    .session-page-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      gap: 4px;
      min-width: 38px;
      height: 38px;
      padding: 0 0.65rem;
      border-radius: var(--radius-sm, 6px);
      background: var(--bg-card, #0f1422);
      border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
      color: var(--text-muted, #94a3b8);
      font-family: var(--font-mono, monospace);
      font-size: 0.85rem;
      font-weight: 700;
      cursor: pointer;
      transition: all 0.18s ease;
      user-select: none;
    }
    .session-page-btn:hover:not(:disabled):not(.active) {
      border-color: var(--accent-cyan, #00f0ff);
      color: #ffffff;
      background: rgba(0, 240, 255, 0.08);
      transform: translateY(-1px);
    }
    .session-page-btn.active {
      background: rgba(0, 240, 255, 0.16);
      border-color: var(--accent-cyan, #00f0ff);
      color: var(--accent-cyan, #00f0ff);
      box-shadow: 0 0 12px rgba(0, 240, 255, 0.25);
    }
    .session-page-btn:disabled {
      opacity: 0.3;
      cursor: not-allowed;
      border-color: rgba(255, 255, 255, 0.06);
      pointer-events: none;
    }
    .session-page-ellipsis {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 24px;
      color: var(--text-dim, #64748b);
      font-family: var(--font-mono, monospace);
      font-weight: 700;
      user-select: none;
    }
    .session-pagination-info {
      font-size: 0.78rem;
      color: var(--text-muted, #94a3b8);
      font-family: var(--font-mono, monospace);
      letter-spacing: 0.2px;
    }
    .session-pagination-info strong {
      color: var(--text-main, #ffffff);
    }
    [data-theme="light"] .session-page-btn {
      background: #ffffff;
      border-color: rgba(15, 23, 42, 0.14);
      color: #64748b;
    }
    [data-theme="light"] .session-page-btn:hover:not(:disabled):not(.active) {
      border-color: #0284c7;
      color: #0f172a;
      background: rgba(2, 132, 199, 0.08);
    }
    [data-theme="light"] .session-page-btn.active {
      background: rgba(2, 132, 199, 0.12);
      border-color: #0284c7;
      color: #0284c7;
      box-shadow: 0 0 8px rgba(2, 132, 199, 0.2);
    }
    [data-theme="light"] .session-page-btn:disabled {
      border-color: rgba(15, 23, 42, 0.08);
      color: #94a3b8;
    }
    [data-theme="light"] .session-page-ellipsis {
      color: #94a3b8;
    }
    [data-theme="light"] .session-pagination-info {
      color: #64748b;
    }
    [data-theme="light"] .session-pagination-info strong {
      color: #0f172a;
    }
    @media (max-width: 600px) {
      .sessions-pagination-controls {
        gap: 0.22rem;
      }
      .session-page-btn {
        min-width: 34px;
        height: 34px;
        padding: 0 0.45rem;
        font-size: 0.8rem;
      }
      .session-pagination-info {
        font-size: 0.74rem;
      }
    }

    .hud-layout-row {
      display: flex;
      align-items: center;
      gap: 0.45rem;
      width: 100%;
      margin-top: 0.35rem;
    }

    .hud-layout-select {
      flex: 1;
      background: rgba(0, 0, 0, 0.55);
      border: 1px solid rgba(0, 240, 255, 0.25);
      color: #fff;
      font-family: var(--font-display);
      font-size: 0.82rem;
      font-weight: 700;
      padding: 0.35rem 0.65rem;
      border-radius: var(--radius-sm);
      outline: none;
      cursor: pointer;
      min-height: 34px;
      height: 34px;
      min-width: 0;
    }
    .hud-layout-select:focus {
      border-color: var(--accent-cyan);
      box-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
    }

    .filter-track-dropdown {
      background: rgba(15, 23, 42, 0.85);
      border: 1px solid var(--border-subtle);
      color: #f1f5f9;
      padding: 0.38rem 0.75rem;
      border-radius: var(--radius-full);
      font-size: 0.78rem;
      font-weight: 600;
      outline: none;
      cursor: pointer;
      min-height: 34px;
      transition: all var(--transition-fast);
    }
    .filter-track-dropdown:hover, .filter-track-dropdown:focus {
      border-color: var(--accent-cyan);
      box-shadow: 0 0 10px rgba(0, 240, 255, 0.2);
    }

    .session-date-badge {
      font-size: 0.72rem;
      color: var(--text-muted);
      background: rgba(255, 255, 255, 0.05);
      padding: 0.18rem 0.55rem;
      border-radius: var(--radius-sm);
      font-family: var(--font-mono);
      white-space: nowrap;
      flex-shrink: 0;
    }

    .session-vehicle-line {
      display: flex;
      align-items: center;
      gap: 0.45rem;
      font-size: 0.82rem;
      color: var(--text-muted);
    }

    .session-vehicle-line i {
      width: 14px;
      height: 14px;
      color: var(--accent-cyan);
    }

    .session-best-lap-box,
    .session-perf-banner {
      background: rgba(0, 0, 0, 0.4);
      border: 1px solid rgba(255, 255, 255, 0.07);
      border-radius: var(--radius-sm);
      padding: 0.65rem 0.95rem;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 0.75rem;
    }

    .session-perf-stat {
      display: flex;
      flex-direction: column;
      gap: 0.15rem;
    }

    .session-perf-stat.session-laps-stat {
      align-items: center;
      text-align: center;
    }

    .session-perf-stat.session-speed-stat {
      align-items: flex-end;
      text-align: right;
    }

    .session-perf-divider {
      width: 1px;
      height: 32px;
      background: rgba(255, 255, 255, 0.1);
      flex-shrink: 0;
    }

    .best-lap-label,
    .session-perf-label {
      font-size: 0.72rem;
      font-family: var(--font-display);
      text-transform: uppercase;
      letter-spacing: 0.5px;
      color: var(--text-dim);
      font-weight: 700;
      display: flex;
      align-items: center;
      gap: 0.25rem;
    }

    .best-lap-time,
    .session-perf-val {
      font-family: var(--font-mono);
      font-size: 1.38rem;
      font-weight: 900;
      line-height: 1.2;
    }

    .best-lap-time,
    .session-perf-val.best-lap-time {
      color: var(--accent-green);
      text-shadow: 0 0 16px rgba(0, 230, 118, 0.35);
      letter-spacing: 0.5px;
    }

    .session-perf-val.top-speed-val {
      color: var(--accent-cyan);
      text-shadow: 0 0 16px rgba(0, 240, 255, 0.35);
      letter-spacing: 0.3px;
    }
    .session-perf-val.total-laps-val {
      color: #f1f5f9;
      letter-spacing: 0.3px;
    }
    .session-perf-val.total-laps-val small,
    .session-perf-val.total-laps-val .total-laps-unit {
      font-size: 0.72rem;
      color: var(--text-dim);
      font-weight: 700;
    }

    /* 4-Wheel Mini PSI Pill Grid */
    .tire-psi-mini-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 0.45rem;
      background: rgba(0, 0, 0, 0.22);
      padding: 0.55rem;
      border-radius: var(--radius-sm);
      font-family: var(--font-mono);
      font-size: 0.76rem;
    }

    .tire-psi-cell {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 0.3rem 0.5rem;
      background: rgba(255, 255, 255, 0.03);
      border-radius: 4px;
    }

    .tire-wheel-tag {
      color: var(--text-dim);
      font-weight: 700;
      font-size: 0.72rem;
    }

    .tire-psi-val {
      color: #fff;
      font-weight: 700;
    }

    .tire-psi-val span.hot {
      color: var(--accent-amber);
    }

    .session-actions-bar {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      margin-top: auto;
      padding-top: 0.6rem;
      border-top: 1px solid var(--border-subtle);
    }

    .btn-session-lock {
      transition: all var(--transition-fast);
    }
    .btn-session-lock.locked {
      color: var(--accent-amber, #ffb300) !important;
      border-color: rgba(255, 179, 0, 0.5) !important;
      background: rgba(255, 179, 0, 0.12) !important;
    }
    .btn-session-lock:hover {
      border-color: var(--accent-amber, #ffb300) !important;
      color: var(--accent-amber, #ffb300) !important;
    }
    .session-locked-badge {
      display: inline-flex;
      align-items: center;
      gap: 3px;
      font-size: 0.7rem;
      font-weight: 700;
      padding: 1px 6px;
      border-radius: 4px;
      background: rgba(255, 179, 0, 0.15);
      color: var(--accent-amber, #ffb300);
      border: 1px solid rgba(255, 179, 0, 0.4);
    }

    /* Session Visibility & Friend Access Controls */
    .session-vis-bar {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 0.5rem;
      padding-top: 0.55rem;
      border-top: 1px dashed rgba(255, 255, 255, 0.08);
      flex-wrap: wrap;
    }

    .session-vis-selector {
      display: inline-flex;
      align-items: center;
      background: rgba(0, 0, 0, 0.5);
      border: 1px solid rgba(255, 255, 255, 0.08);
      border-radius: var(--radius-full);
      padding: 2px;
      gap: 2px;
    }

    .vis-pill {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      background: transparent;
      border: none;
      color: var(--text-muted);
      font-family: var(--font-display);
      font-size: 0.72rem;
      font-weight: 700;
      padding: 0.22rem 0.55rem;
      border-radius: var(--radius-full);
      cursor: pointer;
      transition: all var(--transition-fast, 0.15s ease);
      touch-action: manipulation;
      white-space: nowrap;
    }

    .vis-pill i {
      width: 12px;
      height: 12px;
    }

    .vis-pill:hover {
      color: #fff;
    }

    .vis-pill.active.public {
      background: rgba(0, 240, 255, 0.18);
      color: var(--accent-cyan);
      box-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
    }

    .vis-pill.active.friends {
      background: rgba(255, 184, 48, 0.2);
      color: #ffb830;
      box-shadow: 0 0 10px rgba(255, 184, 48, 0.35);
    }

    .vis-pill.active.private {
      background: rgba(255, 255, 255, 0.14);
      color: #f1f5f9;
    }

    .btn-manage-friends {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      background: rgba(255, 184, 48, 0.12);
      border: 1px solid rgba(255, 184, 48, 0.38);
      color: #ffb830;
      font-family: var(--font-display);
      font-size: 0.72rem;
      font-weight: 700;
      padding: 0.24rem 0.65rem;
      border-radius: var(--radius-full);
      cursor: pointer;
      transition: all 0.15s ease;
      touch-action: manipulation;
    }

    .btn-manage-friends:hover {
      background: rgba(255, 184, 48, 0.25);
      transform: translateY(-1px);
      box-shadow: 0 0 12px rgba(255, 184, 48, 0.4);
    }

    .btn-manage-friends i {
      width: 13px;
      height: 13px;
    }

    /* Batch Session Visibility Panel */
    .batch-visibility-panel {
      background: linear-gradient(145deg, rgba(17, 24, 39, 0.75), rgba(15, 23, 42, 0.85));
      border: 1px solid rgba(255, 255, 255, 0.08);
      border-radius: 12px;
      padding: 1.1rem 1.4rem;
      margin-top: 1.5rem;
      margin-bottom: 2rem;
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 1.25rem;
      flex-wrap: wrap;
      box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
    }
    .batch-visibility-info {
      flex: 1;
      min-width: 260px;
    }
    .batch-visibility-title {
      font-size: 0.92rem;
      font-weight: 700;
      color: var(--text-light);
      display: flex;
      align-items: center;
      gap: 0.5rem;
      margin-bottom: 0.25rem;
    }
    .batch-visibility-desc {
      font-size: 0.78rem;
      color: var(--text-dim);
      line-height: 1.4;
    }
    .batch-visibility-actions {
      display: flex;
      gap: 0.5rem;
      align-items: center;
      flex-wrap: wrap;
    }
    .batch-vis-btn {
      display: inline-flex;
      align-items: center;
      gap: 0.35rem;
      font-size: 0.78rem;
      font-weight: 600;
      padding: 0.45rem 0.85rem;
      border-radius: 8px;
      transition: all 0.2s ease;
      background: rgba(255, 255, 255, 0.04);
      border: 1px solid rgba(255, 255, 255, 0.12);
      color: var(--text-muted);
      cursor: pointer;
    }
    .batch-vis-btn:hover {
      background: rgba(255, 255, 255, 0.08);
      color: #fff;
    }
    .batch-vis-btn.public:hover {
      border-color: var(--accent-cyan);
      color: var(--accent-cyan);
      background: rgba(0, 240, 255, 0.08);
    }
    .batch-vis-btn.friends:hover {
      border-color: #ffb830;
      color: #ffb830;
      background: rgba(255, 184, 48, 0.1);
    }
    .batch-vis-btn.private:hover {
      border-color: #f1f5f9;
      color: #f1f5f9;
      background: rgba(255, 255, 255, 0.1);
    }
    .batch-vis-btn.manage-friends {
      border-color: rgba(255, 184, 48, 0.35);
      background: rgba(255, 184, 48, 0.08);
      color: #ffb830;
      margin-left: 0.25rem;
    }
    .batch-vis-btn.manage-friends:hover {
      border-color: #ffb830;
      background: rgba(255, 184, 48, 0.2);
      color: #ffc95c;
      transform: translateY(-1px);
      box-shadow: 0 0 12px rgba(255, 184, 48, 0.35);
    }
    @media (max-width: 640px) {
      .batch-visibility-panel {
        flex-direction: column;
        align-items: stretch;
        padding: 1rem;
        gap: 0.85rem;
      }
      .batch-visibility-actions {
        width: 100%;
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.45rem;
      }
      .batch-vis-btn {
        width: 100%;
        justify-content: center;
        padding: 0.5rem 0.4rem;
        font-size: 0.76rem;
        margin-left: 0 !important;
      }
    }

    /* Empty state */
    .empty-state-box {
      text-align: center;
      padding: 3.5rem 1.5rem;
      background: var(--bg-card);
      border: 1px dashed var(--border-bright);
      border-radius: var(--radius-lg);
      margin: 1rem 0;
    }

    .empty-state-box i {
      width: 48px;
      height: 48px;
      color: var(--text-dim);
      margin-bottom: 0.75rem;
    }

        /* --- 5. GPS LAP TIMER TAB (HUD DISPLAY) --- */

    #view-lap-timer,
#view-pit-timer,
.timer-hud-container,
.pit-hud-container {
  touch-action: pan-y pinch-zoom;
}

    .timer-hud-container {
      background: linear-gradient(180deg, rgba(14, 20, 32, 0.95), rgba(7, 10, 16, 0.98));
      border: 1px solid rgba(0, 240, 255, 0.3);
      border-radius: var(--radius-lg);
      padding: 1.35rem;
      box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6), 0 0 30px rgba(0, 240, 255, 0.12);
      max-width: 880px;
      margin: 0 auto;
      display: flex;
      flex-direction: column;
      gap: 1.15rem;
    }

    .hud-header-bar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 0.65rem;
    }

    .hud-circuit-select-wrapper {
      display: flex;
      align-items: center;
      gap: 0.45rem;
      flex: 1;
      min-width: 250px;
    }

    .hud-select {
      background: rgba(0, 0, 0, 0.5);
      border: 1px solid rgba(0, 240, 255, 0.35);
      color: #fff;
      font-family: var(--font-display);
      font-size: 0.9rem;
      font-weight: 700;
      padding: 0.5rem 0.85rem;
      border-radius: var(--radius-sm);
      outline: none;
      width: 100%;
      cursor: pointer;
      min-height: 40px;
    }

    .hud-status-badge {
      display: inline-flex;
      align-items: center;
      gap: 0.4rem;
      padding: 0.35rem 0.75rem;
      border-radius: var(--radius-full);
      font-size: 0.75rem;
      font-family: var(--font-mono);
      font-weight: 700;
      background: rgba(255, 42, 75, 0.15);
      border: 1px solid rgba(255, 42, 75, 0.4);
      color: var(--accent-red);
      min-height: 32px;
    }

    .hud-status-badge.active {
      background: rgba(0, 230, 118, 0.15);
      border-color: rgba(0, 230, 118, 0.5);
      color: var(--accent-green);
    }

    .hud-status-badge.sim {
      background: rgba(255, 179, 0, 0.15);
      border-color: rgba(255, 179, 0, 0.5);
      color: var(--accent-amber);
    }

    /* GPS Auto-Start Status Banners */

    .hud-auto-start-banner {
      display: flex;
      align-items: center;
      justify-content: center;
      flex-wrap: nowrap !important;
      gap: 0.65rem;
      padding: 0.65rem 0.95rem;
      background: rgba(0, 240, 255, 0.08);
      border: 1px solid rgba(0, 240, 255, 0.35);
      border-radius: var(--radius-sm);
      scroll-margin-top: 54px;
      transition: all var(--transition-normal);
      overflow: hidden;
      white-space: nowrap;
    }

    .hud-auto-start-banner.pit {
      background: rgba(255, 179, 0, 0.08);
      border-color: rgba(255, 179, 0, 0.35);
    }

    .hud-auto-start-banner.triggered {
      background: rgba(0, 230, 118, 0.16) !important;
      border-color: var(--accent-green) !important;
      box-shadow: 0 0 18px rgba(0, 230, 118, 0.35);
    }

    .auto-start-indicator {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 0.6rem;
      flex-shrink: 0;
    }

    .auto-start-dot,
    .auto-start-dot.pit {
      width: 14px;
      height: 14px;
      border-radius: 50%;
      background: var(--accent-green, #00e676);
      box-shadow: 0 0 14px var(--accent-green, #00e676), 0 0 4px #fff;
      animation: autoStartPulse 1.4s infinite ease-in-out;
      flex-shrink: 0;
    }

    .auto-start-dot.active,
    .auto-start-dot.pit.active {
      background: var(--accent-green, #00e676) !important;
      box-shadow: 0 0 18px var(--accent-green, #00e676), 0 0 5px #fff !important;
      animation: none;
    }

    .auto-start-dot.amber,
    .auto-start-dot.pit.amber {
      background: #ffb300 !important;
      box-shadow: 0 0 16px #ffb300, 0 0 4px #fff !important;
      animation: autoStartPulseAmber 0.8s infinite ease-in-out !important;
    }

    .auto-start-dot.red,
    .auto-start-dot.pit.red {
      background: #ff2a4b !important;
      box-shadow: 0 0 16px #ff2a4b, 0 0 4px #fff !important;
      animation: none !important;
    }

    .auto-start-dot.green,
    .auto-start-dot.pit.green {
      background: var(--accent-green, #00e676) !important;
      box-shadow: 0 0 18px var(--accent-green, #00e676), 0 0 5px #fff !important;
      animation: autoStartPulse 1.4s infinite ease-in-out !important;
    }

    @keyframes autoStartPulseAmber {
      0% { opacity: 0.4; transform: scale(0.9); box-shadow: 0 0 8px #ffb300; }
      50% { opacity: 1; transform: scale(1.15); box-shadow: 0 0 18px #ffb300, 0 0 4px #fff; }
      100% { opacity: 0.4; transform: scale(0.9); box-shadow: 0 0 8px #ffb300; }
    }

    @keyframes autoStartPulse {
      0% { opacity: 0.35; transform: scale(0.85); box-shadow: 0 0 8px var(--accent-green, #00e676); }

      50% { opacity: 1; transform: scale(1.15); box-shadow: 0 0 16px var(--accent-green, #00e676), 0 0 5px #fff; }

      100% { opacity: 0.35; transform: scale(0.85); box-shadow: 0 0 8px var(--accent-green, #00e676); }

    }

    /* Pre-Flight Circuit Readiness & Motorsport Starting Lights */
    .start-lights-cluster {
      display: inline-flex;
      align-items: center;
      gap: 5px;
      padding: 3px 6px;
      background: rgba(0, 0, 0, 0.5);
      border: 1px solid rgba(255, 255, 255, 0.15);
      border-radius: 9999px;
      flex-shrink: 0;
    }
    .s-light {
      width: 10px;
      height: 10px;
      border-radius: 50%;
      background: rgba(255, 255, 255, 0.15);
      border: 1px solid rgba(255, 255, 255, 0.2);
      transition: all 0.22s ease-in-out;
      flex-shrink: 0;
    }
    .s-light.amber {
      background: #ffb300 !important;
      border-color: #ffd54f !important;
      box-shadow: 0 0 10px #ffb300, 0 0 2px #fff !important;
      animation: autoStartPulse 0.8s infinite ease-in-out;
    }
    .s-light.red {
      background: #ff2a4b !important;
      border-color: #ff6b81 !important;
      box-shadow: 0 0 10px #ff2a4b, 0 0 2px #fff !important;
    }
    .s-light.green {
      background: #00e676 !important;
      border-color: #69f0ae !important;
      box-shadow: 0 0 12px #00e676, 0 0 3px #fff !important;
      animation: autoStartPulse 1.4s infinite ease-in-out;
    }
    .s-light.off {
      background: rgba(255, 255, 255, 0.08) !important;
      border-color: rgba(255, 255, 255, 0.12) !important;
      box-shadow: none !important;
      animation: none !important;
    }

    .hud-auto-start-banner {
      cursor: pointer;
      user-select: none;
    }
    .hud-auto-start-banner:hover {
      border-color: rgba(0, 240, 255, 0.55);
    }
    .hud-auto-start-banner.preflight-scanning {
      background: rgba(255, 179, 0, 0.12) !important;
      border-color: rgba(255, 179, 0, 0.5) !important;
      box-shadow: 0 0 16px rgba(255, 179, 0, 0.25) !important;
    }

    .auto-start-title {
      font-family: var(--font-display);
      font-weight: 800;
      font-size: 0.92rem;
      letter-spacing: 0.5px;
      color: #fff;
      white-space: nowrap;
    }

    .auto-start-desc {
      font-size: 0.88rem;
      color: var(--text-muted);
      font-family: var(--font-sans);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      flex-shrink: 1;
      text-align: right;
    }

    .auto-start-desc.live-distance {
      color: var(--accent-cyan, #00f0ff) !important;
      font-family: var(--font-mono, monospace);
      font-weight: 800;
      letter-spacing: 0.3px;
    }

    .hud-auto-start-banner.pit .auto-start-desc.live-distance {
      color: var(--accent-amber, #ffb300) !important;
    }

    .rc-delta-num-badge.armed-dist {
      font-size: 1.15rem !important;
      color: var(--accent-cyan, #00f0ff) !important;
      letter-spacing: 0.5px;
      padding: 0.2rem 0.65rem !important;
    }

    /* Big Digital Lap Time Gauge */

    .hud-laptime-gauge {
      text-align: center;
      padding: 1.5rem 0.75rem;
      background: radial-gradient(circle at 50% 50%, rgba(0, 240, 255, 0.08), transparent 75%);
      border: 1px solid rgba(255, 255, 255, 0.06);
      border-radius: var(--radius-md);
      position: relative;
    }

    .hud-lap-number-pill {
      display: inline-block;
      font-family: var(--font-display);
      font-size: 0.85rem;
      font-weight: 800;
      text-transform: uppercase;
      letter-spacing: 1px;
      color: var(--accent-cyan);
      margin-bottom: 0.35rem;
    }

    .hud-big-lap-time {
      font-family: var(--font-timer) !important;
      font-variant-numeric: tabular-nums lining-nums;
      -webkit-font-feature-settings: "tnum" 1, "lnum" 1;
      font-feature-settings: "tnum" 1, "lnum" 1;
      font-kerning: none;
      font-size: clamp(3.2rem, 7.5vw, 5.5rem);
      font-weight: 700;
      color: #fff;
      text-shadow: 0 0 32px rgba(0, 240, 255, 0.5);
      line-height: 1;
      letter-spacing: -0.5px;
      display: inline-block;
      width: auto;
      min-width: 9ch;
      max-width: 100%;
      text-align: center;
      white-space: nowrap;
      box-sizing: content-box;
    }

    .hud-pred-lap-pill {
      display: inline-flex;
      align-items: center;
      gap: 0.35rem;
      background: rgba(0, 0, 0, 0.55);
      border: 1px solid rgba(0, 240, 255, 0.25);
      padding: 0.2rem 0.6rem;
      border-radius: var(--radius-full);
      font-size: 0.75rem;
      letter-spacing: 0.3px;
    }

    .predictive-delta-container {
      width: 100%;
      max-width: 440px;
      margin: 0.55rem auto 0;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 0.35rem;
    }

    .pred-scale-toolbar {
      width: 100%;
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 0 0.2rem;
      margin-bottom: 0.15rem;
    }

    .pred-scale-label {
      font-family: var(--font-display);
      font-size: 0.72rem;
      font-weight: 700;
      color: var(--text-dim);
      letter-spacing: 0.8px;
      text-transform: uppercase;
      display: flex;
      align-items: center;
      gap: 0.3rem;
    }

    .pred-scale-group {
      display: inline-flex;
      align-items: center;
      background: rgba(0, 0, 0, 0.45);
      border: 1px solid rgba(255, 255, 255, 0.1);
      border-radius: var(--radius-full);
      padding: 2px;
      gap: 2px;
    }

    .pred-scale-btn {
      background: transparent;
      border: none;
      color: var(--text-dim);
      font-family: var(--font-timer);
      font-size: 0.72rem;
      font-weight: 700;
      padding: 0.12rem 0.55rem;
      border-radius: var(--radius-full);
      cursor: pointer;
      transition: all var(--transition-fast);
      white-space: nowrap;
    }

    .pred-scale-btn:hover {
      color: #fff;
      background: rgba(255, 255, 255, 0.08);
    }

    .pred-scale-btn.active {
      background: var(--accent-cyan);
      color: #000;
      font-weight: 900;
      box-shadow: 0 0 10px rgba(0, 240, 255, 0.5);
    }

    .predictive-delta-bar-wrap {
      width: 100%;
      background: rgba(0, 0, 0, 0.55);
      border: 1px solid rgba(255, 255, 255, 0.12);
      border-radius: 6px;
      padding: 0.35rem 0.65rem 0.45rem;
      box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6);
    }

    .pred-bar-scale-labels {
      display: flex;
      justify-content: space-between;
      font-family: var(--font-mono);
      font-size: 0.72rem;
      font-weight: 700;
      color: var(--text-dim);
      margin-bottom: 0.25rem;
      padding: 0 2px;
    }

    .pred-bar-scale-labels .center-zero {
      color: var(--accent-cyan);
    }

    .pred-split-track {
      position: relative;
      height: 12px;
      background: rgba(255, 255, 255, 0.05);
      border-radius: 4px;
      display: flex;
      overflow: hidden;
      border: 1px solid rgba(255, 255, 255, 0.08);
    }

    .pred-loss-half {
      flex: 1;
      display: flex;
      justify-content: flex-end;
      height: 100%;
      background: rgba(255, 42, 75, 0.05);
    }

    .pred-bar-fill-loss {
      height: 100%;
      width: 0%;
      background: linear-gradient(270deg, #ff2a4b, #ff1744);
      box-shadow: 0 0 10px rgba(255, 42, 75, 0.85);
      border-radius: 2px 0 0 2px;
      transition: width 0.08s linear;
    }

    .pred-bar-center-pin {
      width: 2px;
      height: 100%;
      background: #fff;
      box-shadow: 0 0 6px rgba(255, 255, 255, 0.9);
      z-index: 2;
    }

    .pred-gain-half {
      flex: 1;
      display: flex;
      justify-content: flex-start;
      height: 100%;
      background: rgba(0, 230, 118, 0.05);
    }

    .pred-bar-fill-gain {
      height: 100%;
      width: 0%;
      background: linear-gradient(90deg, #00e676, #00c853);
      box-shadow: 0 0 10px rgba(0, 230, 118, 0.85);
      border-radius: 0 2px 2px 0;
      transition: width 0.08s linear;
    }

    .hud-delta-display {
      font-family: var(--font-timer) !important;
      font-variant-numeric: tabular-nums lining-nums;
      -webkit-font-feature-settings: "tnum" 1, "lnum" 1;
      font-feature-settings: "tnum" 1, "lnum" 1;
      font-kerning: none;
      font-size: 1.05rem;
      font-weight: 800;
      display: flex;
      align-items: baseline;
      justify-content: center;
      flex-wrap: nowrap;
      white-space: nowrap;
      overflow: hidden;
      width: 100%;
      min-height: 1.45rem;
      gap: 0.45rem;
      letter-spacing: 0px;
      line-height: 1;
      margin-top: 0.35rem;
      text-align: center;
    }

    .hud-delta-val,
    #lap-delta-val,
    #pit-delta-val {
      font-family: var(--font-timer) !important;
      font-variant-numeric: tabular-nums lining-nums;
      -webkit-font-feature-settings: "tnum" 1, "lnum" 1;
      font-feature-settings: "tnum" 1, "lnum" 1;
      font-kerning: none;
      display: inline-block;
      flex-shrink: 0;
      white-space: nowrap;
      min-width: auto;
      text-align: left;
      letter-spacing: 0px;
      font-size: 1.05rem;
      font-weight: 800;
    }

    #lap-delta-val {
      color: var(--accent-cyan, #00f0ff);
    }

    #pit-delta-val {
      color: var(--accent-amber, #ffb300);
    }

    #lap-pred-time {
      font-family: var(--font-timer) !important;
      font-variant-numeric: tabular-nums lining-nums;
      -webkit-font-feature-settings: "tnum" 1, "lnum" 1;
      font-feature-settings: "tnum" 1, "lnum" 1;
      font-kerning: none;
      display: inline-block;
      min-width: 9ch;
      text-align: right;
      letter-spacing: 0px;
    }

    .hud-delta-display.faster {
      color: var(--accent-green);
      text-shadow: 0 0 16px rgba(0, 230, 118, 0.6);
    }

    .hud-delta-display.slower {
      color: var(--accent-red);
      text-shadow: 0 0 16px rgba(255, 42, 75, 0.6);
    }

    .hud-delta-display.even {
      color: var(--text-dim);
    }

    .hud-delta-sub {
      font-family: var(--font-display);
      font-size: 1.05rem;
      font-weight: 700;
      letter-spacing: 0.4px;
      color: var(--text-muted);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      min-width: 0;
      flex: 0 0 auto;
      font-variant-numeric: tabular-nums lining-nums;
    }

    .precision-badge {
      display: inline-flex;
      align-items: center;
      gap: 0.25rem;
      font-family: var(--font-mono);
      font-size: 0.72rem;
      font-weight: 700;
      color: var(--accent-cyan);
      background: rgba(0, 240, 255, 0.08);
      border: 1px solid rgba(0, 240, 255, 0.25);
      padding: 0.12rem 0.45rem;
      border-radius: 4px;
    }

    /* HUD Stats Grid (Speed, Best Lap, Last Lap) */

    .hud-stats-grid {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 0.65rem;
    }

    .hud-stat-tile {
      background: rgba(0, 0, 0, 0.4);
      border: 1px solid var(--border-subtle);
      border-radius: var(--radius-sm);
      padding: 0.75rem 0.5rem;
      text-align: center;
    }

    .hud-stat-label {
      font-size: 0.72rem;
      font-family: var(--font-display);
      text-transform: uppercase;
      color: var(--text-dim);
      letter-spacing: 0.5px;
    }

    .hud-stat-val {
      font-family: var(--font-timer) !important;
      font-variant-numeric: tabular-nums lining-nums;
      -webkit-font-feature-settings: "tnum" 1, "lnum" 1;
      font-feature-settings: "tnum" 1, "lnum" 1;
      font-kerning: none;
      letter-spacing: 0px;
      font-size: 1.35rem;
      font-weight: 700;
      color: #fff;
      margin-top: 0.2rem;
      white-space: nowrap;
    }

    /* GPS Telemetry Diagnostics Strip */

    .hud-diag-strip {
      display: flex;
      flex-direction: column;
      gap: 0.42rem;
      background: rgba(0, 0, 0, 0.45);
      border: 1px solid rgba(255, 255, 255, 0.07);
      padding: 0.55rem 0.85rem;
      border-radius: var(--radius-sm);
      font-size: 0.74rem;
      font-family: var(--font-mono);
      color: var(--text-muted);
    }

    .hud-diag-readings {
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: nowrap !important;
      white-space: nowrap !important;
      overflow: hidden;
      gap: 0.35rem 0.65rem;
      height: 1.45rem;
      min-height: 1.45rem;
      max-height: 1.45rem;
      line-height: 1.45rem;
      font-size: clamp(0.72rem, 0.85vw, 0.74rem);
    }

    .hud-diag-readings span,
    .hud-diag-badges span {
      white-space: nowrap !important;
    }

    .hud-diag-readings > span {
      white-space: nowrap !important;
      overflow: hidden;
      text-overflow: ellipsis;
      flex-shrink: 1;
      min-width: 0;
    }

    .hud-diag-badges {
      display: flex;
      align-items: center;
      flex-wrap: wrap;
      gap: 0.5rem;
      padding-top: 0.4rem;
      border-top: 1px solid rgba(255, 255, 255, 0.06);
    }

    /* Lap Timer Controls (Desktop: 4 balanced buttons) */

    .btn.btn-gps-connected {
      background: rgba(0, 230, 118, 0.12) !important;
      border-color: rgba(0, 230, 118, 0.5) !important;
      color: var(--accent-green) !important;
      box-shadow: 0 0 10px rgba(0, 230, 118, 0.15) !important;
    }

    .btn.btn-gps-stalled {
      background: rgba(255, 170, 0, 0.12) !important;
      border-color: rgba(255, 170, 0, 0.5) !important;
      color: var(--accent-amber) !important;
      box-shadow: 0 0 10px rgba(255, 170, 0, 0.15) !important;
    }

    .hud-controls-cluster {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 0.55rem;
      align-items: stretch;
    }
    .hud-controls-cluster .btn {
      min-height: 44px;
      font-size: 0.85rem;
      padding: 0.5rem 0.5rem;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      justify-content: center;
    }

    .hud-controls-cluster .btn {
      min-height: 44px;
      white-space: nowrap;
      justify-content: center;
    }

    .vbo-count-pill {
      font-size: 0.72rem;
      font-family: var(--font-mono);
      font-weight: 700;
      background: rgba(0, 240, 255, 0.15);
      border: 1px solid rgba(0, 240, 255, 0.4);
      color: var(--accent-cyan);
      padding: 0.12rem 0.45rem;
      border-radius: var(--radius-full);
      margin-left: 0.35rem;
      display: inline-block;
      vertical-align: middle;
      transition: all var(--transition-fast);
      white-space: nowrap;
      flex-shrink: 0;
    }

    .vbo-count-pill.active {
      background: rgba(0, 230, 118, 0.2);
      border-color: rgba(0, 230, 118, 0.5);
      color: var(--accent-green);
    }

    .hud-btn-vbo {
      border-color: rgba(0, 240, 255, 0.45) !important;
      color: var(--accent-cyan) !important;
      background: rgba(0, 240, 255, 0.05);
      font-weight: 700;
      transition: all var(--transition-fast);
    }

    .hud-btn-vbo:hover {
      background: rgba(0, 240, 255, 0.15) !important;
      box-shadow: 0 0 16px rgba(0, 240, 255, 0.3);
      color: #fff !important;
    }

    /* Screen Wake Lock & External BLE GPS Badges */

    .wakelock-badge {
      cursor: pointer;
      user-select: none;
      transition: all 0.2s ease;
      display: inline-flex;
      align-items: center;
      gap: 0.25rem;
      padding: 0.15rem 0.5rem;
      border-radius: var(--radius-sm);
      font-weight: 600;
    }

    .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.12);
      color: var(--text-dim);
    }

    .wakelock-badge:hover {
      filter: brightness(1.2);
    }

    .ext-gps-badge {
      cursor: pointer;
      user-select: none;
      transition: all 0.2s ease;
      display: inline-flex;
      align-items: center;
      gap: 0.25rem;
      padding: 0.15rem 0.5rem;
      border-radius: var(--radius-sm);
      font-weight: 600;
    }

    .ext-gps-badge.connected {
      background: rgba(0, 240, 255, 0.15);
      border: 1px solid rgba(0, 240, 255, 0.6);
      color: var(--accent-cyan);
      text-shadow: 0 0 8px rgba(0, 240, 255, 0.4);
      animation: blePulseGlow 2s infinite ease-in-out;
    }

    .ext-gps-badge.standby {
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid rgba(255, 255, 255, 0.12);
      color: var(--text-dim);
    }

    .ext-gps-badge:hover {
      filter: brightness(1.2);
      border-color: var(--accent-cyan);
    }

    @keyframes blePulseGlow {
      0%, 100% { box-shadow: 0 0 6px rgba(0, 240, 255, 0.25); }

      50% { box-shadow: 0 0 14px rgba(0, 240, 255, 0.55); }

    }

    .hud-btn-ble {
      border-color: rgba(0, 240, 255, 0.35) !important;
      color: var(--accent-cyan) !important;
      background: rgba(0, 240, 255, 0.05);
      font-weight: 700;
      transition: all var(--transition-fast);
    }

    .hud-btn-ble:hover {
      background: rgba(0, 240, 255, 0.15) !important;
      border-color: var(--accent-cyan) !important;
      color: #fff !important;
      box-shadow: 0 0 14px rgba(0, 240, 255, 0.3);
    }

    .hud-btn-ble.connected {
      background: rgba(0, 240, 255, 0.18) !important;
      border-color: var(--accent-cyan) !important;
      color: #fff !important;
      box-shadow: 0 0 12px rgba(0, 240, 255, 0.35);
    }

    /* BLE GPS Modal & GNSS Signal Telemetry Styles */

    .gps-live-dot {
      width: 7px;
      height: 7px;
      border-radius: 50%;
      background: var(--text-dim);
      display: inline-block;
      transition: all 0.25s ease;
    }

    .gps-live-dot.active {
      background: var(--accent-green);
      box-shadow: 0 0 8px var(--accent-green);
      animation: gpsPulse 1.2s infinite alternate;
    }

    @keyframes gpsPulse {
      0% { opacity: 0.5; transform: scale(0.9); }

      100% { opacity: 1; transform: scale(1.15); }

    }

    .gps-signal-meter-box {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      background: rgba(0, 0, 0, 0.45);
      padding: 0.25rem 0.55rem;
      border-radius: var(--radius-sm);
      border: 1px solid var(--border-subtle);
    }

    .gps-signal-meter {
      display: inline-flex;
      align-items: flex-end;
      gap: 2px;
      height: 13px;
    }

    .gps-signal-bar {
      width: 3px;
      border-radius: 1px;
      background: rgba(255, 255, 255, 0.18);
      transition: background 0.2s;
    }

    .gps-signal-bar.bar-1 { height: 3px; }

    .gps-signal-bar.bar-2 { height: 5px; }

    .gps-signal-bar.bar-3 { height: 8px; }

    .gps-signal-bar.bar-4 { height: 11px; }

    .gps-signal-bar.bar-5 { height: 13px; }

    .gps-signal-bar.active-green { background: var(--accent-green); }

    .gps-signal-bar.active-cyan { background: var(--accent-cyan); }

    .gps-signal-bar.active-amber { background: var(--accent-amber); }

    .gps-signal-bar.active-red { background: var(--accent-red); }

    .ble-status-grid {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 0.5rem;
      margin: 0.7rem 0;
    }

    .gps-guide-accordion {
      margin-top: 0.65rem;
      border: 1px solid rgba(255, 255, 255, 0.08);
      border-radius: var(--radius-sm);
      overflow: hidden;
      background: rgba(0, 0, 0, 0.3);
      transition: border-color 0.2s;
    }
    .gps-guide-accordion:hover {
      border-color: rgba(0, 240, 255, 0.25);
    }
    .gps-guide-header-btn {
      width: 100%;
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding: 0.6rem 0.85rem;
      background: rgba(255, 255, 255, 0.03);
      border: none;
      color: var(--text-light);
      font-size: 0.75rem;
      font-weight: 700;
      cursor: pointer;
      text-align: left;
    }
    .gps-guide-header-btn:hover {
      background: rgba(255, 255, 255, 0.06);
    }
    .gps-guide-header-btn i.chevron-icon {
      transition: transform 0.25s ease;
    }

    @media (max-width: 640px) {
      #modal-ble-gps .modal-card {
        max-height: 94dvh !important;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0 !important;
      }
      #modal-ble-gps .modal-body {
        padding: 0.65rem 0.85rem 1.25rem 0.85rem !important;
        gap: 0.5rem !important;
      }
      #modal-ble-gps .ble-status-grid {
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 0.35rem !important;
        margin: 0.45rem 0 !important;
      }
      #modal-ble-gps .ble-status-tile {
        padding: 0.45rem 0.2rem !important;
        border-radius: var(--radius-sm) !important;
      }
      #modal-ble-gps .ble-status-tile .tile-label {
        font-size: 0.72rem !important;
        letter-spacing: -0.2px !important;
      }
      #modal-ble-gps .ble-status-val {
        font-size: 0.95rem !important;
        margin-top: 0.1rem !important;
        line-height: 1.15 !important;
      }
      #modal-ble-gps .ble-status-tile .tile-sub {
        font-size: 0.72rem !important;
        letter-spacing: -0.2px !important;
      }
      #modal-ble-gps .btn-gps-action {
        min-height: 48px !important;
        font-size: 0.85rem !important;
        font-weight: 800 !important;
      }
      /* Baud rate selector available in accordion settings */
    }

    .ble-status-tile {
      background: rgba(0, 0, 0, 0.45);
      border: 1px solid var(--border-subtle);
      border-radius: var(--radius-sm);
      padding: 0.55rem 0.35rem;
      text-align: center;
      transition: border-color 0.2s;
    }

    .ble-status-val {
      font-family: var(--font-mono);
      font-size: 1.15rem;
      font-weight: 700;
      margin-top: 0.15rem;
      line-height: 1.25;
    }

        /* --- 6. PIT LANE TIMER TAB --- */

        /* --- PIT GATE CALIBRATION & GPS TUNING DRAWER (USER CONFIGURABLE) --- */
    .pit-gate-calib-panel {
      background: rgba(10, 15, 26, 0.85);
      border: 1px solid rgba(0, 240, 255, 0.25);
      border-radius: var(--radius-sm);
      margin-top: 0.75rem;
      overflow: hidden;
      transition: all 0.2s ease;
      box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
    }
    .pit-gate-calib-panel.custom-active {
      border-color: rgba(255, 179, 0, 0.55);
      box-shadow: 0 0 14px rgba(255, 179, 0, 0.15);
    }
    .pit-calib-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0.6rem 0.85rem;
      background: rgba(15, 23, 42, 0.75);
      cursor: pointer;
      user-select: none;
      transition: background 0.15s ease;
    }
    .pit-calib-header:hover {
      background: rgba(20, 32, 58, 0.9);
    }
    .pit-calib-title {
      display: flex;
      align-items: center;
      gap: 0.45rem;
      font-size: 0.82rem;
      font-weight: 700;
      color: var(--text-main);
      font-family: var(--font-display);
      letter-spacing: 0.5px;
    }
    .pit-calib-badge {
      font-size: 0.72rem;
      font-weight: 800;
      padding: 2px 7px;
      border-radius: 9999px;
      background: rgba(148, 163, 184, 0.18);
      color: var(--text-muted);
      border: 1px solid rgba(148, 163, 184, 0.3);
    }
    .pit-calib-badge.custom {
      background: rgba(255, 179, 0, 0.2);
      color: var(--accent-amber);
      border-color: rgba(255, 179, 0, 0.5);
    }

    /* Start/Finish Calibration & Course Setup Modal Mode Distinction */
    .lap-calib-mode-pill {
      display: inline-flex;
      align-items: center;
      gap: 0.35rem;
      font-size: 0.72rem;
      font-weight: 800;
      padding: 0.18rem 0.55rem;
      border-radius: var(--radius-sm);
      letter-spacing: 0.3px;
      line-height: 1.2;
      transition: all var(--transition-fast);
      box-shadow: 0 1px 4px rgba(0,0,0,0.15);
    }
    .lap-calib-mode-pill.mode-calibrate {
      background: rgba(245, 158, 11, 0.16);
      color: #fbbf24;
      border: 1px solid rgba(245, 158, 11, 0.45);
    }
    .lap-calib-mode-pill.mode-create {
      background: rgba(0, 230, 118, 0.16);
      color: #00e676;
      border: 1px solid rgba(0, 230, 118, 0.45);
    }

    .lap-calib-tab-btn {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 0.45rem;
      padding: 0.55rem 0.75rem;
      font-size: 0.78rem;
      font-weight: 700;
      border-radius: var(--radius-sm);
      border: 1px solid transparent;
      background: rgba(255, 255, 255, 0.04);
      color: var(--text-muted);
      cursor: pointer;
      transition: all var(--transition-fast);
      position: relative;
    }
    .lap-calib-tab-btn:hover {
      background: rgba(255, 255, 255, 0.08);
      color: #fff;
    }
    .lap-calib-tab-btn.active#lap-calib-tab-btn-calibrate {
      background: rgba(245, 158, 11, 0.18) !important;
      color: #fbbf24 !important;
      border-color: rgba(245, 158, 11, 0.5) !important;
      box-shadow: 0 0 14px rgba(245, 158, 11, 0.22);
    }
    .lap-calib-tab-btn.active#lap-calib-tab-btn-create {
      background: rgba(0, 230, 118, 0.16) !important;
      color: #00e676 !important;
      border-color: rgba(0, 230, 118, 0.5) !important;
      box-shadow: 0 0 14px rgba(0, 230, 118, 0.22);
    }

    .lap-calib-tab-tag {
      font-size: 0.72rem;
      font-weight: 900;
      padding: 0.05rem 0.35rem;
      border-radius: 3px;
      line-height: 1.1;
      letter-spacing: 0.3px;
    }
    .lap-calib-tab-tag.edit {
      background: rgba(245, 158, 11, 0.25);
      color: #fbbf24;
      border: 1px solid rgba(245, 158, 11, 0.45);
    }
    .lap-calib-tab-tag.new {
      background: rgba(0, 230, 118, 0.25);
      color: #00e676;
      border: 1px solid rgba(0, 230, 118, 0.45);
    }

    .lap-calib-mode-banner {
      margin-bottom: 0.65rem;
      padding: 0.45rem 0.65rem;
      border-radius: var(--radius-sm);
      display: flex;
      flex-direction: column;
      gap: 0.25rem;
    }

    @media (max-width: 640px) {
      .lap-calib-mode-banner {
        padding: 0.32rem 0.5rem;
        margin-bottom: 0.45rem;
        gap: 0.18rem;
      }
      .mode-banner-pill-edit,
      .mode-banner-pill-create {
        font-size: 0.72rem !important;
        padding: 0.06rem 0.28rem !important;
      }
      .mode-banner-circuit-name {
        font-size: 0.78rem !important;
      }
      .mode-banner-layout-row {
        font-size: 0.72rem !important;
      }
      .mode-banner-guide-desc {
        font-size: 0.72rem !important;
        line-height: 1.25 !important;
        padding-top: 0.18rem !important;
        gap: 0.25rem !important;
      }
      .lap-calib-tabs {
        padding: 0.3rem 0.65rem 0.2rem !important;
        gap: 0.25rem !important;
      }
      .lap-calib-tab-btn {
        padding: 0.35rem 0.45rem !important;
        font-size: 0.72rem !important;
        gap: 0.25rem !important;
      }
      .lap-calib-tab-tag {
        font-size: 0.72rem !important;
        padding: 0.04rem 0.24rem !important;
      }
      .lap-calib-mode-pill {
        font-size: 0.72rem !important;
        padding: 0.08rem 0.28rem !important;
      }
    }
    .lap-calib-mode-banner.mode-banner-calibrate {
      background: linear-gradient(135deg, rgba(245, 158, 11, 0.14), rgba(15, 23, 42, 0.88));
      border: 1px solid rgba(245, 158, 11, 0.4);
    }
    .lap-calib-mode-banner.mode-banner-create {
      background: linear-gradient(135deg, rgba(0, 230, 118, 0.14), rgba(15, 23, 42, 0.88));
      border: 1px solid rgba(0, 230, 118, 0.4);
    }
    .mode-banner-top {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 0.5rem;
      flex-wrap: wrap;
    }
    .mode-banner-label {
      display: flex;
      align-items: center;
      gap: 0.45rem;
    }
    .mode-banner-pill-edit {
      font-size: 0.72rem;
      font-weight: 800;
      padding: 0.12rem 0.45rem;
      border-radius: 3px;
      background: #f59e0b;
      color: #000;
      display: inline-flex;
      align-items: center;
      gap: 0.25rem;
      letter-spacing: 0.3px;
    }
    .mode-banner-pill-create {
      font-size: 0.72rem;
      font-weight: 800;
      padding: 0.12rem 0.45rem;
      border-radius: 3px;
      background: #00e676;
      color: #000;
      display: inline-flex;
      align-items: center;
      gap: 0.25rem;
      letter-spacing: 0.3px;
    }
    .mode-banner-circuit-name {
      font-size: 0.88rem;
      font-weight: 800;
      color: #fff;
      font-family: var(--font-display);
    }
    .mode-banner-layout-row {
      font-size: 0.74rem;
      color: var(--accent-cyan);
      font-weight: 600;
      display: flex;
      align-items: center;
      gap: 0.3rem;
    }
    .mode-banner-guide-desc {
      font-size: 0.73rem;
      color: var(--text-muted);
      line-height: 1.4;
      display: flex;
      align-items: flex-start;
      gap: 0.4rem;
      padding-top: 0.3rem;
      border-top: 1px solid rgba(255, 255, 255, 0.08);
    }
    .pit-calib-toggle-hint {
      font-size: 0.72rem;
      color: var(--accent-cyan);
      font-weight: 600;
    }
    .pit-calib-body {
      padding: 0.75rem 0.85rem;
      border-top: 1px solid rgba(255, 255, 255, 0.08);
      background: rgba(8, 12, 20, 0.95);
    }
    .pit-calib-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 0.75rem;
      margin-bottom: 0.75rem;
    }
    @media (max-width: 640px) {
      .pit-calib-grid {
        grid-template-columns: 1fr;
      }
    }
    .pit-calib-card {
      background: rgba(15, 23, 42, 0.6);
      border: 1px solid rgba(255, 255, 255, 0.1);
      border-radius: var(--radius-sm);
      padding: 0.65rem 0.75rem;
    }
    .pit-calib-card-title {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 0.5rem;
    }
    .gate-tag {
      font-size: 0.74rem;
      font-weight: 800;
      font-family: var(--font-display);
      display: inline-flex;
      align-items: center;
      gap: 0.3rem;
    }
    .gate-tag.in { color: var(--accent-green); }
    .gate-tag.out { color: var(--accent-amber); }
    .btn-use-gps {
      padding: 0.25rem 0.55rem;
      font-size: 0.72rem;
      font-weight: 700;
      gap: 0.3rem;
      border-radius: 4px;
      line-height: 1.2;
    }
    .pit-coord-inputs {
      display: grid;
      grid-template-columns: 1fr 1fr 75px;
      gap: 0.4rem;
    }
    @media (max-width: 480px) {
      .pit-coord-inputs {
        grid-template-columns: 1fr 1fr;
      }
      .pit-coord-inputs .coord-field.mini {
        grid-column: span 2;
      }
    }
    .coord-field {
      display: flex;
      flex-direction: column;
      gap: 0.18rem;
    }
    .coord-field label {
      font-size: 0.72rem;
      color: var(--text-dim);
      font-weight: 600;
      text-transform: uppercase;
      letter-spacing: 0.3px;
    }
    .calib-input {
      background: rgba(3, 7, 18, 0.85);
      border: 1px solid rgba(255, 255, 255, 0.16);
      color: #fff;
      font-family: var(--font-mono);
      font-size: 0.8rem;
      padding: 0.35rem 0.45rem;
      border-radius: 4px;
      width: 100%;
      outline: none;
      transition: border-color 0.15s ease, box-shadow 0.15s ease;
    }
    .calib-input:focus {
      border-color: var(--accent-cyan);
      box-shadow: 0 0 6px rgba(0, 240, 255, 0.3);
    }
    .calib-input.flash-gps {
      border-color: var(--accent-green) !important;
      box-shadow: 0 0 10px rgba(0, 255, 136, 0.5) !important;
      background: rgba(0, 255, 136, 0.12) !important;
    }
    .calib-dist-info {
      font-size: 0.72rem;
      color: var(--text-dim);
      margin-top: 0.4rem;
      font-family: var(--font-mono);
    }
    .pit-calib-actions {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      flex-wrap: wrap;
    }
    .calib-save-msg {
      font-size: 0.75rem;
      font-weight: 700;
      color: var(--accent-green);
      transition: opacity 0.3s ease;
    }

        .pit-hud-container {
      background: linear-gradient(180deg, rgba(14, 20, 32, 0.95), rgba(7, 10, 16, 0.98));
      border: 1px solid rgba(255, 179, 0, 0.35);
      border-radius: var(--radius-lg);
      padding: 1.35rem;
      box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6), 0 0 30px rgba(255, 179, 0, 0.12);
      max-width: 880px;
      margin: 0 auto;
      display: flex;
      flex-direction: column;
      gap: 1.15rem;
    }

    .pit-gauge-box {
      text-align: center;
      padding: 1.85rem 1rem;
      background: radial-gradient(circle at 50% 50%, rgba(255, 179, 0, 0.08), transparent 75%);
      border: 1px solid rgba(255, 179, 0, 0.15);
      border-radius: var(--radius-md);
      position: relative;
    }

    .pit-target-toolbar {
      background: rgba(0, 0, 0, 0.42);
      border: 1px solid rgba(255, 179, 0, 0.28);
      border-radius: var(--radius-sm);
      padding: 0.65rem 0.85rem;
      display: flex;
      flex-direction: column;
      gap: 0.45rem;
    }

    .pit-target-toolbar-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 0.35rem;
    }

    .pit-target-label {
      font-family: var(--font-display);
      font-size: 0.8rem;
      font-weight: 800;
      color: var(--accent-amber);
      letter-spacing: 0.5px;
      display: inline-flex;
      align-items: center;
      gap: 0.35rem;
    }

    .pit-target-current-pill {
      font-family: var(--font-mono);
      font-size: 0.76rem;
      font-weight: 700;
      background: rgba(255, 179, 0, 0.15);
      border: 1px solid rgba(255, 179, 0, 0.4);
      color: #fff;
      padding: 0.18rem 0.55rem;
      border-radius: var(--radius-full);
    }

    .pit-target-chips-row {
      display: flex;
      gap: 0.38rem;
      overflow-x: auto;
      overscroll-behavior-x: contain;
      scrollbar-width: none;
      -webkit-overflow-scrolling: touch;
      touch-action: pan-x pan-y;
      align-items: center;
      padding-bottom: 2px;
      width: 100%;
      max-width: 100%;
    }

    .pit-target-chips-row::-webkit-scrollbar { display: none; }

    .pit-target-chip {
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid rgba(255, 255, 255, 0.14);
      color: var(--text-main);
      font-family: var(--font-display);
      font-size: 0.78rem;
      font-weight: 700;
      padding: 0.25rem 0.65rem;
      border-radius: var(--radius-full);
      cursor: pointer;
      white-space: nowrap;
      transition: all var(--transition-fast);
      display: inline-flex;
      align-items: center;
      gap: 0.25rem;
      flex-shrink: 0;
    }

    .pit-target-chip:hover {
      background: rgba(255, 179, 0, 0.18);
      border-color: rgba(255, 179, 0, 0.45);
      color: var(--accent-amber);
    }

    .pit-target-chip.active {
      background: linear-gradient(135deg, rgba(255, 179, 0, 0.38), rgba(255, 179, 0, 0.18));
      border-color: var(--accent-amber);
      color: #fff;
      box-shadow: 0 0 10px rgba(255, 179, 0, 0.35);
    }

    .pit-target-chip.custom-btn {
      color: var(--accent-cyan);
      border-color: rgba(0, 240, 255, 0.3);
    }

    .pit-target-chip.custom-btn:hover {
      background: rgba(0, 240, 255, 0.2);
      border-color: var(--accent-cyan);
    }

    .pit-custom-input-bar {
      margin-top: 0.35rem;
      padding-top: 0.45rem;
      border-top: 1px dashed rgba(255, 255, 255, 0.1);
      display: flex;
      align-items: center;
      gap: 0.45rem;
      flex-wrap: wrap;
    }

    #pit-total-time-label {
      font-family: var(--font-display);
      font-size: 1.05rem;
      font-weight: 800;
      letter-spacing: 1.2px;
      color: var(--text-muted);
      margin-bottom: 0.2rem;
    }

    .pit-big-countdown {
      font-family: var(--font-timer) !important;
      font-variant-numeric: tabular-nums lining-nums;
      -webkit-font-feature-settings: "tnum" 1, "lnum" 1;
      font-feature-settings: "tnum" 1, "lnum" 1;
      font-kerning: none;
      font-size: clamp(3.2rem, 7.5vw, 5.5rem);
      font-weight: 700;
      color: var(--accent-amber);
      text-shadow: 0 0 32px rgba(255, 179, 0, 0.5);
      line-height: 1;
      letter-spacing: -0.5px;
      display: inline-block;
      width: auto;
      min-width: 9.5ch;
      max-width: 100%;
      text-align: center;
      white-space: nowrap;
      box-sizing: content-box;
    }

    .pit-status-alert {
      font-family: var(--font-display);
      font-size: 1.05rem;
      font-weight: 700;
      letter-spacing: 0.4px;
      margin-top: 0.35rem;
      color: var(--text-muted);
      text-align: center;
      width: 100%;
      max-width: 100%;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      box-sizing: border-box;
      min-height: 1.4rem;
      line-height: 1.4rem;
      display: flex !important;
      align-items: center;
      justify-content: center;
      gap: 0.35rem;
      font-variant-numeric: tabular-nums lining-nums;
      -webkit-font-feature-settings: "tnum" 1, "lnum" 1;
      font-feature-settings: "tnum" 1, "lnum" 1;
    }

    .pit-status-alert .pit-alert-label {
      display: inline-block;
      white-space: nowrap;
      flex-shrink: 0;
    }

    .pit-status-alert .pit-alert-dist {
      font-family: var(--font-timer), monospace !important;
      font-variant-numeric: tabular-nums lining-nums;
      -webkit-font-feature-settings: "tnum" 1, "lnum" 1;
      font-feature-settings: "tnum" 1, "lnum" 1;
      font-kerning: none;
      display: inline-block;
      min-width: 8.5ch;
      text-align: left;
      white-space: nowrap;
      flex-shrink: 0;
      color: var(--accent-cyan, #00f0ff);
      letter-spacing: 0px;
    }

    .pit-release-flash {
      background: rgba(0, 230, 118, 0.25) !important;
      border-color: var(--accent-green) !important;
    }

    .pit-release-flash .pit-big-countdown {
      color: var(--accent-green) !important;
      text-shadow: 0 0 36px rgba(0, 230, 118, 0.8) !important;
    }

    /* Pit Gates Sequence Indicator */

    .pit-gates-flow {
      display: flex;
      align-items: center;
      justify-content: space-between;
      background: rgba(0, 0, 0, 0.35);
      padding: 0.75rem 1rem;
      border-radius: var(--radius-sm);
      gap: 0.4rem;
    }

    .pit-gate-node {
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 0.2rem;
      font-family: var(--font-display);
      font-size: 0.72rem;
      color: var(--text-dim);
      text-align: center;
    }

    .pit-gate-node.active { color: var(--accent-cyan); }

    .pit-gate-node.passed { color: var(--accent-green); }

    .pit-gate-icon-circle {
      width: 30px;
      height: 30px;
      border-radius: var(--radius-full);
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid var(--border-subtle);
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .pit-gate-node.active .pit-gate-icon-circle {
      background: rgba(0, 240, 255, 0.2);
      border-color: var(--accent-cyan);
      box-shadow: 0 0 12px rgba(0, 240, 255, 0.4);
    }

    .pit-gate-node.passed .pit-gate-icon-circle {
      background: rgba(0, 230, 118, 0.2);
      border-color: var(--accent-green);
    }

    .pit-flow-arrow {
      color: var(--text-dim);
      font-size: 0.85rem;
    }

    .pit-controls-cluster {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 0.5rem;
      align-items: stretch;
      max-width: 820px;
      margin: 0 auto;
      width: 100%;
    }
    .pit-controls-cluster > :last-child:nth-child(odd) {
      grid-column: span 2;
    }
    .pit-controls-cluster .btn {
      min-height: 44px;
      font-size: 0.85rem;
      padding: 0.5rem 0.5rem;
      justify-content: center;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      gap: 0.3rem;
    }
    .pit-controls-cluster .btn {
      min-height: 42px;
      font-size: 0.8rem;
      padding: 0.4rem 0.3rem;
      justify-content: center;
      white-space: nowrap;
      gap: 0.3rem;
    }
    /* Mobile <= 640px: Inherit comfortable 44px button height matching Lap Timer */
    @media (max-width: 640px) {
      .pit-controls-cluster .btn {
        min-height: 44px;
        font-size: 0.82rem;
      }
    }

    .pit-controls-cluster .btn {
      min-height: 44px;
      white-space: nowrap;
      justify-content: center;
    }

    .pit-node-sub {
      font-size: 0.72rem;
      font-family: var(--font-mono);
      color: var(--text-dim);
      font-weight: 700;
      white-space: nowrap;
    }

    .pit-stats-grid {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 0.55rem;
    }

    @media (max-width: 600px) {
      .pit-stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.35rem;
      }

    }

    .pit-speed-warn {
      color: var(--accent-red) !important;
      animation: pit-warn-pulse 0.5s infinite alternate;
    }

    .pit-speed-near {
      color: var(--accent-amber) !important;
      text-shadow: 0 0 10px rgba(255, 179, 0, 0.7);
    }

    .pit-gauge-box.pit-speed-overspeed {
      border-color: var(--accent-red) !important;
      background: radial-gradient(circle at 50% 50%, rgba(255, 61, 0, 0.22), transparent 75%) !important;
      animation: pit-warn-pulse 0.4s infinite alternate;
    }

    @keyframes pit-warn-pulse {
      from { text-shadow: 0 0 4px rgba(255, 61, 0, 0.5); }

      to { text-shadow: 0 0 18px rgba(255, 61, 0, 1); transform: scale(1.05); }

    }

    /* Pit Stop History & Audit Card */

    .pit-history-card {
      background: rgba(0, 0, 0, 0.4);
      border: 1px solid rgba(255, 179, 0, 0.22);
      border-radius: var(--radius-md);
      padding: 0.85rem;
      display: flex;
      flex-direction: column;
      gap: 0.65rem;
      margin-top: 0.25rem;
    }

    .pit-history-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 0.5rem;
    }

    .pit-history-title {
      display: inline-flex;
      align-items: center;
      gap: 0.45rem;
      font-family: var(--font-display);
      font-size: 0.85rem;
      font-weight: 800;
      color: #fff;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }

    .pit-history-badge {
      font-family: var(--font-mono);
      font-size: 0.72rem;
      font-weight: 700;
      padding: 0.15rem 0.5rem;
      border-radius: var(--radius-full);
      background: rgba(255, 179, 0, 0.15);
      border: 1px solid rgba(255, 179, 0, 0.35);
      color: var(--accent-amber);
    }

    /* Lap Time History & Session Records Card */

        /* --- Lap Timer & Pit Timer History Logs - Card Deck System (Desktop & Mobile) --- */
    /* Hide old desktop table headers and rows on ALL viewports */
    #lap-history-card .modern-table thead,
    #pit-history-card .modern-table thead,
    .lap-history-desktop-row,
    .lap-history-desktop-detail-row,
    .pit-history-desktop-row {
      display: none !important;
    }

    /* Modern Table & Container to block/card stream */
    #lap-history-card .modern-table,
    #lap-history-card .modern-table tbody,
    #pit-history-card .modern-table,
    #pit-history-card .modern-table tbody {
      display: block !important;
      width: 100% !important;
    }

    #lap-history-card .table-responsive,
    #pit-history-card .table-responsive {
      max-height: none !important;
      overflow: visible !important;
      padding-right: 0 !important;
    }

    .lap-history-mobile-card-row,
    .pit-history-mobile-card-row {
      display: block !important;
      width: 100% !important;
      border: none !important;
      margin-bottom: 0.4rem !important;
    }

    .lap-history-mobile-card-row > td,
    .pit-history-mobile-card-row > td {
      display: block !important;
      width: 100% !important;
      padding: 0 !important;
      border: none !important;
      background: transparent !important;
    }

    /* 1. LAP TIMER CARD (LHM) */
    .lhm-card {
      display: flex !important;
      flex-direction: column;
      gap: 0.35rem;
      background: linear-gradient(135deg, rgba(20, 24, 33, 0.95), rgba(13, 16, 23, 0.98)) !important;
      border: 1px solid rgba(0, 240, 255, 0.2) !important;
      border-radius: 6px !important;
      padding: 0.5rem 0.75rem !important;
      box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35) !important;
      position: relative;
      overflow: hidden;
    }

    .lhm-card::before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      width: 3px;
      height: 100%;
      background: linear-gradient(180deg, var(--accent-cyan), var(--accent-green));
    }

    .lhm-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 0.4rem;
      border-bottom: 1px solid rgba(255, 255, 255, 0.06);
      padding-bottom: 0.25rem;
    }

    .lhm-circuit-info {
      display: flex;
      align-items: center;
      gap: 0.35rem;
      flex: 1 1 auto;
      min-width: 0;
      overflow: hidden;
    }

    .lhm-run-badge,
    .lhm-date-badge {
      font-family: var(--font-mono);
      font-weight: 700;
      font-size: 0.72rem;
      color: #fff;
      background: rgba(255, 255, 255, 0.12);
      padding: 0.1rem 0.35rem;
      border-radius: 3px;
      flex-shrink: 0;
      letter-spacing: -0.2px;
    }

    .lhm-circuit-title {
      display: inline-flex;
      align-items: baseline;
      gap: 0.3rem;
      flex: 1 1 auto;
      min-width: 0;
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
    }

    .lhm-circuit-name {
      font-weight: 700;
      font-size: 0.85rem;
      color: #fff;
      flex-shrink: 0;
    }

    .lhm-layout-name {
      font-size: 0.75rem;
      color: var(--text-dim);
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .lhm-header-right {
      display: flex;
      align-items: center;
      gap: 0.35rem;
      flex-shrink: 0;
      max-width: 48%;
    }

    .lhm-time {
      font-family: var(--font-mono);
      font-size: 0.72rem;
      color: var(--text-muted);
    }

    /* Horizontal Main Row */
    .lhm-row-main {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 0.4rem;
      flex-wrap: wrap;
    }

    .lhm-data-strip {
      display: flex;
      align-items: center;
      gap: 0.55rem;
      min-width: 0;
      flex-wrap: wrap;
    }

    .lhm-best-time {
      font-family: var(--font-mono);
      font-weight: 900;
      font-size: 1.15rem;
      color: #00ff88;
      text-shadow: 0 0 8px rgba(0, 255, 136, 0.35);
      letter-spacing: -0.3px;
      line-height: 1;
    }

    .lhm-stat-chips {
      display: inline-flex;
      align-items: center;
      gap: 0.35rem;
      font-size: 0.72rem;
      color: var(--text-dim);
    }

    .lhm-stat-chip {
      display: inline-flex;
      align-items: center;
      gap: 2px;
      white-space: nowrap !important;
      flex-shrink: 0;
    }

    .lhm-stat-chip b {
      color: #fff;
      font-weight: 600;
    }

    .lhm-actions-inline {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      flex-shrink: 0;
      margin-left: auto;
    }

    .lhm-actions-inline .btn {
      height: 26px !important;
      min-height: 26px !important;
      font-size: 0.72rem !important;
      font-weight: 700 !important;
      padding: 0 0.45rem !important;
      border-radius: 4px !important;
      justify-content: center !important;
      display: inline-flex !important;
      align-items: center !important;
      gap: 2px !important;
    }

    .lhm-detail-container {
      margin-top: 0.25rem;
      background: rgba(0, 0, 0, 0.5);
      border: 1px solid rgba(0, 255, 136, 0.25);
      border-radius: 5px;
      padding: 0.45rem 0.6rem;
    }

    /* 2. PIT TIMER CARD (PHM) */
    .phm-card {
      display: flex !important;
      flex-direction: column;
      gap: 0.35rem;
      background: linear-gradient(135deg, rgba(20, 24, 33, 0.95), rgba(13, 16, 23, 0.98)) !important;
      border: 1px solid rgba(255, 179, 0, 0.22) !important;
      border-radius: 6px !important;
      padding: 0.5rem 0.75rem !important;
      box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35) !important;
      position: relative;
      overflow: hidden;
    }

    .phm-card::before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      width: 3px;
      height: 100%;
      background: linear-gradient(180deg, var(--accent-amber), var(--accent-green));
    }

    .phm-card.penalty::before {
      background: linear-gradient(180deg, var(--accent-red), var(--accent-amber)) !important;
    }

    .phm-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 0.4rem;
      border-bottom: 1px solid rgba(255, 255, 255, 0.06);
      padding-bottom: 0.25rem;
    }

    .phm-circuit-info {
      display: flex;
      align-items: center;
      gap: 0.35rem;
      flex: 1 1 auto;
      min-width: 0;
      overflow: hidden;
    }

    .phm-date-badge {
      font-family: var(--font-mono);
      font-weight: 700;
      font-size: 0.72rem;
      color: #fff;
      background: rgba(255, 255, 255, 0.12);
      padding: 0.1rem 0.35rem;
      border-radius: 3px;
      flex-shrink: 0;
      letter-spacing: -0.2px;
    }

    .phm-circuit-title {
      display: inline-flex;
      align-items: baseline;
      gap: 0.3rem;
      flex: 1 1 auto;
      min-width: 0;
      overflow: hidden;
      white-space: nowrap;
      text-overflow: ellipsis;
    }

    .phm-circuit-name {
      font-weight: 700;
      font-size: 0.85rem;
      color: #fff;
      flex-shrink: 0;
    }

    .phm-header-right {
      display: flex;
      align-items: center;
      gap: 0.35rem;
      flex-shrink: 0;
    }

    .phm-time {
      font-family: var(--font-mono);
      font-size: 0.72rem;
      color: var(--text-muted);
    }

    /* Horizontal Main Row */
    .phm-row-main {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 0.4rem;
      flex-wrap: wrap;
    }

    .phm-data-strip {
      display: flex;
      align-items: center;
      gap: 0.55rem;
      min-width: 0;
      flex-wrap: wrap;
    }

    .phm-pit-time {
      font-family: var(--font-mono);
      font-weight: 900;
      font-size: 1.15rem;
      letter-spacing: -0.3px;
      line-height: 1;
    }

    .phm-stat-chips {
      display: inline-flex;
      align-items: center;
      gap: 0.35rem;
      font-size: 0.72rem;
      color: var(--text-dim);
    }

    .phm-stat-chip {
      display: inline-flex;
      align-items: center;
      gap: 2px;
      white-space: nowrap !important;
      flex-shrink: 0;
    }

    .phm-stat-chip b {
      color: #fff;
      font-weight: 600;
    }

    .phm-actions-inline {
      display: inline-flex;
      align-items: center;
      gap: 4px;
      flex-shrink: 0;
      margin-left: auto;
    }

    .phm-actions-inline .btn {
      height: 26px !important;
      min-height: 26px !important;
      font-size: 0.72rem !important;
      font-weight: 700 !important;
      padding: 0 0.45rem !important;
      border-radius: 4px !important;
      justify-content: center !important;
      display: inline-flex !important;
      align-items: center !important;
      gap: 2px !important;
    }

    .lap-history-card {
      background: rgba(0, 0, 0, 0.4);
      border: 1px solid rgba(0, 240, 255, 0.22);
      border-radius: var(--radius-md);
      padding: 0.85rem;
      display: flex;
      flex-direction: column;
      gap: 0.65rem;
      margin-top: 0.25rem;
    }

    .lap-history-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 0.5rem;
    }

    .lap-history-title {
      display: inline-flex;
      align-items: center;
      gap: 0.45rem;
      font-family: var(--font-display);
      font-size: 0.85rem;
      font-weight: 800;
      color: #fff;
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }

    .lap-history-badge {
      font-family: var(--font-mono);
      font-size: 0.72rem;
      font-weight: 700;
      padding: 0.15rem 0.5rem;
      border-radius: var(--radius-full);
      background: rgba(0, 240, 255, 0.15);
      border: 1px solid rgba(0, 240, 255, 0.35);
      color: var(--accent-cyan);
    }

    .lap-status-tag {
      display: inline-flex;
      align-items: center;
      padding: 0.15rem 0.45rem;
      border-radius: 4px;
      font-size: 0.72rem;
      font-weight: 800;
      font-family: var(--font-mono);
      letter-spacing: 0.5px;
      white-space: nowrap;
      max-width: 95px;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .lap-status-tag.best {
      background: rgba(0, 255, 136, 0.2);
      border: 1px solid var(--accent-green);
      color: var(--accent-green);
      box-shadow: 0 0 8px rgba(0, 255, 136, 0.3);
    }

    .lap-status-tag.valid {
      background: rgba(0, 240, 255, 0.12);
      border: 1px solid rgba(0, 240, 255, 0.3);
      color: var(--accent-cyan);
    }

        /* --- 8. CIRCUIT RANK & LEADERBOARD STYLES --- */

    .rank-recent-circuits {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      flex-wrap: wrap;
      margin-top: -0.25rem;
      margin-bottom: 1rem;
      padding: 0.2rem 0;
    }

    .rank-recent-label {
      color: var(--text-dim);
      display: inline-flex;
      align-items: center;
      gap: 0.3rem;
      font-weight: 600;
      font-size: 0.73rem;
      letter-spacing: 0.3px;
      text-transform: uppercase;
      padding-right: 0.15rem;
      flex-shrink: 0;
    }

    .rank-recent-chips {
      display: flex;
      align-items: center;
      gap: 0.4rem;
      flex-wrap: wrap;
    }

    .rank-recent-chip {
      background: rgba(255, 255, 255, 0.04);
      border: 1px solid rgba(255, 255, 255, 0.09);
      border-radius: 9999px;
      padding: 0.22rem 0.65rem;
      color: var(--text-muted);
      cursor: pointer;
      font-size: 0.75rem;
      font-weight: 500;
      transition: all 0.15s ease;
      display: inline-flex;
      align-items: center;
      gap: 0.28rem;
    }

    .rank-recent-chip:hover {
      background: rgba(0, 240, 255, 0.08);
      border-color: rgba(0, 240, 255, 0.3);
      color: #fff;
    }

    .rank-recent-chip.active {
      background: rgba(0, 240, 255, 0.14);
      border-color: var(--accent-cyan);
      color: var(--accent-cyan);
      font-weight: 700;
    }

    .rank-toolbar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 0.8rem;
      margin-bottom: 1.25rem;
      flex-wrap: wrap;
    }

    .rank-search-box {
      position: relative;
      flex: 1;
      min-width: 200px;
      max-width: 320px;
      display: flex;
      align-items: center;
    }

    .rank-search-box i,
    .rank-search-box svg,
    .rank-search-box [data-lucide="search"] {
      position: absolute !important;
      left: 0.7rem !important;
      top: 50% !important;
      transform: translateY(-50%) !important;
      pointer-events: none !important;
      width: 13px !important;
      height: 13px !important;
      color: var(--text-dim) !important;
      z-index: 2 !important;
      display: inline-block !important;
      margin: 0 !important;
    }

    .rank-search-box input {
      width: 100% !important;
      box-sizing: border-box !important;
      min-height: 36px !important;
      height: 36px !important;
      padding: 0.35rem 0.75rem 0.35rem 2.05rem !important;
      background: var(--bg-card);
      border: 1px solid var(--border-subtle);
      border-radius: var(--radius-sm);
      color: #fff;
      font-size: 0.82rem !important;
      transition: all 0.2s ease;
      display: block !important;
      margin: 0 !important;
    }

    .rank-search-box input:focus {
      outline: none;
      border-color: var(--accent-cyan);
      box-shadow: 0 0 10px rgba(0, 240, 255, 0.25);
    }

    .rank-filter-dropdowns {
      display: flex;
      gap: 0.5rem;
      align-items: center;
      flex-wrap: wrap;
    }

    .rank-podium-cluster {
      display: none !important;
    }

    .rank-podium-card {
      background: var(--bg-card);
      border-radius: var(--radius-md);
      padding: 1.1rem;
      display: flex;
      flex-direction: column;
      position: relative;
      border: 1px solid var(--border-subtle);
      transition: all 0.2s ease;
      cursor: pointer;
    }

    .rank-podium-card:hover {
      transform: translateY(-3px);
      box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
    }

    .rank-podium-card.p1 {
      border-color: rgba(255, 215, 0, 0.45);
      background: linear-gradient(180deg, rgba(255, 215, 0, 0.08) 0%, rgba(15, 23, 42, 0.85) 100%);
      box-shadow: 0 0 25px rgba(255, 215, 0, 0.15);
    }

    .rank-podium-card.p2 {
      border-color: rgba(226, 232, 240, 0.4);
      background: linear-gradient(180deg, rgba(226, 232, 240, 0.06) 0%, rgba(15, 23, 42, 0.85) 100%);
    }

    .rank-podium-card.p3 {
      border-color: rgba(205, 127, 50, 0.4);
      background: linear-gradient(180deg, rgba(205, 127, 50, 0.06) 0%, rgba(15, 23, 42, 0.85) 100%);
    }

    .rank-card {
      background: var(--bg-card);
      border: 1px solid var(--border-subtle);
      border-radius: var(--radius-md);
      overflow: hidden;
      display: flex;
      flex-direction: column;
    }

    .rank-card-header {
      padding: 0.9rem 1.25rem;
      border-bottom: 1px solid var(--border-subtle);
      display: flex;
      justify-content: space-between;
      align-items: center;
      background: rgba(255, 255, 255, 0.015);
      flex-wrap: wrap;
      gap: 0.5rem;
    }

    .rank-card-title {
      display: inline-flex;
      align-items: center;
      gap: 0.5rem;
      font-weight: 700;
      font-size: 0.9rem;
      color: #fff;
      font-family: var(--font-display);
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }

    .rank-badge {
      font-family: var(--font-mono);
      font-size: 0.72rem;
      font-weight: 700;
      padding: 0.15rem 0.5rem;
      border-radius: 9999px;
      background: rgba(0, 240, 255, 0.12);
      color: var(--accent-cyan);
      border: 1px solid rgba(0, 240, 255, 0.3);
    }

    .rank-badge.verified {
      background: rgba(16, 185, 129, 0.15);
      border: 1px solid rgba(16, 185, 129, 0.45);
      color: #10b981;
      display: inline-flex;
      align-items: center;
      gap: 0.25rem;
      padding: 0.15rem 0.45rem;
      border-radius: 9999px;
      font-size: 0.68rem;
      font-weight: 700;
      box-shadow: 0 0 10px rgba(16, 185, 129, 0.2);
    }
    .rank-badge.verified svg {
      color: #10b981;
    }

    /* =========================================================================
       UNIFIED ORIGIN BADGES: REAL, iRacing, In-App SIM, Man. Entry, Imported
       ========================================================================= */

    /* 1. REAL (Verified GPS Run - High-Visibility Emerald Neon) */
    .badge-real,
    .badge-verified,
    .rank-verified-badge {
      display: inline-flex;
      align-items: center;
      gap: 0.28rem;
      padding: 0.15rem 0.52rem;
      border-radius: 9999px;
      background: linear-gradient(135deg, rgba(0, 230, 118, 0.24), rgba(0, 180, 80, 0.14));
      border: 1px solid rgba(0, 230, 118, 0.65);
      color: #00e676;
      font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
      font-size: 0.72rem;
      font-weight: 800;
      letter-spacing: 0.04em;
      white-space: nowrap;
      vertical-align: middle;
      line-height: 1.25;
      box-shadow: 0 0 10px rgba(0, 230, 118, 0.3);
      cursor: default;
      transition: all 0.2s ease;
    }
    .badge-real:hover,
    .badge-verified:hover,
    .rank-verified-badge:hover {
      background: linear-gradient(135deg, rgba(0, 230, 118, 0.36), rgba(0, 180, 80, 0.22));
      border-color: rgba(0, 230, 118, 0.85);
      box-shadow: 0 0 14px rgba(0, 230, 118, 0.45);
    }
    .badge-real svg,
    .badge-verified svg,
    .badge-verified-svg,
    .rank-verified-badge svg {
      color: #00e676;
      flex-shrink: 0;
      vertical-align: -1px;
    }
    .badge-real.compact,
    .badge-verified.compact,
    .rank-verified-badge.mobile {
      padding: 0.1rem 0.4rem;
      font-size: 0.65rem;
      gap: 0.2rem;
      line-height: 1.2;
    }
    .badge-real.compact svg,
    .badge-verified.compact svg,
    .rank-verified-badge.mobile svg {
      width: 10px;
      height: 10px;
    }

    html[data-theme="light"] .badge-real,
    html[data-theme="light"] .badge-verified {
      background: linear-gradient(135deg, rgba(5, 150, 105, 0.18), rgba(4, 120, 87, 0.1)) !important;
      border-color: rgba(5, 150, 105, 0.55) !important;
      color: #047857 !important;
      box-shadow: 0 1px 5px rgba(5, 150, 105, 0.2) !important;
    }
    html[data-theme="light"] .badge-real svg,
    html[data-theme="light"] .badge-verified svg {
      color: #047857 !important;
    }

    /* 2. iRacing (Simulator Telemetry - Crimson Red) */
    .badge-iracing {
      display: inline-flex;
      align-items: center;
      gap: 0.28rem;
      padding: 0.15rem 0.52rem;
      border-radius: 9999px;
      background: linear-gradient(135deg, rgba(239, 68, 68, 0.22), rgba(185, 28, 28, 0.1));
      border: 1px solid rgba(239, 68, 68, 0.5);
      color: #f87171;
      font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
      font-size: 0.72rem;
      font-weight: 800;
      letter-spacing: 0.02em;
      white-space: nowrap;
      vertical-align: middle;
      line-height: 1.25;
      box-shadow: 0 0 8px rgba(239, 68, 68, 0.2);
      cursor: default;
      transition: all 0.2s ease;
    }
    .badge-iracing:hover {
      background: linear-gradient(135deg, rgba(239, 68, 68, 0.32), rgba(185, 28, 28, 0.18));
      border-color: rgba(239, 68, 68, 0.75);
      box-shadow: 0 0 12px rgba(239, 68, 68, 0.4);
    }
    .badge-iracing svg {
      color: #ef4444;
      flex-shrink: 0;
      vertical-align: -1px;
    }
    .badge-iracing.compact {
      padding: 0.1rem 0.38rem;
      font-size: 0.64rem;
      gap: 0.2rem;
      line-height: 1.2;
    }
    .badge-iracing.compact svg {
      width: 10px;
      height: 10px;
    }

    html[data-theme="light"] .badge-iracing {
      background: linear-gradient(135deg, rgba(239, 68, 68, 0.14), rgba(220, 38, 38, 0.08)) !important;
      border-color: rgba(220, 38, 38, 0.45) !important;
      color: #dc2626 !important;
      box-shadow: 0 1px 4px rgba(220, 38, 38, 0.15) !important;
    }
    html[data-theme="light"] .badge-iracing svg {
      color: #dc2626 !important;
    }

    /* 2b. Assetto Corsa (AC - Racing Amber) */
    .badge-ac {
      display: inline-flex;
      align-items: center;
      gap: 0.28rem;
      padding: 0.15rem 0.52rem;
      border-radius: 9999px;
      background: linear-gradient(135deg, rgba(245, 158, 11, 0.22), rgba(217, 119, 6, 0.1));
      border: 1px solid rgba(245, 158, 11, 0.5);
      color: #fbbf24;
      font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
      font-size: 0.72rem;
      font-weight: 800;
      letter-spacing: 0.02em;
      white-space: nowrap;
      vertical-align: middle;
      line-height: 1.25;
      box-shadow: 0 0 8px rgba(245, 158, 11, 0.2);
      cursor: default;
      transition: all 0.2s ease;
    }
    .badge-ac:hover {
      background: linear-gradient(135deg, rgba(245, 158, 11, 0.32), rgba(217, 119, 6, 0.18));
      border-color: rgba(245, 158, 11, 0.75);
      box-shadow: 0 0 12px rgba(245, 158, 11, 0.4);
    }
    .badge-ac svg { color: #f59e0b; flex-shrink: 0; vertical-align: -1px; }
    .badge-ac.compact { padding: 0.1rem 0.38rem; font-size: 0.64rem; gap: 0.2rem; line-height: 1.2; }
    .badge-ac.compact svg { width: 10px; height: 10px; }
    html[data-theme="light"] .badge-ac {
      background: linear-gradient(135deg, rgba(245, 158, 11, 0.14), rgba(217, 119, 6, 0.08)) !important;
      border-color: rgba(217, 119, 6, 0.45) !important;
      color: #b45309 !important;
      box-shadow: 0 1px 4px rgba(217, 119, 6, 0.15) !important;
    }
    html[data-theme="light"] .badge-ac svg { color: #b45309 !important; }

    /* 2c. Assetto Corsa Competizione (ACC - Electric Violet) */
    .badge-acc {
      display: inline-flex;
      align-items: center;
      gap: 0.28rem;
      padding: 0.15rem 0.52rem;
      border-radius: 9999px;
      background: linear-gradient(135deg, rgba(139, 92, 246, 0.24), rgba(109, 40, 217, 0.12));
      border: 1px solid rgba(139, 92, 246, 0.55);
      color: #c4b5fd;
      font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
      font-size: 0.72rem;
      font-weight: 800;
      letter-spacing: 0.02em;
      white-space: nowrap;
      vertical-align: middle;
      line-height: 1.25;
      box-shadow: 0 0 8px rgba(139, 92, 246, 0.22);
      cursor: default;
      transition: all 0.2s ease;
    }
    .badge-acc:hover {
      background: linear-gradient(135deg, rgba(139, 92, 246, 0.34), rgba(109, 40, 217, 0.2));
      border-color: rgba(139, 92, 246, 0.78);
      box-shadow: 0 0 12px rgba(139, 92, 246, 0.42);
    }
    .badge-acc svg { color: #a78bfa; flex-shrink: 0; vertical-align: -1px; }
    .badge-acc.compact { padding: 0.1rem 0.38rem; font-size: 0.64rem; gap: 0.2rem; line-height: 1.2; }
    .badge-acc.compact svg { width: 10px; height: 10px; }
    html[data-theme="light"] .badge-acc {
      background: linear-gradient(135deg, rgba(139, 92, 246, 0.14), rgba(109, 40, 217, 0.08)) !important;
      border-color: rgba(109, 40, 217, 0.45) !important;
      color: #6d28d9 !important;
      box-shadow: 0 1px 4px rgba(109, 40, 217, 0.15) !important;
    }
    html[data-theme="light"] .badge-acc svg { color: #6d28d9 !important; }

    /* 2d. Assetto Corsa EVO (AC EVO - Emerald Green) */
    .badge-acevo {
      display: inline-flex;
      align-items: center;
      gap: 0.28rem;
      padding: 0.15rem 0.52rem;
      border-radius: 9999px;
      background: linear-gradient(135deg, rgba(16, 185, 129, 0.24), rgba(5, 150, 105, 0.12));
      border: 1px solid rgba(16, 185, 129, 0.55);
      color: #34d399;
      font-family: var(--font-display);
      font-size: 0.7rem;
      font-weight: 800;
      letter-spacing: 0.04em;
      text-transform: uppercase;
      white-space: nowrap;
      box-shadow: 0 0 8px rgba(16, 185, 129, 0.22);
      transition: all 0.2s ease;
    }
    .badge-acevo:hover {
      background: linear-gradient(135deg, rgba(16, 185, 129, 0.34), rgba(5, 150, 105, 0.2));
      border-color: rgba(16, 185, 129, 0.78);
      box-shadow: 0 0 12px rgba(16, 185, 129, 0.4);
    }
    .badge-acevo svg { color: #10b981; flex-shrink: 0; vertical-align: -1px; }
    .badge-acevo.compact { padding: 0.1rem 0.38rem; font-size: 0.64rem; gap: 0.2rem; line-height: 1.2; }
    .badge-acevo.compact svg { width: 10px; height: 10px; }
    html[data-theme="light"] .badge-acevo {
      background: linear-gradient(135deg, rgba(16, 185, 129, 0.14), rgba(5, 150, 105, 0.08)) !important;
      border-color: rgba(5, 150, 105, 0.45) !important;
      color: #047857 !important;
      box-shadow: 0 1px 4px rgba(5, 150, 105, 0.15) !important;
    }
    html[data-theme="light"] .badge-acevo svg { color: #047857 !important; }

    /* 3. In-App SIM (In-App Simulation - Cyan Tech) */
    .badge-inapp-sim {
      display: inline-flex;
      align-items: center;
      gap: 0.28rem;
      padding: 0.15rem 0.52rem;
      border-radius: 9999px;
      background: linear-gradient(135deg, rgba(0, 229, 255, 0.18), rgba(0, 150, 255, 0.08));
      border: 1px solid rgba(0, 229, 255, 0.45);
      color: var(--accent-cyan, #00f0ff);
      font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
      font-size: 0.72rem;
      font-weight: 800;
      letter-spacing: 0.02em;
      white-space: nowrap;
      vertical-align: middle;
      line-height: 1.25;
      box-shadow: 0 0 8px rgba(0, 229, 255, 0.2);
      cursor: default;
      transition: all 0.2s ease;
    }
    .badge-inapp-sim:hover {
      background: linear-gradient(135deg, rgba(0, 229, 255, 0.28), rgba(0, 150, 255, 0.15));
      border-color: rgba(0, 229, 255, 0.7);
      box-shadow: 0 0 12px rgba(0, 229, 255, 0.35);
    }
    .badge-inapp-sim svg {
      color: var(--accent-cyan, #00f0ff);
      flex-shrink: 0;
      vertical-align: -1px;
    }
    .badge-inapp-sim.compact {
      padding: 0.1rem 0.38rem;
      font-size: 0.64rem;
      gap: 0.2rem;
      line-height: 1.2;
    }
    .badge-inapp-sim.compact svg {
      width: 10px;
      height: 10px;
    }

    html[data-theme="light"] .badge-inapp-sim {
      background: linear-gradient(135deg, rgba(2, 132, 199, 0.14), rgba(3, 105, 161, 0.07)) !important;
      border-color: rgba(2, 132, 199, 0.45) !important;
      color: #0284c7 !important;
    }
    html[data-theme="light"] .badge-inapp-sim svg {
      color: #0284c7 !important;
    }

    /* 4. Man. Entry (Manual Entry - Slate Muted) */
    .badge-man-entry {
      display: inline-flex;
      align-items: center;
      gap: 0.28rem;
      padding: 0.15rem 0.52rem;
      border-radius: 9999px;
      background: rgba(148, 163, 184, 0.14);
      border: 1px solid rgba(148, 163, 184, 0.3);
      color: #cbd5e1;
      font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
      font-size: 0.72rem;
      font-weight: 700;
      letter-spacing: 0.02em;
      white-space: nowrap;
      vertical-align: middle;
      line-height: 1.25;
      cursor: default;
      transition: all 0.2s ease;
    }
    .badge-man-entry:hover {
      background: rgba(148, 163, 184, 0.22);
      border-color: rgba(148, 163, 184, 0.5);
    }
    .badge-man-entry svg {
      color: #94a3b8;
      flex-shrink: 0;
      vertical-align: -1px;
    }
    .badge-man-entry.compact {
      padding: 0.1rem 0.38rem;
      font-size: 0.64rem;
      gap: 0.2rem;
      line-height: 1.2;
    }
    .badge-man-entry.compact svg {
      width: 10px;
      height: 10px;
    }

    html[data-theme="light"] .badge-man-entry {
      background: rgba(100, 116, 139, 0.1) !important;
      border-color: rgba(100, 116, 139, 0.28) !important;
      color: #475569 !important;
    }
    html[data-theme="light"] .badge-man-entry svg {
      color: #64748b !important;
    }

    /* 5. Imported (VBO Upload - Warm Amber) */
    .badge-imported {
      display: inline-flex;
      align-items: center;
      gap: 0.28rem;
      padding: 0.15rem 0.52rem;
      border-radius: 9999px;
      background: linear-gradient(135deg, rgba(245, 158, 11, 0.18), rgba(217, 119, 6, 0.08));
      border: 1px solid rgba(245, 158, 11, 0.45);
      color: #fbbf24;
      font-family: var(--font-sans, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif);
      font-size: 0.72rem;
      font-weight: 700;
      letter-spacing: 0.02em;
      white-space: nowrap;
      vertical-align: middle;
      line-height: 1.25;
      box-shadow: 0 0 8px rgba(245, 158, 11, 0.2);
      cursor: default;
      transition: all 0.2s ease;
    }
    .badge-imported:hover {
      background: linear-gradient(135deg, rgba(245, 158, 11, 0.28), rgba(217, 119, 6, 0.15));
      border-color: rgba(245, 158, 11, 0.7);
      box-shadow: 0 0 12px rgba(245, 158, 11, 0.35);
    }
    .badge-imported svg {
      color: #f59e0b;
      flex-shrink: 0;
      vertical-align: -1px;
    }
    .badge-imported.compact {
      padding: 0.1rem 0.38rem;
      font-size: 0.64rem;
      gap: 0.2rem;
      line-height: 1.2;
    }
    .badge-imported.compact svg {
      width: 10px;
      height: 10px;
    }

    html[data-theme="light"] .badge-imported {
      background: linear-gradient(135deg, rgba(217, 119, 6, 0.14), rgba(180, 83, 9, 0.07)) !important;
      border-color: rgba(217, 119, 6, 0.45) !important;
      color: #b45309 !important;
    }
    html[data-theme="light"] .badge-imported svg {
      color: #b45309 !important;
    }

    /* Responsive visibility for session cards */
    @media (max-width: 640px) {
      .session-card-origin-badge,
      .session-card-verified-badge,
      .session-card-iracing-badge {
        display: none !important;
      }
    }
    @media (min-width: 641px) {
      .session-meta-origin-badge,
      .session-meta-verified-badge,
      .session-meta-iracing-badge {
        display: none !important;
      }
    }

    /* Leaderboard Origin Badge Filter Bar */
    .rank-badge-filter-bar,
    .rank-verified-toggle-group {
      display: inline-flex;
      align-items: center;
      background: rgba(15, 23, 42, 0.7);
      border: 1px solid rgba(255, 255, 255, 0.12);
      border-radius: 9999px;
      padding: 3px;
      gap: 3px;
      overflow-x: auto;
      max-width: 100%;
      scrollbar-width: none;
      -webkit-overflow-scrolling: touch;
    }
    .rank-badge-filter-bar::-webkit-scrollbar,
    .rank-verified-toggle-group::-webkit-scrollbar {
      display: none;
    }
    .rank-badge-pill,
    .rank-verified-pill {
      background: transparent;
      border: 1px solid transparent;
      color: #94a3b8;
      font-size: 0.72rem;
      font-weight: 700;
      padding: 0.22rem 0.58rem;
      border-radius: 9999px;
      cursor: pointer;
      display: inline-flex;
      align-items: center;
      gap: 0.25rem;
      white-space: nowrap;
      transition: all 0.2s ease;
      line-height: 1.2;
    }
    .rank-badge-pill svg,
    .rank-verified-pill svg {
      flex-shrink: 0;
    }
    .rank-badge-pill:hover,
    .rank-verified-pill:hover {
      color: #ffffff;
      background: rgba(255, 255, 255, 0.06);
    }
    .rank-badge-pill.active,
    .rank-verified-pill.active {
      background: rgba(255, 255, 255, 0.18);
      color: #ffffff;
      border-color: rgba(255, 255, 255, 0.3);
    }
    .rank-badge-pill.pill-real.active {
      background: linear-gradient(135deg, rgba(0, 230, 118, 0.25), rgba(0, 180, 80, 0.15));
      color: #00e676;
      border-color: rgba(0, 230, 118, 0.6);
      box-shadow: 0 0 10px rgba(0, 230, 118, 0.3);
    }
    .rank-badge-pill.pill-real.active svg {
      color: #00e676;
    }
    .rank-badge-pill.pill-iracing.active {
      background: linear-gradient(135deg, rgba(239, 68, 68, 0.25), rgba(185, 28, 28, 0.15));
      color: #f87171;
      border-color: rgba(239, 68, 68, 0.6);
      box-shadow: 0 0 10px rgba(239, 68, 68, 0.3);
    }
    .rank-badge-pill.pill-iracing.active svg {
      color: #ef4444;
    }
    .rank-badge-pill.pill-sim.active {
      background: linear-gradient(135deg, rgba(0, 229, 255, 0.22), rgba(0, 150, 255, 0.12));
      color: var(--accent-cyan);
      border-color: rgba(0, 229, 255, 0.55);
      box-shadow: 0 0 10px rgba(0, 229, 255, 0.3);
    }
    .rank-badge-pill.pill-sim.active svg {
      color: var(--accent-cyan);
    }
    .rank-badge-pill.pill-manual.active {
      background: rgba(148, 163, 184, 0.22);
      color: #f1f5f9;
      border-color: rgba(148, 163, 184, 0.5);
    }
    .rank-badge-pill.pill-manual.active svg {
      color: #cbd5e1;
    }
    .rank-badge-pill.pill-imported.active {
      background: linear-gradient(135deg, rgba(245, 158, 11, 0.25), rgba(217, 119, 6, 0.15));
      color: #fbbf24;
      border-color: rgba(245, 158, 11, 0.55);
      box-shadow: 0 0 10px rgba(245, 158, 11, 0.3);
    }
    .rank-badge-pill.pill-imported.active svg {
      color: #f59e0b;
    }

    html[data-theme="light"] .rank-badge-filter-bar,
    html[data-theme="light"] .rank-verified-toggle-group {
      background: #f1f5f9;
      border-color: rgba(15, 23, 42, 0.14);
    }
    html[data-theme="light"] .rank-badge-pill,
    html[data-theme="light"] .rank-verified-pill {
      color: #64748b;
    }
    html[data-theme="light"] .rank-badge-pill:hover,
    html[data-theme="light"] .rank-verified-pill:hover {
      color: #0f172a;
      background: rgba(15, 23, 42, 0.06);
    }
    html[data-theme="light"] .rank-badge-pill.active,
    html[data-theme="light"] .rank-verified-pill.active {
      background: #ffffff;
      color: #0f172a;
      border-color: rgba(15, 23, 42, 0.22);
      box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    }
    html[data-theme="light"] .rank-badge-pill.pill-real.active {
      background: #ecfdf5;
      color: #047857;
      border-color: rgba(5, 150, 105, 0.55);
    }
    html[data-theme="light"] .rank-badge-pill.pill-real.active svg {
      color: #047857;
    }
    html[data-theme="light"] .rank-badge-pill.pill-iracing.active {
      background: #fef2f2;
      color: #dc2626;
      border-color: rgba(220, 38, 38, 0.55);
    }
    html[data-theme="light"] .rank-badge-pill.pill-iracing.active svg {
      color: #dc2626;
    }
    html[data-theme="light"] .rank-badge-pill.pill-sim.active {
      background: #f0f9ff;
      color: #0284c7;
      border-color: rgba(2, 132, 199, 0.55);
    }
    html[data-theme="light"] .rank-badge-pill.pill-sim.active svg {
      color: #0284c7;
    }
    html[data-theme="light"] .rank-badge-pill.pill-manual.active {
      background: #f8fafc;
      color: #334155;
      border-color: rgba(100, 116, 139, 0.45);
    }
    html[data-theme="light"] .rank-badge-pill.pill-manual.active svg {
      color: #475569;
    }
    html[data-theme="light"] .rank-badge-pill.pill-imported.active {
      background: #fffbeb;
      color: #b45309;
      border-color: rgba(217, 119, 6, 0.55);
    }
    html[data-theme="light"] .rank-badge-pill.pill-imported.active svg {
      color: #b45309;
    }

    /* Session Detail Verified Run Certificate Banner */
    .session-verified-banner {
      display: flex;
      align-items: center;
      gap: 0.75rem;
      padding: 0.65rem 0.95rem;
      margin-bottom: 0.9rem;
      border-radius: 10px;
      background: linear-gradient(135deg, rgba(16, 185, 129, 0.12), rgba(16, 185, 129, 0.04));
      border: 1px solid rgba(16, 185, 129, 0.3);
      color: #f1f5f9;
    }
    .session-verified-badge {
      display: inline-flex;
      align-items: center;
      gap: 0.35rem;
      font-weight: 800;
      font-size: 0.82rem;
      color: #34d399;
      white-space: nowrap;
    }
    .session-verified-desc {
      font-size: 0.74rem;
      color: #94a3b8;
      line-height: 1.35;
    }

    .rank-pos-badge {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 32px;
      height: 32px;
      border-radius: 8px;
      font-family: var(--font-mono);
      font-weight: 900;
      font-size: 0.85rem;
    }

    .rank-pos-badge.gold {
      background: linear-gradient(135deg, #ffd700, #ffaa00);
      color: #000;
      box-shadow: 0 0 10px rgba(255, 215, 0, 0.4);
    }

    .rank-pos-badge.silver {
      background: linear-gradient(135deg, #e2e8f0, #94a3b8);
      color: #000;
      box-shadow: 0 0 10px rgba(226, 232, 240, 0.3);
    }

    .rank-pos-badge.bronze {
      background: linear-gradient(135deg, #cd7f32, #a05a2c);
      color: #fff;
      box-shadow: 0 0 10px rgba(205, 127, 50, 0.3);
    }

    .rank-pos-badge.normal {
      background: rgba(255, 255, 255, 0.05);
      color: var(--text-dim);
      border: 1px solid rgba(255, 255, 255, 0.1);
    }

    .rank-driver-avatar {
      width: 28px;
      height: 28px;
      border-radius: 50%;
      background: linear-gradient(135deg, rgba(0, 240, 255, 0.2), rgba(0, 255, 136, 0.2));
      border: 1px solid rgba(0, 240, 255, 0.4);
      display: inline-flex;
      align-items: center;
      justify-content: center;
      font-weight: 800;
      font-size: 0.72rem;
      color: var(--accent-cyan);
      margin-right: 0.45rem;
      flex-shrink: 0;
    }

    .rank-row:hover {
      background: rgba(0, 240, 255, 0.035) !important;
      cursor: pointer;
    }

    .rank-table th.sortable {
      cursor: pointer;
      user-select: none;
      transition: all 0.15s ease;
      white-space: nowrap;
    }

    .rank-table th.sortable:hover {
      color: var(--accent-cyan) !important;
      background: rgba(0, 240, 255, 0.05);
    }

    .rank-table th.sortable .sort-indicator {
      display: inline-flex;
      align-items: center;
      margin-left: 0.35rem;
      font-size: 0.72rem;
      opacity: 0.35;
      transition: all 0.15s ease;
      vertical-align: middle;
    }

    .rank-table th.sortable:hover .sort-indicator {
      opacity: 0.8;
      color: var(--accent-cyan);
    }

    .rank-table th.sortable.active {
      color: var(--accent-cyan) !important;
      background: rgba(0, 240, 255, 0.08);
    }

    .rank-table th.sortable.active .sort-indicator {
      opacity: 1;
      color: var(--accent-cyan);
      font-weight: 900;
    }

    @media (max-width: 768px) {
      .rank-podium-cluster {
        display: none !important;
      }

      .rank-toolbar {
        flex-direction: column;
        align-items: stretch;
        gap: 0.5rem;
        margin-bottom: 0.9rem;
      }

      .rank-search-box {
        max-width: none !important;
        width: 100% !important;
        display: flex !important;
        align-items: center !important;
        position: relative !important;
      }

      .rank-search-box i,
      .rank-search-box svg {
        position: absolute !important;
        left: 0.7rem !important;
        top: 50% !important;
        transform: translateY(-50%) !important;
        pointer-events: none !important;
        width: 13px !important;
        height: 13px !important;
        color: var(--text-dim) !important;
        z-index: 2 !important;
      }

      .rank-search-box input {
        width: 100% !important;
        box-sizing: border-box !important;
        min-height: 36px !important;
        height: 36px !important;
        padding: 0.35rem 0.75rem 0.35rem 2.05rem !important;
        font-size: 0.82rem !important;
      }

      .rank-filter-dropdowns {
        display: grid;
        grid-template-columns: 1fr 1fr;
        width: 100%;
        gap: 0.45rem;
      }

      .rank-filter-dropdowns .dropdown-wrapper {
        width: 100%;
      }

      .rank-filter-dropdowns .form-select {
        width: 100%;
        font-size: 0.82rem !important;
        font-weight: 600 !important;
        min-height: 36px !important;
        height: 36px !important;
        padding: 0.35rem 0.55rem !important;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }

      #rank-track-dropdown-btn {
        font-size: 0.8rem !important;
        font-weight: 600 !important;
        min-height: 34px !important;
        height: 34px !important;
        padding: 0.35rem 0.8rem !important;
      }

      #rank-track-btn-label {
        font-size: 0.8rem !important;
        font-weight: 600 !important;
      }

      .session-circuit-dropdown-panel .dropdown-circuit-item {
        font-size: 0.95rem !important;
        font-weight: 600 !important;
        padding: 0.65rem 0.85rem !important;
        min-height: 44px !important;
      }
      .session-circuit-dropdown-panel .dropdown-group-title {
        font-size: 0.82rem !important;
        font-weight: 800 !important;
      }
      .session-circuit-dropdown-panel .dropdown-search-input {
        font-size: 0.95rem !important;
        height: 42px !important;
      }

      .rank-recent-circuits {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        padding-bottom: 0.35rem;
        margin-bottom: 0.75rem;
      }
      .rank-recent-circuits::-webkit-scrollbar { display: none; }
      .rank-recent-chips {
        flex-wrap: nowrap;
      }
      .rank-recent-chip {
        white-space: nowrap;
        flex-shrink: 0;
      }

      /* Desktop table hidden on mobile */
      .rank-table-desktop {
        display: none !important;
      }

      /* Mobile Card List displayed on mobile */
      .rank-mobile-list {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.65rem !important;
        padding: 0.75rem 0.85rem calc(5.5rem + env(safe-area-inset-bottom, 0px)) !important;
      }

      /* Card Container & Header on Mobile */
      .rank-card {
        border-radius: 12px !important;
        margin-bottom: calc(5.5rem + env(safe-area-inset-bottom, 0px)) !important;
      }

      .rank-card-header {
        padding: 0.65rem 0.85rem !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        flex-wrap: wrap !important;
        gap: 0.45rem !important;
      }

      .rank-card-title {
        font-size: 0.88rem !important;
        gap: 0.4rem !important;
      }

      .rank-header-hint {
        display: none !important;
      }

      .rank-verified-toggle-group {
        padding: 2px !important;
      }

      .rank-verified-pill {
        padding: 0.22rem 0.55rem !important;
        font-size: 0.72rem !important;
        font-weight: 700 !important;
      }

      .rank-mobile-select-all {
        display: inline-flex !important;
        align-items: center !important;
        gap: 5px !important;
        font-size: 0.76rem !important;
        font-weight: 700 !important;
        color: var(--text-muted) !important;
        cursor: pointer !important;
        user-select: none !important;
        padding: 0.2rem 0.45rem !important;
        border-radius: 4px !important;
        background: rgba(255, 255, 255, 0.04) !important;
        border: 1px solid rgba(255, 255, 255, 0.08) !important;
      }

      /* Mobile Card Base */
      .rank-m-card {
        border-radius: 10px !important;
        padding: 0.75rem 0.85rem !important;
        gap: 0.45rem !important;
        box-sizing: border-box !important;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25) !important;
      }

      .rank-m-card:active {
        transform: scale(0.99) !important;
      }

      .rank-lap-check-wrap {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        min-width: 28px !important;
        min-height: 28px !important;
        margin-right: 4px !important;
        flex-shrink: 0 !important;
      }

      .rank-pos-badge.rank-m-pos {
        width: 26px !important;
        height: 26px !important;
        font-size: 0.78rem !important;
        font-weight: 900 !important;
        border-radius: 6px !important;
        flex-shrink: 0 !important;
      }

      .rank-driver-avatar {
        width: 26px !important;
        height: 26px !important;
        font-size: 0.74rem !important;
        margin-right: 0.35rem !important;
        flex-shrink: 0 !important;
      }

      .rank-m-driver-name {
        font-size: 0.92rem !important;
        font-weight: 700 !important;
        display: flex !important;
        align-items: center !important;
        gap: 0.3rem !important;
        line-height: 1.25 !important;
      }

      .rank-m-driver-text {
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
      }

      .rank-m-driver-meta {
        font-size: 0.72rem !important;
        line-height: 1.25 !important;
        color: var(--text-dim) !important;
      }

      .rank-m-time-box {
        text-align: right !important;
        flex-shrink: 0 !important;
      }

      .rank-m-best-time {
        font-size: 1.15rem !important;
        font-weight: 900 !important;
        font-family: var(--font-mono) !important;
        line-height: 1.1 !important;
      }

      .rank-m-gap {
        font-size: 0.72rem !important;
        font-family: var(--font-mono) !important;
        font-weight: 700 !important;
        margin-top: 2px !important;
      }

      .rank-m-bottom {
        display: flex !important;
        justify-content: space-between !important;
        align-items: center !important;
        padding-top: 0.42rem !important;
        gap: 0.4rem !important;
        font-size: 0.72rem !important;
      }

      .rank-m-track-col {
        display: flex !important;
        align-items: center !important;
        gap: 0.25rem !important;
        min-width: 0 !important;
        flex: 1 1 auto !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
      }

      .rank-m-track-pin {
        flex-shrink: 0 !important;
      }

      .rank-m-track-col strong {
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
      }

      .rank-m-layout-text {
        opacity: 0.75 !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
      }

      .rank-m-badges-col {
        display: flex !important;
        align-items: center !important;
        gap: 0.35rem !important;
        flex-shrink: 0 !important;
      }

      .rank-m-speed-badge {
        font-family: var(--font-mono) !important;
        font-weight: 700 !important;
        color: var(--accent-cyan) !important;
        font-size: 0.7rem !important;
        background: rgba(0, 240, 255, 0.08) !important;
        border: 1px solid rgba(0, 240, 255, 0.25) !important;
        padding: 0.12rem 0.38rem !important;
        border-radius: 4px !important;
        white-space: nowrap !important;
      }

      .rank-m-priv-badge {
        font-size: 0.68rem !important;
        font-weight: 600 !important;
        padding: 0.12rem 0.38rem !important;
        border-radius: 4px !important;
        white-space: nowrap !important;
      }

      .rank-m-priv-badge.priv-public {
        color: var(--accent-green) !important;
        background: rgba(0, 230, 118, 0.08) !important;
        border: 1px solid rgba(0, 230, 118, 0.25) !important;
      }

      .rank-m-priv-badge.priv-friends {
        color: var(--accent-cyan) !important;
        background: rgba(0, 240, 255, 0.08) !important;
        border: 1px solid rgba(0, 240, 255, 0.25) !important;
      }

    }

    /* Rank Mobile Card List Container */
    .rank-mobile-list {
      display: none;
    }

    .rank-mobile-select-all {
      display: none;
    }

    .rank-m-card {
      background: var(--bg-card);
      border: 1px solid var(--border-subtle);
      border-radius: var(--radius-sm);
      padding: 0.75rem 0.85rem;
      display: flex;
      flex-direction: column;
      gap: 0.45rem;
      transition: all 0.15s ease;
      cursor: pointer;
      position: relative;
    }

    .rank-m-card:hover {
      border-color: rgba(0, 240, 255, 0.4);
      background: var(--bg-card-hover);
    }

    .rank-m-card.p1 {
      border-color: rgba(255, 215, 0, 0.55);
      border-left: 3.5px solid #ffd700;
      background: linear-gradient(90deg, rgba(255, 215, 0, 0.08) 0%, var(--bg-card) 100%);
    }

    .rank-m-card.p2 {
      border-color: rgba(226, 232, 240, 0.45);
      border-left: 3.5px solid #94a3b8;
    }

    .rank-m-card.p3 {
      border-color: rgba(205, 127, 50, 0.45);
      border-left: 3.5px solid #cd7f32;
    }

    .rank-m-card.card-selected {
      border-color: var(--accent-cyan, #00f0ff) !important;
      background: rgba(0, 240, 255, 0.08) !important;
      box-shadow: 0 0 12px rgba(0, 240, 255, 0.25) !important;
    }

    .rank-m-top {
      display: flex;
      justify-content: space-between;
      align-items: center;
      gap: 0.5rem;
    }

    .rank-m-left {
      display: flex;
      align-items: center;
      gap: 0.4rem;
      min-width: 0;
      flex: 1;
    }

    .rank-m-pos {
      flex-shrink: 0;
    }

    .rank-m-driver-info {
      min-width: 0;
      flex: 1;
    }

    .rank-m-driver-name {
      font-weight: 700;
      font-size: 0.92rem;
      color: #fff;
      display: flex;
      align-items: center;
      gap: 0.3rem;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .rank-m-driver-meta {
      font-size: 0.72rem;
      color: var(--text-dim);
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .rank-m-time-box {
      text-align: right;
      flex-shrink: 0;
    }

    .rank-m-best-time {
      font-family: var(--font-mono);
      font-size: 1.12rem;
      font-weight: 800;
      color: var(--accent-green);
      line-height: 1.1;
    }

    .rank-m-gap {
      font-family: var(--font-mono);
      font-size: 0.72rem;
      color: var(--text-dim);
    }

    .rank-m-gap.leader {
      color: var(--accent-amber);
      font-weight: 700;
    }

    .rank-m-bottom {
      display: flex;
      justify-content: space-between;
      align-items: center;
      padding-top: 0.4rem;
      border-top: 1px solid rgba(255, 255, 255, 0.05);
      font-size: 0.72rem;
      color: var(--text-dim);
      gap: 0.5rem;
    }

    .rank-m-track-col {
      display: flex;
      align-items: center;
      gap: 0.25rem;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
      flex: 1;
    }

    .rank-m-track-col strong {
      color: var(--text-light);
      font-weight: 600;
    }

    .rank-m-badges-col {
      display: flex;
      align-items: center;
      gap: 0.4rem;
      flex-shrink: 0;
    }

    /* Light Theme Support for Mobile Cards */
    html[data-theme="light"] .rank-m-card {
      background: #ffffff !important;
      border: 1px solid #e2e8f0 !important;
      box-shadow: 0 1px 4px rgba(15, 23, 42, 0.06) !important;
    }
    html[data-theme="light"] .rank-m-card:hover {
      background: #f8fafc !important;
      border-color: rgba(2, 132, 199, 0.35) !important;
    }
    html[data-theme="light"] .rank-m-card.p1 {
      border: 1px solid rgba(234, 179, 8, 0.45) !important;
      border-left: 3.5px solid #eab308 !important;
      background: linear-gradient(90deg, #fefce8 0%, #ffffff 85%) !important;
    }
    html[data-theme="light"] .rank-m-card.p2 {
      border: 1px solid #cbd5e1 !important;
      border-left: 3.5px solid #94a3b8 !important;
    }
    html[data-theme="light"] .rank-m-card.p3 {
      border: 1px solid #fed7aa !important;
      border-left: 3.5px solid #cd7f32 !important;
    }
    html[data-theme="light"] .rank-m-card.card-selected {
      border-color: #0284c7 !important;
      background: #f0f9ff !important;
      box-shadow: 0 0 10px rgba(2, 132, 199, 0.2) !important;
    }
    html[data-theme="light"] .rank-m-driver-name {
      color: #0f172a !important;
    }
    html[data-theme="light"] .rank-m-driver-meta {
      color: #64748b !important;
    }
    html[data-theme="light"] .rank-m-best-time {
      color: #059669 !important;
    }
    html[data-theme="light"] .rank-m-gap {
      color: #64748b !important;
    }
    html[data-theme="light"] .rank-m-gap.leader {
      color: #d97706 !important;
    }
    html[data-theme="light"] .rank-m-track-col strong {
      color: #1e293b !important;
    }
    html[data-theme="light"] .rank-m-bottom {
      border-top: 1px solid rgba(15, 23, 42, 0.06) !important;
      color: #64748b !important;
    }
    html[data-theme="light"] .rank-m-speed-badge {
      color: #0284c7 !important;
      background: #f0f9ff !important;
      border-color: rgba(2, 132, 199, 0.3) !important;
    }
    html[data-theme="light"] .rank-m-priv-badge.priv-public {
      color: #059669 !important;
      background: #ecfdf5 !important;
      border-color: rgba(5, 150, 105, 0.3) !important;
    }
    html[data-theme="light"] .rank-m-priv-badge.priv-friends {
      color: #0284c7 !important;
      background: #f0f9ff !important;
      border-color: rgba(2, 132, 199, 0.3) !important;
    }
    html[data-theme="light"] .rank-mobile-select-all {
      color: #1e293b !important;
      background: #ffffff !important;
      border: 1px solid #cbd5e1 !important;
    }

    /* =========================================================================
       LEADERBOARD DARK/LIGHT HIGH-CONTRAST & MOBILE OPTIMIZATION (v20261125)
       ========================================================================= */
    #view-rank .rank-card {
      background: #0d1424;
      border: 1px solid rgba(148, 163, 184, 0.22);
    }
    #view-rank .rank-card-header {
      background: rgba(30, 41, 59, 0.65);
      border-bottom: 1px solid rgba(148, 163, 184, 0.18);
    }
    #view-rank .rank-card-title {
      color: #f8fafc;
      min-width: 0;
    }
    #view-rank .rank-search-box input {
      background: #111827;
      border: 1px solid rgba(148, 163, 184, 0.28);
      color: #f8fafc;
    }
    #view-rank .rank-search-box input::placeholder {
      color: #94a3b8;
    }
    #view-rank .rank-badge-filter-bar {
      background: rgba(15, 23, 42, 0.92);
      border: 1px solid rgba(148, 163, 184, 0.24);
    }
    #view-rank .rank-badge-pill {
      color: #cbd5e1;
      background: rgba(30, 41, 59, 0.55);
      border-color: rgba(148, 163, 184, 0.16);
    }
    #view-rank .rank-badge-pill:hover {
      color: #ffffff;
      background: rgba(51, 65, 85, 0.75);
    }
    #view-rank .rank-badge-pill.active:not(.pill-real):not(.pill-iracing):not(.pill-sim):not(.pill-manual):not(.pill-imported) {
      background: rgba(255, 255, 255, 0.2);
      color: #ffffff;
      border-color: rgba(255, 255, 255, 0.42);
    }
    #view-rank .rank-pos-badge.normal {
      background: rgba(51, 65, 85, 0.85);
      color: #e2e8f0;
      border: 1px solid rgba(148, 163, 184, 0.3);
    }
    #view-rank .rank-m-card {
      background: #141d31;
      border: 1px solid rgba(148, 163, 184, 0.24);
      box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
    }
    #view-rank .rank-m-card.p1 {
      background: linear-gradient(90deg, rgba(255, 215, 0, 0.14) 0%, #141d31 100%);
      border-color: rgba(255, 215, 0, 0.55);
    }
    #view-rank .rank-m-driver-name,
    #view-rank .rank-m-driver-text {
      color: #f8fafc;
    }
    #view-rank .rank-m-driver-meta {
      color: #cbd5e1 !important;
    }
    #view-rank .rank-m-gap {
      color: #cbd5e1 !important;
    }
    #view-rank .rank-m-gap.leader {
      color: #fbbf24 !important;
    }
    #view-rank .rank-m-bottom {
      border-top: 1px solid rgba(148, 163, 184, 0.18);
      color: #cbd5e1;
    }
    #view-rank .rank-m-track-col strong {
      color: #f1f5f9;
    }
    #view-rank .rank-m-layout-text {
      color: #94a3b8;
      opacity: 1 !important;
    }

    /* Light Mode Contrast Refinements for Leaderboard */
    html[data-theme="light"] #view-rank .rank-card {
      background: #ffffff !important;
      border: 1px solid #cbd5e1 !important;
    }
    html[data-theme="light"] #view-rank .rank-card-header {
      background: #f8fafc !important;
      border-bottom: 1px solid #e2e8f0 !important;
    }
    html[data-theme="light"] #view-rank .rank-card-title {
      color: #0f172a !important;
    }
    html[data-theme="light"] #view-rank .rank-search-box input {
      background: #ffffff !important;
      border: 1px solid #cbd5e1 !important;
      color: #0f172a !important;
    }
    html[data-theme="light"] #view-rank .rank-search-box input::placeholder {
      color: #64748b !important;
    }
    html[data-theme="light"] #view-rank .rank-badge-filter-bar {
      background: #eef2f7 !important;
      border: 1px solid #cbd5e1 !important;
    }
    html[data-theme="light"] #view-rank .rank-badge-pill {
      color: #334155 !important;
      background: rgba(255, 255, 255, 0.78) !important;
      border-color: #cbd5e1 !important;
    }
    html[data-theme="light"] #view-rank .rank-badge-pill.active:not(.pill-real):not(.pill-iracing):not(.pill-sim):not(.pill-manual):not(.pill-imported) {
      background: #0f172a !important;
      color: #ffffff !important;
      border-color: #0f172a !important;
    }
    html[data-theme="light"] #view-rank .rank-m-card {
      background: #ffffff !important;
      border: 1px solid #cbd5e1 !important;
    }
    html[data-theme="light"] #view-rank .rank-m-driver-name,
    html[data-theme="light"] #view-rank .rank-m-driver-text {
      color: #0f172a !important;
    }
    html[data-theme="light"] #view-rank .rank-m-driver-meta,
    html[data-theme="light"] #view-rank .rank-m-gap,
    html[data-theme="light"] #view-rank .rank-m-layout-text {
      color: #475569 !important;
      opacity: 1 !important;
    }
    html[data-theme="light"] #view-rank .rank-m-gap.leader {
      color: #d97706 !important;
    }
    html[data-theme="light"] #view-rank .rank-m-track-col strong {
      color: #0f172a !important;
    }

    @media (max-width: 768px) {
      #view-rank .rank-card-header {
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.55rem !important;
        padding: 0.75rem 0.75rem !important;
      }
      #view-rank .rank-card-title {
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        gap: 0.35rem 0.45rem !important;
        width: 100% !important;
        min-width: 0 !important;
        font-size: 0.88rem !important;
        line-height: 1.3 !important;
      }
      #view-rank #rank-table-title {
        min-width: 0 !important;
        word-break: keep-all !important;
        overflow-wrap: anywhere !important;
      }
      #view-rank .rank-card-header-actions {
        width: 100% !important;
        min-width: 0 !important;
        max-width: 100% !important;
        display: flex !important;
        flex-direction: column !important;
        align-items: stretch !important;
        gap: 0.45rem !important;
      }
      #view-rank .rank-mobile-select-all {
        align-self: flex-start !important;
        color: #e2e8f0 !important;
        background: rgba(30, 41, 59, 0.85) !important;
        border: 1px solid rgba(148, 163, 184, 0.28) !important;
      }
      #view-rank .rank-badge-filter-bar {
        display: flex !important;
        flex-wrap: wrap !important;
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: visible !important;
        border-radius: 12px !important;
        padding: 5px !important;
        gap: 5px !important;
        box-sizing: border-box !important;
      }
      #view-rank .rank-badge-pill {
        flex: 0 1 auto !important;
        padding: 0.28rem 0.56rem !important;
        font-size: 0.72rem !important;
        min-height: 29px !important;
      }

      /* Mobile Lap Card: Zero Title Clipping */
      #view-rank .rank-mobile-list {
        padding: 0.65rem 0.65rem calc(5.5rem + env(safe-area-inset-bottom, 0px)) !important;
        gap: 0.65rem !important;
      }
      #view-rank .rank-m-card {
        padding: 0.78rem 0.78rem !important;
        gap: 0.52rem !important;
      }
      #view-rank .rank-m-top {
        align-items: flex-start !important;
        gap: 0.45rem !important;
      }
      #view-rank .rank-m-left {
        align-items: flex-start !important;
        gap: 0.38rem !important;
        min-width: 0 !important;
        flex: 1 1 auto !important;
      }
      #view-rank .rank-lap-check-wrap {
        min-width: 22px !important;
        min-height: 24px !important;
        margin-right: 0 !important;
        margin-top: 1px !important;
      }
      #view-rank .rank-pos-badge.rank-m-pos {
        width: 24px !important;
        height: 24px !important;
        font-size: 0.74rem !important;
        margin-top: 1px !important;
      }
      #view-rank .rank-driver-avatar {
        display: none !important;
      }
      #view-rank .rank-m-driver-info {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.18rem !important;
        min-width: 0 !important;
        flex: 1 1 auto !important;
      }
      #view-rank .rank-m-driver-name {
        display: flex !important;
        flex-wrap: wrap !important;
        align-items: center !important;
        gap: 0.25rem 0.35rem !important;
        white-space: normal !important;
        overflow: visible !important;
        line-height: 1.28 !important;
      }
      #view-rank .rank-m-driver-text {
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
        word-break: break-word !important;
        font-size: 0.9rem !important;
        font-weight: 800 !important;
      }
      #view-rank .rank-m-driver-meta {
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
        line-height: 1.3 !important;
        font-size: 0.75rem !important;
      }
      #view-rank .rank-m-best-time {
        font-size: 1.04rem !important;
        letter-spacing: -0.02em !important;
      }
      #view-rank .rank-m-bottom {
        flex-wrap: wrap !important;
        row-gap: 0.35rem !important;
        column-gap: 0.5rem !important;
        padding-top: 0.48rem !important;
      }
      #view-rank .rank-m-track-col {
        flex: 1 1 100% !important;
        white-space: normal !important;
        overflow: visible !important;
        flex-wrap: wrap !important;
        line-height: 1.32 !important;
      }
      #view-rank .rank-m-track-col strong,
      #view-rank .rank-m-layout-text {
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
      }
      #view-rank .rank-m-badges-col {
        width: 100% !important;
        justify-content: flex-end !important;
        flex-wrap: wrap !important;
      }
    }

    .ct-sector-table th.ct-th-sortable {
      cursor: pointer;
      user-select: none;
      white-space: nowrap;
      transition: color 0.15s ease, background 0.15s ease;
    }
    .ct-sector-table th.ct-th-sortable:hover {
      color: var(--accent-cyan) !important;
      background: rgba(0, 240, 255, 0.08);
    }
    .ct-sector-table th.ct-th-sortable.is-sorted {
      color: var(--accent-cyan) !important;
    }
    .ct-sort-ind {
      display: inline-block;
      margin-left: 3px;
      font-size: 0.65rem;
      opacity: 0.45;
    }
    .ct-sort-ind.active {
      opacity: 1;
      color: var(--accent-cyan);
    }
    html[data-theme="light"] .ct-sector-table th.ct-th-sortable:hover,
    html[data-theme="light"] .ct-sector-table th.ct-th-sortable.is-sorted,
    html[data-theme="light"] .ct-sort-ind.active {
      color: #0284c7 !important;
    }

    /* --- 7. GUIDES & INSIGHTS TAB (UNIFIED WITH GUIDES.PHP) --- */

    .guides-grid {
      display: grid;
      grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
      gap: 1.15rem;
    }

    .guide-card {
      background: var(--bg-card);
      border: 1px solid var(--border-subtle);
      border-radius: 12px;
      padding: 1.15rem;
      display: flex;
      flex-direction: column;
      text-decoration: none;
      color: inherit;
      transition: all 0.2s ease;
      touch-action: manipulation;
      cursor: pointer;
    }

    .guide-card:hover {
      transform: translateY(-3px);
      border-color: var(--accent-cyan);
      background: rgba(18, 26, 44, 0.95);
      box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 0 16px rgba(0, 240, 255, 0.15);
      text-decoration: none;
    }

    .card-thumb {
      width: 100%;
      height: 145px;
      border-radius: 8px;
      object-fit: cover;
      margin-bottom: 0.75rem;
      border: 1px solid rgba(255, 255, 255, 0.08);
      background: #030712;
      transition: transform 0.3s ease;
    }

    .guide-card:hover .card-thumb {
      transform: scale(1.02);
    }

    .card-meta {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 0.65rem;
    }

    .badge-cyan {
      display: inline-flex;
      align-items: center;
      gap: 0.25rem;
      padding: 0.2rem 0.6rem;
      border-radius: 9999px;
      font-size: 0.74rem;
      font-weight: 700;
      letter-spacing: 0.02em;
      background: rgba(0, 240, 255, 0.12);
      color: var(--accent-cyan);
      border: 1px solid rgba(0, 240, 255, 0.3);
    }

    .card-title {
      font-family: var(--font-display);
      font-size: 1.02rem;
      font-weight: 700;
      color: #fff;
      line-height: 1.42;
      margin-bottom: 0.45rem;
      word-break: keep-all;
    }

    .card-excerpt {
      font-size: 0.8rem;
      color: var(--text-muted);
      line-height: 1.5;
      display: -webkit-box;
      -webkit-line-clamp: 3;
      -webkit-box-orient: vertical;
      overflow: hidden;
      margin-bottom: 0.85rem;
    }

    .card-footer {
      margin-top: auto;
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-size: 0.74rem;
      color: var(--text-muted);
      padding-top: 0.7rem;
      border-top: 1px solid rgba(255, 255, 255, 0.06);
    }

    /* Category Chips - Swipeable Horizontal Scroll for Mobile */

    .category-chips-wrapper {
      position: relative;
      margin-bottom: 1.35rem;
    }

    .category-chips {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
      padding: 0.25rem 0.25rem 0.5rem;
      scrollbar-width: none;
    }

    .category-chips::-webkit-scrollbar {
      display: none;
    }

    .cat-chip {
      padding: 0.45rem 0.95rem;
      border-radius: 9999px;
      font-size: 0.8rem;
      font-weight: 600;
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid rgba(255, 255, 255, 0.1);
      color: var(--text-muted);
      cursor: pointer;
      transition: all 0.2s ease;
      white-space: nowrap;
      flex-shrink: 0;
      touch-action: manipulation;
      font-family: inherit;
    }

    .cat-chip:hover, .cat-chip.active {
      background: rgba(0, 240, 255, 0.15);
      border-color: var(--accent-cyan);
      color: var(--accent-cyan);
      box-shadow: 0 0 12px rgba(0, 240, 255, 0.25);
    }

    /* Guide Language Switcher Toggle */

    .guide-lang-toggle {
      display: inline-flex;
      align-items: center;
      background: rgba(15, 23, 42, 0.85);
      border: 1px solid var(--border-subtle);
      border-radius: 9999px;
      padding: 3px;
      gap: 2px;
      backdrop-filter: blur(8px);
      box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.4);
      user-select: none;
    }

    .guide-lang-btn {
      background: transparent;
      border: none;
      color: var(--text-dim);
      font-family: var(--font-display);
      font-size: 0.72rem;
      font-weight: 700;
      padding: 4px 11px;
      border-radius: 9999px;
      cursor: pointer;
      transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
      display: inline-flex;
      align-items: center;
      justify-content: center;
      line-height: 1;
      letter-spacing: 0.5px;
    }

    .guide-lang-btn:hover {
      color: #fff;
    }

    .guide-lang-btn.active {
      background: linear-gradient(135deg, var(--accent-cyan), #00a8e8);
      color: #030712;
      box-shadow: 0 2px 8px rgba(0, 210, 255, 0.35);
      font-weight: 800;
    }

        /* --- 8. MODALS & FORMS (DESKTOP & NATIVE MOBILE BOTTOM-SHEET) --- */

    .modal-overlay {
      position: fixed;
      inset: 0;
      z-index: 10000000;
      background: rgba(0, 0, 0, 0.85);
      backdrop-filter: blur(14px);
      -webkit-backdrop-filter: blur(14px);
      display: none;
      align-items: center;
      justify-content: center;
      padding: 1rem;
    }

    .modal-overlay.active {
      display: flex;
      animation: modalFadeIn 0.2s ease;
    }

    @keyframes modalFadeIn {
      from { opacity: 0; }

      to { opacity: 1; }

    }

    .modal-card {
      background: #0d121c;
      border: 1px solid var(--border-bright);
      border-radius: var(--radius-lg);
      width: 100%;
      max-width: 660px;
      max-height: 90vh;
      display: flex;
      flex-direction: column;
      box-shadow: 0 20px 60px rgba(0, 0, 0, 0.85), 0 0 40px rgba(0, 240, 255, 0.1);
      overflow: hidden;
      transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
    }

    @keyframes spin {
      0% { transform: rotate(0deg); }
      100% { transform: rotate(360deg); }
    }
    .spin {
      animation: spin 0.85s linear infinite !important;
      display: inline-block !important;
    }

    @keyframes modalShake {
      0%, 100% { transform: scale(1); }

      25% { transform: scale(1.012) translateY(-2px); }

      50% { transform: scale(0.995) translateY(1px); }

      75% { transform: scale(1.008) translateY(-1px); }

    }

    .modal-card.shake {
      animation: modalShake 0.32s ease-in-out !important;
      border-color: rgba(0, 240, 255, 0.75) !important;
      box-shadow: 0 0 35px rgba(0, 240, 255, 0.35) !important;
    }

    .modal-drag-indicator {
      display: none;
      width: 40px;
      height: 4px;
      background: rgba(255, 255, 255, 0.25);
      border-radius: 2px;
      margin: 8px auto 2px;
    }

    .modal-header {
      padding: 0.95rem 1.25rem;
      border-bottom: 1px solid var(--border-subtle);
      display: flex;
      justify-content: space-between;
      align-items: center;
      background: rgba(255, 255, 255, 0.02);
      flex-shrink: 0;
      min-height: 56px;
      box-sizing: border-box;
    }

    /* UNIFIED GLOBAL MODAL TITLE SYSTEM (DESKTOP & BASE) */
    .modal-title,
    .modal-header .modal-title,
    .modal-card .modal-title {
      font-family: var(--font-display) !important;
      font-size: 1.22rem !important;
      font-weight: 800 !important;
      color: var(--text-main, #ffffff) !important;
      display: flex !important;
      align-items: center !important;
      gap: 0.55rem !important;
      min-width: 0 !important;
      letter-spacing: 0.2px !important;
      line-height: 1.35 !important;
      padding: 2px 0 !important;
    }

    .modal-title span,
    .modal-title strong,
    #ct-modal-title,
    #auth-modal-title,
    #vbo-export-modal-title {
      font-size: inherit !important;
      font-weight: inherit !important;
      font-family: inherit !important;
      line-height: inherit !important;
      overflow: hidden !important;
      text-overflow: ellipsis !important;
      white-space: nowrap !important;
    }

    .modal-title i,
    .modal-title svg,
    .modal-title [data-lucide] {
      width: 20px !important;
      height: 20px !important;
      flex-shrink: 0 !important;
    }

    .modal-close-btn {
      background: transparent;
      border: none;
      color: var(--text-muted);
      cursor: pointer;
      padding: 0.3rem;
      display: flex;
      align-items: center;
      justify-content: center;
      border-radius: 4px;
      transition: color var(--transition-fast);
      min-width: 32px;
      min-height: 32px;
    }

    .modal-close-btn:hover {
      color: #fff;
    }

    .modal-close-btn svg,
    .modal-close-btn i,
    .modal-close-btn [data-lucide] {
      width: 20px !important;
      height: 20px !important;
      display: block !important;
      stroke: currentColor !important;
      stroke-width: 2.5 !important;
      flex-shrink: 0 !important;
    }

    .modal-body {
      padding: 1.25rem;
      overflow-y: auto;
      display: flex;
      flex-direction: column;
      gap: 1rem;
      flex: 1;
      -webkit-overflow-scrolling: touch;
    }

    .modal-footer {
      padding: 0.85rem 1.25rem;
      border-top: 1px solid var(--border-subtle);
      display: flex;
      justify-content: flex-end;
      align-items: center;
      gap: 0.5rem;
      background: rgba(255, 255, 255, 0.02);
      flex-shrink: 0;
    }

    /* Form Inputs */

    .form-group {
      display: flex;
      flex-direction: column;
      gap: 0.35rem;
    }

    .form-label {
      font-size: 0.78rem;
      font-weight: 700;
      color: var(--text-muted);
      font-family: var(--font-display);
      text-transform: uppercase;
      letter-spacing: 0.3px;
    }

    .form-input, .form-select, .form-textarea {
      width: 100%;
      background: rgba(0, 0, 0, 0.4);
      border: 1px solid var(--border-bright);
      color: #fff;
      font-family: var(--font-sans);
      font-size: 0.9rem;
      padding: 0.6rem 0.8rem;
      border-radius: var(--radius-sm);
      outline: none;
      transition: border-color var(--transition-fast);
      min-height: 42px;
    }

    .form-input:focus, .form-select:focus, .form-textarea:focus {
      border-color: var(--accent-cyan);
      box-shadow: 0 0 10px rgba(0, 240, 255, 0.25);
    }

    .auth-toggle-tabs {
      display: flex;
      gap: 0.35rem;
      background: rgba(255, 255, 255, 0.05);
      padding: 0.25rem;
      border-radius: var(--radius-sm);
      margin-bottom: 0.75rem;
    }
    .auth-tab-btn {
      flex: 1;
      background: transparent;
      color: var(--text-muted);
      border: none;
      font-weight: 700;
      transition: all 0.2s ease;
      cursor: pointer;
      min-height: 34px;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border-radius: calc(var(--radius-sm) - 2px);
    }
    .auth-tab-btn.active {
      background: var(--accent-cyan) !important;
      color: #000000 !important;
      box-shadow: 0 1px 6px rgba(0, 240, 255, 0.35);
    }

    .form-row {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 0.75rem;
    }

    /* Dedicated Session Date & Time Row (Responsive proportional width) */

    .form-row-datetime {
      display: grid;
      grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr);
      gap: 0.75rem;
      align-items: start;
      width: 100%;
      max-width: 100%;
      box-sizing: border-box;
    }

    .form-row-datetime > .form-group {
      min-width: 0;
      width: 100%;
    }

    .form-row-datetime .form-label {
      white-space: nowrap !important;
      display: flex;
      align-items: center;
    }

    .form-date-input, .form-time-input {
      font-family: var(--font-sans);
      min-width: 0;
      width: 100%;
      box-sizing: border-box;
    }

    input[type="date"]::-webkit-date-and-time-value,

    input[type="time"]::-webkit-date-and-time-value {
      text-align: left;
      height: 1.25em;
    }

    .form-date-input::-webkit-calendar-picker-indicator,

    .form-time-input::-webkit-calendar-picker-indicator {
      filter: invert(0.85);
      cursor: pointer;
      opacity: 0.8;
      margin: 0;
      padding: 0;
    }

    /* Quick Preset Chips */

    .quick-preset-chips-row {
      display: flex;
      gap: 0.35rem;
      overflow-x: auto;
      overscroll-behavior-x: contain;
      padding-top: 0.2rem;
      padding-bottom: 0.2rem;
      scrollbar-width: none;
      -webkit-overflow-scrolling: touch;
      touch-action: pan-x pan-y;
      width: 100%;
      max-width: 100%;
    }

    .quick-preset-chips-row::-webkit-scrollbar { display: none; }

    .quick-preset-chip {
      background: rgba(255, 255, 255, 0.06);
      border: 1px solid var(--border-subtle);
      color: var(--text-muted);
      font-size: 0.74rem;
      font-weight: 600;
      padding: 0.22rem 0.6rem;
      border-radius: var(--radius-full);
      cursor: pointer;
      white-space: nowrap;
      transition: all var(--transition-fast);
      flex-shrink: 0;
    }

    .quick-preset-chip:active, .quick-preset-chip:hover {
      background: rgba(0, 240, 255, 0.18);
      color: var(--accent-cyan);
      border-color: var(--accent-cyan);
    }

        /* --- SUPERCHARGED 4-WHEEL TIRE PRESSURE CAR DIAGRAM & INPUTS --- */

    .mobile-car-setup-container {
      background: rgba(0, 0, 0, 0.38);
      border: 1px solid rgba(0, 240, 255, 0.25);
      border-radius: var(--radius-md);
      padding: 0.85rem;
      display: flex;
      flex-direction: column;
      gap: 0.65rem;
    }

    .car-setup-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      flex-wrap: wrap;
      gap: 0.4rem;
      border-bottom: 1px solid rgba(255, 255, 255, 0.06);
      padding-bottom: 0.5rem;
    }

    .car-setup-title {
      font-family: var(--font-display);
      font-size: 0.86rem;
      font-weight: 800;
      color: var(--accent-cyan);
      display: flex;
      align-items: center;
      gap: 0.35rem;
    }

    .live-psi-summary-badge {
      font-family: var(--font-mono);
      font-size: 0.72rem;
      font-weight: 700;
      color: var(--accent-green);
      background: rgba(0, 230, 118, 0.1);
      border: 1px solid rgba(0, 230, 118, 0.3);
      padding: 0.18rem 0.55rem;
      border-radius: var(--radius-full);
    }

    .car-axle-label {
      font-family: var(--font-display);
      font-size: 0.72rem;
      font-weight: 800;
      text-transform: uppercase;
      letter-spacing: 1px;
      color: var(--accent-cyan);
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 0.4rem;
      margin: 0.1rem 0;
    }

    .car-axle-label.rear {
      color: var(--accent-red);
      margin-top: 0.4rem;
    }

    .car-axle-label i {
      width: 14px;
      height: 14px;
    }

    .car-axle-row {
      display: grid;
      grid-template-columns: 1fr 34px 1fr;
      align-items: stretch;
      gap: 0.5rem;
    }

    .car-silhouette-spine {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 0.2rem;
    }

    .car-spine-line {
      width: 2px;
      flex: 1;
      background: rgba(255, 255, 255, 0.12);
    }

    .car-chassis-badge, .car-exhaust-badge {
      font-family: var(--font-display);
      font-size: 0.72rem;
      font-weight: 900;
      letter-spacing: 0.5px;
      color: var(--text-dim);
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid var(--border-subtle);
      padding: 0.25rem 0.1rem;
      border-radius: 4px;
      writing-mode: vertical-rl;
      text-orientation: mixed;
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .wheel-box {
      background: rgba(255, 255, 255, 0.03);
      border: 1px solid rgba(255, 255, 255, 0.1);
      border-radius: var(--radius-sm);
      padding: 0.65rem;
      display: flex;
      flex-direction: column;
      gap: 0.45rem;
      transition: border-color var(--transition-fast);
    }

    .wheel-box:focus-within {
      border-color: rgba(0, 240, 255, 0.5);
      background: rgba(0, 240, 255, 0.04);
    }

    .wheel-box-top {
      display: flex;
      justify-content: space-between;
      align-items: center;
      font-family: var(--font-mono);
      font-size: 0.74rem;
      font-weight: 800;
    }

    .wheel-id-badge {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      min-width: 58px;
      padding: 0.22rem 0.52rem;
      border-radius: 4px;
      background: rgba(255, 255, 255, 0.05);
      gap: 0.3rem;
      color: #fff;
      white-space: nowrap !important;
      flex-shrink: 0 !important;
      font-weight: 800;
      letter-spacing: 0.5px;
    }

    [data-theme="light"] .wheel-id-badge {
      background: rgba(15, 23, 42, 0.06);
    }

    .wheel-box-top {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 0.25rem;
      white-space: nowrap !important;
    }

    .wheel-id-badge.fl, .wheel-id-badge.fr { color: var(--accent-cyan); }

    .wheel-id-badge.rl, .wheel-id-badge.rr { color: var(--accent-red); }

    .wheel-delta-pill {
      font-size: 0.72rem;
      font-family: var(--font-mono);
      font-weight: 800;
      color: var(--text-dim);
      background: rgba(0, 0, 0, 0.4);
      padding: 0.1rem 0.4rem;
      border-radius: 4px;
    }

    .wheel-delta-pill.gain {
      color: var(--accent-green);
      background: rgba(0, 230, 118, 0.15);
    }

    .wheel-delta-pill.hot-warning {
      color: var(--accent-red);
      background: rgba(255, 42, 75, 0.2);
    }

    .wheel-input-rows {
      display: flex;
      flex-direction: column;
      gap: 0.4rem;
    }

    .wheel-input-item {
      display: flex;
      flex-direction: column;
      gap: 0.15rem;
    }

    .wheel-input-item label {
      font-size: 0.72rem;
      color: var(--text-dim);
      font-weight: 700;
      font-family: var(--font-display);
      text-transform: uppercase;
    }

    .wheel-input-item.hot-highlight label {
      color: var(--accent-amber);
    }

    /* Stepper with [+] and [-] buttons */

    .input-stepper-wrap {
      display: grid;
      grid-template-columns: 28px 1fr 28px;
      align-items: stretch;
      background: rgba(0, 0, 0, 0.5);
      border: 1px solid var(--border-subtle);
      border-radius: 6px;
      overflow: hidden;
    }

    .input-stepper-wrap:focus-within {
      border-color: var(--accent-cyan);
    }

    .wheel-input-item.hot-highlight .input-stepper-wrap {
      border-color: rgba(255, 179, 0, 0.4);
    }

    .wheel-input-item.hot-highlight .input-stepper-wrap:focus-within {
      border-color: var(--accent-amber);
      box-shadow: 0 0 10px rgba(255, 179, 0, 0.3);
    }

    .btn-step {
      background: rgba(255, 255, 255, 0.05);
      border: none;
      color: #fff;
      font-family: var(--font-mono);
      font-size: 0.95rem;
      font-weight: 700;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      transition: background var(--transition-fast);
      user-select: none;
    }

    .btn-step:active {
      background: rgba(255, 255, 255, 0.2);
    }

    .input-stepper-wrap input {
      background: transparent;
      border: none;
      outline: none;
      font-family: var(--font-mono);
      font-size: 0.92rem;
      font-weight: 800;
      color: #fff;
      text-align: center;
      padding: 0.45rem 0.2rem;
      width: 100%;
    }

    .input-stepper-wrap input.input-hot {
      color: var(--accent-amber);
    }

    /* Grouped Lap Timer Metrics Box Grid */
    .laptimer-metrics-grid {
      display: grid;
      grid-template-columns: minmax(0, 1.35fr) minmax(0, 0.9fr) minmax(0, 1fr);
      gap: 0.65rem;
      align-items: end;
      width: 100%;
      box-sizing: border-box;
    }
    .laptimer-metrics-grid > .form-group {
      min-width: 0;
      box-sizing: border-box;
    }
    @media (max-width: 540px) {
      .laptimer-metrics-grid {
        grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.85fr) minmax(0, 1fr);
        gap: 0.45rem;
      }
    }
    @media (max-width: 400px) {
      .laptimer-metrics-grid {
        grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.75fr) minmax(0, 1fr);
        gap: 0.35rem;
      }
    }
    .total-laps-grouped-input,
    .top-speed-grouped-input {
      font-family: var(--font-mono) !important;
      font-size: 1.15rem !important;
      font-weight: 800 !important;
      text-align: center;
      height: 48px;
    }

    /* Hero Best Lap Input Group */

    .best-lap-hero-group {
      background: rgba(0, 230, 118, 0.05);
      border: 1px solid rgba(0, 230, 118, 0.35);
      border-radius: var(--radius-sm);
      padding: 0.75rem 0.85rem;
    }

    .best-lap-hero-input {
      font-family: var(--font-mono) !important;
      font-size: 1.35rem !important;
      font-weight: 900 !important;
      color: var(--accent-green) !important;
      text-shadow: 0 0 16px rgba(0, 230, 118, 0.35);
      text-align: center;
      letter-spacing: 1px;
      border-color: rgba(0, 230, 118, 0.5) !important;
      background: rgba(0, 0, 0, 0.6) !important;
    }

    /* Smart Lap Time Live Preview Badge */

    .smart-lap-preview-pill {
      font-family: var(--font-mono);
      font-size: 0.72rem;
      font-weight: 700;
      color: var(--text-dim);
      background: rgba(255, 255, 255, 0.05);
      border: 1px solid var(--border-subtle);
      padding: 0.15rem 0.55rem;
      border-radius: var(--radius-full);
      transition: all var(--transition-fast);
      white-space: nowrap;
    }

    .smart-lap-preview-pill.active {
      color: var(--accent-green);
      background: rgba(0, 230, 118, 0.12);
      border-color: rgba(0, 230, 118, 0.45);
      box-shadow: 0 0 10px rgba(0, 230, 118, 0.2);
    }

    /* Ergonomic Modal Footer Layout (Mobile 2-Row, Desktop 1-Row) */

    .session-modal-footer {
      display: grid;
      grid-template-columns: 1fr 1fr;
      grid-template-areas:
        "save save"
        "lap cancel";
      gap: 0.55rem;
      width: 100%;
    }

    .session-modal-footer .btn-save-session {
      grid-area: save;
      min-height: 48px;
      font-size: 1rem;
      font-weight: 800;
      width: 100%;
      justify-content: center;
      letter-spacing: 0.3px;
    }

    .session-modal-footer .btn-lap-timer {
      grid-area: lap;
      min-height: 42px;
      font-weight: 700;
      justify-content: center;
    }

    .session-modal-footer .btn-cancel-session {
      grid-area: cancel;
      min-height: 42px;
      justify-content: center;
    }

    @media (min-width: 769px) {
      .session-modal-footer {
        display: flex;
        justify-content: flex-end;
        gap: 0.6rem;
      }

      .session-modal-footer .btn-save-session {
        width: auto;
        min-height: auto;
        order: 3;
        padding: 0.55rem 1.4rem;
      }

      .session-modal-footer .btn-lap-timer {
        width: auto;
        min-height: auto;
        order: 2;
      }

      .session-modal-footer .btn-cancel-session {
        width: auto;
        min-height: auto;
        order: 1;
      }

    }

    /* Markdown Reader Modal Body */

    .markdown-rendered-body {
      color: #e2e8f0;
      font-size: 0.95rem;
      line-height: 1.7;
      word-break: break-word;
      overflow-wrap: break-word;
    }

    .markdown-rendered-body h1,

    .markdown-rendered-body h2,

    .markdown-rendered-body h3 {
      font-family: var(--font-display);
      color: #fff;
      margin: 1.25rem 0 0.5rem 0;
      letter-spacing: 0.3px;
    }

    .markdown-rendered-body h2 {
      border-bottom: 1px solid var(--border-subtle);
      padding-bottom: 0.35rem;
      color: var(--accent-cyan);
    }

    .markdown-rendered-body p {
      margin-bottom: 0.75rem;
    }

    .markdown-rendered-body ul, 

    .markdown-rendered-body ol {
      padding-left: 1.4rem;
      margin-bottom: 0.75rem;
    }

    .markdown-rendered-body li {
      margin-bottom: 0.3rem;
    }

    .markdown-rendered-body blockquote {
      border-left: 3px solid var(--accent-cyan);
      background: rgba(0, 240, 255, 0.05);
      padding: 0.6rem 1rem;
      margin: 0.85rem 0;
      border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
      font-style: italic;
    }

        /* --- 9. MOBILE BOTTOM NAVIGATION --- */

    .mobile-bottom-nav {
      display: none;
      position: fixed;
      bottom: 0;
      left: 0;
      right: 0;
      z-index: 100;
      background: rgba(7, 10, 16, 0.94);
      backdrop-filter: blur(24px);
      -webkit-backdrop-filter: blur(24px);
      border-top: 1px solid var(--border-subtle);
      padding: 0.4rem 0.4rem max(0.55rem, env(safe-area-inset-bottom));
      justify-content: space-around;
      align-items: center;
      box-shadow: 0 -6px 24px rgba(0, 0, 0, 0.85);
      touch-action: pan-y;
      user-select: none;
      -webkit-user-select: none;
    }

    .mob-nav-item {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 3px;
      color: #94a3b8;
      background: transparent;
      border: none;
      cursor: pointer;
      font-family: var(--font-display);
      font-size: clamp(0.82rem, 2.6vw, 0.88rem);
      font-weight: 700;
      letter-spacing: 0.01em;
      padding: 0.35rem 0.1rem;
      min-height: 52px;
      border-radius: var(--radius-sm);
      transition: all var(--transition-fast);
      flex: 1;
      position: relative;
      touch-action: manipulation;
      text-decoration: none;
      min-width: 0;
      white-space: nowrap;
      user-select: none;
      -webkit-user-select: none;
      -webkit-touch-callout: none;
    }

    .mob-nav-item:active {
      transform: scale(0.92);
    }

    .mob-nav-item {
      color: #94a3b8;
      outline: none !important;
      -webkit-tap-highlight-color: transparent !important;
    }

    .mob-nav-item:focus {
      outline: none !important;
      color: #94a3b8;
    }

    @media (hover: hover) and (pointer: fine) {
      .mob-nav-item:hover {
        color: var(--accent-cyan);
      }
    }

    .mob-nav-item.active {
      color: var(--accent-cyan) !important;
    }

    .mob-nav-item.active i {
      filter: drop-shadow(0 0 6px rgba(0, 240, 255, 0.6));
    }

    .mob-nav-item.active::after {
      content: '';
      position: absolute;
      top: -3px;
      left: 50%;
      transform: translateX(-50%);
      width: 20px;
      height: 3px;
      background: var(--accent-cyan);
      border-radius: 2px;
      box-shadow: 0 0 10px var(--accent-cyan);
    }

    .mob-nav-item i,
    .mob-nav-item svg {
      width: 24px;
      height: 24px;
      stroke-width: 2.2px;
      pointer-events: none;
      transition: transform var(--transition-fast);
    }

    .mob-nav-item span {
      font-size: inherit;
      font-weight: 700;
      line-height: 1.15;
      letter-spacing: 0.01em;
      pointer-events: none;
      white-space: nowrap;
    }

    .mob-nav-center-action {
      background: linear-gradient(135deg, var(--accent-green, #00e676), #00b348);
      color: #fff !important;
      border-radius: var(--radius-full);
      width: 52px;
      height: 52px;
      margin-top: -22px;
      box-shadow: 0 6px 22px rgba(0, 230, 118, 0.65), 0 0 14px rgba(0, 255, 136, 0.45);
      display: flex;
      flex-shrink: 0;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      border: 3px solid #070a10;
      flex: 0 0 54px;
      transition: transform var(--transition-fast), box-shadow var(--transition-fast);
      touch-action: manipulation;
      cursor: pointer;
      user-select: none;
      -webkit-user-select: none;
      -webkit-touch-callout: none;
      -webkit-tap-highlight-color: transparent !important;
      outline: none !important;
    }

    .mob-nav-center-action:active {
      transform: scale(0.9);
      box-shadow: 0 2px 10px rgba(0, 230, 118, 0.85);
    }

    .mob-nav-center-action.action-hud {
      background: linear-gradient(135deg, #00f0ff, #0088cc);
      box-shadow: 0 6px 22px rgba(0, 240, 255, 0.65), 0 0 14px rgba(0, 240, 255, 0.45);
    }
    .mob-nav-center-action.action-hud:active {
      box-shadow: 0 2px 10px rgba(0, 240, 255, 0.85);
    }
    .mob-nav-center-action.action-hud-pit {
      background: linear-gradient(135deg, #ffd600, #ff9100) !important;
      color: #070a10 !important;
      box-shadow: 0 6px 22px rgba(255, 179, 0, 0.75), 0 0 14px rgba(255, 214, 0, 0.5) !important;
    }
    .mob-nav-center-action.action-hud-pit:hover {
      box-shadow: 0 8px 24px rgba(255, 179, 0, 0.95) !important;
    }
    .mob-nav-center-action.action-hud-pit:active {
      box-shadow: 0 2px 10px rgba(255, 179, 0, 0.95) !important;
    }
    .mob-nav-center-action.action-hud-pit i,
    .mob-nav-center-action.action-hud-pit svg {
      color: #070a10 !important;
      stroke: #070a10 !important;
    }
    .mob-nav-center-action.action-add {
      background: linear-gradient(135deg, var(--accent-green, #00e676), #00b348);
      box-shadow: 0 6px 22px rgba(0, 230, 118, 0.65), 0 0 14px rgba(0, 255, 136, 0.45);
    }
    .mob-nav-center-action.action-add:active {
      box-shadow: 0 2px 10px rgba(0, 230, 118, 0.85);
    }

        /* --- ONBOARDING MICRO-BANNER (No App Install / PWA Reassurance) --- */
    .onboarding-micro-banner {
      width: 100%;
      background: linear-gradient(90deg, rgba(0, 240, 255, 0.12) 0%, rgba(14, 20, 32, 0.98) 45%, rgba(0, 230, 118, 0.08) 100%);
      border-bottom: 1px solid rgba(0, 240, 255, 0.22);
      padding: 0.24rem 1rem;
      margin: 0;
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 0.65rem;
      font-size: 0.78rem;
      color: var(--text-main, #f8fafc);
      z-index: 9999;
      position: relative;
      line-height: 1.25;
    }
    .onboarding-banner-content {
      display: flex;
      align-items: center;
      gap: 0.55rem;
      flex-wrap: wrap;
      line-height: 1.25;
    }
    .onboarding-banner-badge {
      display: inline-flex;
      align-items: center;
      gap: 0.25rem;
      background: rgba(0, 240, 255, 0.15);
      color: var(--accent-cyan, #00f0ff);
      border: 1px solid rgba(0, 240, 255, 0.35);
      border-radius: 4px;
      padding: 0.08rem 0.4rem;
      font-size: 0.68rem;
      font-weight: 700;
      white-space: nowrap;
      letter-spacing: 0.3px;
    }
    .onboarding-banner-text {
      color: #e2e8f0;
      font-size: 0.78rem;
    }
    .onboarding-banner-text strong {
      color: #fff;
    }
    .onboarding-banner-close {
      background: none;
      border: none;
      color: var(--text-muted, #94a3b8);
      cursor: pointer;
      padding: 0.2rem;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      border-radius: 4px;
      transition: color 0.15s ease, background 0.15s ease;
      flex-shrink: 0;
    }
    .onboarding-banner-close:hover {
      color: #fff;
      background: rgba(255, 255, 255, 0.1);
    }
    html[data-theme="light"] .onboarding-micro-banner {
      background: linear-gradient(90deg, #ecfeff 0%, #f0fdf4 100%);
      border-bottom: 1px solid rgba(14, 165, 233, 0.25);
      color: #0f172a;
    }
    html[data-theme="light"] .onboarding-banner-badge {
      background: #e0f2fe;
      color: #0284c7;
      border-color: #bae6fd;
    }
    html[data-theme="light"] .onboarding-banner-text {
      color: #334155;
    }
    html[data-theme="light"] .onboarding-banner-text strong {
      color: #0f172a;
    }
    html[data-theme="light"] .onboarding-banner-close {
      color: #64748b;
    }
    html[data-theme="light"] .onboarding-banner-close:hover {
      color: #0f172a;
      background: rgba(15, 23, 42, 0.08);
    }
    @media (max-width: 640px) {
      .onboarding-micro-banner {
        padding: 0.45rem 0.65rem;
        max-height: none;
        height: auto;
        box-sizing: border-box;
        display: flex;
        align-items: center;
        justify-content: space-between;
      }
      .onboarding-banner-content {
        display: flex;
        align-items: center;
        gap: 0.35rem;
        flex: 1;
        min-width: 0;
        flex-wrap: nowrap;
      }
      .onboarding-banner-badge {
        font-size: 0.62rem;
        padding: 0.05rem 0.28rem;
        flex-shrink: 0;
        line-height: 1.2;
      }
      .onboarding-banner-text {
        font-size: 0.70rem;
        line-height: 1.2;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        text-overflow: ellipsis;
        min-width: 0;
        word-break: break-word;
      }
      .onboarding-banner-close {
        flex-shrink: 0;
        padding: 0.15rem;
        margin-left: 0.25rem;
      }
    }

    .mob-nav-center-action i,
    .mob-nav-center-action svg {
      width: 28px;
      height: 28px;
      stroke-width: 2.4px;
      pointer-events: none;
    }

    /* Toast Notification: Pass-through overlay with multi-line readability */
    .toast-box {
      position: fixed;
      bottom: calc(4.8rem + env(safe-area-inset-bottom));
      left: 50%;
      transform: translateX(-50%) translateY(10px);
      background: rgba(10, 16, 26, 0.88);
      backdrop-filter: blur(8px);
      -webkit-backdrop-filter: blur(8px);
      border: 1px solid rgba(0, 240, 255, 0.25);
      color: rgba(230, 245, 255, 0.96);
      padding: 0.45rem 0.85rem;
      border-radius: 8px;
      font-family: var(--font-display);
      font-size: 0.8rem;
      font-weight: 600;
      letter-spacing: 0.015em;
      text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
      box-shadow: 0 4px 20px rgba(0, 0, 0, 0.65);
      z-index: 10000050;
      opacity: 0;
      cursor: pointer;
      user-select: none;
      -webkit-user-select: none;
      -webkit-tap-highlight-color: transparent;
      pointer-events: none !important;
      transition: opacity 0.28s ease, transform 0.28s ease;
      width: max-content;
      max-width: min(92vw, 560px);
      white-space: pre-line;
      word-break: keep-all;
      overflow-wrap: break-word;
      text-align: center;
      line-height: 1.45;
    }

    .toast-box.show {
      transform: translateX(-50%) translateY(0);
      opacity: 0.98;
      pointer-events: auto !important;
    }

    .toast-box.show:active {
      transform: translateX(-50%) translateY(2px) scale(0.97);
      opacity: 0.85;
    }

    html[data-theme="light"] .toast-box,
    [data-theme="light"] .toast-box {
      background: rgba(15, 23, 42, 0.92) !important;
      color: #f8fafc !important;
      border: 1.5px solid rgba(2, 132, 199, 0.5) !important;
      box-shadow: 0 6px 24px rgba(15, 23, 42, 0.28) !important;
    }

    .auth-forgot-link {
      font-size: 0.74rem;
      color: var(--accent-cyan);
      font-weight: 600;
      text-decoration: none;
      cursor: pointer;
      transition: opacity 0.15s ease;
    }
    .auth-forgot-link:hover {
      text-decoration: underline;
      opacity: 0.85;
    }
    .auth-back-link {
      display: inline-flex;
      align-items: center;
      gap: 0.35rem;
      font-size: 0.78rem;
      color: var(--text-muted);
      text-decoration: none;
      cursor: pointer;
      transition: color 0.15s ease;
    }
    .auth-back-link:hover {
      color: var(--accent-cyan);
    }

    .auth-error-box {
      display: none;
      align-items: center;
      gap: 0.55rem;
      background: rgba(239, 68, 68, 0.15);
      border: 1px solid rgba(239, 68, 68, 0.45);
      border-radius: var(--radius-sm);
      color: #fca5a5;
      font-size: 0.8rem;
      font-weight: 600;
      padding: 0.55rem 0.85rem;
      margin-top: 0.75rem;
      margin-bottom: 0.2rem;
      line-height: 1.4;
      animation: modalFadeIn 0.2s ease-out;
    }

    .auth-error-box i,
    .auth-error-box svg {
      width: 16px;
      height: 16px;
      flex-shrink: 0;
      color: #ef4444;
    }

    /* =========================================================================

       10. ADVANCED MOBILE RESPONSIVE OPTIMIZATION (@media <= 768px)

       ========================================================================= */

    @media (max-width: 860px) {
      /* General layout */
      .app-container {
        padding: 0.75rem 0.65rem;
        padding-bottom: 1.25rem;
        width: 100%;
        max-width: 100%;
        box-sizing: border-box;
      }

      .topbar {
        padding: max(0.55rem, env(safe-area-inset-top)) 0.75rem 0.55rem;
        gap: 0.5rem;
      }

      .nav-tabs-desktop { display: none !important; }

      .mobile-bottom-nav { display: flex !important; }

      .brand-title { font-size: 1.05rem; }

      .brand-subtitle { display: none; }

      /* On mobile, primary "Log Session" action is in the floating bottom nav center + button */

      .topbar-actions .btn-primary { display: none !important; }

      .user-pill {
        display: inline-flex;
        align-items: center;
        gap: 0.4rem;
        padding: 0.2rem 0.55rem 0.2rem 0.25rem;
        background: rgba(255, 255, 255, 0.06);
        border: 1px solid rgba(255, 255, 255, 0.12);
        border-radius: var(--radius-full);
      }

      .user-avatar-badge {
        width: 26px;
        height: 26px;
        font-size: 0.72rem;
      }

      .user-name-text {
        display: inline-block !important;
        max-width: 110px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
        font-size: 0.8rem;
        font-weight: 700;
        color: #f1f5f9;
      }

      /* Form Elements: 16px to prevent iOS Safari auto-zoom while preserving custom sizes */

      input:not(.best-lap-hero-input):not(.stepper-num), select, textarea, .form-input, .form-select, .filter-track-dropdown, .hud-select {
        font-size: 16px !important;
      }

      .best-lap-hero-input {
        font-size: 1.35rem !important;
      }

      .input-stepper-wrap input {
        font-size: 0.92rem !important;
        min-width: 0 !important;
      }

      .modal-header .btn-cyan {
        display: none !important; /* Hide redundant header button on mobile so title has full room */
      }

      .form-row:not(.form-row-datetime) {
        grid-template-columns: 1fr;
        gap: 0.65rem;
      }

      .form-row-datetime {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
        gap: 0.45rem !important;
        justify-content: stretch !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
      }

      .form-row-datetime > .form-group {
        min-width: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
      }

      .form-date-input {
        padding: 0.45rem 0.35rem !important;
        font-size: 13.5px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        min-width: 0 !important;
      }

      .form-time-input {
        padding: 0.45rem 0.35rem !important;
        font-size: 13.5px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        min-width: 0 !important;
      }

      .best-lap-hero-group {
        padding: 0.65rem 0.65rem !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
      }

      .laptimer-metrics-grid {
        display: grid !important;
        grid-template-columns: minmax(0, 1.25fr) minmax(0, 0.85fr) minmax(0, 1fr) !important;
        gap: 0.45rem !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
      }

      .laptimer-metrics-grid > .form-group {
        min-width: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
      }

      .laptimer-metrics-grid .form-label {
        font-size: 0.72rem !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        display: block !important;
        width: 100% !important;
      }

      .smart-lap-preview-pill {
        max-width: 100% !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        display: inline-block !important;
        box-sizing: border-box !important;
      }

      /* NATIVE MOBILE BOTTOM-SHEET MODALS */

      .modal-overlay {
        padding: 0 !important;
        padding-top: max(env(safe-area-inset-top, 0px), 28px) !important;
        align-items: flex-end !important;
        box-sizing: border-box !important;
      }
      .modal-overlay.active {
        padding: 0 !important;
        padding-top: max(env(safe-area-inset-top, 0px), 28px) !important;
        align-items: flex-end !important;
        box-sizing: border-box !important;
      }

      .modal-card {
        max-width: 100% !important;
        width: 100% !important;
        max-height: calc(100dvh - max(env(safe-area-inset-top, 0px), 28px) - 8px) !important;
        max-height: calc(100vh - max(env(safe-area-inset-top, 0px), 28px) - 8px) !important;
        height: auto !important;
        border-radius: var(--radius-xl) var(--radius-xl) 0 0 !important;
        border-bottom: none !important;
        border-left: none !important;
        border-right: none !important;
        animation: sheetSlideUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
        display: flex;
        flex-direction: column;
        overflow: hidden;
      }

      #modal-log-session .modal-card,
      #modal-spectator-preview .modal-card {
        height: calc(100dvh - max(env(safe-area-inset-top, 0px), 28px) - 8px) !important;
        max-height: calc(100dvh - max(env(safe-area-inset-top, 0px), 28px) - 8px) !important;
      }

      #modal-spectator-preview .modal-body {
        flex: 1 1 0% !important;
        height: 100% !important;
        min-height: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
      }

      @keyframes sheetSlideUp {
        from { transform: translateY(100%); }

        to { transform: translateY(0); }

      }

      .modal-drag-indicator {
        display: block !important;
        width: 38px !important;
        height: 4px !important;
        border-radius: 2px !important;
        background: rgba(255, 255, 255, 0.25) !important;
        margin: 10px auto 4px auto !important;
        flex-shrink: 0 !important;
      }

      .modal-header {
        position: sticky !important;
        top: 0 !important;
        z-index: 25 !important;
        background: #0d121c !important;
        padding: 0.75rem 1rem !important;
        min-height: 52px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        flex-shrink: 0 !important;
        box-sizing: border-box !important;
      }

      .modal-close-btn {
        min-width: 36px !important;
        min-height: 36px !important;
        width: 36px !important;
        height: 36px !important;
        padding: 0 !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex-shrink: 0 !important;
      }

      .modal-body {
        padding: 0.95rem 1rem;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
      }

      .modal-footer {
        position: sticky;
        bottom: 0;
        z-index: 20;
        background: #0d121c;
        border-top: 1px solid var(--border-subtle);
        padding: 0.75rem 1rem calc(0.75rem + env(safe-area-inset-bottom));
        box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.75);
      }

      /* Section Header & Stats Banner */

      .section-header {
        margin-bottom: 0.85rem;
        gap: 0.5rem;
      }

      .section-title {
        font-size: 1.2rem;
      }

      .section-subtitle {
        font-size: 0.74rem;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
      }
      /* Enforce 1-line display for section titles, subtitles, card headers and modal banners on mobile */
      .section-title,
      .section-subtitle,
      .rank-card-title,
      .mode-banner-guide-desc {
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
      }

      /* UNIFIED GLOBAL MODAL TITLE SYSTEM (MOBILE RESPONSIVE) */
      .modal-title,
      .modal-header .modal-title,
      .modal-card .modal-title,
      #modal-session-detail .modal-title,
      #modal-lap-analysis-compare .modal-title,
      #modal-circuit-tools-compare .modal-title,
      #modal-session-lap-selector .modal-title,
      #modal-log-session .modal-title,
      #modal-vbo-import .modal-title,
      #modal-vbo-export .modal-title,
      #modal-auth .modal-title,
      #modal-user-profile .modal-title,
      #modal-unit-settings .modal-title,
      #modal-friends-management .modal-title,
      #modal-ble-gps .modal-title,
      #modal-lap-gate-calib .modal-title,
      #modal-pit-gate-calib .modal-title,
      #modal-live-share .modal-title,
      #modal-share-session .modal-title,
      #modal-spectator-preview .modal-title,
      #modal-gps-permission .modal-title {
        font-family: var(--font-display) !important;
        font-size: 1.12rem !important;
        font-weight: 800 !important;
        letter-spacing: 0.15px !important;
        line-height: 1.35 !important;
        display: flex !important;
        align-items: center !important;
        gap: 0.5rem !important;
        min-width: 0 !important;
        flex: 1 1 auto !important;
        overflow: hidden !important;
        white-space: nowrap !important;
        padding: 2px 0 !important;
      }

      .modal-title span,
      .modal-title strong,
      #ct-modal-title,
      #auth-modal-title,
      #vbo-export-modal-title {
        font-size: inherit !important;
        font-weight: inherit !important;
        font-family: inherit !important;
        line-height: inherit !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
      }

      .modal-title i,
      .modal-title svg,
      .modal-title [data-lucide] {
        width: 20px !important;
        height: 20px !important;
        flex-shrink: 0 !important;
      }

      .mobile-stats-banner {
        gap: 0.35rem;
      }

      .stat-banner-card {
        padding: 0.55rem 0.25rem;
        min-width: 0;
      }

      .stat-banner-label {
        font-family: var(--font-sans);
        font-weight: 700;
        font-size: clamp(0.72rem, 2.35vw, 0.72rem);
        letter-spacing: -0.2px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }

      .stat-banner-val {
        font-size: clamp(0.85rem, 3.6vw, 1.15rem);
        white-space: nowrap;
        text-overflow: ellipsis;
        overflow: hidden;
      }

      /* Grid & Tile responsiveness */

      .sessions-grid {
        grid-template-columns: 1fr;
        width: 100%;
      }

      .session-card {
        padding: 0.95rem;
        width: 100%;
        box-sizing: border-box;
      }

      .session-actions-bar {
        display: grid;
        grid-template-columns: 1fr 1fr 38px 48px 38px;
        gap: 0.35rem;
      }

      .session-actions-bar .btn-sm {
        padding: 0.38rem 0.25rem;
        font-size: 0.74rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
      }

      /* =========================================================================

         Timer HUD & Pit Timer Mobile Optimization (<= 768px)

         ========================================================================= */

      .timer-hud-container,

      .pit-hud-container {
        padding: 0.85rem 0.65rem;
        gap: 0.75rem;
        border-radius: var(--radius-md);
      }

      .hud-header-bar {
        display: flex;
        flex-direction: column;
        align-items: stretch;
        gap: 0.45rem;
      }

      .hud-circuit-select-wrapper {
        display: flex;
        align-items: center;
        gap: 0.35rem;
        width: 100%;
        min-width: 0;
      }

      .hud-select {
        flex: 1;
        min-width: 0;
        font-size: 0.82rem;
        font-weight: 700;
        padding: 0.45rem 0.55rem;
        text-overflow: ellipsis;
        white-space: nowrap;
        overflow: hidden;
      }

      .hud-circuit-select-wrapper .btn-sm {
        flex-shrink: 0;
        padding: 0.45rem 0.65rem;
        font-size: 0.76rem;
        white-space: nowrap;
      }

      .hud-status-badge {
        align-self: flex-start;
        font-size: 0.72rem;
        padding: 0.22rem 0.6rem;
        min-height: 26px;
      }

      .hud-auto-start-banner {
        padding: 0.4rem 0.6rem;
        gap: 0.4rem;
        justify-content: center;
        flex-wrap: nowrap !important;
        white-space: nowrap;
        overflow: hidden;
        max-width: 100%;
        box-sizing: border-box;
      }

      .auto-start-indicator {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 0.45rem;
        flex-shrink: 1;
        min-width: 0;
        max-width: 100%;
        overflow: hidden;
      }

      .auto-start-dot,
      .auto-start-dot.pit {
        width: 12px;
        height: 12px;
        flex-shrink: 0;
        background: var(--accent-green, #00e676);
        box-shadow: 0 0 12px var(--accent-green, #00e676), 0 0 4px #fff;
      }

      .auto-start-title {
        font-size: 0.76rem !important;
        font-weight: 800;
        letter-spacing: 0.2px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
      }

      .auto-start-desc {
        font-size: 0.76rem !important;
        font-weight: 800;
        line-height: 1.25;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        flex-shrink: 1;
        text-align: right;
      }

      /* Big Lap Time Gauge on Mobile */

      .hud-laptime-gauge {
        padding: 0.85rem 0.35rem;
      }

      .hud-lap-number-pill {
        font-size: 0.74rem;
        padding: 0.15rem 0.5rem;
        margin-bottom: 0.2rem;
      }

      .hud-big-lap-time {
        font-size: clamp(3.3rem, 16.0vw, 4.8rem);
        letter-spacing: -0.5px;
        font-kerning: none;
        line-height: 1;
        font-feature-settings: "tnum" 1;
        margin: 0.25rem 0;
        width: auto;
        min-width: 9ch;
        max-width: 100%;
        display: inline-block;
      }

      .hud-delta-display {
        font-size: 0.92rem;
        margin-top: 0.25rem;
        justify-content: center;
        text-align: center;
      }

      .hud-delta-sub {
        font-size: 0.92rem;
      }

      .hud-delta-val,
      #lap-delta-val,
      #pit-delta-val {
        font-size: 0.92rem;
      }

      /* Big Pit Countdown Gauge on Mobile */

      .pit-gauge-box {
        padding: 0.85rem 0.35rem;
      }

      #pit-total-time-label {
        font-size: 1.0rem;
        font-weight: 800;
        letter-spacing: 1px;
        color: var(--text-muted);
        margin-bottom: 0.25rem;
      }

      .pit-big-countdown {
        font-size: clamp(3.3rem, 16.0vw, 4.8rem);
        letter-spacing: -0.5px;
        font-kerning: none;
        line-height: 1;
        font-feature-settings: "tnum" 1;
        margin: 0.25rem 0;
        width: auto;
        min-width: 9.5ch;
        max-width: 100%;
        display: inline-block;
      }

      .pit-status-alert {
        font-family: var(--font-display) !important;
        font-size: 0.92rem !important;
        font-weight: 700 !important;
        margin-top: 0.25rem !important;
        letter-spacing: 0.4px !important;
        color: var(--text-muted) !important;
        text-align: center !important;
        width: 100% !important;
        max-width: 100% !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        box-sizing: border-box !important;
        min-height: 1.25rem !important;
        line-height: 1.25rem !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
      }

      /* Stats Grid on Mobile: 3 columns, clean tabular values */

      .hud-stats-grid {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 0.35rem;
      }

      .hud-stat-tile {
        padding: 0.5rem 0.2rem;
        min-width: 0;
      }

      .hud-stat-label {
        font-size: 0.72rem;
        letter-spacing: 0.2px;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }

      .hud-stat-val {
        font-size: clamp(0.85rem, 3.4vw, 1.15rem);
        margin-top: 0.15rem;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
      }

      .hud-stat-val small {
        font-size: 0.72rem;
      }

      /* Diagnostics Strip on Mobile: 2-Tier Clean Readout with ample height for 3 rows */

      .hud-diag-strip {
        display: flex;
        flex-direction: column;
        gap: 0.45rem;
        padding: 0.7rem 0.85rem !important;
        font-size: 0.72rem;
        height: auto !important;
        min-height: auto !important;
        max-height: none !important;
        overflow: visible !important;
      }

      .hud-diag-readings {
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 0.4rem 0.65rem !important;
        font-size: 0.72rem !important;
        line-height: 1.45 !important;
        height: auto !important;
        min-height: auto !important;
        max-height: none !important;
        overflow: visible !important;
      }

      .hud-diag-readings span {
        white-space: nowrap !important;
        overflow: hidden;
        text-overflow: ellipsis;
        line-height: 1.45 !important;
        padding: 0.12rem 0 !important;
      }

      .hud-diag-badges {
        display: flex;
        flex-wrap: wrap;
        gap: 0.35rem;
        padding-top: 0.35rem;
        border-top: 1px solid rgba(255, 255, 255, 0.06);
      }

      .hud-diag-badges .precision-badge,

      .hud-diag-badges .wakelock-badge,

      .hud-diag-badges .ext-gps-badge {
        font-size: 0.72rem;
        padding: 0.2rem 0.45rem;
        white-space: nowrap;
      }

      /* Timer Controls on Mobile (Clean 2x2 Grid) */

      .hud-controls-cluster {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 0.45rem;
      }

      .hud-controls-cluster .btn {
        min-height: 44px;
        font-size: 0.82rem;
        padding: 0.45rem 0.35rem;
        justify-content: center;
        white-space: nowrap;
      }

      /* Pit Controls on Mobile (Symmetrical 50/50 2-button row) */

      .pit-controls-cluster {
        display: grid;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.45rem !important;
        max-width: 100%;
      }
      .pit-controls-cluster > :last-child:nth-child(odd) {
        grid-column: span 2;
      }

      .pit-controls-cluster .btn {
        min-height: 44px;
        font-size: 0.84rem;
        padding: 0.45rem 0.35rem;
        justify-content: center;
        white-space: nowrap;
      }

      /* Pit Gates Sequence Flow on Mobile */

      .pit-gates-flow {
        padding: 0.5rem 0.35rem;
        gap: 0.2rem;
      }

      .pit-gate-node {
        gap: 0.15rem;
      }

      .pit-gate-icon-circle {
        width: 26px;
        height: 26px;
      }

      .pit-gate-node span {
        font-size: 0.72rem;
      }

      .pit-flow-arrow {
        font-size: 0.72rem;
      }

      /* Pit Target Toolbar on Mobile */

      .pit-target-toolbar {
        padding: 0.5rem 0.65rem;
        gap: 0.4rem;
      }

      .pit-target-label {
        font-size: 0.74rem;
      }

      .pit-target-current-pill {
        font-size: 0.72rem;
        padding: 0.12rem 0.45rem;
      }

      .pit-target-chips-row {
        gap: 0.3rem;
        padding: 0.15rem 0;
      }

      .pit-target-chip {
        font-size: 0.74rem;
        padding: 0.28rem 0.6rem;
        min-height: 32px;
      }

      .pit-custom-input-bar {
        gap: 0.35rem;
      }

      .pit-custom-input-bar input {
        font-size: 16px !important;
        width: 52px;
        height: 34px;
      }

      /* Guides on mobile */

      .guides-grid {
        grid-template-columns: 1fr;
        width: 100%;
      }

      /* Footer responsiveness on mobile */

      .site-footer {
        padding: 1.85rem 1rem calc(1.85rem + 70px);
        margin-top: 1.25rem;
      }

      .footer-nav-links {
        gap: 0.65rem 1rem;
        font-size: 0.78rem;
      }

    }

    /* Compact Mobile Screen Optimization (<= 480px) */

    @media (max-width: 480px) {
      .app-container {
        padding: 0.6rem 0.5rem;
        padding-bottom: 1.0rem;
      }

      .session-card {
        padding: 0.8rem 0.65rem;
      }

      .session-best-lap-box,

      .session-perf-banner {
        padding: 0.5rem 0.55rem;
        gap: 0.35rem;
      }

      .session-perf-stat {
        min-width: 0;
        flex: 0 1 auto;
      }

      .session-perf-stat.session-laps-stat {
        flex: 1 1 auto;
        align-items: center;
        text-align: center;
      }

      .session-perf-divider {
        margin: 0 0.1rem;
      }

      .session-perf-label {
        font-size: clamp(0.66rem, 2.3vw, 0.75rem) !important;
        font-weight: 700 !important;
        white-space: nowrap !important;
        letter-spacing: 0.15px !important;
        flex-shrink: 0 !important;
      }

      .best-lap-time,

      .session-perf-val.best-lap-time {
        font-size: clamp(0.98rem, 4.1vw, 1.18rem);
        letter-spacing: 0;
      }

      .session-perf-val.total-laps-val,
      .session-perf-val.top-speed-val {
        font-size: clamp(0.95rem, 3.8vw, 1.12rem);
      }

      .tire-psi-mini-grid {
        gap: 0.35rem;
        padding: 0.45rem;
      }

      .tire-psi-cell {
        padding: 0.25rem 0.4rem;
      }

      .timer-hud-container,

      .pit-hud-container {
        padding: 0.7rem 0.45rem;
        gap: 0.6rem;
      }

      .hud-big-lap-time {
        font-size: clamp(3.3rem, 16.0vw, 4.5rem);
      }

      .pit-big-countdown {
        font-size: clamp(3.3rem, 16.0vw, 4.5rem);
      }

      .hud-stat-val {
        font-size: 0.95rem;
      }

      .hud-controls-cluster .btn,

      .pit-controls-cluster .btn {
        font-size: 0.78rem;
        gap: 0.25rem;
      }

      .hud-controls-cluster .btn i,

      .pit-controls-cluster .btn i {
        width: 14px;
        height: 14px;
      }

      .mobile-car-setup-container {
        padding: 0.6rem 0.45rem;
      }

      .car-axle-row {
        grid-template-columns: 1fr 28px 1fr;
        gap: 0.35rem;
      }

      .car-chassis-badge, .car-exhaust-badge {
        font-size: 0.72rem;
        padding: 0.1rem 0.1rem;
      }

      .wheel-box {
        padding: 0.45rem;
        gap: 0.35rem;
      }

      .wheel-box-top {
        font-size: 0.72rem;
      }

      .wheel-id-badge {
        font-size: 0.72rem;
        min-width: 52px;
        padding: 0.18rem 0.45rem;
        justify-content: center;
      }

      .wheel-delta-pill {
        font-size: 0.72rem;
        padding: 0.06rem 0.24rem;
      }

      .input-stepper-wrap {
        grid-template-columns: 28px 1fr 28px;
      }

      .input-stepper-wrap input {
        font-size: 0.85rem !important;
        padding: 0.35rem 0.05rem;
      }

      .quick-preset-chip {
        font-size: 0.72rem;
        padding: 0.2rem 0.5rem;
      }

      .form-row-datetime {
        display: grid !important;
        grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) !important;
        gap: 0.4rem !important;
        justify-content: stretch !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
      }

      .form-row-datetime > .form-group {
        min-width: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
      }

      .form-date-input {
        padding: 0.4rem 0.3rem !important;
        font-size: 12.5px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        min-width: 0 !important;
      }

      .form-time-input {
        padding: 0.4rem 0.3rem !important;
        font-size: 12.5px !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        min-width: 0 !important;
      }

      .form-row-datetime .form-label {
        font-size: 0.72rem !important;
        white-space: nowrap !important;
      }

      /* Log Track Session Modal Mobile Spacing & Zero-Unwanted-Wrap */
      #modal-log-session .modal-body {
        padding: 0.7rem 0.75rem !important;
        gap: 0.5rem !important;
      }
      #modal-log-session .form-group {
        margin-bottom: 0.5rem !important;
      }
      .wheel-input-item label {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        white-space: nowrap !important;
      }
      .best-lap-hero-group {
        padding: 0.5rem 0.45rem !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
      }
      .laptimer-metrics-grid {
        display: grid !important;
        grid-template-columns: minmax(0, 1.22fr) minmax(0, 0.78fr) minmax(0, 1fr) !important;
        gap: 0.35rem !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
      }
      .laptimer-metrics-grid > .form-group {
        min-width: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
      }
      .laptimer-metrics-grid > .form-group > div {
        min-width: 0 !important;
        max-width: 100% !important;
        overflow: hidden !important;
      }
      .laptimer-metrics-grid .form-label {
        font-size: 0.72rem !important;
        letter-spacing: -0.2px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        display: block !important;
        width: 100% !important;
        box-sizing: border-box !important;
      }
      .best-lap-hero-input {
        font-size: 1.05rem !important;
        height: 38px !important;
        padding: 0.25rem 0.15rem !important;
        letter-spacing: 0px !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        text-align: center !important;
      }
      .total-laps-grouped-input,
      .top-speed-grouped-input {
        font-size: 0.98rem !important;
        height: 38px !important;
        padding: 0.25rem 0.15rem !important;
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        text-align: center !important;
      }
      .smart-lap-preview-pill {
        font-size: 0.72rem !important;
        padding: 0.06rem 0.2rem !important;
        max-width: 100% !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        white-space: nowrap !important;
        display: inline-block !important;
        box-sizing: border-box !important;
      }
      #modal-track-btn-label {
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
      }
      #modal-launch-timer-btn {
        font-size: 0.78rem !important;
        padding: 0.4rem 0.4rem !important;
        white-space: normal !important;
        word-break: keep-all !important;
      }

    }

    /* =========================================================================
       PRIORITY 1: MOBILE LANDSCAPE DUAL-PANEL COCKPIT GRID (Zero-Scroll HUD)
       Harmonized Side-by-Side: [Left: Live Radar Map] + [Right: Digital Timing HUD]
       Bottom: [Full-Width History Log Table]
       ========================================================================= */
    @media (orientation: landscape) and (max-height: 600px) {
      .toast-box {
        bottom: 0.55rem !important;
        font-size: 0.74rem !important;
      }

      .mobile-bottom-nav {
        display: none !important;
      }
      .app-container {
        padding-top: 0.2rem !important;
        padding-bottom: 0.75rem !important;
        max-width: 100% !important;
      }
      .navbar {
        padding: 0.2rem 0.75rem !important;
        min-height: 38px !important;
      }
      .navbar .brand {
        font-size: 0.95rem !important;
      }

      /* -------------------------------------------------------------
         COMMON UNIFIED GRID CONTAINER FOR BOTH LAP & PIT TIMERS
         ------------------------------------------------------------- */
      .timer-hud-container,
      .pit-hud-container {
        display: grid !important;
        grid-template-columns: 42% 58% !important;
        gap: 0.35rem 0.65rem !important;
        padding: 0.25rem 0.5rem 0.75rem 0.5rem !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
      }

      /* Row 1: Header Bar (Circuit search & select) spans full width */
      .timer-hud-container .hud-header-bar,
      .pit-hud-container .hud-header-bar {
        grid-column: 1 / -1 !important;
        padding: 0.3rem 0.65rem !important;
        margin: 0 !important;
      }

      /* Row 2: GPS Auto-Start Banner spans full width */
      .timer-hud-container .hud-auto-start-banner,
      .pit-hud-container .hud-auto-start-banner {
        grid-column: 1 / -1 !important;
        padding: 0.2rem 0.5rem !important;
        margin: 0 !important;
      }

      /* -------------------------------------------------------------
         LEFT COLUMN (42%): REAL-TIME VECTOR CIRCUIT / PIT RADAR MAPS
         ------------------------------------------------------------- */
      #lap-circuit-map-card {
        grid-column: 1 !important;
        grid-row: 3 / 7 !important;
        height: 100% !important;
        min-height: 250px !important;
        margin: 0 !important;
        display: flex !important;
        flex-direction: column !important;
      }
      #pit-circuit-map-card {
        grid-column: 1 !important;
        grid-row: 3 / 9 !important;
        height: 100% !important;
        min-height: 250px !important;
        margin: 0 !important;
        display: flex !important;
        flex-direction: column !important;
      }
      #lap-circuit-map-card .circuit-map-canvas-wrap,
      #pit-circuit-map-card .circuit-map-canvas-wrap {
        height: 100% !important;
        min-height: 230px !important;
        flex: 1 !important;
      }

      /* -------------------------------------------------------------
         RIGHT COLUMN (58%): LAP TIMER DIGITAL COCKPIT HIERARCHY
         ------------------------------------------------------------- */
      /* Row 3: Big Lap Time Gauge */
      .hud-laptime-gauge {
        grid-column: 2 !important;
        grid-row: 3 !important;
        padding: 0.35rem 0.55rem !important;
        margin: 0 !important;
      }
      .hud-big-lap-time {
        font-size: clamp(2.3rem, 12vh, 3.8rem) !important;
        margin: 0 !important;
        line-height: 1.05 !important;
      }
      .predictive-delta-container {
        margin-top: 0.25rem !important;
        padding: 0.2rem 0.4rem !important;
      }
      .pred-scale-toolbar {
        margin-bottom: 0.15rem !important;
      }

      /* Row 4: Lap Stats Grid (SPEED, BEST, LAST) */
      .hud-stats-grid {
        grid-column: 2 !important;
        grid-row: 4 !important;
        gap: 0.3rem !important;
        margin: 0 !important;
      }
      .hud-stat-tile {
        padding: 0.25rem 0.2rem !important;
      }
      .hud-stat-val {
        font-size: 1.05rem !important;
      }

      /* Row 5: Lap Controls Cluster (6 Buttons in 2 Rows) */
      .hud-controls-cluster {
        grid-column: 2 !important;
        grid-row: 5 !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 0.3rem !important;
        margin: 0 !important;
      }
      .hud-controls-cluster .btn {
        min-height: 38px !important;
        padding: 0.25rem 0.2rem !important;
        font-size: 0.72rem !important;
      }
          #btn-lap-save-session {
      display: none !important;
    }

    #btn-lap-save-session:disabled,
          #btn-lap-export-vbo:disabled,
          #btn-pit-export-vbo:disabled {
      opacity: 0.42 !important;
      cursor: not-allowed !important;
      filter: grayscale(35%) !important;
      box-shadow: none !important;
      transform: none !important;
    }

    #btn-lap-export-vbo:disabled:hover,
    #btn-pit-export-vbo:disabled:hover {
      box-shadow: none !important;
      transform: none !important;
      background: rgba(0, 240, 255, 0.05) !important;
      color: var(--accent-cyan) !important;
    }
.hud-btn-save,
      .hud-btn-vbo {
        grid-column: span 1 !important;
      }

      /* Row 6: Lap Diagnostics Strip */
      .timer-hud-container .hud-diag-strip {
        grid-column: 2 !important;
        grid-row: 6 !important;
        padding: 0.25rem 0.5rem !important;
        margin: 0 !important;
      }
      .timer-hud-container .hud-diag-readings {
        gap: 0.15rem 0.4rem !important;
        font-size: 0.72rem !important;
        flex-wrap: nowrap !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        height: 1.35rem !important;
        min-height: 1.35rem !important;
        max-height: 1.35rem !important;
        line-height: 1.35rem !important;
      }

      /* -------------------------------------------------------------
         RIGHT COLUMN (58%): PIT TIMER HARMONIZED DIGITAL HIERARCHY
         (Mirrors Lap Timer: Gauge -> Flow/Target -> Stats -> Controls -> Diag)
         ------------------------------------------------------------- */
      /* Row 3: Big Countdown Gauge (Matches .hud-laptime-gauge at Row 3) */
      #pit-gauge-box {
        grid-column: 2 !important;
        grid-row: 3 !important;
        padding: 0.35rem 0.55rem !important;
        margin: 0 !important;
      }
      .pit-big-countdown {
        font-size: clamp(2.3rem, 12vh, 3.8rem) !important;
        margin: 0 !important;
        line-height: 1.05 !important;
      }
      .pit-status-alert {
        font-size: 0.78rem !important;
        margin-top: 0.15rem !important;
        letter-spacing: 0.2px !important;
        text-align: center !important;
        width: 100% !important;
        max-width: 100% !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        box-sizing: border-box !important;
        min-height: 1.2rem !important;
        line-height: 1.2rem !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
      }

      /* Row 4: Pit Gates Flow Nodes (Compact 1.ENTRY -> 2.BOX -> 3.EXIT) */
      .pit-gates-flow {
        grid-column: 2 !important;
        grid-row: 4 !important;
        padding: 0.15rem 0.35rem !important;
        margin: 0 !important;
        gap: 0.35rem !important;
      }
      .pit-gate-node {
        padding: 0.2rem 0.35rem !important;
        font-size: 0.72rem !important;
      }
      .pit-node-sub {
        font-size: 0.72rem !important;
      }

      /* Row 5: Pit Target Countdown Duration Toolbar */
      .pit-target-toolbar {
        grid-column: 2 !important;
        grid-row: 5 !important;
        padding: 0.2rem 0.4rem !important;
        margin: 0 !important;
      }
      .pit-target-toolbar-header {
        margin-bottom: 0.12rem !important;
      }
      .pit-target-chips-row {
        gap: 0.25rem !important;
      }
      .pit-target-chip {
        padding: 0.15rem 0.35rem !important;
        font-size: 0.72rem !important;
      }

      /* Row 6: Pit Telemetry Stats Grid (Speed, Limit, Stationary, Total) */
      .pit-stats-grid {
        grid-column: 2 !important;
        grid-row: 6 !important;
        gap: 0.3rem !important;
        margin: 0 !important;
      }
      .pit-stats-grid .hud-stat-tile {
        padding: 0.25rem 0.2rem !important;
      }
      .pit-stats-grid .hud-stat-val {
        font-size: 1.05rem !important;
      }

      /* Row 7: Pit Controls Cluster (Matches .hud-controls-cluster) */
      .pit-controls-cluster {
        grid-column: 2 !important;
        grid-row: 7 !important;
        position: static !important;
        bottom: auto !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 0.3rem !important;
        margin: 0 !important;
        padding: 0 !important;
        background: transparent !important;
        box-shadow: none !important;
        border: none !important;
      }
      .pit-controls-cluster .btn {
        min-height: 38px !important;
        padding: 0.25rem 0.15rem !important;
        font-size: 0.72rem !important;
      }

      /* Row 8: Pit Diagnostics Strip */
      .pit-hud-container .hud-diag-strip {
        grid-column: 2 !important;
        grid-row: 8 !important;
        padding: 0.25rem 0.5rem !important;
        margin: 0 !important;
      }
      .pit-hud-container .hud-diag-readings {
        gap: 0.15rem 0.4rem !important;
        font-size: 0.72rem !important;
        flex-wrap: nowrap !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        height: 1.35rem !important;
        min-height: 1.35rem !important;
        max-height: 1.35rem !important;
        line-height: 1.35rem !important;
      }

      /* -------------------------------------------------------------
         BOTTOM AREA: HISTORY LOG TABLES (Always full-width below cockpit)
         ------------------------------------------------------------- */
      #lap-history-card {
        grid-column: 1 / -1 !important;
        grid-row: 7 !important;
        margin-top: 0.75rem !important;
        margin-bottom: 1.5rem !important;
        width: 100% !important;
        clear: both !important;
      }

      #pit-history-card {
        grid-column: 1 / -1 !important;
        grid-row: 9 !important;
        margin-top: 0.75rem !important;
        margin-bottom: 1.5rem !important;
        width: 100% !important;
        clear: both !important;
        display: flex !important;
        flex-direction: column !important;
      }
    }

        /* --- SIMPLE & CLEAN MOTORSPORT FOOTER --- */

    .site-footer {
      border-top: 1px solid var(--border-subtle);
      background: rgba(7, 10, 16, 0.95);
      padding: 2.25rem 1.5rem calc(2.25rem + 75px); /* Extra padding for mobile bottom nav */
      margin-top: 1.5rem;
      text-align: center;
      font-size: 0.82rem;
      color: var(--text-muted);
    }

    .footer-container {
      max-width: 1100px;
      margin: 0 auto;
      display: flex;
      flex-direction: column;
      align-items: center;
      gap: 1.15rem;
    }

    .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));
    }
    .footer-brand {
      display: inline-flex;
      align-items: center;
      gap: 0.5rem;
      color: #fff;
      font-family: var(--font-display);
      font-size: 1.15rem;
      font-weight: 700;
      letter-spacing: 0.5px;
      text-decoration: none;
    }

    .footer-brand-badge {
      width: 26px;
      height: 26px;
      border-radius: 6px;
      background: linear-gradient(135deg, var(--accent-red), #d61f3d);
      color: #fff;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      font-size: 0.8rem;
      font-weight: 900;
    }

    .footer-tagline {
      font-size: 0.82rem;
      color: var(--text-dim);
      margin-top: -0.45rem;
    }

    .footer-nav-links {
      display: flex;
      justify-content: center;
      align-items: center;
      flex-wrap: wrap;
      gap: 1.25rem;
    }

    .footer-nav-links a {
      color: var(--text-muted);
      text-decoration: none;
      font-size: 0.82rem;
      font-weight: 500;
      transition: color var(--transition-fast);
      display: inline-flex;
      align-items: center;
      gap: 0.35rem;
    }

    .footer-nav-links a:hover {
      color: var(--accent-cyan);
    }

    .footer-nav-links .footer-link-active {
      color: var(--accent-cyan);
      font-weight: 700;
    }

    .footer-nav-links .footer-link-highlight {
      color: var(--text-muted);
    }

    .footer-nav-links .footer-link-highlight:hover {
      color: var(--accent-cyan);
    }

    .footer-copyright {
      font-size: 0.78rem;
      color: var(--text-dim);
      font-family: var(--font-mono);
      margin-top: 0.25rem;
    }

    .footer-bottom-bar {
      width: 100%;
      display: grid;
      grid-template-columns: 1fr auto 1fr;
      align-items: center;
      margin-top: 0.85rem;
      padding-top: 1.15rem;
      border-top: 1px solid rgba(255, 255, 255, 0.08);
    }

    html[data-theme="light"] .footer-bottom-bar {
      border-top: 1px solid rgba(15, 23, 42, 0.1);
    }

    .footer-bottom-spacer {
      /* balances right social links to keep copyright centered */
    }

    .footer-bottom-bar .footer-copyright {
      margin-top: 0;
    }

    .footer-social-links {
      display: inline-flex;
      align-items: center;
      justify-content: flex-end;
      gap: 0.75rem;
    }

    .footer-social-btn {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      text-decoration: none;
      transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), filter 0.2s ease, opacity 0.2s ease;
      line-height: 0;
      opacity: 0.92;
      border: none !important;
      background: none !important;
      padding: 0;
    }

    .footer-social-btn:hover {
      transform: translateY(-2px) scale(1.08);
      opacity: 1;
    }

    .footer-social-btn.footer-social-yt:hover {
      filter: drop-shadow(0 4px 12px rgba(255, 0, 0, 0.5));
    }

    .footer-social-btn.footer-social-ig:hover {
      filter: drop-shadow(0 4px 12px rgba(225, 48, 108, 0.55));
    }

    .footer-social-btn svg {
      width: 28px;
      height: 28px;
      display: block;
    }

    @media (max-width: 768px) {
      .footer-bottom-bar {
        display: flex;
        flex-direction: column-reverse;
        align-items: center;
        gap: 0.85rem;
        padding-top: 1rem;
      }
      .footer-bottom-spacer {
        display: none;
      }
      .footer-social-links {
        justify-content: center;
      }
      .footer-copyright {
        text-align: center;
        font-size: 0.74rem;
      }
    }

        /* --- 7. REAL-TIME CIRCUIT MAP & GPS RADAR COMPONENT (LAP & PIT TIMERS) --- */

    .hud-circuit-map-card {
      background: radial-gradient(circle at 50% 20%, rgba(15, 23, 42, 0.92), rgba(6, 10, 18, 0.98));
      border: 1px solid rgba(0, 240, 255, 0.3);
      border-radius: var(--radius-md);
      padding: 0.45rem;
      position: relative;
      scroll-margin-top: 54px;
      box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06), 0 8px 28px rgba(0, 0, 0, 0.5);
      transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .hud-circuit-map-card.pit {
      border-color: rgba(255, 179, 0, 0.35);
    }

    .circuit-map-toolbar {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 0.5rem;
      padding-bottom: 0.45rem;
      border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }

    .circuit-map-title {
      font-size: 0.76rem;
      font-weight: 700;
      color: var(--accent-cyan);
      letter-spacing: 0.08em;
      text-transform: uppercase;
      display: flex;
      align-items: center;
      gap: 0.4rem;
    }

    .circuit-map-card.pit .circuit-map-title {
      color: var(--accent-yellow);
    }

    .circuit-map-badges {
      display: flex;
      align-items: center;
      gap: 0.4rem;
    }

    .circuit-map-badge {
      font-size: 0.72rem;
      font-weight: 700;
      padding: 2px 7px;
      border-radius: 9999px;
      background: rgba(255, 255, 255, 0.06);
      color: var(--text-dim);
      font-family: 'JetBrains Mono', monospace;
      letter-spacing: 0.04em;
    }

    .circuit-map-badge.live {
      background: rgba(0, 255, 136, 0.15);
      color: var(--accent-green);
      border: 1px solid rgba(0, 255, 136, 0.3);
    }

    .circuit-map-badge.sim {
      background: rgba(0, 240, 255, 0.15);
      color: var(--accent-cyan);
      border: 1px solid rgba(0, 240, 255, 0.3);
    }

    .circuit-map-canvas-wrap {
      position: relative;
      width: 100%;
      height: 220px;
      background: #060a12;
      border-radius: var(--radius-sm);
      overflow: hidden;
      border: 1px solid rgba(255, 255, 255, 0.05);
      display: flex;
      align-items: center;
      justify-content: center;
    }

    .circuit-map-canvas-wrap canvas {
      width: 100%;
      height: 100%;
      display: block;
    }

    .circuit-map-telemetry {
      position: absolute;
      bottom: 8px;
      left: 10px;
      font-family: 'JetBrains Mono', monospace;
      font-size: 0.72rem;
      color: var(--text-dim);
      background: rgba(6, 10, 18, 0.75);
      backdrop-filter: blur(4px);
      padding: 2px 6px;
      border-radius: 4px;
      border: 1px solid rgba(255, 255, 255, 0.08);
      pointer-events: none;
      z-index: 2;
    }

    .circuit-map-speed-hud {
      position: absolute;
      top: 8px;
      right: 10px;
      font-family: 'JetBrains Mono', monospace;
      font-size: 0.8rem;
      font-weight: 800;
      color: var(--text-main);
      background: rgba(6, 10, 18, 0.75);
      backdrop-filter: blur(4px);
      padding: 2px 8px;
      border-radius: 4px;
      border: 1px solid rgba(255, 255, 255, 0.08);
      pointer-events: none;
      z-index: 2;
    }

        /* --- 11. SEO & MOTORSPORT PLATFORM DIRECTORY STYLES --- */

    .seo-platform-info {
      margin-top: 3.5rem;
      padding: 2.25rem 1.5rem;
      background: rgba(14, 20, 32, 0.65);
      border: 1px solid var(--border-subtle);
      border-radius: var(--radius-lg);
      backdrop-filter: blur(16px);
      -webkit-backdrop-filter: blur(16px);
    }

    .seo-info-header {
      text-align: center;
      margin-bottom: 2rem;
    }

    .seo-info-badge {
      display: inline-flex;
      align-items: center;
      gap: 0.35rem;
      font-family: var(--font-display);
      font-size: 0.75rem;
      font-weight: 800;
      color: var(--accent-cyan);
      background: rgba(0, 240, 255, 0.1);
      border: 1px solid rgba(0, 240, 255, 0.25);
      padding: 0.25rem 0.75rem;
      border-radius: var(--radius-full);
      margin-bottom: 0.75rem;
      letter-spacing: 0.5px;
    }

    .seo-info-title {
      font-family: var(--font-display);
      font-size: 1.45rem;
      font-weight: 800;
      color: #fff;
      letter-spacing: 0.5px;
      margin-bottom: 0.65rem;
      line-height: 1.35;
    }

    .seo-info-desc {
      font-size: 0.92rem;
      color: var(--text-muted);
      max-width: 840px;
      margin: 0 auto;
      line-height: 1.65;
    }

    .seo-features-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
      gap: 1.15rem;
      margin-bottom: 2.25rem;
    }

    .seo-feature-card {
      background: rgba(18, 24, 38, 0.75);
      border: 1px solid var(--border-subtle);
      border-radius: var(--radius-md);
      padding: 1.25rem 1.15rem;
      transition: all var(--transition-normal);
    }

    .seo-feature-card:hover {
      border-color: rgba(0, 240, 255, 0.4);
      transform: translateY(-2px);
      box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
    }

    .seo-feature-icon {
      font-size: 1.65rem;
      margin-bottom: 0.5rem;
      display: inline-block;
    }

    .seo-feature-card h3 {
      font-family: var(--font-display);
      font-size: 1.05rem;
      font-weight: 700;
      color: #fff;
      margin-bottom: 0.45rem;
      display: flex;
      align-items: center;
      gap: 0.4rem;
    }

    .seo-feature-card p {
      font-size: 0.85rem;
      color: var(--text-muted);
      line-height: 1.55;
    }

    .seo-circuits-section {
      margin-bottom: 2.25rem;
      padding-top: 1.85rem;
      border-top: 1px solid var(--border-subtle);
    }

    .seo-circuits-section h3 {
      font-family: var(--font-display);
      font-size: 1.2rem;
      font-weight: 800;
      color: var(--accent-cyan);
      margin-bottom: 0.4rem;
      text-align: center;
    }

    .seo-circuits-sub {
      text-align: center;
      font-size: 0.85rem;
      color: var(--text-muted);
      margin-bottom: 1.25rem;
    }

    .seo-circuits-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
      gap: 1rem;
    }

    .seo-circuit-region {
      background: rgba(255, 255, 255, 0.02);
      border: 1px solid var(--border-subtle);
      border-radius: var(--radius-md);
      padding: 1rem 1.15rem;
    }

    .seo-circuit-region-title {
      font-family: var(--font-display);
      font-size: 0.88rem;
      font-weight: 800;
      color: var(--accent-amber);
      margin-bottom: 0.65rem;
      display: flex;
      align-items: center;
      gap: 0.35rem;
    }

    .seo-circuit-list {
      list-style: none;
      padding: 0;
      margin: 0;
      font-size: 0.82rem;
      color: var(--text-muted);
      line-height: 1.7;
    }

    .seo-circuit-list li {
      display: flex;
      align-items: center;
      gap: 0.4rem;
    }

    .seo-circuit-list li::before {
      content: '•';
      color: var(--accent-cyan);
      font-weight: bold;
    }

    .seo-faq-section {
      padding-top: 1.85rem;
      border-top: 1px solid var(--border-subtle);
    }

    .seo-faq-section h3 {
      font-family: var(--font-display);
      font-size: 1.2rem;
      font-weight: 800;
      color: #fff;
      margin-bottom: 0.35rem;
      text-align: center;
    }

    .seo-faq-sub {
      text-align: center;
      font-size: 0.85rem;
      color: var(--text-muted);
      margin-bottom: 1.25rem;
    }

    .seo-faq-item {
      background: rgba(18, 24, 38, 0.65);
      border: 1px solid var(--border-subtle);
      border-radius: var(--radius-md);
      margin-bottom: 0.65rem;
      overflow: hidden;
      transition: border-color var(--transition-fast);
    }

    .seo-faq-item:hover {
      border-color: rgba(255, 255, 255, 0.18);
    }

    .seo-faq-summary {
      padding: 0.85rem 1.25rem;
      font-family: var(--font-display);
      font-size: 0.94rem;
      font-weight: 700;
      color: #f1f5f9;
      cursor: pointer;
      user-select: none;
      list-style: none;
      display: flex;
      justify-content: space-between;
      align-items: center;
    }

    .seo-faq-summary::-webkit-details-marker { display: none; }

    .seo-faq-summary::after {
      content: '+';
      font-family: var(--font-mono);
      font-size: 1.2rem;
      color: var(--accent-cyan);
      font-weight: 700;
      margin-left: 0.75rem;
      flex-shrink: 0;
    }

    details[open] .seo-faq-summary::after {
      content: '−';
      color: var(--accent-red);
    }

    .seo-faq-answer {
      padding: 0.25rem 1.25rem 1.15rem;
      font-size: 0.88rem;
      color: var(--text-muted);
      line-height: 1.65;
      border-top: 1px solid rgba(255, 255, 255, 0.04);
    }

    .seo-faq-answer strong {
      color: #fff;
    }

    .seo-faq-formula {
      display: block;
      background: rgba(0, 0, 0, 0.45);
      border-left: 2px solid var(--accent-cyan);
      padding: 0.45rem 0.75rem;
      margin: 0.65rem 0;
      font-family: var(--font-mono);
      font-size: 0.82rem;
      color: #e2e8f0;
      border-radius: 0 4px 4px 0;
      overflow-x: auto;
    }

    .tech-tag {
      display: inline-block;
      font-family: var(--font-mono);
      font-size: 0.72rem;
      font-weight: 700;
      color: var(--accent-cyan);
      background: rgba(0, 240, 255, 0.08);
      border: 1px solid rgba(0, 240, 255, 0.2);
      border-radius: 4px;
      padding: 0.15rem 0.45rem;
      letter-spacing: 0.2px;
    }

    .tech-badges-cluster {
      margin-top: 0.75rem;
      display: flex;
      flex-wrap: wrap;
      gap: 0.35rem;
    }

        /* --- MOBILE PIT CONTROLS: HARMONIZED WITH LAP TIMER (CLEAN 2-COLUMN GRID) --- */
    @media (max-width: 768px) and (orientation: portrait) {
      .pit-hud-container {
        padding-bottom: 1rem !important;
      }
      .pit-controls-cluster {
        position: static !important;
        bottom: auto !important;
        z-index: auto !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        padding: 0 !important;
        margin: 0.65rem 0 !important;
        display: grid !important;
        grid-template-columns: 1fr 1fr !important;
        gap: 0.45rem !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
      }
      .pit-controls-cluster > :last-child:nth-child(odd) {
        grid-column: span 2 !important;
      }
      .pit-controls-cluster .btn {
        min-height: 44px !important;
        font-size: 0.82rem !important;
        font-weight: 600 !important;
        padding: 0.45rem 0.35rem !important;
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: center !important;
        gap: 0.35rem !important;
        border-radius: var(--radius-md) !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
      }
      .pit-controls-cluster .btn i {
        width: 16px !important;
        height: 16px !important;
        flex-shrink: 0 !important;
      }
      .pit-controls-cluster .btn span {
        font-size: 0.82rem !important;
        letter-spacing: normal !important;
        line-height: normal !important;
        font-weight: 600 !important;
      }
      #btn-pit-gate-calib {
        border-color: rgba(255, 179, 0, 0.45) !important;
        color: var(--accent-amber) !important;
      }
      #btn-lap-gate-calib {
        border-color: rgba(0, 240, 255, 0.45) !important;
        color: var(--accent-cyan) !important;
      }
    }

    /* Hide top featured guide banner on mobile screens (keep full focus on session logs) */
    @media (max-width: 768px) {
      #session-guide-card-slot,
      .session-guide-banner-card {
        display: none !important;
        margin: 0 !important;
        padding: 0 !important;
        height: 0 !important;
        overflow: hidden !important;
      }
    }

    .hud-track-search-input[readonly],
    .hud-track-search-input:disabled {
      background: rgba(3, 7, 18, 0.85) !important;
      color: #fff !important;
      opacity: 1 !important;
      -webkit-text-fill-color: #fff !important;
      cursor: text !important;
    }
    .hud-track-search-box {
      cursor: text;
    }

    /* High-Impact Cockpit Team Radio Flag Alert Banner */
    .hud-cockpit-radio-banner {
      width: 100%;
      max-width: 480px;
      margin: 0 auto 0.75rem;
      border-radius: 12px;
      padding: 0.85rem 1rem;
      border: 2px solid #ff1744;
      background: linear-gradient(135deg, rgba(255,23,68,0.25) 0%, rgba(7,10,16,0.95) 100%);
      box-shadow: 0 0 35px rgba(255,23,68,0.6), inset 0 0 20px rgba(255,23,68,0.3);
      cursor: pointer;
      text-align: center;
      position: relative;
      animation: alert-pulse 1.2s infinite ease-in-out;
      z-index: 10;
    }

    @keyframes alert-pulse {
      0% { transform: scale(0.99); opacity: 0.95; }
      50% { transform: scale(1.02); opacity: 1; }
      100% { transform: scale(0.99); opacity: 0.95; }
    }

    .radio-banner-badge {
      font-family: var(--font-display);
      font-weight: 800;
      font-size: 1.15rem;
      letter-spacing: 0.06em;
      text-transform: uppercase;
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 0.5rem;
      margin-bottom: 0.35rem;
      color: #ffffff;
    }

    .radio-banner-msg {
      font-family: var(--font-display);
      font-size: clamp(1.45rem, 5vw, 1.95rem);
      font-weight: 900;
      letter-spacing: 0.02em;
      color: #ffffff;
      text-shadow: 0 3px 15px rgba(0,0,0,0.95);
      line-height: 1.2;
      text-transform: uppercase;
    }

    .radio-banner-dismiss {
      font-size: 0.72rem;
      color: rgba(255, 255, 255, 0.8) !important;
      font-family: var(--font-mono);
      margin-top: 0.35rem;
      opacity: 0.9;
      letter-spacing: 0.05em;
    }

        /* --- 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-light: #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 */
    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;
      box-shadow: none !important;
    }
    html[data-theme="light"] .footer-brand-logo {
      content: url('/v1/logo-light.png?v=7') !important;
      height: 26px !important;
      width: auto !important;
      max-width: 90px !important;
      object-fit: contain !important;
      vertical-align: middle !important;
      filter: drop-shadow(0 1px 2px rgba(15, 23, 42, 0.08)) !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"] .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;
    }
    
        /* --- CIRCUIT SEARCH DROPDOWN LIGHT MODE (Seamless Top Header & Inputs) --- */
    html[data-theme="light"] .session-circuit-dropdown-panel {
      background: #ffffff !important;
      border: 1px solid rgba(15, 23, 42, 0.14) !important;
      box-shadow: 0 16px 40px rgba(15, 23, 42, 0.16) !important;
    }
    html[data-theme="light"] .dropdown-search-header {
      background: #ffffff !important;
      border-bottom: 1px solid rgba(15, 23, 42, 0.08) !important;
    }
    html[data-theme="light"] .dropdown-search-input-box {
      background: #f8fafc !important;
      border: 1px solid rgba(15, 23, 42, 0.16) !important;
    }
    html[data-theme="light"] .dropdown-search-input-box:focus-within {
      background: #ffffff !important;
      border-color: #0284c7 !important;
      box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15) !important;
    }
    html[data-theme="light"] .dropdown-search-input {
      background: transparent !important;
      color: #0f172a !important;
    }
    html[data-theme="light"] .dropdown-search-input::placeholder {
      color: #64748b !important;
    }
    html[data-theme="light"] .dropdown-close-btn {
      background: #f1f5f9 !important;
      border: 1px solid rgba(15, 23, 42, 0.12) !important;
      color: #475569 !important;
    }
    html[data-theme="light"] .dropdown-close-btn:hover {
      background: #fee2e2 !important;
      border-color: #ef4444 !important;
      color: #ef4444 !important;
    }

    /* Guide & Article Light Mode Overrides */
    html[data-theme="light"] .article-header {
      background: transparent !important;
      border: none !important;
      border-bottom: 1px solid rgba(15, 23, 42, 0.09) !important;
      box-shadow: none !important;
      border-radius: 0 !important;
      padding: 0 0 1.5rem 0 !important;
      margin-bottom: 2rem !important;
    }
    html[data-theme="light"] .article-title {
      color: #0f172a !important;
    }
    html[data-theme="light"] .badge-cyan {
      background: #e0f2fe !important;
      color: #0369a1 !important;
      border: 1px solid rgba(2, 132, 199, 0.28) !important;
      font-weight: 700 !important;
    }
    html[data-theme="light"] .article-body code,
    html[data-theme="light"] code {
      background: #e0f2fe !important;
      color: #0369a1 !important;
      border: 1px solid rgba(2, 132, 199, 0.28) !important;
      font-weight: 700 !important;
      padding: 0.15rem 0.45rem !important;
      border-radius: 4px !important;
    }
    html[data-theme="light"] .guide-callout {
      background: #f8fafc !important;
      border: 1px solid rgba(15, 23, 42, 0.1) !important;
      border-left: 4px solid #0284c7 !important;
      color: #1e293b !important;
      box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04) !important;
    }
    html[data-theme="light"] .guide-callout p,
    html[data-theme="light"] .guide-callout span,
    html[data-theme="light"] .guide-callout strong,
    html[data-theme="light"] .guide-callout em,
    html[data-theme="light"] .guide-callout blockquote {
      color: inherit !important;
    }
    html[data-theme="light"] .guide-callout.callout-warning {
      background: #fffbeb !important;
      border: 1px solid rgba(217, 119, 6, 0.25) !important;
      border-left: 4px solid #d97706 !important;
      color: #92400e !important;
    }
    html[data-theme="light"] .guide-callout.callout-tip {
      background: #f0fdf4 !important;
      border: 1px solid rgba(5, 150, 105, 0.25) !important;
      border-left: 4px solid #059669 !important;
      color: #166534 !important;
    }

    /* Auth Modal Tabs & Controls in Light Mode */
    html[data-theme="light"] .auth-toggle-tabs {
      background: #f1f5f9 !important;
      border: 1px solid rgba(15, 23, 42, 0.1) !important;
    }
    html[data-theme="light"] .auth-tab-btn {
      color: #64748b !important;
      background: transparent !important;
    }
    html[data-theme="light"] .auth-tab-btn:hover {
      color: #0f172a !important;
    }
    html[data-theme="light"] .auth-tab-btn.active {
      background: #0284c7 !important;
      color: #ffffff !important;
      box-shadow: 0 2px 8px rgba(2, 132, 199, 0.25) !important;
    }
    html[data-theme="light"] .auth-forgot-link {
      color: #0284c7 !important;
    }
    html[data-theme="light"] .auth-back-link {
      color: #64748b !important;
    }
    html[data-theme="light"] .auth-back-link:hover {
      color: #0284c7 !important;
    }
    html[data-theme="light"] #auth-reset-notice {
      background: #f0f9ff !important;
      border: 1px solid rgba(2, 132, 199, 0.35) !important;
      color: #0369a1 !important;
    }
    html[data-theme="light"] .auth-error-box {
      background: #fef2f2 !important;
      border: 1px solid rgba(239, 68, 68, 0.45) !important;
      color: #b91c1c !important;
    }
    html[data-theme="light"] .auth-error-box i,
    html[data-theme="light"] .auth-error-box svg {
      color: #dc2626 !important;
    }
    html[data-theme="light"] #modal-auth .form-input,
    html[data-theme="light"] #modal-auth input {
      background: #ffffff !important;
      border: 1px solid rgba(15, 23, 42, 0.18) !important;
      color: #0f172a !important;
    }
    html[data-theme="light"] #modal-auth .form-input::placeholder,
    html[data-theme="light"] #modal-auth input::placeholder {
      color: #94a3b8 !important;
    }
    html[data-theme="light"] #modal-auth .form-label {
      color: #334155 !important;
      font-weight: 700 !important;
    }
    html[data-theme="light"] #modal-auth .auth-divider span {
      background: #ffffff !important;
      color: #64748b !important;
    }
    html[data-theme="light"] #modal-auth .auth-divider::before {
      border-color: rgba(15, 23, 42, 0.1) !important;
    }

    /* Modal Backdrop & Overlays in Light Mode */
    html[data-theme="light"] .modal-overlay {
      background: rgba(15, 23, 42, 0.42) !important;
      backdrop-filter: blur(8px) !important;
      -webkit-backdrop-filter: blur(8px) !important;
    }
    html[data-theme="light"] .modal-card {
      background: #ffffff !important;
      border: 1px solid 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;
      color: #0f172a !important;
    }
    html[data-theme="light"] .modal-title {
      color: #0f172a !important;
    }
    html[data-theme="light"] .modal-close-btn {
      color: #64748b !important;
      background: #f1f5f9 !important;
      border-radius: 8px !important;
    }
    html[data-theme="light"] .modal-close-btn:hover {
      background: #e2e8f0 !important;
      color: #0f172a !important;
    }

    /* Modal 1: Live Spectator Broadcast (#modal-live-share) */
    html[data-theme="light"] #modal-live-share .modal-body > div[style*="rgba(255,23,68"],
    html[data-theme="light"] #modal-live-share div[style*="rgba(255,23,68"] {
      background: #fff1f2 !important;
      border: 1px solid rgba(225, 29, 72, 0.25) !important;
    }
    html[data-theme="light"] #modal-live-status-title {
      color: #e11d48 !important;
      font-weight: 800 !important;
    }
    html[data-theme="light"] #modal-live-viewers-count {
      color: #64748b !important;
    }
    html[data-theme="light"] #modal-live-share div[style*="#070a10"],
    html[data-theme="light"] #modal-live-share div[style*="background:#070a10"] {
      background: #f8fafc !important;
      border: 1px solid rgba(15, 23, 42, 0.12) !important;
    }
    html[data-theme="light"] #modal-live-link-input {
      background: #ffffff !important;
      border: 1px solid rgba(15, 23, 42, 0.18) !important;
      color: #0284c7 !important;
      font-weight: 700 !important;
    }
    html[data-theme="light"] #modal-live-share .modal-body {
      color: #334155 !important;
    }
    html[data-theme="light"] #modal-live-share .modal-body strong {
      color: #0f172a !important;
    }
    html[data-theme="light"] #modal-live-share span[style*="color:var(--text-dim)"] {
      color: #64748b !important;
    }
    html[data-theme="light"] #btn-modal-stop-broadcast {
      border-color: rgba(225, 29, 72, 0.4) !important;
      color: #e11d48 !important;
      background: #fff1f2 !important;
    }
    html[data-theme="light"] #btn-modal-stop-broadcast:hover {
      background: #ffe4e6 !important;
      border-color: #e11d48 !important;
    }

    /* Modal 2: External GPS / GNSS Receiver (#modal-ble-gps) & Status Badges */
    html[data-theme="light"] #modal-ble-gps div[style*="background:rgba(0,0,0,0.45)"],
    html[data-theme="light"] #modal-ble-gps div[style*="background: rgba(0, 0, 0, 0.4)"],
    html[data-theme="light"] #modal-ble-gps div[style*="background:rgba(0,0,0,0.55)"],
    html[data-theme="light"] #modal-ble-gps div[style*="box-shadow:0 0 20px rgba(0,240,255,0.06)"] {
      background: #f8fafc !important;
      border: 1px solid rgba(2, 132, 199, 0.22) !important;
      box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04) !important;
    }
    html[data-theme="light"] #ble-modal-dev-name {
      color: #0f172a !important;
    }
    html[data-theme="light"] .gps-signal-meter-box {
      background: #f1f5f9 !important;
      border: 1px solid rgba(15, 23, 42, 0.14) !important;
      box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04) !important;
    }
    html[data-theme="light"] .gps-signal-bar {
      background: #cbd5e1 !important;
    }
    html[data-theme="light"] .gps-signal-bar.active-green { background: #059669 !important; }
    html[data-theme="light"] .gps-signal-bar.active-cyan { background: #0284c7 !important; }
    html[data-theme="light"] .gps-signal-bar.active-amber { background: #d97706 !important; }
    html[data-theme="light"] .gps-signal-bar.active-red { background: #e11d48 !important; }
    html[data-theme="light"] #ble-modal-signal-label {
      color: #334155;
      font-weight: 800;
    }
    html[data-theme="light"] #ble-modal-status-pill,
    html[data-theme="light"] .hud-status-badge {
      background: #ffffff !important;
      border: 1px solid rgba(15, 23, 42, 0.16) !important;
      color: #0f172a !important;
      box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04) !important;
    }
    html[data-theme="light"] .ext-gps-badge.standby {
      background: #f1f5f9 !important;
      border: 1px solid rgba(15, 23, 42, 0.14) !important;
      color: #334155 !important;
      box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04) !important;
    }
    html[data-theme="light"] .ext-gps-badge.standby:hover {
      background: #e2e8f0 !important;
      border-color: #0284c7 !important;
      color: #0284c7 !important;
    }
    html[data-theme="light"] .ext-gps-badge.connected {
      background: #f0fdf4 !important;
      border: 1px solid #059669 !important;
      color: #059669 !important;
      text-shadow: none !important;
      font-weight: 700 !important;
    }
    html[data-theme="light"] .ext-gps-badge.connected.verified {
      background: #f0f9ff !important;
      border-color: #0284c7 !important;
      color: #0284c7 !important;
    }
    html[data-theme="light"] .wakelock-badge.inactive {
      background: #f1f5f9 !important;
      border: 1px solid rgba(15, 23, 42, 0.14) !important;
      color: #334155 !important;
      box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04) !important;
    }
    html[data-theme="light"] .wakelock-badge.inactive:hover {
      background: #e2e8f0 !important;
      border-color: #0284c7 !important;
      color: #0284c7 !important;
    }
    html[data-theme="light"] .wakelock-badge.active {
      background: #fefce8 !important;
      border: 1px solid #ca8a04 !important;
      color: #a16207 !important;
      text-shadow: none !important;
    }
    /* Audio Coaching & IMU Badges in Light Mode */
    html[data-theme="light"] .coaching-badge.active {
      background: #ecfdf5 !important;
      border: 1px solid #059669 !important;
      color: #047857 !important;
      text-shadow: none !important;
      font-weight: 700 !important;
      box-shadow: 0 1px 2px rgba(5, 150, 105, 0.08) !important;
    }
    html[data-theme="light"] .coaching-badge.active:hover {
      background: #dcfce7 !important;
      border-color: #047857 !important;
      color: #065f46 !important;
    }
    html[data-theme="light"] .coaching-badge.inactive {
      background: #f1f5f9 !important;
      border: 1px solid rgba(15, 23, 42, 0.16) !important;
      color: #475569 !important;
      box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04) !important;
    }
    html[data-theme="light"] .coaching-badge.inactive:hover {
      background: #e2e8f0 !important;
      border-color: #047857 !important;
      color: #047857 !important;
    }
    html[data-theme="light"] .imu-badge.active {
      background: #f0f9ff !important;
      border: 1px solid #0284c7 !important;
      color: #0369a1 !important;
      text-shadow: none !important;
      font-weight: 700 !important;
      box-shadow: 0 1px 2px rgba(2, 132, 199, 0.08) !important;
    }
    html[data-theme="light"] .imu-badge.active:hover {
      background: #e0f2fe !important;
      border-color: #0369a1 !important;
      color: #075985 !important;
    }
    html[data-theme="light"] .imu-badge.standby {
      background: #f8fafc !important;
      border: 1px solid rgba(15, 23, 42, 0.2) !important;
      color: #334155 !important;
      box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04) !important;
    }
    html[data-theme="light"] .imu-badge.standby:hover {
      background: #f1f5f9 !important;
      border-color: #0284c7 !important;
      color: #0284c7 !important;
    }
    html[data-theme="light"] .imu-badge.inactive {
      background: #f1f5f9 !important;
      border: 1px solid rgba(15, 23, 42, 0.16) !important;
      color: #475569 !important;
      box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04) !important;
    }
    html[data-theme="light"] .imu-badge.inactive:hover {
      background: #e2e8f0 !important;
      border-color: #0284c7 !important;
      color: #0284c7 !important;
    }
    html[data-theme="light"] #ble-modal-diag-card {
      background: #f8fafc !important;
      border: 1px solid rgba(15, 23, 42, 0.1) !important;
      color: #334155 !important;
    }
    html[data-theme="light"] #ble-stream-packets,
    html[data-theme="light"] #ble-stream-last-time {
      color: #0f172a !important;
    }
    html[data-theme="light"] #serial-baud-box {
      background: #f8fafc !important;
      border: 1px solid rgba(15, 23, 42, 0.1) !important;
    }
    html[data-theme="light"] #modal-ble-gps div[style*="background:rgba(255,255,255,0.02)"] {
      background: #f1f5f9 !important;
      border: 1px solid rgba(15, 23, 42, 0.08) !important;
      color: #334155 !important;
    }
    html[data-theme="light"] #ble-modal-coords {
      color: #0f172a !important;
    }
    html[data-theme="light"] #ble-modal-stream-type {
      color: #0284c7 !important;
    }
    html[data-theme="light"] #modal-ble-gps .ble-status-tile {
      background: #ffffff !important;
      border: 1px solid rgba(15, 23, 42, 0.1) !important;
    }
    html[data-theme="light"] #modal-ble-gps .tile-label {
      color: #64748b !important;
    }
    html[data-theme="light"] #modal-ble-gps .ble-status-val {
      color: #0284c7 !important;
    }
    html[data-theme="light"] #modal-ble-gps select,
    html[data-theme="light"] #modal-ble-gps input {
      background: #ffffff !important;
      border: 1px solid rgba(15, 23, 42, 0.18) !important;
      color: #0f172a !important;
    }
    html[data-theme="light"] #modal-ble-gps .gps-guide-accordion {
      border-color: rgba(15, 23, 42, 0.1) !important;
    }
    html[data-theme="light"] #modal-ble-gps .gps-guide-header-btn {
      background: #f8fafc !important;
      color: #0f172a !important;
    }
    html[data-theme="light"] #ble-env-banner {
      background: #f1f5f9 !important;
      border: 1px solid rgba(15, 23, 42, 0.1) !important;
      color: #334155 !important;
    }
    html[data-theme="light"] #modal-ble-gps strong {
      color: #0f172a !important;
    }
    html[data-theme="light"] #modal-ble-gps #sim-bridge-info-bar {
      background: #fffbeb !important;
      border: 1px solid #fde68a !important;
    }
    html[data-theme="light"] #modal-ble-gps #sim-bridge-info-bar span {
      color: #0f172a !important;
    }
    html[data-theme="light"] #modal-ble-gps #sim-bridge-status-badge {
      background: #f1f5f9 !important;
      color: #475569 !important;
      border: 1px solid #cbd5e1 !important;
    }
    html[data-theme="light"] #modal-ble-gps #sim-bridge-status-desc {
      color: #475569 !important;
    }
    html[data-theme="light"] #modal-ble-gps kbd {
      background: #e2e8f0 !important;
      color: #0f172a !important;
      border: 1px solid #cbd5e1 !important;
    }
    html[data-theme="light"] #modal-ble-gps #serial-baud-box {
      background: #f8fafc !important;
      border: 1px solid rgba(15, 23, 42, 0.1) !important;
    }
    html[data-theme="light"] #modal-ble-gps #serial-baud-rate {
      background: #ffffff !important;
      color: #0f172a !important;
      border: 1px solid rgba(15, 23, 42, 0.2) !important;
    }
    html[data-theme="light"] #modal-ble-gps #btn-ble-disconnect {
      color: #e11d48 !important;
      border-color: #e11d48 !important;
      background: #fff1f2 !important;
    }

    /* Modal 3: Export GPS Telemetry (#modal-vbo-export) Base & Mobile Styles */
    .vbo-modal-card {
      max-width: 480px;
    }
    .vbo-modal-body {
      display: flex;
      flex-direction: column;
      gap: 0.85rem;
      padding: 1rem 1.15rem 1.15rem 1.15rem;
    }
    .vbo-export-banner {
      background: rgba(0, 240, 255, 0.05);
      border: 1px solid rgba(0, 240, 255, 0.2);
      border-radius: var(--radius-md);
      padding: 0.75rem 0.9rem;
      display: flex;
      align-items: center;
      gap: 0.75rem;
    }
    .vbo-export-banner-icon {
      width: 42px;
      height: 42px;
      border-radius: 10px;
      background: rgba(0, 240, 255, 0.12);
      display: flex;
      align-items: center;
      justify-content: center;
      flex-shrink: 0;
      color: var(--accent-cyan);
    }
    .vbo-export-summary-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 0.45rem;
    }
    .vbo-stat-card {
      background: rgba(255, 255, 255, 0.03);
      border: 1px solid rgba(255, 255, 255, 0.07);
      border-radius: var(--radius-sm);
      padding: 0.55rem 0.65rem;
    }
    .vbo-stat-label {
      font-size: 0.72rem;
      color: var(--text-dim);
      text-transform: uppercase;
      letter-spacing: 0.5px;
      font-weight: 700;
    }
    .vbo-stat-val {
      font-size: 0.84rem;
      font-weight: 700;
      color: #fff;
      margin-top: 0.2rem;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .vbo-filename-box {
      background: rgba(0, 0, 0, 0.4);
      border: 1px dashed rgba(255, 255, 255, 0.12);
      border-radius: var(--radius-sm);
      padding: 0.55rem 0.75rem;
    }
    .vbo-filename-label {
      font-size: 0.72rem;
      color: var(--text-dim);
      margin-bottom: 0.2rem;
      font-weight: 700;
    }
    .vbo-filename-text {
      font-size: 0.78rem;
      font-family: var(--font-mono);
      color: var(--text-light);
      word-break: break-all;
    }
    .vbo-modal-footer {
      display: flex;
      gap: 0.55rem;
      padding: 0.75rem 1.15rem calc(0.75rem + env(safe-area-inset-bottom, 12px));
    }

    @media (max-width: 768px) {
      .vbo-modal-card {
        max-width: 100% !important;
        width: 100% !important;
        border-radius: 20px 20px 0 0 !important;
      }
      .vbo-modal-body {
        padding: 0.85rem 1rem !important;
        gap: 0.75rem !important;
      }
      .vbo-export-banner {
        padding: 0.6rem 0.75rem !important;
        gap: 0.65rem !important;
      }
      .vbo-export-banner-icon {
        width: 36px !important;
        height: 36px !important;
      }
      .vbo-stat-card {
        padding: 0.45rem 0.55rem !important;
      }
      .vbo-stat-label {
        font-size: 0.72rem !important;
      }
      .vbo-stat-val {
        font-size: 0.8rem !important;
      }
      .vbo-filename-box {
        padding: 0.45rem 0.65rem !important;
      }
      .vbo-filename-text {
        font-size: 0.74rem !important;
      }
      .vbo-modal-footer {
        padding: 0.65rem 1rem calc(0.85rem + env(safe-area-inset-bottom, 12px)) !important;
      }
    }

    /* Modal 3: Export GPS Telemetry Light Theme Overrides */
    html[data-theme="light"] .vbo-export-banner {
      background: #f0f9ff !important;
      border: 1px solid rgba(2, 132, 199, 0.25) !important;
    }
    html[data-theme="light"] #vbo-export-modal-title {
      color: #0369a1 !important;
    }
    html[data-theme="light"] .vbo-stat-card {
      background: #f8fafc !important;
      border: 1px solid rgba(15, 23, 42, 0.1) !important;
    }
    html[data-theme="light"] .vbo-stat-val {
      color: #0f172a !important;
    }
    html[data-theme="light"] #vbo-export-timing-val {
      color: #059669 !important;
    }
    html[data-theme="light"] #vbo-export-points-val {
      color: #0284c7 !important;
    }
    html[data-theme="light"] .vbo-filename-box {
      background: #f1f5f9 !important;
      border: 1px dashed rgba(15, 23, 42, 0.2) !important;
    }
    html[data-theme="light"] .vbo-filename-text {
      color: #0f172a !important;
    }
    html[data-theme="light"] .vbo-modal-body {
      color: #334155 !important;
    }
    html[data-theme="light"] .vbo-stat-label,
    html[data-theme="light"] .vbo-filename-label {
      color: #64748b !important;
    }

    /* Modal: Friend Management & Invite (#modal-friends-management) Light Theme */
    html[data-theme="light"] #modal-friends-management .modal-card {
      background: #ffffff !important;
      color: #0f172a !important;
    }
    html[data-theme="light"] #modal-friends-management .modal-header {
      background: #ffffff !important;
      border-bottom: 1px solid rgba(15, 23, 42, 0.08) !important;
    }
    html[data-theme="light"] #modal-friends-management .modal-title {
      color: #0f172a !important;
    }
    html[data-theme="light"] #modal-friends-management .friends-invite-card {
      background: #fffbeb !important;
      border: 1px solid rgba(217, 119, 6, 0.3) !important;
      box-shadow: 0 2px 12px rgba(217, 119, 6, 0.08) !important;
    }
    html[data-theme="light"] #modal-friends-management .friends-invite-title {
      color: #b45309 !important;
    }
    html[data-theme="light"] #modal-friends-management .friends-invite-desc {
      color: #475569 !important;
    }
    html[data-theme="light"] #modal-friends-management .friends-input {
      background: #ffffff !important;
      border: 1px solid rgba(15, 23, 42, 0.18) !important;
      color: #0f172a !important;
    }
    html[data-theme="light"] #modal-friends-management .friends-input::placeholder {
      color: #94a3b8 !important;
    }
    html[data-theme="light"] #modal-friends-management .friends-section-title {
      color: #0f172a !important;
    }
    html[data-theme="light"] #modal-friends-management #friend-list-count {
      color: #0284c7 !important;
    }
    html[data-theme="light"] #modal-friends-management .friends-empty-state {
      background: #f8fafc !important;
      border: 1px dashed rgba(15, 23, 42, 0.18) !important;
      color: #475569 !important;
    }
    html[data-theme="light"] #modal-friends-management .friend-item-card {
      background: #f8fafc !important;
      border: 1px solid rgba(15, 23, 42, 0.1) !important;
      box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04) !important;
    }
    html[data-theme="light"] #modal-friends-management .friend-item-name {
      color: #0f172a !important;
    }
    html[data-theme="light"] #modal-friends-management .friend-item-email {
      color: #64748b !important;
    }
    html[data-theme="light"] #modal-friends-management .friend-remove-btn {
      background: #fff1f2 !important;
      border: 1px solid rgba(225, 29, 72, 0.35) !important;
      color: #e11d48 !important;
    }
    html[data-theme="light"] #modal-friends-management .friend-remove-btn:hover {
      background: #ffe4e6 !important;
      color: #be123c !important;
    }
    html[data-theme="light"] #modal-friends-management .friend-search-item {
      background: #f8fafc !important;
      border: 1px solid rgba(15, 23, 42, 0.1) !important;
      box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04) !important;
    }
    html[data-theme="light"] #modal-friends-management .friend-search-name {
      color: #0f172a !important;
    }
    html[data-theme="light"] #modal-friends-management .friend-search-email {
      color: #64748b !important;
    }

    /* Modal 4: Log Track Session (#modal-log-session) */
    html[data-theme="light"] #modal-log-session .form-label {
      color: #0f172a !important;
      font-weight: 700 !important;
    }
    html[data-theme="light"] #modal-log-session .hud-track-search-box {
      background: #ffffff !important;
      border-color: rgba(15, 23, 42, 0.18) !important;
    }
    html[data-theme="light"] #modal-log-session .hud-track-search-input {
      background: #ffffff !important;
      color: #0f172a !important;
    }
    html[data-theme="light"] #modal-log-session .form-select,
    html[data-theme="light"] #modal-log-session .form-input,
    html[data-theme="light"] #modal-log-session .form-textarea,
    html[data-theme="light"] #modal-log-session .form-date-input,
    html[data-theme="light"] #modal-log-session .form-time-input {
      background: #ffffff !important;
      border: 1px solid rgba(15, 23, 42, 0.18) !important;
      color: #0f172a !important;
    }
    html[data-theme="light"] #modal-log-session .mobile-car-setup-container {
      background: #f8fafc !important;
      border: 1px solid rgba(15, 23, 42, 0.12) !important;
    }
    html[data-theme="light"] #modal-log-session .car-setup-title {
      color: #0f172a !important;
    }
    html[data-theme="light"] #modal-log-session .wheel-box {
      background: #ffffff !important;
      border: 1px solid rgba(15, 23, 42, 0.14) !important;
      box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04) !important;
    }
    html[data-theme="light"] #modal-log-session .wheel-id-badge {
      background: #f1f5f9 !important;
      color: #0f172a !important;
      border: 1px solid rgba(15, 23, 42, 0.1) !important;
    }
    html[data-theme="light"] #modal-log-session .wheel-box input {
      background: #ffffff !important;
      border-color: rgba(15, 23, 42, 0.16) !important;
      color: #0f172a !important;
    }
    html[data-theme="light"] #modal-log-session .car-axle-label {
      color: #64748b !important;
    }
    html[data-theme="light"] #modal-log-session .best-lap-hero-group {
      background: #f0f9ff !important;
      border: 1px solid rgba(2, 132, 199, 0.25) !important;
    }
    html[data-theme="light"] #modal-log-session .best-lap-hero-input {
      background: #ffffff !important;
      border: 1px solid rgba(2, 132, 199, 0.3) !important;
      color: #0284c7 !important;
      font-weight: 800 !important;
    }

    /* Modal 4.5: Lap Gate GPS Calibration & Custom Circuits (#modal-lap-gate-calib) */
    .lap-custom-item-name {
      color: #ffffff;
      font-weight: 700;
    }

    /* Mobile-optimized S/F Setup Dropdown */
    .calib-select-lg {
      width: 100% !important;
      min-height: 44px !important;
      height: 44px !important;
      font-size: 0.95rem !important;
      font-weight: 700 !important;
      padding: 0.55rem 0.85rem !important;
      border-radius: var(--radius-sm) !important;
      background-color: rgba(3, 7, 18, 0.9) !important;
      border: 1px solid rgba(0, 240, 255, 0.35) !important;
      color: #ffffff !important;
      cursor: pointer !important;
      line-height: 1.3 !important;
    }
    .calib-select-lg option {
      font-size: 0.95rem !important;
      font-weight: 600 !important;
      padding: 0.6rem !important;
      background: #0f172a !important;
      color: #ffffff !important;
    }
    html[data-theme="light"] .calib-select-lg {
      background-color: #ffffff !important;
      border: 1.5px solid rgba(15, 23, 42, 0.25) !important;
      color: #0f172a !important;
      box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08) !important;
    }
    html[data-theme="light"] .calib-select-lg option {
      background: #ffffff !important;
      color: #0f172a !important;
    }
    .lap-calib-field-label {
      display: block;
      font-size: 0.78rem !important;
      font-weight: 800 !important;
      color: var(--accent-cyan);
      letter-spacing: 0.04em;
      text-transform: uppercase;
      margin-bottom: 0.35rem;
    }
    html[data-theme="light"] .lap-calib-field-label {
      color: #0369a1 !important;
    }
    .lap-create-meta-row {
      display: flex;
      align-items: center;
      justify-content: space-between;
      gap: 0.75rem;
      margin-bottom: 0.75rem;
      padding: 0.55rem 0.75rem;
      background: rgba(0, 0, 0, 0.22);
      border-radius: var(--radius-sm);
      border: 1px solid rgba(255, 255, 255, 0.08);
    }
    html[data-theme="light"] .lap-create-meta-row {
      background: #f1f5f9 !important;
      border-color: rgba(15, 23, 42, 0.12) !important;
    }

    /* Circuit Leaderboard Dropdown Base Styling */
    .rank-filter-dropdowns .form-select {
      font-size: 0.82rem !important;
      font-weight: 600 !important;
      min-height: 36px !important;
      height: 36px !important;
      padding: 0.35rem 0.65rem !important;
      border-radius: var(--radius-sm) !important;
      background-color: rgba(15, 23, 42, 0.92) !important;
      border: 1px solid rgba(0, 240, 255, 0.35) !important;
      color: #ffffff !important;
      cursor: pointer !important;
    }
    .rank-filter-dropdowns .form-select option {
      font-size: 0.82rem !important;
      font-weight: 500 !important;
      padding: 0.45rem 0.6rem !important;
      background: #0f172a !important;
      color: #ffffff !important;
    }
    html[data-theme="light"] .rank-filter-dropdowns .form-select {
      background-color: #ffffff !important;
      border: 1.5px solid rgba(15, 23, 42, 0.22) !important;
      color: #0f172a !important;
      box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08) !important;
    }
    html[data-theme="light"] .rank-filter-dropdowns .form-select option {
      background: #ffffff !important;
      color: #0f172a !important;
    }
    html[data-theme="light"] .rank-search-box input {
      background: #ffffff !important;
      color: #0f172a !important;
      border: 1.5px solid rgba(15, 23, 42, 0.22) !important;
      box-shadow: 0 1px 3px rgba(15, 23, 42, 0.08) !important;
    }
    html[data-theme="light"] .rank-search-box i,
    html[data-theme="light"] .rank-search-box svg {
      color: #64748b !important;
    }
    html[data-theme="light"] #modal-lap-gate-calib .modal-card {
      background: #ffffff !important;
      color: #0f172a !important;
      border: 1px solid rgba(15, 23, 42, 0.15) !important;
      box-shadow: 0 20px 50px rgba(15, 23, 42, 0.16) !important;
    }
    html[data-theme="light"] #modal-lap-gate-calib .modal-header {
      background: #f8fafc !important;
      border-bottom: 1px solid rgba(15, 23, 42, 0.1) !important;
      color: #0f172a !important;
    }
    html[data-theme="light"] #modal-lap-gate-calib .modal-title {
      color: #0f172a !important;
    }
    html[data-theme="light"] #modal-lap-gate-calib .modal-title span {
      color: #0f172a !important;
    }
    html[data-theme="light"] #modal-lap-gate-calib .modal-close-btn {
      color: #64748b !important;
    }
    html[data-theme="light"] #modal-lap-gate-calib .modal-close-btn:hover {
      color: #0f172a !important;
      background: #e2e8f0 !important;
    }
    html[data-theme="light"] #modal-lap-gate-calib div[style*="background:rgba(15,23,42,0.75)"],
    html[data-theme="light"] #modal-lap-gate-calib div[style*="background:rgba(15,23,42,0.6)"],
    html[data-theme="light"] #modal-lap-gate-calib div[style*="background: rgba(15, 23, 42, 0.6)"] {
      background: #f8fafc !important;
      border: 1px solid rgba(15, 23, 42, 0.12) !important;
    }
    html[data-theme="light"] #lap-calib-modal-track-name {
      color: #0f172a !important;
      font-weight: 800 !important;
    }
    html[data-theme="light"] #lap-calib-modal-layout-name,
    html[data-theme="light"] #lap-calib-modal-layout-name span {
      color: #0369a1 !important;
      font-weight: 700 !important;
    }
    html[data-theme="light"] #lap-calib-modal-status-badge {
      background: #e0f2fe !important;
      color: #0369a1 !important;
      border: 1px solid rgba(2, 132, 199, 0.3) !important;
    }
    html[data-theme="light"] #modal-lap-gate-calib .lap-calib-modal-section {
      background: #f8fafc !important;
      border: 1px solid rgba(15, 23, 42, 0.12) !important;
      border-radius: var(--radius-sm) !important;
      padding: 0.75rem !important;
      color: #0f172a !important;
    }
    html[data-theme="light"] #modal-lap-gate-calib .lap-calib-tabs {
      background: #f1f5f9 !important;
      border-bottom: 1px solid rgba(15, 23, 42, 0.12) !important;
    }
    html[data-theme="light"] #modal-lap-gate-calib .lap-calib-tab-btn {
      background: #e2e8f0 !important;
      color: #475569 !important;
      font-weight: 700 !important;
      border: 1px solid transparent !important;
    }
    html[data-theme="light"] #modal-lap-gate-calib .lap-calib-tab-btn:hover {
      background: #cbd5e1 !important;
      color: #0f172a !important;
    }
    html[data-theme="light"] #modal-lap-gate-calib .lap-calib-tab-btn.active#lap-calib-tab-btn-calibrate {
      background: #ffffff !important;
      color: #b45309 !important;
      border-color: rgba(217, 119, 6, 0.5) !important;
      box-shadow: 0 2px 8px rgba(217, 119, 6, 0.18) !important;
    }
    html[data-theme="light"] #modal-lap-gate-calib .lap-calib-tab-btn.active#lap-calib-tab-btn-create {
      background: #ffffff !important;
      color: #15803d !important;
      border-color: rgba(22, 163, 74, 0.5) !important;
      box-shadow: 0 2px 8px rgba(22, 163, 74, 0.18) !important;
    }
    html[data-theme="light"] #modal-lap-gate-calib .lap-calib-tab-tag.edit {
      background: #fef3c7 !important;
      color: #b45309 !important;
      border: 1px solid rgba(217, 119, 6, 0.4) !important;
    }
    html[data-theme="light"] #modal-lap-gate-calib .lap-calib-tab-tag.new {
      background: #dcfce7 !important;
      color: #15803d !important;
      border: 1px solid rgba(22, 163, 74, 0.4) !important;
    }
    html[data-theme="light"] #modal-lap-gate-calib .lap-calib-mode-pill.mode-calibrate {
      background: #fef3c7 !important;
      color: #b45309 !important;
      border: 1px solid rgba(217, 119, 6, 0.4) !important;
    }
    html[data-theme="light"] #modal-lap-gate-calib .lap-calib-mode-pill.mode-create {
      background: #dcfce7 !important;
      color: #15803d !important;
      border: 1px solid rgba(22, 163, 74, 0.4) !important;
    }
    html[data-theme="light"] #modal-lap-gate-calib .lap-calib-mode-banner.mode-banner-calibrate {
      background: linear-gradient(135deg, #fffbeb, #ffffff) !important;
      border: 1px solid rgba(217, 119, 6, 0.35) !important;
    }
    html[data-theme="light"] #modal-lap-gate-calib .lap-calib-mode-banner.mode-banner-create {
      background: linear-gradient(135deg, #f0fdf4, #ffffff) !important;
      border: 1px solid rgba(22, 163, 74, 0.35) !important;
    }
    html[data-theme="light"] #modal-lap-gate-calib .mode-banner-circuit-name {
      color: #0f172a !important;
      font-weight: 800 !important;
    }
    html[data-theme="light"] #modal-lap-gate-calib .mode-banner-guide-desc {
      color: #475569 !important;
      border-top: 1px solid rgba(15, 23, 42, 0.08) !important;
    }
    html[data-theme="light"] #modal-lap-gate-calib .mode-banner-pill-edit {
      background: #fef3c7 !important;
      color: #b45309 !important;
      border: 1px solid rgba(217, 119, 6, 0.4) !important;
    }
    html[data-theme="light"] #modal-lap-gate-calib .mode-banner-pill-create {
      background: #dcfce7 !important;
      color: #15803d !important;
      border: 1px solid rgba(22, 163, 74, 0.4) !important;
    }
    html[data-theme="light"] #modal-lap-gate-calib div[style*="background:rgba(0,0,0,0.25)"],
    html[data-theme="light"] #modal-lap-gate-calib div[style*="background: rgba(0, 0, 0, 0.25)"] {
      background: #f1f5f9 !important;
      border-top: 1px solid rgba(15, 23, 42, 0.08) !important;
      border-right: 1px solid rgba(15, 23, 42, 0.08) !important;
      border-bottom: 1px solid rgba(15, 23, 42, 0.08) !important;
    }
    html[data-theme="light"] #modal-lap-gate-calib label {
      color: #334155 !important;
      font-weight: 700 !important;
    }
    html[data-theme="light"] #modal-lap-gate-calib span[style*="color:var(--text-muted)"] {
      color: #64748b !important;
    }
    html[data-theme="light"] #modal-lap-gate-calib .calib-input {
      background: #ffffff !important;
      border: 1px solid rgba(15, 23, 42, 0.22) !important;
      color: #0f172a !important;
    }
    html[data-theme="light"] #modal-lap-gate-calib .calib-input::placeholder {
      color: #94a3b8 !important;
    }
    html[data-theme="light"] #modal-lap-gate-calib .calib-input option {
      background: #ffffff !important;
      color: #0f172a !important;
    }
    html[data-theme="light"] #modal-lap-gate-calib .calib-dist-info {
      background: #e2e8f0 !important;
      color: #1e293b !important;
      border: 1px solid rgba(15, 23, 42, 0.12) !important;
    }
    html[data-theme="light"] #modal-lap-gate-calib div[style*="background:rgba(3,7,18,0.7)"],
    html[data-theme="light"] #modal-lap-gate-calib div[style*="background: rgba(3, 7, 18, 0.7)"] {
      background: #f1f5f9 !important;
      border: 1px solid rgba(15, 23, 42, 0.1) !important;
      color: #334155 !important;
    }
    html[data-theme="light"] #modal-lap-gate-calib #lap-calib-preview-bearing {
      color: #0284c7 !important;
    }
    html[data-theme="light"] #modal-lap-gate-calib #lap-create-start-label {
      color: #15803d !important;
    }
    html[data-theme="light"] #modal-lap-gate-calib #lap-create-finish-section span[style*="color:var(--accent-amber)"] {
      color: #b45309 !important;
    }
    html[data-theme="light"] #modal-lap-gate-calib #lap-custom-courses-count {
      color: #0284c7 !important;
      font-weight: 800 !important;
    }
    html[data-theme="light"] #modal-lap-gate-calib div[style*="⭐ My Custom Courses"] span:first-child {
      color: #1e293b !important;
      font-weight: 800 !important;
    }
    html[data-theme="light"] #modal-lap-gate-calib .lap-calib-custom-item {
      background: #ffffff !important;
      border: 1px solid rgba(15, 23, 42, 0.14) !important;
      box-shadow: 0 1px 4px rgba(15, 23, 42, 0.05) !important;
    }
    html[data-theme="light"] #modal-lap-gate-calib .lap-calib-custom-item:hover {
      border-color: #0284c7 !important;
      background: #f0f9ff !important;
    }
    html[data-theme="light"] #modal-lap-gate-calib .lap-custom-item-name,
    html[data-theme="light"] #modal-lap-gate-calib .lap-calib-custom-item div[style*="color:#fff"],
    html[data-theme="light"] #modal-lap-gate-calib .lap-calib-custom-item div[style*="color: #fff"] {
      color: #0f172a !important;
      font-weight: 800 !important;
    }
    html[data-theme="light"] #modal-lap-gate-calib .lap-calib-custom-item div[style*="color:var(--text-muted)"] {
      color: #64748b !important;
    }
    html[data-theme="light"] #modal-lap-gate-calib div[style*="No custom courses registered yet"] {
      background: #f1f5f9 !important;
      color: #475569 !important;
      border: 1px dashed rgba(15, 23, 42, 0.2) !important;
    }
    html[data-theme="light"] #modal-lap-gate-calib #lap-calib-modal-footer {
      background: #f8fafc !important;
      border-top: 1px solid rgba(15, 23, 42, 0.1) !important;
    }
    html[data-theme="light"] #modal-lap-gate-calib .btn-outline {
      background: #ffffff !important;
      color: #334155 !important;
      border: 1px solid rgba(15, 23, 42, 0.22) !important;
    }
    html[data-theme="light"] #modal-lap-gate-calib .btn-outline:hover {
      background: #f1f5f9 !important;
      color: #0f172a !important;
      border-color: rgba(15, 23, 42, 0.35) !important;
    }

    /* Modal 5: Pit Gate GPS Calibration (#modal-pit-gate-calib) */
    html[data-theme="light"] #modal-pit-gate-calib div[style*="background:rgba(15,23,42,0.75)"] {
      background: #f0f9ff !important;
      border: 1px solid rgba(2, 132, 199, 0.25) !important;
    }
    html[data-theme="light"] #calib-modal-track-name {
      color: #0f172a !important;
    }
    html[data-theme="light"] #calib-modal-layout-name {
      color: #0369a1 !important;
    }
    html[data-theme="light"] #calib-modal-status-badge {
      background: #e0f2fe !important;
      color: #0369a1 !important;
      border: 1px solid rgba(2, 132, 199, 0.3) !important;
    }
    html[data-theme="light"] .pit-calib-modal-section {
      background: #f8fafc !important;
      border: 1px solid rgba(15, 23, 42, 0.12) !important;
      border-radius: var(--radius-sm) !important;
      padding: 0.75rem !important;
    }
    html[data-theme="light"] .gate-tag.in {
      background: rgba(2, 132, 199, 0.12) !important;
      color: #0284c7 !important;
      border: 1px solid rgba(2, 132, 199, 0.25) !important;
    }
    html[data-theme="light"] .gate-tag.out {
      background: rgba(217, 119, 6, 0.12) !important;
      color: #b45309 !important;
      border: 1px solid rgba(217, 119, 6, 0.25) !important;
    }
    html[data-theme="light"] .coord-field label {
      color: #64748b !important;
      font-weight: 700 !important;
    }
    html[data-theme="light"] .calib-input {
      background: #ffffff !important;
      border: 1px solid rgba(15, 23, 42, 0.18) !important;
      color: #0f172a !important;
      font-weight: 700 !important;
    }
    html[data-theme="light"] .calib-dist-info {
      background: #e2e8f0 !important;
      color: #334155 !important;
      border: 1px solid rgba(15, 23, 42, 0.08) !important;
    }

    /* Modal 6: Driver Profile Modal (#modal-user-profile) Light Mode Visibility */
    html[data-theme="light"] #modal-user-profile #prof-name {
      color: #0f172a !important;
    }
    html[data-theme="light"] #modal-user-profile #prof-email {
      color: #64748b !important;
    }
    html[data-theme="light"] #modal-user-profile .driver-nick-card,
    html[data-theme="light"] #modal-user-profile div[style*="rgba(15, 23, 42, 0.7)"],
    html[data-theme="light"] #modal-user-profile div[style*="rgba(15,23,42,0.7)"] {
      background: #f0f9ff !important;
      border: 1px solid rgba(2, 132, 199, 0.28) !important;
      box-shadow: 0 2px 10px rgba(2, 132, 199, 0.06) !important;
    }
    html[data-theme="light"] #modal-user-profile .driver-nick-card label,
    html[data-theme="light"] #modal-user-profile label[style*="color:var(--accent-cyan)"] {
      color: #0284c7 !important;
    }
    html[data-theme="light"] #modal-user-profile span[style*="color:var(--text-dim)"] {
      color: #64748b !important;
    }
    html[data-theme="light"] #modal-user-profile #prof-nickname-input {
      background: #ffffff !important;
      border: 1.5px solid rgba(15, 23, 42, 0.2) !important;
      color: #0f172a !important;
      box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04) !important;
    }
    html[data-theme="light"] #modal-user-profile #prof-nickname-input:focus {
      border-color: #0284c7 !important;
      box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15) !important;
    }
    html[data-theme="light"] #modal-user-profile #prof-nickname-input::placeholder {
      color: #94a3b8 !important;
    }
    html[data-theme="light"] #modal-user-profile .btn-cyan,
    html[data-theme="light"] .btn-cyan {
      background: #0284c7 !important;
      color: #ffffff !important;
      border: 1px solid #0284c7 !important;
      box-shadow: 0 2px 8px rgba(2, 132, 199, 0.25) !important;
    }
    html[data-theme="light"] #modal-user-profile .btn-cyan:hover,
    html[data-theme="light"] .btn-cyan:hover {
      background: #0369a1 !important;
      border-color: #0369a1 !important;
      box-shadow: 0 4px 12px rgba(2, 132, 199, 0.35) !important;
      color: #ffffff !important;
    }
    html[data-theme="light"] #modal-user-profile button[onclick*="resetDriverNicknameToDefault"] {
      color: #0284c7 !important;
      font-weight: 600 !important;
    }
    html[data-theme="light"] #modal-user-profile button[onclick*="resetDriverNicknameToDefault"]:hover {
      color: #0369a1 !important;
    }
    html[data-theme="light"] #modal-user-profile .driver-stats-grid,
    html[data-theme="light"] #modal-user-profile div[style*="background:rgba(0,0,0,0.35)"],
    html[data-theme="light"] #modal-user-profile div[style*="background: rgba(0, 0, 0, 0.35)"] {
      background: #f8fafc !important;
      border: 1px solid rgba(15, 23, 42, 0.12) !important;
      box-shadow: 0 2px 8px rgba(15, 23, 42, 0.03) !important;
    }
    html[data-theme="light"] #modal-user-profile #prof-session-count {
      color: #0284c7 !important;
    }
    html[data-theme="light"] #modal-user-profile #prof-best-lap {
      color: #059669 !important;
    }
    html[data-theme="light"] #modal-user-profile #prof-auth-type,
    html[data-theme="light"] #modal-user-profile #prof-joined-date {
      color: #1e293b !important;
    }
    html[data-theme="light"] #modal-user-profile .modal-body span[style*="color:var(--text-muted)"] {
      color: #64748b !important;
      font-weight: 600 !important;
    }
    html[data-theme="light"] #modal-user-profile a[href*="privacy.html"] {
      color: #475569 !important;
    }
    html[data-theme="light"] #modal-user-profile a[href*="privacy.html"]:hover {
      color: #0284c7 !important;
    }
    html[data-theme="light"] #modal-user-profile a[href*="delete-account.html"] {
      color: #e11d48 !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;
    }
    html[data-theme="light"] .footer-brand,
    html[data-theme="light"] .footer-brand span {
      color: #0f172a !important;
    }
    html[data-theme="light"] .footer-nav-links a:hover {
      color: #0284c7 !important;
    }
    html[data-theme="light"] .footer-nav-links .footer-link-active {
      color: #0284c7 !important;
      font-weight: 700;
    }
    html[data-theme="light"] .footer-nav-links .footer-link-highlight {
      color: inherit !important;
    }
    html[data-theme="light"] .footer-nav-links .footer-link-highlight:hover {
      color: #0284c7 !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;
      gap: 0.7rem;
      width: 100%;
      padding: 0.55rem 0.65rem;
      border-radius: var(--radius-md, 10px);
      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;
    }
    .icon-sun { display: none; }
    .icon-moon { display: inline-block; }
    html[data-theme="light"] .icon-sun { display: inline-block; }
    html[data-theme="light"] .icon-moon { display: none; }

        /* --- LAP TIMER & PIT TIMER LIGHT MODE COCKPIT THEME --- */
    /* Outer Containers */
    html[data-theme="light"] .timer-hud-container,
    html[data-theme="light"] .pit-hud-container {
      background: #ffffff !important;
      border: 1px solid rgba(15, 23, 42, 0.1) !important;
      box-shadow: 0 6px 24px rgba(15, 23, 42, 0.06) !important;
      color: #0f172a !important;
    }

    /* Top Bar & Circuit Selectors */
    html[data-theme="light"] .hud-header-bar {
      border-bottom: 1px solid rgba(15, 23, 42, 0.08) !important;
    }
    html[data-theme="light"] .hud-track-dropdown-btn,
    html[data-theme="light"] .filter-track-dropdown-btn {
      background: #f8fafc !important;
      border: 1px solid rgba(15, 23, 42, 0.15) !important;
      color: #0f172a !important;
    }
    html[data-theme="light"] .hud-track-search-input {
      background: #ffffff !important;
      border: 1px solid rgba(15, 23, 42, 0.18) !important;
      color: #0f172a !important;
    }
    html[data-theme="light"] .hud-track-search-input[readonly],
    html[data-theme="light"] .hud-track-search-input:disabled {
      background: #f8fafc !important;
      color: #0f172a !important;
      -webkit-text-fill-color: #0f172a !important;
    }
    html[data-theme="light"] .session-circuit-dropdown-panel {
      background: #ffffff !important;
      border: 1px solid rgba(15, 23, 42, 0.14) !important;
      box-shadow: 0 16px 40px rgba(15, 23, 42, 0.12) !important;
    }
    html[data-theme="light"] .hud-layout-row {
      background: #f8fafc !important;
      border-color: rgba(15, 23, 42, 0.08) !important;
      color: #334155 !important;
    }
    html[data-theme="light"] .hud-layout-select {
      background: #ffffff !important;
      border: 1px solid rgba(15, 23, 42, 0.18) !important;
      color: #0f172a !important;
    }

    /* Auto-Start Status Banner */
    html[data-theme="light"] .hud-auto-start-banner {
      background: #f0f9ff !important;
      border: 1px solid rgba(2, 132, 199, 0.28) !important;
      color: #0369a1 !important;
    }
    html[data-theme="light"] .hud-auto-start-banner.pit {
      background: #fffbeb !important;
      border-color: rgba(217, 119, 6, 0.3) !important;
      color: #92400e !important;
    }
    html[data-theme="light"] .auto-start-title {
      color: #0369a1 !important;
    }
    html[data-theme="light"] .hud-auto-start-banner.pit .auto-start-title {
      color: #92400e !important;
    }
    html[data-theme="light"] .auto-start-desc {
      color: #0284c7 !important;
    }
    html[data-theme="light"] .hud-auto-start-banner.pit .auto-start-desc {
      color: #b45309 !important;
    }
    html[data-theme="light"] .hud-auto-start-banner.triggered {
      background: #ecfdf5 !important;
      border-color: #059669 !important;
      color: #065f46 !important;
      box-shadow: 0 0 14px rgba(5, 150, 105, 0.2) !important;
    }
    html[data-theme="light"] .start-lights-cluster {
      background: #e2e8f0 !important;
      border-color: #cbd5e1 !important;
    }
    html[data-theme="light"] .s-light.off {
      background: #94a3b8 !important;
      border-color: #64748b !important;
    }
    html[data-theme="light"] .hud-auto-start-banner.preflight-scanning {
      background: #fef3c7 !important;
      border-color: #f59e0b !important;
      color: #b45309 !important;
    }

    /* Track Map Card & Canvas Wrap */
    html[data-theme="light"] .hud-circuit-map-card {
      background: #f8fafc !important;
      border: 1px solid rgba(15, 23, 42, 0.1) !important;
      box-shadow: 0 2px 10px rgba(15, 23, 42, 0.04) !important;
    }
    html[data-theme="light"] .hud-circuit-map-card.pit {
      border-color: rgba(217, 119, 6, 0.25) !important;
    }
    html[data-theme="light"] .circuit-map-toolbar {
      border-bottom: 1px solid rgba(15, 23, 42, 0.08) !important;
    }
    html[data-theme="light"] .circuit-map-title {
      color: #0284c7 !important;
    }
    html[data-theme="light"] .circuit-map-card.pit .circuit-map-title,
    html[data-theme="light"] .hud-circuit-map-card.pit .circuit-map-title {
      color: #d97706 !important;
    }
    html[data-theme="light"] .circuit-map-canvas-wrap {
      background: #f1f5f9 !important;
      border: 1px solid rgba(15, 23, 42, 0.08) !important;
    }
    html[data-theme="light"] .circuit-map-telemetry,
    html[data-theme="light"] .circuit-map-speed-hud {
      background: rgba(255, 255, 255, 0.92) !important;
      border: 1px solid rgba(15, 23, 42, 0.12) !important;
      color: #0f172a !important;
      box-shadow: 0 1px 4px rgba(15, 23, 42, 0.05) !important;
    }

    /* Digital Lap Time Gauge & Timer Display */
    html[data-theme="light"] .hud-laptime-gauge,
    html[data-theme="light"] .pit-gauge-box {
      background: #f8fafc !important;
      border: 1px solid rgba(15, 23, 42, 0.1) !important;
      box-shadow: inset 0 2px 6px rgba(15, 23, 42, 0.03) !important;
    }
    html[data-theme="light"] .hud-lap-number-pill {
      color: #0284c7 !important;
    }
    html[data-theme="light"] .hud-pred-lap-pill {
      background: #ffffff !important;
      border: 1px solid rgba(15, 23, 42, 0.15) !important;
      color: #475569 !important;
    }
    html[data-theme="light"] .hud-pred-lap-pill span {
      color: #0284c7 !important;
    }
    html[data-theme="light"] .hud-big-lap-time {
      color: #0284c7 !important;
      text-shadow: 0 2px 8px rgba(2, 132, 199, 0.22) !important;
    }
    html[data-theme="light"] .pit-big-countdown {
      color: #d97706 !important;
      text-shadow: 0 2px 8px rgba(217, 119, 6, 0.22) !important;
    }
    html[data-theme="light"] .pit-status-alert {
      color: #0f172a !important;
    }
    html[data-theme="light"] .pit-status-alert .pit-alert-dist {
      color: #0284c7 !important;
    }
    html[data-theme="light"] .pit-release-flash .pit-big-countdown {
      color: #059669 !important;
      text-shadow: 0 2px 8px rgba(5, 150, 105, 0.25) !important;
    }
    html[data-theme="light"] .pit-release-flash .pit-status-alert {
      color: #059669 !important;
    }
    html[data-theme="light"] #lap-sim-speed-badge,
    html[data-theme="light"] #pit-sim-speed-badge,
    html[data-theme="light"] #pit-sim-speed-top-badge {
      background: #e0f2fe !important;
      border-color: #0284c7 !important;
      color: #0284c7 !important;
      font-weight: 800 !important;
    }

    /* Session Performance Analysis Modal (Mobile & Light Mode Optimized) */
    #modal-session-detail .modal-card {
      max-width: 540px;
      width: 100%;
    }
    #modal-session-detail .modal-body {
      display: flex;
      flex-direction: column;
      gap: 0.65rem;
      padding: 0.9rem 1.1rem;
    }
    .sda-top-header {
      display: flex;
      flex-direction: column;
      gap: 0.6rem;
      border-bottom: 1px solid var(--border-subtle);
      padding-bottom: 0.65rem;
    }
    .sda-track-title {
      font-family: var(--font-display);
      font-size: 1.08rem;
      color: #ffffff;
      display: flex;
      align-items: center;
      gap: 0.4rem;
      flex-wrap: wrap;
      margin: 0;
      line-height: 1.25;
    }
    .sda-sub-meta {
      font-size: 0.78rem;
      color: var(--text-muted);
      margin: 0.2rem 0 0 0;
    }
    .sda-kpi-grid {
      display: grid;
      grid-template-columns: repeat(4, 1fr);
      gap: 0.45rem;
      width: 100%;
      box-sizing: border-box;
    }
    .sda-kpi-box {
      background: rgba(255, 255, 255, 0.03);
      border: 1px solid var(--border-subtle);
      border-radius: 8px;
      padding: 0.45rem 0.65rem;
      display: flex;
      flex-direction: column;
      gap: 0.1rem;
      min-width: 0;
      box-sizing: border-box;
      overflow: hidden;
    }
    .sda-kpi-label {
      font-size: 0.72rem;
      color: var(--text-dim);
      text-transform: uppercase;
      font-weight: 700;
      letter-spacing: 0.4px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .sda-kpi-val {
      font-family: var(--font-mono);
      font-size: 1.18rem;
      font-weight: 900;
      line-height: 1.15;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .sda-kpi-val.best-lap { color: var(--accent-green); }
    .sda-kpi-val.top-speed { color: var(--accent-cyan); }
    .sda-psi-container {
      margin: 0 !important;
      padding: 0.65rem !important;
    }
    .sda-psi-line {
      font-family: var(--font-mono);
      font-size: 0.78rem;
      margin-top: 0.18rem;
      color: var(--text-main);
      white-space: nowrap;
    }
    .sda-hot-psi {
      color: var(--accent-amber);
      font-weight: 700;
    }
    .sda-specs-box {
      background: rgba(0, 0, 0, 0.3);
      padding: 0.7rem 0.8rem;
      border-radius: var(--radius-sm);
      border: 1px solid var(--border-subtle);
      display: flex;
      flex-direction: column;
      gap: 0.5rem;
      font-size: 0.82rem;
    }
    .sda-specs-grid {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 0.45rem;
    }
    .sda-spec-item {
      display: flex;
      flex-direction: column;
      gap: 0.1rem;
    }
    .sda-spec-label {
      font-size: 0.72rem;
      color: var(--text-dim);
      text-transform: uppercase;
      font-weight: 700;
    }
    .sda-spec-val {
      font-family: var(--font-mono);
      font-size: 0.8rem;
      font-weight: 600;
      color: var(--text-main);
    }
    .sda-notes-content {
      background: rgba(255, 255, 255, 0.03);
      padding: 0.45rem 0.6rem;
      border-radius: 6px;
      color: #f1f5f9;
      line-height: 1.4;
      font-size: 0.8rem;
      border: 1px solid rgba(255, 255, 255, 0.05);
      word-break: break-word;
    }
    .sda-actions-bar {
      display: grid;
      grid-template-columns: 1.3fr 1fr 0.8fr;
      gap: 0.4rem;
      padding-top: 0.25rem;
    }
    .sda-actions-bar .btn {
      justify-content: center;
      padding: 0.48rem 0.4rem;
      font-size: 0.76rem;
      white-space: nowrap;
    }
    .sda-btn-vbo {
      color: var(--accent-cyan) !important;
      border-color: rgba(0, 240, 255, 0.45) !important;
      font-weight: 700 !important;
    }
    .sda-btn-share {
      color: var(--accent-green) !important;
      border-color: rgba(0, 230, 118, 0.45) !important;
      font-weight: 700 !important;
    }
    html[data-theme="light"] .sda-track-title {
      color: #0f172a !important;
    }
    html[data-theme="light"] .sda-kpi-box {
      background: #f8fafc !important;
      border-color: rgba(15, 23, 42, 0.12) !important;
    }
    html[data-theme="light"] .sda-kpi-val.best-lap {
      color: #059669 !important;
    }
    html[data-theme="light"] .sda-kpi-val.total-laps {
      color: #b45309 !important;
    }
    html[data-theme="light"] .sda-kpi-val.total-laps small {
      color: #64748b !important;
    }
    html[data-theme="light"] .sda-kpi-val.top-speed {
      color: #0284c7 !important;
    }
    html[data-theme="light"] .sda-psi-line {
      color: #334155 !important;
    }
    html[data-theme="light"] .sda-hot-psi {
      color: #d97706 !important;
    }
    html[data-theme="light"] .sda-specs-box {
      background: #f8fafc !important;
      border-color: rgba(15, 23, 42, 0.12) !important;
    }
    html[data-theme="light"] .sda-spec-val {
      color: #0f172a !important;
    }
    html[data-theme="light"] .sda-notes-content {
      background: #ffffff !important;
      color: #1e293b !important;
      border-color: rgba(15, 23, 42, 0.1) !important;
    }
    html[data-theme="light"] .sda-btn-vbo {
      color: #0284c7 !important;
      border-color: rgba(2, 132, 199, 0.4) !important;
      background: #f0f9ff !important;
    }
    html[data-theme="light"] .sda-btn-share {
      color: #059669 !important;
      border-color: rgba(5, 150, 105, 0.4) !important;
      background: #ecfdf5 !important;
    }

    /* Light Mode Overrides for 4-Wheel Pressure Telemetry in Session Detail */
    html[data-theme="light"] #modal-session-detail .mobile-car-setup-container {
      background: #f8fafc !important;
      border: 1px solid rgba(15, 23, 42, 0.12) !important;
      box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04) !important;
    }
    html[data-theme="light"] #modal-session-detail .car-setup-header {
      border-bottom: 1px solid rgba(15, 23, 42, 0.08) !important;
    }
    html[data-theme="light"] #modal-session-detail .car-setup-title {
      color: #0284c7 !important;
      font-weight: 800 !important;
    }
    html[data-theme="light"] #modal-session-detail .wheel-box {
      background: #ffffff !important;
      border: 1px solid rgba(15, 23, 42, 0.14) !important;
      box-shadow: 0 1px 4px rgba(15, 23, 42, 0.04) !important;
    }
    html[data-theme="light"] #modal-session-detail .wheel-id-badge {
      font-weight: 700 !important;
    }
    html[data-theme="light"] #modal-session-detail .wheel-id-badge.fl,
    html[data-theme="light"] #modal-session-detail .wheel-id-badge.fr {
      color: #0284c7 !important;
    }
    html[data-theme="light"] #modal-session-detail .wheel-id-badge.rl,
    html[data-theme="light"] #modal-session-detail .wheel-id-badge.rr {
      color: #dc2626 !important;
    }
    html[data-theme="light"] #modal-session-detail .sda-psi-line {
      color: #1e293b !important;
      font-weight: 600 !important;
    }
    html[data-theme="light"] #modal-session-detail .sda-hot-psi {
      color: #d97706 !important;
      font-weight: 800 !important;
    }
    html[data-theme="light"] #modal-session-detail .car-spine-line {
      background: rgba(15, 23, 42, 0.15) !important;
    }
    html[data-theme="light"] #modal-session-detail .car-chassis-badge,
    html[data-theme="light"] #modal-session-detail .car-exhaust-badge {
      background: #f1f5f9 !important;
      color: #475569 !important;
      border: 1px solid rgba(15, 23, 42, 0.14) !important;
    }

    @media (max-width: 768px) {
      #modal-session-detail.active {
        padding: 0 !important;
        padding-top: max(env(safe-area-inset-top, 0px), 28px) !important;
        box-sizing: border-box !important;
      }
      #modal-session-detail .modal-card {
        max-height: calc(100dvh - max(env(safe-area-inset-top, 0px), 28px) - 8px) !important;
        max-height: calc(100vh - max(env(safe-area-inset-top, 0px), 28px) - 8px) !important;
        border-radius: 16px 16px 0 0 !important;
      }
      #modal-session-detail .modal-drag-indicator {
        display: block !important;
        width: 38px !important;
        height: 4px !important;
        border-radius: 2px !important;
        background: rgba(255, 255, 255, 0.25) !important;
        margin: 10px auto 4px auto !important;
        flex-shrink: 0 !important;
      }
      #modal-session-detail .modal-header {
        position: sticky !important;
        top: 0 !important;
        z-index: 25 !important;
        padding: 0.75rem 1rem !important;
        min-height: 52px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        background: var(--bg-surface, #0d121c) !important;
        border-bottom: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08)) !important;
        box-sizing: border-box !important;
        flex-shrink: 0 !important;
      }
      #modal-session-detail .modal-title {
        font-size: 1.12rem !important;
        font-weight: 800 !important;
        line-height: 1.35 !important;
        display: flex !important;
        align-items: center !important;
        gap: 0.5rem !important;
        color: var(--text-main, #ffffff) !important;
        margin: 0 !important;
        min-width: 0 !important;
        flex: 1 1 auto !important;
        padding: 2px 0 !important;
      }
      #modal-session-detail .modal-close-btn {
        min-width: 34px !important;
        min-height: 34px !important;
        width: 34px !important;
        height: 34px !important;
        border-radius: 8px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex-shrink: 0 !important;
        margin-right: 0 !important;
        padding: 0 !important;
        color: var(--text-muted, #94a3b8) !important;
        background: rgba(255, 255, 255, 0.05) !important;
        border: 1px solid rgba(255, 255, 255, 0.1) !important;
        cursor: pointer !important;
      }
      #modal-session-detail .modal-close-btn:hover,
      #modal-session-detail .modal-close-btn:active {
        background: rgba(255, 255, 255, 0.12) !important;
        color: #ffffff !important;
      }
      #modal-session-detail .modal-body {
        padding: 0.75rem 0.85rem !important;
        gap: 0.55rem !important;
      }
      #modal-session-detail .modal-footer {
        padding: 0.65rem 0.85rem calc(0.65rem + env(safe-area-inset-bottom)) !important;
      }
      .sda-top-header {
        gap: 0.45rem !important;
        padding-bottom: 0.5rem !important;
      }
      .sda-track-title {
        font-size: 0.98rem !important;
      }
      .sda-sub-meta {
        font-size: 0.74rem !important;
      }
      .sda-kpi-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.45rem !important;
      }
      .sda-kpi-box {
        padding: 0.42rem 0.55rem !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
      }
      .sda-kpi-val {
        font-size: 1.12rem !important;
      }
      #modal-session-detail .car-axle-row {
        grid-template-columns: 1fr 34px 1fr !important;
        gap: 0.35rem !important;
      }
      #modal-session-detail .wheel-box {
        padding: 0.45rem 0.5rem !important;
      }
      .sda-psi-line {
        font-size: 0.72rem !important;
      }
      .sda-specs-box {
        padding: 0.55rem 0.65rem !important;
        gap: 0.4rem !important;
      }
      .sda-specs-grid {
        gap: 0.4rem !important;
      }
      .sda-spec-val {
        font-size: 0.78rem !important;
      }
      .sda-notes-content {
        padding: 0.38rem 0.5rem !important;
        font-size: 0.76rem !important;
      }
      .sda-actions-bar {
        grid-template-columns: 1.25fr 1fr 0.8fr !important;
        gap: 0.35rem !important;
      }
      .sda-actions-bar .btn {
        padding: 0.45rem 0.3rem !important;
        font-size: 0.74rem !important;
      }
    }

    @media (max-width: 480px) {
      #modal-session-detail .modal-body {
        padding: 0.65rem 0.75rem !important;
        gap: 0.5rem !important;
      }
      .sda-track-title {
        font-size: 0.94rem !important;
      }
      .sda-kpi-grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 0.35rem !important;
      }
      .sda-kpi-box {
        padding: 0.38rem 0.45rem !important;
        min-width: 0 !important;
        box-sizing: border-box !important;
        overflow: hidden !important;
      }
      .sda-kpi-label {
        font-size: 0.65rem !important;
      }
      .sda-kpi-val {
        font-size: 1.05rem !important;
      }
      #modal-session-detail .car-axle-row {
        grid-template-columns: 1fr 32px 1fr !important;
        gap: 0.25rem !important;
      }
      #modal-session-detail .wheel-box {
        padding: 0.4rem 0.42rem !important;
      }
      .sda-psi-line {
        font-size: 0.72rem !important;
      }
      .sda-actions-bar {
        grid-template-columns: 1fr 1fr !important;
        gap: 0.35rem !important;
      }
      .sda-btn-vbo {
        grid-column: 1 / -1 !important;
      }
    }

    /* Predictive Delta Bar */
    html[data-theme="light"] .predictive-delta-bar-wrap {
      background: #e2e8f0 !important;
      border: 1px solid rgba(15, 23, 42, 0.14) !important;
      box-shadow: inset 0 1px 3px rgba(15, 23, 42, 0.1) !important;
    }
    html[data-theme="light"] .pred-bar-center-pin {
      background: #0f172a !important;
    }
    html[data-theme="light"] .pred-bar-scale-labels span {
      color: #475569 !important;
    }
    html[data-theme="light"] .pred-scale-btn {
      background: #ffffff !important;
      border-color: rgba(15, 23, 42, 0.15) !important;
      color: #475569 !important;
    }
    html[data-theme="light"] .pred-scale-btn.active {
      background: #0284c7 !important;
      color: #ffffff !important;
      border-color: #0284c7 !important;
    }
    html[data-theme="light"] .hud-delta-sub {
      color: #64748b !important;
    }

    /* Stats Grid (SPEED, BEST LAP, LAST LAP) */
    html[data-theme="light"] .hud-stat-tile {
      background: #ffffff !important;
      border: 1px solid rgba(15, 23, 42, 0.1) !important;
      box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04) !important;
    }
    html[data-theme="light"] .hud-stat-label {
      color: #64748b !important;
      font-weight: 600 !important;
    }
    html[data-theme="light"] .hud-stat-val {
      color: #0f172a !important;
    }

    /* GPS Telemetry Diagnostics Strip */
    html[data-theme="light"] .hud-diag-strip {
      background: #f8fafc !important;
      border: 1px solid rgba(15, 23, 42, 0.1) !important;
      color: #475569 !important;
    }
    html[data-theme="light"] .hud-diag-badges {
      border-top: 1px solid rgba(15, 23, 42, 0.08) !important;
    }

    /* Pit Timer Target Toolbar & Nodes */
    html[data-theme="light"] .pit-target-toolbar {
      background: #f8fafc !important;
      border: 1px solid rgba(15, 23, 42, 0.08) !important;
    }
    html[data-theme="light"] .pit-target-label {
      color: #0f172a !important;
    }
    html[data-theme="light"] .pit-target-chip {
      background: #ffffff !important;
      border: 1px solid rgba(15, 23, 42, 0.15) !important;
      color: #334155 !important;
    }
    html[data-theme="light"] .pit-target-chip.active {
      background: #d97706 !important;
      color: #ffffff !important;
      border-color: #d97706 !important;
    }
    /* Pit Timer: 3-Gate Flow Sequence Bar */
    html[data-theme="light"] .pit-gates-flow {
      background: #f8fafc !important;
      border: 1px solid rgba(15, 23, 42, 0.09) !important;
      border-radius: var(--radius-md) !important;
      box-shadow: inset 0 1px 3px rgba(15, 23, 42, 0.03) !important;
      padding: 0.75rem 1rem !important;
    }
    html[data-theme="light"] .pit-gate-node {
      background: #ffffff !important;
      border: 1px solid rgba(15, 23, 42, 0.12) !important;
      border-radius: var(--radius-sm) !important;
      box-shadow: 0 2px 6px rgba(15, 23, 42, 0.05) !important;
      padding: 0.45rem 0.65rem !important;
      color: #334155 !important;
    }
    html[data-theme="light"] .pit-gate-node span {
      color: #0f172a !important;
      font-weight: 700 !important;
    }
    html[data-theme="light"] .pit-gate-node .pit-node-sub {
      color: #64748b !important;
      font-weight: 600 !important;
    }
    html[data-theme="light"] .pit-gate-icon-circle {
      background: #f1f5f9 !important;
      border: 1px solid rgba(15, 23, 42, 0.12) !important;
      color: #475569 !important;
    }
    html[data-theme="light"] .pit-gate-node.active {
      background: #f0f9ff !important;
      border-color: #0284c7 !important;
      box-shadow: 0 0 0 1px #0284c7, 0 4px 12px rgba(2, 132, 199, 0.15) !important;
    }
    html[data-theme="light"] .pit-gate-node.active span {
      color: #0284c7 !important;
      font-weight: 800 !important;
    }
    html[data-theme="light"] .pit-gate-node.active .pit-node-sub {
      color: #0369a1 !important;
      font-weight: 700 !important;
    }
    html[data-theme="light"] .pit-gate-node.active .pit-gate-icon-circle {
      background: #0284c7 !important;
      border-color: #0284c7 !important;
      color: #ffffff !important;
      box-shadow: 0 0 10px rgba(2, 132, 199, 0.25) !important;
    }
    html[data-theme="light"] .pit-gate-node.passed {
      background: #f0fdf4 !important;
      border-color: #059669 !important;
      box-shadow: 0 2px 6px rgba(5, 150, 105, 0.1) !important;
    }
    html[data-theme="light"] .pit-gate-node.passed span {
      color: #059669 !important;
      font-weight: 800 !important;
    }
    html[data-theme="light"] .pit-gate-node.passed .pit-node-sub {
      color: #047857 !important;
      font-weight: 700 !important;
    }
    html[data-theme="light"] .pit-gate-node.passed .pit-gate-icon-circle {
      background: #059669 !important;
      border-color: #059669 !important;
      color: #ffffff !important;
    }
    html[data-theme="light"] .pit-flow-arrow {
      color: #94a3b8 !important;
      font-weight: 700 !important;
    }

    /* History Cards in Timers */
    html[data-theme="light"] .lap-history-card,
    html[data-theme="light"] .pit-history-card {
      background: #ffffff !important;
      border: 1px solid rgba(15, 23, 42, 0.1) !important;
      box-shadow: 0 4px 18px rgba(15, 23, 42, 0.04) !important;
    }
    html[data-theme="light"] .lap-history-title,
    html[data-theme="light"] .pit-history-title {
      color: #0f172a !important;
    }
    html[data-theme="light"] .modern-table th {
      background: #f1f5f9 !important;
      color: #0f172a !important;
      border-bottom: 2px solid rgba(15, 23, 42, 0.08) !important;
    }
    html[data-theme="light"] .modern-table td {
      color: #1e293b !important;
      border-bottom: 1px solid rgba(15, 23, 42, 0.06) !important;
    }

        /* --- LIGHT THEME: SESSION LOGS & TELEMETRY SHOWCASE OVERRIDES --- */
    html[data-theme="light"] .batch-visibility-panel {
      background: #ffffff !important;
      border: 1px solid rgba(15, 23, 42, 0.12) !important;
      box-shadow: 0 4px 20px rgba(15, 23, 42, 0.05) !important;
    }
    html[data-theme="light"] .batch-visibility-title {
      color: #0f172a !important;
    }
    html[data-theme="light"] .batch-visibility-desc {
      color: #475569 !important;
    }
    html[data-theme="light"] .batch-vis-btn {
      background: #ffffff !important;
      border: 1px solid rgba(15, 23, 42, 0.16) !important;
      color: #475569 !important;
    }
    html[data-theme="light"] .batch-vis-btn .batch-vis-icon {
      color: inherit;
    }
    html[data-theme="light"] .batch-vis-btn.public .batch-vis-icon {
      color: #0284c7;
    }
    html[data-theme="light"] .batch-vis-btn.friends .batch-vis-icon {
      color: #d97706;
    }
    html[data-theme="light"] .batch-vis-btn.private .batch-vis-icon {
      color: #64748b;
    }
    html[data-theme="light"] .batch-vis-btn.manage-friends .batch-vis-icon {
      color: #b45309;
    }

    html[data-theme="light"] .batch-vis-btn.public:hover {
      background: #f0f9ff !important;
      border-color: #0284c7 !important;
      color: #0284c7 !important;
    }
    html[data-theme="light"] .batch-vis-btn.friends:hover {
      background: #fffbeb !important;
      border-color: #d97706 !important;
      color: #d97706 !important;
    }
    html[data-theme="light"] .batch-vis-btn.private:hover {
      background: #fff1f2 !important;
      border-color: #e11d48 !important;
      color: #e11d48 !important;
    }

    html[data-theme="light"] .batch-vis-btn.active.public {
      background: #e0f2fe !important;
      border: 1.5px solid #0284c7 !important;
      color: #0369a1 !important;
      box-shadow: 0 2px 10px rgba(2, 132, 199, 0.28) !important;
      font-weight: 800 !important;
    }
    html[data-theme="light"] .batch-vis-btn.active.public .batch-vis-icon {
      color: #0284c7 !important;
    }

    html[data-theme="light"] .batch-vis-btn.active.friends {
      background: #fef3c7 !important;
      border: 1.5px solid #d97706 !important;
      color: #b45309 !important;
      box-shadow: 0 2px 10px rgba(217, 119, 6, 0.28) !important;
      font-weight: 800 !important;
    }
    html[data-theme="light"] .batch-vis-btn.active.friends .batch-vis-icon {
      color: #d97706 !important;
    }

    html[data-theme="light"] .batch-vis-btn.active.private {
      background: #ffe4e6 !important;
      border: 1.5px solid #e11d48 !important;
      color: #be123c !important;
      box-shadow: 0 2px 10px rgba(225, 29, 72, 0.28) !important;
      font-weight: 800 !important;
    }
    html[data-theme="light"] .batch-vis-btn.active.private .batch-vis-icon {
      color: #e11d48 !important;
    }

    html[data-theme="light"] .batch-vis-btn.manage-friends {
      background: #fffbeb !important;
      border: 1px solid rgba(217, 119, 6, 0.35) !important;
      color: #b45309 !important;
    }
    html[data-theme="light"] .batch-vis-btn.manage-friends:hover {
      background: #fef3c7 !important;
      border-color: #d97706 !important;
      color: #92400e !important;
      box-shadow: 0 2px 8px rgba(217, 119, 6, 0.2) !important;
    }
    html[data-theme="light"] .btn-manage-friends {
      background: #fffbeb !important;
      border: 1px solid rgba(217, 119, 6, 0.35) !important;
      color: #b45309 !important;
    }
    html[data-theme="light"] .btn-manage-friends:hover {
      background: #fef3c7 !important;
      box-shadow: 0 0 10px rgba(217, 119, 6, 0.25) !important;
    }

    /* Session Card Visibility Pills Light Theme */
    html[data-theme="light"] .session-vis-selector {
      background: #f1f5f9 !important;
      border: 1px solid rgba(15, 23, 42, 0.14) !important;
    }
    html[data-theme="light"] .session-vis-bar {
      border-top: 1px dashed rgba(15, 23, 42, 0.12) !important;
    }
    html[data-theme="light"] .vis-pill {
      color: #64748b !important;
    }
    html[data-theme="light"] .vis-pill:hover {
      color: #0f172a !important;
      background: rgba(15, 23, 42, 0.06) !important;
    }
    html[data-theme="light"] .vis-pill.active.public {
      background: #e0f2fe !important;
      color: #0369a1 !important;
      border: 1px solid rgba(2, 132, 199, 0.4) !important;
      box-shadow: 0 1px 4px rgba(2, 132, 199, 0.25) !important;
      font-weight: 800 !important;
    }
    html[data-theme="light"] .vis-pill.active.public i {
      color: #0284c7 !important;
    }
    html[data-theme="light"] .vis-pill.active.friends {
      background: #fef3c7 !important;
      color: #b45309 !important;
      border: 1px solid rgba(217, 119, 6, 0.4) !important;
      box-shadow: 0 1px 4px rgba(217, 119, 6, 0.25) !important;
      font-weight: 800 !important;
    }
    html[data-theme="light"] .vis-pill.active.friends i {
      color: #d97706 !important;
    }
    html[data-theme="light"] .vis-pill.active.private {
      background: #ffe4e6 !important;
      color: #be123c !important;
      border: 1px solid rgba(225, 29, 72, 0.4) !important;
      box-shadow: 0 1px 4px rgba(225, 29, 72, 0.25) !important;
      font-weight: 800 !important;
    }
    html[data-theme="light"] .vis-pill.active.private i {
      color: #e11d48 !important;
    }

    /* Live Telemetry Showcase Card */
    html[data-theme="light"] .live-telemetry-feature-card {
      background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%) !important;
      border: 1px solid rgba(2, 132, 199, 0.25) !important;
      box-shadow: 0 10px 30px rgba(15, 23, 42, 0.07), 0 0 20px rgba(2, 132, 199, 0.05) !important;
    }
    html[data-theme="light"] .live-telemetry-feature-card:hover {
      border-color: rgba(2, 132, 199, 0.45) !important;
      box-shadow: 0 14px 38px rgba(15, 23, 42, 0.1), 0 0 28px rgba(2, 132, 199, 0.1) !important;
    }
    html[data-theme="light"] .ltf-glow-edge {
      background: linear-gradient(90deg, transparent, #0284c7, #e11d48, transparent) !important;
      opacity: 0.8 !important;
    }
    html[data-theme="light"] .ltf-badge {
      background: rgba(225, 29, 72, 0.08) !important;
      border: 1px solid rgba(225, 29, 72, 0.3) !important;
      color: #e11d48 !important;
    }
    html[data-theme="light"] .ltf-pulse-dot {
      background: #e11d48 !important;
      box-shadow: 0 0 6px #e11d48 !important;
    }
    html[data-theme="light"] .ltf-main-title {
      color: #0f172a !important;
    }
    html[data-theme="light"] .ltf-description {
      color: #475569 !important;
    }
    html[data-theme="light"] .ltf-features-grid {
      border-top: 1px solid rgba(15, 23, 42, 0.08) !important;
    }
    html[data-theme="light"] .ltf-feat-item {
      background: #f8fafc !important;
      border: 1px solid rgba(15, 23, 42, 0.08) !important;
      box-shadow: 0 2px 6px rgba(15, 23, 42, 0.03) !important;
    }
    html[data-theme="light"] .ltf-feat-content h4 {
      color: #0f172a !important;
    }
    html[data-theme="light"] .ltf-feat-content p {
      color: #475569 !important;
    }
    html[data-theme="light"] .ltf-gallery-item {
      background: #ffffff !important;
      border: 1px solid rgba(15, 23, 42, 0.1) !important;
      box-shadow: 0 4px 16px rgba(15, 23, 42, 0.06) !important;
    }
    html[data-theme="light"] .ltf-gallery-item:hover {
      border-color: rgba(2, 132, 199, 0.4) !important;
      box-shadow: 0 8px 24px rgba(15, 23, 42, 0.1) !important;
    }
    html[data-theme="light"] .ltf-gallery-caption {
      background: #f8fafc !important;
      border-top: 1px solid rgba(15, 23, 42, 0.08) !important;
    }
    html[data-theme="light"] .ltf-gallery-caption h5 {
      color: #0f172a !important;
    }
    html[data-theme="light"] .ltf-gallery-caption p {
      color: #475569 !important;
    }

    /* Stats Overview Banner (Laps, Tracks, Track Time) */
    html[data-theme="light"] .stat-banner-card {
      background: #ffffff !important;
      border: 1px solid rgba(15, 23, 42, 0.1) !important;
      box-shadow: 0 2px 8px rgba(15, 23, 42, 0.04) !important;
    }
    html[data-theme="light"] .stat-banner-label {
      color: #64748b !important;
    }
    html[data-theme="light"] .stat-banner-val {
      color: #0f172a !important;
    }

    /* Session Log Cards & Sub-components */
    html[data-theme="light"] .session-card {
      background: #ffffff !important;
      border: 1px solid rgba(15, 23, 42, 0.1) !important;
      box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04) !important;
    }
    html[data-theme="light"] .session-card:hover {
      background: #f8fafc !important;
      border-color: rgba(2, 132, 199, 0.35) !important;
      box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08) !important;
    }
    html[data-theme="light"] .session-date-badge {
      background: rgba(15, 23, 42, 0.05) !important;
      color: #475569 !important;
      border: 1px solid rgba(15, 23, 42, 0.08) !important;
    }
    html[data-theme="light"] .session-vehicle-inline {
      background: rgba(15, 23, 42, 0.04) !important;
      color: #1e293b !important;
      border: 1px solid rgba(15, 23, 42, 0.08) !important;
    }
    html[data-theme="light"] .session-perf-banner {
      background: #f8fafc !important;
      border: 1px solid rgba(15, 23, 42, 0.08) !important;
    }
    html[data-theme="light"] .session-perf-divider {
      background: rgba(15, 23, 42, 0.1) !important;
    }
    html[data-theme="light"] .session-perf-label {
      color: #64748b !important;
    }
    html[data-theme="light"] .session-perf-val.best-lap-time {
      color: #0284c7 !important;
    }
    html[data-theme="light"] .session-perf-val.total-laps-val {
      color: #0f172a !important;
      text-shadow: none !important;
    }
    html[data-theme="light"] .session-perf-val.total-laps-val small,
    html[data-theme="light"] .session-perf-val.total-laps-val .total-laps-unit {
      color: #64748b !important;
    }
    html[data-theme="light"] .session-perf-val.top-speed-val {
      color: #d97706 !important;
    }
    html[data-theme="light"] .tire-psi-mini-grid {
      background: #f8fafc !important;
      border: 1px solid rgba(15, 23, 42, 0.08) !important;
    }
    html[data-theme="light"] .tire-psi-cell {
      background: #ffffff !important;
      border: 1px solid rgba(15, 23, 42, 0.06) !important;
    }
    html[data-theme="light"] .tire-wheel-tag {
      color: #64748b !important;
    }
    html[data-theme="light"] .tire-psi-val {
      color: #0f172a !important;
    }
    html[data-theme="light"] .session-notes-box {
      background: #f8fafc !important;
      border: 1px solid rgba(15, 23, 42, 0.08) !important;
      color: #334155 !important;
    }
    html[data-theme="light"] .session-actions-bar {
      border-top: 1px solid rgba(15, 23, 42, 0.08) !important;
    }
    html[data-theme="light"] .session-locked-badge {
      background: #fef3c7 !important;
      color: #92400e !important;
      border-color: rgba(217, 119, 6, 0.35) !important;
    }
    html[data-theme="light"] .btn-session-lock-top {
      background: #f1f5f9 !important;
      border-color: rgba(15, 23, 42, 0.15) !important;
      color: #64748b !important;
    }
    html[data-theme="light"] .btn-session-lock-top:hover {
      background: #fffbeb !important;
      border-color: rgba(217, 119, 6, 0.35) !important;
      color: #b45309 !important;
    }
    html[data-theme="light"] .btn-session-lock-top.locked {
      background: #fef3c7 !important;
      border-color: rgba(217, 119, 6, 0.4) !important;
      color: #b45309 !important;
    }
    html[data-theme="light"] .session-vis-selector {
      background: #f1f5f9 !important;
      border: 1px solid rgba(15, 23, 42, 0.12) !important;
    }
    html[data-theme="light"] .empty-state-box {
      background: #ffffff !important;
      border: 1px dashed rgba(15, 23, 42, 0.2) !important;
    }
    html[data-theme="light"] .empty-state-box h3 {
      color: #0f172a !important;
    }
    html[data-theme="light"] .empty-state-box p {
      color: #475569 !important;
    }

    /* SEO Platform Overview Section */
    html[data-theme="light"] .seo-platform-info {
      background: #ffffff !important;
      border: 1px solid rgba(15, 23, 42, 0.1) !important;
      box-shadow: 0 4px 20px rgba(15, 23, 42, 0.04) !important;
    }
    html[data-theme="light"] .seo-info-badge {
      background: rgba(2, 132, 199, 0.08) !important;
      border: 1px solid rgba(2, 132, 199, 0.25) !important;
      color: #0284c7 !important;
    }
    html[data-theme="light"] .seo-info-title {
      color: #0f172a !important;
    }
    html[data-theme="light"] .seo-info-desc {
      color: #475569 !important;
    }
    html[data-theme="light"] .seo-feature-card {
      background: #f8fafc !important;
      border: 1px solid rgba(15, 23, 42, 0.08) !important;
    }
    html[data-theme="light"] .seo-feature-card h3 {
      color: #0f172a !important;
    }
    html[data-theme="light"] .seo-feature-card p {
      color: #475569 !important;
    }
    html[data-theme="light"] .seo-faq-section {
      border-top: 1px solid rgba(15, 23, 42, 0.08) !important;
    }
    html[data-theme="light"] .seo-faq-summary {
      background: #f8fafc !important;
      color: #0f172a !important;
      border: 1px solid rgba(15, 23, 42, 0.08) !important;
    }
    html[data-theme="light"] .seo-faq-answer {
      color: #334155 !important;
      background: #ffffff !important;
    }

        /* --- LIGHT THEME: LAP TIMER & PIT TIMER HISTORY LOGS (LHM / PHM) --- */
    html[data-theme="light"] .lap-history-card,
    html[data-theme="light"] .pit-history-card {
      background: #ffffff !important;
      border: 1px solid rgba(15, 23, 42, 0.12) !important;
      box-shadow: 0 4px 18px rgba(15, 23, 42, 0.04) !important;
    }

    html[data-theme="light"] .lap-history-title,
    html[data-theme="light"] .pit-history-title {
      color: #0f172a !important;
    }

    html[data-theme="light"] .lap-history-header-box .btn-outline,
    html[data-theme="light"] .pit-history-header-box .btn-outline {
      background: #ffffff !important;
      border: 1px solid rgba(15, 23, 42, 0.15) !important;
      color: #475569 !important;
    }
    html[data-theme="light"] .lap-history-header-box .btn-outline:hover,
    html[data-theme="light"] .pit-history-header-box .btn-outline:hover {
      background: #f1f5f9 !important;
      color: #0f172a !important;
    }

    /* Individual Lap & Pit Run Cards (Deck items) */
    html[data-theme="light"] .lhm-card,
    html[data-theme="light"] .phm-card {
      background: #ffffff !important;
      border: 1px solid rgba(15, 23, 42, 0.12) !important;
      box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05) !important;
    }
    html[data-theme="light"] .lhm-card:hover,
    html[data-theme="light"] .phm-card:hover {
      border-color: rgba(2, 132, 199, 0.35) !important;
      box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08) !important;
    }
    html[data-theme="light"] .lhm-card::before {
      background: linear-gradient(180deg, #0284c7, #059669) !important;
    }
    html[data-theme="light"] .phm-card::before {
      background: linear-gradient(180deg, #d97706, #059669) !important;
    }
    html[data-theme="light"] .phm-card.penalty::before {
      background: linear-gradient(180deg, #e11d48, #d97706) !important;
    }

    /* Card Headers */
    html[data-theme="light"] .lhm-header,
    html[data-theme="light"] .phm-header {
      border-bottom: 1px solid rgba(15, 23, 42, 0.08) !important;
    }
    html[data-theme="light"] .lhm-circuit-name,
    html[data-theme="light"] .phm-circuit-name {
      color: #0f172a !important;
      font-weight: 700 !important;
    }
    html[data-theme="light"] .lhm-layout-name,
    html[data-theme="light"] .phm-circuit-title {
      color: #64748b !important;
    }
    html[data-theme="light"] .lhm-run-badge,
    html[data-theme="light"] .lhm-date-badge,
    html[data-theme="light"] .phm-date-badge {
      background: #f1f5f9 !important;
      color: #334155 !important;
      border: 1px solid rgba(15, 23, 42, 0.12) !important;
    }
    html[data-theme="light"] .lhm-time,
    html[data-theme="light"] .phm-time {
      color: #64748b !important;
    }

    /* Lap Times & Pit Duration */
    html[data-theme="light"] .lhm-best-time {
      color: #059669 !important;
      text-shadow: none !important;
    }
    html[data-theme="light"] .phm-pit-time {
      text-shadow: none !important;
    }
    html[data-theme="light"] .phm-card.legal .phm-pit-time {
      color: #d97706 !important;
    }
    html[data-theme="light"] .phm-card.penalty .phm-pit-time {
      color: #e11d48 !important;
    }

    /* Stat Chips (Laps, Speed, Last Lap) */
    html[data-theme="light"] .lhm-stat-chips,
    html[data-theme="light"] .phm-stat-chips {
      color: #64748b !important;
    }
    html[data-theme="light"] .lhm-stat-chip b,
    html[data-theme="light"] .phm-stat-chip b {
      color: #0f172a !important;
    }

    /* Status Tags (SIM STOP, SAVED, RESET, TAB EXIT) */
    html[data-theme="light"] .lap-status-tag {
      background: rgba(2, 132, 199, 0.08) !important;
      border: 1px solid rgba(2, 132, 199, 0.25) !important;
      color: #0284c7 !important;
    }
    html[data-theme="light"] .lap-status-tag.best {
      background: rgba(5, 150, 105, 0.1) !important;
      border: 1px solid rgba(5, 150, 105, 0.35) !important;
      color: #059669 !important;
      box-shadow: none !important;
    }
    html[data-theme="light"] .lap-status-tag.valid {
      background: rgba(2, 132, 199, 0.08) !important;
      border: 1px solid rgba(2, 132, 199, 0.3) !important;
      color: #0284c7 !important;
    }

    /* Action Buttons in Run Cards */
    html[data-theme="light"] .lhm-actions-inline .btn-outline,
    html[data-theme="light"] .phm-actions-inline .btn-outline {
      background: #f8fafc !important;
      border: 1px solid rgba(15, 23, 42, 0.15) !important;
      color: #334155 !important;
    }
    html[data-theme="light"] .lhm-actions-inline .btn-outline:hover,
    html[data-theme="light"] .phm-actions-inline .btn-outline:hover {
      background: #f1f5f9 !important;
      color: #0f172a !important;
    }

    /* Expanded Lap Detail Breakdown */
    html[data-theme="light"] .lhm-detail-container {
      background: #f8fafc !important;
      border: 1px solid rgba(16, 185, 129, 0.3) !important;
    }
    html[data-theme="light"] .lhm-detail-list > div {
      border-bottom: 1px solid rgba(15, 23, 42, 0.08) !important;
      color: #334155 !important;
    }
    html[data-theme="light"] .lhm-detail-list > div span[style*="color:#fff"] {
      color: #0f172a !important;
    }
    html[data-theme="light"] .lhm-detail-list > div span[style*="color:var(--text-dim)"] {
      color: #64748b !important;
    }

    /* Desktop fallback table rows */
    html[data-theme="light"] .lap-history-desktop-row td,
    html[data-theme="light"] .pit-history-desktop-row td {
      background: transparent !important;
      border-bottom: 1px solid rgba(15, 23, 42, 0.08) !important;
      color: #1e293b !important;
    }

    /* Podium Card Elements Defaults (Dark Mode) */
    .rank-podium-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 0.6rem;
    }
    .rank-podium-pos-badge {
      font-size: 1.35rem;
      display: inline-flex;
      align-items: center;
      gap: 0.35rem;
    }
    .rank-podium-card.p1 .rank-pos-tag {
      color: #ffd700;
      font-family: var(--font-display);
      font-size: 1.1rem;
    }
    .rank-podium-card.p2 .rank-pos-tag {
      color: #e2e8f0;
      font-family: var(--font-display);
      font-size: 1.1rem;
    }
    .rank-podium-card.p3 .rank-pos-tag {
      color: #cd7f32;
      font-family: var(--font-display);
      font-size: 1.1rem;
    }
    .rank-podium-time {
      font-size: 1.55rem;
      font-weight: 800;
      font-family: var(--font-mono);
      color: var(--accent-green);
      letter-spacing: -0.5px;
      margin-bottom: 0.25rem;
      line-height: 1.2;
    }
    .rank-podium-gap {
      font-size: 0.75rem;
      font-family: var(--font-mono);
      color: var(--text-dim);
      margin-bottom: 0.75rem;
    }
    .rank-podium-gap.leader {
      color: var(--accent-amber);
      font-weight: 700;
    }
    .rank-podium-meta {
      border-top: 1px solid rgba(255, 255, 255, 0.08);
      padding-top: 0.6rem;
      display: flex;
      flex-direction: column;
      gap: 0.25rem;
    }
    .rank-podium-driver {
      font-weight: 700;
      color: #fff;
      font-size: 0.88rem;
      display: flex;
      align-items: center;
    }
    .rank-driver-name {
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .rank-podium-vehicle {
      font-size: 0.75rem;
      color: var(--accent-cyan);
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }
    .rank-podium-track-row {
      font-size: 0.72rem;
      color: var(--text-dim);
      display: flex;
      justify-content: space-between;
      margin-top: 0.2rem;
    }
    .rank-driver-name-text {
      font-weight: 700;
      color: #fff;
    }
    .rank-track-name-text {
      font-weight: 600;
      color: var(--text-light);
    }

        /* --- LIGHT THEME: CIRCUIT LEADERBOARD & PODIUM CARDS HIGH-CONTRAST OVERRIDES --- */
    /* Podium Cards Container & General Card */
    html[data-theme="light"] .rank-podium-card {
      background: #ffffff !important;
      border: 1px solid rgba(15, 23, 42, 0.12) !important;
      box-shadow: 0 4px 18px rgba(15, 23, 42, 0.05) !important;
      color: #0f172a !important;
    }
    html[data-theme="light"] .rank-podium-card:hover {
      box-shadow: 0 10px 28px rgba(15, 23, 42, 0.09) !important;
    }

    /* P1 Card (Warm Gold Highlight) */
    html[data-theme="light"] .rank-podium-card.p1 {
      background: linear-gradient(180deg, #fefce8 0%, #ffffff 75%) !important;
      border: 1.5px solid rgba(234, 179, 8, 0.6) !important;
      box-shadow: 0 6px 22px rgba(234, 179, 8, 0.18), 0 2px 8px rgba(15, 23, 42, 0.04) !important;
    }
    html[data-theme="light"] .rank-podium-card.p1 .rank-pos-tag,
    html[data-theme="light"] .rank-podium-card.p1 strong {
      color: #b45309 !important;
      font-weight: 800 !important;
    }

    /* P2 Card (Crisp Silver Slate Highlight) */
    html[data-theme="light"] .rank-podium-card.p2 {
      background: linear-gradient(180deg, #f8fafc 0%, #ffffff 75%) !important;
      border: 1.5px solid rgba(148, 163, 184, 0.6) !important;
      box-shadow: 0 6px 22px rgba(148, 163, 184, 0.16), 0 2px 8px rgba(15, 23, 42, 0.04) !important;
    }
    html[data-theme="light"] .rank-podium-card.p2 .rank-pos-tag,
    html[data-theme="light"] .rank-podium-card.p2 strong {
      color: #334155 !important;
      font-weight: 800 !important;
    }

    /* P3 Card (Crisp Bronze Highlight) */
    html[data-theme="light"] .rank-podium-card.p3 {
      background: linear-gradient(180deg, #fff7ed 0%, #ffffff 75%) !important;
      border: 1.5px solid rgba(249, 115, 22, 0.55) !important;
      box-shadow: 0 6px 22px rgba(249, 115, 22, 0.14), 0 2px 8px rgba(15, 23, 42, 0.04) !important;
    }
    html[data-theme="light"] .rank-podium-card.p3 .rank-pos-tag,
    html[data-theme="light"] .rank-podium-card.p3 strong {
      color: #c2410c !important;
      font-weight: 800 !important;
    }

    /* Lap Time */
    html[data-theme="light"] .rank-podium-time {
      color: #059669 !important;
      font-weight: 800 !important;
    }

    /* Gap and Leader labels */
    html[data-theme="light"] .rank-podium-gap {
      color: #64748b !important;
    }
    html[data-theme="light"] .rank-podium-gap.leader {
      color: #d97706 !important;
      font-weight: 700 !important;
    }

    /* Divider and Meta */
    html[data-theme="light"] .rank-podium-meta {
      border-top: 1px solid rgba(15, 23, 42, 0.08) !important;
    }
    html[data-theme="light"] .rank-podium-driver,
    html[data-theme="light"] .rank-driver-name {
      color: #0f172a !important;
      font-weight: 700 !important;
    }
    html[data-theme="light"] .rank-driver-avatar {
      background: linear-gradient(135deg, rgba(2, 132, 199, 0.12), rgba(5, 150, 105, 0.12)) !important;
      border: 1px solid rgba(2, 132, 199, 0.3) !important;
      color: #0284c7 !important;
    }
    html[data-theme="light"] .rank-podium-vehicle {
      color: #0284c7 !important;
      font-weight: 600 !important;
    }
    html[data-theme="light"] .rank-podium-track {
      color: #475569 !important;
      font-weight: 500 !important;
    }
    html[data-theme="light"] .rank-podium-speed {
      color: #d97706 !important;
      font-weight: 700 !important;
    }

    /* Visibility Badge */
    html[data-theme="light"] .rank-badge {
      background: #f1f5f9 !important;
      border: 1px solid rgba(15, 23, 42, 0.14) !important;
      color: #0284c7 !important;
    }
    html[data-theme="light"] .rank-badge.friends {
      color: #0284c7 !important;
    }
    html[data-theme="light"] .rank-badge.public {
      color: #059669 !important;
    }
    html[data-theme="light"] .rank-badge.verified {
      background: rgba(16, 185, 129, 0.12) !important;
      border: 1px solid rgba(5, 150, 105, 0.45) !important;
      color: #059669 !important;
    }
    html[data-theme="light"] .badge-verified,
    html[data-theme="light"] .rank-verified-badge {
      background: linear-gradient(135deg, rgba(16, 185, 129, 0.15), rgba(5, 150, 105, 0.08)) !important;
      border-color: rgba(5, 150, 105, 0.45) !important;
      color: #059669 !important;
      box-shadow: 0 1px 4px rgba(5, 150, 105, 0.15) !important;
    }
    html[data-theme="light"] .badge-verified-svg,
    html[data-theme="light"] .badge-verified svg,
    html[data-theme="light"] .rank-verified-badge svg {
      color: #059669 !important;
    }
    html[data-theme="light"] .rank-verified-toggle-group {
      background: #f1f5f9 !important;
      border-color: #cbd5e1 !important;
    }
    html[data-theme="light"] .rank-verified-pill {
      color: #64748b !important;
    }
    html[data-theme="light"] .rank-verified-pill:hover {
      color: #0f172a !important;
      background: rgba(0, 0, 0, 0.04) !important;
    }
    html[data-theme="light"] .rank-verified-pill.active {
      background: #ffffff !important;
      color: #059669 !important;
      border-color: rgba(5, 150, 105, 0.4) !important;
      box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08) !important;
    }
    html[data-theme="light"] .rank-verified-pill.active svg {
      color: #059669 !important;
    }
    html[data-theme="light"] .session-verified-banner {
      background: rgba(16, 185, 129, 0.08) !important;
      border-color: rgba(5, 150, 105, 0.3) !important;
      color: #0f172a !important;
    }
    html[data-theme="light"] .session-verified-badge {
      color: #059669 !important;
    }
    html[data-theme="light"] .session-verified-desc {
      color: #475569 !important;
    }

    /* Leaderboard Table Card */
    html[data-theme="light"] .rank-card {
      background: #ffffff !important;
      border: 1px solid rgba(15, 23, 42, 0.12) !important;
      box-shadow: 0 4px 18px rgba(15, 23, 42, 0.04) !important;
    }
    html[data-theme="light"] .rank-card-header {
      background: #f8fafc !important;
      border-bottom: 1px solid rgba(15, 23, 42, 0.08) !important;
    }
    html[data-theme="light"] .rank-card-title {
      color: #0f172a !important;
    }
    html[data-theme="light"] .rank-table th {
      background: #f1f5f9 !important;
      color: #0f172a !important;
      border-bottom: 2px solid rgba(15, 23, 42, 0.08) !important;
    }
    html[data-theme="light"] .rank-table td {
      color: #1e293b !important;
      border-bottom: 1px solid rgba(15, 23, 42, 0.06) !important;
    }
    html[data-theme="light"] .rank-row:hover {
      background: #f8fafc !important;
    }
    html[data-theme="light"] .rank-driver-name-text {
      color: #0f172a !important;
    }
    html[data-theme="light"] .rank-track-name-text {
      color: #0f172a !important;
    }
    html[data-theme="light"] .rank-pos-badge.normal {
      background: #f1f5f9 !important;
      color: #475569 !important;
      border: 1px solid rgba(15, 23, 42, 0.1) !important;
    }
    html[data-theme="light"] .rank-recent-circuits {
      background: #f8fafc !important;
      border: 1px solid rgba(15, 23, 42, 0.08) !important;
    }
    html[data-theme="light"] .rank-recent-chip {
      background: #ffffff !important;
      border: 1px solid rgba(15, 23, 42, 0.12) !important;
      color: #334155 !important;
    }
    html[data-theme="light"] .rank-recent-chip:hover {
      background: #f1f5f9 !important;
      color: #0284c7 !important;
    }

    /* =========================================================================
       INDEPENDENT COCKPIT HUD OVERLAY (RaceChrono Motorsport Cockpit Architecture)
       Deep Classic Racing Blue (#000080 / #05054d), Full Ticked Delta Ruler,
       Crisp White Lap Time, Yellow Pit Countdown, Real-Time Predictive Lap Time.
       Optimized for Mobile Browsers with Navigation URL Bars.
       ========================================================================= */
    .cockpit-hud-overlay {
      position: fixed;
      inset: 0;
      width: 100vw;
      /* Using dynamic viewport height to fit strictly inside browser area between bars */
      height: 100vh;
      height: 100dvh;
      background: #00003b;
      z-index: 9999999;
      display: none;
      flex-direction: column;
      box-sizing: border-box;
      touch-action: none;
      user-select: none;
      padding: max(4px, env(safe-area-inset-top, 4px)) max(10px, env(safe-area-inset-right, 10px)) max(6px, env(safe-area-inset-bottom, 6px)) max(10px, env(safe-area-inset-left, 10px));
      overflow: hidden;
    }
    .cockpit-hud-overlay.active {
      display: flex !important;
    }
    .cockpit-hud-overlay:fullscreen,
    .cockpit-hud-overlay:-webkit-full-screen {
      width: 100vw !important;
      height: 100vh !important;
      background: #00003b !important;
    }

    /* Floating Exit Focus Button on Top-Right of Map Panel */
    .cockpit-hud-exit-btn {
      position: absolute;
      top: 8px;
      right: 8px;
      z-index: 30;
      display: inline-flex;
      align-items: center;
      gap: 0.35rem;
      padding: 0.35rem 0.75rem;
      font-size: 0.75rem;
      font-weight: 800;
      font-family: var(--font-display);
      text-transform: uppercase;
      letter-spacing: 0.4px;
      color: #ffffff;
      background: rgba(255, 42, 75, 0.28);
      border: 1.5px solid #ff2a4b;
      border-radius: 20px;
      backdrop-filter: blur(10px);
      -webkit-backdrop-filter: blur(10px);
      box-shadow: 0 0 14px rgba(255, 42, 75, 0.55), inset 0 0 8px rgba(255, 42, 75, 0.2);
      cursor: pointer;
      transition: all var(--transition-fast);
    }
    .cockpit-hud-exit-btn:hover,
    .cockpit-hud-exit-btn:active {
      background: rgba(255, 42, 75, 0.55);
      border-color: #ff5270;
      color: #ffffff;
      box-shadow: 0 0 18px rgba(255, 42, 75, 0.85);
      transform: scale(1.05);
    }

    /* Main Flex Grid inside Cockpit Overlay */
    .cockpit-hud-main {
      flex: 1;
      min-height: 0;
      width: 100%;
      display: flex;
      gap: 6px;
      overflow: hidden;
      margin: 0;
      padding: 0;
      box-sizing: border-box;
    }

    /* Left Map Panel */
    .cockpit-hud-map-panel {
      position: relative;
      background: #00004d;
      border: 1.5px solid #002288;
      border-radius: 6px;
      overflow: hidden;
      display: flex;
      flex-direction: column;
    }
    .cockpit-hud-map-canvas {
      width: 100%;
      height: 100%;
      display: block;
      flex: 1;
    }
    .cockpit-hud-map-speed {
      position: absolute;
      top: 8px;
      left: 8px;
      font-family: var(--font-mono);
      font-size: 1.25rem;
      font-weight: 900;
      color: #00f0ff;
      background: rgba(0, 0, 60, 0.85);
      padding: 0.15rem 0.5rem;
      border-radius: 4px;
      border: 1px solid rgba(0, 240, 255, 0.5);
      pointer-events: none;
      z-index: 10;
    }

    /* Right Telemetry Column (RaceChrono Solid Card Architecture) */
    .cockpit-hud-telemetry-panel {
      display: flex;
      flex-direction: column;
      gap: 6px;
      min-height: 0;
      overflow: hidden;
    }

    /* Standard RaceChrono Telemetry Tile */
    .rc-tile {
      background: #000066;
      border: 1px solid #001f7a;
      border-radius: 6px;
      padding: 6px 10px;
      box-sizing: border-box;
      position: relative;
      display: flex;
      flex-direction: column;
      justify-content: space-between;
    }
    .rc-tile-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 2px;
    }
    .rc-label {
      font-size: 0.72rem;
      font-weight: 700;
      color: #9bb7ea;
      font-family: var(--font-display);
      text-transform: uppercase;
      letter-spacing: 0.5px;
    }
    .rc-sub-metric {
      font-family: var(--font-mono);
      font-size: 0.76rem;
      font-weight: 700;
      color: #00f0ff;
    }
    .rc-lap-huge {
      font-family: var(--font-mono);
      font-size: clamp(1.4rem, 4.2vw, 2.2rem) !important;
      font-weight: 900 !important;
      color: #00f0ff !important;
      letter-spacing: -0.5px;
      line-height: 1;
      text-shadow: 0 0 12px rgba(0, 240, 255, 0.4);
    }

    /* Best & Previous Split Cards (50% / 50%) - Perfectly fitted */
    .rc-row-split {
      display: grid;
      grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
      gap: 6px;
      flex: 0 0 auto;
      width: 100%;
      box-sizing: border-box;
    }
    .rc-row-split .rc-tile {
      padding: 5px 8px;
      overflow: hidden;
      min-width: 0;
    }
    .rc-split-val {
      font-family: var(--font-mono);
      /* Dynamically scaled to prevent text cut-off on edge */
      font-size: clamp(1.15rem, 2.3vw, 1.85rem);
      font-weight: 900;
      color: #ffffff;
      line-height: 1.1;
      text-align: right;
      letter-spacing: -0.5px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      width: 100%;
      box-sizing: border-box;
    }

    /* Hero Current Lap / Countdown Box */
    .rc-tile-hero {
      flex: 1 1 auto;
      justify-content: center;
      padding: 6px 10px;
      background: #000075;
      border: 1.5px solid #0033aa;
    }
    .rc-hero-time {
      font-family: var(--font-mono);
      font-size: clamp(3.3rem, 15vw, 5.0rem);
      font-weight: 900;
      color: #ffffff;
      line-height: 1.0;
      text-align: right;
      letter-spacing: -1px;
      text-shadow: 0 0 16px rgba(255, 255, 255, 0.35);
      margin: 2px 0;
    }
    .rc-hero-time.pit-mode {
      color: #ffeb3b !important;
      text-shadow: 0 0 16px rgba(255, 235, 59, 0.45) !important;
    }
    .rc-hero-footer {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-top: 4px;
      font-family: var(--font-mono);
      font-size: 0.78rem;
    }

    /* Time Delta Scale & Ruler (Swapped to Top, High Contrast & Clean Separation) */
    .rc-tile-delta {
      flex: 0 0 auto;
      padding: 6px 10px 8px;
      background: #00005a;
      display: flex;
      flex-direction: column;
      justify-content: center;
      position: relative;
    }
    .rc-delta-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 2px;
    }
    .rc-delta-unit {
      font-size: 0.72rem;
      color: #6b8bbb;
      font-family: var(--font-mono);
      font-weight: 700;
    }
    /* Independent Dedicated Row for Large Delta Seconds - Zero overlap with bar! */
    .rc-delta-num-row {
      display: flex;
      justify-content: center;
      align-items: center;
      padding: 2px 0 4px;
      width: 100%;
    }
    .rc-delta-num-badge {
      font-family: var(--font-mono);
      font-size: clamp(1.8rem, 6.5vw, 3.2rem);
      font-weight: 900;
      letter-spacing: -0.5px;
      line-height: 1.0;
    }
    .rc-delta-num-badge.gain {
      color: #00e676;
      text-shadow: 0 0 16px rgba(0, 230, 118, 0.7);
    }
    .rc-delta-num-badge.loss {
      color: #ff1744;
      text-shadow: 0 0 16px rgba(255, 23, 68, 0.7);
    }
    .rc-delta-num-badge.even {
      color: #9bb7ea;
    }

    .rc-delta-ruler-container {
      position: relative;
      width: 100%;
      height: 32px;
      margin: 2px 0;
      display: flex;
      align-items: center;
    }
    /* Tick marks line */
    .rc-delta-ruler-ticks {
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      height: 14px;
      display: flex;
      justify-content: space-between;
      border-bottom: 2px solid rgba(255, 255, 255, 0.7);
    }
    .rc-ruler-tick {
      width: 2px;
      height: 7px;
      background: rgba(255, 255, 255, 0.6);
    }
    .rc-ruler-tick.major {
      height: 14px;
      background: #ffffff;
      width: 2.5px;
    }
    /* Center baseline indicator */
    .rc-delta-ruler-center {
      position: absolute;
      left: 50%;
      top: -2px;
      bottom: 0;
      width: 3px;
      background: #00f0ff;
      transform: translateX(-50%);
      z-index: 6;
      box-shadow: 0 0 8px #00f0ff;
    }
    /* Dynamic Bar fill from center - Extra thick 16px block for maximum readability */
    .rc-delta-bar-fill {
      position: absolute;
      top: 15px;
      height: 16px;
      border-radius: 4px;
      transition: width 0.06s ease-out, left 0.06s ease-out;
      z-index: 5;
    }
    .rc-delta-bar-fill.gain {
      background: #00e676;
      box-shadow: 0 0 14px rgba(0, 230, 118, 0.9);
      left: 50%;
    }
    .rc-delta-bar-fill.loss {
      background: #ff1744;
      box-shadow: 0 0 14px rgba(255, 23, 68, 0.9);
      right: 50%;
    }

    /* Cockpit HUD Overlay Team Radio & Flag Alert Banner */
    .cockpit-overlay-radio-banner {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      z-index: 40;
      width: 86%;
      max-width: 440px;
      padding: 0.8rem 1.1rem;
      border-radius: 14px;
      border: 2.5px solid #00f0ff;
      background: linear-gradient(135deg, rgba(0, 240, 255, 0.32) 0%, rgba(2, 6, 23, 0.96) 100%);
      box-shadow: 0 0 45px rgba(0, 240, 255, 0.8), inset 0 0 22px rgba(0, 240, 255, 0.4);
      backdrop-filter: blur(14px);
      -webkit-backdrop-filter: blur(14px);
      text-align: center;
      cursor: pointer;
      display: none;
      animation: cockpit-overlay-radio-pulse 1.1s infinite ease-in-out;
      box-sizing: border-box;
    }
    @keyframes cockpit-overlay-radio-pulse {
      0% { transform: translate(-50%, -50%) scale(0.98); opacity: 0.95; }
      50% { transform: translate(-50%, -50%) scale(1.03); opacity: 1; }
      100% { transform: translate(-50%, -50%) scale(0.98); opacity: 0.95; }
    }
    .cockpit-overlay-radio-header {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 0.45rem;
      margin-bottom: 0.25rem;
      font-family: var(--font-display);
      font-weight: 900;
      font-size: clamp(0.85rem, 2.5vw, 1.15rem);
      letter-spacing: 0.8px;
      text-transform: uppercase;
      color: #ffffff;
      text-shadow: 0 0 10px rgba(255, 255, 255, 0.6);
    }
    .cockpit-overlay-radio-msg {
      font-family: var(--font-mono);
      font-size: clamp(1.1rem, 3.8vw, 1.7rem);
      font-weight: 900;
      color: #ffffff;
      letter-spacing: -0.3px;
      line-height: 1.2;
      text-shadow: 0 0 16px rgba(0, 0, 0, 0.9);
      margin: 2px 0 4px;
      word-break: break-word;
    }
    .cockpit-overlay-radio-dismiss {
      font-family: var(--font-display);
      font-size: 0.72rem;
      color: rgba(255, 255, 255, 0.65);
      letter-spacing: 0.6px;
      text-transform: uppercase;
    }

    /* Pit Mode Stage Flow Bar in Cockpit HUD */
    .cockpit-pit-flow-container {
      display: none;
      width: 100%;
      height: 100%;
      align-items: center;
      justify-content: space-between;
      gap: 6px;
      padding: 4px 6px;
      box-sizing: border-box;
    }
    .cockpit-pit-flow-step {
      flex: 1 1 0;
      min-width: 0;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      padding: 6px 4px;
      background: rgba(0, 0, 70, 0.6);
      border: 1.5px solid rgba(255, 255, 255, 0.15);
      border-radius: 6px;
      transition: all 0.2s ease-out;
    }
    .cockpit-pit-flow-step .step-title {
      font-family: var(--font-display);
      font-size: clamp(0.72rem, 1.8vw, 0.95rem);
      font-weight: 800;
      letter-spacing: 0.5px;
      color: #8da4d0;
      text-transform: uppercase;
      white-space: nowrap;
    }
    .cockpit-pit-flow-step .step-sub {
      font-family: var(--font-mono);
      font-size: clamp(0.72rem, 1.5vw, 0.8rem);
      font-weight: 700;
      color: #5572a5;
      margin-top: 2px;
      white-space: nowrap;
    }
    .cockpit-pit-flow-step.active {
      background: rgba(0, 160, 255, 0.25);
      border-color: #00f0ff;
      box-shadow: 0 0 12px rgba(0, 240, 255, 0.45);
    }
    .cockpit-pit-flow-step.active .step-title {
      color: #00f0ff;
      text-shadow: 0 0 8px rgba(0, 240, 255, 0.6);
    }
    .cockpit-pit-flow-step.active .step-sub {
      color: #ffffff;
    }
    .cockpit-pit-flow-step.passed {
      background: rgba(0, 230, 118, 0.22);
      border-color: #00e676;
    }
    .cockpit-pit-flow-step.passed .step-title {
      color: #00e676;
    }
    .cockpit-pit-flow-step.passed .step-sub {
      color: #a7f3d0;
    }
    .cockpit-pit-flow-arrow {
      color: #5572a5;
      font-size: 0.9rem;
      font-weight: 900;
      flex: 0 0 auto;
    }

        /* --- ORIENTATION RESPONSIVENESS (Landscape vs Portrait) --- */
    /* Landscape (Phone mounted horizontally) */
    @media (orientation: landscape) {
      .cockpit-hud-main {
        flex-direction: row !important;
        gap: 8px !important;
      }
      /* Adjusted map to 46% to allocate 54% width to right telemetry, preventing lap time cut-off */
      .cockpit-hud-map-panel {
        flex: 0 0 46% !important;
        width: 46% !important;
        height: 100% !important;
      }
      .cockpit-hud-telemetry-panel {
        flex: 1 1 54% !important;
        width: 54% !important;
        height: 100% !important;
        gap: 5px !important;
      }
      .rc-split-val {
        font-size: clamp(1.2rem, 2.4vw, 2.0rem);
      }
      .rc-hero-time {
        font-size: clamp(2.8rem, 18vh, 4.5rem);
      }
      .rc-delta-num-badge {
        font-size: clamp(1.6rem, 4.0vw, 2.6rem);
      }
      .rc-delta-ruler-container {
        height: 26px;
      }
      .rc-delta-bar-fill {
        height: 13px;
        top: 12px;
      }
    }

    /* Portrait (Phone mounted vertically) - Map window slightly expanded, telemetry compact & fully fitted */
    @media (orientation: portrait) {
      .cockpit-hud-main {
        flex-direction: column !important;
        gap: 5px !important;
      }
      .cockpit-hud-map-panel {
        flex: 0 0 35.5% !important;
        width: 100% !important;
        min-height: 0;
      }
      .cockpit-hud-telemetry-panel {
        flex: 1 1 64.5% !important;
        width: 100% !important;
        gap: 5px !important;
        min-height: 0;
      }
      /* Compact Delta Tile in Portrait */
      .rc-tile-delta {
        padding: 4px 10px 6px !important;
        flex: 0 0 auto !important;
      }
      .rc-delta-num-row {
        padding: 1px 0 2px !important;
      }
      .rc-delta-num-badge {
        font-size: clamp(1.8rem, 7.5vw, 2.7rem) !important;
      }
      .rc-delta-ruler-container {
        height: 26px !important;
        margin: 2px 0 0 !important;
      }
      .rc-delta-ruler-ticks {
        height: 12px !important;
      }
      .rc-ruler-tick {
        height: 6px !important;
      }
      .rc-ruler-tick.major {
        height: 12px !important;
      }
      .rc-delta-bar-fill {
        height: 13px !important;
        top: 13px !important;
      }

      /* Compact Current Lap Tile in Portrait */
      .rc-tile-hero {
        padding: 4px 10px !important;
        flex: 1 1 auto !important;
      }
      .rc-hero-time {
        font-size: clamp(3.3rem, 16.0vw, 4.5rem) !important;
        margin: 1px 0 !important;
      }
      .rc-hero-footer {
        margin-top: 2px !important;
      }

      /* Bottom Row Best & Previous in Portrait: Guaranteed full display without cut-off */
      .rc-row-split {
        flex: 0 0 auto !important;
      }
      .rc-row-split .rc-tile {
        padding: 5px 8px !important;
      }
      .rc-split-val {
        font-size: clamp(1.3rem, 5.0vw, 1.85rem) !important;
        line-height: 1.15 !important;
      }
    }

    /* Launcher button in regular HUD map card */
    .hud-focus-launcher-btn {
      position: absolute;
      top: 8px;
      right: 8px;
      z-index: 10;
      display: inline-flex;
      align-items: center;
      gap: 0.35rem;
      padding: 0.35rem 0.65rem;
      font-size: 0.72rem;
      font-weight: 800;
      letter-spacing: 0.4px;
      text-transform: uppercase;
      font-family: var(--font-display);
      color: #00f0ff;
      background: rgba(2, 6, 23, 0.85);
      border: 1.5px solid rgba(0, 240, 255, 0.45);
      border-radius: 20px;
      backdrop-filter: blur(6px);
      -webkit-backdrop-filter: blur(6px);
      box-shadow: 0 0 12px rgba(0, 240, 255, 0.25);
      cursor: pointer;
      transition: all var(--transition-fast);
      user-select: none;
    }
    .hud-focus-launcher-btn:hover {
      background: rgba(0, 240, 255, 0.25);
      border-color: #00f0ff;
      transform: scale(1.05);
    }

    /* Distinct High-Impact Colors for External GPS & Setup Action Buttons */
    #btn-lap-ext-gps,
    #btn-pit-ext-gps {
      background: rgba(0, 240, 255, 0.12) !important;
      border: 1.5px solid rgba(0, 240, 255, 0.5) !important;
      color: #00f0ff !important;
      box-shadow: 0 0 10px rgba(0, 240, 255, 0.15) !important;
    }
    #btn-lap-ext-gps:hover,
    #btn-pit-ext-gps:hover {
      background: rgba(0, 240, 255, 0.22) !important;
      border-color: #00f0ff !important;
      box-shadow: 0 0 14px rgba(0, 240, 255, 0.3) !important;
    }
    #btn-lap-ext-gps i,
    #btn-pit-ext-gps i {
      color: #00f0ff !important;
    }

    #btn-lap-gate-calib,
    #btn-pit-gate-calib {
      background: rgba(255, 184, 0, 0.14) !important;
      border: 1.5px solid rgba(255, 184, 0, 0.55) !important;
      color: #ffb800 !important;
      box-shadow: 0 0 10px rgba(255, 184, 0, 0.15) !important;
    }
    #btn-lap-gate-calib:hover,
    #btn-pit-gate-calib:hover {
      background: rgba(255, 184, 0, 0.24) !important;
      border-color: #ffb800 !important;
      box-shadow: 0 0 14px rgba(255, 184, 0, 0.3) !important;
    }
    #btn-lap-gate-calib i,
    #btn-pit-gate-calib i {
      color: #ffb800 !important;
    }

    /* Light Theme Compatibility for Action Buttons */
    html[data-theme="light"] #btn-lap-ext-gps,
    html[data-theme="light"] #btn-pit-ext-gps {
      background: #e0f2fe !important;
      border: 1.5px solid rgba(2, 132, 199, 0.55) !important;
      color: #0284c7 !important;
    }
    html[data-theme="light"] #btn-lap-ext-gps i,
    html[data-theme="light"] #btn-pit-ext-gps i {
      color: #0284c7 !important;
    }
    html[data-theme="light"] #btn-lap-gate-calib,
    html[data-theme="light"] #btn-pit-gate-calib {
      background: #fef3c7 !important;
      border: 1.5px solid rgba(217, 119, 6, 0.55) !important;
      color: #b45309 !important;
    }
    html[data-theme="light"] #btn-lap-gate-calib i,
    html[data-theme="light"] #btn-pit-gate-calib i {
      color: #b45309 !important;
    }

    /* Distinct High-Impact Vivid Crimson Color for Live Share Button */
    #btn-lap-live-share {
      background: rgba(255, 23, 68, 0.12) !important;
      border: 1.5px solid rgba(255, 23, 68, 0.55) !important;
      color: #ff1744 !important;
      box-shadow: 0 0 10px rgba(255, 23, 68, 0.15) !important;
    }
    #btn-lap-live-share:hover {
      background: rgba(255, 23, 68, 0.22) !important;
      border-color: #ff1744 !important;
      box-shadow: 0 0 14px rgba(255, 23, 68, 0.3) !important;
    }
    #btn-lap-live-share i,
    #btn-lap-live-share #icon-lap-live-share {
      color: #ff1744 !important;
    }

    /* Light Theme Compatibility for Live Share */
    html[data-theme="light"] #btn-lap-live-share {
      background: #ffe4e6 !important;
      border: 1.5px solid rgba(225, 29, 72, 0.55) !important;
      color: #e11d48 !important;
    }
    html[data-theme="light"] #btn-lap-live-share i,
    html[data-theme="light"] #btn-lap-live-share #icon-lap-live-share {
      color: #e11d48 !important;
    }

/* =============================================================================
   PWA ONE-TOUCH INSTALL UI (TOPBAR BUTTON & FLOATING SMART BANNER)
   High-conversion, motorsport-themed install prompt for Chrome Android & Desktop
   ============================================================================= */

.btn-pwa-install-topbar {
  display: none !important;
}

/* PWA Floating Smart Install Banner */
.pwa-install-banner {
  position: fixed;
  z-index: 105;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  background: rgba(13, 18, 28, 0.94);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(225, 29, 72, 0.2);
  padding: 0.75rem 0.95rem;
  transition: opacity 0.3s ease, transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  animation: pwaBannerSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes pwaBannerSlideUp {
  from {
    opacity: 0;
    transform: translateY(24px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.pwa-banner-leaving {
  opacity: 0 !important;
  transform: translateY(20px) scale(0.95) !important;
  pointer-events: none !important;
}

/* Mobile Placement (sits comfortably above mobile bottom nav & center + button) */
@media (max-width: 991px) {
  .pwa-install-banner {
    left: 10px;
    right: 10px;
    bottom: calc(72px + max(0.5rem, env(safe-area-inset-bottom)));
  }
}

/* Desktop Placement (floating bottom-right card) */
@media (min-width: 992px) {
  .pwa-install-banner {
    bottom: 24px;
    right: 24px;
    left: auto;
    max-width: 420px;
    width: calc(100% - 48px);
  }
}

.pwa-banner-content {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 1;
  min-width: 0;
}

.pwa-banner-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  flex-shrink: 0;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.pwa-banner-text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.pwa-banner-title-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.pwa-banner-title {
  font-family: var(--font-display, inherit);
  font-size: 0.88rem;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.2;
}

.pwa-banner-badge {
  font-family: var(--font-display, inherit);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  background: rgba(0, 240, 255, 0.15);
  color: #00f0ff;
  border: 1px solid rgba(0, 240, 255, 0.35);
  text-transform: uppercase;
}

.pwa-banner-desc {
  font-size: 0.74rem;
  color: #94a3b8;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 420px) {
  .pwa-banner-desc {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }
}

.pwa-banner-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}

.pwa-banner-dismiss {
  background: transparent;
  border: none;
  color: #64748b;
  font-size: 0.74rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  transition: all 0.15s ease;
}
.pwa-banner-dismiss:hover {
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.06);
}

.pwa-banner-install-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.85rem;
  font-family: var(--font-display, inherit);
  font-size: 0.82rem;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(135deg, #e11d48, #be123c);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(225, 29, 72, 0.4);
  transition: all 0.18s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
}
.pwa-banner-install-btn:hover {
  background: linear-gradient(135deg, #f43f5e, #e11d48);
  box-shadow: 0 6px 16px rgba(225, 29, 72, 0.55);
  transform: translateY(-1px);
}

/* Light Theme Overrides */
html[data-theme="light"] .pwa-install-banner {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.18), 0 0 0 1px rgba(225, 29, 72, 0.2);
}
html[data-theme="light"] .pwa-banner-title {
  color: #0f172a;
}
html[data-theme="light"] .pwa-banner-desc {
  color: #475569;
}
html[data-theme="light"] .pwa-banner-dismiss {
  color: #64748b;
}
html[data-theme="light"] .pwa-banner-dismiss:hover {
  color: #0f172a;
  background: rgba(0, 0, 0, 0.05);
}
html[data-theme="light"] .pwa-banner-badge {
  background: rgba(2, 132, 199, 0.1);
  color: #0284c7;
  border-color: rgba(2, 132, 199, 0.25);
}


/* --- iOS Safari 2-Step PWA Install Guide Modal --- */
.ios-install-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.25rem;
  animation: iosFadeIn 0.25s ease;
}

@keyframes iosFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.ios-install-modal-card {
  background: rgba(15, 23, 42, 0.96);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 20px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(225, 29, 72, 0.2);
  padding: 1.4rem;
  color: #ffffff;
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
  animation: iosCardSlideUp 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes iosCardSlideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.ios-install-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.ios-install-modal-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.ios-install-app-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.ios-install-close-btn {
  background: rgba(255, 255, 255, 0.08);
  border: none;
  color: #94a3b8;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  transition: all 0.15s ease;
}
.ios-install-close-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

.ios-install-steps {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.ios-install-step {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  padding: 0.7rem 0.85rem;
}

.ios-step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: linear-gradient(135deg, #e11d48, #be123c);
  color: #ffffff;
  font-weight: 800;
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

.ios-step-content {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  flex: 1;
}

.ios-step-title {
  font-size: 0.85rem;
  color: #f1f5f9;
  line-height: 1.3;
}
.ios-step-title strong {
  color: #00f0ff;
  font-weight: 700;
}

.ios-step-sub {
  font-size: 0.74rem;
  color: #94a3b8;
  line-height: 1.25;
}

.ios-step-icon-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.3rem;
  background: rgba(0, 240, 255, 0.1);
  border: 1px solid rgba(0, 240, 255, 0.25);
  border-radius: 6px;
  padding: 0.2rem 0.55rem;
  color: #00f0ff;
  font-size: 0.72rem;
  font-weight: 600;
  width: fit-content;
}

.pwa-guide-notice {
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 10px;
  padding: 0.65rem 0.85rem;
  font-size: 0.76rem;
  color: #f59e0b;
  line-height: 1.4;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
}
html[data-theme="light"] .pwa-guide-notice {
  background: rgba(217, 119, 6, 0.08);
  border-color: rgba(217, 119, 6, 0.25);
  color: #b45309;
}

.btn-ios-install-gotit {
  width: 100%;
  padding: 0.75rem;
  border-radius: 10px;
  background: linear-gradient(135deg, #e11d48, #be123c);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(225, 29, 72, 0.4);
  transition: all 0.2s ease;
}
.btn-ios-install-gotit:hover {
  background: linear-gradient(135deg, #f43f5e, #e11d48);
  box-shadow: 0 6px 18px rgba(225, 29, 72, 0.55);
}

/* Light Theme for iOS Modal */
html[data-theme="light"] .ios-install-modal-card {
  background: rgba(255, 255, 255, 0.98);
  border-color: rgba(0, 0, 0, 0.12);
  color: #0f172a;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(225, 29, 72, 0.2);
}
html[data-theme="light"] .ios-install-modal-title div div:first-child {
  color: #0f172a !important;
}
html[data-theme="light"] .ios-install-step {
  background: rgba(0, 0, 0, 0.03);
  border-color: rgba(0, 0, 0, 0.08);
}
html[data-theme="light"] .ios-step-title {
  color: #1e293b;
}
html[data-theme="light"] .ios-step-title strong {
  color: #0284c7;
}
html[data-theme="light"] .ios-step-sub {
  color: #64748b;
}
html[data-theme="light"] .ios-step-icon-badge {
  background: rgba(2, 132, 199, 0.1);
  border-color: rgba(2, 132, 199, 0.3);
  color: #0284c7;
}
html[data-theme="light"] .ios-install-close-btn {
  background: rgba(0, 0, 0, 0.06);
  color: #64748b;
}
html[data-theme="light"] .ios-install-close-btn:hover {
  background: rgba(0, 0, 0, 0.12);
  color: #0f172a;
}

/* =============================================================================
   QUICK TIP & TOPBAR SAFE-AREA & SPACING OPTIMIZATION (iPhone & Mobile PWA)
   - When Quick Tip is active: Quick Tip takes safe-area padding; Topbar is compact.
   - When Quick Tip is closed/dismissed: Topbar ALWAYS takes safe-area padding
     so the header & login button ("Guest Driver") are NEVER covered by the notch.
   ============================================================================= */

/* Default Topbar Padding - Guaranteed notch clearance on mobile/PWA */
.topbar {
  padding-top: max(0.65rem, env(safe-area-inset-top, 20px));
  padding-bottom: 0.55rem;
  padding-left: 0.75rem;
  padding-right: 0.75rem;
  transition: padding-top 0.2s ease;
}

@media (max-width: 991px) {
  .topbar {
    padding-top: max(0.65rem, env(safe-area-inset-top, 20px));
    padding-bottom: 0.55rem;
    padding-left: 0.75rem;
    padding-right: 0.75rem;
  }
}

/* Standalone PWA Mode (iOS & Android): Always enforce safe notch height when Quick Tip is closed */
@media all and (display-mode: standalone), (display-mode: fullscreen) {
  body:not(.has-quick-tip) .topbar {
    padding-top: max(1.5rem, calc(env(safe-area-inset-top, 44px) + 0.5rem)) !important;
  }
  body.has-quick-tip .onboarding-micro-banner {
    padding-top: max(0.75rem, calc(env(safe-area-inset-top, 44px) + 0.5rem)) !important;
    padding-bottom: 0.6rem !important;
    min-height: calc(env(safe-area-inset-top, 44px) + 38px) !important;
    max-height: none !important;
    height: auto !important;
  }
  body.has-quick-tip .topbar {
    padding-top: 0.75rem !important;
    padding-bottom: 0.7rem !important;
  }
}

/* Standalone class fallback for iOS WebKit PWA (when window.navigator.standalone === true) */
.is-standalone body:not(.has-quick-tip) .topbar,
body.is-standalone:not(.has-quick-tip) .topbar {
  padding-top: max(1.5rem, calc(env(safe-area-inset-top, 44px) + 0.5rem)) !important;
}
.is-standalone body.has-quick-tip .onboarding-micro-banner,
body.is-standalone.has-quick-tip .onboarding-micro-banner {
  padding-top: max(0.75rem, calc(env(safe-area-inset-top, 44px) + 0.5rem)) !important;
  padding-bottom: 0.6rem !important;
  min-height: calc(env(safe-area-inset-top, 44px) + 38px) !important;
  max-height: none !important;
  height: auto !important;
}
.is-standalone body.has-quick-tip .topbar,
body.is-standalone.has-quick-tip .topbar {
  padding-top: 0.75rem !important;
  padding-bottom: 0.7rem !important;
}

/* Quick Tip Banner (When Active in standard browser) */
body.tab-view-lap-timer .quick-tip-lap-start,
body.tab-view-pit-timer .quick-tip-lap-start,
html.tab-is-timer-view .quick-tip-lap-start,
html.tab-preload-lap-timer .quick-tip-lap-start,
html.tab-preload-pit-timer .quick-tip-lap-start {
  display: none !important;
}

body.has-quick-tip .onboarding-micro-banner {
  padding-top: max(0.6rem, calc(env(safe-area-inset-top, 0px) + 0.5rem)) !important;
  padding-bottom: 0.55rem !important;
  padding-left: max(0.85rem, env(safe-area-inset-left, 0px)) !important;
  padding-right: max(0.85rem, env(safe-area-inset-right, 0px)) !important;
  line-height: 1.35 !important;
  height: auto !important;
  max-height: none !important;
  min-height: calc(env(safe-area-inset-top, 0px) + 36px) !important;
  box-sizing: border-box !important;
}

/* Topbar Header spacing below Quick Tip */
body.has-quick-tip .topbar {
  padding-top: 0.8rem !important;
  padding-bottom: 0.75rem !important;
}

@media (max-width: 991px) {
  body.has-quick-tip .topbar {
    padding-top: 0.7rem !important;
    padding-bottom: 0.65rem !important;
  }
}

@media (max-width: 640px) {
  body.has-quick-tip .topbar {
    padding-top: 0.7rem !important;
    padding-bottom: 0.65rem !important;
  }
}

/* =========================================================================
   TELEMETRY EVOLUTION: OPTIMAL LAP, AUDIO COACHING, 6-AXIS IMU G-G DIAGRAM
   ========================================================================= */

/* 1. Optimal Lap KPI & Banner */
.sda-kpi-optimal {
  border-color: rgba(179, 136, 255, 0.35) !important;
  background: rgba(179, 136, 255, 0.08) !important;
}
.sda-kpi-optimal .sda-kpi-val {
  color: #b388ff !important;
  text-shadow: 0 0 12px rgba(179, 136, 255, 0.45);
}
.sda-optimal-banner {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.85rem;
  margin: 0.6rem 0;
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(179, 136, 255, 0.12), rgba(0, 240, 255, 0.08));
  border: 1px solid rgba(179, 136, 255, 0.3);
  font-size: 0.78rem;
  color: #e2e8f0;
}
.sda-optimal-badge {
  background: #b388ff;
  color: #07090e;
  font-weight: 800;
  font-size: 0.68rem;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

/* 2. Audio Coaching & IMU Badges in Lap Timer Header */
.coaching-badge, .imu-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  white-space: nowrap;
  user-select: none;
}
.coaching-badge.active {
  background: rgba(0, 255, 136, 0.12);
  color: #00ff88;
  border: 1px solid rgba(0, 255, 136, 0.35);
}
html[data-theme="light"] .coaching-badge.active {
  background: #ecfdf5;
  color: #047857;
  border-color: #059669;
}
.coaching-badge.inactive {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-dim);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
html[data-theme="light"] .coaching-badge.inactive {
  background: #f1f5f9;
  color: #475569;
  border-color: rgba(15, 23, 42, 0.16);
}
.imu-badge.active {
  background: rgba(0, 240, 255, 0.12);
  color: #00f0ff;
  border: 1px solid rgba(0, 240, 255, 0.35);
}
html[data-theme="light"] .imu-badge.active {
  background: #f0f9ff;
  color: #0369a1;
  border-color: #0284c7;
}
.imu-badge.standby {
  background: rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.2);
}
html[data-theme="light"] .imu-badge.standby {
  background: #f8fafc;
  color: #334155;
  border-color: rgba(15, 23, 42, 0.2);
}
.imu-badge.inactive {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-dim);
  border: 1px solid rgba(255, 255, 255, 0.1);
}
html[data-theme="light"] .imu-badge.inactive {
  background: #f1f5f9;
  color: #475569;
  border-color: rgba(15, 23, 42, 0.16);
}

/* Floating Audio Delta Cue Banner (Center HUD overlay) */
.lap-delta-floating-notice {
  position: absolute;
  top: 18%;
  left: 50%;
  transform: translateX(-50%) scale(0.9);
  padding: 0.45rem 1.1rem;
  border-radius: 20px;
  font-family: var(--font-display, Orbitron, sans-serif);
  font-weight: 800;
  font-size: 1.05rem;
  letter-spacing: 0.5px;
  color: #fff;
  pointer-events: none;
  opacity: 0;
  z-index: 250;
  transition: all 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
}
.lap-delta-floating-notice.show {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

/* 3. Real-Time G-G Diagram Mini HUD in Track Map (Bottom-Right) */
.circuit-map-gg-hud {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 72px;
  height: 72px;
  background: rgba(7, 10, 16, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2px;
  z-index: 10;
  backdrop-filter: blur(6px);
  cursor: pointer;
  transition: border-color 0.2s;
}
.circuit-map-gg-hud:hover {
  border-color: rgba(0, 240, 255, 0.5);
}
.circuit-map-gg-hud canvas {
  width: 52px;
  height: 52px;
  display: block;
}
.circuit-map-gg-hud-val {
  font-family: var(--font-mono, monospace);
  font-size: 0.65rem;
  font-weight: 800;
  color: var(--accent-cyan);
  line-height: 1;
  margin-top: 2px;
}

/* Ensure telemetry label does not overlap with bottom-right G-G HUD on narrow screens */
.circuit-map-telemetry {
  max-width: calc(100% - 90px) !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* =========================================================================
   COCKPIT HUD FOCUS G-G DIAGRAM & SESSION ANALYSIS LIGHT MODE OPTIMIZATION
   ========================================================================= */

/* Cockpit HUD Focus G-G Diagram (Bottom-Right in Map Panel) */
.cockpit-gg-hud {
  position: absolute !important;
  bottom: 8px !important;
  right: 8px !important;
  z-index: 25 !important;
}

/* Session Analysis Modal Light Mode Contrast & Readability Improvements */
html[data-theme="light"] #modal-session-detail .modal-card {
  background: #ffffff !important;
  border: 1px solid rgba(15, 23, 42, 0.16) !important;
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.25) !important;
}

/* =========================================================================
   PIT TIMER ZUPT (ZERO-VELOCITY UPDATE) SENSOR FUSION BADGE
   ========================================================================= */
.pit-zupt-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-family: var(--font-display);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 1px 5px;
  border-radius: 4px;
  margin-left: 5px;
  vertical-align: middle;
  transition: all 0.2s ease;
  user-select: none;
}
.pit-zupt-badge.standby {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
  border: 1px solid rgba(255, 255, 255, 0.18);
}
.pit-zupt-badge.active-lock {
  background: rgba(0, 255, 136, 0.22);
  color: #00ff88;
  border: 1px solid #00ff88;
  box-shadow: 0 0 8px rgba(0, 255, 136, 0.35);
  animation: zuptPulse 1.5s infinite;
}
@keyframes zuptPulse {
  0% { opacity: 0.85; }
  50% { opacity: 1; box-shadow: 0 0 12px rgba(0, 255, 136, 0.6); }
  100% { opacity: 0.85; }
}

html[data-theme="light"] .pit-zupt-badge.standby {
  background: rgba(15, 23, 42, 0.06);
  color: #64748b;
  border: 1px solid rgba(15, 23, 42, 0.15);
}
html[data-theme="light"] .pit-zupt-badge.active-lock {
  background: #ecfdf5;
  color: #059669;
  border: 1px solid #059669;
  box-shadow: 0 0 6px rgba(5, 150, 105, 0.25);
}
html[data-theme="light"] #modal-session-detail .modal-drag-indicator {
  background: rgba(15, 23, 42, 0.2) !important;
}
html[data-theme="light"] #modal-session-detail .modal-header {
  background: #ffffff !important;
  border-bottom: 1px solid #e2e8f0 !important;
}
html[data-theme="light"] #modal-session-detail .modal-title {
  color: #0f172a !important;
  font-weight: 800 !important;
}
html[data-theme="light"] #modal-session-detail .modal-close-btn {
  color: #475569 !important;
  background: #f1f5f9 !important;
  border: 1px solid #e2e8f0 !important;
}
html[data-theme="light"] #modal-session-detail .modal-close-btn:hover,
html[data-theme="light"] #modal-session-detail .modal-close-btn:active {
  background: #e2e8f0 !important;
  color: #0f172a !important;
}
html[data-theme="light"] .sda-top-header {
  border-bottom: 1px solid rgba(15, 23, 42, 0.08) !important;
}
html[data-theme="light"] .sda-track-title span:first-child {
  color: #0f172a !important;
  font-weight: 800 !important;
}
html[data-theme="light"] .sda-sub-meta {
  color: #475569 !important;
  font-weight: 500 !important;
}
html[data-theme="light"] .sda-sub-meta strong {
  color: #0284c7 !important;
  font-weight: 700 !important;
}
html[data-theme="light"] .sda-kpi-box {
  background: #f8fafc !important;
  border: 1px solid rgba(15, 23, 42, 0.12) !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.04) !important;
}
html[data-theme="light"] .sda-kpi-label {
  color: #64748b !important;
  font-weight: 700 !important;
  font-size: 0.68rem !important;
}
html[data-theme="light"] .sda-kpi-val.best-lap {
  color: #059669 !important;
  font-weight: 800 !important;
  text-shadow: none !important;
}
html[data-theme="light"] .sda-kpi-optimal {
  background: #f5f3ff !important;
  border: 1px solid rgba(124, 58, 237, 0.3) !important;
  box-shadow: 0 1px 4px rgba(124, 58, 237, 0.08) !important;
}
html[data-theme="light"] .sda-kpi-optimal .sda-kpi-val {
  color: #6d28d9 !important;
  font-weight: 800 !important;
  text-shadow: none !important;
}
html[data-theme="light"] .sda-kpi-optimal .sda-kpi-label {
  color: #7c3aed !important;
  font-weight: 700 !important;
}
html[data-theme="light"] .sda-optimal-banner {
  background: linear-gradient(135deg, #f5f3ff 0%, #ecfdf5 100%) !important;
  border: 1px solid rgba(124, 58, 237, 0.28) !important;
  color: #1e293b !important;
  font-weight: 600 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04) !important;
}
html[data-theme="light"] .sda-optimal-badge {
  background: #7c3aed !important;
  color: #ffffff !important;
  font-weight: 800 !important;
}
html[data-theme="light"] .sda-specs-box {
  background: #f8fafc !important;
  border: 1px solid rgba(15, 23, 42, 0.12) !important;
}
html[data-theme="light"] .sda-spec-label {
  color: #64748b !important;
  font-weight: 700 !important;
}
html[data-theme="light"] .sda-spec-val {
  color: #0f172a !important;
  font-weight: 600 !important;
}
html[data-theme="light"] .sda-notes-wrap {
  border-top: 1px solid rgba(15, 23, 42, 0.08) !important;
}
html[data-theme="light"] .sda-notes-content {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid rgba(15, 23, 42, 0.14) !important;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.03) !important;
}
html[data-theme="light"] .session-layout-badge {
  background: rgba(15, 23, 42, 0.06) !important;
  color: #334155 !important;
  border: 1px solid rgba(15, 23, 42, 0.12) !important;
}

/* =========================================================================
   RECOMMENDATION 1: PRO SETUP ACCORDION & GPS PERMISSION GUIDE MODAL
   ========================================================================= */

.pro-setup-accordion {
  width: 100%;
  margin-top: 0.85rem;
  margin-bottom: 0.85rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  overflow: hidden;
  transition: border-color var(--transition-fast), background var(--transition-fast);
}
html[data-theme="light"] .pro-setup-accordion {
  background: rgba(15, 23, 42, 0.02);
  border-color: rgba(15, 23, 42, 0.12);
}
.pro-setup-accordion:hover {
  border-color: rgba(0, 240, 255, 0.35);
}
.pro-setup-toggle-btn {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  padding: 0.75rem 0.95rem;
  background: transparent;
  border: none;
  color: var(--text-bright);
  font-family: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.pro-setup-toggle-title {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--text-bright);
}
.pro-setup-icon {
  color: var(--accent-cyan);
  width: 15px;
  height: 15px;
  flex-shrink: 0;
}
.pro-setup-toggle-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-dim);
  border: 1px solid rgba(255, 255, 255, 0.12);
  margin-left: auto;
  white-space: nowrap;
}
html[data-theme="light"] .pro-setup-toggle-badge {
  background: rgba(15, 23, 42, 0.06);
  color: #64748b;
  border-color: rgba(15, 23, 42, 0.12);
}
.pro-setup-chevron {
  width: 15px;
  height: 15px;
  color: var(--text-dim);
  transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}
.pro-setup-content {
  padding: 0.85rem 0.95rem 0.5rem 0.95rem;
  border-top: 1px dashed var(--border-subtle);
  background: rgba(0, 0, 0, 0.15);
}
html[data-theme="light"] .pro-setup-content {
  background: rgba(15, 23, 42, 0.015);
  border-top-color: rgba(15, 23, 42, 0.1);
}

/* GPS Permission Guide Modal Styles */
.gps-guide-modal-card {
  max-width: 520px;
}
.gps-guide-banner {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.9rem 1rem;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(0, 240, 255, 0.06));
  border: 1px solid rgba(245, 158, 11, 0.35);
  margin-bottom: 1rem;
}
.gps-guide-icon-wrap {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: rgba(0, 240, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: 1px solid rgba(0, 240, 255, 0.25);
}
.gps-guide-steps-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.gps-guide-step-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem 0.85rem;
}
html[data-theme="light"] .gps-guide-step-card {
  background: #f8fafc;
  border-color: #e2e8f0;
}
.gps-step-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--accent-cyan);
  background: rgba(0, 240, 255, 0.1);
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  margin-bottom: 0.45rem;
  font-family: var(--font-display);
}
.gps-step-ol {
  margin: 0;
  padding-left: 1.2rem;
  font-size: 0.82rem;
  color: var(--text-bright);
  line-height: 1.5;
}
.gps-step-ol li {
  margin-bottom: 0.3rem;
}
.gps-step-ol li:last-child {
  margin-bottom: 0;
}
.gps-mount-tip-box {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-sm);
  background: rgba(0, 240, 255, 0.06);
  border: 1px dashed rgba(0, 240, 255, 0.3);
  font-size: 0.78rem;
  color: var(--text-dim);
  line-height: 1.4;
}

/* =========================================================================
   LAP ANALYSIS: MULTI-LAP SPATIAL TELEMETRY & APEX ANALYZER & SPATIAL TELEMETRY ANALYZER
   ========================================================================= */

/* Floating Comparison Dock on Leaderboard */
.rank-compare-dock {
  position: fixed;
  bottom: 4.8rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  width: min(94vw, 760px);
  background: rgba(13, 18, 28, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(0, 240, 255, 0.45);
  border-radius: var(--radius-lg, 12px);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.85), 0 0 30px rgba(0, 240, 255, 0.22);
  padding: 0.75rem 1rem;
  animation: slideUpCompareDock 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@media (min-width: 769px) {
  .rank-compare-dock {
    bottom: 1.5rem;
  }
}
@keyframes slideUpCompareDock {
  from { opacity: 0; transform: translate(-50%, 25px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}
html[data-theme="light"] .rank-compare-dock {
  background: rgba(255, 255, 255, 0.96);
  border-color: rgba(2, 132, 199, 0.4);
  box-shadow: 0 12px 35px rgba(0, 0, 0, 0.15), 0 0 20px rgba(2, 132, 199, 0.12);
}
.rank-compare-dock-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}
.rank-compare-dock-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  min-width: 0;
}
.rank-compare-dock-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 800;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  background: rgba(0, 240, 255, 0.15);
  color: var(--accent-cyan, #00f0ff);
  border: 1px solid rgba(0, 240, 255, 0.35);
  font-family: var(--font-display, inherit);
  white-space: nowrap;
}
.rank-compare-dock-title {
  font-size: 0.88rem;
  font-weight: 800;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
html[data-theme="light"] .rank-compare-dock-title {
  color: #0f172a;
}
.rank-compare-pills {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}
.rank-cmp-pill {
  font-size: 0.72rem;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-weight: 700;
  white-space: nowrap;
}
.rank-cmp-pill.ref {
  background: rgba(255, 51, 102, 0.15);
  color: #ff3366;
  border: 1px solid rgba(255, 51, 102, 0.4);
}
.rank-cmp-pill.cmp {
  background: rgba(0, 229, 255, 0.15);
  color: #00e5ff;
  border: 1px solid rgba(0, 229, 255, 0.4);
}
.rank-compare-dock-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-shrink: 0;
}
.rank-btn-compare {
  font-size: 0.84rem;
  font-weight: 800;
  padding: 0.45rem 1rem;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: linear-gradient(135deg, #00e5ff 0%, #0284c7 100%);
  color: #04101e;
  border: none;
  border-radius: var(--radius-sm, 6px);
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 229, 255, 0.35);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.rank-btn-compare:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(0, 229, 255, 0.5);
}
.rank-btn-clear {
  padding: 0.45rem 0.65rem;
  color: var(--text-muted, #94a3b8);
  border-color: rgba(255, 255, 255, 0.2);
  cursor: pointer;
}

/* Row selection state */
.rank-row.row-selected,
.rank-m-card.card-selected {
  background: rgba(0, 240, 255, 0.08) !important;
  border-color: rgba(0, 240, 255, 0.35) !important;
}

/* Circuit Tools Modal Layout */
.ct-modal-card {
  max-width: 880px;
  max-height: 94vh;
  display: flex;
  flex-direction: column;
}
.ct-modal-body > * {
  flex-shrink: 0;
}
.ct-modal-body {
  padding: 1rem 1.25rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.ct-legend-strip {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  width: 100%;
}
.ct-legend-card {
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md, 8px);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 0;
  box-sizing: border-box;
}
.ct-legend-card.ref {
  background: rgba(255, 51, 102, 0.08);
  border: 1px solid rgba(255, 51, 102, 0.35);
}
.ct-legend-card.cmp {
  background: rgba(0, 229, 255, 0.08);
  border: 1px solid rgba(0, 229, 255, 0.35);
}
.ct-legend-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
}
.ct-card-badge {
  font-size: 0.72rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
  letter-spacing: 0.02em;
}
.ct-card-badge.ref {
  background: rgba(255, 51, 102, 0.2);
  color: #ff3366;
  border: 1px solid rgba(255, 51, 102, 0.4);
}
.ct-card-badge.cmp {
  background: rgba(0, 229, 255, 0.2);
  color: #00e5ff;
  border: 1px solid rgba(0, 229, 255, 0.4);
}
.ct-card-subtag {
  font-size: 0.72rem;
  color: var(--text-dim, #94a3b8);
  font-weight: 600;
}
.ct-vbo-badge {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(16, 185, 129, 0.2);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.5);
  letter-spacing: 0.03em;
}
.ct-card-driver {
  font-weight: 800;
  font-size: 0.98rem;
  color: #fff;
  line-height: 1.25;
  word-break: break-word;
  white-space: normal;
}
.ct-card-vehicle {
  font-size: 0.76rem;
  color: var(--text-dim, #94a3b8);
  line-height: 1.2;
  word-break: break-word;
  white-space: normal;
}
.ct-card-time {
  font-family: var(--font-mono, monospace);
  font-weight: 800;
  font-size: 1.25rem;
  line-height: 1.1;
  margin-top: 2px;
}
.ct-card-time.ref { color: #ff3366; }
.ct-card-time.cmp { color: #00e5ff; }

/* Light Theme */
html[data-theme="light"] .ct-legend-card.ref {
  background: #fff1f2;
  border-color: #fecdd3;
}
html[data-theme="light"] .ct-legend-card.cmp {
  background: #f0f9ff;
  border-color: #bae6fd;
}
html[data-theme="light"] .ct-card-driver {
  color: #0f172a;
}
html[data-theme="light"] .ct-card-vehicle {
  color: #64748b;
}
html[data-theme="light"] .ct-card-time.ref { color: #e11d48; }
html[data-theme="light"] .ct-card-time.cmp { color: #0284c7; }

.ct-legend-line.sector {
  background: #f59e0b;
}

/* Sector Table */
.ct-sector-table-wrap {
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.1));
  border-radius: var(--radius-md, 8px);
  padding: 0.65rem 0.85rem;
}
html[data-theme="light"] .ct-sector-table-wrap {
  background: #f8fafc;
  border-color: #e2e8f0;
}
.ct-section-heading {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  color: var(--text-dim, #94a3b8);
  margin-bottom: 0.45rem;
}
.ct-sector-table {
  font-size: 0.8rem;
  margin: 0;
  width: 100%;
}
.ct-sector-table th {
  padding: 0.4rem 0.6rem;
  background: rgba(255, 255, 255, 0.03);
  font-weight: 700;
}
.ct-sector-table td {
  padding: 0.45rem 0.6rem;
  vertical-align: middle;
}
.ct-delta-tag {
  font-family: var(--font-mono, monospace);
  font-weight: 800;
  font-size: 0.78rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  display: inline-block;
}
.ct-delta-tag.gain {
  background: rgba(0, 230, 118, 0.15);
  color: #00e676;
  border: 1px solid rgba(0, 230, 118, 0.35);
}
.ct-delta-tag.loss {
  background: rgba(255, 23, 68, 0.15);
  color: #ff1744;
  border: 1px solid rgba(255, 23, 68, 0.35);
}

/* Map Card */
.ct-map-card {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.1));
  border-radius: var(--radius-md, 8px);
  padding: 0.65rem 0.85rem;
}
html[data-theme="light"] .ct-map-card {
  background: #f8fafc;
  border-color: #e2e8f0;
}
.ct-map-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.45rem;
}
.ct-map-title {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 800;
  color: var(--text-dim, #94a3b8);
}
.ct-map-hint {
  font-size: 0.72rem;
  color: var(--accent-cyan, #00f0ff);
}
.ct-map-canvas-wrap {
  position: relative;
  width: 100%;
  height: 320px;
  background: #06090e;
  border-radius: var(--radius-sm, 6px);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.05);
}
html[data-theme="light"] .ct-map-canvas-wrap {
  background: #ffffff;
  border-color: #e2e8f0;
}
#ct-compare-map-canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.ct-map-telemetry-badge {
  position: absolute;
  bottom: 8px;
  right: 8px;
  background: rgba(0, 0, 0, 0.75);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
  font-size: 0.72rem;
  font-family: var(--font-mono, monospace);
  pointer-events: none;
}

/* Graphs Section */
.ct-graphs-container {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.1));
  border-radius: var(--radius-md, 8px);
  padding: 0.75rem 0.85rem;
}
html[data-theme="light"] .ct-graphs-container {
  background: #f8fafc;
  border-color: #e2e8f0;
}
.ct-scrubber-readout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  padding: 0.35rem 0.65rem;
  background: rgba(255, 255, 255, 0.04);
  border-radius: var(--radius-sm, 6px);
  margin-bottom: 0.45rem;
  font-size: 0.8rem;
  min-height: 38px;
  box-sizing: border-box;
  border: 1px solid rgba(255, 255, 255, 0.08);
}
html[data-theme="light"] .ct-scrubber-readout {
  background: #ffffff;
  border-color: #e2e8f0;
}
.ct-readout-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  height: 22px;
  line-height: 22px;
  box-sizing: border-box;
}
.ct-readout-label {
  color: var(--text-dim, #94a3b8);
  font-size: 0.74rem;
  font-weight: 600;
  white-space: nowrap;
}
.ct-readout-item strong {
  font-size: 0.84rem;
  font-weight: 700;
  white-space: nowrap;
}
.ct-delta-pill {
  font-family: var(--font-mono, monospace);
  font-size: 0.84rem;
  font-weight: 800;
}
.ct-corner-active-badge {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: rgba(0, 240, 255, 0.15);
  border: 1px solid rgba(0, 240, 255, 0.45);
  padding: 0 6px;
  height: 20px;
  line-height: 20px;
  box-sizing: border-box;
  border-radius: 4px;
  color: var(--accent-cyan, #00f0ff);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.2px;
}
html[data-theme="light"] .ct-corner-active-badge {
  background: rgba(2, 132, 199, 0.12);
  border-color: rgba(2, 132, 199, 0.4);
  color: #0284c7;
}
.ct-slider-wrap {
  width: 100%;
  margin-bottom: 0.65rem;
}
.ct-slider {
  width: 100%;
  height: 6px;
  accent-color: var(--accent-cyan, #00f0ff);
  cursor: pointer;
  border-radius: 3px;
}
.ct-canvas-wrap {
  position: relative;
  width: 100%;
  background: #06090e;
  border-radius: var(--radius-sm, 6px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 0.35rem 0.5rem;
}
.ct-canvas-wrap + .ct-canvas-wrap {
  margin-top: 0.65rem;
}
html[data-theme="light"] .ct-canvas-wrap {
  background: #ffffff;
  border-color: #e2e8f0;
}
.ct-canvas-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-dim, #94a3b8);
  margin-bottom: 0.25rem;
}
.ct-canvas-legend {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.7rem;
  font-weight: 700;
}
#ct-speed-canvas,
#ct-delta-canvas {
  width: 100%;
  display: block;
  cursor: crosshair;
  touch-action: pan-y;
}

/* AI Coaching box */
.ct-coaching-box {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  padding: 0.75rem 0.95rem;
  border-radius: var(--radius-md, 8px);
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.12), rgba(0, 240, 255, 0.06));
  border: 1px solid rgba(245, 158, 11, 0.35);
  font-size: 0.82rem;
  color: #f1f5f9;
  line-height: 1.45;
}
html[data-theme="light"] .ct-coaching-box {
  background: #fffbeb;
  border-color: #fde68a;
  color: #78350f;
}

/* Mobile Responsive Optimizations for Lap Analysis */
@media (max-width: 768px) {
  .rank-compare-dock {
    bottom: calc(4.6rem + env(safe-area-inset-bottom, 0px));
    width: min(96vw, 680px);
    padding: 0.6rem 0.8rem;
  }
  .ct-modal-card {
    max-width: 100% !important;
    width: 100% !important;
    min-width: 100% !important;
    height: calc(100% - 12px) !important;
    height: calc(100dvh - 8px - max(env(safe-area-inset-top, 0px), 28px)) !important;
    max-height: calc(100dvh - 8px - max(env(safe-area-inset-top, 0px), 28px)) !important;
    margin: 0 !important;
    border-radius: 16px 16px 0 0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
  }
  .ct-modal-body {
    padding: 0.35rem 0.35rem calc(1.8rem + env(safe-area-inset-bottom, 0px)) !important;
    gap: 0.4rem !important;
    -webkit-overflow-scrolling: touch;
  }
  .ct-legend-strip {
    grid-template-columns: 1fr 1fr;
    gap: 0.35rem;
  }
  .ct-legend-card {
    padding: 0.35rem 0.45rem;
  }
  .ct-legend-driver {
    font-size: 0.82rem;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .ct-legend-time {
    font-size: 0.95rem;
  }
  .ct-sector-table-wrap {
    padding: 0.35rem 0.45rem;
  }
  .ct-sector-table th, .ct-sector-table td {
    padding: 0.28rem 0.35rem;
    font-size: 0.72rem;
    white-space: nowrap;
  }
  .ct-map-card {
    padding: 0.3rem 0.35rem !important;
  }
  .ct-map-canvas-wrap {
    height: clamp(280px, 45vh, 360px) !important;
    touch-action: pan-y !important;
  }
  .ct-graphs-container {
    padding: 0.3rem 0.35rem !important;
  }
  .ct-canvas-wrap {
    padding: 0.15rem 0.15rem !important;
  }
}

/* Visibility & Zoom Controls for Lap Analysis */
.ct-map-title-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}
.ct-map-line-legend {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-light, #f1f5f9);
}
.ct-line-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  white-space: nowrap;
}
.ct-legend-line {
  display: inline-block;
  width: 14px;
  height: 3px;
  border-radius: 2px;
}
.ct-legend-line.ref {
  background: #ff3366;
  box-shadow: 0 0 8px rgba(255, 51, 102, 0.7);
}
.ct-legend-line.cmp {
  background: #00e5ff;
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.7);
}
.ct-map-tools {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.ct-zoom-btn-group {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  overflow: hidden;
}
.ct-zoom-btn {
  background: transparent;
  border: none;
  color: #f1f5f9;
  font-size: 0.85rem;
  font-weight: 800;
  padding: 0.22rem 0.6rem;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
  line-height: 1;
}
.ct-zoom-btn:hover {
  background: rgba(0, 240, 255, 0.25);
  color: #00f0ff;
}
.ct-zoom-btn.ct-zoom-reset {
  font-size: 0.72rem;
  border-left: 1px solid rgba(255, 255, 255, 0.15);
  padding: 0.22rem 0.55rem;
}
.ct-map-zoom-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(4, 9, 18, 0.85);
  color: #00f0ff;
  border: 1px solid rgba(0, 240, 255, 0.4);
  border-radius: 4px;
  padding: 0.2rem 0.5rem;
  font-size: 0.72rem;
  font-weight: 800;
  font-family: var(--font-mono, monospace);
  pointer-events: none;
  backdrop-filter: blur(8px);
}
.ct-map-telemetry-badge {
  background: rgba(4, 9, 18, 0.85) !important;
  border: 1px solid rgba(255, 255, 255, 0.2) !important;
  backdrop-filter: blur(8px);
  font-weight: 700;
}
.ct-legend-card.ref {
  background: rgba(255, 51, 102, 0.12) !important;
  border: 1.5px solid rgba(255, 51, 102, 0.45) !important;
}
.ct-legend-card.cmp {
  background: rgba(0, 229, 255, 0.12) !important;
  border: 1.5px solid rgba(0, 229, 255, 0.45) !important;
}
.ct-sector-table {
  border-collapse: separate;
  border-spacing: 0;
}
.ct-sector-table tr:hover td {
  background: rgba(255, 255, 255, 0.04);
}

/* =========================================================================
   LAP ANALYSIS: ENHANCED VISIBILITY, MINIMUM FONT SIZES & LIGHT MODE
   ========================================================================= */

/* Minimum font sizes and crisp typography */
.ct-modal-card {
  font-size: 0.9rem;
}
.ct-section-heading {
  font-size: 0.9rem !important;
  font-weight: 800;
  color: var(--text-light, #f1f5f9);
}
.ct-sector-table {
  font-size: 0.9rem !important;
}
.ct-sector-table th {
  font-size: 0.85rem !important;
  font-weight: 800;
  padding: 0.55rem 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.ct-sector-table td {
  font-size: 0.92rem !important;
  padding: 0.55rem 0.75rem;
}
.ct-delta-tag {
  font-size: 0.88rem !important;
  font-weight: 800;
  padding: 0.22rem 0.55rem;
  border-radius: 5px;
}
.ct-map-title {
  font-size: 0.9rem !important;
  font-weight: 800;
}
.ct-map-hint {
  font-size: 0.84rem !important;
  font-weight: 600;
}
.ct-map-line-legend {
  font-size: 0.82rem !important;
  font-weight: 700;
}
.ct-zoom-btn {
  font-size: 0.95rem !important;
  font-weight: 800;
  padding: 0.25rem 0.65rem;
}
.ct-zoom-btn.ct-zoom-reset {
  font-size: 0.82rem !important;
  font-weight: 800;
}
.ct-map-zoom-badge {
  font-size: 0.82rem !important;
  font-weight: 800;
  padding: 0.25rem 0.6rem;
}
.ct-scrubber-readout {
  font-size: 0.82rem !important;
  padding: 0.35rem 0.65rem !important;
  min-height: 38px !important;
}
.ct-readout-label {
  font-size: 0.74rem !important;
  font-weight: 600 !important;
}
.ct-readout-item strong {
  font-size: 0.84rem !important;
  font-weight: 700 !important;
}
.ct-delta-pill {
  font-size: 0.86rem !important;
  font-weight: 800 !important;
}
.ct-canvas-title {
  font-size: 0.88rem !important;
  font-weight: 800;
}
.ct-canvas-legend {
  font-size: 0.84rem !important;
  font-weight: 700;
}
.ct-coaching-box {
  font-size: 0.92rem !important;
  line-height: 1.5;
}
.rank-compare-dock-badge {
  font-size: 0.82rem !important;
}
.rank-compare-dock-title {
  font-size: 0.95rem !important;
}
.rank-cmp-pill {
  font-size: 0.82rem !important;
}
.rank-btn-compare {
  font-size: 0.9rem !important;
}

/* Light Mode High-Contrast Overrides */
html[data-theme="light"] .ct-modal-card {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
  color: #0f172a !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.22) !important;
}
html[data-theme="light"] .ct-modal-body {
  background: #ffffff !important;
}
html[data-theme="light"] .ct-legend-card.ref {
  background: #fff1f2 !important;
  border: 2px solid #fda4af !important;
  box-shadow: 0 2px 8px rgba(225, 29, 72, 0.08) !important;
}
html[data-theme="light"] .ct-legend-card.ref .ct-legend-driver {
  color: #9f1239 !important;
}
html[data-theme="light"] .ct-legend-card.ref .ct-legend-time {
  color: #e11d48 !important;
}
html[data-theme="light"] .ct-legend-card.cmp {
  background: #f0f9ff !important;
  border: 2px solid #7dd3fc !important;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.08) !important;
}
html[data-theme="light"] .ct-legend-card.cmp .ct-legend-driver {
  color: #0369a1 !important;
}
html[data-theme="light"] .ct-legend-card.cmp .ct-legend-time {
  color: #0284c7 !important;
}
html[data-theme="light"] .ct-sector-table-wrap {
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
}
html[data-theme="light"] .ct-section-heading {
  color: #1e293b !important;
}
html[data-theme="light"] .ct-sector-table th {
  background: #f1f5f9 !important;
  color: #1e293b !important;
  border-bottom: 2px solid #cbd5e1 !important;
}
html[data-theme="light"] .ct-sector-table td {
  color: #0f172a !important;
  border-bottom: 1px solid #e2e8f0 !important;
}
html[data-theme="light"] .ct-sector-table tr:hover td {
  background: #f8fafc !important;
}
html[data-theme="light"] .ct-delta-tag.gain {
  background: #dcfce7 !important;
  color: #15803d !important;
  border: 1.5px solid #86efac !important;
}
html[data-theme="light"] .ct-delta-tag.loss {
  background: #fee2e2 !important;
  color: #b91c1c !important;
  border: 1.5px solid #fca5a5 !important;
}
html[data-theme="light"] .ct-map-card {
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
}
html[data-theme="light"] .ct-map-title {
  color: #0f172a !important;
}
html[data-theme="light"] .ct-map-hint {
  color: #0284c7 !important;
}
html[data-theme="light"] .ct-map-line-legend {
  color: #334155 !important;
}
html[data-theme="light"] .ct-zoom-btn-group {
  background: #f1f5f9 !important;
  border: 1.5px solid #cbd5e1 !important;
}
html[data-theme="light"] .ct-zoom-btn {
  color: #0f172a !important;
}
html[data-theme="light"] .ct-zoom-btn:hover {
  background: #e2e8f0 !important;
  color: #0284c7 !important;
}
html[data-theme="light"] .ct-map-canvas-wrap {
  background: #f8fafc !important;
  border: 1.5px solid #cbd5e1 !important;
}
html[data-theme="light"] .ct-map-zoom-badge {
  background: rgba(255, 255, 255, 0.95) !important;
  color: #0369a1 !important;
  border: 1.5px solid #7dd3fc !important;
}
html[data-theme="light"] .ct-graphs-container {
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
}
html[data-theme="light"] .ct-scrubber-readout {
  background: #f8fafc !important;
  border: 1.5px solid #cbd5e1 !important;
  color: #0f172a !important;
}
html[data-theme="light"] .ct-readout-label {
  color: #475569 !important;
}
html[data-theme="light"] .ct-canvas-wrap {
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
}
html[data-theme="light"] .ct-canvas-title {
  color: #0f172a !important;
}
html[data-theme="light"] .ct-coaching-box {
  background: #fffbeb !important;
  border: 1.5px solid #fde68a !important;
  color: #78350f !important;
}


/* =========================================================================
   STRICT FIXED-WIDTH MOBILE OPTIMIZATION FOR LAP ANALYSIS MODAL
   Ensures 100% fixed mobile width, zero horizontal wobble or overflow,
   full vertical scrolling & enlarged track map with 3-lap support
   ========================================================================= */
@media (max-width: 768px) {
  #modal-lap-analysis-compare,
  #modal-circuit-tools-compare {
    display: none !important;
  }

  #modal-lap-analysis-compare.active,
  #modal-circuit-tools-compare.active {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
    height: 100% !important;
    height: 100dvh !important;
    max-height: 100dvh !important;
    padding: 0 !important;
    padding-top: max(env(safe-area-inset-top, 0px), 28px) !important;
    margin: 0 !important;
    overflow-x: hidden !important;
    overflow-y: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: flex-end !important;
    box-sizing: border-box !important;
    z-index: 1050 !important;
  }

  #modal-lap-analysis-compare .modal-card,
  #modal-circuit-tools-compare .modal-card,
  .ct-modal-card {
    position: relative !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 100% !important;
    height: calc(100% - 12px) !important;
    height: calc(100dvh - 8px - max(env(safe-area-inset-top, 0px), 28px)) !important;
    max-height: calc(100dvh - 8px - max(env(safe-area-inset-top, 0px), 28px)) !important;
    display: flex !important;
    flex-direction: column !important;
    margin: 0 !important;
    border-radius: 16px 16px 0 0 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    left: 0 !important;
    right: 0 !important;
  }

  .ct-modal-card .modal-drag-indicator {
    width: 36px !important;
    height: 4px !important;
    border-radius: 2px !important;
    background: rgba(255, 255, 255, 0.25) !important;
    margin: 10px auto 4px auto !important;
    flex-shrink: 0 !important;
  }

  #modal-lap-analysis-compare .modal-header,
  #modal-circuit-tools-compare .modal-header {
    width: 100% !important;
    flex-shrink: 0 !important;
    box-sizing: border-box !important;
    padding: 0.75rem 1rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    background: var(--bg-surface, #0d121c) !important;
    border-bottom: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.1)) !important;
    min-height: 52px !important;
    z-index: 10 !important;
  }

  #modal-lap-analysis-compare .modal-title,
  #modal-circuit-tools-compare .modal-title {
    min-width: 0 !important;
    flex: 1 1 auto !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    font-size: 1.12rem !important;
    font-weight: 800 !important;
    line-height: 1.35 !important;
    color: var(--text-main, #ffffff) !important;
    overflow: hidden !important;
    padding: 2px 0 !important;
  }

  #ct-modal-title {
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    display: inline-block !important;
    font-size: inherit !important;
    font-weight: 800 !important;
    line-height: 1.35 !important;
    color: inherit !important;
  }

  /* Modal body: Smooth vertical scrolling without cutoff & minimal edge margins */
  .ct-modal-body {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    height: auto !important;
    max-height: 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    overscroll-behavior: contain !important;
    padding: 0.3rem 0.35rem calc(1.8rem + env(safe-area-inset-bottom, 0px)) !important;
    gap: 0.4rem !important;
  }

  .ct-modal-body > * {
    flex-shrink: 0 !important;
    min-height: min-content !important;
  }

  .ct-legend-strip {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 0.35rem !important;
  }

  .ct-legend-card {
    min-width: 0 !important;
    box-sizing: border-box !important;
    overflow: visible !important;
    padding: 0.35rem 0.45rem !important;
  }

  .ct-card-driver {
    font-size: 0.85rem !important;
    line-height: 1.2 !important;
    word-break: break-word !important;
    white-space: normal !important;
    overflow: visible !important;
  }

  .ct-card-vehicle {
    font-size: 0.7rem !important;
    line-height: 1.15 !important;
    word-break: break-word !important;
    white-space: normal !important;
    overflow: visible !important;
  }

  .ct-card-time {
    font-size: 1.0rem !important;
    line-height: 1.1 !important;
  }

  /* Fixed Sector Splits Table with minimized padding */
  .ct-sector-table-wrap {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow-x: visible !important;
    padding: 0.35rem 0.45rem !important;
  }

  .ct-sector-table-wrap .table-responsive:not(.ct-matrix-scroll-wrap) {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: hidden !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .ct-sector-table:not(.is-matrix) {
    width: 100% !important;
    max-width: 100% !important;
    table-layout: fixed !important;
    box-sizing: border-box !important;
    margin: 0 !important;
    border-collapse: collapse !important;
  }

  .ct-sector-table:not(.is-matrix) th,
  .ct-sector-table:not(.is-matrix) td {
    padding: 0.28rem 0.35rem !important;
    font-size: 0.72rem !important;
    line-height: 1.25 !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
  }

  .ct-sector-table:not(.is-matrix) th:first-child,
  .ct-sector-table:not(.is-matrix) td:first-child {
    width: 22% !important;
    text-align: left !important;
  }

  .ct-sector-table:not(.is-matrix) th:nth-child(2),
  .ct-sector-table:not(.is-matrix) td:nth-child(2) {
    width: 25% !important;
    text-align: center !important;
  }

  .ct-sector-table:not(.is-matrix) th:nth-child(3),
  .ct-sector-table:not(.is-matrix) td:nth-child(3) {
    width: 25% !important;
    text-align: center !important;
  }

  .ct-sector-table:not(.is-matrix) th:nth-child(4),
  .ct-sector-table:not(.is-matrix) td:nth-child(4) {
    width: 28% !important;
    text-align: center !important;
  }

  .ct-delta-tag {
    font-size: 0.7rem !important;
    padding: 0.1rem 0.25rem !important;
  }

  /* Maximized Track Map Container: Slim Single-Row Header + Full-Width Canvas */
  .ct-map-card {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    padding: 0.3rem 0.35rem !important;
    border-radius: 8px !important;
  }

  .ct-map-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    flex-wrap: nowrap !important;
    gap: 0.25rem !important;
    margin-bottom: 0.25rem !important;
  }

  .ct-map-title-row {
    width: auto !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.35rem !important;
  }

  .ct-map-title {
    font-size: 0.78rem !important;
    white-space: nowrap !important;
  }

  .ct-map-line-legend {
    font-size: 0.68rem !important;
    gap: 0.35rem !important;
  }

  .ct-map-tools {
    width: auto !important;
    display: flex !important;
    align-items: center !important;
    gap: 0.25rem !important;
  }

  .ct-map-hint {
    display: none !important;
  }

  .ct-zoom-btn-group {
    gap: 2px !important;
  }

  .ct-zoom-btn {
    padding: 0.15rem 0.35rem !important;
    font-size: 0.72rem !important;
    min-width: 24px !important;
    height: 24px !important;
  }

  /* Height maximized to clamp(280px, 45vh, 360px) on mobile for large view */
  .ct-map-canvas-wrap {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    height: clamp(280px, 45vh, 360px) !important;
    touch-action: pan-y !important;
    border-radius: 6px !important;
  }

  #ct-compare-map-canvas {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    display: block !important;
    box-sizing: border-box !important;
    touch-action: pan-y !important;
  }

  /* Graphs Container & Scrubber Bar with Edge-to-Edge Utilization */
  .ct-graphs-container {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    padding: 0.3rem 0.35rem !important;
    border-radius: 8px !important;
  }

  .ct-scrubber-readout {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    grid-template-rows: repeat(4, 20px) !important;
    gap: 0.2rem 0.5rem !important;
    padding: 0.35rem 0.45rem !important;
    font-size: 0.72rem !important;
    min-height: 98px !important;
    max-height: 102px !important;
    overflow: hidden !important;
    align-items: center !important;
  }

  .ct-readout-item {
    gap: 0.25rem !important;
    height: 20px !important;
    line-height: 20px !important;
    min-height: 20px !important;
    box-sizing: border-box !important;
    display: flex !important;
    align-items: center !important;
    white-space: nowrap !important;
  }

  /* 4 Lines strictly allocated on mobile */
  /* Line 1: Position */
  .ct-readout-item:nth-child(1) {
    grid-column: 1 / -1 !important;
  }

  /* Line 2: Corner (Apex / Zone) */
  .ct-readout-item:nth-child(2) {
    grid-column: 1 / -1 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  /* Line 3: Ref Speed (Left) & Cmp Speed (Right) */
  .ct-readout-item:nth-child(3) {
    grid-column: 1 !important;
  }

  .ct-readout-item:nth-child(4) {
    grid-column: 2 !important;
  }

  /* Line 4: Time Delta */
  .ct-readout-item:nth-child(5) {
    grid-column: 1 / -1 !important;
  }

  .ct-readout-label {
    font-size: 0.68rem !important;
    font-weight: 600 !important;
    white-space: nowrap !important;
  }

  .ct-readout-item strong {
    font-size: 0.76rem !important;
    font-weight: 700 !important;
    white-space: nowrap !important;
  }

  .ct-delta-pill {
    font-size: 0.78rem !important;
    font-weight: 800 !important;
  }

  .ct-corner-active-badge {
    font-size: 0.70rem !important;
    height: 18px !important;
    line-height: 18px !important;
    padding: 0 5px !important;
  }

  .ct-slider-wrap {
    margin: 0.25rem 0 0.35rem 0 !important;
  }

  .ct-canvas-wrap {
    width: 100% !important;
    max-width: 100% !important;
    box-sizing: border-box !important;
    overflow: hidden !important;
    padding: 0.15rem 0.15rem !important;
    margin-bottom: 0.35rem !important;
  }

  .ct-canvas-title {
    font-size: 0.72rem !important;
    margin-bottom: 0.2rem !important;
    padding: 0 0.15rem !important;
  }

  .ct-canvas-legend {
    font-size: 0.68rem !important;
    gap: 0.4rem !important;
  }

  #ct-speed-canvas,
  #ct-delta-canvas {
    width: 100% !important;
    max-width: 100% !important;
    display: block !important;
    box-sizing: border-box !important;
  }
}

/* Light Mode overrides for CMP 2 */
html[data-theme="light"] .ct-legend-card.cmp2 {
  background: #fffbeb !important;
  border: 2px solid #fde68a !important;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.08) !important;
}
html[data-theme="light"] .ct-legend-card.cmp2 .ct-legend-driver {
  color: #b45309 !important;
}
html[data-theme="light"] .ct-legend-card.cmp2 .ct-legend-time {
  color: #d97706 !important;
}
html[data-theme="light"] .rank-cmp-pill.cmp2 {
  background: #fef3c7 !important;
  border-color: #f59e0b !important;
  color: #b45309 !important;
}

/* =========================================================================
   Unit & Regional Settings Modal Styles
   ========================================================================= */
.btn-unit-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 700;
  font-family: var(--font-mono, monospace);
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-unit-toggle:hover {
  color: var(--accent-cyan);
  border-color: rgba(0, 240, 255, 0.4);
  background: rgba(0, 240, 255, 0.08);
}
@media (max-width: 768px) {
  .btn-unit-toggle {
    display: none !important;
  }
}
@media (min-width: 769px) and (max-width: 991px) {
  .btn-unit-toggle {
    padding: 0.3rem 0.5rem;
    font-size: 0.68rem;
  }
}
.unit-presets-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.55rem;
}
@media (max-width: 480px) {
  .unit-presets-grid {
    grid-template-columns: 1fr;
  }
}
.unit-preset-btn {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.65rem 0.8rem;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  text-align: left;
  cursor: pointer;
  transition: all 0.15s ease;
}
.unit-preset-btn:hover {
  border-color: rgba(0, 240, 255, 0.4);
  background: rgba(0, 240, 255, 0.05);
}
.unit-preset-btn.active {
  border-color: var(--accent-cyan) !important;
  background: rgba(0, 240, 255, 0.12) !important;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.15);
}
.unit-preset-btn .preset-flag {
  font-size: 1.25rem;
  line-height: 1;
}
.unit-preset-btn .preset-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.unit-preset-btn .preset-title {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-main, #fff);
}
.unit-preset-btn .preset-sub {
  font-size: 0.65rem;
  color: var(--text-dim);
  font-family: var(--font-mono, monospace);
}
.unit-option-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.65rem;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: var(--radius-xs);
  gap: 0.5rem;
}
.unit-option-meta {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.unit-option-name {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.unit-option-desc {
  font-size: 0.68rem;
  color: var(--text-dim);
}
.unit-toggle-group {
  display: inline-flex;
  padding: 2px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  flex-shrink: 0;
}
.unit-pill {
  padding: 0.22rem 0.6rem;
  font-size: 0.72rem;
  font-weight: 700;
  font-family: var(--font-mono, monospace);
  color: var(--text-muted);
  background: transparent;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.12s ease;
}
.unit-pill:hover {
  color: #fff;
}
.unit-pill.active {
  color: #000 !important;
  background: var(--accent-cyan) !important;
  font-weight: 800;
}
.unit-preview-card {
  transition: background 0.15s ease, border-color 0.15s ease;
}
.unit-preview-grid strong,
.unit-preview-grid .preview-val {
  color: var(--text-main, #ffffff);
}

/* =========================================================================
   Unit Modal Light Mode Contrast & Visibility Optimizations
   ========================================================================= */
[data-theme="light"] .unit-modal-card {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1) !important;
}
[data-theme="light"] .unit-modal-card .modal-header {
  background: #f8fafc !important;
  border-bottom: 1px solid #e2e8f0 !important;
}
[data-theme="light"] .unit-modal-card .modal-title {
  color: #0f172a !important;
}
[data-theme="light"] .unit-modal-card .modal-close-btn {
  color: #64748b !important;
}
[data-theme="light"] .unit-modal-card .modal-close-btn:hover {
  color: #0f172a !important;
  background: rgba(15, 23, 42, 0.08) !important;
}
[data-theme="light"] .unit-section-title {
  color: #475569 !important;
}
[data-theme="light"] .unit-preset-btn {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
[data-theme="light"] .unit-preset-btn:hover {
  background: #f0f9ff !important;
  border-color: #0284c7 !important;
}
[data-theme="light"] .unit-preset-btn.active {
  background: #e0f2fe !important;
  border-color: #0284c7 !important;
  box-shadow: 0 0 0 1px #0284c7, 0 2px 4px rgba(2, 132, 199, 0.15) !important;
}
[data-theme="light"] .unit-preset-btn .preset-title {
  color: #0f172a !important;
}
[data-theme="light"] .unit-preset-btn .preset-sub {
  color: #475569 !important;
  font-weight: 600;
}
[data-theme="light"] .unit-preset-btn.active .preset-title {
  color: #0369a1 !important;
}
[data-theme="light"] .unit-preset-btn.active .preset-sub {
  color: #0284c7 !important;
}
[data-theme="light"] .unit-option-row {
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
}
[data-theme="light"] .unit-option-name {
  color: #0f172a !important;
}
[data-theme="light"] .unit-option-desc {
  color: #64748b !important;
}
[data-theme="light"] .unit-toggle-group {
  background: #e2e8f0 !important;
  border: 1px solid #cbd5e1 !important;
}
[data-theme="light"] .unit-pill {
  color: #475569 !important;
}
[data-theme="light"] .unit-pill:hover {
  color: #0f172a !important;
}
[data-theme="light"] .unit-pill.active {
  background: #0284c7 !important;
  color: #ffffff !important;
  font-weight: 800;
  box-shadow: 0 1px 3px rgba(2, 132, 199, 0.3) !important;
}
[data-theme="light"] .unit-preview-card {
  background: #f0fdf4 !important;
  border: 1px solid #bbf7d0 !important;
}
[data-theme="light"] .unit-preview-card .preview-card-title {
  color: #15803d !important;
}
[data-theme="light"] .unit-preview-grid strong,
[data-theme="light"] .unit-preview-grid .preview-val {
  color: #0f172a !important;
}
[data-theme="light"] .unit-preview-grid .preview-item span {
  color: #64748b !important;
}
[data-theme="light"] .unit-preview-grid #prev-unit-dist {
  color: #0284c7 !important;
}
[data-theme="light"] .unit-preview-grid #prev-unit-pressure {
  color: #d97706 !important;
}
[data-theme="light"] .unit-modal-footer {
  background: #f8fafc !important;
  border-top: 1px solid #e2e8f0 !important;
}
[data-theme="light"] .btn-unit-toggle {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #334155;
}
[data-theme="light"] .btn-unit-toggle:hover {
  background: #e0f2fe;
  border-color: #0284c7;
  color: #0284c7;
}


/* =========================================================================
   SESSION LAP SELECTOR MODAL & LAP ANALYSIS LAUNCHER
   ========================================================================= */

.lap-selector-modal-card {
  max-width: 520px;
  width: 95vw;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
}

.lap-selector-modal-body {
  padding: 0.85rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.lap-sel-header-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 0.65rem 0.85rem;
}

.lap-sel-track-title {
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text-bright);
}

.lap-sel-meta-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.76rem;
  color: var(--text-dim);
  margin-top: 0.3rem;
}

.lap-sel-presets-row {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.lap-sel-presets-label {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
}

.lap-sel-preset-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(179, 136, 255, 0.1);
  border: 1px solid rgba(179, 136, 255, 0.3);
  color: var(--accent-purple, #b388ff);
  border-radius: 20px;
  padding: 0.25rem 0.65rem;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.lap-sel-preset-btn:hover {
  background: rgba(179, 136, 255, 0.2);
}

.lap-sel-preset-btn.clear {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--text-dim);
}

.lap-sel-summary-box {
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  font-size: 0.82rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.lap-sel-summary-box.ready {
  background: rgba(0, 229, 255, 0.08);
  border: 1px solid rgba(0, 229, 255, 0.3);
  color: var(--text-bright);
}

.lap-sel-summary-box.pending {
  background: rgba(255, 179, 0, 0.08);
  border: 1px solid rgba(255, 179, 0, 0.3);
  color: var(--accent-amber, #ffb300);
}

.lap-sel-pill-pair {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.lap-sel-chip {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 0.78rem;
  padding: 2px 7px;
  border-radius: 4px;
}

.lap-sel-chip.ref {
  background: rgba(255, 51, 102, 0.15);
  color: #ff3366;
  border: 1px solid rgba(255, 51, 102, 0.4);
}

.lap-sel-chip.cmp {
  background: rgba(0, 229, 255, 0.15);
  color: #00e5ff;
  border: 1px solid rgba(0, 229, 255, 0.4);
}

.lap-sel-vs {
  font-size: 0.72rem;
  color: var(--text-dim);
  font-weight: 800;
}

.lap-sel-delta {
  font-size: 0.82rem;
  font-family: var(--font-mono);
  color: var(--accent-cyan);
}

.lap-sel-table-wrap {
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  overflow: hidden;
  background: var(--bg-card);
}

.lap-sel-table-header {
  display: flex;
  align-items: center;
  padding: 0.45rem 0.65rem;
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  border-bottom: 1px solid var(--border-subtle);
}

.lap-sel-table-body {
  max-height: 250px;
  overflow-y: auto;
}

.lap-sel-row {
  display: flex;
  align-items: center;
  padding: 0.55rem 0.65rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  cursor: pointer;
  transition: background 0.12s ease;
  user-select: none;
  font-size: 0.84rem;
}

.lap-sel-row:last-child {
  border-bottom: none;
}

.lap-sel-row:hover {
  background: rgba(255, 255, 255, 0.03);
}

.lap-sel-row.selected-ref {
  background: rgba(255, 51, 102, 0.08);
  border-left: 3px solid #ff3366;
}

.lap-sel-row.selected-cmp {
  background: rgba(0, 229, 255, 0.08);
  border-left: 3px solid #00e5ff;
}

.lap-sel-check-col {
  width: 28px;
  display: flex;
  align-items: center;
}

.lap-sel-checkbox {
  cursor: pointer;
  width: 16px;
  height: 16px;
  accent-color: var(--accent-purple, #b388ff);
}

.lap-sel-num-col {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 6px;
}

.lap-sel-best-badge {
  color: #ffc107;
  font-size: 0.75rem;
}

.lap-sel-time-col {
  width: 90px;
  text-align: right;
  font-family: var(--font-mono);
  font-weight: 700;
}

.lap-sel-diff-col {
  width: 75px;
  text-align: right;
  font-family: var(--font-mono);
  font-size: 0.76rem;
}

.lap-sel-diff.best {
  color: #00ff88;
  font-weight: 800;
}

.lap-sel-diff {
  color: var(--text-dim);
}

.lap-sel-tag-col {
  width: 58px;
  text-align: center;
}

.lap-sel-role-tag {
  font-size: 0.7rem;
  font-weight: 800;
  padding: 1px 6px;
  border-radius: 4px;
}

.lap-sel-role-tag.ref {
  background: rgba(255, 51, 102, 0.2);
  color: #ff3366;
}

.lap-sel-role-tag.cmp {
  background: rgba(0, 229, 255, 0.2);
  color: #00e5ff;
}


.lap-selector-modal-footer {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  border-top: 1px solid var(--border-subtle);
}

.lap-selector-modal-footer .btn {
  font-size: 0.95rem !important;
  height: 42px !important;
  padding: 0 1.25rem !important;
  font-weight: 700 !important;
  border-radius: var(--radius-sm);
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.4rem !important;
}

.lap-selector-modal-footer .btn-outline {
  font-size: 0.92rem !important;
  height: 42px !important;
  padding: 0 1.15rem !important;
  font-weight: 600 !important;
}

#btn-launch-session-lap-analysis {
  font-size: 0.95rem !important;
  height: 42px !important;
  padding: 0 1.35rem !important;
  font-weight: 800 !important;
  background: linear-gradient(135deg, #7c3aed, #6d28d9) !important;
  color: #ffffff !important;
  border: 1px solid #8b5cf6 !important;
  box-shadow: 0 3px 12px rgba(124, 58, 237, 0.35) !important;
}

#btn-launch-session-lap-analysis:hover:not([disabled]) {
  background: linear-gradient(135deg, #6d28d9, #5b21b6) !important;
  box-shadow: 0 4px 16px rgba(124, 58, 237, 0.5) !important;
}

#btn-launch-session-lap-analysis[disabled] {
  opacity: 0.45 !important;
  cursor: not-allowed !important;
  box-shadow: none !important;
}

/* Sorting Buttons & Indicators */
.lap-sel-sort-row {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.lap-sel-sort-label {
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--text-dim);
  text-transform: uppercase;
  display: inline-flex;
  align-items: center;
  gap: 3px;
}

.lap-sel-sort-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: var(--text-main);
  padding: 0.22rem 0.55rem;
  border-radius: 4px;
  font-size: 0.74rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.lap-sel-sort-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.lap-sel-sort-btn.active {
  background: rgba(0, 240, 255, 0.15) !important;
  border-color: var(--accent-cyan) !important;
  color: var(--accent-cyan) !important;
}

.lap-sel-table-header span.sortable {
  cursor: pointer;
  user-select: none;
  transition: color 0.15s ease;
}

.lap-sel-table-header span.sortable:hover {
  color: var(--accent-cyan);
}


.btn-purple {
  background: #7c3aed;
  color: #fff;
  border: 1px solid #8b5cf6;
}

.btn-purple:hover {
  background: #6d28d9;
}

.btn-session-analysis {
  color: var(--accent-purple, #b388ff);
  border-color: rgba(179, 136, 255, 0.4);
}


/* =========================================================================
   LIGHT MODE OVERRIDES: SESSION LAP SELECTOR MODAL (HIGH CONTRAST & VISIBILITY)
   ========================================================================= */
html[data-theme="light"] .lap-selector-modal-card,
[data-theme="light"] .lap-selector-modal-card {
  background: #ffffff !important;
  color: #0f172a !important;
  border: 1px solid #cbd5e1 !important;
  box-shadow: 0 12px 36px rgba(15, 23, 42, 0.18) !important;
}

html[data-theme="light"] .lap-selector-modal-card .modal-header,
[data-theme="light"] .lap-selector-modal-card .modal-header {
  border-bottom: 1px solid #e2e8f0 !important;
  background: #f8fafc !important;
}

html[data-theme="light"] .lap-selector-modal-card .modal-title,
[data-theme="light"] .lap-selector-modal-card .modal-title {
  color: #0f172a !important;
  font-weight: 800 !important;
}

html[data-theme="light"] .lap-selector-modal-card .modal-close-btn,
[data-theme="light"] .lap-selector-modal-card .modal-close-btn {
  color: #475569 !important;
}
html[data-theme="light"] .lap-selector-modal-card .modal-close-btn:hover,
[data-theme="light"] .lap-selector-modal-card .modal-close-btn:hover {
  color: #0f172a !important;
  background: #e2e8f0 !important;
}

html[data-theme="light"] .lap-sel-header-card,
[data-theme="light"] .lap-sel-header-card {
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
}

html[data-theme="light"] .lap-sel-track-title,
[data-theme="light"] .lap-sel-track-title {
  color: #0f172a !important;
  font-weight: 800 !important;
}

html[data-theme="light"] .lap-sel-meta-line,
[data-theme="light"] .lap-sel-meta-line {
  color: #334155 !important;
  font-weight: 600 !important;
}

/* Presets & Sorting */
html[data-theme="light"] .lap-sel-presets-label,
[data-theme="light"] .lap-sel-presets-label,
html[data-theme="light"] .lap-sel-sort-label,
[data-theme="light"] .lap-sel-sort-label {
  color: #334155 !important;
  font-weight: 800 !important;
}

html[data-theme="light"] .lap-sel-preset-btn,
[data-theme="light"] .lap-sel-preset-btn {
  background: #f5f3ff !important;
  color: #6d28d9 !important;
  border: 1px solid #c4b5fd !important;
  font-weight: 700 !important;
}
html[data-theme="light"] .lap-sel-preset-btn:hover,
[data-theme="light"] .lap-sel-preset-btn:hover {
  background: #ede9fe !important;
  color: #5b21b6 !important;
}

html[data-theme="light"] .lap-sel-preset-btn.clear,
[data-theme="light"] .lap-sel-preset-btn.clear {
  background: #f1f5f9 !important;
  color: #475569 !important;
  border: 1px solid #cbd5e1 !important;
}

html[data-theme="light"] .lap-sel-sort-btn,
[data-theme="light"] .lap-sel-sort-btn {
  background: #ffffff !important;
  color: #334155 !important;
  border: 1px solid #cbd5e1 !important;
  font-weight: 700 !important;
}
html[data-theme="light"] .lap-sel-sort-btn:hover,
[data-theme="light"] .lap-sel-sort-btn:hover {
  background: #f1f5f9 !important;
  color: #0f172a !important;
}
html[data-theme="light"] .lap-sel-sort-btn.active,
[data-theme="light"] .lap-sel-sort-btn.active {
  background: #e0f2fe !important;
  color: #0369a1 !important;
  border-color: #0284c7 !important;
}

/* Summary Banner High Contrast */
html[data-theme="light"] .lap-sel-summary-box.ready,
[data-theme="light"] .lap-sel-summary-box.ready {
  background: #f0fdf4 !important;
  border: 1.5px solid #059669 !important;
  color: #064e3b !important;
}

html[data-theme="light"] .lap-sel-summary-box.pending,
[data-theme="light"] .lap-sel-summary-box.pending {
  background: #fffbeb !important;
  border: 1.5px solid #d97706 !important;
  color: #78350f !important;
  font-weight: 700 !important;
}

html[data-theme="light"] .lap-sel-chip.ref,
[data-theme="light"] .lap-sel-chip.ref {
  background: #ffe4e6 !important;
  color: #be123c !important;
  border: 1.5px solid #f43f5e !important;
  font-weight: 800 !important;
}

html[data-theme="light"] .lap-sel-chip.cmp,
[data-theme="light"] .lap-sel-chip.cmp {
  background: #e0f2fe !important;
  color: #0369a1 !important;
  border: 1.5px solid #0284c7 !important;
  font-weight: 800 !important;
}

html[data-theme="light"] .lap-sel-vs,
[data-theme="light"] .lap-sel-vs {
  color: #475569 !important;
  font-weight: 900 !important;
}

html[data-theme="light"] .lap-sel-delta,
[data-theme="light"] .lap-sel-delta {
  color: #0284c7 !important;
  font-weight: 800 !important;
}

/* Table High Contrast */
html[data-theme="light"] .lap-sel-table-wrap,
[data-theme="light"] .lap-sel-table-wrap {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
}

html[data-theme="light"] .lap-sel-table-header,
[data-theme="light"] .lap-sel-table-header {
  background: #f1f5f9 !important;
  color: #0f172a !important;
  font-weight: 800 !important;
  border-bottom: 1px solid #cbd5e1 !important;
}

html[data-theme="light"] .lap-sel-table-header span.sortable:hover,
[data-theme="light"] .lap-sel-table-header span.sortable:hover {
  color: #7c3aed !important;
}

html[data-theme="light"] .lap-sel-row,
[data-theme="light"] .lap-sel-row {
  border-bottom: 1px solid #e2e8f0 !important;
  color: #0f172a !important;
}

html[data-theme="light"] .lap-sel-row:hover,
[data-theme="light"] .lap-sel-row:hover {
  background: #f8fafc !important;
}

html[data-theme="light"] .lap-sel-row.selected-ref,
[data-theme="light"] .lap-sel-row.selected-ref {
  background: #fff1f2 !important;
  border-left: 4px solid #e11d48 !important;
}

html[data-theme="light"] .lap-sel-row.selected-cmp,
[data-theme="light"] .lap-sel-row.selected-cmp {
  background: #f0f9ff !important;
  border-left: 4px solid #0284c7 !important;
}

html[data-theme="light"] .lap-sel-num-col strong,
[data-theme="light"] .lap-sel-num-col strong {
  color: #0f172a !important;
  font-weight: 800 !important;
}

html[data-theme="light"] .lap-sel-time-col,
[data-theme="light"] .lap-sel-time-col {
  color: #0f172a !important;
  font-weight: 800 !important;
}

html[data-theme="light"] .lap-sel-diff,
[data-theme="light"] .lap-sel-diff {
  color: #475569 !important;
  font-weight: 700 !important;
}

html[data-theme="light"] .lap-sel-diff.best,
[data-theme="light"] .lap-sel-diff.best {
  color: #047857 !important;
  background: #d1fae5 !important;
  padding: 1px 6px !important;
  border-radius: 4px !important;
  font-weight: 800 !important;
}

html[data-theme="light"] .lap-sel-role-tag.ref,
[data-theme="light"] .lap-sel-role-tag.ref {
  background: #ffe4e6 !important;
  color: #be123c !important;
  border: 1px solid #f43f5e !important;
  font-weight: 800 !important;
}

html[data-theme="light"] .lap-sel-role-tag.cmp,
[data-theme="light"] .lap-sel-role-tag.cmp {
  background: #e0f2fe !important;
  color: #0369a1 !important;
  border: 1px solid #0284c7 !important;
  font-weight: 800 !important;
}

/* Modal Footer & Action Buttons in Light Mode */
html[data-theme="light"] .lap-selector-modal-footer,
[data-theme="light"] .lap-selector-modal-footer {
  background: #f8fafc !important;
  border-top: 1px solid #cbd5e1 !important;
}

html[data-theme="light"] .lap-selector-modal-footer .btn-outline,
[data-theme="light"] .lap-selector-modal-footer .btn-outline {
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
  color: #1e293b !important;
  font-size: 0.92rem !important;
  font-weight: 700 !important;
  height: 42px !important;
  padding: 0 1.25rem !important;
}

html[data-theme="light"] .lap-selector-modal-footer .btn-outline:hover,
[data-theme="light"] .lap-selector-modal-footer .btn-outline:hover {
  background: #f1f5f9 !important;
  color: #0f172a !important;
  border-color: #94a3b8 !important;
}

html[data-theme="light"] #btn-launch-session-lap-analysis,
[data-theme="light"] #btn-launch-session-lap-analysis {
  background: linear-gradient(135deg, #7c3aed, #6d28d9) !important;
  color: #ffffff !important;
  font-size: 0.95rem !important;
  font-weight: 800 !important;
  height: 42px !important;
  padding: 0 1.45rem !important;
  border: none !important;
  box-shadow: 0 4px 14px rgba(124, 58, 237, 0.4) !important;
}

html[data-theme="light"] #btn-launch-session-lap-analysis:hover:not([disabled]),
[data-theme="light"] #btn-launch-session-lap-analysis:hover:not([disabled]) {
  background: linear-gradient(135deg, #6d28d9, #5b21b6) !important;
  box-shadow: 0 6px 18px rgba(124, 58, 237, 0.5) !important;
}

html[data-theme="light"] #btn-launch-session-lap-analysis[disabled],
[data-theme="light"] #btn-launch-session-lap-analysis[disabled] {
  background: #e2e8f0 !important;
  color: #94a3b8 !important;
  box-shadow: none !important;
  opacity: 0.65 !important;
}


html[data-theme="light"] .btn-session-analysis {
  color: #7c3aed !important;
  border-color: rgba(124, 58, 237, 0.35) !important;
  background: rgba(124, 58, 237, 0.06) !important;
}

html[data-theme="light"] .btn-session-analysis:hover {
  background: rgba(124, 58, 237, 0.15) !important;
}

/* =========================================================================
   SESSION CARD ACTIONS BAR (RESPONSIVE GRID WHEN ANALYSIS BUTTON IS PRESENT)
   ========================================================================= */
.session-actions-bar.has-analysis {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  grid-template-rows: auto auto !important;
  gap: 0.4rem !important;
  width: 100% !important;
  box-sizing: border-box !important;
}

.session-actions-bar.has-analysis .btn-sm {
  width: 100% !important;
  min-width: 0 !important;
  padding: 0.42rem 0.35rem !important;
  font-size: 0.76rem !important;
  font-weight: 600 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 0.28rem !important;
  white-space: nowrap !important;
  box-sizing: border-box !important;
}

.session-actions-bar.has-analysis .btn-sm i {
  width: 13px !important;
  height: 13px !important;
  flex-shrink: 0 !important;
}

.session-actions-bar.has-analysis .action-btn-label {
  display: inline !important;
}

/* Single-row configuration when Analysis button is NOT present */
.session-actions-bar:not(.has-analysis) {
  display: flex !important;
  align-items: center !important;
  gap: 0.4rem !important;
}

.session-actions-bar:not(.has-analysis) .action-btn-label {
  display: none !important;
}

.session-actions-bar:not(.has-analysis) .btn-session-detail {
  flex: 1.15;
}

.session-actions-bar:not(.has-analysis) .btn-session-edit {
  flex: 1;
}

@media (max-width: 768px) {
  .session-actions-bar.has-analysis {
    gap: 0.32rem !important;
  }
  .session-actions-bar.has-analysis .btn-sm {
    padding: 0.38rem 0.25rem !important;
    font-size: 0.72rem !important;
  }
}


/* =========================================================================
   CIRCUIT TOOLS 3: MAX SPEED SECTORS & MULTI-LAP MATRIX TABLE
   ========================================================================= */

/* Circuit Tools 3 Sector Color Strip (Directly Above Speed Graph) */
.ct-sector-strip {
  display: flex;
  width: 100%;
  height: 20px;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
  font-family: var(--font-mono, monospace);
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}
.ct-sector-strip-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  box-sizing: border-box;
  border-right: 1px solid rgba(0, 0, 0, 0.25);
  transition: opacity 0.15s ease, filter 0.15s ease;
  user-select: none;
}
.ct-sector-strip-seg:last-child {
  border-right: none;
}
.ct-sector-strip-seg.active-seg {
  filter: brightness(1.25);
  outline: 2px solid #ffffff;
  outline-offset: -2px;
  z-index: 2;
}

/* Circuit Tools 3 Matrix Table */
.ct-matrix-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0;
  padding: 0;
}
.ct-matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.80rem !important;
  white-space: nowrap;
}
.ct-matrix-table th {
  padding: 0.4rem 0.5rem !important;
  background: rgba(255, 255, 255, 0.05);
  font-weight: 800;
  text-align: center;
  border-bottom: 1.5px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
  font-family: var(--font-sans, sans-serif);
}
.ct-matrix-table td {
  padding: 0.35rem 0.5rem !important;
  vertical-align: middle;
  text-align: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.ct-matrix-table tr.row-ref {
  background: rgba(255, 51, 102, 0.10) !important;
}
.ct-matrix-table tr.row-cmp {
  background: rgba(0, 229, 255, 0.10) !important;
}
.ct-matrix-table tr:hover td {
  background: rgba(255, 255, 255, 0.06);
}
.ct-matrix-summary-row {
  font-weight: 800;
  background: rgba(255, 255, 255, 0.03);
  border-top: 1.5px solid var(--border-subtle, rgba(255, 255, 255, 0.15));
}
.ct-matrix-summary-row td {
  padding: 0.4rem 0.5rem !important;
}
.ct-val-ref {
  color: #ffffff;
  font-weight: 800;
  font-family: var(--font-mono, monospace);
}
html[data-theme="light"] .ct-val-ref {
  color: #0f172a;
}
.ct-val-delta-gain {
  color: #00e676 !important;
  font-weight: 800;
  font-family: var(--font-mono, monospace);
}
.ct-val-delta-loss {
  color: #ff3366 !important;
  font-weight: 800;
  font-family: var(--font-mono, monospace);
}
.ct-val-delta-zero {
  color: var(--text-dim, #94a3b8);
  font-family: var(--font-mono, monospace);
}
.ct-show-box {
  width: 18px;
  height: 18px;
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
  margin: 0 auto;
}
.ct-show-box.ref {
  background: #ff3366;
  color: #ffffff;
  border: 1px solid #ff3366;
}
.ct-show-box.cmp {
  background: #00e5ff;
  color: #000000;
  border: 1px solid #00e5ff;
}
.ct-show-box.off {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: transparent;
}
.ct-show-box.off:hover {
  border-color: #00e5ff;
}

/* =========================================================================
   MOBILE-OPTIMIZED SECTOR ANALYSIS & VIEW SWITCHER
   ========================================================================= */

.ct-matrix-title-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.6rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.ct-sector-view-toggle {
  display: inline-flex;
  align-items: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  padding: 2px;
  gap: 2px;
}
html[data-theme="light"] .ct-sector-view-toggle {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.ct-view-tab-btn {
  background: transparent;
  border: none;
  color: var(--text-dim, #94a3b8);
  font-size: 0.74rem;
  font-weight: 700;
  padding: 0.22rem 0.6rem;
  border-radius: 4px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
  font-family: var(--font-sans, sans-serif);
}
.ct-view-tab-btn:hover {
  color: #ffffff;
}
html[data-theme="light"] .ct-view-tab-btn:hover {
  color: #0f172a;
}
.ct-view-tab-btn.active {
  background: var(--accent-cyan, #00e5ff);
  color: #000000 !important;
  font-weight: 800;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}

/* 1. Focused 2-Lap Sector View Container */
.ct-focused-sector-container {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}

.ct-focused-summary-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 0.55rem 0.85rem;
  margin-bottom: 0.35rem;
}
html[data-theme="light"] .ct-focused-summary-banner {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.ct-focused-summary-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.ct-focused-summary-col.cmp {
  align-items: flex-end;
}
.ct-summary-tag {
  font-size: 0.70rem;
  font-weight: 700;
}
.ct-summary-tag.ref { color: #ff3366; }
.ct-summary-tag.cmp { color: #00e5ff; }
html[data-theme="light"] .ct-summary-tag.cmp { color: #0284c7; }

.ct-summary-val {
  font-family: var(--font-mono, monospace);
  font-size: 0.95rem;
  font-weight: 800;
  color: #ffffff;
}
html[data-theme="light"] .ct-summary-val { color: #0f172a; }

.ct-focused-summary-delta {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.2rem 0.65rem;
  border-radius: 6px;
}
.ct-focused-summary-delta.gain {
  background: rgba(0, 230, 118, 0.12);
  border: 1px solid rgba(0, 230, 118, 0.3);
}
.ct-focused-summary-delta.loss {
  background: rgba(255, 51, 102, 0.12);
  border: 1px solid rgba(255, 51, 102, 0.3);
}
.ct-delta-huge {
  font-family: var(--font-mono, monospace);
  font-size: 1.05rem;
  font-weight: 900;
}
.ct-focused-summary-delta.gain .ct-delta-huge { color: #00e676; }
.ct-focused-summary-delta.loss .ct-delta-huge { color: #ff3366; }

.ct-delta-caption {
  font-size: 0.65rem;
  color: var(--text-dim, #94a3b8);
  font-weight: 600;
}

.ct-focused-sector-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  max-height: 380px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding-right: 2px;
}

.ct-focused-sector-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 6px;
  padding: 0.45rem 0.65rem;
  cursor: pointer;
  transition: all 0.15s ease;
  gap: 0.5rem;
  user-select: none;
}
.ct-focused-sector-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
}
html[data-theme="light"] .ct-focused-sector-card {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04);
}
html[data-theme="light"] .ct-focused-sector-card:hover {
  background: #f8fafc;
  border-color: #cbd5e1;
}

.ct-focused-sector-card.active-sector-card {
  background: rgba(0, 229, 255, 0.08) !important;
  border-color: var(--accent-cyan, #00e5ff) !important;
  box-shadow: 0 0 8px rgba(0, 229, 255, 0.25);
}

.ct-card-left-group {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  min-width: 95px;
}

.ct-sector-badge-pill {
  width: 28px;
  height: 22px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 900;
  color: #ffffff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  font-family: var(--font-mono, monospace);
  flex-shrink: 0;
}

.ct-sec-info {
  display: flex;
  flex-direction: column;
}

.ct-sec-name {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-main, #e2e8f0);
}
html[data-theme="light"] .ct-sec-name { color: #1e293b; }

.ct-sec-dist {
  font-size: 0.65rem;
  font-family: var(--font-mono, monospace);
  color: var(--text-dim, #94a3b8);
  white-space: nowrap;
}

.ct-card-mid-times {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono, monospace);
  font-size: 0.78rem;
  white-space: nowrap;
}

.ct-time-comp-item {
  display: flex;
  align-items: center;
  gap: 2px;
}
.ct-time-val {
  font-weight: 700;
  color: #ffffff;
}
html[data-theme="light"] .ct-time-val { color: #0f172a; }

.ct-time-comp-divider {
  color: var(--text-dim, #64748b);
  font-size: 0.7rem;
}

.ct-card-right-delta {
  min-width: 72px;
  text-align: right;
}

.ct-focused-delta-badge {
  display: inline-block;
  font-family: var(--font-mono, monospace);
  font-size: 0.74rem;
  font-weight: 800;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  white-space: nowrap;
}
.ct-focused-delta-badge.gain {
  background: rgba(0, 230, 118, 0.15);
  color: #00e676;
  border: 1px solid rgba(0, 230, 118, 0.3);
}
.ct-focused-delta-badge.loss {
  background: rgba(255, 51, 102, 0.15);
  color: #ff3366;
  border: 1px solid rgba(255, 51, 102, 0.3);
}
.ct-focused-delta-badge.zero {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-dim, #94a3b8);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* 2. Sticky Columns for Matrix Table on Mobile */
.ct-matrix-scroll-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  position: relative;
}

.ct-matrix-table {
  border-collapse: separate !important;
  border-spacing: 0 !important;
}

.ct-matrix-table th:nth-child(1),
.ct-matrix-table td:nth-child(1) {
  position: sticky !important;
  left: 0 !important;
  z-index: 5 !important;
  background: #0f141d;
  width: 46px;
  min-width: 46px;
  max-width: 46px;
}

.ct-matrix-table th:nth-child(2),
.ct-matrix-table td:nth-child(2) {
  position: sticky !important;
  left: 46px !important;
  z-index: 5 !important;
  background: #0f141d;
  width: 62px;
  min-width: 62px;
  max-width: 62px;
}

.ct-matrix-table th:nth-child(3),
.ct-matrix-table td:nth-child(3) {
  position: sticky !important;
  left: 108px !important;
  z-index: 5 !important;
  background: #0f141d;
  width: 96px;
  min-width: 96px;
  max-width: 96px;
  border-right: 1.5px solid var(--border-subtle, rgba(255, 255, 255, 0.15)) !important;
  box-shadow: 3px 0 6px -2px rgba(0, 0, 0, 0.5);
}

html[data-theme="light"] .ct-matrix-table th:nth-child(1),
html[data-theme="light"] .ct-matrix-table td:nth-child(1),
html[data-theme="light"] .ct-matrix-table th:nth-child(2),
html[data-theme="light"] .ct-matrix-table td:nth-child(2),
html[data-theme="light"] .ct-matrix-table th:nth-child(3),
html[data-theme="light"] .ct-matrix-table td:nth-child(3) {
  background: #ffffff !important;
}

.ct-matrix-table tr.row-ref td:nth-child(1),
.ct-matrix-table tr.row-ref td:nth-child(2),
.ct-matrix-table tr.row-ref td:nth-child(3) {
  background: #2b1420 !important;
}
html[data-theme="light"] .ct-matrix-table tr.row-ref td:nth-child(1),
html[data-theme="light"] .ct-matrix-table tr.row-ref td:nth-child(2),
html[data-theme="light"] .ct-matrix-table tr.row-ref td:nth-child(3) {
  background: #ffebee !important;
}

.ct-matrix-table tr.row-cmp td:nth-child(1),
.ct-matrix-table tr.row-cmp td:nth-child(2),
.ct-matrix-table tr.row-cmp td:nth-child(3) {
  background: #0d2233 !important;
}
html[data-theme="light"] .ct-matrix-table tr.row-cmp td:nth-child(1),
html[data-theme="light"] .ct-matrix-table tr.row-cmp td:nth-child(2),
html[data-theme="light"] .ct-matrix-table tr.row-cmp td:nth-child(3) {
  background: #e0f7fa !important;
}

.ct-matrix-table tr.ct-matrix-summary-row td:nth-child(1),
.ct-matrix-table tr.ct-matrix-summary-row td:nth-child(2),
.ct-matrix-table tr.ct-matrix-summary-row td:nth-child(3) {
  background: #151a24 !important;
}
html[data-theme="light"] .ct-matrix-table tr.ct-matrix-summary-row td:nth-child(1),
html[data-theme="light"] .ct-matrix-table tr.ct-matrix-summary-row td:nth-child(2),
html[data-theme="light"] .ct-matrix-table tr.ct-matrix-summary-row td:nth-child(3) {
  background: #f1f5f9 !important;
}

/* =========================================================================
   2-LAP COMPARISON MATRIX TABLE (ULTRA-CLEAN & HIGH VISIBILITY)
   ========================================================================= */

.ct-focused-matrix-wrap {
  width: 100%;
  margin-bottom: 0.75rem;
  overflow-x: auto;
  border-radius: 6px;
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.12));
}

.ct-2lap-matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem !important;
  white-space: nowrap;
}

.ct-2lap-matrix-table th {
  padding: 0.5rem 0.65rem !important;
  background: rgba(255, 255, 255, 0.05);
  font-weight: 800;
  border-bottom: 2px solid var(--border-subtle, rgba(255, 255, 255, 0.15));
  font-family: var(--font-sans, sans-serif);
  font-size: 0.82rem;
}
html[data-theme="light"] .ct-2lap-matrix-table th {
  background: #f1f5f9;
  border-bottom-color: #cbd5e1;
}

.ct-2lap-matrix-table td {
  padding: 0.42rem 0.65rem !important;
  vertical-align: middle;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.12s ease;
}
html[data-theme="light"] .ct-2lap-matrix-table td {
  border-bottom-color: #e2e8f0;
}

.ct-2lap-matrix-table tr.ct-2lap-row:hover td {
  background: rgba(255, 255, 255, 0.05);
}
html[data-theme="light"] .ct-2lap-matrix-table tr.ct-2lap-row:hover td {
  background: #f8fafc;
}

.ct-2lap-matrix-table tr.active-2lap-row td {
  background: rgba(0, 229, 255, 0.12) !important;
  border-color: var(--accent-cyan, #00e5ff) !important;
}

.ct-sector-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 22px;
  padding: 0 0.4rem;
  border-radius: 4px;
  color: #ffffff;
  font-size: 0.76rem;
  font-weight: 900;
  font-family: var(--font-mono, monospace);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.ct-2lap-total-row {
  background: rgba(255, 255, 255, 0.04);
  border-top: 2px solid var(--border-subtle, rgba(255, 255, 255, 0.2)) !important;
}
html[data-theme="light"] .ct-2lap-total-row {
  background: #f1f5f9;
  border-top-color: #cbd5e1 !important;
}
.ct-2lap-total-row td {
  padding: 0.55rem 0.65rem !important;
  font-size: 0.92rem !important;
}

/* =========================================================================
   SIMPLIFIED TOP LAPTIME STRIP IN LAP ANALYSIS MODAL
   ========================================================================= */

.ct-slim-legend-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.1));
  border-radius: 8px;
  padding: 0.42rem 0.75rem;
  margin-bottom: 0.65rem;
}
html[data-theme="light"] .ct-slim-legend-strip {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.ct-slim-card {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex: 1;
}
.ct-slim-card.cmp {
  justify-content: flex-end;
}

.ct-slim-badge {
  font-size: 0.70rem;
  font-weight: 800;
  padding: 0.12rem 0.38rem;
  border-radius: 3px;
  white-space: nowrap;
}
.ct-slim-badge.ref {
  background: rgba(255, 51, 102, 0.15);
  color: #ff3366;
}
.ct-slim-badge.cmp {
  background: rgba(0, 229, 255, 0.15);
  color: #00e5ff;
}
html[data-theme="light"] .ct-slim-badge.cmp {
  color: #0284c7;
}

.ct-slim-title {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-main, #ffffff);
  white-space: nowrap;
}
html[data-theme="light"] .ct-slim-title {
  color: #0f172a;
}

.ct-slim-time {
  font-family: var(--font-mono, monospace);
  font-size: 0.96rem;
  font-weight: 900;
  white-space: nowrap;
}
.ct-slim-time.ref {
  color: #ff3366;
}
.ct-slim-time.cmp {
  color: #00e5ff;
}
html[data-theme="light"] .ct-slim-time.cmp {
  color: #0284c7;
}

.ct-slim-delta-box {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.16rem 0.55rem;
  border-radius: 4px;
  font-family: var(--font-mono, monospace);
  font-size: 0.84rem;
  font-weight: 900;
  white-space: nowrap;
  flex-shrink: 0;
}
.ct-slim-delta-box.gain {
  background: rgba(0, 230, 118, 0.15);
  color: #00e676;
  border: 1px solid rgba(0, 230, 118, 0.35);
}
.ct-slim-delta-box.loss {
  background: rgba(255, 51, 102, 0.15);
  color: #ff3366;
  border: 1px solid rgba(255, 51, 102, 0.35);
}

/* =========================================================================
   2-LAP COMPARE DISTINCT DELTA PILL BADGES (+ RED, - GREEN)
   ========================================================================= */

.ct-delta-pill-badge {
  display: inline-block;
  font-family: var(--font-mono, monospace);
  font-size: 0.82rem;
  font-weight: 800;
  padding: 0.14rem 0.52rem;
  border-radius: 4px;
  white-space: nowrap;
  text-align: right;
  line-height: 1.25;
}

/* Gaining Time (-) -> High Contrast Bright Green */
.ct-delta-pill-badge.ct-delta-badge-gain {
  background: rgba(0, 230, 118, 0.18) !important;
  color: #00e676 !important;
  border: 1px solid rgba(0, 230, 118, 0.45) !important;
  box-shadow: 0 1px 3px rgba(0, 230, 118, 0.15);
}

/* Losing Time (+) -> High Contrast Bright Red/Coral */
.ct-delta-pill-badge.ct-delta-badge-loss {
  background: rgba(255, 51, 102, 0.18) !important;
  color: #ff3366 !important;
  border: 1px solid rgba(255, 51, 102, 0.45) !important;
  box-shadow: 0 1px 3px rgba(255, 51, 102, 0.15);
}

/* Zero Delta (00.00) -> Neutral Dim Gray */
.ct-delta-pill-badge.ct-delta-badge-zero {
  color: var(--text-dim, #94a3b8) !important;
  background: transparent !important;
  border: 1px solid transparent !important;
}

/* =========================================================================
   MOBILE RESPONSIVE: ENABLE FULL MATRIX TAB & HORIZONTAL SCROLL
   ========================================================================= */

@media (max-width: 768px) {
  #btn-ct-view-matrix {
    display: inline-flex !important;
  }

  .ct-sector-table-wrap {
    overflow-x: visible !important;
  }

  .ct-matrix-scroll-wrap {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    box-sizing: border-box !important;
    padding-bottom: 8px;
    margin-top: 0.35rem;
    scrollbar-width: thin;
  }

  .ct-matrix-scroll-wrap::-webkit-scrollbar {
    height: 6px;
  }

  .ct-matrix-scroll-wrap::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.25);
    border-radius: 3px;
  }

  .ct-matrix-table,
  .ct-sector-table.is-matrix {
    width: max-content !important;
    min-width: 100% !important;
    table-layout: auto !important;
    border-collapse: separate !important;
    border-spacing: 0 !important;
  }

  .ct-matrix-table th,
  .ct-matrix-table td,
  .ct-sector-table.is-matrix th,
  .ct-sector-table.is-matrix td {
    padding: 0.35rem 0.55rem !important;
    font-size: 0.76rem !important;
    white-space: nowrap !important;
    overflow: visible !important;
    text-overflow: clip !important;
  }
}

/* =========================================================================
   SESSION CARD EXAMPLE BADGE
   ========================================================================= */

.session-example-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: rgba(0, 229, 255, 0.15);
  color: var(--accent-cyan, #00e5ff);
  border: 1px solid rgba(0, 229, 255, 0.45);
  border-radius: 4px;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 1px 6px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  vertical-align: middle;
}
html[data-theme="light"] .session-example-badge {
  background: rgba(2, 132, 199, 0.12);
  color: #0284c7;
  border-color: rgba(2, 132, 199, 0.35);
}


/* =========================================================================
   LIGHT MODE: COMPREHENSIVE HIGH-VISIBILITY FOR LAP ANALYSIS MODAL
   ========================================================================= */
html[data-theme="light"] .ct-modal-card,
[data-theme="light"] .ct-modal-card {
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  color: #0f172a !important;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.18) !important;
}

html[data-theme="light"] .ct-modal-card .modal-drag-indicator,
[data-theme="light"] .ct-modal-card .modal-drag-indicator {
  background: rgba(15, 23, 42, 0.18) !important;
}

html[data-theme="light"] .ct-modal-card .modal-header,
[data-theme="light"] .ct-modal-card .modal-header,
html[data-theme="light"] #modal-lap-analysis-compare .modal-header,
[data-theme="light"] #modal-lap-analysis-compare .modal-header,
html[data-theme="light"] #modal-circuit-tools-compare .modal-header,
[data-theme="light"] #modal-circuit-tools-compare .modal-header {
  background: #ffffff !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

html[data-theme="light"] #modal-lap-analysis-compare .modal-title,
[data-theme="light"] #modal-lap-analysis-compare .modal-title,
html[data-theme="light"] #modal-circuit-tools-compare .modal-title,
[data-theme="light"] #modal-circuit-tools-compare .modal-title,
html[data-theme="light"] #ct-modal-title,
[data-theme="light"] #ct-modal-title {
  color: #0f172a !important;
  font-weight: 800 !important;
}

html[data-theme="light"] .ct-modal-card .modal-close-btn,
[data-theme="light"] .ct-modal-card .modal-close-btn,
html[data-theme="light"] #modal-lap-analysis-compare .modal-close-btn,
[data-theme="light"] #modal-lap-analysis-compare .modal-close-btn,
html[data-theme="light"] #modal-circuit-tools-compare .modal-close-btn,
[data-theme="light"] #modal-circuit-tools-compare .modal-close-btn {
  color: #475569 !important;
  background: #f1f5f9 !important;
  border-radius: 8px !important;
}
html[data-theme="light"] .ct-modal-card .modal-close-btn:hover,
[data-theme="light"] .ct-modal-card .modal-close-btn:hover,
html[data-theme="light"] #modal-lap-analysis-compare .modal-close-btn:hover,
[data-theme="light"] #modal-lap-analysis-compare .modal-close-btn:hover,
html[data-theme="light"] #modal-circuit-tools-compare .modal-close-btn:hover,
[data-theme="light"] #modal-circuit-tools-compare .modal-close-btn:hover {
  color: #0f172a !important;
  background: #e2e8f0 !important;
}

html[data-theme="light"] .ct-modal-body,
[data-theme="light"] .ct-modal-body {
  background: #ffffff !important;
  color: #0f172a !important;
}

/* Top Lap Legend Cards */
html[data-theme="light"] .ct-legend-card.ref,
[data-theme="light"] .ct-legend-card.ref {
  background: #fff1f2 !important;
  border: 2px solid #fda4af !important;
  box-shadow: 0 2px 8px rgba(225, 29, 72, 0.08) !important;
}

html[data-theme="light"] .ct-legend-card.ref .ct-card-driver,
[data-theme="light"] .ct-legend-card.ref .ct-card-driver {
  color: #0f172a !important;
  font-weight: 800 !important;
}

html[data-theme="light"] .ct-legend-card.ref .ct-card-vehicle,
[data-theme="light"] .ct-legend-card.ref .ct-card-vehicle {
  color: #475569 !important;
  font-weight: 600 !important;
}

html[data-theme="light"] .ct-legend-card.ref .ct-card-time.ref,
[data-theme="light"] .ct-legend-card.ref .ct-card-time.ref {
  color: #e11d48 !important;
  font-weight: 900 !important;
}

html[data-theme="light"] .ct-legend-card.ref .ct-card-subtag,
[data-theme="light"] .ct-legend-card.ref .ct-card-subtag {
  color: #be123c !important;
  font-weight: 700 !important;
}

html[data-theme="light"] .ct-legend-card.cmp,
[data-theme="light"] .ct-legend-card.cmp {
  background: #f0f9ff !important;
  border: 2px solid #7dd3fc !important;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.08) !important;
}

html[data-theme="light"] .ct-legend-card.cmp .ct-card-driver,
[data-theme="light"] .ct-legend-card.cmp .ct-card-driver {
  color: #0f172a !important;
  font-weight: 800 !important;
}

html[data-theme="light"] .ct-legend-card.cmp .ct-card-vehicle,
[data-theme="light"] .ct-legend-card.cmp .ct-card-vehicle {
  color: #475569 !important;
  font-weight: 600 !important;
}

html[data-theme="light"] .ct-legend-card.cmp .ct-card-time.cmp,
[data-theme="light"] .ct-legend-card.cmp .ct-card-time.cmp {
  color: #0284c7 !important;
  font-weight: 900 !important;
}

html[data-theme="light"] .ct-delta-tag.gain,
[data-theme="light"] .ct-delta-tag.gain {
  background: #dcfce7 !important;
  color: #15803d !important;
  border: 1.5px solid #86efac !important;
  font-weight: 800 !important;
}

html[data-theme="light"] .ct-delta-tag.loss,
[data-theme="light"] .ct-delta-tag.loss {
  background: #fee2e2 !important;
  color: #b91c1c !important;
  border: 1.5px solid #fca5a5 !important;
  font-weight: 800 !important;
}

/* Sector Splits Section */
html[data-theme="light"] .ct-sector-table-wrap,
[data-theme="light"] .ct-sector-table-wrap {
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
}

html[data-theme="light"] .ct-section-heading,
[data-theme="light"] .ct-section-heading {
  color: #0f172a !important;
  font-weight: 800 !important;
}

html[data-theme="light"] .ct-sector-view-toggle,
[data-theme="light"] .ct-sector-view-toggle {
  background: #f1f5f9 !important;
  border: 1px solid #cbd5e1 !important;
}

html[data-theme="light"] .ct-view-tab-btn,
[data-theme="light"] .ct-view-tab-btn {
  color: #475569 !important;
  font-weight: 700 !important;
}

html[data-theme="light"] .ct-view-tab-btn:hover,
[data-theme="light"] .ct-view-tab-btn:hover {
  color: #0f172a !important;
  background: #e2e8f0 !important;
}

html[data-theme="light"] .ct-view-tab-btn.active,
[data-theme="light"] .ct-view-tab-btn.active {
  background: #0284c7 !important;
  color: #ffffff !important;
  font-weight: 800 !important;
}

html[data-theme="light"] .ct-2lap-matrix-table,
[data-theme="light"] .ct-2lap-matrix-table {
  background: #ffffff !important;
  color: #0f172a !important;
}

html[data-theme="light"] .ct-2lap-matrix-table th,
[data-theme="light"] .ct-2lap-matrix-table th {
  background: #f1f5f9 !important;
  color: #0f172a !important;
  font-weight: 800 !important;
  border-bottom: 2px solid #cbd5e1 !important;
}

html[data-theme="light"] .ct-2lap-matrix-table td,
[data-theme="light"] .ct-2lap-matrix-table td {
  color: #0f172a !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

html[data-theme="light"] .ct-2lap-matrix-table tr.ct-2lap-row:hover td,
[data-theme="light"] .ct-2lap-matrix-table tr.ct-2lap-row:hover td {
  background: #f8fafc !important;
}

html[data-theme="light"] .ct-2lap-total-row,
[data-theme="light"] .ct-2lap-total-row {
  background: #f8fafc !important;
  color: #0f172a !important;
  font-weight: 900 !important;
  border-top: 2px solid #cbd5e1 !important;
}

/* Track Map Card */
html[data-theme="light"] .ct-map-card,
[data-theme="light"] .ct-map-card {
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
}

html[data-theme="light"] .ct-map-title,
[data-theme="light"] .ct-map-title {
  color: #0f172a !important;
  font-weight: 800 !important;
}

html[data-theme="light"] .ct-map-hint,
[data-theme="light"] .ct-map-hint {
  color: #0284c7 !important;
  font-weight: 700 !important;
}

html[data-theme="light"] .ct-map-line-legend,
[data-theme="light"] .ct-map-line-legend {
  color: #334155 !important;
  font-weight: 700 !important;
}

html[data-theme="light"] .ct-zoom-btn-group,
[data-theme="light"] .ct-zoom-btn-group {
  background: #f1f5f9 !important;
  border: 1.5px solid #cbd5e1 !important;
}

html[data-theme="light"] .ct-zoom-btn,
[data-theme="light"] .ct-zoom-btn {
  color: #0f172a !important;
  font-weight: 800 !important;
}

html[data-theme="light"] .ct-map-canvas-wrap,
[data-theme="light"] .ct-map-canvas-wrap {
  background: #f8fafc !important;
  border: 1px solid #cbd5e1 !important;
}

/* Telemetry Graphs & Scrubber */
html[data-theme="light"] .ct-graphs-container,
[data-theme="light"] .ct-graphs-container {
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
}

html[data-theme="light"] .ct-scrubber-readout,
[data-theme="light"] .ct-scrubber-readout {
  background: #f8fafc !important;
  border: 1.5px solid #cbd5e1 !important;
  color: #0f172a !important;
}

html[data-theme="light"] .ct-readout-label,
[data-theme="light"] .ct-readout-label {
  color: #475569 !important;
  font-weight: 700 !important;
}

html[data-theme="light"] .ct-canvas-wrap,
[data-theme="light"] .ct-canvas-wrap {
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
}

html[data-theme="light"] .ct-canvas-title,
[data-theme="light"] .ct-canvas-title {
  color: #0f172a !important;
  font-weight: 800 !important;
}


/* ==========================================================================
   DRIVER PROFILE MODAL (#modal-user-profile) & PASSKEY BOX STYLES
   ========================================================================== */
.prof-section-card {
  margin: 0.6rem 0;
  padding: 0.75rem 0.85rem;
  background: rgba(15, 23, 42, 0.7);
  border-radius: var(--radius-sm, 6px);
  box-sizing: border-box;
}

.prof-nickname-card {
  border: 1px solid rgba(0, 240, 255, 0.25);
}

.prof-passkey-card {
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.prof-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.4rem;
}

.prof-card-label {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.prof-card-subinfo {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.prof-nickname-input-row {
  display: flex;
  gap: 0.4rem;
  align-items: center;
}

#prof-nickname-input {
  flex: 1;
  height: 34px;
  font-size: 0.85rem;
  font-weight: 700;
  color: #ffffff;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: var(--radius-sm, 6px);
  padding: 0 0.65rem;
}

.prof-nickname-footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.35rem;
}

#prof-nickname-feedback {
  font-size: 0.72rem;
  color: var(--text-muted);
  min-height: 1rem;
}

.btn-prof-reset-nick {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 0.72rem;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
}

/* Passkey Card Components */
.prof-passkey-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
  flex-wrap: wrap;
}

.prof-passkey-label {
  font-size: 0.75rem;
  font-weight: 800;
  color: #10b981;
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.btn-prof-register-passkey {
  height: 26px;
  padding: 0 0.65rem;
  font-size: 0.72rem;
  font-weight: 700;
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid #10b981;
  color: #10b981;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.15s ease;
}

.btn-prof-register-passkey:hover {
  background: rgba(16, 185, 129, 0.28);
  border-color: #34d399;
  color: #ffffff;
}

.prof-passkey-desc {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin: 0 0 0.45rem;
  line-height: 1.35;
}

.prof-passkey-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  font-size: 0.75rem;
}

.prof-passkey-empty {
  color: var(--text-dim);
  font-size: 0.72rem;
  text-align: center;
  padding: 0.4rem 0;
}

.prof-passkey-empty.prof-passkey-error {
  color: #ef4444;
}

.prof-passkey-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.45rem 0.65rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 5px;
  min-height: 38px;
  box-sizing: border-box;
}

.prof-passkey-item-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  overflow: hidden;
  flex: 1;
}

.prof-passkey-item-icon {
  width: 15px;
  height: 15px;
  color: #10b981;
  flex-shrink: 0;
}

.prof-passkey-item-texts {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  overflow: hidden;
}

.prof-passkey-device-name {
  font-weight: 700;
  color: #ffffff;
  font-size: 0.75rem;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
}

.prof-passkey-device-date {
  font-size: 0.68rem;
  color: var(--text-dim);
}

.btn-prof-passkey-delete {
  background: none;
  border: none;
  color: #f87171;
  font-size: 0.75rem;
  cursor: pointer;
  padding: 5px 6px;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-width: 28px;
  min-height: 28px;
  transition: all 0.15s ease;
}

.btn-prof-passkey-delete:hover {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.btn-prof-passkey-delete i,
.btn-prof-passkey-delete svg {
  width: 14px;
  height: 14px;
}

/* Stats Grid */
.prof-stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
  margin: 0.6rem 0;
  background: rgba(0, 0, 0, 0.35);
  padding: 0.85rem;
  border-radius: var(--radius-sm, 6px);
  border: 1px solid var(--border-subtle);
  box-sizing: border-box;
}

.prof-stat-item {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.prof-stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.prof-stat-val {
  font-size: 0.85rem;
  font-weight: 700;
}

.prof-stat-val.val-cyan {
  color: var(--accent-cyan);
  font-size: 1rem;
  font-family: var(--font-mono);
}

.prof-stat-val.val-green {
  color: var(--accent-green);
  font-size: 1rem;
  font-family: var(--font-mono);
}

.prof-stat-val.val-norm {
  color: #ffffff;
  font-weight: 600;
}

/* Footer Actions */
.prof-actions-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-subtle);
  gap: 0.5rem;
}

.btn-prof-signout {
  background: rgba(255, 42, 75, 0.15);
  border: 1px solid rgba(255, 42, 75, 0.4);
  color: #ff6b81;
}

.btn-prof-signout:hover {
  background: rgba(255, 42, 75, 0.25);
  color: #ff4757;
}

.prof-links-footer {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  margin-top: 0.65rem;
  padding-top: 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.75rem;
}

.prof-link-privacy {
  color: var(--text-muted);
  text-decoration: none;
}
.prof-link-privacy:hover {
  color: var(--text-normal);
}

.prof-link-units {
  color: var(--accent-cyan);
  text-decoration: none;
  cursor: pointer;
  font-weight: 600;
}
.prof-link-units:hover {
  text-decoration: underline;
}

/* Mobile Responsiveness for Driver Profile & Passkeys */
@media (max-width: 480px) {
  #modal-user-profile .modal-card {
    padding: 0 !important;
    max-height: calc(100dvh - max(env(safe-area-inset-top, 0px), 28px) - 8px) !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
  }
  #modal-user-profile .modal-body {
    padding-left: 0.95rem !important;
    padding-right: 0.95rem !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    flex: 1 1 auto !important;
  }
  .prof-section-card {
    margin: 0.5rem 0;
    padding: 0.65rem 0.75rem;
  }
  .prof-passkey-header {
    margin-bottom: 0.4rem;
    gap: 0.4rem;
  }
  .prof-passkey-label {
    font-size: 0.74rem;
  }
  .btn-prof-register-passkey {
    height: 28px;
    font-size: 0.72rem;
    padding: 0 0.6rem;
  }
  .prof-passkey-item {
    padding: 0.45rem 0.55rem;
    min-height: 42px;
  }
  .btn-prof-passkey-delete {
    min-width: 32px;
    min-height: 32px;
    padding: 6px;
  }
  .prof-stats-grid {
    margin: 0.5rem 0;
    padding: 0.65rem 0.75rem;
    gap: 0.55rem;
  }
}

@media (max-width: 380px) {
  .prof-passkey-header {
    flex-direction: column;
    align-items: stretch;
    gap: 0.4rem;
  }
  .btn-prof-register-passkey {
    width: 100%;
    justify-content: center;
    height: 30px;
  }
}

/* Explicit Modal Header & Title & Close Button System for Driver Profile */
#modal-user-profile .modal-header {
  position: sticky !important;
  top: 0 !important;
  z-index: 25 !important;
  padding: 0.75rem 1rem !important;
  min-height: 52px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  background: #0d121c !important;
  border-bottom: 1px solid var(--border-subtle, rgba(255, 255, 255, 0.08)) !important;
  box-sizing: border-box !important;
  flex-shrink: 0 !important;
  width: 100% !important;
}

#modal-user-profile .modal-title {
  color: var(--text-main, #ffffff) !important;
  font-size: 1.12rem !important;
  font-weight: 800 !important;
  line-height: 1.35 !important;
  display: flex !important;
  align-items: center !important;
  gap: 0.5rem !important;
  min-width: 0 !important;
  flex: 1 1 auto !important;
  padding: 2px 0 !important;
}

#modal-user-profile .modal-title span {
  color: inherit !important;
  font-size: inherit !important;
  font-weight: inherit !important;
}

#modal-user-profile .modal-title i,
#modal-user-profile .modal-title svg {
  color: var(--accent-cyan, #00f0ff) !important;
  width: 20px !important;
  height: 20px !important;
  flex-shrink: 0 !important;
}

#modal-user-profile .modal-close-btn {
  min-width: 36px !important;
  min-height: 36px !important;
  width: 36px !important;
  height: 36px !important;
  padding: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: rgba(255, 255, 255, 0.06) !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 8px !important;
  color: #ffffff !important;
  cursor: pointer !important;
  flex-shrink: 0 !important;
}

#modal-user-profile .modal-close-btn:hover {
  background: rgba(255, 255, 255, 0.16) !important;
  color: #ffffff !important;
}

#modal-user-profile .modal-close-btn svg,
#modal-user-profile .modal-close-btn i {
  width: 20px !important;
  height: 20px !important;
  stroke: currentColor !important;
  display: block !important;
}

/* ==========================================================================
   LIGHT MODE: DRIVER PROFILE MODAL HIGH CONTRAST & VISIBILITY OVERRIDES
   ========================================================================== */
html[data-theme="light"] #modal-user-profile .modal-card,
[data-theme="light"] #modal-user-profile .modal-card {
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
  box-shadow: 0 20px 40px -15px rgba(15, 23, 42, 0.15) !important;
}

html[data-theme="light"] #modal-user-profile .modal-header,
[data-theme="light"] #modal-user-profile .modal-header {
  background: #ffffff !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

html[data-theme="light"] #modal-user-profile .modal-title,
[data-theme="light"] #modal-user-profile .modal-title {
  color: #0f172a !important;
  font-weight: 800 !important;
}

html[data-theme="light"] #modal-user-profile .modal-title span,
[data-theme="light"] #modal-user-profile .modal-title span {
  color: #0f172a !important;
}

html[data-theme="light"] #modal-user-profile .modal-title i,
[data-theme="light"] #modal-user-profile .modal-title i,
html[data-theme="light"] #modal-user-profile .modal-title svg,
[data-theme="light"] #modal-user-profile .modal-title svg {
  color: #0284c7 !important;
  width: 20px !important;
  height: 20px !important;
}

html[data-theme="light"] #modal-user-profile .modal-close-btn,
[data-theme="light"] #modal-user-profile .modal-close-btn {
  color: #475569 !important;
  background: #f1f5f9 !important;
  border: 1px solid #e2e8f0 !important;
  border-radius: 8px !important;
}

html[data-theme="light"] #modal-user-profile .modal-close-btn:hover,
[data-theme="light"] #modal-user-profile .modal-close-btn:hover {
  background: #e2e8f0 !important;
  color: #0f172a !important;
}

html[data-theme="light"] #modal-user-profile .prof-header-card,
[data-theme="light"] #modal-user-profile .prof-header-card {
  border-bottom: 1px solid #e2e8f0 !important;
}

html[data-theme="light"] #modal-user-profile #prof-name,
[data-theme="light"] #modal-user-profile #prof-name {
  color: #0f172a !important;
}

html[data-theme="light"] #modal-user-profile #prof-email,
[data-theme="light"] #modal-user-profile #prof-email {
  color: #64748b !important;
  font-weight: 500 !important;
}

html[data-theme="light"] #modal-user-profile #prof-class-badge,
[data-theme="light"] #modal-user-profile #prof-class-badge {
  background: #fff1f2 !important;
  border: 1px solid #fecdd3 !important;
  color: #e11d48 !important;
}

html[data-theme="light"] #modal-user-profile #prof-license-badge,
[data-theme="light"] #modal-user-profile #prof-license-badge {
  background: #f0f9ff !important;
  border: 1px solid #bae6fd !important;
  color: #0284c7 !important;
}

/* Nickname Box in Light Mode */
html[data-theme="light"] #modal-user-profile .prof-nickname-card,
[data-theme="light"] #modal-user-profile .prof-nickname-card {
  background: #f8fafc !important;
  border: 1.5px solid #cbd5e1 !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05) !important;
}

html[data-theme="light"] #modal-user-profile .prof-nickname-card .prof-card-label,
[data-theme="light"] #modal-user-profile .prof-nickname-card .prof-card-label {
  color: #0369a1 !important;
}

html[data-theme="light"] #modal-user-profile .prof-card-subinfo,
[data-theme="light"] #modal-user-profile .prof-card-subinfo {
  color: #64748b !important;
}

html[data-theme="light"] #modal-user-profile #prof-nickname-input,
[data-theme="light"] #modal-user-profile #prof-nickname-input {
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
  color: #0f172a !important;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.04) !important;
}

html[data-theme="light"] #modal-user-profile #prof-nickname-input:focus,
[data-theme="light"] #modal-user-profile #prof-nickname-input:focus {
  border-color: #0284c7 !important;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.15) !important;
}

html[data-theme="light"] #modal-user-profile #prof-nickname-input::placeholder,
[data-theme="light"] #modal-user-profile #prof-nickname-input::placeholder {
  color: #94a3b8 !important;
}

html[data-theme="light"] #modal-user-profile #prof-nickname-feedback,
[data-theme="light"] #modal-user-profile #prof-nickname-feedback {
  color: #64748b !important;
}

html[data-theme="light"] #modal-user-profile .btn-prof-reset-nick,
[data-theme="light"] #modal-user-profile .btn-prof-reset-nick {
  color: #0284c7 !important;
  font-weight: 600 !important;
}

html[data-theme="light"] #modal-user-profile .btn-prof-reset-nick:hover,
[data-theme="light"] #modal-user-profile .btn-prof-reset-nick:hover {
  color: #0369a1 !important;
}

/* Passkey Box in Light Mode - High Contrast Crisp Emerald */
html[data-theme="light"] #modal-user-profile .prof-passkey-card,
[data-theme="light"] #modal-user-profile .prof-passkey-card {
  background: #f0fdf4 !important;
  border: 1.5px solid #a7f3d0 !important;
  box-shadow: 0 1px 3px rgba(16, 185, 129, 0.08) !important;
}

html[data-theme="light"] #modal-user-profile .prof-passkey-label,
[data-theme="light"] #modal-user-profile .prof-passkey-label {
  color: #047857 !important;
}

html[data-theme="light"] #modal-user-profile .prof-passkey-desc,
[data-theme="light"] #modal-user-profile .prof-passkey-desc {
  color: #334155 !important;
  font-weight: 500 !important;
}

html[data-theme="light"] #modal-user-profile .btn-prof-register-passkey,
[data-theme="light"] #modal-user-profile .btn-prof-register-passkey {
  background: #ffffff !important;
  border: 1.5px solid #059669 !important;
  color: #047857 !important;
  font-weight: 700 !important;
  box-shadow: 0 1px 2px rgba(5, 150, 105, 0.1) !important;
}

html[data-theme="light"] #modal-user-profile .btn-prof-register-passkey:hover,
[data-theme="light"] #modal-user-profile .btn-prof-register-passkey:hover {
  background: #ecfdf5 !important;
  border-color: #047857 !important;
  color: #065f46 !important;
}

html[data-theme="light"] #modal-user-profile .prof-passkey-item,
[data-theme="light"] #modal-user-profile .prof-passkey-item {
  background: #ffffff !important;
  border: 1px solid #bbf7d0 !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03) !important;
}

html[data-theme="light"] #modal-user-profile .prof-passkey-item-icon,
[data-theme="light"] #modal-user-profile .prof-passkey-item-icon {
  color: #059669 !important;
}

html[data-theme="light"] #modal-user-profile .prof-passkey-device-name,
[data-theme="light"] #modal-user-profile .prof-passkey-device-name {
  color: #0f172a !important;
  font-weight: 700 !important;
}

html[data-theme="light"] #modal-user-profile .prof-passkey-device-date,
[data-theme="light"] #modal-user-profile .prof-passkey-device-date {
  color: #64748b !important;
}

html[data-theme="light"] #modal-user-profile .btn-prof-passkey-delete,
[data-theme="light"] #modal-user-profile .btn-prof-passkey-delete {
  color: #ef4444 !important;
}

html[data-theme="light"] #modal-user-profile .btn-prof-passkey-delete:hover,
[data-theme="light"] #modal-user-profile .btn-prof-passkey-delete:hover {
  background: #fef2f2 !important;
  color: #dc2626 !important;
}

html[data-theme="light"] #modal-user-profile .prof-passkey-empty,
[data-theme="light"] #modal-user-profile .prof-passkey-empty {
  color: #64748b !important;
}

/* Stats Grid in Light Mode */
html[data-theme="light"] #modal-user-profile .prof-stats-grid,
[data-theme="light"] #modal-user-profile .prof-stats-grid {
  background: #f8fafc !important;
  border: 1.5px solid #cbd5e1 !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.05) !important;
}

html[data-theme="light"] #modal-user-profile .prof-stat-label,
[data-theme="light"] #modal-user-profile .prof-stat-label {
  color: #64748b !important;
  font-weight: 600 !important;
}

html[data-theme="light"] #modal-user-profile .prof-stat-val.val-cyan,
[data-theme="light"] #modal-user-profile .prof-stat-val.val-cyan {
  color: #0284c7 !important;
}

html[data-theme="light"] #modal-user-profile .prof-stat-val.val-green,
[data-theme="light"] #modal-user-profile .prof-stat-val.val-green {
  color: #059669 !important;
}

html[data-theme="light"] #modal-user-profile .prof-stat-val.val-norm,
[data-theme="light"] #modal-user-profile .prof-stat-val.val-norm {
  color: #0f172a !important;
  font-weight: 700 !important;
}

/* Footer & Links in Light Mode */
html[data-theme="light"] #modal-user-profile .prof-actions-footer,
[data-theme="light"] #modal-user-profile .prof-actions-footer {
  border-top: 1px solid #e2e8f0 !important;
}

html[data-theme="light"] #modal-user-profile .btn-prof-signout,
[data-theme="light"] #modal-user-profile .btn-prof-signout {
  background: #fff1f2 !important;
  border: 1px solid #fecdd3 !important;
  color: #e11d48 !important;
}

html[data-theme="light"] #modal-user-profile .btn-prof-signout:hover,
[data-theme="light"] #modal-user-profile .btn-prof-signout:hover {
  background: #ffe4e6 !important;
  color: #be123c !important;
}

html[data-theme="light"] #modal-user-profile .prof-links-footer,
[data-theme="light"] #modal-user-profile .prof-links-footer {
  border-top: 1px solid #e2e8f0 !important;
}

html[data-theme="light"] #modal-user-profile .prof-link-privacy,
[data-theme="light"] #modal-user-profile .prof-link-privacy {
  color: #64748b !important;
}

html[data-theme="light"] #modal-user-profile .prof-link-privacy:hover,
[data-theme="light"] #modal-user-profile .prof-link-privacy:hover {
  color: #0f172a !important;
}

html[data-theme="light"] #modal-user-profile .prof-link-units,
[data-theme="light"] #modal-user-profile .prof-link-units {
  color: #0284c7 !important;
}

html[data-theme="light"] #modal-user-profile .prof-link-units:hover,
[data-theme="light"] #modal-user-profile .prof-link-units:hover {
  color: #0369a1 !important;
}


/* ==========================================================================
   LIGHT MODE: DRIVER SIGN IN MODAL (modal-auth) HIGH CONTRAST & VISIBILITY OVERRIDES
   ========================================================================== */
html[data-theme="light"] #modal-auth .modal-card,
[data-theme="light"] #modal-auth .modal-card {
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
  box-shadow: 0 20px 45px -10px rgba(15, 23, 42, 0.22), 0 0 0 1px rgba(15, 23, 42, 0.06) !important;
  color: #0f172a !important;
}

html[data-theme="light"] #modal-auth .modal-header,
[data-theme="light"] #modal-auth .modal-header {
  background: #f8fafc !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

html[data-theme="light"] #modal-auth .modal-title,
[data-theme="light"] #modal-auth .modal-title {
  color: #0f172a !important;
  font-weight: 800 !important;
}

html[data-theme="light"] #modal-auth .modal-title i,
html[data-theme="light"] #modal-auth .modal-title svg,
[data-theme="light"] #modal-auth .modal-title i,
[data-theme="light"] #modal-auth .modal-title svg {
  color: #0284c7 !important;
}

html[data-theme="light"] #modal-auth .modal-close-btn,
[data-theme="light"] #modal-auth .modal-close-btn {
  color: #64748b !important;
  background: transparent !important;
}

html[data-theme="light"] #modal-auth .modal-close-btn:hover,
[data-theme="light"] #modal-auth .modal-close-btn:hover {
  background: #f1f5f9 !important;
  color: #0f172a !important;
}

html[data-theme="light"] #modal-auth .modal-drag-indicator,
[data-theme="light"] #modal-auth .modal-drag-indicator {
  background: #cbd5e1 !important;
}

/* Auth Mode Toggle Tabs */
html[data-theme="light"] #modal-auth .auth-toggle-tabs,
[data-theme="light"] #modal-auth .auth-toggle-tabs {
  background: #f1f5f9 !important;
  border: 1.5px solid #cbd5e1 !important;
  padding: 4px !important;
  border-radius: var(--radius-sm) !important;
}

html[data-theme="light"] #modal-auth .auth-tab-btn,
[data-theme="light"] #modal-auth .auth-tab-btn {
  color: #475569 !important;
  font-weight: 700 !important;
  background: transparent !important;
  border-radius: calc(var(--radius-sm) - 2px) !important;
}

html[data-theme="light"] #modal-auth .auth-tab-btn:hover:not(.active),
[data-theme="light"] #modal-auth .auth-tab-btn:hover:not(.active) {
  color: #0f172a !important;
  background: rgba(15, 23, 42, 0.05) !important;
}

html[data-theme="light"] #modal-auth .auth-tab-btn.active,
[data-theme="light"] #modal-auth .auth-tab-btn.active {
  background: #0284c7 !important;
  color: #ffffff !important;
  font-weight: 800 !important;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.3) !important;
}

/* Passkey Quick Login Button */
html[data-theme="light"] #btn-passkey-login,
[data-theme="light"] #btn-passkey-login {
  background: #ecfdf5 !important;
  border: 1.5px solid #10b981 !important;
  color: #065f46 !important;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.18) !important;
}

html[data-theme="light"] #btn-passkey-login svg,
[data-theme="light"] #btn-passkey-login svg {
  stroke: #059669 !important;
}

html[data-theme="light"] #btn-passkey-login span,
[data-theme="light"] #btn-passkey-login span {
  color: #065f46 !important;
  font-weight: 700 !important;
}

html[data-theme="light"] #btn-passkey-login:hover,
[data-theme="light"] #btn-passkey-login:hover {
  background: #d1fae5 !important;
  border-color: #059669 !important;
}

/* Social Login Buttons (Google / Kakao) */
html[data-theme="light"] .btn-social-google,
[data-theme="light"] .btn-social-google {
  background-color: #ffffff !important;
  color: #1e293b !important;
  border: 1.5px solid #cbd5e1 !important;
  font-weight: 600 !important;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06) !important;
}

html[data-theme="light"] .btn-social-google:hover,
[data-theme="light"] .btn-social-google:hover {
  background-color: #f8fafc !important;
  border-color: #94a3b8 !important;
}

html[data-theme="light"] .btn-social-kakao,
[data-theme="light"] .btn-social-kakao {
  background-color: #fee500 !important;
  color: #191919 !important;
  border: 1.5px solid #facc15 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}

/* Divider */
html[data-theme="light"] #modal-auth .auth-divider,
[data-theme="light"] #modal-auth .auth-divider {
  color: #64748b !important;
}

html[data-theme="light"] #modal-auth .auth-divider span,
[data-theme="light"] #modal-auth .auth-divider span {
  background: #ffffff !important;
  color: #64748b !important;
  font-weight: 600 !important;
  font-size: 0.76rem !important;
}

html[data-theme="light"] #modal-auth .auth-divider::before,
html[data-theme="light"] #modal-auth .auth-divider::after,
[data-theme="light"] #modal-auth .auth-divider::before,
[data-theme="light"] #modal-auth .auth-divider::after {
  border-bottom: 1px solid #e2e8f0 !important;
}

/* Passkey Signup 1-Click Box */
html[data-theme="light"] .auth-passkey-signup-box,
[data-theme="light"] .auth-passkey-signup-box {
  background: #ecfdf5 !important;
  border: 1.5px solid #6ee7b7 !important;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.1) !important;
}

html[data-theme="light"] .auth-passkey-signup-title,
[data-theme="light"] .auth-passkey-signup-title,
html[data-theme="light"] .auth-passkey-signup-title span,
[data-theme="light"] .auth-passkey-signup-title span {
  color: #065f46 !important;
  font-weight: 700 !important;
}

html[data-theme="light"] .auth-passkey-signup-title i,
html[data-theme="light"] .auth-passkey-signup-title svg,
[data-theme="light"] .auth-passkey-signup-title i,
[data-theme="light"] .auth-passkey-signup-title svg {
  color: #059669 !important;
}

html[data-theme="light"] #btn-passkey-signup,
[data-theme="light"] #btn-passkey-signup {
  background: #059669 !important;
  color: #ffffff !important;
  font-weight: 800 !important;
  box-shadow: 0 2px 8px rgba(5, 150, 105, 0.25) !important;
}

html[data-theme="light"] #btn-passkey-signup:hover,
[data-theme="light"] #btn-passkey-signup:hover {
  background: #047857 !important;
}

/* Password Reset Notice */
html[data-theme="light"] #modal-auth #auth-reset-notice,
[data-theme="light"] #modal-auth #auth-reset-notice {
  background: #f0f9ff !important;
  border: 1.5px solid #bae6fd !important;
  color: #0369a1 !important;
  font-weight: 600 !important;
}

/* Form Labels & Inputs */
html[data-theme="light"] #modal-auth .form-label,
[data-theme="light"] #modal-auth .form-label {
  color: #1e293b !important;
  font-weight: 700 !important;
  font-size: 0.82rem !important;
}

html[data-theme="light"] #modal-auth .form-input,
html[data-theme="light"] #modal-auth input,
[data-theme="light"] #modal-auth .form-input,
[data-theme="light"] #modal-auth input {
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
  color: #0f172a !important;
  font-weight: 600 !important;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04) !important;
}

html[data-theme="light"] #modal-auth .form-input:focus,
html[data-theme="light"] #modal-auth input:focus,
[data-theme="light"] #modal-auth .form-input:focus,
[data-theme="light"] #modal-auth input:focus {
  border-color: #0284c7 !important;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.2) !important;
}

html[data-theme="light"] #modal-auth .form-input::placeholder,
html[data-theme="light"] #modal-auth input::placeholder,
[data-theme="light"] #modal-auth .form-input::placeholder,
[data-theme="light"] #modal-auth input::placeholder {
  color: #94a3b8 !important;
}

/* Verification Code & Timer */
html[data-theme="light"] #modal-auth #auth-code,
[data-theme="light"] #modal-auth #auth-code {
  background: #f8fafc !important;
  border: 2px solid #cbd5e1 !important;
  color: #0f172a !important;
}

html[data-theme="light"] #modal-auth #auth-code:focus,
[data-theme="light"] #modal-auth #auth-code:focus {
  border-color: #0284c7 !important;
  box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.2) !important;
}

html[data-theme="light"] #modal-auth #auth-code-timer,
[data-theme="light"] #modal-auth #auth-code-timer {
  color: #d97706 !important;
}

html[data-theme="light"] #modal-auth #auth-resend-btn,
[data-theme="light"] #modal-auth #auth-resend-btn {
  color: #0284c7 !important;
  font-weight: 700 !important;
}

html[data-theme="light"] #modal-auth #auth-resend-btn:hover,
[data-theme="light"] #modal-auth #auth-resend-btn:hover {
  color: #0369a1 !important;
  text-decoration: underline !important;
}

/* Forgot Password Link */
html[data-theme="light"] #modal-auth .auth-forgot-link,
[data-theme="light"] #modal-auth .auth-forgot-link {
  color: #0284c7 !important;
  font-weight: 700 !important;
}

html[data-theme="light"] #modal-auth .auth-forgot-link:hover,
[data-theme="light"] #modal-auth .auth-forgot-link:hover {
  color: #0369a1 !important;
  text-decoration: underline !important;
}

/* Submit Button */
html[data-theme="light"] #modal-auth #auth-submit-btn,
[data-theme="light"] #modal-auth #auth-submit-btn {
  background: #0284c7 !important;
  color: #ffffff !important;
  font-weight: 800 !important;
  border: none !important;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3) !important;
}

html[data-theme="light"] #modal-auth #auth-submit-btn:hover,
[data-theme="light"] #modal-auth #auth-submit-btn:hover {
  background: #0369a1 !important;
  box-shadow: 0 4px 14px rgba(2, 132, 199, 0.4) !important;
}

/* Back Link */
html[data-theme="light"] #modal-auth .auth-back-link,
[data-theme="light"] #modal-auth .auth-back-link {
  color: #475569 !important;
  font-weight: 700 !important;
}

html[data-theme="light"] #modal-auth .auth-back-link:hover,
[data-theme="light"] #modal-auth .auth-back-link:hover {
  color: #0284c7 !important;
}

/* Error Alert Box */
html[data-theme="light"] #modal-auth .auth-error-box,
[data-theme="light"] #modal-auth .auth-error-box {
  background: #fef2f2 !important;
  border: 1.5px solid #fecdd3 !important;
  color: #b91c1c !important;
  font-weight: 700 !important;
}

html[data-theme="light"] #modal-auth .auth-error-box i,
html[data-theme="light"] #modal-auth .auth-error-box svg,
[data-theme="light"] #modal-auth .auth-error-box i,
[data-theme="light"] #modal-auth .auth-error-box svg {
  color: #dc2626 !important;
}

/* Footer Notes & Privacy Policy */
html[data-theme="light"] #modal-auth .auth-guest-note,
[data-theme="light"] #modal-auth .auth-guest-note {
  color: #64748b !important;
}

html[data-theme="light"] #modal-auth .auth-terms-note,
[data-theme="light"] #modal-auth .auth-terms-note {
  color: #64748b !important;
  border-top: 1px solid #e2e8f0 !important;
}

html[data-theme="light"] #modal-auth .auth-terms-note a,
[data-theme="light"] #modal-auth .auth-terms-note a {
  color: #0284c7 !important;
  font-weight: 600 !important;
}


/* ==========================================================================
   VBO TELEMETRY IMPORT MODAL & STYLING
   ========================================================================== */
.vbo-import-modal-card {
  max-width: 580px;
  width: 100%;
}

.vbo-dropzone {
  border: 2px dashed rgba(0, 240, 255, 0.4);
  border-radius: var(--radius-md);
  padding: 2.2rem 1.25rem;
  text-align: center;
  cursor: pointer;
  background: rgba(0, 240, 255, 0.03);
  transition: all var(--transition-fast);
  margin-bottom: 0.5rem;
}

.vbo-dropzone:hover,
.vbo-dropzone.dragover {
  border-color: var(--accent-cyan);
  background: rgba(0, 240, 255, 0.08);
  transform: translateY(-1px);
}

.vbo-dropzone-icon {
  width: 44px;
  height: 44px;
  color: var(--accent-cyan);
  margin-bottom: 0.65rem;
}

.vbo-dropzone-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-light);
  margin-bottom: 0.35rem;
}

.vbo-dropzone-title span {
  color: var(--accent-cyan);
  text-decoration: underline;
  cursor: pointer;
}

.vbo-dropzone-hint {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.vbo-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
  margin-bottom: 0.85rem;
}

.vbo-stat-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.35rem;
  text-align: center;
}

.vbo-stat-label {
  font-size: 0.66rem;
  color: var(--text-muted);
  font-weight: 700;
  text-transform: uppercase;
  display: block;
  margin-bottom: 2px;
}

.vbo-stat-val {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text-light);
  white-space: nowrap;
}

.vbo-stat-val.val-best {
  color: #eab308;
}

.vbo-lap-item {
  transition: background var(--transition-fast);
}

.vbo-lap-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.vbo-lap-item.is-best-lap {
  background: rgba(234, 179, 8, 0.08);
  border-left: 3px solid #eab308;
}

/* Session Source Badge: VBO Telemetry */
.session-source-vbo {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.5);
  color: #10b981;
}

/* Light Mode Overrides for VBO Import Modal */
html[data-theme="light"] #modal-vbo-import .modal-card,
[data-theme="light"] #modal-vbo-import .modal-card {
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
  color: #0f172a !important;
  box-shadow: 0 20px 45px -10px rgba(15, 23, 42, 0.22) !important;
}

html[data-theme="light"] #modal-vbo-import .modal-header,
[data-theme="light"] #modal-vbo-import .modal-header {
  background: #f8fafc !important;
  border-bottom: 1px solid #e2e8f0 !important;
}

html[data-theme="light"] #modal-vbo-import .modal-title,
[data-theme="light"] #modal-vbo-import .modal-title {
  color: #0f172a !important;
  font-weight: 800 !important;
}

html[data-theme="light"] #modal-vbo-import .modal-title i,
[data-theme="light"] #modal-vbo-import .modal-title i {
  color: #0284c7 !important;
}

html[data-theme="light"] #modal-vbo-import .modal-close-btn,
[data-theme="light"] #modal-vbo-import .modal-close-btn {
  color: #64748b !important;
}

html[data-theme="light"] #modal-vbo-import .modal-close-btn:hover,
[data-theme="light"] #modal-vbo-import .modal-close-btn:hover {
  background: #f1f5f9 !important;
  color: #0f172a !important;
}

html[data-theme="light"] .vbo-dropzone,
[data-theme="light"] .vbo-dropzone {
  border: 2px dashed #94a3b8 !important;
  background: #f8fafc !important;
}

html[data-theme="light"] .vbo-dropzone:hover,
[data-theme="light"] .vbo-dropzone:hover {
  border-color: #0284c7 !important;
  background: #f0f9ff !important;
}

html[data-theme="light"] .vbo-dropzone-icon,
[data-theme="light"] .vbo-dropzone-icon {
  color: #0284c7 !important;
}

html[data-theme="light"] .vbo-dropzone-title,
[data-theme="light"] .vbo-dropzone-title {
  color: #0f172a !important;
}

html[data-theme="light"] .vbo-dropzone-title span,
[data-theme="light"] .vbo-dropzone-title span {
  color: #0284c7 !important;
}

html[data-theme="light"] .vbo-dropzone-hint,
[data-theme="light"] .vbo-dropzone-hint {
  color: #64748b !important;
}

html[data-theme="light"] .vbo-stat-card,
[data-theme="light"] .vbo-stat-card {
  background: #f8fafc !important;
  border: 1.5px solid #cbd5e1 !important;
}

html[data-theme="light"] .vbo-stat-label,
[data-theme="light"] .vbo-stat-label {
  color: #64748b !important;
}

html[data-theme="light"] .vbo-stat-val,
[data-theme="light"] .vbo-stat-val {
  color: #0f172a !important;
}

html[data-theme="light"] .vbo-stat-val.val-best,
[data-theme="light"] .vbo-stat-val.val-best {
  color: #b45309 !important;
}

html[data-theme="light"] .vbo-laps-list-container,
[data-theme="light"] .vbo-laps-list-container {
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
}

html[data-theme="light"] .vbo-lap-item,
[data-theme="light"] .vbo-lap-item {
  border-bottom: 1px solid #f1f5f9 !important;
}

html[data-theme="light"] .vbo-lap-item:hover,
[data-theme="light"] .vbo-lap-item:hover {
  background: #f8fafc !important;
}

html[data-theme="light"] .vbo-lap-item.is-best-lap,
[data-theme="light"] .vbo-lap-item.is-best-lap {
  background: #fefce8 !important;
  border-left: 3px solid #eab308 !important;
}

html[data-theme="light"] #modal-vbo-import .form-label,
[data-theme="light"] #modal-vbo-import .form-label {
  color: #1e293b !important;
  font-weight: 700 !important;
}

html[data-theme="light"] #modal-vbo-import .form-input,
html[data-theme="light"] #modal-vbo-import .form-select,
[data-theme="light"] #modal-vbo-import .form-input,
[data-theme="light"] #modal-vbo-import .form-select {
  background: #ffffff !important;
  border: 1.5px solid #cbd5e1 !important;
  color: #0f172a !important;
}

html[data-theme="light"] #btn-vbo-import-submit,
[data-theme="light"] #btn-vbo-import-submit {
  background: #0284c7 !important;
  color: #ffffff !important;
  font-weight: 800 !important;
  border: none !important;
  box-shadow: 0 4px 12px rgba(2, 132, 199, 0.3) !important;
}

html[data-theme="light"] #btn-vbo-import-submit:hover,
[data-theme="light"] #btn-vbo-import-submit:hover {
  background: #0369a1 !important;
}

html[data-theme="light"] .session-source-vbo,
[data-theme="light"] .session-source-vbo {
  background: #ecfdf5 !important;
  border: 1.5px solid #10b981 !important;
  color: #065f46 !important;
  font-weight: 800 !important;
}


/* VBO Dropzone & Lap Validity Styles */
.vbo-dropzone.drag-over,
.vbo-dropzone.dragover {
  border-color: var(--accent-cyan, #00f0ff) !important;
  background: rgba(0, 240, 255, 0.12) !important;
  box-shadow: 0 0 25px rgba(0, 240, 255, 0.45) !important;
  transform: scale(1.01);
}

.lap-row-disabled {
  opacity: 0.42 !important;
  background: rgba(0, 0, 0, 0.25) !important;
}

.lap-row-disabled .vbo-lap-time-str {
  text-decoration: line-through;
  color: var(--text-muted) !important;
}

.vbo-lap-tag {
  font-size: 0.64rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 3px;
  text-transform: uppercase;
}

.vbo-lap-tag.out-lap {
  background: rgba(234, 179, 8, 0.15);
  color: #eab308;
  border: 1px solid rgba(234, 179, 8, 0.35);
}

.vbo-lap-tag.in-lap {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.35);
}

.vbo-lap-tag.slow-lap {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

/* Detail Modal Lap Validity Tick */
.btn-lap-validity-tick {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  transition: all var(--transition-fast);
}

.btn-lap-validity-tick.is-valid {
  color: var(--accent-green, #10b981);
}

.btn-lap-validity-tick.is-valid:hover {
  background: rgba(16, 185, 129, 0.18);
  transform: scale(1.1);
}

.btn-lap-validity-tick.is-invalid {
  color: var(--text-dim, #71717a);
  opacity: 0.7;
}

.btn-lap-validity-tick.is-invalid:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.18);
  transform: scale(1.1);
}

.sda-lap-row.is-invalid-lap {
  opacity: 0.45;
  background: rgba(0, 0, 0, 0.15);
}

.sda-lap-row.is-invalid-lap span[style*="font-family:var(--font-mono)"] {
  text-decoration: line-through;
}

/* Light Mode Overrides */
html[data-theme="light"] .vbo-dropzone.drag-over,
[data-theme="light"] .vbo-dropzone.drag-over {
  border-color: #0284c7 !important;
  background: rgba(2, 132, 199, 0.12) !important;
  box-shadow: 0 0 20px rgba(2, 132, 199, 0.35) !important;
}

html[data-theme="light"] .lap-row-disabled,
[data-theme="light"] .lap-row-disabled {
  opacity: 0.55 !important;
  background: #f1f5f9 !important;
}

html[data-theme="light"] .sda-laps-section,
[data-theme="light"] .sda-laps-section {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
}

html[data-theme="light"] .sda-laps-table-wrapper,
[data-theme="light"] .sda-laps-table-wrapper {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
}

html[data-theme="light"] .sda-lap-row,
[data-theme="light"] .sda-lap-row {
  border-bottom-color: #e2e8f0 !important;
}

html[data-theme="light"] .sda-lap-row.is-invalid-lap,
[data-theme="light"] .sda-lap-row.is-invalid-lap {
  background: #f8fafc !important;
}

/* =========================================================================
   WHEEL ALIGNMENT & RIDE HEIGHT 4-WHEEL CHASSIS INPUT (MOBILE-FRIENDLY)
   ========================================================================= */
.wheel-align-chassis {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.align-axle-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.15rem 0.1rem;
}

.align-axle-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  color: var(--text-light);
}

.align-axle-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}
.align-axle-dot.front {
  background: var(--accent-cyan, #00f0ff);
  box-shadow: 0 0 6px rgba(0, 240, 255, 0.55);
}
.align-axle-dot.rear {
  background: var(--accent-amber, #ffb300);
  box-shadow: 0 0 6px rgba(255, 179, 0, 0.55);
}

.align-sync-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.28rem 0.55rem;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent-cyan, #00f0ff);
  background: rgba(0, 240, 255, 0.09);
  border: 1px solid rgba(0, 240, 255, 0.3);
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
  touch-action: manipulation;
}
.align-sync-btn i,
.align-sync-btn svg {
  width: 12px;
  height: 12px;
}
.align-sync-btn:active {
  transform: scale(0.96);
  background: rgba(0, 240, 255, 0.2);
}

.align-axle-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
}

.align-wheel-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 0.55rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-width: 0;
}

.align-wheel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.35rem;
  padding-bottom: 0.32rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
}

.align-wheel-sub {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.align-param-list {
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
}

.align-param-row {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
}

.align-param-lbl {
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.align-param-lbl small {
  font-size: 0.62rem;
  color: var(--text-dim);
  font-weight: 500;
}

.align-stepper {
  display: grid;
  grid-template-columns: 30px 1fr 30px;
  align-items: stretch;
  background: rgba(0, 0, 0, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  overflow: hidden;
  height: 34px;
}

.align-step-btn {
  background: rgba(255, 255, 255, 0.05);
  border: none;
  color: var(--text-light);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  user-select: none;
  touch-action: manipulation;
  transition: background 0.12s ease;
}
.align-step-btn:hover {
  background: rgba(0, 240, 255, 0.14);
}
.align-step-btn:active {
  background: rgba(0, 240, 255, 0.28);
}

.align-num-input {
  width: 100%;
  min-width: 0;
  background: transparent;
  border: none;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  color: var(--text-main, #f8fafc);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  text-align: center;
  padding: 0 2px;
  outline: none;
  -moz-appearance: textfield;
}
.align-num-input::-webkit-outer-spin-button,
.align-num-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.align-num-input::placeholder {
  color: rgba(148, 163, 184, 0.45);
  font-weight: 500;
}
.align-num-input:focus {
  background: rgba(0, 240, 255, 0.07);
}

.align-chassis-divider {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.15rem 0;
}
.align-chassis-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.14), transparent);
}
.align-chassis-icon {
  font-family: var(--font-display);
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  white-space: nowrap;
}

.align-helper-note {
  font-size: 0.68rem;
  line-height: 1.4;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.025);
  border-radius: 6px;
  padding: 0.4rem 0.55rem;
  border: 1px dashed rgba(255, 255, 255, 0.09);
}

/* Session Detail Alignment Readout */
.sda-align-grid-lines {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.2rem 0.4rem;
  font-size: 0.7rem;
  margin-top: 0.25rem;
}
.sda-align-kv {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 3px;
  font-family: var(--font-mono);
}
.sda-align-k {
  color: var(--text-dim);
  font-family: var(--font-sans);
  font-size: 0.64rem;
}
.sda-align-v {
  color: var(--text-main);
  font-weight: 700;
}

@media (max-width: 420px) {
  .align-axle-grid {
    gap: 0.4rem;
  }
  .align-wheel-card {
    padding: 0.42rem;
  }
  .align-stepper {
    grid-template-columns: 28px 1fr 28px;
    height: 36px;
  }
  .align-num-input {
    font-size: 0.78rem;
  }
}

/* Light Mode Overrides for Wheel Alignment */
html[data-theme="light"] .align-wheel-card,
[data-theme="light"] .align-wheel-card {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
}
html[data-theme="light"] .align-wheel-header,
[data-theme="light"] .align-wheel-header {
  border-bottom-color: #e2e8f0 !important;
}
html[data-theme="light"] .align-axle-label,
[data-theme="light"] .align-axle-label {
  color: #0f172a !important;
}
html[data-theme="light"] .align-sync-btn,
[data-theme="light"] .align-sync-btn {
  color: #0284c7 !important;
  background: #e0f2fe !important;
  border-color: #7dd3fc !important;
}
html[data-theme="light"] .align-stepper,
[data-theme="light"] .align-stepper {
  background: #ffffff !important;
  border-color: #cbd5e1 !important;
}
html[data-theme="light"] .align-step-btn,
[data-theme="light"] .align-step-btn {
  background: #f1f5f9 !important;
  color: #0f172a !important;
}
html[data-theme="light"] .align-num-input,
[data-theme="light"] .align-num-input {
  color: #0f172a !important;
  border-left-color: #e2e8f0 !important;
  border-right-color: #e2e8f0 !important;
}
html[data-theme="light"] .align-chassis-line,
[data-theme="light"] .align-chassis-line {
  background: linear-gradient(90deg, transparent, #cbd5e1, transparent) !important;
}
html[data-theme="light"] .align-helper-note,
[data-theme="light"] .align-helper-note {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
  color: #475569 !important;
}

/* AC EVO Session Source Badge */
.session-source-acevo {
  background: rgba(16, 185, 129, 0.16);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}
html[data-theme="light"] .session-source-acevo,
[data-theme="light"] .session-source-acevo {
  background: #ecfdf5 !important;
  color: #047857 !important;
  border-color: #6ee7b7 !important;
}

/* =========================================================================
   FOOTER DEDICATED FEATURE LANDING PAGES STRIP
   ========================================================================= */
.footer-landing-strip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  max-width: 780px;
  margin: 0.45rem auto 0.2rem;
  padding-top: 0.85rem;
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}
.footer-landing-label {
  font-family: var(--font-mono);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--text-dim);
}
.footer-landing-pills {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.footer-landing-pills a {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.28rem 0.68rem;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-decoration: none;
  transition: color 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}
.footer-landing-pills a:hover {
  color: var(--accent-cyan);
  border-color: rgba(0, 240, 255, 0.45);
  background: rgba(0, 240, 255, 0.08);
}
html[data-theme="light"] .footer-landing-strip,
[data-theme="light"] .footer-landing-strip {
  border-top-color: rgba(15, 23, 42, 0.09) !important;
}
html[data-theme="light"] .footer-landing-pills a,
[data-theme="light"] .footer-landing-pills a {
  background: #f8fafc !important;
  border-color: #cbd5e1 !important;
  color: #334155 !important;
}
html[data-theme="light"] .footer-landing-pills a:hover,
[data-theme="light"] .footer-landing-pills a:hover {
  color: #0284c7 !important;
  border-color: #0284c7 !important;
  background: #e0f2fe !important;
}

/* =========================================================================
   EMBEDDED MODAL MODE (?embed_modal=profile|log-session|units)
   ========================================================================= */
html.ml-embed-modal-mode,
html.ml-embed-modal-mode body {
  background: transparent !important;
  overflow: hidden !important;
}
html.ml-embed-modal-mode .topbar,
html.ml-embed-modal-mode .onboarding-micro-banner,
html.ml-embed-modal-mode .app-container,
html.ml-embed-modal-mode .site-footer,
html.ml-embed-modal-mode .mobile-bottom-nav,
html.ml-embed-modal-mode #pwa-install-banner {
  display: none !important;
}
html.ml-embed-modal-mode .modal-overlay.active {
  background: rgba(7, 10, 16, 0.58) !important;
  backdrop-filter: blur(4px) !important;
}
