/* ── Race overlay ────────────────────────────────────────── */
.race-overlay {
    position: relative;
    min-height: 460px;
    border-radius: 24px;
    background: linear-gradient(180deg, rgba(3,14,38,0.97) 0%, rgba(5,20,55,0.98) 70%, rgba(4,16,46,0.99) 100%);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 18px; z-index: 20; overflow: hidden; direction: rtl;
}

/* ── Sea shimmer background ──────────────────────────────── */
.race-sea-bg { position: absolute; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }

@keyframes water-shimmer-a {
    0%   { transform: translateX(-120%) rotate(-12deg); opacity: 0; }
    15%  { opacity: 0.25; }
    85%  { opacity: 0.18; }
    100% { transform: translateX(160%)  rotate(-12deg); opacity: 0; }
}
@keyframes water-shimmer-b {
    0%   { transform: translateX(-140%) rotate(-8deg); opacity: 0; }
    15%  { opacity: 0.18; }
    85%  { opacity: 0.12; }
    100% { transform: translateX(180%)  rotate(-8deg); opacity: 0; }
}

.race-sea-bg::before,
.race-sea-bg::after {
    content: ''; position: absolute; top: -50%; left: -20%;
    width: 35%; height: 200%; pointer-events: none;
    border-radius: 50%; filter: blur(12px);
}
.race-sea-bg::before {
    background: linear-gradient(90deg, transparent 0%, rgba(140,220,255,0.05) 40%, rgba(200,245,255,0.09) 50%, rgba(140,220,255,0.05) 60%, transparent 100%);
    animation: water-shimmer-a 14s ease-in-out infinite;
}
.race-sea-bg::after {
    background: linear-gradient(90deg, transparent 0%, rgba(100,200,255,0.03) 35%, rgba(170,235,255,0.07) 50%, rgba(100,200,255,0.03) 65%, transparent 100%);
    animation: water-shimmer-b 19s ease-in-out infinite;
    animation-delay: -7s;
}

/* Swimming fish across overlay */
.race-fish-swim {
    position: absolute; font-size: 1.8rem; top: 22%; right: 0;
    transform: translateX(110%) scaleX(-1);
    animation: race-fish-cross 12s linear infinite;
}
@keyframes race-fish-cross {
    0%   { transform: translateX(110%)   scaleX(-1); }
    100% { transform: translateX(-1100%) scaleX(-1); }
}

/* ── Scan lines ──────────────────────────────────────────── */
.race-wave {
    position: absolute; inset: 0; border-radius: 24px;
    pointer-events: none; overflow: hidden; z-index: 1;
}
.race-wave::before,
.race-wave::after {
    content: ''; position: absolute; top: 0; left: 0; right: 0;
    height: 2px; border-radius: 999px; filter: blur(3px);
    will-change: transform, opacity;
}
.race-wave::before {
    background: linear-gradient(90deg, transparent 0%, rgba(140,220,255,0.0) 10%, rgba(180,235,255,0.55) 40%, rgba(220,248,255,0.70) 50%, rgba(180,235,255,0.55) 60%, transparent 90%);
    animation: scan-line-a 11s linear infinite;
}
.race-wave::after {
    height: 1px;
    background: linear-gradient(90deg, transparent 0%, rgba(6,182,212,0.0) 15%, rgba(120,210,255,0.40) 45%, rgba(160,230,255,0.55) 50%, rgba(120,210,255,0.40) 55%, transparent 85%);
    animation: scan-line-b 16s linear infinite; animation-delay: -5s;
}

@keyframes scan-line-a {
    0%   { transform: translateY(0);     opacity: 0; }
    4%   { opacity: 1; }
    92%  { opacity: 0.7; }
    100% { transform: translateY(520px); opacity: 0; }
}
@keyframes scan-line-b {
    0%   { transform: translateY(0);     opacity: 0; }
    6%   { opacity: 0.8; }
    88%  { opacity: 0.5; }
    100% { transform: translateY(520px); opacity: 0; }
}

.scan-line-c,
.scan-line-d {
    position: absolute; top: 0; left: 0; right: 0;
    pointer-events: none; border-radius: 999px; filter: blur(4px);
    will-change: transform, opacity;
}
.scan-line-c { height: 1px; background: linear-gradient(90deg, transparent 5%, rgba(100,200,255,0.45) 35%, rgba(200,245,255,0.60) 50%, rgba(100,200,255,0.45) 65%, transparent 95%); animation: scan-line-a 19s linear infinite; animation-delay: -7s; }
.scan-line-d { height: 2px; background: linear-gradient(90deg, transparent 20%, rgba(77,160,230,0.30) 45%, rgba(130,215,255,0.45) 50%, rgba(77,160,230,0.30) 55%, transparent 80%); animation: scan-line-b 24s linear infinite; animation-delay: -14s; }

/* ── Overlay timer / status ──────────────────────────────── */
.race-overlay-center {
    display: flex; flex-direction: column; align-items: center;
    gap: 6px; position: relative; z-index: 2; text-align: center;
}
.race-overlay-status {
    font-size: 0.82rem; font-weight: 700; color: var(--muted);
    letter-spacing: 0.08em; text-transform: uppercase;
}
.race-overlay-timer {
    font-size: 7rem; font-weight: 900; color: var(--accent);
    line-height: 1; font-variant-numeric: tabular-nums;
    text-shadow: 0 0 40px rgba(6,182,212,0.70), 0 0 80px rgba(6,182,212,0.35);
    animation: ocean-glow 1.4s ease-in-out infinite;
}
@keyframes ocean-glow {
    0%, 100% { text-shadow: 0 0 30px rgba(6,182,212,0.60), 0 0 60px rgba(6,182,212,0.25); }
    50%       { text-shadow: 0 0 55px rgba(6,182,212,0.95), 0 0 110px rgba(6,182,212,0.50); }
}
.race-overlay-label { font-size: 0.78rem; color: var(--muted); opacity: 0.65; letter-spacing: 0.04em; }

/* ── Race lobby ──────────────────────────────────────────── */
.race-pane         { display: flex; flex-direction: column; align-items: center; gap: 14px; z-index: 2; position: relative; width: 100%; }
.race-lobby-content { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; direction: rtl; }
.race-lobby-title  { font-size: 1.3rem; font-weight: 800; color: var(--accent); letter-spacing: 0.06em; text-shadow: 0 0 16px rgba(6,182,212,0.50); }
.race-lobby-desc   { font-size: 0.82rem; color: var(--muted); max-width: 240px; line-height: 1.5; }

.lobby-fish-section { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 14px; background: rgba(6,182,212,0.05); border: 1px solid rgba(6,182,212,0.14); border-radius: 12px; width: 100%; }
.lobby-fish-label   { font-size: 0.72rem; font-weight: 700; color: var(--muted); letter-spacing: 0.04em; }
.lobby-fish-lock-hint { font-size: 0.72rem; color: var(--muted); opacity: 0.7; display: flex; align-items: center; gap: 5px; }

.race-join-btn {
    display: flex; align-items: center; gap: 10px; padding: 14px 32px; border-radius: 999px;
    background: var(--accent); color: #021428; font-size: 1rem; font-weight: 800;
    letter-spacing: 0.04em; cursor: pointer; border: none; min-width: unset;
    box-shadow: 0 4px 24px rgba(6,182,212,0.45);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.race-join-btn:hover { transform: scale(1.06) translateY(-1px); box-shadow: 0 8px 32px rgba(6,182,212,0.65); }

.race-cancel-btn { z-index: 2; font-size: 0.80rem; padding: 8px 20px; border-radius: 999px; min-width: unset; }

/* ── Player chips ────────────────────────────────────────── */
.race-waiting-players {
    display: flex; flex-direction: row; flex-wrap: nowrap; justify-content: center;
    gap: 10px; z-index: 2; width: 100%; max-width: 520px; padding: 8px 4px;
}
.race-player-chip {
    display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px 8px;
    border-radius: 12px; background: rgba(6,182,212,0.07); border: 1px solid rgba(6,182,212,0.16);
    position: relative; min-height: 88px; justify-content: center;
}
.race-player-chip.chip-mine { background: rgba(6,182,212,0.16); border-color: rgba(6,182,212,0.50); box-shadow: 0 0 10px rgba(6,182,212,0.18); }
.chip-you-badge { position: absolute; top: 4px; right: 4px; font-size: 0.52rem; font-weight: 800; color: var(--accent); background: rgba(6,182,212,0.18); padding: 1px 5px; border-radius: 4px; letter-spacing: 0.04em; }

.race-player-fish { font-size: 1.8rem; line-height: 1; display: block; animation: fish-bob 1.8s ease-in-out infinite; }
@keyframes fish-bob {
    0%, 100% { transform: scaleX(-1) rotate(-2deg) scaleY(0.96); }
    50%       { transform: scaleX(-1) rotate(2deg)  scaleY(1.04) translateY(-3px); }
}
.race-player-name { font-size: 0.62rem; color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 64px; text-align: center; }

/* Empty slot — skeleton shimmer */
.race-player-chip.race-slot-empty { background: transparent; border: 1px dashed rgba(6,182,212,0.18); }
.race-slot-empty .race-player-fish { width: 36px; height: 36px; border-radius: 50%; font-size: 0; background: rgba(6,182,212,0.10); animation: slot-shimmer 1.8s ease-in-out infinite; }
.race-slot-empty .race-player-name { width: 32px; height: 6px; border-radius: 4px; font-size: 0; background: rgba(6,182,212,0.10); animation: slot-shimmer 1.8s ease-in-out infinite; animation-delay: 0.3s; }
@keyframes slot-shimmer {
    0%, 100% { background: rgba(6,182,212,0.08); }
    50%       { background: rgba(6,182,212,0.20); }
}

@keyframes chip-pop-in {
    0%   { transform: scale(0) translateY(8px); opacity: 0; }
    60%  { transform: scale(1.18) translateY(-2px); opacity: 1; }
    100% { transform: scale(1)   translateY(0);    opacity: 1; }
}
.race-player-chip.chip-enter { animation: chip-pop-in 0.42s cubic-bezier(0.34, 1.56, 0.64, 1) forwards; }

/* ── Race track ──────────────────────────────────────────── */
.race-track {
    background: linear-gradient(180deg, rgba(4,20,55,0.92) 0%, rgba(6,28,70,0.88) 100%);
    border: 1px solid rgba(6,182,212,0.22); border-radius: 20px;
    padding: 14px 16px; margin-bottom: 10px; position: relative; overflow: hidden;
}
.race-track::before { content: ''; position: absolute; inset: 0; background: radial-gradient(ellipse at 50% 0%, rgba(6,182,212,0.08) 0%, transparent 70%); pointer-events: none; }
.race-header        { display: flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.race-title         { font-size: 0.78rem; font-weight: 800; color: var(--accent); letter-spacing: 0.08em; text-transform: uppercase; }
.race-lanes         { display: flex; flex-direction: column; gap: 9px; position: relative; z-index: 1; }
.race-lane          { display: flex; align-items: center; gap: 10px; height: 30px; }
.race-lane--user .lane-label { color: var(--accent); }

.lane-label { font-size: 0.68rem; font-weight: 700; color: rgba(200,230,255,0.60); direction: rtl; text-align: right; width: 46px; flex-shrink: 0; }
.lane-label--user { color: var(--accent) !important; font-weight: 800; font-size: 0.74rem; }

.lane-bg {
    flex: 1; height: 24px; background: rgba(6,182,212,0.07);
    border-radius: 999px; border: 1px solid rgba(6,182,212,0.14);
    position: relative; overflow: visible;
}
.race-lane--user .lane-bg { border-color: rgba(6,182,212,0.40) !important; box-shadow: 0 0 8px rgba(6,182,212,0.18); }

.lane-fish {
    position: absolute; top: 50%; right: 2%;
    transform: translateY(-50%) scaleX(-1);
    font-size: 1.25rem; line-height: 1; transition: right 0.18s linear;
    animation: fish-swim var(--swim-dur, 1.4s) ease-in-out infinite;
    z-index: 2; filter: drop-shadow(0 1px 3px rgba(0,0,0,0.40));
}
.lane-fish--user {
    font-size: 1.65rem; z-index: 4;
    animation: fish-swim var(--swim-dur, 1.4s) ease-in-out infinite,
               user-fish-pulse 2.2s ease-in-out infinite;
}
@keyframes user-fish-pulse {
    0%, 100% { filter: drop-shadow(0 0  6px rgba(6,182,212,0.80)) drop-shadow(0 0  2px rgba(255,255,255,0.20)); }
    50%       { filter: drop-shadow(0 0 20px rgba(6,182,212,1.00)) drop-shadow(0 0 38px rgba(6,182,212,0.55)); }
}
@keyframes fish-swim {
    0%, 100% { transform: translateY(-50%) scaleX(-1) rotate(-3deg) scaleY(0.95); }
    50%       { transform: translateY(calc(-50% - 2px)) scaleX(-1) rotate(3deg) scaleY(1.05); }
}

/* Fish bubbles */
.fish-bubble {
    position: absolute; border-radius: 50%; pointer-events: none; z-index: 5;
    background: radial-gradient(circle at 35% 30%, rgba(210,245,255,0.80) 0%, rgba(6,182,212,0.22) 55%, transparent 100%);
    border: 0.5px solid rgba(160,220,255,0.55);
    animation: fish-bubble-rise var(--bdur, 1s) ease-out forwards;
}
@keyframes fish-bubble-rise {
    0%   { transform: translate(0,    0)    scale(1.0); opacity: 0.80; }
    50%  { transform: translate(2px, -12px) scale(0.75); opacity: 0.50; }
    100% { transform: translate(4px, -24px) scale(0.40); opacity: 0.00; }
}

/* Finish line */
.race-finish-line {
    position: absolute; left: 56px; top: -6px; bottom: -6px; width: 4px;
    background: repeating-linear-gradient(180deg, rgba(255,255,255,0.92) 0px, rgba(255,255,255,0.92) 4px, rgba(10,10,10,0.80) 4px, rgba(10,10,10,0.80) 8px);
    z-index: 5; pointer-events: none; border-radius: 2px;
}
.race-finish-flag { position: absolute; top: -22px; left: -6px; font-size: 1.2rem; line-height: 1; }

/* Finished lane */
.race-lane--finished .lane-bg  { background: rgba(52,211,154,0.16); border-color: rgba(52,211,154,0.38); transition: background 0.5s ease, border-color 0.5s ease; }
.race-lane--finished .lane-fish { animation: none !important; filter: drop-shadow(0 0 8px rgba(52,211,154,0.65)); transform: translateY(-50%) scaleX(-1) !important; }

/* Countdown overlay */
.race-countdown {
    position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
    background: rgba(4,15,45,0.82); border-radius: 20px;
    font-size: 2.8rem; font-weight: 900; color: var(--accent); z-index: 20;
    transition: opacity 0.40s ease, transform 0.20s ease;
}
.race-countdown.is-go { color: var(--success); }

/* Back button */
.race-back-btn {
    position: absolute; top: 12px; right: 12px; z-index: 30;
    display: inline-flex; align-items: center; gap: 7px;
    padding: 7px 14px; border-radius: 999px;
    background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.18);
    color: rgba(255,255,255,0.75); font-size: 0.78rem; font-weight: 600;
    cursor: pointer; min-width: unset;
    transition: background 0.2s ease, color 0.2s ease; direction: rtl;
}
.race-back-btn:hover { background: rgba(255,255,255,0.16); color: #fff; transform: none; box-shadow: none; }

/* Disq warning */
.disq-warning {
    position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
    z-index: 15; white-space: nowrap; text-align: center; direction: rtl;
    padding: 7px 18px; border-radius: 999px;
    background: rgba(248,113,113,0.18); border: 1px solid rgba(248,113,113,0.50);
    color: var(--danger); font-size: 0.82rem; font-weight: 800; letter-spacing: 0.04em;
    animation: disq-pulse 0.6s ease-in-out infinite; pointer-events: none;
}
@keyframes disq-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.65; }
}

/* Race typing area */
.race-typing-area { display: flex; flex-direction: column; gap: 10px; }

/* Hide practice elements when race is active */
#practiceContext.race-active #exerciseLabel,
#practiceContext.race-active #quoteAttrib,
#practiceContext.race-active .action-panel,
#practiceContext.race-active .action-indicators { display: none !important; }

/* Waiting-for-others overlay */
.race-waiting-others {
    display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 16px;
    border-radius: 12px; background: rgba(52,211,154,0.10); border: 1px solid rgba(52,211,154,0.30);
    direction: rtl; text-align: center; animation: rwo-pulse 2s ease-in-out infinite;
}
@keyframes rwo-pulse {
    0%, 100% { border-color: rgba(52,211,154,0.30); }
    50%       { border-color: rgba(52,211,154,0.60); }
}
.rwo-icon  { font-size: 1.6rem; }
.rwo-title { font-size: 0.90rem; font-weight: 700; color: var(--success); }
.rwo-place { font-size: 0.80rem; color: var(--muted); }

/* ── Preview countdown bar ───────────────────────────────── */
.race-preview-bar {
    display: flex; flex-direction: column; gap: 7px; padding: 10px 16px;
    border-radius: 12px; background: rgba(6,182,212,0.08); border: 1px solid rgba(6,182,212,0.25);
    margin-bottom: 8px; animation: preview-bar-pulse 2s ease-in-out infinite;
}
@keyframes preview-bar-pulse {
    0%, 100% { border-color: rgba(6,182,212,0.25); }
    50%       { border-color: rgba(6,182,212,0.55); }
}
.preview-bar-content { display: flex; align-items: center; gap: 6px; font-size: 0.82rem; color: var(--muted); }
.preview-bar-icon    { font-size: 1rem; }
.preview-bar-count   { font-size: 1.5rem; font-weight: 900; color: var(--accent); min-width: 24px; text-align: center; font-variant-numeric: tabular-nums; text-shadow: 0 0 14px rgba(6,182,212,0.55); line-height: 1; }
.preview-bar-track   { height: 4px; background: rgba(6,182,212,0.12); border-radius: 999px; overflow: hidden; }
.preview-bar-fill    { height: 100%; width: 100%; background: linear-gradient(90deg, rgba(6,182,212,0.40), var(--accent)); border-radius: 999px; transition: width 0.95s linear; box-shadow: 0 0 8px rgba(6,182,212,0.45); }

/* ── Race results modal (rr-*) ───────────────────────────── */
.rr-modal-wrap {
    position: fixed; inset: 0; z-index: 600;
    display: flex; align-items: center; justify-content: center;
    background: rgba(4,12,24,0.92); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
    animation: rr-fade-in 0.35s ease forwards;
}
@keyframes rr-fade-in { from { opacity: 0; } to { opacity: 1; } }

.rr-card {
    position: relative;
    background: var(--surface); border-radius: 24px; padding: 28px 30px;
    width: min(94%, 580px); max-height: 88vh; overflow-y: auto;
    display: flex; flex-direction: column; gap: 18px;
    border: 1px solid rgba(8,100,120,0.22);
    box-shadow: 0 32px 80px rgba(4,14,28,0.75);
    direction: rtl; scrollbar-width: thin; scrollbar-color: rgba(6,182,212,0.45) transparent;
}
.rr-title        { font-size: 1.3rem; font-weight: 900; color: var(--accent); text-align: center; letter-spacing: 0.04em; text-shadow: 0 0 16px rgba(6,182,212,0.35); }
.rr-winner-banner { text-align: center; padding: 10px 16px; border-radius: 12px; background: linear-gradient(135deg, rgba(251,191,36,0.16), rgba(251,191,36,0.08)); border: 1px solid rgba(251,191,36,0.38); font-size: 0.92rem; font-weight: 800; color: #fbbf24; text-shadow: 0 0 12px rgba(251,191,36,0.40); }
.rr-hero         { display: flex; align-items: center; gap: 14px; padding: 14px 18px; border-radius: 20px; background: rgba(6,182,212,0.08); border: 1px solid rgba(6,182,212,0.22); }
.rr-hero-medal   { font-size: 2.6rem; line-height: 1; flex-shrink: 0; }
.rr-hero-text    { display: flex; flex-direction: column; gap: 3px; }
.rr-hero-label   { font-size: 1.1rem; font-weight: 900; color: var(--text); }
.rr-hero-sub     { font-size: 0.76rem; color: var(--muted); }
.rr-hero-score   { font-size: 1.35rem; font-weight: 900; color: var(--accent); margin-right: auto; }
.rr-hero-score small { font-size: 0.60rem; color: var(--muted); margin-right: 2px; }

/* Table */
.rr-table-wrap { overflow-x: auto; border-radius: 12px; }
.rr-table      { width: 100%; border-collapse: collapse; font-size: 0.83rem; }
.rr-table thead th { font-size: 0.66rem; font-weight: 700; color: var(--muted); letter-spacing: 0.07em; text-transform: uppercase; padding: 4px 8px 8px; border-bottom: 1px solid rgba(8,100,120,0.18); text-align: center; }
.rr-table tbody td { padding: 8px 8px; border-bottom: 1px solid rgba(8,100,120,0.08); vertical-align: middle; text-align: center; }
.rr-table tbody td.rr-name-cell      { text-align: right; font-weight: 600; }
.rr-table tbody tr:last-child td    { border-bottom: none; }
.rr-table tbody tr.rr-me td          { background: rgba(6,182,212,0.10); font-weight: 700; }
.rr-table tbody tr.rr-disq           { opacity: 0.65; }
.rr-table tbody tr.rr-disq .rr-wpm-cell,
.rr-table tbody tr.rr-disq .rr-score-cell { color: var(--danger); }
.rr-table .rr-wpm-cell   { font-weight: 800; color: var(--accent); }
.rr-table .rr-score-cell { font-weight: 800; }
.rr-penalty { display: block; font-size: 0.67rem; font-weight: 600; color: #f87171; opacity: 0.88; line-height: 1.2; }

/* Progress bars */
.rr-bars     { display: flex; flex-direction: column; gap: 7px; }
.rr-bar-row  { display: flex; align-items: center; gap: 10px; }
.rr-bar-label { font-size: 0.70rem; font-weight: 600; color: var(--muted); width: 58px; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex-shrink: 0; }
.rr-bar-track { flex: 1; height: 10px; background: rgba(6,182,212,0.09); border-radius: 999px; overflow: hidden; }
.rr-bar-fill  { height: 100%; border-radius: 999px; background: linear-gradient(90deg, rgba(6,182,212,0.40), var(--accent)); transition: width 1.0s cubic-bezier(0.22, 1, 0.36, 1); }
.rr-bar-fill.rr-fill-me     { background: linear-gradient(90deg, rgba(100,210,255,0.60), rgba(6,182,212,1.0)); box-shadow: 0 0 6px rgba(6,182,212,0.40); }
.rr-bar-fill.rr-fill-winner { background: linear-gradient(90deg, #fbbf24, #f59e0b); }
.rr-bar-fill.rr-fill-disq   { background: rgba(248,113,113,0.50); }
.rr-bar-pct  { font-size: 0.70rem; font-weight: 700; color: var(--muted); width: 34px; text-align: left; flex-shrink: 0; }

/* Progress chart */
.rr-chart-wrap { overflow: hidden; border-radius: 12px; background: var(--surface-strong); border: 1px solid rgba(8,100,120,0.14); padding: 6px 4px 2px; }
.rr-chart-svg  { display: block; width: 100%; height: auto; }
.rr-chart-svg polyline:hover { stroke-opacity: 1 !important; stroke-width: 3 !important; cursor: crosshair; }

.rr-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; padding-top: 4px; }
.rr-actions .race-join-btn { padding: 12px 24px; font-size: 0.92rem; }

/* Full race results leaderboard */
.race-hero              { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-radius: 20px; background: rgba(6,182,212,0.08); border: 1px solid rgba(6,182,212,0.22); width: 100%; direction: rtl; }
.race-hero-medal        { font-size: 3rem; line-height: 1; flex-shrink: 0; }
.race-hero-text         { display: flex; flex-direction: column; gap: 2px; }
.race-hero-label        { font-size: 1.2rem; font-weight: 900; color: var(--text); letter-spacing: 0.02em; }
.race-hero-sub          { font-size: 0.76rem; color: var(--muted); font-weight: 500; }
.race-hero-score        { font-size: 1.4rem; font-weight: 900; color: var(--accent); margin-right: auto; text-align: right; flex-shrink: 0; }
.race-hero-score small  { font-size: 0.60rem; font-weight: 600; color: var(--muted); margin-right: 2px; }

.race-leaderboard        { display: flex; flex-direction: column; gap: 5px; width: 100%; }
.race-leaderboard-header { display: grid; grid-template-columns: 1.1rem 1fr auto auto; gap: 8px; padding: 0 12px; font-size: 0.66rem; font-weight: 700; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; direction: rtl; opacity: 0.65; }

.race-row {
    display: flex; align-items: center; gap: 8px; padding: 8px 12px;
    border-radius: 12px; background: var(--surface-strong); border: 1px solid transparent;
    direction: rtl; font-size: 0.86rem; transition: background 0.2s;
}
.race-row.rr-me     { background: rgba(6,182,212,0.14); border-color: rgba(6,182,212,0.35); font-weight: 700; }
.race-row.rr-winner { background: rgba(251,191,36,0.10); border-color: rgba(251,191,36,0.30); }
.race-row.rr-disq   { background: rgba(248,113,113,0.10); border-color: rgba(248,113,113,0.28); opacity: 0.80; }
.race-row.rr-dnf    { opacity: 0.55; }

.rr-medal { font-size: 1.1rem; flex-shrink: 0; }
.rr-name  { flex: 1; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rr-pct   { font-size: 0.74rem; color: var(--muted); font-weight: 600; flex-shrink: 0; }
.rr-score { font-size: 0.80rem; font-weight: 800; color: var(--accent); flex-shrink: 0; min-width: 36px; text-align: right; }

.race-winner-bar {
    width: 100%; text-align: center; padding: 10px 16px; border-radius: 12px;
    background: linear-gradient(135deg, rgba(251,191,36,0.15), rgba(251,191,36,0.08));
    border: 1px solid rgba(251,191,36,0.35); font-size: 0.88rem; font-weight: 800;
    color: #fbbf24; direction: rtl; text-shadow: 0 0 10px rgba(251,191,36,0.35);
}

.rr-badge        { font-size: 0.72rem; font-weight: 700; padding: 2px 7px; border-radius: 8px; flex-shrink: 0; }
.rr-badge--done  { color: var(--success); }
.rr-badge--disq  { color: var(--danger); background: rgba(248,113,113,0.12); }
.rr-badge--dnf   { color: var(--muted); }

.race-my-stats       { display: flex; gap: 20px; justify-content: center; font-size: 0.90rem; font-weight: 700; color: var(--muted); direction: rtl; }
.race-results-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; width: 100%; }
.race-results-actions .race-join-btn { padding: 12px 24px; font-size: 0.92rem; }

/* Placement card inside normal results modal */
.race-placement { width: 100%; text-align: center; direction: rtl; padding: 14px 16px; border-radius: 12px; background: rgba(6,182,212,0.07); border: 1px solid rgba(6,182,212,0.22); display: flex; flex-direction: column; align-items: center; gap: 4px; }
.race-place-emoji { font-size: 2.2rem; line-height: 1; }
.race-place-text  { font-size: 1rem; font-weight: 800; color: var(--text); }
.race-place-sub   { font-size: 0.76rem; color: var(--muted); }
