/* =========================================
   RANDALL.CSS - Where's Randall trainer
   ========================================= */

body { overflow-y: auto; }

.training-main {
    padding-top: calc(var(--nav-h) + 40px);
    padding-bottom: 80px;
    max-width: 1000px;
    margin: 0 auto;
    padding-left: 20px;
    padding-right: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* ---- top bar: modes + timer + prompt ---- */
.randall-topbar {
    display: flex;
    align-items: center;
    gap: 24px;
    padding: 16px 24px;
    flex-wrap: wrap;
}

.randall-modes {
    display: flex;
    gap: 8px;
}

.mode-btn {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 9px;
    color: rgba(255,255,255,0.55);
    font-size: 0.85rem;
    font-weight: 700;
    padding: 8px 14px;
    cursor: pointer;
    text-align: left;
    transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.mode-btn .mode-hint {
    display: block;
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--text-muted);
    letter-spacing: 0.02em;
}
.mode-btn:hover { color: #fff; border-color: rgba(255,255,255,0.35); }
.mode-btn.active {
    background: rgba(0,200,255,0.12);
    color: #00c8ff;
    border-color: rgba(0,200,255,0.4);
}

/* the timer is read out to screen readers; on screen it is the HUD */
.randall-sr {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.randall-prompt {
    margin-left: auto;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-muted);
    max-width: 300px;
    text-align: right;
}

/* ---- stage: the game's 73:60 screen ---- */
.randall-stage-wrap {
    padding: 16px;
    display: flex;
    justify-content: center;
    position: relative;   /* anchors the run-results overlay */
}

.randall-view {
    position: relative;
    width: min(100%, calc(72vh * 73 / 60));
    aspect-ratio: 73 / 60;
    border-radius: 6px;
    overflow: hidden;
    background:
        radial-gradient(ellipse at 50% 20%, rgba(0, 60, 120, 0.25), transparent 70%),
        rgba(6, 10, 22, 0.6);
}

.randall-view canvas {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    display: block;
}

.randall-canvas { cursor: crosshair; }
.randall-hud { pointer-events: none; }

/* ---- graphics from the player's disc ---- */
.randall-disc {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 12px 24px;
    padding: 16px 22px;
}
.randall-disc-text { flex: 1 1 420px; }
.randall-disc-title {
    font-size: 0.8rem;
    font-weight: 800;
    color: #00c8ff;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin: 0 0 6px;
}
.randall-disc-text p { margin: 0; font-size: 0.85rem; line-height: 1.55; color: var(--text-muted); }
.randall-disc.loaded #discCopy { display: none; }
.randall-disc-msg { min-height: 1.2em; margin-top: 6px !important; }
.randall-disc-msg.ok { color: var(--grade-perfect, #00ff88) !important; }
.randall-disc-msg.err { color: var(--grade-miss, #ff3366) !important; }
.randall-disc-actions { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; }
.randall-disc.loaded .randall-file-btn { display: none; }
.randall-file-btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: var(--text-primary);
    font-weight: 600;
    padding: 0.4rem 0.85rem;
    font-size: 0.8rem;
    cursor: pointer;
}
.randall-file-btn:hover { border-color: rgba(255, 255, 255, 0.4); }
.randall-file-btn:focus-within { outline: 2px solid #00c8ff; outline-offset: 2px; }
.randall-link {
    background: none;
    border: none;
    padding: 0;
    color: var(--text-muted);
    font-size: 0.78rem;
    text-decoration: underline;
    cursor: pointer;
}
.randall-link:hover { color: var(--text-primary); }
.randall-progress {
    flex-basis: 100%;
    height: 4px;
    background: rgba(148, 163, 184, 0.15);
    border-radius: 2px;
    overflow: hidden;
}
.randall-progress span { display: block; height: 100%; width: 0; background: #00c8ff; }

/* ---- stats row (shared look with other trainers) ---- */
.stats-row {
    display: flex;
    align-items: center;
    padding: 16px 24px;
    gap: 0;
    flex-wrap: wrap;
}

.stat-cell {
    flex: 1;
    min-width: 80px;
    text-align: center;
    padding: 8px 12px;
    border-right: 1px solid var(--border-subtle);
}
.stat-cell:last-of-type { border-right: none; }

.stat-value {
    font-size: 1.7rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.02em;
    line-height: 1;
}

.stat-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-top: 4px;
}

.btn-reset {
    margin-left: auto;
    background: transparent;
    border: 1px solid var(--border-glow);
    border-radius: 7px;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    padding: 7px 16px;
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}
.btn-reset:hover {
    border-color: var(--accent-red);
    color: var(--accent-red);
}

/* ---- timing cheat sheet ---- */
.randall-tip { padding: 16px 22px; }

.randall-tip-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
}

.randall-tip-title {
    font-size: 0.8rem;
    font-weight: 800;
    color: #00c8ff;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.randall-tip-lock {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-style: italic;
    display: none;
}
.randall-tip.locked .randall-tip-lock { display: inline; }

.randall-tip-body {
    margin-top: 10px;
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-muted);
}
.randall-tip-body p { margin: 0; }
.randall-tip-body ul { margin: 8px 0 0; padding-left: 20px; }
.randall-tip-body li { margin-bottom: 4px; }
.randall-tip-body strong { color: var(--text-primary); }
.randall-tip-foot { margin-top: 8px !important; font-size: 0.78rem; }

.randall-tip.locked .randall-tip-body { display: none; }

/* ---- credit ---- */
.randall-credit {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-align: center;
}
.randall-credit a { color: #00c8ff; text-decoration: none; }
.randall-credit a:hover { text-decoration: underline; }

/* Responsive */
@media (max-width: 600px) {
    .randall-topbar { padding: 14px 16px; gap: 14px; }
    .randall-prompt { margin-left: 0; text-align: left; max-width: none; }
    .randall-stage-wrap { padding: 8px; }
    .stats-row { padding: 14px 16px; }
    .stat-value { font-size: 1.3rem; }
    .btn-reset { width: 100%; margin-left: 0; margin-top: 12px; }
}
