
  @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

  /* ── Design tokens ── */
  :root {
    --bg:       #f9f9f7;
    --surface:  #ffffff;
    --surface2: #f0f0eb;
    --border:   #e5e5dc;
    --border2:  #d5d5cc;
    --accent:   #E8B15C;
    --accent2:  #FF5252;
    --accent3:  #E8B15C;
    --live:     #E8B15C;
    --text:     #0c0c0c;
    --muted:    #999999;
    --radius:   12px;
    --radius-sm:8px;
    --sidebar-w:210px;
    --tab-h:    64px;
    --header-h: 52px;
  }

  body.dark {
    --bg:       #0A0D14;
    --surface:  #1A1F2B;
    --surface2: #1A1F2B;
    --border:   #1A1F2B;
    --border2:  #333333;
    --accent:   #E8B15C;
    --accent2:  #FF5252;
    --accent3:  #E8B15C;
    --live:     #E8B15C;
    --text:     #f0f0f0;
    --muted:    #666666;
    --radius:   12px;
    --radius-sm:8px;
    --sidebar-w:210px;
    --tab-h:    64px;
    --header-h: 52px;
  }
  /* Sidebar always dark in both themes */
  .sidebar { background: #1a1a1a !important; border-color: #111 !important; }
  .sidebar-logo { color: #fff !important; }
  .sidebar-item { color: #aaaaaa !important; }
  .sidebar-item:hover { background: #2a2a2a !important; color: #fff !important; }
  .sidebar-item.active { background: #E8B15C !important; color: #fff !important; }
  .sidebar-item.live { color: #E8B15C !important; }
  .sidebar-item.live.active { color: #fff !important; }
  .sidebar-item.groups { color: #f97316 !important; }
  .sidebar-divider { background: #2a2a2a !important; }
  .sidebar-bottom { border-color: #2a2a2a !important; }
  .sidebar-user:hover { background: #2a2a2a !important; }
  #avatar-desktop { border-color: #E8B15C !important; background: rgba(232,177,92,0.1) !important; color: #E8B15C !important; }
  #username-desktop { color: #e0e0e0 !important; }

  body.dark .btn-primary { color: #fff; }
  body.dark .sidebar-item.active { background: #E8B15C !important; color: #fff !important; }
  body.dark .bottom-tab.active .tab-icon { background: rgba(232,177,92,.1); }
  body.dark .bottom-tab.active .tab-label { color: var(--accent); }
  body.dark .bottom-tab.tab-live .tab-btn { background: var(--accent); box-shadow: 0 4px 16px rgba(232,177,92,.4); }
  body.dark .bottom-tab.tab-live .tab-btn span { color: #fff; }
  body.dark .match-item:hover { border-color: var(--accent); }
  body.dark .lnum:hover { background: var(--surface2); }
  body.dark input, body.dark select { background: var(--surface2); border-color: var(--border2); color: var(--text); }
  body.dark .filter-chip.selected { background: rgba(232,177,92,.1); border-color: var(--accent); color: var(--accent); }
  body.dark .lpill.on { background: rgba(0,200,83,.1); border-color: #00C853; color: #00C853; }
  body.dark .card h2 { color: var(--accent); }
  body.dark .pill.win { background: rgba(232,177,92,.1); color: var(--accent); border-color: rgba(232,177,92,.2); }
  body.dark .h2h-bar-left { background: var(--accent); }
  body.dark .h2h-bar-left span, body.dark .h2h-bar-right span { color: #fff; }
  body.dark .stat-block .value.accent { color: var(--accent); }
  body.dark .section-label { color: #444; }
  body.dark .bottom-bar { background: var(--surface); border-color: var(--border); }
  body.dark #context-bar { background: var(--surface); border-color: var(--border); }
  body.dark .sidebar-item.live { color: var(--accent) !important; }
  body.dark .modal-header h2 { color: var(--accent); }

  /* ── Reset ── */
  *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
  html { -webkit-text-size-adjust: 100%; }
  body {
    font-family: 'Comfortaa', -apple-system, BlinkMacSystemFont, sans-serif;
    font-size: 14px;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
  }

  /* ══════════════════════════════
     DESKTOP LAYOUT (≥768px)
  ══════════════════════════════ */
  .app-shell {
    display: flex;
    min-height: 100vh;
  }

  /* Sidebar */
  .sidebar {
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
  }
  .sidebar-logo {
    padding: 16px 14px 12px;
    font-family: 'Comfortaa', sans-serif;
    color: #fff;
    border-bottom: 1px solid #2a2a2a;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0;
    position: relative;
    min-height: 120px;
  }
  .sidebar-logo span { font-size: 20px; }
  .sidebar-nav { flex: 1; padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; }
  .sidebar-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--muted);
    cursor: pointer;
    transition: all .12s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
  }
  .sidebar-item:hover { background: var(--surface2); color: var(--text); }
  .sidebar-item.active { background: var(--surface2); color: var(--text); font-weight: 700; }
  .sidebar-item.live { color: #00C853; }
  .sidebar-item.live.active { background: #E8B15C; }
  .sidebar-item.groups { color: #E8B15C; }
  .sidebar-item .s-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
  .sidebar-divider { height: 1px; background: var(--border); margin: 8px 8px; }
  .sidebar-bottom {
    padding: 12px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
  }
  .sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background .12s;
  }
  .sidebar-user:hover { background: var(--surface2); }
  .avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: #e8f5e9;
    border: 2px solid var(--accent3);
    display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 800;
    color: var(--accent3);
    flex-shrink: 0;
  }
  body.dark .avatar { background: rgba(0,200,83,.12); }

  /* Main content area (desktop) */
  .main-area {
    margin-left: var(--sidebar-w);
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
  }

  /* Context bar (desktop — sticky under sidebar top) */
  #context-bar {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 8px 24px;
    display: flex;
    align-items: center;
    gap: 8px;
    position: sticky;
    top: 0;
    z-index: 90;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  #context-bar::-webkit-scrollbar { display: none; }

  /* Main content */
  main {
    padding: 24px;
    max-width: 1200px;
    width: 100%;
  }

  /* Hide mobile elements on desktop */
  .bottom-bar, .mobile-header { display: none; }

  /* ══════════════════════════════
     MOBILE LAYOUT (<768px)
  ══════════════════════════════ */
  @media (max-width: 768px) {
    /* Hide sidebar */
    .sidebar { display: none; }
    .main-area { margin-left: 0; }

    /* Mobile header */
    .mobile-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 10px 16px 10px;
      background: var(--surface);
      border-bottom: 1px solid var(--border);
      position: sticky;
      top: 0;
      z-index: 100;
      padding-top: max(10px, env(safe-area-inset-top));
      min-height: 68px;
    }
    .mobile-logo {
      font-family: 'Comfortaa', sans-serif;
      font-size: 20px;
      font-weight: 700;
      letter-spacing: .2px;
      color: var(--text);
      display: flex; align-items: center; gap: 10px;
      cursor: pointer;
    }
    .mobile-logo img {
      width: 46px !important;
      height: 46px !important;
    }
    .mobile-header-right { display: flex; align-items: center; gap: 8px; }

    /* Context bar mobile */
    #context-bar {
      padding: 6px 12px;
      top: 68px;
    }

    /* Main content */
    main {
      padding: 12px 12px;
      padding-top: 8px;
      padding-bottom: calc(var(--tab-h) + 16px + env(safe-area-inset-bottom));
    }

    /* Bottom tab bar */
    .bottom-bar {
      display: flex;
      position: fixed;
      bottom: 0; left: 0; right: 0;
      background: var(--surface);
      border-top: 1px solid var(--border);
      z-index: 100;
      padding-bottom: env(safe-area-inset-bottom);
      height: calc(var(--tab-h) + env(safe-area-inset-bottom));
    }
    .bottom-tab {
      flex: 1;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 3px;
      cursor: pointer;
      border: none;
      background: none;
      padding: 8px 4px;
      position: relative;
    }
    .tab-icon {
      font-size: 20px;
      width: 34px; height: 34px;
      display: flex; align-items: center; justify-content: center;
      border-radius: 10px;
      transition: background .12s;
    }
    .bottom-tab.active .tab-icon { background: var(--surface2); }
    .tab-label {
      font-size: 9px;
      font-weight: 600;
      color: var(--muted);
      letter-spacing: .3px;
    }
    .bottom-tab.active .tab-label { color: var(--text); }

    /* Live tab — elevated button */
    .bottom-tab.tab-live .tab-btn {
      width: 44px; height: 44px;
      border-radius: 22px;
      background: #E8B15C;
      display: flex; align-items: center; justify-content: center;
      margin-top: -10px;
      box-shadow: 0 4px 16px rgba(59,130,246,.4);
      pointer-events: none;
      transition: transform .12s;
    }
    .bottom-tab.tab-live:active .tab-btn { transform: scale(.95); }
    .bottom-tab.tab-live .tab-btn span { font-size: 18px; color: #fff; }
    .bottom-tab.tab-live .tab-label { color: #E8B15C; }

    /* Cards smaller */
    .card { padding: 14px 12px; }
    .grid-2 { grid-template-columns: 1fr; }
    .grid-3 { grid-template-columns: 1fr 1fr; }
    .grid-4 { grid-template-columns: repeat(3,1fr); gap: 8px; }
    .player-panels { grid-template-columns: 1fr; }
    .stat-block { padding: 10px 8px; }
    .stat-block .value { font-size: 22px; }
    .match-item { padding: 10px 12px; gap: 8px; flex-wrap: wrap; }
    .match-date { min-width: 0; font-size: 10px; }
    .match-score { font-size: 18px; }
    .h2h-label { min-width: 60px; font-size: 11px; }
    .h2h-label-right { min-width: 60px; font-size: 11px; }
    .data-table { font-size: 11px; }
    .data-table th { padding: 6px 8px; font-size: 9px; }
    .data-table td { padding: 7px 8px; }
    .modal { padding: 16px; max-height: 90vh; width: 96% !important; overflow-x: hidden; }
    .modal table, .modal .data-table { max-width: 100%; overflow-x: auto; display: block; }
    .toast { right: 12px; font-size: 11px; padding: 10px 14px; }
    .h2h-selector { gap: 8px; }
    .h2h-vs { font-size: 22px; }
    .lnum { padding: 18px 4px; font-size: 16px; touch-action: manipulation; }
    .lpill { padding: 6px 12px; font-size: 11px; }
    #classement-content { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    [class*="grid-"] { gap: 8px; }
    .form-row, .form-row-3, .form-row-4 { grid-template-columns: 1fr; }
    .grid-2, .player-panels { grid-template-columns: 1fr; }
    .grid-4 { grid-template-columns: repeat(3,1fr) !important; gap: 6px !important; }
    .stat-block { padding: 8px 6px; }
    .stat-block .value { font-size: 18px; }
    .stat-block .label { font-size: 9px; }
  }

  @media (max-width: 480px) {
    .grid-4 { grid-template-columns: repeat(3,1fr); gap: 6px; }
    .stat-block .value { font-size: 20px; }
    main { padding: 8px; }
    .card { padding: 12px 10px; }
    .lnum { padding: 18px 2px; font-size: 14px; touch-action: manipulation; }
  }

  /* Safe area for toast on mobile */
  .toast { bottom: calc(var(--tab-h) + 8px + env(safe-area-inset-bottom)); }
  @media (min-width: 769px) { .toast { bottom: 24px; } }

  /* ══════════════════════════════
     SHARED COMPONENTS
  ══════════════════════════════ */

  /* Pages */
  .page { display: none; }
  .page.active { display: block; }

  /* Buttons */
  .btn {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 9px 18px;
    font-family: 'Comfortaa', sans-serif;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: opacity .12s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
  }
  body:not(.dark) .btn { color: #fff; }
  .btn:hover { opacity: .85; }
  .btn.secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border2); }
  .btn.danger { background: var(--accent2); color: #fff; }
  .btn.teal { background: var(--accent3); color: #fff; }
  .btn-primary { background: var(--accent); color: #fff; }
  .mode-toggle {
    position: relative;
    background: var(--surface2) !important;
    color: var(--muted) !important;
    border: 1px solid var(--border2) !important;
    box-shadow: none !important;
    font-weight: 700 !important;
  }
  .mode-toggle.is-active {
    background: linear-gradient(135deg, #E8B15C, #c98622) !important;
    color: #0A0D14 !important;
    border-color: #E8B15C !important;
    box-shadow: 0 6px 18px rgba(232,177,92,.28) !important;
    transform: translateY(-1px);
  }
  .mode-toggle.is-active::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -5px;
    width: 18px;
    height: 3px;
    border-radius: 999px;
    background: #E8B15C;
    transform: translateX(-50%);
  }
  .help-dot {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    border: 1px solid var(--border2);
    background: var(--surface2);
    color: var(--muted);
    font-size: 12px;
    font-weight: 900;
    line-height: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
  }
  .help-dot:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(232,177,92,.12);
  }
  .inline-help-box {
    display: none;
    background: rgba(232,177,92,.10);
    border: 1px solid rgba(232,177,92,.35);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: 'IBM Plex Mono', monospace;
    font-size: 10.5px;
    line-height: 1.55;
    padding: 10px;
    margin-top: 8px;
  }
  .inline-help-box.open { display: block; }

  /* Cards */
  .card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
  }
  .card h2 {
    font-family: 'Comfortaa', sans-serif;
    font-size: 16px;
    font-weight: 800;
    letter-spacing: -.3px;
    color: #E8B15C;
    margin-bottom: 14px;
  }
  body.dark .card h2 { color: var(--accent); }

  /* Grid */
  .grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
  .grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; }
  .grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }

  /* Forms */
  .form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
  label { font-size: 11px; font-weight: 800; color: var(--muted); letter-spacing: .8px; text-transform: uppercase; }
  input, select {
    background: var(--surface2);
    border: 1px solid var(--border2);
    color: var(--text);
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    font-family: 'Comfortaa', sans-serif;
    font-size: 14px;
    outline: none;
    transition: border-color .15s;
    width: 100%;
  }
  input:focus, select:focus { border-color: #E8B15C; }
  input[type=number] { -moz-appearance: textfield; }
  input[type=number]::-webkit-outer-spin-button,
  input[type=number]::-webkit-inner-spin-button { -webkit-appearance: none; }
  .form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
  .form-row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }
  .form-row-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 12px; }

  /* Player panels */
  .player-panels { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 16px; }
  .player-panel {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
  }
  .player-panel h3 {
    font-family: 'Bebas Neue', sans-serif;
    font-size: 15px;
    letter-spacing: 1.5px;
    margin-bottom: 14px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
  }
  .player-panel.p1 h3 { color: #E8B15C; }
  .player-panel.p2 h3 { color: #E8B15C; }
  body.dark .player-panel.p1 h3 { color: var(--accent); }

  /* Section label */
  .section-label {
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--muted);
    margin: 14px 0 10px;
    padding-bottom: 6px;
    border-bottom: 2px solid var(--border);
  }

  /* Match list */
  .match-list { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; }
  .match-item {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 18px;
    display: flex;
    align-items: center;
    gap: 16px;
    cursor: pointer;
    transition: border-color .12s, box-shadow .12s;
  }
  .match-item:hover { border-color: var(--border2); box-shadow: 0 2px 8px rgba(0,0,0,.06); }
  .match-date { font-size: 11px; color: var(--muted); min-width: 90px; font-weight: 500; }
  .match-score { font-family: 'Bebas Neue', sans-serif; font-size: 22px; letter-spacing: 2px; flex: 1; text-align: center; }
  .match-score .winner { color: #E8B15C; }
  .match-score .loser { color: var(--muted); }
  body.dark .match-score .winner { color: var(--accent); }

  /* Stat blocks */
  .stat-block {
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    text-align: center;
  }
  .stat-block .label { font-size: 10px; font-weight: 600; color: var(--muted); letter-spacing: .5px; text-transform: uppercase; margin-bottom: 6px; }
  .stat-block .value { font-family: 'Bebas Neue', sans-serif; font-size: 28px; color: var(--text); }
  .stat-block .value.accent { color: #E8B15C; }
  .stat-block .value.teal { color: #E8B15C; }
  .stat-block .value.red { color: var(--accent2); }
  body.dark .stat-block .value.accent { color: var(--accent); }

  /* H2H */
  .h2h-bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
  .h2h-label { font-size: 13px; font-weight: 600; color: var(--text); min-width: 130px; text-align: right; }
  .h2h-bar-container { flex: 1; display: flex; height: 22px; border-radius: 4px; overflow: hidden; }
  .h2h-bar-left { background: #E8B15C; transition: width .5s; display: flex; align-items: center; justify-content: flex-end; padding-right: 6px; }
  .h2h-bar-right { background: #0c0c0c; transition: width .5s; display: flex; align-items: center; padding-left: 6px; }
  .h2h-bar-left span, .h2h-bar-right span { font-size: 11px; font-weight: 700; color: #fff; }
  .h2h-label-right { font-size: 13px; font-weight: 600; color: var(--text); min-width: 130px; }
  .h2h-selector { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
  .h2h-vs { font-family: 'Bebas Neue', sans-serif; font-size: 32px; color: var(--muted); }

  /* Modal */
  .modal-overlay {
    display: none; position: fixed; inset: 0;
    background: rgba(0,0,0,.6); z-index: 200;
    align-items: center; justify-content: center;
  }
  .modal-overlay.open { display: flex; }
  .modal {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    max-width: 900px; width: 95%;
    max-height: 90vh; overflow-y: auto;
  }
  .modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
  .modal-header h2 { font-family: 'Comfortaa', sans-serif; font-size: 20px; font-weight: 800; letter-spacing: -0.5px; color: #E8B15C; }
  body.dark .modal-header h2 { color: var(--accent); }
  .modal-close {
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    flex: 0 0 44px;
    padding: 0;
    border: none;
    border-radius: 12px;
    background: none;
    color: var(--muted);
    font-size: 20px;
    cursor: pointer;
  }

  /* Toast */
  .toast {
    position: fixed; right: 24px;
    background: var(--accent);
    color: #fff;
    font-size: 12px; font-weight: 600;
    padding: 12px 20px;
    border-radius: var(--radius-sm);
    transform: translateY(80px); opacity: 0;
    transition: all .3s; z-index: 300;
  }
  body.dark .toast { color: #000; }
  .toast.show { transform: translateY(0); opacity: 1; }

  /* Pills */
  .pill {
    display: inline-block; padding: 2px 8px;
    border-radius: var(--radius-sm);
    font-size: 11px; font-weight: 600;
  }
  .pill.win { background: rgba(232,177,92,.08); color: #E8B15C; border: 1px solid rgba(232,177,92,.2); }
  .pill.loss { background: rgba(204,34,0,.08); color: var(--accent2); border: 1px solid rgba(204,34,0,.2); }

  /* Table */
  .data-table { width: 100%; border-collapse: collapse; }
  .data-table th { font-size: 10px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--muted); text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border); }
  .data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 12px; }
  .data-table tr:last-child td { border-bottom: none; }
  .data-table tr:hover td { background: var(--surface2); }

  /* Empty state */
  .empty { text-align: center; padding: 60px; color: var(--muted); font-size: 12px; }
  .empty .icon { font-size: 40px; margin-bottom: 12px; opacity: .3; display: block; }

  /* Player chips */
  .player-chip {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--surface2); border: 1px solid var(--border);
    border-radius: var(--radius-sm); padding: 6px 12px; margin: 4px;
    font-size: 12px; font-weight: 500;
  }
  .player-chip button { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 14px; line-height: 1; }
  .player-chip button:hover { color: var(--accent2); }

  .player-order-list {
    display:flex;
    flex-direction:column;
    gap:7px;
  }

  .player-chip.player-order-row {
    width:100%;
    min-height:52px;
    display:grid;
    grid-template-columns:32px minmax(0,1fr) auto;
    gap:10px;
    margin:0;
    padding:8px 10px;
    border-radius:8px;
  }

  .player-order-position {
    width:28px;
    height:28px;
    display:grid;
    place-items:center;
    border-radius:50%;
    background:var(--surface);
    color:var(--muted);
    font:800 10px 'IBM Plex Mono', monospace;
  }

  .player-order-name {
    min-width:0;
    overflow:hidden;
    color:var(--text);
    font-weight:700;
    text-overflow:ellipsis;
    white-space:nowrap;
  }

  .player-order-actions {
    display:flex;
    align-items:center;
    gap:3px;
  }

  .player-chip .player-order-actions button {
    width:44px;
    height:44px;
    display:grid;
    place-items:center;
    padding:0;
    border:1px solid transparent;
    border-radius:6px;
    color:var(--muted);
    font-size:15px;
  }

  .player-chip .player-order-actions button:hover:not(:disabled) {
    border-color:var(--border2);
    background:var(--surface);
    color:var(--text);
  }

  .player-chip .player-order-actions .player-delete-button:hover:not(:disabled) {
    color:var(--accent2);
  }

  .player-chip .player-order-actions button:disabled {
    opacity:.28;
    cursor:not-allowed;
  }

  .player-chip .player-order-actions button:focus-visible {
    outline:2px solid var(--accent);
    outline-offset:2px;
  }

  /* Filter chips */
  .filter-chip {
    display: inline-flex; align-items: center; gap: 6px;
    min-height: 44px;
    padding: 5px 12px; border-radius: 20px;
    font-size: 12px; font-weight: 600;
    cursor: pointer; border: 1px solid var(--border);
    background: var(--surface2); color: var(--muted);
    transition: all .12s; user-select: none;
  }
  .filter-chip.selected { background: rgba(232,177,92,.08); border-color: #E8B15C; color: #00C853; }
  .filter-chip:hover { border-color: #00C853; }

  /* Live pills */
  .lpill { display:inline-block;padding:7px 16px;border-radius:20px;font-size:13px;font-weight:600;cursor:pointer;border:1.5px solid var(--border2);background:var(--surface2);color:var(--muted);transition:all .12s;user-select:none }
  .lpill.on { background:rgba(0,200,83,.1);border-color:#00C853;color:#00C853;font-weight:700 }
  .lpill:hover { border-color:#00C853 }
  .lpill.warn.on { background:rgba(232,177,92,.12);border-color:#E8B15C;color:#E8B15C }

  /* Live numpad */
  .lnum { padding:16px 4px;border:1px solid var(--border2);border-radius:var(--radius-sm);background:var(--surface2);font-size:15px;font-weight:700;color:var(--text);cursor:pointer;text-align:center;transition:all .1s;-webkit-tap-highlight-color:transparent }
  .lnum:active { transform:scale(.95); background:var(--border2); }
  .lnum.mod-on { background:rgba(232,177,92,.15);border-color:#E8B15C;color:#E8B15C;border-width:2px }
  .lnum.mod-off { color:var(--muted) }
  .lnum.erase { background:rgba(255,82,82,.08);color:#FF5252 }
  .lnum.bust { background:rgba(255,82,82,.12);color:#FF5252;font-size:11px }
  .lnum.live-key-miss { background:rgba(255,82,82,.12) !important;color:#FF5252 !important;border:2px solid rgba(255,82,82,.55) !important;font-weight:800 !important }
  .lnum.live-key-25 { background:var(--surface2) !important;color:var(--text) !important;border:2px solid rgba(232,177,92,.38) !important;font-weight:800 !important }
  .lnum.live-key-50 { background:#8A5A1F !important;color:#fff !important;border:2px solid #E8B15C !important;font-weight:900 !important }
  .lnum.live-key-double { background:rgba(59,130,246,.13) !important;color:#3B82F6 !important;border:2px solid rgba(59,130,246,.72) !important;font-weight:800 !important }
  .lnum.live-key-double.active { background:#3B82F6 !important;color:#fff !important;border-color:#3B82F6 !important }
  .lnum.live-key-triple { background:rgba(0,200,83,.12) !important;color:#00C853 !important;border:2px solid #00C853 !important;font-weight:800 !important }
  .lnum.live-key-triple.active { background:#00C853 !important;color:#0A0D14 !important }
  .lnum.live-key-erase { background:#FF5252 !important;color:#fff !important;border:2px solid #FF5252 !important;font-weight:900 !important }

  /* Context bar tabs */
  .ctx-tab-active { background:var(--surface2) !important; color:var(--text) !important; font-weight:700 !important; border-color:var(--border2) !important; }
  .ctx-tab-group-active { background:rgba(232,177,92,0.08) !important; color:#E8B15C !important; border-color:#E8B15C !important; font-weight:700 !important; }

  /* PWA safe area */
  @media (max-width:768px) {
    #context-bar { padding-left: max(12px,env(safe-area-inset-left)); padding-right: max(12px,env(safe-area-inset-right)); }
  }

  /* ── Sidebar collapsible ── */
  .sidebar.collapsed {
    width: 0;
    overflow: hidden;
    border-right: none;
  }
  .main-area.expanded {
    margin-left: 0;
  }
  .sidebar-toggle {
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 150;
    width: 36px; height: 36px;
    background: var(--surface);
    border: 1px solid var(--border2);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    transition: background .12s;
    color: var(--text);
  }
  .sidebar-toggle:hover { background: var(--surface2); }
  @media (min-width: 769px) {
    .sidebar { transition: width .2s ease; }
    .main-area { transition: margin-left .2s ease; }
    .sidebar.collapsed + .main-area { margin-left: 0; }
  }
  @media (max-width: 768px) {
    .sidebar-toggle { display: none !important; }
  }
  .menu-drawer {
    display: none;
    position: fixed; inset: 0; z-index: 150;
  }
  .menu-drawer.open { display: block; }
  .menu-overlay { position: absolute; inset: 0; background: rgba(0,0,0,.5); }
  .menu-panel {
    position: absolute; bottom: 0; left: 0; right: 0;
    background: var(--surface);
    border-radius: var(--radius) var(--radius) 0 0;
    padding: 16px 0;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }
  .menu-handle { width: 36px; height: 4px; background: var(--border2); border-radius: 2px; margin: 0 auto 16px; }
  .menu-item {
    display: flex; align-items: center; gap: 12px;
    padding: 12px 20px;
    font-size: 14px; font-weight: 500;
    color: var(--text); cursor: pointer;
    border: none; background: none; width: 100%; text-align: left;
  }
  .menu-item:hover { background: var(--surface2); }
  .menu-item .m-icon { font-size: 18px; width: 24px; text-align: center; }
  .menu-divider { height: 1px; background: var(--border); margin: 8px 0; }
  .menu-theme-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 20px; }
  .theme-toggle-btn {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 14px; border-radius: 20px;
    border: 1px solid var(--border2); background: var(--surface2);
    font-size: 12px; font-weight: 600; color: var(--text); cursor: pointer;
  }

  /* Niveau tooltip / classement overrides */
  #niveau-tooltip { z-index: 250; }

  /* ══════════════════════════════
     PREMIUM UI — noir / or, modes clair et foncé
  ══════════════════════════════ */
  :root {
    --bg: #f6f2e8;
    --surface: rgba(255,255,255,.88);
    --surface2: rgba(247,241,229,.92);
    --border: rgba(10,13,20,.10);
    --border2: rgba(232,177,92,.36);
    --accent: #E8B15C;
    --accent2: #FF5252;
    --accent3: #00C853;
    --live: #E8B15C;
    --text: #0A0D14;
    --muted: #6b7280;
    --gold-soft: rgba(232,177,92,.16);
    --gold-glow: rgba(232,177,92,.34);
    --shadow-premium: 0 18px 45px rgba(10,13,20,.10);
    --radius: 18px;
    --radius-sm: 12px;
  }

  body.dark {
    --bg: #0A0D14;
    --surface: rgba(26,31,43,.72);
    --surface2: rgba(18,22,32,.86);
    --border: rgba(255,255,255,.08);
    --border2: rgba(232,177,92,.24);
    --accent: #E8B15C;
    --accent2: #FF5252;
    --accent3: #00C853;
    --live: #E8B15C;
    --text: #f8fafc;
    --muted: #9ca3af;
    --gold-soft: rgba(232,177,92,.14);
    --gold-glow: rgba(232,177,92,.42);
    --shadow-premium: 0 24px 60px rgba(0,0,0,.36);
  }

  body,
  button,
  input,
  select,
  textarea,
  .btn,
  .card h2,
  .modal-header h2,
  .player-panel h3,
  .match-score,
  .stat-block .value,
  [style*="Bebas Neue"],
  [style*="IBM Plex Mono"],
  [style*="Comfortaa"],
  [style*="DM Sans"] {
    font-family: Inter, -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Segoe UI", sans-serif !important;
    letter-spacing: 0 !important;
  }

  body {
    background:
      radial-gradient(circle at 18% 0%, rgba(232,177,92,.18), transparent 34%),
      radial-gradient(circle at 88% 10%, rgba(0,200,83,.08), transparent 30%),
      linear-gradient(135deg, #fbf7ee 0%, var(--bg) 48%, #efe6d6 100%);
    color: var(--text);
    font-feature-settings: "tnum" 1, "cv02" 1, "cv03" 1;
  }

  body.dark {
    background:
      radial-gradient(circle at 18% 0%, rgba(232,177,92,.16), transparent 32%),
      radial-gradient(circle at 100% 0%, rgba(232,177,92,.08), transparent 34%),
      linear-gradient(145deg, #05070b 0%, #0A0D14 45%, #101622 100%);
  }

  body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background:
      linear-gradient(115deg, transparent 0 42%, rgba(232,177,92,.12) 42.2%, transparent 42.7%),
      radial-gradient(circle at 18% 26%, transparent 0 78px, rgba(232,177,92,.08) 79px 80px, transparent 81px 150px, rgba(232,177,92,.06) 151px 152px, transparent 153px);
    opacity: .7;
    z-index: -1;
  }

  .sidebar {
    background: linear-gradient(180deg, #0A0D14 0%, #101522 100%) !important;
    border-right: 1px solid rgba(232,177,92,.22) !important;
    box-shadow: 18px 0 45px rgba(0,0,0,.18);
  }

  .sidebar-logo {
    border-bottom-color: rgba(232,177,92,.18) !important;
  }

  .sidebar-logo span,
  .mobile-logo span {
    color: #f8fafc !important;
  }

  .sidebar-logo span span,
  .mobile-logo span span,
  .sidebar-item.active .s-icon,
  .bottom-tab.active .tab-icon,
  .bottom-tab.active .tab-label {
    color: var(--accent) !important;
  }

  .sidebar-item {
    border: 1px solid transparent !important;
    color: rgba(248,250,252,.68) !important;
    border-radius: 14px !important;
  }

  .sidebar-item:hover {
    background: rgba(232,177,92,.10) !important;
    border-color: rgba(232,177,92,.18) !important;
    color: #fff !important;
  }

  .sidebar-item.active {
    background: linear-gradient(135deg, rgba(232,177,92,.28), rgba(232,177,92,.10)) !important;
    border-color: rgba(232,177,92,.46) !important;
    color: #fff !important;
    box-shadow: 0 10px 26px rgba(232,177,92,.12);
  }

  .sidebar-item.live,
  .sidebar-item.groups {
    color: var(--accent) !important;
  }

  .sidebar-divider,
  .sidebar-bottom {
    border-color: rgba(232,177,92,.14) !important;
    background-color: rgba(232,177,92,.14) !important;
  }

  .main-area {
    min-height: 100vh;
  }

  #context-bar,
  .mobile-header,
  .bottom-bar,
  .menu-panel,
  .modal,
  .card,
  .player-panel,
  .match-item,
  .stat-block,
  .data-table,
  #niveau-tooltip {
    background: var(--surface) !important;
    border-color: var(--border) !important;
    box-shadow: var(--shadow-premium);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }

  #context-bar {
    border-bottom: 1px solid var(--border2) !important;
  }

  .card,
  .modal,
  .match-item,
  .stat-block,
  .player-panel {
    border: 1px solid var(--border) !important;
    border-radius: var(--radius) !important;
  }

  .card h2,
  .modal-header h2,
  h2 {
    color: var(--text) !important;
    font-weight: 800 !important;
  }

  .card h2::first-letter,
  .modal-header h2::first-letter {
    color: var(--accent);
  }

  .btn,
  .btn.teal,
  .btn-primary {
    background: linear-gradient(135deg, #ffd27c 0%, #E8B15C 46%, #bd7f2e 100%) !important;
    color: #0A0D14 !important;
    border: 1px solid rgba(232,177,92,.45) !important;
    border-radius: 16px !important;
    box-shadow: 0 12px 26px rgba(232,177,92,.24);
    font-weight: 800 !important;
  }

  .btn:hover {
    opacity: 1 !important;
    transform: translateY(-1px);
    box-shadow: 0 16px 32px rgba(232,177,92,.30);
  }

  .btn.secondary,
  .theme-toggle-btn,
  input,
  select,
  .filter-chip,
  .lpill,
  .lnum {
    background: var(--surface2) !important;
    color: var(--text) !important;
    border: 1px solid var(--border2) !important;
    border-radius: 14px !important;
  }

  .btn.danger {
    background: linear-gradient(135deg, #ff7b7b, #FF5252) !important;
    color: #fff !important;
    border-color: rgba(255,82,82,.55) !important;
    box-shadow: 0 12px 26px rgba(255,82,82,.22);
  }

  input:focus,
  select:focus {
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 4px var(--gold-soft);
  }

  label,
  .section-label,
  .data-table th,
  .stat-block .label,
  .tab-label {
    color: var(--muted) !important;
    font-weight: 700 !important;
    text-transform: none !important;
  }

  .stat-block {
    text-align: left !important;
    position: relative;
    overflow: hidden;
  }

  .stat-block::after {
    content: "";
    position: absolute;
    inset: auto 0 0 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), transparent);
    opacity: .8;
  }

  .stat-block .value,
  .stat-block .value.accent,
  .match-score .winner,
  .player-panel.p1 h3,
  .modal-header h2,
  .card h2 {
    color: var(--accent) !important;
  }

  .stat-block .value.teal,
  .pill.win,
  #auth-success {
    color: var(--accent3) !important;
  }

  .stat-block .value.red,
  .pill.loss,
  #auth-error {
    color: var(--accent2) !important;
  }

  .data-table th,
  .data-table td {
    border-bottom-color: var(--border) !important;
  }

  .data-table tr:hover td,
  .match-item:hover,
  .menu-item:hover {
    background: var(--gold-soft) !important;
  }

  .bottom-bar {
    border-top: 1px solid var(--border2) !important;
  }

  .bottom-tab.tab-live .tab-btn {
    background: linear-gradient(135deg, #ffd27c, #E8B15C) !important;
    box-shadow: 0 12px 30px rgba(232,177,92,.42) !important;
  }

  .bottom-tab.tab-live .tab-btn span {
    color: #0A0D14 !important;
  }

  .ctx-tab-active,
  .ctx-tab-group-active,
  .filter-chip.selected,
  .lpill.on {
    background: linear-gradient(135deg, rgba(232,177,92,.28), rgba(232,177,92,.10)) !important;
    color: var(--accent) !important;
    border-color: rgba(232,177,92,.55) !important;
  }

  .toast {
    background: linear-gradient(135deg, #ffd27c, #E8B15C) !important;
    color: #0A0D14 !important;
    box-shadow: 0 18px 42px rgba(232,177,92,.34);
  }

  .h2h-bar-left,
  .h2h-bar-right {
    background: linear-gradient(90deg, #E8B15C, #bd7f2e) !important;
  }

  .avatar,
  #avatar-desktop {
    background: var(--gold-soft) !important;
    border-color: var(--accent) !important;
    color: var(--accent) !important;
  }

  .modal-overlay {
    background: rgba(10,13,20,.72) !important;
    backdrop-filter: blur(10px);
  }

  @media (max-width: 768px) {
    html {
      min-height: 100%;
      background: var(--bg);
      overscroll-behavior-y: none;
    }

    body {
      min-height: 100%;
      overflow-x: hidden;
      -webkit-font-smoothing: antialiased;
      text-rendering: optimizeLegibility;
    }

    body::before {
      opacity: .45;
      background:
        linear-gradient(135deg, transparent 0 58%, rgba(232,177,92,.10) 58.2%, transparent 58.8%),
        radial-gradient(circle at 50% -8%, rgba(232,177,92,.13), transparent 36%),
        radial-gradient(circle at 100% 20%, rgba(0,200,83,.06), transparent 28%);
    }

    .app-shell,
    .main-area {
      width: 100%;
      min-width: 0;
      margin-left: 0 !important;
    }

    .mobile-header {
      display: flex !important;
      position: sticky;
      top: 0;
      z-index: 160;
      min-height: calc(64px + env(safe-area-inset-top));
      padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
      background: rgba(10,13,20,.92) !important;
      border-bottom: 1px solid rgba(232,177,92,.20) !important;
      box-shadow: 0 18px 34px rgba(0,0,0,.20);
    }

    body:not(.dark) .mobile-header {
      background: rgba(255,252,244,.88) !important;
      box-shadow: 0 12px 28px rgba(96,72,35,.12);
    }

    .mobile-logo {
      min-width: 0;
      gap: 10px !important;
    }

    .mobile-logo img {
      width: 40px !important;
      height: 40px !important;
      border: 1px solid rgba(232,177,92,.36);
      box-shadow: 0 8px 20px rgba(232,177,92,.16);
    }

    .mobile-logo span {
      font-size: 18px !important;
      font-weight: 900 !important;
      line-height: 1;
      white-space: nowrap;
    }

    .mobile-header-right {
      margin-left: auto;
    }

    .avatar {
      width: 38px !important;
      height: 38px !important;
      border-radius: 50% !important;
    }

    #context-bar {
      position: sticky;
      top: calc(64px + env(safe-area-inset-top));
      z-index: 150;
      display: flex !important;
      align-items: center;
      gap: 8px;
      min-height: 46px;
      padding: 8px 14px;
      overflow-x: auto;
      scrollbar-width: none;
      border-bottom: 1px solid var(--border) !important;
    }

    #context-bar::-webkit-scrollbar {
      display: none;
    }

    main {
      width: 100%;
      max-width: 480px;
      margin: 0 auto;
      padding: 14px 14px calc(108px + env(safe-area-inset-bottom)) !important;
    }

    .page.active {
      animation: mobilePageIn .18s ease both;
    }

    @keyframes mobilePageIn {
      from { opacity: 0; transform: translateY(8px); }
      to { opacity: 1; transform: translateY(0); }
    }

    .card,
    .player-panel,
    .stat-block,
    .match-item {
      border-radius: 24px !important;
    }

    .card {
      padding: 16px !important;
      margin-bottom: 14px !important;
    }

    .card h2,
    .modal-header h2,
    main > .page > div > h2,
    main h2 {
      font-size: 19px !important;
      line-height: 1.18 !important;
      letter-spacing: 0 !important;
    }

    .grid-4,
    #kpi-global,
    #kpi-averages {
      display: grid !important;
      grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
      gap: 10px !important;
    }

    .grid-3,
    .grid-2,
    .player-panels,
    #player-panels-container,
    .form-row,
    .form-row-3,
    .form-row-4,
    .h2h-selector {
      display: grid !important;
      grid-template-columns: 1fr !important;
      gap: 12px !important;
    }

    .stat-block {
      min-height: 96px;
      padding: 14px !important;
    }

    .stat-block .label {
      font-size: 11px !important;
      line-height: 1.25 !important;
    }

    .stat-block .value {
      margin-top: 8px;
      font-size: 29px !important;
      line-height: 1 !important;
    }

    .btn,
    .btn.secondary,
    .theme-toggle-btn,
    input,
    select {
      min-height: 48px;
      border-radius: 18px !important;
      font-size: 16px !important;
    }

    .btn,
    .btn.secondary {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      padding: 12px 16px !important;
    }

    input,
    select {
      width: 100%;
      padding: 0 14px !important;
    }

    textarea {
      font-size: 16px !important;
    }

    .player-chip.player-order-row {
      align-items: start;
      grid-template-columns: 32px minmax(0, 1fr);
    }

    .player-order-name {
      display: -webkit-box;
      overflow: hidden;
      white-space: normal;
      text-overflow: clip;
      overflow-wrap: anywhere;
      -webkit-box-orient: vertical;
      -webkit-line-clamp: 2;
    }

    .player-order-actions {
      grid-column: 2;
      flex-wrap: wrap;
      gap: 4px;
    }

    .player-chip .player-order-actions button {
      width: 44px;
      height: 44px;
    }

    #page-live .lpill,
    #page-training .lpill,
    .help-dot {
      min-height: 44px;
    }

    #page-live .lpill,
    #page-training .lpill,
    .help-dot {
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }

    .bottom-bar {
      display: flex !important;
      position: fixed;
      left: 12px;
      right: 12px;
      bottom: calc(10px + env(safe-area-inset-bottom));
      width: auto;
      height: 74px;
      margin: 0;
      padding: 8px 8px 10px;
      z-index: 180;
      border: 1px solid var(--border2) !important;
      border-radius: 28px !important;
      overflow: visible;
      box-shadow: 0 18px 48px rgba(0,0,0,.32);
    }

    body:not(.dark) .bottom-bar {
      box-shadow: 0 16px 36px rgba(96,72,35,.16);
    }

    .bottom-tab {
      min-width: 0;
      min-height: 52px;
      flex: 1;
      gap: 4px;
      padding: 5px 2px !important;
      border-radius: 18px;
    }

    .bottom-tab.active {
      background: rgba(232,177,92,.11);
    }

    .tab-icon {
      font-size: 21px !important;
      line-height: 1;
    }

    .tab-label {
      font-size: 10px !important;
      line-height: 1.1;
      max-width: 100%;
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

    .bottom-tab.tab-live {
      align-self: flex-start;
      padding-top: 0 !important;
    }

    .bottom-tab.tab-live .tab-btn {
      width: 58px !important;
      height: 58px !important;
      margin-top: -24px;
      border-radius: 50% !important;
      border: 3px solid var(--bg);
    }

    .bottom-tab.tab-live .tab-label {
      margin-top: 0;
      color: var(--accent) !important;
    }

    .menu-panel {
      left: 10px !important;
      right: 10px !important;
      bottom: calc(92px + env(safe-area-inset-bottom)) !important;
      width: auto !important;
      max-height: 72vh;
      overflow-y: auto;
      border-radius: 28px !important;
      padding: 10px !important;
    }

    .menu-item {
      min-height: 48px;
      border-radius: 18px !important;
    }

    .modal {
      width: calc(100vw - 20px) !important;
      max-width: 460px !important;
      max-height: 88vh !important;
      overflow-y: auto;
      border-radius: 28px !important;
      padding: 18px !important;
    }

    .data-table {
      display: block;
      width: 100%;
      max-width: 100%;
      overflow-x: auto;
      white-space: nowrap;
      border-radius: 18px !important;
    }

    .data-table th,
    .data-table td {
      padding: 10px 11px !important;
      font-size: 12px !important;
    }

    #classement-filter-chips,
    #classement-forme-controls {
      min-width: 0;
    }

    #classement-filter-chips {
      flex-wrap: nowrap !important;
      overflow-x: auto;
      padding-bottom: 3px;
      scrollbar-width: none;
    }

    #classement-filter-chips::-webkit-scrollbar {
      display: none;
    }

    .filter-chip,
    .lpill,
    .mode-toggle {
      white-space: nowrap;
      flex-shrink: 0;
    }

    .ranking-row {
      border-radius: 22px !important;
    }

    .ranking-rank {
      min-height: 58px;
      border-radius: 16px !important;
    }

    .ranking-player {
      min-height: 58px;
      justify-content: center;
    }

    .ranking-name {
      font-size: 15px !important;
      line-height: 1.2;
    }

    .ranking-pills,
    .ranking-meta {
      display:flex;
      gap:5px;
      overflow-x:auto;
      flex-wrap:nowrap;
      scrollbar-width:none;
      padding-bottom:2px;
    }

    .ranking-pills::-webkit-scrollbar,
    .ranking-meta::-webkit-scrollbar {
      display:none;
    }

    .ranking-stat-value {
      font-size: clamp(24px, 8vw, 31px) !important;
      line-height: .95 !important;
      letter-spacing: 0 !important;
      max-width: 100%;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .ranking-stat-sub {
      font-size: 9.5px !important;
      line-height: 1.25 !important;
      max-height: 2.6em;
      overflow: hidden;
    }

    .cricket-board {
      overflow-x: auto;
      -webkit-overflow-scrolling: touch;
    }

    .cricket-board .cricket-row {
      min-width: min(620px, calc(100vw - 44px));
    }

    .cricket-target-stat-grid {
      grid-template-columns:repeat(2,minmax(0,1fr));
    }

    .match-item {
      display: flex;
      flex-direction: column;
      align-items: stretch;
      gap: 10px;
      padding: 14px !important;
    }

    .match-item > span {
      min-width: 0 !important;
      width: 100%;
      text-align: left !important;
    }

    .match-delete {
      width: 100%;
      justify-content: flex-start;
      flex-wrap: wrap;
      margin-left: 0 !important;
    }

    .match-score {
      text-align: left !important;
      font-size: 18px !important;
    }

    .lnum {
      min-height: 54px;
      padding: 14px 4px !important;
      border-radius: 16px !important;
      font-size: 16px !important;
      touch-action: manipulation;
    }

    #page-live .card {
      padding: 14px !important;
    }

    #page-live [style*="grid-template-columns"] {
      gap: 8px !important;
    }

    body.live-playing-layout {
      overflow: hidden;
    }

    body.live-playing-layout .mobile-header,
    body.live-playing-layout #context-bar,
    body.live-playing-layout .bottom-bar {
      display: none !important;
    }

    body.live-playing-layout main {
      max-width: none;
      height: 100dvh;
      padding: max(6px, env(safe-area-inset-top)) 8px max(6px, env(safe-area-inset-bottom)) !important;
      overflow: hidden;
    }

    body.live-playing-layout #page-live.active {
      display: flex;
      height: 100%;
      min-height: 0;
      overflow: hidden;
    }

    body.live-playing-layout .live-playing-shell {
      display: flex;
      flex-direction: column;
      gap: 6px;
      width: 100%;
      height: 100%;
      min-height: 0;
      overflow: hidden;
    }

    body.live-playing-layout .live-topbar {
      flex-shrink: 0;
      margin-bottom: 0 !important;
      gap: 6px !important;
      flex-wrap: nowrap !important;
    }

    body.live-playing-layout .live-topbar > div:first-child {
      min-width: 0;
      flex: 1;
    }

    body.live-playing-layout .live-meta {
      font-size: 9px !important;
      line-height: 1.2 !important;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    body.live-playing-layout .live-current {
      font-size: clamp(16px, 4.8vw, 20px) !important;
      line-height: 1.05 !important;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    body.live-playing-layout .live-actions {
      flex-shrink: 0;
      gap: 4px !important;
    }

    body.live-playing-layout .live-actions button {
      min-width: 44px;
      min-height: 44px !important;
      padding: 4px 8px !important;
      border-radius: 12px !important;
      font-size: 10px !important;
    }

    body.live-playing-layout .live-player-grid {
      flex-shrink: 0;
      gap: 5px !important;
      margin-bottom: 0 !important;
    }

    body.live-playing-layout .live-player-card {
      min-width: calc(50% - 3px) !important;
      max-width: calc(50% - 3px) !important;
      padding: 6px !important;
      border-radius: 16px !important;
    }

    body.live-playing-layout .live-count-5 .live-player-card,
    body.live-playing-layout .live-count-6 .live-player-card,
    body.live-playing-layout .live-count-7 .live-player-card,
    body.live-playing-layout .live-count-8 .live-player-card,
    body.live-playing-layout .live-count-9 .live-player-card,
    body.live-playing-layout .live-count-10 .live-player-card {
      min-width: calc(33.333% - 4px) !important;
      max-width: calc(33.333% - 4px) !important;
    }

    body.live-playing-layout .live-player-name {
      font-size: 10px !important;
      margin-bottom: 3px !important;
    }

    body.live-playing-layout .live-player-meta {
      padding: 2px 6px !important;
      margin-bottom: 2px !important;
    }

    body.live-playing-layout .live-player-meta span {
      font-size: 11px !important;
    }

    body.live-playing-layout .live-player-score {
      font-size: clamp(30px, 10vw, 42px) !important;
      letter-spacing: 0 !important;
    }

    body.live-playing-layout .live-count-5 .live-player-score,
    body.live-playing-layout .live-count-6 .live-player-score,
    body.live-playing-layout .live-count-7 .live-player-score,
    body.live-playing-layout .live-count-8 .live-player-score,
    body.live-playing-layout .live-count-9 .live-player-score,
    body.live-playing-layout .live-count-10 .live-player-score {
      font-size: clamp(22px, 7vw, 31px) !important;
    }

    body.live-playing-layout .live-player-set {
      font-size: 9px !important;
      margin-top: 1px !important;
    }

    body.live-playing-layout .live-checkout {
      flex-shrink: 1;
      max-height: 52px;
      overflow-y: auto;
      margin-bottom: 0 !important;
      padding: 6px 8px !important;
      border-radius: 14px !important;
    }

    body.live-playing-layout .live-checkout-title {
      font-size: 8px !important;
      margin-bottom: 2px !important;
    }

    body.live-playing-layout .live-checkout-line {
      font-size: 10px !important;
      padding: 1px 0 !important;
    }

    body.live-playing-layout .live-slots {
      flex-shrink: 0;
      padding: 6px !important;
      margin-bottom: 0 !important;
      border-radius: 16px !important;
    }

    body.live-playing-layout .live-slot {
      padding: 5px 3px !important;
      border-radius: 14px !important;
    }

    body.live-playing-layout .live-slot-label {
      font-size: 8px !important;
      margin-bottom: 1px !important;
    }

    body.live-playing-layout .live-slot-value {
      font-size: 18px !important;
    }

    body.live-playing-layout .live-turn-total {
      flex-shrink: 0;
      margin-top: -2px !important;
      font-size: 9px !important;
      line-height: 1.1 !important;
    }

    body.live-playing-layout .live-turn-total strong {
      font-size: 14px !important;
    }

    body.live-playing-layout #live-numpad {
      flex-shrink: 0;
      margin-top: auto !important;
      margin-bottom: 0 !important;
      padding: 6px !important;
      border-radius: 18px !important;
    }

    body.live-playing-layout .live-numpad-grid {
      gap: 4px !important;
    }

    body.live-playing-layout #live-numpad .lnum {
      min-height: 0 !important;
      height: 44px !important;
      padding: 0 2px !important;
      border-radius: 12px !important;
      font-size: clamp(12px, 3.5vw, 15px) !important;
      line-height: 1 !important;
    }

    [style*="display:flex"][style*="gap:12px"],
    [style*="display:flex"][style*="gap:10px"],
    [style*="display:flex"][style*="gap:8px"] {
      max-width: 100%;
    }
  }

  @media (max-width: 768px) and (orientation: landscape) and (max-height: 500px) {
    body.live-playing-layout {
      overflow-x: hidden;
      overflow-y: auto;
    }

    body.live-playing-layout main {
      height: auto;
      min-height: 100dvh;
      overflow: visible;
    }

    body.live-playing-layout #page-live.active,
    body.live-playing-layout .live-playing-shell {
      height: auto;
      min-height: 100dvh;
      overflow: visible;
    }
  }

  @media (max-width: 932px) and (orientation: landscape) and (max-height: 500px) {
    body.live-playing-layout .live-actions button {
      min-width: 44px;
      min-height: 44px !important;
      display: inline-flex;
      align-items: center;
      justify-content: center;
    }
  }

  @media (max-width: 380px) {
    main {
      padding-left: 10px !important;
      padding-right: 10px !important;
    }

    .card {
      padding: 14px !important;
    }

    .grid-4,
    #kpi-global,
    #kpi-averages {
      gap: 8px !important;
    }

    .stat-block .value {
      font-size: 25px !important;
    }

    .ranking-stats-grid,
    .cricket-target-stat-grid {
      grid-template-columns:1fr !important;
    }

    .ranking-row {
      grid-template-columns:38px minmax(0,1fr) !important;
    }

    .tab-label {
      font-size: 9px !important;
    }
  }

  .stat-block {
    container-type: inline-size;
  }

  .stat-block .value {
    max-width: 100%;
    display: block;
    width: 100%;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: clip;
    line-height: 1 !important;
    letter-spacing: 0 !important;
    transform-origin: left center;
  }

  .stat-block .value.stat-long {
    font-size: clamp(24px, 30cqw, 48px) !important;
  }

  .stat-block .value.stat-xlong {
    font-size: clamp(20px, 25cqw, 40px) !important;
  }

  @media (max-width: 640px) {
    .stat-block .value.stat-long {
      font-size: clamp(19px, 26cqw, 30px) !important;
    }
    .stat-block .value.stat-xlong {
      font-size: clamp(17px, 22cqw, 26px) !important;
    }
  }

  .ranking-board {
    display: grid;
    gap: 10px;
    --ranking-muted: #4b5563;
    --ranking-soft: #64748b;
  }

  body.dark .ranking-board {
    --ranking-muted: #c4ccd8;
    --ranking-soft: #aab4c2;
  }

  .ranking-summary {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:12px;
    padding:12px 14px;
    border:1px solid var(--border);
    border-radius:var(--radius);
    background:var(--surface2);
    margin-bottom:12px;
  }

  .ranking-row {
    display:grid;
    grid-template-columns:52px minmax(180px,1.1fr) minmax(0,4fr);
    gap:6px;
    align-items:stretch;
    padding:7px;
    border:1px solid var(--border);
    border-radius:var(--radius);
    background:var(--surface);
    transition:border-color .15s, transform .15s, box-shadow .15s;
  }

  .ranking-row:hover {
    border-color:var(--accent);
    box-shadow:var(--shadow-premium);
    transform:translateY(-1px);
  }

  .ranking-rank {
    display:flex;
    align-items:center;
    justify-content:center;
    border-radius:var(--radius-sm);
    background:var(--surface2);
    font-family:'Bebas Neue';
    font-size:20px;
    color:var(--ranking-soft);
  }

  .ranking-player {
    min-width:0;
    padding:2px 6px;
    display:flex;
    flex-direction:column;
    justify-content:center;
    gap:5px;
  }

  .ranking-name {
    font-family:'IBM Plex Mono';
    font-size:15px;
    font-weight:800;
    color:var(--text);
    cursor:pointer;
    text-decoration:underline;
    text-underline-offset:3px;
  }

  .ranking-name:hover {
    color:var(--accent);
  }

  .ranking-meta {
    display:flex;
    flex-wrap:wrap;
    gap:5px;
  }

  .ranking-pill {
    display:inline-flex;
    align-items:center;
    border:1px solid var(--border);
    border-radius:999px;
    padding:3px 7px;
    background:var(--surface2);
    font-family:'IBM Plex Mono';
    font-size:10px;
    font-weight:700;
    color:var(--ranking-muted);
    white-space:nowrap;
  }

  .ranking-stat {
    min-width:0;
    padding:7px 9px;
    border:1px solid var(--border);
    border-radius:var(--radius-sm);
    background:var(--surface2);
  }

  .ranking-stats-grid {
    min-width:0;
    display:grid;
    grid-template-columns:repeat(5,minmax(86px,1fr));
    gap:6px;
  }

  .ranking-stat-label {
    font-family:'IBM Plex Mono';
    font-size:9.5px;
    line-height:1.2;
    color:var(--ranking-muted);
    text-transform:uppercase;
    letter-spacing:.5px;
    margin-bottom:4px;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
  }

  .ranking-stat-value {
    font-family:'Bebas Neue';
    font-size:27px;
    line-height:1;
    color:var(--text);
    white-space:nowrap;
  }

  .ranking-stat-sub {
    font-family:'IBM Plex Mono';
    font-size:10px;
    line-height:1.25;
    color:var(--ranking-muted);
    margin-top:3px;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
  }

  .ranking-trend {
    display:flex;
    flex-direction:column;
    justify-content:center;
    gap:5px;
  }

  .training-hero {
    display:grid;
    grid-template-columns:minmax(0,1.25fr) minmax(280px,.75fr);
    gap:14px;
    margin-bottom:16px;
  }

  .training-card {
    background:var(--surface);
    border:1px solid var(--border);
    border-radius:var(--radius);
    padding:16px;
  }

  .training-card.selected {
    border-color:var(--accent);
    box-shadow:0 10px 26px rgba(232,177,92,.14);
  }

  .training-title {
    font-family:'Bebas Neue';
    font-size:20px;
    letter-spacing:2px;
    color:var(--accent);
    margin-bottom:6px;
  }

  .training-grid {
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(190px,1fr));
    gap:10px;
  }

  .training-session-layout {
    display:grid;
    grid-template-columns:minmax(0,1fr) minmax(260px,.45fr);
    gap:14px;
  }

  .training-target {
    display:flex;
    align-items:center;
    justify-content:center;
    min-height:120px;
    border:1px solid var(--border);
    border-radius:var(--radius);
    background:var(--surface2);
    font-family:'Bebas Neue';
    font-size:52px;
    line-height:1;
    color:var(--accent);
  }

  .training-actions {
    display:flex;
    flex-wrap:wrap;
    gap:8px;
    margin-top:12px;
  }

  .training-history-item {
    display:grid;
    grid-template-columns:minmax(120px,.7fr) minmax(140px,1fr) minmax(140px,1fr) auto;
    gap:10px;
    align-items:center;
    padding:12px 14px;
    border:1px solid var(--border);
    border-radius:var(--radius);
    background:var(--surface);
  }

  .home-hero {
    position:relative;
    overflow:hidden;
    display:grid;
    grid-template-columns:minmax(0,1.1fr) minmax(260px,.9fr);
    gap:18px;
    align-items:stretch;
    margin-bottom:16px;
    padding:18px;
    border:1px solid rgba(232,177,92,.34);
    border-radius:var(--radius);
    background:
      linear-gradient(135deg, rgba(10,13,20,.94), rgba(26,31,43,.92)),
      var(--surface);
    color:#fff;
    box-shadow:0 16px 40px rgba(10,13,20,.18);
  }

  .home-hero::before {
    content:'';
    position:absolute;
    inset:12px auto auto 18px;
    width:220px;
    height:220px;
    border:1px solid rgba(232,177,92,.12);
    border-radius:50%;
    box-shadow:42px 42px 0 -1px rgba(232,177,92,.07), 84px 84px 0 -1px rgba(232,177,92,.045);
    pointer-events:none;
  }

  .home-hero-main,
  .home-hero-side {
    position:relative;
    z-index:1;
  }

  .home-kicker {
    font-family:'IBM Plex Mono';
    font-size:11px;
    font-weight:800;
    letter-spacing:.8px;
    color:rgba(232,177,92,.92);
    text-transform:uppercase;
    margin-bottom:10px;
  }

  .home-title {
    font-size:30px;
    line-height:1.05;
    font-weight:900;
    letter-spacing:0;
    margin:0 0 7px;
  }

  .home-subtitle {
    max-width:520px;
    color:rgba(255,255,255,.68);
    font-size:14px;
    line-height:1.45;
    margin-bottom:16px;
  }

  .home-actions,
  .live-hero-actions {
    display:flex;
    flex-wrap:wrap;
    gap:9px;
  }

  .home-action-btn {
    display:inline-flex;
    align-items:center;
    gap:8px;
    min-height:44px;
    padding:9px 14px;
    border-radius:var(--radius-sm);
    border:1px solid rgba(255,255,255,.14);
    background:rgba(255,255,255,.08);
    color:#fff;
    font-weight:800;
    font-size:12px;
    cursor:pointer;
  }

  .home-action-btn.primary {
    border-color:rgba(232,177,92,.55);
    background:linear-gradient(135deg, #FFD47C, #E8B15C 58%, #C98422);
    color:#111;
    box-shadow:0 12px 26px rgba(232,177,92,.28);
  }

  .home-hero-side {
    display:grid;
    grid-template-columns:1fr auto;
    gap:14px;
    align-items:center;
    min-height:164px;
    padding:14px;
    border:1px solid rgba(255,255,255,.08);
    border-radius:var(--radius);
    background:rgba(255,255,255,.055);
  }

  .home-mini-stats {
    display:grid;
    grid-template-columns:repeat(2,minmax(0,1fr));
    gap:8px;
    margin-top:12px;
  }

  .home-mini-stat {
    min-width:0;
    padding:9px;
    border:1px solid rgba(255,255,255,.08);
    border-radius:var(--radius-sm);
    background:rgba(255,255,255,.055);
  }

  .home-mini-stat .label {
    font-family:'IBM Plex Mono';
    font-size:9px;
    font-weight:800;
    letter-spacing:.4px;
    text-transform:uppercase;
    color:rgba(255,255,255,.55);
    margin-bottom:4px;
  }

  .home-mini-stat .value {
    font-size:20px;
    font-weight:900;
    color:#E8B15C;
    line-height:1;
    white-space:nowrap;
  }

  .dartboard-visual {
    position:relative;
    flex:0 0 auto;
    width:150px;
    height:150px;
    border-radius:50%;
    border:8px solid #11151c;
    background:
      radial-gradient(circle at 50% 50%, #E8B15C 0 3.5%, #0A0D14 3.7% 7%, #00C853 7.2% 10.5%, #FF5252 10.8% 13.2%, transparent 13.5% 100%),
      repeating-conic-gradient(from -9deg, #0A0D14 0 9deg, #F4E2C2 9deg 18deg, #121722 18deg 27deg, #E7D2A4 27deg 36deg);
    box-shadow:inset 0 0 0 8px #243126, inset 0 0 0 14px #C95745, inset 0 0 0 22px #11151c, 0 18px 34px rgba(0,0,0,.36);
  }

  .dartboard-visual::before {
    content:'';
    position:absolute;
    inset:21%;
    border-radius:50%;
    border:2px solid rgba(255,255,255,.22);
    box-shadow:0 0 0 20px rgba(0,0,0,.14);
  }

  .live-landing {
    display:grid;
    grid-template-columns:minmax(0,1fr);
    gap:14px;
    align-items:stretch;
  }

  .live-premium-card,
  .live-setup-hero {
    position:relative;
    overflow:hidden;
    border:1px solid rgba(232,177,92,.34);
    border-radius:var(--radius);
    background:
      linear-gradient(135deg, rgba(10,13,20,.95), rgba(26,31,43,.93)),
      var(--surface);
    color:#fff;
    box-shadow:0 16px 36px rgba(10,13,20,.18);
  }

  .live-premium-card {
    display:grid;
    grid-template-columns:minmax(0,1fr) auto;
    gap:16px;
    align-items:center;
    min-height:240px;
    padding:22px;
  }

  .live-setup-hero {
    display:grid;
    grid-template-columns:auto minmax(0,1fr);
    gap:18px;
    align-items:center;
    margin-bottom:14px;
    padding:18px;
  }

  .live-hero-title {
    font-size:42px;
    line-height:.95;
    font-weight:900;
    color:#E8B15C;
    margin-bottom:6px;
  }

  .live-hero-sub {
    color:rgba(255,255,255,.68);
    font-size:13px;
    line-height:1.45;
    margin-bottom:14px;
  }

  .live-rule-grid {
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:8px;
    margin:12px 0 16px;
  }

  .live-rule-tile {
    min-width:0;
    padding:10px;
    border:1px solid rgba(255,255,255,.09);
    border-radius:var(--radius-sm);
    background:rgba(255,255,255,.055);
  }

  .live-rule-tile .label {
    font-family:'IBM Plex Mono';
    font-size:9px;
    font-weight:800;
    color:rgba(255,255,255,.52);
    text-transform:uppercase;
    letter-spacing:.4px;
    margin-bottom:4px;
  }

  .live-rule-tile .value {
    font-weight:900;
    font-size:17px;
    color:#fff;
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
  }

  .cricket-board {
    display:grid;
    gap:6px;
    padding:10px;
    border:1px solid var(--border);
    border-radius:var(--radius);
    background:var(--surface);
    margin-bottom:10px;
  }

  .cricket-row {
    display:grid;
    grid-template-columns:54px repeat(var(--cricket-player-count, 2), minmax(74px, 1fr));
    gap:6px;
    align-items:center;
  }

  .cricket-target {
    font-family:'Bebas Neue';
    font-size:22px;
    color:var(--accent);
    text-align:center;
  }

  .cricket-cell {
    min-width:0;
    padding:7px 6px;
    border:1px solid var(--border);
    border-radius:var(--radius-sm);
    background:var(--surface2);
    text-align:center;
  }

  .cricket-cell.closed {
    border-color:rgba(0,200,83,.38);
    background:rgba(0,200,83,.07);
  }

  .cricket-player-head {
    font-size:10px;
    font-weight:900;
    color:var(--muted);
    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
  }

  .cricket-marks {
    font-family:'IBM Plex Mono';
    font-size:16px;
    font-weight:900;
    letter-spacing:1px;
    color:var(--text);
  }

  .cricket-score {
    font-size:10px;
    color:var(--muted);
    margin-top:2px;
  }

  .cricket-target-stat-grid {
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(118px,1fr));
    gap:8px;
  }

  .cricket-target-stat {
    border:1px solid var(--border);
    border-radius:var(--radius-sm);
    background:var(--surface);
    padding:9px;
    min-width:0;
  }

  .cricket-target-stat-head {
    display:flex;
    justify-content:space-between;
    gap:8px;
    align-items:center;
    font-family:'IBM Plex Mono';
    font-size:11px;
    color:var(--text);
    margin-bottom:6px;
  }

  .cricket-target-stat-head span {
    color:var(--accent);
    font-weight:900;
  }

  .cricket-target-stat-bar {
    height:6px;
    border-radius:999px;
    background:rgba(232,177,92,.12);
    overflow:hidden;
    margin-bottom:6px;
  }

  .cricket-target-stat-bar i {
    display:block;
    height:100%;
    border-radius:999px;
    background:linear-gradient(90deg, var(--accent), var(--accent3));
  }

  .cricket-target-stat-meta {
    font-family:'IBM Plex Mono';
    font-size:9.5px;
    line-height:1.25;
    color:var(--muted);
  }

  @media (max-width: 900px) {
    .home-hero,
    .live-landing,
    .live-setup-hero,
    .live-premium-card {
      grid-template-columns:1fr;
    }
    .home-hero {
      padding:16px;
    }
    .home-title {
      font-size:26px;
    }
    .home-hero-side {
      grid-template-columns:minmax(0,1fr) auto;
    }
    .dartboard-visual {
      width:118px;
      height:118px;
      border-width:6px;
    }
    .live-rule-grid {
      grid-template-columns:repeat(3,minmax(0,1fr));
    }
    .ranking-row {
      grid-template-columns:44px minmax(0,1fr);
      padding:8px;
      gap:6px;
    }
    .ranking-player {
      padding-right:0;
      grid-column:2 / -1;
    }
    .ranking-stats-grid {
      grid-column:1 / -1;
      grid-template-columns:repeat(2,minmax(0,1fr));
      gap:7px;
    }
    .ranking-stat {
      display:block;
      padding:8px 9px;
    }
    .ranking-trend {
      grid-column:1 / -1;
    }
    .ranking-stat-label,
    .ranking-stat-sub {
      white-space:normal;
    }
    .ranking-summary {
      align-items:flex-start;
      flex-direction:column;
    }
    .training-hero,
    .training-session-layout {
      grid-template-columns:1fr;
    }
    .training-history-item {
      grid-template-columns:1fr;
    }
  }

  /* Dashboard product home */
  .dashboard-product-shell {
    width:100%;
    max-width:1040px;
    margin:0 auto;
  }

  #context-bar.dashboard-context-hidden {
    display:none !important;
  }

  .dashboard-welcome {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:28px;
    padding:26px 28px;
    border:1px solid var(--border);
    border-radius:8px;
    background:var(--surface);
  }

  .dashboard-welcome-copy {
    min-width:0;
  }

  .dashboard-section-eyebrow {
    margin-bottom:6px;
    color:#76531d;
    font-family:'IBM Plex Mono', monospace;
    font-size:11px;
    font-weight:800;
    text-transform:uppercase;
  }

  .dashboard-welcome h1 {
    max-width:100%;
    margin:0;
    color:var(--text);
    font-size:30px;
    font-weight:900;
    line-height:1.15;
    overflow-wrap:anywhere;
  }

  .dashboard-welcome p {
    margin-top:6px;
    color:#5f5f59;
    font-size:15px;
    line-height:1.45;
  }

  .dashboard-primary-action {
    min-width:230px;
    min-height:52px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:10px;
    padding:12px 20px;
    border:1px solid #ad6d11;
    border-radius:8px;
    background:#dfa33f;
    color:#16120b;
    font:800 14px 'Comfortaa', sans-serif;
    cursor:pointer;
  }

  .dashboard-primary-action:hover {
    background:#e8b15c;
  }

  .dashboard-primary-action:active {
    transform:translateY(1px);
  }

  .dashboard-local-note {
    display:flex;
    align-items:center;
    justify-content:flex-end;
    gap:8px 14px;
    margin:10px 2px 0;
    color:#5f5f59;
    font-size:12px;
    line-height:1.4;
  }

  .dashboard-local-note button {
    min-height:44px;
    padding:8px 4px;
    border:0;
    background:transparent;
    color:#76531d;
    font:800 12px 'Comfortaa', sans-serif;
    cursor:pointer;
  }

  .dashboard-local-note button:focus-visible {
    outline:3px solid #7a4b05;
    outline-offset:2px;
  }

  .dashboard-install-suggestion {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:20px;
    margin-top:14px;
    padding:16px 18px;
    border:1px solid #d8cab2;
    border-left:4px solid #b9893f;
    border-radius:8px;
    background:#f7f4ed;
  }

  .dashboard-install-copy {
    min-width:0;
  }

  .dashboard-install-copy h2 {
    margin:0;
    color:var(--text);
    font-size:16px;
    font-weight:800;
  }

  .dashboard-install-copy p {
    margin:5px 0 0;
    color:#5f5f59;
    font-size:12px;
    line-height:1.45;
  }

  .dashboard-install-actions {
    flex:0 0 auto;
    display:flex;
    align-items:center;
    gap:8px;
  }

  .dashboard-install-primary,
  .dashboard-install-later {
    min-height:44px;
    padding:9px 13px;
    border-radius:7px;
    font:800 12px 'Comfortaa', sans-serif;
    cursor:pointer;
  }

  .dashboard-install-primary {
    border:1px solid #ad6d11;
    background:#dfa33f;
    color:#16120b;
  }

  .dashboard-install-later {
    border:1px solid transparent;
    background:transparent;
    color:#6f4a13;
  }

  .dashboard-install-primary:hover {
    background:#e8b15c;
  }

  .dashboard-install-later:hover {
    border-color:#d8cab2;
    background:var(--surface);
  }

  .dashboard-install-primary:focus-visible,
  .dashboard-install-later:focus-visible {
    outline:3px solid #7a4b05;
    outline-offset:2px;
  }

  .dashboard-kpis {
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    margin:18px 0 28px;
    border-top:1px solid var(--border);
    border-bottom:1px solid var(--border);
    background:var(--surface);
  }

  .dashboard-kpi {
    min-width:0;
    padding:18px 20px;
    text-align:center;
  }

  .dashboard-kpi + .dashboard-kpi {
    border-left:1px solid var(--border);
  }

  .dashboard-kpi strong {
    display:block;
    color:#8a5b16;
    font-family:'IBM Plex Mono', monospace;
    font-size:25px;
    font-weight:800;
    line-height:1.1;
    overflow-wrap:anywhere;
  }

  .dashboard-kpi span {
    display:block;
    margin-top:5px;
    color:#5f5f59;
    font-size:12px;
    font-weight:700;
    line-height:1.35;
  }

  .dashboard-section {
    margin-top:26px;
  }

  .dashboard-section-heading,
  .dashboard-analytics-header {
    display:flex;
    align-items:flex-end;
    justify-content:space-between;
    gap:16px;
    margin-bottom:12px;
  }

  .dashboard-section-heading h2,
  .dashboard-analytics-header h2 {
    margin:0;
    color:var(--text);
    font-size:19px;
    font-weight:800;
  }

  .dashboard-last-match {
    padding:20px 22px;
    border:1px solid var(--border);
    border-radius:8px;
    background:var(--surface);
  }

  .dashboard-match-summary {
    padding-top:4px;
  }

  .dashboard-match-scoreline {
    display:flex;
    align-items:center;
    justify-content:center;
    gap:14px;
    min-width:0;
  }

  .dashboard-match-player {
    min-width:0;
    flex:1 1 120px;
    display:flex;
    align-items:center;
    justify-content:center;
    gap:10px;
    color:#54544f;
  }

  .dashboard-match-player span {
    min-width:0;
    font-size:14px;
    font-weight:700;
    line-height:1.35;
    overflow-wrap:anywhere;
  }

  .dashboard-match-player strong {
    flex:0 0 auto;
    color:var(--text);
    font-family:'IBM Plex Mono', monospace;
    font-size:26px;
    line-height:1;
  }

  .dashboard-match-player.is-winner span,
  .dashboard-match-player.is-winner strong {
    color:#76531d;
  }

  .dashboard-score-separator {
    flex:0 0 auto;
    color:#8a8a82;
    font-size:20px;
  }

  .dashboard-match-meta {
    margin-top:12px;
    color:#66665f;
    font-size:12px;
    font-weight:600;
    line-height:1.45;
    text-align:center;
  }

  .dashboard-inline-action,
  .dashboard-text-action {
    min-height:44px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    border:0;
    background:transparent;
    color:#6f4a13;
    font:800 12px 'Comfortaa', sans-serif;
    cursor:pointer;
  }

  .dashboard-inline-action {
    margin:10px auto 0;
    padding:8px 12px;
  }

  .dashboard-match-summary .dashboard-inline-action {
    display:flex;
  }

  .dashboard-empty-state {
    padding:8px 0 2px;
    color:#66665f;
    text-align:center;
  }

  .dashboard-empty-state p {
    font-size:13px;
    line-height:1.5;
  }

  .dashboard-secondary-actions {
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    gap:10px;
  }

  .dashboard-secondary-actions button {
    min-width:0;
    min-height:52px;
    display:flex;
    align-items:center;
    justify-content:flex-start;
    gap:10px;
    padding:11px 14px;
    border:1px solid var(--border);
    border-radius:8px;
    background:var(--surface);
    color:var(--text);
    font:700 12px 'Comfortaa', sans-serif;
    cursor:pointer;
  }

  .dashboard-secondary-actions button:hover {
    border-color:#b9893f;
    background:#f7f4ed;
  }

  .dashboard-secondary-actions button span:last-child {
    min-width:0;
    overflow-wrap:anywhere;
  }

  .dashboard-statistics-access {
    display:flex;
    justify-content:stretch;
    margin-top:18px;
    padding-top:10px;
    border-top:1px solid var(--border);
  }

  .dashboard-statistics-button {
    width:100%;
    min-height:48px;
    justify-content:flex-start;
    gap:10px;
    padding:11px 14px;
    border:1px solid #d8cab2;
    border-radius:8px;
    background:#f7f4ed;
    color:#292720;
    text-align:left;
  }

  .dashboard-statistics-button:hover {
    border-color:#b9893f;
    background:#f2eadc;
  }

  .dashboard-statistics-icon {
    color:#9a681e;
    font:800 18px/1 'IBM Plex Mono', monospace;
  }

  .dashboard-statistics-arrow {
    margin-left:auto;
    color:#9a681e;
    font-size:17px;
  }

  .dashboard-analytics {
    margin-top:34px;
    padding-top:26px;
    border-top:1px solid var(--border2);
    scroll-margin-top:72px;
  }

  .dashboard-analytics[hidden] {
    display:none;
  }

  .dashboard-primary-action:focus-visible,
  .dashboard-secondary-actions button:focus-visible,
  .dashboard-inline-action:focus-visible,
  .dashboard-text-action:focus-visible {
    outline:3px solid #7a4b05;
    outline-offset:3px;
  }

  body.dark .dashboard-section-eyebrow,
  body.dark .dashboard-kpi strong,
  body.dark .dashboard-match-player.is-winner span,
  body.dark .dashboard-match-player.is-winner strong,
  body.dark .dashboard-inline-action,
  body.dark .dashboard-text-action {
    color:#e8b15c;
  }

  body.dark .dashboard-welcome p,
  body.dark .dashboard-local-note,
  body.dark .dashboard-install-copy p,
  body.dark .dashboard-kpi span,
  body.dark .dashboard-match-player,
  body.dark .dashboard-match-meta,
  body.dark .dashboard-empty-state {
    color:#b8b8b1;
  }

  body.dark .dashboard-install-suggestion {
    border-color:#57472f;
    border-left-color:#b9893f;
    background:#23211d;
  }

  body.dark .dashboard-install-later {
    color:#e8b15c;
  }

  body.dark .dashboard-secondary-actions button:hover {
    background:#232936;
  }

  body.dark .dashboard-statistics-button {
    border-color:#57472f;
    background:#23211d;
    color:#f2eee6;
  }

  body.dark .dashboard-statistics-button:hover {
    border-color:#b9893f;
    background:#2c2821;
  }

  @media (max-width: 768px) {
    .dashboard-welcome.is-first-run {
      align-items:stretch;
      flex-direction:column;
      gap:18px;
    }

    .dashboard-welcome.is-first-run .dashboard-primary-action {
      width:100%;
      min-width:0;
    }
  }

  @media (max-width: 600px) {
    .dashboard-welcome {
      align-items:stretch;
      flex-direction:column;
      gap:18px;
      padding:20px;
    }

    .dashboard-welcome h1 {
      font-size:26px;
    }

    .dashboard-welcome p {
      font-size:14px;
    }

    .dashboard-primary-action {
      width:100%;
      min-width:0;
      min-height:52px;
    }

    .dashboard-local-note {
      align-items:flex-start;
      flex-direction:column;
      margin-top:8px;
      padding:0 4px;
    }

    .dashboard-local-note button {
      padding:6px 0;
      text-align:left;
    }

    .dashboard-install-suggestion {
      align-items:stretch;
      flex-direction:column;
      gap:12px;
      margin-top:12px;
      padding:15px;
    }

    .dashboard-install-actions {
      width:100%;
      display:grid;
      grid-template-columns:minmax(0,1fr) auto;
    }

    .dashboard-install-primary,
    .dashboard-install-later {
      min-width:0;
    }

    .dashboard-kpis {
      margin:14px 0 22px;
    }

    .dashboard-kpi {
      padding:14px 8px;
    }

    .dashboard-kpi strong {
      font-size:21px;
    }

    .dashboard-kpi span {
      font-size:11px;
    }

    .dashboard-section {
      margin-top:22px;
    }

    .dashboard-last-match {
      padding:17px 16px;
    }

    .dashboard-match-scoreline {
      gap:8px;
    }

    .dashboard-match-player {
      align-items:center;
      flex-direction:column;
      gap:5px;
      text-align:center;
    }

    .dashboard-match-player span {
      font-size:12px;
    }

    .dashboard-match-player strong {
      font-size:24px;
    }

    .dashboard-secondary-actions {
      gap:8px;
    }

    .dashboard-secondary-actions button {
      min-height:54px;
      justify-content:center;
      flex-direction:column;
      gap:4px;
      padding:8px 6px;
      text-align:center;
    }

    .dashboard-analytics {
      margin-top:26px;
      padding-top:22px;
    }
  }

  /* Ranking refresh */
  .ranking-page {
    overflow-x:hidden;
  }

  .ranking-page-shell {
    width:min(1120px,100%);
    margin:0 auto;
  }

  .ranking-header {
    display:flex;
    align-items:flex-end;
    justify-content:space-between;
    gap:20px;
    margin-bottom:18px;
    padding:6px 2px 18px;
    border-bottom:1px solid var(--border);
  }

  .ranking-eyebrow,
  .ranking-control-label {
    color:#8a621f;
    font:800 10px/1.2 'IBM Plex Mono', monospace;
    letter-spacing:1px;
    text-transform:uppercase;
  }

  .ranking-header h1 {
    margin:5px 0 2px;
    color:var(--text);
    font:400 32px/1 'Bebas Neue', sans-serif;
    letter-spacing:2px;
  }

  .ranking-header p {
    margin:0;
    color:var(--muted);
    font-size:13px;
  }

  .ranking-toolbar,
  .ranking-filter-panel {
    display:flex;
    align-items:center;
    gap:18px;
    margin-bottom:12px;
    padding:12px 14px;
    border:1px solid var(--border);
    border-radius:8px;
    background:var(--surface);
  }

  .ranking-toolbar {
    justify-content:space-between;
  }

  .ranking-control-group {
    display:flex;
    align-items:center;
    gap:10px;
  }

  .ranking-segmented-control {
    display:flex;
    gap:3px;
    padding:3px;
    border:1px solid var(--border);
    border-radius:7px;
    background:var(--surface2);
  }

  .ranking-segmented-control .btn {
    min-height:44px;
    padding:6px 11px;
    border:0 !important;
    border-radius:5px !important;
    background:transparent !important;
    color:var(--muted) !important;
    font-size:10px;
    box-shadow:none !important;
    transform:none;
  }

  .ranking-segmented-control .btn.is-active {
    background:#24231f !important;
    color:#fff !important;
    box-shadow:none !important;
    transform:none;
  }

  .ranking-segmented-control .mode-toggle.is-active::after {
    display:none;
  }

  .ranking-filter-panel {
    gap:12px;
  }

  .ranking-filter-chips {
    min-width:0;
    display:flex;
    flex:1;
    flex-wrap:wrap;
    gap:6px;
  }

  .ranking-filter-actions {
    display:flex;
    gap:6px;
  }

  .ranking-filter-actions .btn {
    min-height:36px;
    padding:6px 10px;
    border-radius:6px !important;
    font-size:10px;
    box-shadow:none;
  }

  .ranking-results-panel {
    padding:20px;
    border:1px solid var(--border);
    border-radius:8px;
    background:var(--surface);
  }

  .ranking-results-header {
    display:flex;
    align-items:flex-end;
    justify-content:space-between;
    gap:16px;
  }

  .ranking-results-header > div {
    display:flex;
    flex-direction:column;
    gap:4px;
  }

  .ranking-results-header strong {
    color:var(--text);
    font-size:15px;
  }

  .ranking-primary-metric {
    color:var(--muted);
    font:700 11px 'IBM Plex Mono', monospace;
  }

  .ranking-note {
    margin:8px 0 0;
    color:var(--muted);
    font-size:11px;
    line-height:1.45;
  }

  .ranking-podium {
    min-height:144px;
    display:grid;
    grid-template-columns:repeat(3,minmax(0,1fr));
    align-items:end;
    gap:10px;
    margin:20px 0 24px;
  }

  .ranking-podium-1,
  .ranking-podium-2 {
    min-height:0;
    grid-template-columns:repeat(var(--ranking-count, 2),minmax(0,220px));
    justify-content:center;
  }

  .ranking-podium-1 {
    --ranking-count:1;
  }

  .ranking-podium-2 {
    --ranking-count:2;
  }

  .ranking-podium-place {
    min-width:0;
    min-height:118px;
    display:flex;
    align-items:center;
    justify-content:center;
    flex-direction:column;
    gap:3px;
    padding:14px 12px;
    border:1px solid var(--border);
    border-radius:8px;
    background:#f7f7f4;
    color:var(--text);
    cursor:pointer;
  }

  .ranking-podium-place-1 {
    min-height:144px;
    order:2;
    border-color:#d8bc86;
    background:#faf5e9;
    box-shadow:inset 0 3px 0 #b9893f;
  }

  .ranking-podium-place-2 {
    order:1;
  }

  .ranking-podium-place-3 {
    order:3;
  }

  .ranking-podium-rank {
    width:28px;
    height:28px;
    display:grid;
    place-items:center;
    border:1px solid #c7c4bc;
    border-radius:50%;
    color:#5f5c55;
    font:800 12px 'IBM Plex Mono', monospace;
  }

  .ranking-podium-place-1 .ranking-podium-rank {
    border-color:#b9893f;
    background:#b9893f;
    color:#fff;
  }

  .ranking-podium-place strong {
    width:100%;
    overflow:hidden;
    color:var(--text);
    font-size:14px;
    text-align:center;
    text-overflow:ellipsis;
    white-space:nowrap;
  }

  .ranking-podium-value {
    color:#37352f;
    font:400 26px/1 'Bebas Neue', sans-serif;
    letter-spacing:1px;
  }

  .ranking-podium-place-1 .ranking-podium-value {
    color:#9a681e;
    font-size:31px;
  }

  .ranking-podium-place small {
    width:100%;
    overflow:hidden;
    color:var(--muted);
    font-size:10px;
    text-align:center;
    text-overflow:ellipsis;
    white-space:nowrap;
  }

  .ranking-list-heading,
  .ranking-entry {
    display:grid;
    grid-template-columns:54px minmax(180px,1fr) minmax(130px,.55fr) 104px;
    align-items:center;
    gap:14px;
  }

  .ranking-list-heading {
    padding:0 14px 8px;
    color:var(--muted);
    font:700 9px 'IBM Plex Mono', monospace;
    letter-spacing:.8px;
    text-transform:uppercase;
  }

  .ranking-list-heading span:nth-child(3),
  .ranking-list-heading span:nth-child(4) {
    text-align:right;
  }

  .ranking-entries {
    border-top:1px solid var(--border);
  }

  .ranking-entry {
    width:100%;
    min-height:66px;
    padding:10px 14px;
    border:0;
    border-bottom:1px solid var(--border);
    background:transparent;
    color:var(--text);
    text-align:left;
    cursor:pointer;
  }

  .ranking-entry:hover {
    background:#f8f6f1;
  }

  .ranking-position {
    width:32px;
    height:32px;
    display:grid;
    place-items:center;
    border-radius:50%;
    background:var(--surface2);
    color:#5b5953;
    font:800 12px 'IBM Plex Mono', monospace;
  }

  .ranking-entry-1 .ranking-position {
    background:#b9893f;
    color:#fff;
  }

  .ranking-entry-2 .ranking-position,
  .ranking-entry-3 .ranking-position {
    border:1px solid #cbc7bd;
    background:#f3f2ee;
  }

  .ranking-entry-player {
    min-width:0;
    display:flex;
    flex-direction:column;
    gap:5px;
  }

  .ranking-entry-player strong {
    overflow:hidden;
    font-size:13px;
    text-overflow:ellipsis;
    white-space:nowrap;
  }

  .ranking-entry-primary small {
    color:var(--muted);
    font-size:10px;
  }

  .ranking-entry-meta {
    min-width:0;
    display:flex;
    align-items:center;
    flex-wrap:wrap;
    gap:4px 8px;
    color:var(--muted);
    font-size:10px;
  }

  .ranking-entry-meta > span:not(:last-child)::after {
    content:'·';
    margin-left:8px;
    color:#aaa69d;
  }

  .ranking-entry-meta strong {
    color:#4f4c46;
    font:800 10px 'IBM Plex Mono', monospace;
  }

  .ranking-entry-meta .ranking-recent-value.is-up {
    color:#168044;
  }

  .ranking-entry-meta .ranking-recent-value.is-down {
    color:#c43d3d;
  }

  .ranking-entry-meta .ranking-recent-value.is-flat,
  .ranking-entry-meta .ranking-recent-value.is-unavailable {
    color:#77736b;
  }

  .ranking-level-badge {
    display:inline-flex;
    align-items:center;
    min-height:20px;
    padding:2px 7px;
    border:1px solid #d7d2c7;
    border-radius:999px;
    background:#f5f3ee;
    color:#5f5b53;
    font:700 9px 'IBM Plex Mono', monospace;
    white-space:nowrap;
  }

  .ranking-entry-meta > .ranking-level-badge::after {
    display:none;
  }

  .ranking-entry-secondary {
    color:#5d5a54;
    font:700 11px 'IBM Plex Mono', monospace;
    text-align:right;
  }

  .ranking-entry-primary {
    display:flex;
    align-items:flex-end;
    flex-direction:column;
  }

  .ranking-entry-primary strong {
    color:#24231f;
    font:400 22px/1 'Bebas Neue', sans-serif;
    letter-spacing:1px;
  }

  .ranking-entry-1 .ranking-entry-primary strong {
    color:#9a681e;
  }

  .ranking-empty {
    min-height:260px;
    display:flex;
    align-items:center;
    justify-content:center;
    flex-direction:column;
    gap:7px;
    padding:32px;
    text-align:center;
  }

  .ranking-empty > span {
    color:#c49a57;
    font:400 30px 'Bebas Neue', sans-serif;
  }

  .ranking-empty strong {
    color:var(--text);
    font-size:15px;
  }

  .ranking-empty p {
    margin:0;
    color:var(--muted);
    font-size:12px;
  }

  body.dark .ranking-eyebrow,
  body.dark .ranking-control-label,
  body.dark .ranking-podium-place-1 .ranking-podium-value,
  body.dark .ranking-entry-1 .ranking-entry-primary strong {
    color:#e8b15c;
  }

  body.dark .ranking-podium-place,
  body.dark .ranking-entry:hover {
    background:#20252f;
  }

  body.dark .ranking-podium-place-1 {
    border-color:#73582e;
    background:#29251e;
  }

  body.dark .ranking-podium-value,
  body.dark .ranking-entry-primary strong,
  body.dark .ranking-entry-secondary {
    color:#f1eee8;
  }

  body.dark .ranking-position,
  body.dark .ranking-entry-2 .ranking-position,
  body.dark .ranking-entry-3 .ranking-position {
    border-color:#454b55;
    background:#2a303b;
    color:#d6d8dc;
  }

  body.dark .ranking-entry-meta strong {
    color:#e2ded6;
  }

  body.dark .ranking-entry-meta .ranking-recent-value.is-up {
    color:#64c987;
  }

  body.dark .ranking-entry-meta .ranking-recent-value.is-down {
    color:#ff7b7b;
  }

  body.dark .ranking-entry-meta .ranking-recent-value.is-flat,
  body.dark .ranking-entry-meta .ranking-recent-value.is-unavailable {
    color:#aaa69e;
  }

  body.dark .ranking-level-badge {
    border-color:#4a4f58;
    background:#282e38;
    color:#d6d8dc;
  }

  @media (max-width: 900px) {
    input,
    select,
    textarea {
      font-size:16px !important;
    }

    #page-training button[onclick^="showExerciseHelp"] {
      width:44px !important;
      min-width:44px !important;
      height:44px !important;
      flex:0 0 44px !important;
    }
  }

  @media (max-width: 768px) {

    .ranking-header {
      margin-bottom:12px;
      padding-bottom:14px;
    }

    .ranking-header h1 {
      font-size:28px;
    }

    .ranking-toolbar {
      align-items:stretch;
      flex-direction:column;
      gap:6px;
      padding:8px 10px;
    }

    .ranking-control-group {
      align-items:stretch;
      flex-direction:column;
      gap:4px;
    }

    .ranking-toolbar .ranking-control-label {
      display:none;
    }

    .ranking-segmented-control {
      width:100%;
      overflow:visible;
    }

    .ranking-segmented-control .btn {
      min-width:0;
      min-height:44px;
      flex:1;
      padding-right:5px;
      padding-left:5px;
    }

    .ranking-filter-panel {
      align-items:flex-start;
      flex-wrap:wrap;
      gap:8px;
      padding:10px;
    }

    .ranking-filter-panel > .ranking-control-label {
      display:none;
    }

    .ranking-filter-actions {
      margin-left:auto;
    }

    .ranking-results-panel {
      padding:16px 12px;
    }

    .ranking-results-header {
      align-items:flex-start;
      flex-direction:column;
      gap:6px;
    }

    .ranking-podium {
      min-height:104px;
      gap:6px;
      margin:12px 0 14px;
    }

    .ranking-podium-place {
      min-height:90px;
      padding:10px 6px;
    }

    .ranking-podium-place-1 {
      min-height:104px;
    }

    .ranking-podium-rank {
      width:24px;
      height:24px;
      font-size:10px;
    }

    .ranking-podium-place strong {
      font-size:11px;
    }

    .ranking-podium-value {
      font-size:22px;
    }

    .ranking-podium-place-1 .ranking-podium-value {
      font-size:26px;
    }

    .ranking-podium-place small {
      display:none;
    }

    .ranking-list-heading {
      display:none;
    }

    .ranking-entries {
      display:flex;
      flex-direction:column;
      gap:7px;
      border:0;
    }

    .ranking-entry {
      min-height:76px;
      grid-template-columns:40px minmax(0,1fr) auto;
      gap:8px;
      padding:10px;
      border:1px solid var(--border);
      border-radius:7px;
      background:var(--surface);
    }

    .ranking-entry-secondary {
      display:none;
    }

    .ranking-entry-primary strong {
      font-size:21px;
    }

    .ranking-entry-meta {
      gap:3px 6px;
      line-height:1.35;
    }

    .ranking-entry-meta > span:not(:last-child)::after {
      margin-left:6px;
    }

    .ranking-level-badge {
      min-height:18px;
      padding:1px 6px;
      font-size:8px;
    }
  }

  @media (max-width: 420px) {
    .ranking-filter-panel {
      gap:8px;
      padding:10px;
    }

    .ranking-filter-chips {
      width:100%;
      flex-basis:100%;
    }

    .ranking-filter-actions {
      margin-left:0;
    }

    .ranking-results-panel {
      padding:14px 9px;
    }

    .ranking-entry {
      grid-template-columns:36px minmax(0,1fr) 62px;
      padding:9px 7px;
    }

    .ranking-position {
      width:29px;
      height:29px;
    }
  }

  /* Compact synchronization status, derived from the existing sync lifecycle. */
  .sync-status {
    min-height:32px;
    align-self:flex-start;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    gap:7px;
    padding:6px 10px;
    border:1px solid var(--border);
    border-radius:7px;
    background:var(--surface2);
    color:var(--muted);
    font:700 10px/1.2 'IBM Plex Mono', monospace;
    letter-spacing:0;
    cursor:pointer;
  }

  .sync-status:hover {
    border-color:var(--border2);
    color:var(--text);
  }

  .sync-status:focus-visible {
    outline:2px solid var(--accent);
    outline-offset:2px;
  }

  .sync-status-dot {
    width:8px;
    height:8px;
    flex:0 0 8px;
    border-radius:50%;
    background:#7a8494;
  }

  .sync-status.is-synced .sync-status-dot { background:#2f9e64; }
  .sync-status.is-synced { color:#267b50; }
  .sync-status.is-syncing .sync-status-dot,
  .sync-status.is-pending .sync-status-dot { background:#b7791f; }
  .sync-status.is-syncing,
  .sync-status.is-pending { color:#956018; }
  .sync-status.is-offline .sync-status-dot { background:#b14d4d; }

  .match-detail-table-wrap {
    max-width:100%;
    overflow-x:auto;
  }
  .match-details-section {
    border-top:1px solid var(--border);
    margin-top:18px;
    padding-top:14px;
  }
  .match-details-heading {
    margin-bottom:10px;
    color:var(--accent3);
    font-family:'Bebas Neue';
    font-size:16px;
    letter-spacing:2px;
  }
  .match-detail-unavailable {
    border-top:1px solid var(--border);
    margin-top:18px;
    padding-top:10px;
    color:var(--muted);
    font-family:'IBM Plex Mono';
    font-size:11px;
  }
  .match-leg { margin-bottom:10px; }
  .match-leg-toggle {
    display:flex;
    align-items:center;
    justify-content:space-between;
    width:100%;
    margin-bottom:6px;
    padding:8px 10px;
    border:1px solid var(--border);
    border-radius:var(--radius);
    background:var(--surface2);
    color:var(--text);
    cursor:pointer;
    font-family:'IBM Plex Mono';
    font-size:11px;
    font-weight:600;
    text-align:left;
  }
  .match-leg-toggle small {
    margin-left:8px;
    color:var(--muted);
    font-size:10px;
    font-weight:400;
  }
  .match-leg-content { max-width:100%; }
  .match-leg-player-grid {
    display:grid;
    grid-template-columns:repeat(auto-fit,minmax(min(280px,100%),1fr));
    gap:8px;
    padding:4px 0;
  }
  .match-leg-player {
    min-width:0;
    padding:8px;
    border-radius:8px;
  }
  .match-leg-player.is-winner { background:rgba(0,200,83,0.05); }
  .match-leg-player.is-empty { display:none; }
  .match-leg-player-title {
    margin-bottom:5px;
    overflow-wrap:anywhere;
    color:var(--muted);
    font-family:'IBM Plex Mono';
    font-size:10px;
    font-weight:700;
  }
  .match-leg-player.is-winner .match-leg-player-title { color:var(--accent3); }
  .match-turn-row {
    display:grid;
    grid-template-columns:24px minmax(44px,auto) minmax(0,1fr) auto;
    align-items:center;
    gap:5px;
    min-height:28px;
    padding:3px 0;
    border-bottom:.5px solid var(--border);
  }
  .match-turn-index,
  .match-turn-context,
  .match-turn-result,
  .match-turn-empty {
    color:var(--muted);
    font-family:'IBM Plex Mono';
    font-size:9px;
  }
  .match-turn-context { text-align:right; }
  .match-turn-result { text-align:right; }
  .match-turn-darts {
    display:flex;
    flex-wrap:wrap;
    gap:3px;
    min-width:0;
  }
  .match-turn-dart {
    display:inline-flex;
    align-items:center;
    justify-content:center;
    padding:1px 5px;
    border-radius:3px;
    font-family:'IBM Plex Mono';
    font-size:10px;
    font-weight:600;
  }
  @media(max-width:600px) {
    .match-leg-toggle { min-height:44px; }
    .match-leg-toggle small { display:block;margin:3px 0 0; }
    .match-turn-row { grid-template-columns:22px minmax(54px,auto) minmax(0,1fr); }
    .match-turn-result { grid-column:2 / -1;text-align:left;padding-bottom:2px; }
  }
  .sync-status.is-offline { color:#934040; }

  body.dark .sync-status.is-synced { color:#78c99b; }
  body.dark .sync-status.is-syncing,
  body.dark .sync-status.is-pending { color:#e1b45e; }
  body.dark .sync-status.is-offline { color:#df8b8b; }

  .sync-status.is-syncing .sync-status-dot {
    animation:sync-status-pulse 1.2s ease-in-out infinite;
  }

  @keyframes sync-status-pulse {
    50% { opacity:.35; }
  }

  @media (prefers-reduced-motion: reduce) {
    .sync-status.is-syncing .sync-status-dot { animation:none; }
  }

  .sync-status-mobile {
    width:44px;
    height:44px;
    min-height:44px;
    padding:0;
    border-radius:50%;
  }

  .sync-status-mobile .sync-status-dot {
    width:10px;
    height:10px;
    flex-basis:10px;
  }

  .sync-status-mobile .sync-status-label {
    position:absolute;
    width:1px;
    height:1px;
    padding:0;
    margin:-1px;
    overflow:hidden;
    clip:rect(0,0,0,0);
    white-space:nowrap;
    border:0;
  }

  /* Profile and account modal */
  .account-modal {
    width:min(520px, calc(100vw - 24px));
  }

  .account-identity-card {
    display:flex;
    align-items:center;
    gap:14px;
    padding:16px;
    margin-bottom:12px;
    border:1px solid var(--border);
    border-radius:8px;
    background:var(--surface2);
  }

  .account-avatar {
    width:54px;
    height:54px;
    flex:0 0 54px;
    display:grid;
    place-items:center;
    border:2px solid var(--accent);
    border-radius:50%;
    background:var(--gold-soft);
    color:var(--accent);
    font-size:20px;
    font-weight:800;
  }

  .account-avatar.is-local {
    border-color:var(--border2);
    background:var(--surface);
    color:var(--muted);
  }

  .account-identity-copy {
    min-width:0;
    flex:1;
  }

  .account-status-row {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:10px;
  }

  .account-status-row h3 {
    min-width:0;
    overflow-wrap:anywhere;
    color:var(--text);
    font-size:17px;
    line-height:1.25;
  }

  .account-identity-copy p {
    margin-top:4px;
    overflow-wrap:anywhere;
    color:var(--muted);
    font-size:12px;
    line-height:1.45;
  }

  .account-badge {
    flex:0 0 auto;
    padding:4px 7px;
    border:1px solid rgba(47,158,100,.30);
    border-radius:5px;
    background:rgba(47,158,100,.08);
    color:#267b50;
    font:700 9px/1.2 'IBM Plex Mono', monospace;
  }

  .account-badge.is-local {
    border-color:var(--border2);
    background:var(--surface);
    color:var(--muted);
  }

  body.dark .account-badge.is-connected { color:#78c99b; }

  .account-sync-detail {
    min-height:52px;
    display:flex;
    align-items:center;
    gap:10px;
    padding:10px 12px;
    margin-bottom:12px;
    border:1px solid var(--border);
    border-radius:7px;
    background:var(--surface);
    color:var(--text);
  }

  .account-sync-detail > span:last-child {
    min-width:0;
    display:flex;
    flex-direction:column;
    gap:2px;
  }

  .account-sync-detail strong {
    font-size:12px;
  }

  .account-sync-detail small {
    color:var(--muted);
    font-size:11px;
    line-height:1.35;
  }

  .account-sync-dot {
    width:9px;
    height:9px;
    flex:0 0 9px;
    border-radius:50%;
    background:#7a8494;
  }

  .account-sync-dot.is-synced { background:#2f9e64; }
  .account-sync-dot.is-syncing,
  .account-sync-dot.is-pending { background:#b7791f; }
  .account-sync-dot.is-offline { background:#b14d4d; }

  .account-intro {
    margin:0 2px 14px;
    color:var(--muted);
    font-size:12px;
    line-height:1.55;
  }

  .account-tabs {
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:4px;
    padding:4px;
    margin-bottom:18px;
    border:1px solid var(--border);
    border-radius:7px;
    background:var(--surface2);
  }

  .account-tabs button {
    min-height:44px;
    padding:8px 10px;
    border:0;
    border-radius:5px;
    background:transparent;
    color:var(--muted);
    font:700 11px/1.2 'IBM Plex Mono', monospace;
    cursor:pointer;
  }

  .account-tabs button.active {
    background:var(--surface);
    color:var(--text);
    box-shadow:0 2px 8px rgba(0,0,0,.08);
  }

  .account-modal #form-login button,
  .account-modal #form-signup button {
    min-height:44px;
  }

  .account-tabs button:focus-visible,
  .account-secondary-links button:focus-visible,
  .account-logout:focus-visible,
  .account-delete-link:focus-visible,
  .account-advanced summary:focus-visible {
    outline:2px solid var(--accent);
    outline-offset:2px;
  }

  .account-primary-actions,
  .account-secondary-links {
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:8px;
    margin-bottom:10px;
  }

  .account-primary-actions .btn,
  .account-secondary-links button,
  .account-logout {
    min-height:44px;
  }

  .account-secondary-links button {
    border:1px solid var(--border);
    border-radius:7px;
    background:transparent;
    color:var(--text);
    font-size:12px;
    font-weight:700;
    cursor:pointer;
  }

  .account-advanced {
    margin:12px 0;
    border-top:1px solid var(--border);
    border-bottom:1px solid var(--border);
  }

  .account-advanced summary {
    min-height:44px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    color:var(--muted);
    font-size:12px;
    font-weight:700;
    cursor:pointer;
    list-style:none;
  }

  .account-advanced summary::after { content:'+'; font-size:18px; }
  .account-advanced[open] summary::after { content:'−'; }
  .account-advanced-content { padding:0 0 12px; }

  .account-transfer-card {
    padding:10px;
    margin-bottom:10px;
    border:1px solid var(--border);
    border-radius:7px;
    background:var(--surface2);
  }

  .account-tool-grid {
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:8px;
    margin-bottom:8px;
  }

  .account-tool-grid .btn {
    min-height:44px;
    padding:8px;
    font-size:11px;
  }

  .account-tool-grid .btn:last-child { grid-column:1 / -1; }

  .account-delete-link,
  .account-logout {
    width:100%;
    border:1px solid var(--border);
    border-radius:7px;
    background:transparent;
    cursor:pointer;
  }

  .account-delete-link {
    min-height:44px;
    color:var(--accent2);
    font-size:11px;
  }

  .account-logout {
    color:var(--muted);
    font-size:12px;
    font-weight:700;
  }

  .account-logout:hover,
  .account-secondary-links button:hover {
    border-color:var(--border2);
    background:var(--surface2);
    color:var(--text);
  }

  @media (max-width: 430px) {
    .account-modal { padding:16px !important; }
    .account-identity-card { padding:13px; }
    .account-avatar { width:48px; height:48px; flex-basis:48px; }
    .account-primary-actions,
    .account-secondary-links { grid-template-columns:1fr; }
    .account-tool-grid { grid-template-columns:1fr; }
    .account-tool-grid .btn:last-child { grid-column:auto; }
  }

  /* Aide, FAQ et installation */
  .help-page {
    width:min(100%, 920px);
    margin:0 auto;
    padding-bottom:32px;
  }

  .help-heading {
    margin-bottom:18px;
  }

  .help-eyebrow {
    margin:0 0 5px;
    color:var(--accent);
    font:800 10px/1.2 'IBM Plex Mono', monospace;
    text-transform:uppercase;
  }

  .help-heading h1 {
    margin:0 0 5px;
    color:var(--text);
    font-size:28px;
  }

  .help-heading > p:last-child {
    margin:0;
    color:var(--muted);
    font-size:13px;
    line-height:1.55;
  }

  .install-panel {
    scroll-margin-top:80px;
    margin-bottom:16px;
    border:1px solid var(--border2);
    border-left:4px solid var(--accent);
    border-radius:8px;
    background:var(--surface);
  }

  #faq-install-panel {
    min-height:126px;
    display:grid;
    grid-template-columns:minmax(0, 1fr) auto;
    align-items:center;
    gap:20px;
    padding:20px;
  }

  .install-copy h2 {
    margin:7px 0 5px;
    color:var(--text);
    font-size:19px;
  }

  .install-copy p {
    max-width:620px;
    margin:0;
    color:var(--muted);
    font-size:13px;
    line-height:1.55;
  }

  .install-status {
    display:inline-flex;
    min-height:24px;
    align-items:center;
    padding:3px 8px;
    border:1px solid var(--border);
    border-radius:6px;
    color:var(--muted);
    background:var(--surface2);
    font:700 10px/1.2 'IBM Plex Mono', monospace;
  }

  .install-status.is-installed {
    border-color:rgba(0,200,83,.35);
    color:var(--accent3);
  }

  .install-action {
    min-width:174px;
    min-height:44px;
    display:inline-flex;
    align-items:center;
    justify-content:center;
    text-align:center;
    text-decoration:none;
  }

  .faq-search {
    display:block;
    margin-bottom:14px;
  }

  .faq-search > span {
    display:block;
    margin-bottom:6px;
    color:var(--muted);
    font:700 10px/1.2 'IBM Plex Mono', monospace;
    text-transform:uppercase;
  }

  .faq-search input {
    width:100%;
    min-height:46px;
    padding:10px 13px;
    border:1px solid var(--border2);
    border-radius:7px;
    background:var(--surface);
    color:var(--text);
    font-size:16px;
  }

  .faq-sections {
    display:grid;
    gap:9px;
  }

  .faq-category {
    overflow:hidden;
    border:1px solid var(--border);
    border-radius:8px;
    background:var(--surface);
  }

  .faq-category-toggle,
  .faq-question {
    width:100%;
    min-height:48px;
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:14px;
    border:0;
    background:transparent;
    color:var(--text);
    text-align:left;
    cursor:pointer;
  }

  .faq-category-toggle {
    padding:13px 15px;
    font-size:14px;
    font-weight:800;
  }

  .faq-chevron,
  .faq-plus {
    flex:0 0 auto;
    color:var(--muted);
    font-size:18px;
    transition:transform .18s ease;
  }

  .faq-category-toggle[aria-expanded="true"] .faq-chevron {
    transform:rotate(180deg);
  }

  .faq-category-body {
    border-top:1px solid var(--border);
  }

  .faq-item + .faq-item {
    border-top:1px solid var(--border);
  }

  .faq-question {
    padding:11px 15px;
    font-size:13px;
    font-weight:700;
  }

  .faq-question[aria-expanded="true"] .faq-plus {
    transform:rotate(45deg);
  }

  .faq-answer {
    padding:0 42px 14px 15px;
    color:var(--muted);
    font-size:13px;
    line-height:1.65;
  }

  .faq-category-toggle:hover,
  .faq-question:hover {
    background:var(--surface2);
  }

  .faq-category-toggle:focus-visible,
  .faq-question:focus-visible,
  .faq-search input:focus-visible,
  .install-action:focus-visible {
    outline:2px solid var(--accent);
    outline-offset:-2px;
  }

  .faq-empty {
    padding:32px 16px;
    color:var(--muted);
    text-align:center;
    font-size:13px;
  }

  .account-help-links {
    margin-bottom:14px;
  }

  .legal-inline-links {
    display:flex;
    flex-wrap:wrap;
    gap:8px 18px;
    margin-top:18px;
    padding-top:14px;
    border-top:1px solid var(--border);
  }

  .legal-inline-links button,
  .legal-page-tabs button,
  .legal-page-footer button {
    border:0;
    background:transparent;
    color:var(--accent);
    font:700 12px/1.4 'IBM Plex Mono', monospace;
    cursor:pointer;
    text-decoration:underline;
    text-underline-offset:3px;
  }

  .legal-inline-links button {
    min-height:44px;
    padding:0;
  }

  /* Legal and privacy pages */
  .legal-page {
    width:min(100%, 860px);
    margin:0 auto;
    padding-bottom:36px;
    color:var(--text);
  }

  .legal-page-tabs {
    display:inline-grid;
    grid-template-columns:1fr 1fr;
    gap:4px;
    margin-bottom:22px;
    padding:4px;
    border:1px solid var(--border);
    border-radius:8px;
    background:var(--surface2);
  }

  .legal-page-tabs button {
    min-height:44px;
    padding:8px 13px;
    border-radius:5px;
    color:var(--muted);
    text-decoration:none;
  }

  .legal-page-tabs button.active {
    background:var(--surface);
    color:var(--text);
    box-shadow:0 1px 5px rgba(0,0,0,.08);
  }

  .legal-heading {
    margin-bottom:24px;
  }

  .legal-eyebrow {
    margin:0 0 6px;
    color:var(--accent);
    font:800 10px/1.2 'IBM Plex Mono', monospace;
    text-transform:uppercase;
  }

  .legal-heading h1 {
    margin:0 0 7px;
    color:var(--text);
    font-size:30px;
    line-height:1.15;
  }

  .legal-heading > p:not(.legal-eyebrow) {
    max-width:680px;
    margin:0 0 9px;
    color:var(--muted);
    font-size:14px;
    line-height:1.55;
  }

  .legal-heading > span {
    color:var(--muted);
    font:600 10px/1.4 'IBM Plex Mono', monospace;
  }

  .legal-section {
    padding:20px 0;
    border-top:1px solid var(--border);
  }

  .legal-section h2 {
    margin:0 0 11px;
    color:var(--text);
    font-size:18px;
    line-height:1.3;
  }

  .legal-section h3 {
    margin:16px 0 5px;
    color:var(--text);
    font-size:14px;
    line-height:1.4;
  }

  .legal-section p,
  .legal-section li,
  .legal-details dt,
  .legal-details dd {
    font-size:13px;
    line-height:1.7;
  }

  .legal-section p {
    margin:0 0 10px;
    color:var(--muted);
  }

  .legal-section p:last-child { margin-bottom:0; }

  .legal-section ul {
    margin:8px 0 0;
    padding-left:20px;
    color:var(--muted);
  }

  .legal-section li + li { margin-top:6px; }

  .legal-section a {
    color:var(--accent);
    overflow-wrap:anywhere;
    text-underline-offset:3px;
  }

  .legal-details {
    margin:0;
  }

  .legal-details > div {
    display:grid;
    grid-template-columns:minmax(145px, .42fr) minmax(0, 1fr);
    gap:14px;
    padding:9px 0;
    border-bottom:1px solid var(--border);
  }

  .legal-details > div:last-child { border-bottom:0; }
  .legal-details dt { color:var(--muted); font-weight:700; }
  .legal-details dd { margin:0; color:var(--text); overflow-wrap:anywhere; }

  .legal-publisher-note {
    margin-top:12px !important;
    padding:12px 14px;
    border-left:3px solid var(--border2);
    background:var(--surface2);
  }

  .legal-purpose-grid {
    display:grid;
    grid-template-columns:1fr 1fr;
    gap:14px;
    margin-bottom:10px;
  }

  .legal-purpose-grid > div {
    padding:14px;
    border:1px solid var(--border);
    border-radius:7px;
    background:var(--surface2);
  }

  .legal-purpose-grid h3 { margin:0 0 6px; }

  .legal-page-footer {
    display:flex;
    align-items:center;
    justify-content:space-between;
    gap:18px;
    padding-top:20px;
    border-top:1px solid var(--border);
    color:var(--muted);
    font:600 10px/1.5 'IBM Plex Mono', monospace;
  }

  .legal-page-footer button {
    min-height:44px;
    padding:0;
    text-align:left;
  }

  .legal-inline-links button:focus-visible,
  .legal-page-tabs button:focus-visible,
  .legal-page-footer button:focus-visible,
  .legal-section a:focus-visible {
    outline:2px solid var(--accent);
    outline-offset:3px;
  }

  @media (max-width: 600px) {
    .help-heading h1 { font-size:24px; }
    #faq-install-panel {
      min-height:0;
      grid-template-columns:1fr;
      gap:14px;
      padding:16px;
    }
    .install-action { width:100%; min-width:0; }
    .faq-answer { padding-right:15px; }
    .legal-page-tabs { width:100%; }
    .legal-heading h1 { font-size:25px; }
    .legal-details > div { grid-template-columns:1fr; gap:2px; }
    .legal-purpose-grid { grid-template-columns:1fr; }
    .legal-page-footer { align-items:flex-start; flex-direction:column; gap:5px; }
  }
