    :root {
      --bg:         #0f1113;
      --surface:    #16181c;
      --surface2:   #1e2126;
      --border:     #2a2e35;
      --accent:     #06BBD9;
      --accent-glow:rgba(6, 187, 217, 0.12);
      --accent-dim: rgba(6, 187, 217, 0.20);
      --red:        #FF4C4C;
      --red-dim:    rgba(255, 76, 76, 0.15);
      --green:      #00e676;
      --green-dim:  rgba(0, 230, 118, 0.12);
      --text:       #dde1e8;
      --text-dim:   #6b7280;
      --text-mid:   #9ca3af;
      --radius:     10px;
      --font:       'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
    }

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

    html { scroll-behavior: smooth; }

    body {
      background-color: #0a0b0d;
      background-image: url('/images/carbon-fiber.png');
      background-repeat: repeat;
      color: var(--text);
      font-family: var(--font);
      font-size: 15px;
      min-height: 100vh;
      -webkit-font-smoothing: antialiased;
    }

    /* ── Header ─────────────────────────────────────────── */
    header {
      background: var(--surface);
      border-bottom: 1px solid var(--border);
      padding: 1rem 1.75rem;
      display: flex;
      align-items: center;
      justify-content: space-between;
      flex-wrap: wrap;
      gap: 0.75rem;
      position: sticky;
      top: 0;
      z-index: 10;
    }

    .header-left { display: flex; align-items: center; gap: 1rem; }

    .logo {
      width: 36px; height: 36px;
      border-radius: 8px;
      object-fit: contain;
      display: block;
    }

    .server-title {
      font-size: 1.1rem;
      font-weight: 700;
      letter-spacing: 0.3px;
      line-height: 1.2;
    }

    .server-address {
      color: var(--text-dim);
      font-size: 0.78rem;
      font-family: 'Consolas', 'SF Mono', monospace;
      margin-top: 1px;
    }

    .header-right { display: flex; align-items: center; gap: 0.75rem; }

    .status-badge {
      display: inline-flex;
      align-items: center;
      gap: 0.45rem;
      padding: 0.3rem 0.8rem;
      border-radius: 999px;
      font-size: 0.8rem;
      font-weight: 600;
    }

    .status-badge.online  { background: var(--green-dim);  color: var(--green); }
    .status-badge.offline { background: var(--red-dim);    color: var(--red);   }
    .status-badge.unknown { background: var(--surface2);   color: var(--text-dim); }

    .status-dot {
      width: 7px; height: 7px;
      border-radius: 50%;
      flex-shrink: 0;
    }

    .status-badge.online  .status-dot { background: var(--green); animation: pulse 2s ease-in-out infinite; }
    .status-badge.offline .status-dot { background: var(--red); }
    .status-badge.unknown .status-dot { background: var(--text-dim); }

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

    /* ── Admin header button ─────────────────────────────── */
    .steam-header-login {
      display: inline-flex;
      align-items: center;
      text-decoration: none;
      opacity: 0.85;
      transition: opacity 0.15s;
      line-height: 0; /* prevents extra vertical space */
    }
    .steam-header-login:hover { opacity: 1; filter: brightness(1.15); }
    .steam-header-login img  { display: block; height: 28px; width: auto; }

    /* ── User profile zone (shown when logged in) ── */
    .user-profile-zone {
      display: flex;
      align-items: center;
      gap: 0.55rem;
    }
    .user-avatar {
      width: 42px;
      height: 42px;
      border-radius: 5px;
      object-fit: cover;
      border: 2px solid var(--border);
      flex-shrink: 0;
    }
    /* name + rank badge column */
    .user-info {
      display: flex;
      flex-direction: column;
      justify-content: center;
      gap: 0.2rem;
      min-width: 0;
    }
    .user-name {
      font-size: 0.82rem;
      font-weight: 700;
      color: var(--text);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      max-width: 130px;
      line-height: 1;
    }
    .user-rank-badge {
      display: inline-block;
      font-size: 0.67rem;
      font-weight: 800;
      padding: 0.1rem 0.35rem;
      border-radius: 4px;
      white-space: nowrap;
      line-height: 1.3;
      align-self: flex-start;
    }
    /* leaderboard rank + points column */
    .user-metrics {
      display: flex;
      flex-direction: column;
      justify-content: center;
      align-items: flex-end;
      gap: 0.2rem;
      min-width: 0;
    }
    .user-rank-num {
      font-size: 0.78rem;
      font-weight: 700;
      color: var(--text);
      white-space: nowrap;
      line-height: 1;
    }
    .user-points {
      font-size: 0.67rem;
      color: var(--text-dim);
      white-space: nowrap;
      line-height: 1;
    }
    .user-divider {
      width: 1px;
      height: 28px;
      background: var(--border);
      flex-shrink: 0;
    }
    .user-action-btn {
      display: inline-flex;
      align-items: center;
      gap: 0.3rem;
      padding: 0.25rem 0.6rem;
      border-radius: 6px;
      font-size: 0.72rem;
      font-weight: 600;
      cursor: pointer;
      text-decoration: none;
      border: 1px solid transparent;
      transition: all 0.15s;
      white-space: nowrap;
      font-family: var(--font);
      background: none;
      color: var(--text-dim);
    }
    .user-action-btn.admin {
      border-color: var(--accent-dim);
      color: var(--accent);
      background: var(--accent-glow);
    }
    .user-action-btn.admin:hover { background: var(--accent-dim); }
    .user-action-btn.logout:hover { color: var(--text); border-color: var(--border); }

    .admin-header-btn {
      display: inline-flex;
      align-items: center;
      gap: 0.4rem;
      padding: 0.3rem 0.8rem;
      border-radius: 7px;
      font-size: 0.78rem;
      font-weight: 600;
      cursor: pointer;
      text-decoration: none;
      transition: all 0.15s;
      font-family: var(--font);
      border: none;
    }

    .admin-header-btn.login {
      background: transparent;
      border: 1px solid var(--border);
      color: var(--text-dim);
    }
    .admin-header-btn.login:hover { border-color: var(--accent); color: var(--accent); }

    .admin-header-btn.panel {
      background: var(--accent-glow);
      border: 1px solid var(--accent-dim);
      color: var(--accent);
    }
    .admin-header-btn.panel:hover { background: var(--accent-dim); }

    /* ── Layout ─────────────────────────────────────────── */
    main {
      max-width: 1280px;
      margin: 0 auto;
      padding: 1.5rem 1.5rem 4rem;
    }

    /* ── Stats cards ────────────────────────────────────── */
    .stats-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
      gap: 0.9rem;
      margin-bottom: 1.25rem;
    }

    .stat-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 1.1rem 1.3rem;
      transition: border-color 0.2s;
      position: relative;
      overflow: hidden;
    }

    .stat-card:hover { border-color: var(--accent); }

    /* Map card background image */
    .stat-card.has-map-img {
      background-size: cover;
      background-position: center;
      border-color: rgba(6, 187, 217, 0.35);
    }

    .stat-card.has-map-img::before {
      content: '';
      position: absolute;
      inset: 0;
      background: linear-gradient(160deg, rgba(15,17,19,0.72) 0%, rgba(15,17,19,0.88) 100%);
      border-radius: var(--radius);
      pointer-events: none;
    }

    .stat-card .stat-label,
    .stat-card .stat-value,
    .stat-card .stat-sub {
      position: relative;
      z-index: 1;
    }

    .stat-label {
      font-size: 0.7rem;
      color: var(--text-dim);
      text-transform: uppercase;
      letter-spacing: 0.9px;
      font-weight: 600;
      margin-bottom: 0.45rem;
    }

    .stat-value {
      font-size: 2rem;
      font-weight: 700;
      color: var(--accent);
      line-height: 1;
    }

    .stat-value.text {
      font-size: 0.95rem;
      font-weight: 600;
      color: var(--text);
      word-break: break-word;
      line-height: 1.3;
    }

    .stat-sub {
      font-size: 0.75rem;
      color: var(--text-dim);
      margin-top: 0.3rem;
    }

    /* ── Map detail card ────────────────────────────────── */
    .map-detail-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      margin-bottom: 1.25rem;
      overflow: hidden;
    }

    .map-detail-header {
      display: flex;
      align-items: stretch;
      gap: 0;
      flex-direction: column;
    }

    .map-detail-banner {
      flex: 0 0 auto;
      width: 100%;
      min-height: 160px;
      background-size: cover;
      background-position: center;
      background-color: var(--surface2);
      position: relative;
    }

    .map-detail-banner::after {
      content: '';
      position: absolute;
      inset: 0;
      background: linear-gradient(
        to bottom,
        transparent  0%,
        transparent  35%,
        #111215cc    70%,
        #111215      100%
      );
      pointer-events: none;
      z-index: 1;
    }

    .map-detail-info {
      position: absolute;
      bottom: 0;
      left: 0;
      right: 0;
      padding: 1rem 1.2rem;
      z-index: 2;
      display: flex;
      flex-direction: column;
      gap: 0.45rem;
    }

    .map-detail-name {
      font-size: 1.4rem;
      font-weight: 800;
      color: #fff;
      text-shadow: 0 1px 6px rgba(0,0,0,0.8), 0 0 2px rgba(0,0,0,0.6);
      line-height: 1.2;
    }

    .map-detail-meta {
      display: flex;
      flex-wrap: wrap;
      gap: 0.4rem;
    }

    .map-detail-stats-row {
      display: flex;
      flex-wrap: wrap;
      gap: 0.6rem;
      font-size: 0.75rem;
      color: rgba(255,255,255,0.55);
      text-shadow: 0 1px 3px rgba(0,0,0,0.7);
    }

    .map-detail-stats-row span span {
      color: rgba(255,255,255,0.85);
      font-weight: 700;
    }

    .map-meta-item { font-size: 0.8rem; color: var(--text-dim); }
    .map-meta-item strong { color: var(--accent); font-size: 0.9rem; }

    .map-detail-body {
      padding: 0 1.4rem 1.2rem;
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
      gap: 1.2rem;
    }

    .map-detail-section-title {
      font-size: 0.7rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.9px;
      color: var(--text-dim);
      margin-bottom: 0.55rem;
      padding-bottom: 0.4rem;
      border-bottom: 1px solid var(--border);
    }

    .times-list { list-style: none; }

    .times-list li {
      display: grid;
      grid-template-columns: 20px 1fr 72px 82px;
      align-items: center;
      gap: 0.4rem;
      padding: 0.3rem 0;
      border-bottom: 1px solid var(--border);
      font-size: 0.82rem;
    }

    .times-list li:last-child { border-bottom: none; }

    .times-list .t-rank {
      text-align: center;
      font-size: 0.7rem;
      color: var(--text-dim);
    }

    .times-list .t-name {
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .times-list .t-time {
      color: var(--accent);
      font-weight: 600;
      font-size: 0.8rem;
      font-variant-numeric: tabular-nums;
      text-align: right;
      white-space: nowrap;
    }

    .times-list .t-wr {
      font-size: 0.68rem;
      font-weight: 700;
      color: #f5c842;
      background: rgba(245,200,66,0.12);
      border: 1px solid rgba(245,200,66,0.35);
      border-radius: 4px;
      padding: 0.05rem 0.35rem;
      white-space: nowrap;
      text-align: right;
      justify-self: end;
    }

    .times-list .t-diff {
      color: var(--text-dim);
      font-size: 0.75rem;
      font-variant-numeric: tabular-nums;
      white-space: nowrap;
      text-align: right;
    }

    @media (max-width: 600px) {
      .map-detail-banner { min-height: 80px; }
    }

    /* ── Chart card ─────────────────────────────────────── */
    .chart-card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 1.3rem 1.5rem;
      margin-bottom: 1.25rem;
    }

    .card-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      flex-wrap: wrap;
      gap: 0.75rem;
      margin-bottom: 1.1rem;
    }

    .card-title {
      font-size: 0.85rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.8px;
      color: var(--text-mid);
    }

    .range-tabs { display: flex; gap: 0.35rem; }

    .range-btn {
      background: transparent;
      border: 1px solid var(--border);
      color: var(--text-dim);
      padding: 0.28rem 0.7rem;
      border-radius: 6px;
      cursor: pointer;
      font-size: 0.78rem;
      font-weight: 600;
      font-family: inherit;
      transition: all 0.15s;
    }

    .range-btn:hover { border-color: var(--accent); color: var(--accent); }
    .range-btn.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

    .chart-wrap { position: relative; height: 210px; }

    /* ── Bottom grid ────────────────────────────────────── */
    .bottom-grid {
      display: grid;
      grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
      gap: 1rem;
    }

    @media (max-width: 680px) {
      .bottom-grid { grid-template-columns: 1fr; }
    }

    .card {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: var(--radius);
      padding: 1.2rem 1.4rem;
    }

    /* ── Player list ────────────────────────────────────── */
    .player-list { list-style: none; }

    .player-list li {
      display: flex;
      align-items: center;
      gap: 0.6rem;
      padding: 0.45rem 0;
      border-bottom: 1px solid var(--border);
      font-size: 0.88rem;
    }

    .player-list li:last-child { border-bottom: none; }

    .player-dot {
      width: 6px; height: 6px;
      border-radius: 50%;
      background: var(--green);
      flex-shrink: 0;
    }

    .empty-msg {
      color: var(--text-dim);
      font-size: 0.83rem;
      font-style: italic;
      padding: 0.6rem 0;
    }

    /* ── Map stats ──────────────────────────────────────── */
    .map-table {
      width: 100%;
      border-collapse: collapse;
      font-size: 0.83rem;
    }

    .map-table th {
      text-align: left;
      color: var(--text-dim);
      font-weight: 600;
      font-size: 0.72rem;
      text-transform: uppercase;
      letter-spacing: 0.7px;
      padding: 0 0 0.6rem 0;
      border-bottom: 1px solid var(--border);
    }

    .map-table th:nth-child(2),
    .map-table th:last-child { text-align: right; }

    .map-table td {
      padding: 0.45rem 0;
      border-bottom: 1px solid var(--border);
      vertical-align: top;
    }

    .map-table tr:last-child td { border-bottom: none; }

    .map-name-cell { max-width: 220px; }

    .map-name-text {
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      max-width: 100%;
      display: block;
    }

    .map-bar-wrap { margin-top: 3px; }

    .map-bar {
      height: 3px;
      background: var(--accent);
      border-radius: 2px;
      transition: width 0.5s ease;
      min-width: 2px;
    }

    .map-time-cell {
      text-align: right;
      color: var(--text-dim);
      white-space: nowrap;
      padding-left: 0.75rem;
    }

    /* ── Surf stats grid ────────────────────────────────── */
    .surf-grid {
      display: grid;
      grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
      gap: 1rem;
      margin-bottom: 1.25rem;
    }

    .rank-badge {
      display: inline-flex;
      align-items: center;
      justify-content: center;
      width: 22px; height: 22px;
      border-radius: 5px;
      font-size: 0.72rem;
      font-weight: 700;
      flex-shrink: 0;
      background: var(--surface2);
      color: var(--text-dim);
    }

    .rank-badge.gold   { background: rgba(255,200,50,0.18); color: #ffc832; }
    .rank-badge.silver { background: rgba(180,180,195,0.15); color: #b4b4c3; }
    .rank-badge.bronze { background: rgba(180,110,60,0.18); color: #b46e3c; }

    .surf-table {
      width: 100%;
      border-collapse: collapse;
      font-size: 0.83rem;
    }

    .surf-table th {
      text-align: left;
      color: var(--text-dim);
      font-weight: 600;
      font-size: 0.72rem;
      text-transform: uppercase;
      letter-spacing: 0.7px;
      padding: 0 0 0.6rem 0;
      border-bottom: 1px solid var(--border);
    }

    .surf-table th.r { text-align: right; }

    .surf-table td {
      padding: 0.45rem 0;
      border-bottom: 1px solid var(--border);
      vertical-align: middle;
    }

    .surf-table tr:last-child td { border-bottom: none; }

    .surf-table td.r {
      text-align: right;
      color: var(--text-dim);
      white-space: nowrap;
      padding-left: 0.5rem;
    }

    .surf-table td.accent { color: var(--accent); font-weight: 600; }

    .player-name-cell {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      min-width: 0;
    }

    .player-name-text {
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .section-label {
      font-size: 0.7rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 1px;
      color: var(--text-dim);
      margin: 1.5rem 0 0.75rem;
    }

    /* ── Footer ─────────────────────────────────────────── */
    .footer {
      margin-top: 1.25rem;
      display: flex;
      align-items: center;
      justify-content: space-between;
      flex-wrap: wrap;
      gap: 0.5rem;
    }

    .footer-text {
      font-size: 0.72rem;
      color: var(--text-dim);
    }

    .refresh-indicator {
      font-size: 0.72rem;
      color: var(--text-dim);
      display: flex;
      align-items: center;
      gap: 0.4rem;
    }

    .refresh-dot {
      width: 6px; height: 6px;
      border-radius: 50%;
      background: var(--text-dim);
    }

    .refresh-dot.refreshing { background: var(--accent); animation: pulse-fast 0.8s ease-in-out infinite; }

    /* ── Player Profile Modal ───────────────────────────── */
    .modal-overlay {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.5);
      backdrop-filter: blur(2px);
      z-index: 100;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 1rem;
    }

    .modal-box {
      background: var(--surface);
      border: 1px solid var(--border);
      border-radius: 14px;
      width: 100%;
      max-width: 520px;
      height: 640px;
      max-height: 90vh;
      display: flex;
      flex-direction: column;
      overflow: hidden;
      position: relative;
      box-shadow: 0 24px 64px rgba(0, 0, 0, 0.5);
    }

    .modal-close {
      position: absolute;
      top: 0.75rem;
      right: 0.85rem;
      background: transparent;
      border: none;
      color: var(--text-dim);
      font-size: 1.4rem;
      line-height: 1;
      cursor: pointer;
      padding: 0.2rem 0.4rem;
      border-radius: 5px;
      transition: color 0.15s, background 0.15s;
      z-index: 1;
    }

    .modal-close:hover { color: var(--text); background: var(--surface2); }

    .modal-header {
      display: flex;
      align-items: center;
      gap: 1rem;
      padding: 1.4rem 1.4rem 1rem;
    }

    .modal-avatar {
      width: 72px;
      height: 72px;
      border-radius: 10px;
      object-fit: cover;
      border: 2px solid var(--border);
      flex-shrink: 0;
      background: var(--surface2);
    }

    .modal-avatar-placeholder {
      width: 72px;
      height: 72px;
      border-radius: 10px;
      border: 2px solid var(--border);
      flex-shrink: 0;
      background: var(--surface2);
      display: flex;
      align-items: center;
      justify-content: center;
      font-size: 1.8rem;
    }

    .modal-identity { min-width: 0; }

    .modal-name {
      font-size: 1.15rem;
      font-weight: 700;
      color: var(--text);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .modal-steam-link {
      display: inline-flex;
      align-items: center;
      gap: 0.35rem;
      margin-top: 0.35rem;
      color: var(--text-dim);
      font-size: 0.78rem;
      text-decoration: none;
      transition: color 0.15s;
    }

    .modal-steam-link:hover { color: var(--accent); }

    .modal-steam-link svg { flex-shrink: 0; }

    .modal-stats {
      display: grid;
      grid-template-columns: repeat(5, 1fr);
      gap: 0.5rem;
      padding: 0 1.4rem 1.1rem;
    }

    .modal-stat {
      background: var(--surface2);
      border-radius: 8px;
      padding: 0.7rem 0.5rem;
      text-align: center;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      min-height: 72px;
    }

    .modal-stat-value {
      font-size: 1.2rem;
      font-weight: 700;
      color: var(--accent);
      line-height: 1;
    }

    .modal-stat-label {
      font-size: 0.65rem;
      color: var(--text-dim);
      text-transform: uppercase;
      letter-spacing: 0.7px;
      margin-top: auto;
      padding-top: 0.4rem;
    }

    .modal-records-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      padding: 0 1.4rem 0.5rem;
      border-top: 1px solid var(--border);
      padding-top: 0.9rem;
    }

    .modal-records-title {
      font-size: 0.72rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.9px;
      color: var(--text-dim);
    }

    .modal-records-tabs {
      display: flex;
      gap: 0.3rem;
    }

    .modal-tab-btn {
      background: transparent;
      border: 1px solid var(--border);
      color: var(--text-dim);
      padding: 0.2rem 0.55rem;
      border-radius: 5px;
      cursor: pointer;
      font-size: 0.73rem;
      font-weight: 600;
      font-family: inherit;
      transition: all 0.15s;
    }

    .modal-tab-btn:hover { border-color: var(--accent); color: var(--accent); }
    .modal-tab-btn.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

    .modal-records-scroll {
      overflow-y: auto;
      flex: 1;
      padding: 0 1.4rem 1.2rem;
    }

    .modal-records-scroll::-webkit-scrollbar { width: 5px; }
    .modal-records-scroll::-webkit-scrollbar-track { background: transparent; }
    .modal-records-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

    .modal-record-row {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      padding: 0.32rem 0;
      border-bottom: 1px solid var(--border);
      font-size: 0.82rem;
    }

    .modal-rec-badges {
      display: inline-flex;
      gap: 0.2rem;
      flex-shrink: 0;
    }

    .modal-rec-tier {
      display: inline-block;
      font-size: 0.62rem;
      font-weight: 700;
      padding: 0.1rem 0.28rem;
      border-radius: 4px;
      background: rgba(6,187,217,0.15);
      color: var(--accent);
      border: 1px solid rgba(6,187,217,0.25);
      line-height: 1.4;
      letter-spacing: 0.02em;
    }

    .modal-rec-type {
      display: inline-block;
      font-size: 0.62rem;
      font-weight: 700;
      padding: 0.1rem 0.28rem;
      border-radius: 4px;
      background: rgba(255,255,255,0.05);
      color: var(--text-dim);
      border: 1px solid rgba(255,255,255,0.1);
      line-height: 1.4;
    }

    .modal-record-incomplete {
      color: var(--text-dim) !important;
      font-weight: 400 !important;
      font-style: italic;
      font-size: 0.75rem;
    }

    .modal-record-row:last-child { border-bottom: none; }

    .modal-record-map {
      flex: 1;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
      color: var(--text);
    }

    .modal-record-time {
      color: var(--accent);
      font-weight: 600;
      white-space: nowrap;
    }

    .modal-record-diff {
      color: var(--text-dim);
      font-size: 0.75rem;
      white-space: nowrap;
      min-width: 52px;
      text-align: right;
    }

    .modal-record-wr {
      font-size: 0.68rem;
      font-weight: 700;
      color: #ffc832;
      background: rgba(255,200,50,0.12);
      border-radius: 4px;
      padding: 0.1rem 0.35rem;
      white-space: nowrap;
    }

    .modal-loading {
      text-align: center;
      color: var(--text-dim);
      font-size: 0.85rem;
      padding: 2rem 0;
    }

    .modal-empty {
      color: var(--text-dim);
      font-size: 0.83rem;
      font-style: italic;
      padding: 1rem 0;
    }

    @keyframes modal-in {
      from { opacity: 0; transform: scale(0.95) translateY(8px); }
      to   { opacity: 1; transform: scale(1) translateY(0); }
    }

    .modal-box { animation: modal-in 0.18s ease; }

    @media (max-width: 480px) {
      .modal-stats { grid-template-columns: repeat(2, 1fr); }
    }

    /* ── Map Modal ──────────────────────────────────────── */
    .map-modal-banner {
      width: 100%;
      height: 160px;
      background-size: cover;
      background-position: center;
      background-color: var(--surface2);
      flex-shrink: 0;
      position: relative;
    }

    .map-modal-banner::after {
      content: '';
      position: absolute;
      inset: 0;
      background: linear-gradient(to bottom, transparent 35%, #111215cc 70%, #111215 100%);
      pointer-events: none;
    }

    .map-modal-header {
      padding: 0.75rem 1.4rem 0.8rem;
      display: flex;
      align-items: flex-start;
      justify-content: space-between;
      gap: 0.75rem;
    }

    .map-modal-title {
      font-size: 1.15rem;
      font-weight: 700;
      color: var(--text);
      line-height: 1.2;
    }

    .map-modal-meta {
      display: flex;
      align-items: center;
      gap: 0.4rem;
      margin-top: 0.3rem;
      flex-wrap: wrap;
    }

    .map-meta-badge {
      display: inline-flex;
      align-items: center;
      padding: 0.15rem 0.5rem;
      border-radius: 4px;
      font-size: 0.7rem;
      font-weight: 700;
      letter-spacing: 0.5px;
      background: var(--surface2);
      color: var(--text-dim);
      border: 1px solid var(--border);
    }

    .map-meta-badge.tier { color: var(--accent); border-color: var(--accent-dim); background: var(--accent-glow); }

    /* Larger badges when rendered over the banner image */
    .map-detail-info .map-meta-badge {
      font-size: 0.78rem;
      padding: 0.2rem 0.6rem;
      background: rgba(10,12,14,0.65);
      border-color: rgba(255,255,255,0.15);
      color: #e0e0e0;
      backdrop-filter: blur(4px);
    }
    .map-detail-info .map-meta-badge.tier {
      color: var(--accent);
      border-color: var(--accent-dim);
      background: rgba(10,12,14,0.65);
    }

    .map-modal-workshop-link {
      display: inline-flex;
      align-items: center;
      gap: 0.3rem;
      color: var(--text-dim);
      font-size: 0.78rem;
      text-decoration: none;
      white-space: nowrap;
      flex-shrink: 0;
      margin-top: 0.15rem;
      transition: color 0.15s;
    }

    .map-modal-workshop-link:hover { color: var(--accent); }

    .map-modal-stats {
      display: grid;
      grid-template-columns: repeat(3, 1fr);
      gap: 0.5rem;
      padding: 0 1.4rem 1rem;
    }

    .map-modal-records-header {
      display: flex;
      align-items: center;
      padding: 0 1.4rem 0.5rem;
      border-top: 1px solid var(--border);
      padding-top: 0.9rem;
    }

    .map-modal-records-title {
      font-size: 0.72rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.9px;
      color: var(--text-dim);
    }

    .map-modal-records-scroll {
      overflow-y: auto;
      flex: 1;
      padding: 0 1.4rem 1.2rem;
    }

    .map-modal-records-scroll::-webkit-scrollbar { width: 5px; }
    .map-modal-records-scroll::-webkit-scrollbar-track { background: transparent; }
    .map-modal-records-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

    .map-record-row {
      display: flex;
      align-items: center;
      gap: 0.5rem;
      padding: 0.32rem 0;
      border-bottom: 1px solid var(--border);
      font-size: 0.82rem;
    }

    .map-record-row:last-child { border-bottom: none; }

    .map-record-rank {
      width: 22px;
      text-align: center;
      font-size: 0.7rem;
      color: var(--text-dim);
      flex-shrink: 0;
    }

    .map-record-name {
      flex: 1;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

    .map-record-time {
      color: var(--accent);
      font-weight: 600;
      white-space: nowrap;
    }

    .map-record-diff {
      color: var(--text-dim);
      font-size: 0.75rem;
      white-space: nowrap;
      min-width: 52px;
      text-align: right;
    }

    .map-record-wr {
      font-size: 0.68rem;
      font-weight: 700;
      color: #ffc832;
      background: rgba(255,200,50,0.12);
      border-radius: 4px;
      padding: 0.1rem 0.35rem;
      white-space: nowrap;
    }

    .map-link {
      cursor: pointer;
    }

    .map-link:hover { color: var(--accent); }

    /* ── Floating Action Button ─────────────────────────── */
    .fab-container {
      position: fixed;
      bottom: 1.5rem;
      right: 1.5rem;
      z-index: 90;
      display: flex;
      flex-direction: column;
      align-items: flex-end;
      gap: 0.5rem;
    }
    .fab-menu {
      display: flex;
      flex-direction: column;
      align-items: flex-end;
      gap: 0.4rem;
      transition: opacity 0.15s, transform 0.15s;
    }
    .fab-menu.hidden {
      opacity: 0;
      pointer-events: none;
      transform: translateY(8px);
    }
    .fab-menu-item {
      background: rgba(22, 24, 28, 0.94);
      backdrop-filter: blur(10px);
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 0.5rem 1rem;
      color: var(--text);
      font-size: 0.85rem;
      font-weight: 500;
      cursor: pointer;
      white-space: nowrap;
      transition: background 0.12s, border-color 0.12s, color 0.12s;
    }
    .fab-menu-item:hover {
      background: var(--surface2);
      border-color: var(--accent-dim);
      color: var(--accent);
    }
    .fab-btn {
      width: 46px;
      height: 46px;
      border-radius: 50%;
      background: var(--accent);
      border: none;
      color: #0f1113;
      font-size: 1.5rem;
      line-height: 1;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      box-shadow: 0 4px 16px rgba(6, 187, 217, 0.35);
      transition: background 0.15s, transform 0.2s, box-shadow 0.15s;
    }
    .fab-btn:hover { background: #08d4f5; box-shadow: 0 6px 20px rgba(6, 187, 217, 0.5); }
    .fab-btn.open { transform: rotate(45deg); }

    /* ── Wide modal variant ─────────────────────────────── */
    .modal-box.modal-wide {
      max-width: 800px;
      height: 720px;
    }

    /* ── Filter chips ───────────────────────────────────── */
    .modal-filters {
      padding: 0.5rem 1.1rem;
      display: flex;
      flex-direction: column;
      gap: 0.35rem;
      border-bottom: 1px solid var(--border);
    }
    .filter-row {
      display: flex;
      align-items: center;
      gap: 0.3rem;
      flex-wrap: wrap;
    }
    .filter-label {
      font-size: 0.67rem;
      color: var(--text-dim);
      font-weight: 700;
      letter-spacing: 0.5px;
      text-transform: uppercase;
      min-width: 40px;
      flex-shrink: 0;
    }
    .filter-label + .filter-label, .filter-sep { margin-left: 0.35rem; }
    .filter-chip {
      padding: 0.18rem 0.55rem;
      border-radius: 20px;
      border: 1px solid var(--border);
      background: var(--surface2);
      color: var(--text-dim);
      font-size: 0.74rem;
      font-weight: 600;
      cursor: pointer;
      transition: all 0.12s;
      user-select: none;
    }
    .filter-chip:hover { border-color: var(--accent-dim); color: var(--accent); }
    .filter-chip.active {
      background: var(--accent-glow);
      border-color: var(--accent-dim);
      color: var(--accent);
    }

    /* ── Modal search bar ───────────────────────────────── */
    .modal-search-bar {
      padding: 0.7rem 1.1rem;
      border-bottom: 1px solid var(--border);
    }
    .modal-search-input {
      width: 100%;
      background: var(--surface2);
      border: 1px solid var(--border);
      border-radius: 8px;
      padding: 0.5rem 0.85rem;
      color: var(--text);
      font-size: 0.875rem;
      outline: none;
      transition: border-color 0.15s;
      font-family: var(--font);
    }
    .modal-search-input:focus { border-color: var(--accent-dim); }
    .modal-search-input::placeholder { color: var(--text-dim); }

    /* ── Map list table ─────────────────────────────────── */
    .map-list-header {
      display: grid;
      grid-template-columns: 1fr 44px 76px 52px 60px 72px;
      padding: 0.35rem 1.1rem;
      gap: 0.5rem;
      border-bottom: 1px solid var(--border);
      font-size: 0.68rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.5px;
      color: var(--text-dim);
    }
    .map-list-header [data-sort] {
      cursor: pointer;
      user-select: none;
      transition: color 0.15s;
    }
    .map-list-header [data-sort]:hover,
    .map-list-header [data-sort].sort-active { color: var(--accent); }
    .sort-arrow { opacity: 0.8; font-size: 0.6rem; margin-left: 2px; }

    .map-list-scroll {
      flex: 1;
      overflow-y: auto;
    }
    .map-list-row {
      display: grid;
      grid-template-columns: 1fr 44px 76px 52px 60px 72px;
      align-items: center;
      padding: 0.48rem 1.1rem;
      gap: 0.5rem;
      cursor: pointer;
      border-bottom: 1px solid rgba(42,46,53,0.45);
      transition: background 0.1s;
    }
    .map-list-row:hover { background: var(--surface2); }
    .map-list-name {
      font-size: 0.84rem;
      font-weight: 600;
      color: var(--text);
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }
    .map-list-row:hover .map-list-name { color: var(--accent); }
    .map-list-cell { font-size: 0.81rem; color: var(--text-mid); text-align: right; }
    .map-list-center { font-size: 0.81rem; color: var(--text-mid); text-align: center; }
    .map-list-dim { color: var(--text-dim); }

    /* ── Search users results ───────────────────────────── */
    .search-results-list { flex: 1; overflow-y: auto; }
    .search-result-row {
      display: flex;
      align-items: center;
      gap: 0.85rem;
      padding: 0.7rem 1.2rem;
      cursor: pointer;
      border-bottom: 1px solid rgba(42,46,53,0.45);
      transition: background 0.1s;
    }
    .search-result-row:hover { background: var(--surface2); }
    .search-result-name { font-weight: 600; font-size: 0.9rem; color: var(--text); }
    .search-result-row:hover .search-result-name { color: var(--accent); }
    .search-result-sub { font-size: 0.74rem; color: var(--text-dim); margin-top: 0.1rem; }
    .search-result-pts {
      margin-left: auto;
      font-size: 0.82rem;
      color: var(--accent);
      font-weight: 600;
      white-space: nowrap;
      text-align: right;
    }
    .search-empty {
      padding: 2.5rem 1.2rem;
      text-align: center;
      color: var(--text-dim);
      font-size: 0.875rem;
    }
    .modal-list-title {
      padding: 1.1rem 1.2rem 0.65rem;
      display: flex;
      align-items: center;
      gap: 0.65rem;
      border-bottom: 1px solid var(--border);
      font-weight: 700;
      font-size: 1.0rem;
    }

    /* ── Glass Theme ────────────────────────────────────── */
    header {
      background: rgba(14, 16, 20, 0.82);
      backdrop-filter: blur(14px) saturate(140%);
      -webkit-backdrop-filter: blur(14px) saturate(140%);
      border-color: rgba(255,255,255,0.07);
      box-shadow: inset 0 -1px 0 rgba(255,255,255,0.05), 0 2px 16px rgba(0,0,0,0.4);
    }

    .stat-card {
      background: rgba(22, 24, 28, 0.62);
      backdrop-filter: blur(10px) saturate(130%);
      -webkit-backdrop-filter: blur(10px) saturate(130%);
      border-color: rgba(255,255,255,0.07);
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 4px 18px rgba(0,0,0,0.3);
    }

    .map-detail-card {
      background: rgba(22, 24, 28, 0.62);
      backdrop-filter: blur(10px) saturate(130%);
      -webkit-backdrop-filter: blur(10px) saturate(130%);
      border-color: rgba(255,255,255,0.07);
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 4px 18px rgba(0,0,0,0.3);
    }

    .chart-card {
      background: rgba(22, 24, 28, 0.62);
      backdrop-filter: blur(10px) saturate(130%);
      -webkit-backdrop-filter: blur(10px) saturate(130%);
      border-color: rgba(255,255,255,0.07);
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 4px 18px rgba(0,0,0,0.3);
    }

    .card {
      background: rgba(22, 24, 28, 0.62);
      backdrop-filter: blur(10px) saturate(130%);
      -webkit-backdrop-filter: blur(10px) saturate(130%);
      border-color: rgba(255,255,255,0.07);
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 4px 18px rgba(0,0,0,0.3);
    }

    .modal-box {
      background: rgba(14, 16, 20, 0.88);
      backdrop-filter: blur(18px) saturate(140%);
      -webkit-backdrop-filter: blur(18px) saturate(140%);
      border-color: rgba(255,255,255,0.09);
      box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 24px 64px rgba(0,0,0,0.55);
    }
    /* ─────────────────────────────────────────────────── */
