/* Full-screen dialogs: boot, main menu, game over, leaderboard, settings. */
.screen {
    position: fixed;
    inset: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px 16px 16px 16px;
    background: radial-gradient(ellipse at center, rgba(7, 4, 20, 0.5), rgba(7, 4, 20, 0.88));
}
.screen[hidden] { display: none; }
.screen:not(.screen-menu):not(#scrBoot) .panel { animation: rise 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.2); }
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(0.98); } }

/* ---------- boot ---------- */
#scrBoot { background: var(--bg); z-index: 30; }
/* Same look as the menu: deep-blue night, the CYBER RUNNER title, theme accent bar. */
#scrBoot { background: radial-gradient(ellipse at 50% 40%, #0b2a4a 0%, #071d35 45%, var(--bg) 100%); }
.boot { width: min(420px, 100%); font-family: var(--font-m); }
.boot-logo { margin-bottom: 28px; text-align: center; font-family: var(--font-d); letter-spacing: 0.08em; }
.boot-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.boot-msg { color: var(--muted); font-size: 12px; letter-spacing: 0.24em; }
.boot-pct {
    font-family: var(--font-d);
    font-size: 22px;
    font-weight: 800;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 14px color-mix(in srgb, var(--theme-accent) 70%, transparent);
}
.boot-bar {
    height: 12px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid color-mix(in srgb, var(--theme-accent) 35%, transparent);
    overflow: hidden;
}
.boot-fill {
    height: 100%;
    width: 100%;
    transform-origin: left;
    transform: scaleX(0);
    background: linear-gradient(90deg, var(--theme-accent), var(--cyan));
    box-shadow: 0 0 14px color-mix(in srgb, var(--theme-accent) 70%, transparent);
    transition: transform 0.25s ease-out;
}

/* ---------- main menu ---------- */
.screen-menu {
    justify-content: flex-start;
    background: linear-gradient(90deg, rgba(7, 4, 20, 0.92) 0%, rgba(7, 4, 20, 0.7) 38%, rgba(7, 4, 20, 0) 62%);
}
.menu-col { width: min(440px, 100%); margin-left: clamp(0px, 6vw, 90px); max-height: 100%; overflow-y: auto; padding: 4px; }
.logo { font-weight: 900; line-height: 0.95; margin: 0 0 24px; letter-spacing: 0.06em; }
.logo span { display: block; position: relative; }
.logo-a { font-size: clamp(44px, 10vw, 76px); color: var(--text); text-shadow: 0 0 22px color-mix(in srgb, var(--theme-accent) 55%, transparent); }
.logo-b {
    font-size: clamp(44px, 10vw, 76px);
    color: var(--theme-accent);
    text-shadow: 0 0 18px color-mix(in srgb, var(--theme-accent) 60%, transparent);
}
.logo-a::before, .logo-a::after {
    content: attr(data-text);
    position: absolute;
    inset: 0;
    opacity: 0.8;
    clip-path: inset(0 0 100% 0);
    animation: glitch 2.2s steps(1) infinite;
}
.logo-a::before { color: var(--theme-accent); transform: translateX(-3px); }
.logo-a::after { color: #ffffff; transform: translateX(3px); animation-delay: -1.1s; }
/* Continuous glitch: slices flicker through the word all the time (off under reduced motion). */
@keyframes glitch {
    0% { clip-path: inset(20% 0 55% 0); }
    8% { clip-path: inset(60% 0 15% 0); }
    16% { clip-path: inset(0 0 100% 0); }
    30% { clip-path: inset(40% 0 40% 0); }
    36% { clip-path: inset(5% 0 80% 0); }
    44% { clip-path: inset(0 0 100% 0); }
    58% { clip-path: inset(70% 0 5% 0); }
    64% { clip-path: inset(30% 0 50% 0); }
    72% { clip-path: inset(0 0 100% 0); }
    84% { clip-path: inset(50% 0 30% 0); }
    90% { clip-path: inset(10% 0 70% 0); }
    96%, 100% { clip-path: inset(0 0 100% 0); }
}
.player-card { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 12px; }
.avatar { width: 44px; height: 44px; color: var(--cyan); filter: drop-shadow(0 0 8px rgba(46, 249, 255, 0.6)); flex: none; }
.pc-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.pc-label { font-family: var(--font-m); font-size: 10px; letter-spacing: 0.3em; color: var(--muted); }
.pc-name { font-weight: 800; font-size: 19px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.net { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.net .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.net.on .dot { background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.net.off .dot { background: var(--red); }
.stats3, .stats2 { display: grid; gap: 8px; margin-bottom: 16px; }
.stats3 { grid-template-columns: repeat(3, 1fr); }
.stats2 { grid-template-columns: 1fr 1fr; }
.stat { background: rgba(255, 255, 255, 0.035); border: 1px solid var(--line-soft); border-radius: 10px; padding: 10px 12px; min-width: 0; }
.stat .k { display: block; font-family: var(--font-m); font-size: 10px; letter-spacing: 0.16em; color: var(--muted); }
.stat .v { display: block; font-weight: 800; font-size: 20px; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 10px; }
.grid3 .btn { font-size: 12px; padding: 8px 6px; letter-spacing: 0.04em; }
/* Menu checkbox under the buttons, styled as a full-width button with its own tick box. */
.skip-intro { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; min-height: 46px; margin-top: 10px; font-size: 12px; letter-spacing: 0.06em; cursor: pointer; user-select: none; }
.skip-intro input {
    appearance: none; flex: none; width: 20px; height: 20px; margin: 0; border-radius: 5px; cursor: pointer;
    border: 1.5px solid rgba(46, 249, 255, 0.6); background: rgba(4, 3, 15, 0.5); display: grid; place-items: center;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
}
.skip-intro input::after { content: ''; width: 5px; height: 10px; margin-top: -2px; border: solid #04030f; border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); opacity: 0; }
.skip-intro input:checked { background: var(--theme-accent); border-color: var(--theme-accent); box-shadow: 0 0 12px color-mix(in srgb, var(--theme-accent) 60%, transparent); }
.skip-intro input:checked::after { opacity: 1; }
.skip-intro input:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
/* Narrow desktop windows: the card drops below the menu instead of overlapping it. */
@media (max-width: 760px) {
    .screen-menu { flex-wrap: wrap; align-content: flex-start; overflow-y: auto; }
    .menu-col { margin: 0 auto; max-height: none; overflow: visible; }
    .logo-a, .logo-b { font-size: clamp(38px, 12vw, 56px); }
    .logo { margin-bottom: 16px; }
}

/* ---------- game over ---------- */
.over-title { text-align: center; font-size: clamp(18px, 5vw, 24px); color: var(--red); text-shadow: 0 0 16px rgba(255, 77, 109, 0.6); margin-bottom: 4px; }
.over-cause { text-align: center; color: var(--muted); margin: 0 0 12px; font-size: 14px; min-height: 1.2em; }
.final { text-align: center; margin: 0 0 16px; display: flex; flex-direction: column; align-items: center; }
.final .k { font-family: var(--font-m); font-size: 12px; letter-spacing: 0.3em; color: var(--muted); }
.final .big {
    font-family: var(--font-b);
    font-weight: 800;
    font-size: clamp(50px, 14vw, 80px);
    line-height: 1.05;
    font-variant-numeric: tabular-nums;
    text-shadow: 0 0 28px rgba(46, 249, 255, 0.55);
}
.badge {
    margin-top: 8px;
    padding: 6px 16px;
    border-radius: 999px;
    font-family: var(--font-d);
    font-weight: 800;
    font-size: 13px;
    letter-spacing: 0.12em;
    background: linear-gradient(90deg, var(--gold), var(--pink));
    color: #120515;
    box-shadow: 0 0 24px rgba(255, 210, 87, 0.5);
    animation: badge 1.2s ease-in-out infinite alternate;
}
.badge[hidden] { display: none; }
@keyframes badge { to { box-shadow: 0 0 40px rgba(255, 47, 180, 0.7); transform: scale(1.05); } }
.verify { text-align: center; font-size: 12px; color: var(--muted); margin: -6px 0 14px; min-height: 1.2em; }
.verify.ok { color: var(--ok); }
.pause-score { text-align: center; color: var(--muted); margin: -6px 0 16px; }

/* ---------- leaderboard ---------- */
/* Top 10 as profile cards: rank on the left, the player's equipped card, points on the right. */
.lb-list { list-style: none; margin: 0; padding: 2px 6px 2px 0; max-height: min(64vh, 600px); overflow-y: auto; display: grid; gap: 6px; }
.lb-list li { display: grid; grid-template-columns: 44px 1fr; gap: 8px; align-items: center; }
.lb-list .r { font-family: var(--font-d); font-weight: 800; color: var(--muted); font-size: 14px; text-align: center; }
.lb-list li.p1 .r { color: var(--gold); text-shadow: 0 0 10px rgba(255, 210, 87, 0.6); font-size: 18px; }
.lb-list li.p2 .r { color: #d6e2ff; font-size: 16px; }
.lb-list li.p3 .r { color: #ff9f6b; font-size: 16px; }
.lb-list .player-card, #lbMe .player-card { margin: 0; padding: 7px 14px; }
.lb-list li.me .player-card { outline: 2px solid var(--theme-accent); outline-offset: 2px; }
.lb-list .avatar, #lbMe .avatar { width: 36px; height: 36px; }
.lb-list .pc-name, #lbMe .pc-name { font-size: 16px; }
.player-card .you { color: var(--muted); font-weight: 400; font-size: 13px; }
.lb-state { padding: 32px 12px; text-align: center; color: var(--muted); border: 1px dashed var(--line-soft); border-radius: 10px; }
.lb-state .btn { margin-top: 12px; }
.skel { height: 40px; margin: 6px 0; border-radius: 8px; background: linear-gradient(90deg, rgba(255,255,255,0.04), rgba(255,255,255,0.09), rgba(255,255,255,0.04)); background-size: 200% 100%; animation: skel 1.1s linear infinite; }
@keyframes skel { to { background-position: -200% 0; } }
#lbMe:not(:empty) { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line-soft); font-size: 14px; color: var(--muted); }
.lb-me-h { display: block; margin: 0 0 6px 2px; font-family: var(--font-m); font-size: 10px; letter-spacing: 0.3em; color: var(--theme-accent); }

/* ---------- settings ---------- */
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 0; border-bottom: 1px solid rgba(255, 255, 255, 0.05); }
.set-row > label, .set-row > span { flex: 1; font-weight: 600; }
.set-row input[type=range] { width: 170px; flex: none; }
.set-row output { width: 36px; text-align: right; font-family: var(--font-m); color: var(--muted); }
.bind-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 0; }
.bind-row .keys { display: flex; gap: 6px; }
.rebind { min-width: 84px; min-height: 40px; border-radius: 8px; border: 1px solid var(--line-soft); background: rgba(255, 255, 255, 0.05); font-family: var(--font-m); }
.rebind[data-listening=true] { border-color: var(--amber); color: var(--amber); }

@media (max-height: 560px) {
    .panel { padding: 16px; }
    .logo-a, .logo-b { font-size: 36px; }
    .logo { margin-bottom: 12px; }
    .btn.xl { min-height: 52px; font-size: 18px; }
}

/* ---------- desktop-only notice (phones and tablets) ---------- */
.device-only { max-width: 420px; text-align: center; }
.device-only h2 { color: var(--cyan); letter-spacing: 0.2em; }
.device-only p { margin: 0; line-height: 1.5; color: var(--text); }
