/* Self-hosted Press Start 2P (was Google Fonts). Removes the render-blocking
   fonts.googleapis.com request + googleapis->gstatic chain and lowers CLS. */
@font-face {
    font-family: 'Press Start 2P';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/press-start-2p-latin.woff2') format('woff2');
    unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
    font-family: 'Press Start 2P';
    font-style: normal;
    font-weight: 400;
    font-display: swap;
    src: url('fonts/press-start-2p-latin-ext.woff2') format('woff2');
    unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

* {
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    margin: 0;
    background-color: #3b4147; /* TŠRB dark grey background (lightened for softer contrast) */
    font-family: 'Press Start 2P', system-ui, sans-serif;
    color: #dedfe0; /* Light grey text */
    font-size: 10px;
    user-select: none;
    -webkit-user-select: none;
    cursor: default;
}

input, textarea {
    user-select: auto;
    -webkit-user-select: auto;
    cursor: text;
}

.main-content {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    padding: 20px 0;
}

/* Base text elements use system font for modern readability */
p, div, span {
    font-family: system-ui, -apple-system, sans-serif;
    font-size: 14px;
}

/* Titles and scores keep retro font */
h2, h3, .score-val, canvas, .countdown-text, #top-msg, #main-msg {
    font-family: 'Press Start 2P', monospace;
}

/* Post-Game Teaching Panel */
.teaching-panel {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translate(-50%, -150%);
    transition: transform 0.5s ease-in-out;
    width: 100%;
    max-width: 800px;
    background: linear-gradient(135deg, #475467, #32373c);
    color: #fff;
    padding: 20px 20px 40px 20px; /* extra padding at bottom for close btn */
    border-bottom-left-radius: 15px;
    border-bottom-right-radius: 15px;
    text-align: center;
    z-index: 1000;
    box-shadow: 0px 10px 30px rgba(0,0,0,0.6);
}
.teaching-panel.open {
    transform: translate(-50%, 0);
}
.close-teaching-btn {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-weight: bold;
    padding: 10px 0;
    cursor: pointer;
    font-size: 14px;
    border-bottom-left-radius: 15px;
    border-bottom-right-radius: 15px;
    transition: background 0.2s;
    user-select: none;
    -webkit-user-select: none;
}
.close-teaching-btn:hover {
    background-color: rgba(255, 255, 255, 0.2);
}

.teaching-panel h3 {
    margin-top: 0;
    color: #ff6900;
    text-shadow: 2px 2px 0 #000;
    font-size: 16px;
    line-height: 1.5;
}

.teaching-panel .last-q {
    font-size: 16px;
    margin: 15px 0;
    line-height: 1.5;
}

.teaching-panel .correct-a {
    font-size: 16px;
    font-weight: bold;
    color: #27272A;
    background-color: #ff8c33;
    /* Subtle scanlines over the solid colour (texture only, not a screen) */
    background-image: linear-gradient(rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, 0.16) 50%);
    background-size: 100% 3px;
    display: inline-block;
    padding: 10px 20px;
    border-radius: 8px;
    margin-top: 10px;
    box-shadow: 0 4px 10px rgba(255, 140, 51, 0.4);
}

.teaching-panel .explanation {
    font-size: 14px;
    margin-top: 15px;
    color: #e0e0e0;
    line-height: 1.4;
    font-weight: normal;
}

.teaching-panel .example {
    font-size: 14px;
    margin-top: 10px;
    color: #f6c231;
    font-family: monospace;
    /* Plain dark code field (scanline texture removed) */
    background-color: #1a1a1a;
    padding: 12px;
    border-radius: 6px;
    border: 2px solid #27272A;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.7);
}

/* Nokia 3310 Casing -> Modern-Retro hybrid */
.phone-casing {
    /* Whitish GameBoy-style matte plastic: a fine grayscale grain (inline SVG
       fractal noise) layered over the casing gradient with soft-light blend, so it
       adds tactile texture without shifting the casing color or brightness. */
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='gbnoise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23gbnoise)' opacity='0.45'/%3E%3C/svg%3E"),
        linear-gradient(135deg, #dedfe0, #b2b2b3); /* Lighter casing to match school grey */
    background-size: 140px 140px, auto;
    background-blend-mode: soft-light, normal;
    width: 100%;
    max-width: 380px;
    height: auto;
    padding: 30px;
    padding-bottom: 40px;
    border-radius: 40px;
    border: 4px solid #27272A;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    box-shadow: 10px 20px 40px rgba(0,0,0,0.7), inset 5px 5px 15px rgba(255,255,255,0.8);
}

/* Top Bezel Layout */
.top-bezel-elements {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0 10px;
    margin-bottom: 20px;
}

.camera-container, .mute-container {
    width: 40px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Speaker Slits & Front Camera */
.speaker {
    display: flex;
    gap: 8px;
}
.speaker-slit {
    width: 8px;
    height: 25px;
    background-color: #27272A;
    /* Fine scanlines to match the LCD aesthetic */
    background-image: linear-gradient(rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, 0.35) 50%);
    background-size: 100% 3px;
    border-radius: 10px;
    position: relative;
    overflow: hidden;
}
.speaker-slit::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0%;
    background-color: #ff8c33; /* Accent orange — glowing VU level */
    box-shadow: 0 0 4px rgba(255, 140, 51, 0.6);
}

/* Subtle VU Meter Effect */
@keyframes vu-pulse-vertical {
    0%, 100% { height: 10%; }
    50% { height: 90%; }
}

.speaker.playing .speaker-slit::after {
    animation: vu-pulse-vertical 0.3s infinite ease-in-out;
}
/* Staggered timing for a more natural VU bounce */
.speaker.playing .speaker-slit:nth-child(2)::after { animation-delay: 0.1s; }
.speaker.playing .speaker-slit:nth-child(3)::after { animation-delay: 0.2s; }
.speaker.playing .speaker-slit:nth-child(4)::after { animation-delay: 0.15s; }

.front-camera {
    width: 20px;
    height: 20px;
    background: #18181B;
    border-radius: 50%;
    border: 2px solid #27272A;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: inset 2px 2px 5px rgba(0,0,0,0.8), 0 1px 1px rgba(255,255,255,0.2);
    position: relative;
    overflow: hidden;
}

.camera-lens {
    width: 8px;
    height: 8px;
    background: #000;
    border-radius: 50%;
    box-shadow: inset -1px -1px 2px rgba(255,255,255,0.4);
    transition: all 0.1s;
}

/* Smile Animation Classes */
.front-camera.flash {
    background: #fff;
    box-shadow: 0 0 20px #fff, inset 0 0 10px #fff;
    border-color: #fff;
}

.front-camera.smile .camera-lens {
    width: 2px;
    height: 2px;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: 
        -4px 1px 0 #fff,
        -2px 3px 0 #fff,
         0px 3px 0 #fff,
         2px 3px 0 #fff,
         4px 1px 0 #fff;
    transform: translateY(2px);
}

.camera-eyes {
    opacity: 0;
    width: 2px;
    height: 2px;
    background: transparent;
    border-radius: 0;
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    box-shadow: 
        -3px 0 0 #fff,
         3px 0 0 #fff;
    transition: opacity 0.2s;
}

.front-camera.smile .camera-eyes {
    opacity: 1;
}

/* Brand Text */
.brand {
    color: #27272A;
    font-size: 15px;
    font-weight: 900;
    margin-bottom: 15px;
    text-align: center;
    letter-spacing: 2px;
}

/* Silver Bezel around Screen */
.screen-bezel {
    background: linear-gradient(to bottom, #ff8c33, #e65c00); /* Muted Orange */
    width: 100%;
    max-width: 320px;
    height: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 15px 24px 60px 24px;
    border-radius: 20px 20px 40px 40px;
    box-shadow: inset 0px 5px 10px rgba(0,0,0,0.4);
}

/* Inner Black Border */
.screen-border {
    background-color: #27272A;
    width: 100%;
    padding: 6px;
    border-radius: 10px;
}

/* The Screen Itself */
.screen {
    background-color: #1a1a1a;
    width: 100%;
    max-width: 260px;
    display: flex;
    flex-direction: column;
    position: relative;
    border-radius: 5px;
    overflow: hidden;
}

/* Retro LCD scanline overlay. Full strength on the start/game-over screen;
   softened during gameplay (.screen.playing) so it stays subtle and non-distracting. */
.screen::after {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, 0.18) 50%);
    background-size: 100% 3px;
    border-radius: 5px;
    z-index: 2;
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.4s ease;
}
.screen.playing::after {
    opacity: 0.35;
}

/* Easter egg: error screen flash when all 3 scoreboard medals are turned off */
.screen-error {
    position: absolute;
    inset: 0;
    z-index: 5;
    display: none;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 8px;
    background: #b00018;
    color: #fff;
    font-family: 'Press Start 2P', monospace;
    text-align: center;
    text-shadow: 2px 2px 0 #000;
    pointer-events: none;
}
.screen-error.flash {
    display: flex;
    animation: screen-error-flicker 0.45s steps(2) 3;
}
.screen-error-title { font-size: 16px; letter-spacing: 1px; }
.screen-error-code { font-size: 11px; color: #ffe14d; }
.screen-error-msg { font-size: 9px; }
@keyframes screen-error-flicker {
    0% { opacity: 1; background: #b00018; transform: translateX(0); }
    25% { opacity: 0.2; background: #000; transform: translateX(-2px); }
    50% { opacity: 1; background: #d10020; transform: translateX(2px); }
    75% { opacity: 0.35; background: #000; transform: translateX(-1px); }
    100% { opacity: 1; background: #b00018; transform: translateX(0); }
}

/* Score & UI Text Outside Canvas */
.status-bar {
    display: flex;
    justify-content: space-between;
    padding: 8px 10px;
    border-bottom: 2px solid rgba(246, 194, 49, 0.3);
    color: #f6c231;
}

.status-bar span {
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
}

/* Physical Sound Toggle on Phone Casing */
.physical-sound-toggle {
    width: 32px;
    height: 32px;
    background: linear-gradient(to bottom, #27272A, #18181B);
    border: 2px solid #475467;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    cursor: pointer;
    box-shadow: 0px 3px 6px rgba(0,0,0,0.5);
    transition: transform 0.1s, filter 0.2s, box-shadow 0.2s, border-color 0.2s;
    filter: grayscale(1) opacity(0.6);
    padding: 0;
    position: relative;
}

.physical-sound-toggle:active {
    transform: translateY(2px);
    box-shadow: 0px 1px 3px rgba(0,0,0,0.5);
}

.physical-sound-toggle.on {
    filter: none;
    box-shadow: 0 0 8px rgba(255, 157, 74, 0.5);
    border-color: #d95800;
}

.physical-sound-toggle .sound-icon {
    font-size: 14px;
}

/* Music-state badge: a small note in the corner of the sound toggle. When music
   is off it greys out and gets a red strike-through, so the button shows BOTH
   the game-sound state (speaker glyph) and the music state at a glance. */
.physical-sound-toggle .music-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    width: 14px;
    height: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 9px;
    line-height: 1;
    color: #f6c231;
    background: #18181B;
    border: 1px solid #475467;
    border-radius: 50%;
    text-shadow: 0 0 4px rgba(246, 194, 49, 0.8);
    transition: color 0.2s, filter 0.2s, opacity 0.2s;
}

.physical-sound-toggle .music-badge.off {
    color: #6b7280;
    filter: grayscale(1);
    text-shadow: none;
    opacity: 0.75;
}

.physical-sound-toggle .music-badge.off::after {
    content: '';
    position: absolute;
    left: 50%;
    top: 50%;
    width: 16px;
    height: 1.5px;
    background: #ef4444;
    transform: translate(-50%, -50%) rotate(-45deg);
}

/* The Game Canvas */
canvas {
    display: block;
    margin: 0 auto;
    image-rendering: pixelated;
    width: 100%;
    max-width: 260px;
    height: auto;
}

/* Overlay Messages (Start / Game Over) */
#message-overlay {
    position: absolute;
    top: 72%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    width: 100%;
    color: #f6c231;
    text-shadow: 2px 2px 0 #27272A;
}
/* Game over: lay the text out over the snake — SKILL ISSUE high up over the
   hat, then a gap, then the GAME OVER cluster over the eyes. Uses a flex column
   with a gap (clean flow-based spacing) instead of per-element top offsets. */
/* Game over: lift the text block up and fine-tune each line's offset so the
   messages sit cleanly over the snake's hat / face. */
.screen.gameover #message-overlay {
    top: 40%;
}
.screen.gameover #top-msg  { font-size: 14px; top: 16px; }  /* SKILL ISSUE */
.screen.gameover #mid-msg  { top: 73px; }                   /* TEGOBA VJEŠTINE */
.screen.gameover #main-msg { top: 67px; }                   /* GAME OVER */
.screen.gameover #sub-msg  { top: 62px; }                   /* Pritisni ENTER */

/* Game logo behind the start/game-over text. Anchored to the bottom of the
   screen at full height (sits on the bottom bezel, inside the screen). Sits below
   the text and below the .screen::after scanlines (z-index 2), so the retro LCD
   scanline texture falls over it. Shown only when NOT playing (START / GAME OVER),
   matching the message overlay's lifecycle via the .playing class on .screen. */
.screen-logo {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    height: 82%;
    width: auto;
    z-index: 0;
    opacity: 0.5;
    image-rendering: pixelated;
    pointer-events: none;
    filter: saturate(0.85) brightness(0.95) drop-shadow(0 0 4px rgba(0, 0, 0, 0.6));
    animation: screen-logo-pulse 2.6s ease-in-out infinite;
}
.screen.playing .screen-logo {
    display: none;
}
/* Animated dancing-snake video shows only when music is ON; otherwise the
   static PNG logo is shown. Both share the .screen-logo look above. The video
   matches the PNG's footprint (object-fit keeps the square video proportional). */
.screen-logo-video {
    object-fit: contain;
    opacity: 0.42;       /* matched to the PNG (source frames are brighter after hole-fill) */
    animation: none;     /* steady: no pulsating */
    /* Slightly larger + nudged left so the video snake matches the PNG. */
    height: 86%;
    transform: translateX(calc(-50% - 10px));
    /* Same look as the PNG (saturate/brightness/shadow) PLUS a tiny blur that
       smooths the residual VP8 compression shimmer in the grey body/glasses
       without visibly softening this 42%-opacity background logo. */
    filter: saturate(0.85) brightness(0.95) blur(0.4px) drop-shadow(0 0 4px rgba(0, 0, 0, 0.6));
    image-rendering: auto;   /* let the blur smooth the shimmer (no pixel snapping) */
}
.screen-logo-video { display: none; }            /* music off (default): hide video */
.screen.music-on .screen-logo-video { display: block; }
.screen.music-on .screen-logo-img { display: none; } /* music on: hide static PNG */
/* Anti-cheat callout: on a flagged run the game-over screen forces the
   red-laser-eyes snake PNG to show over the dancing-snake video. */
.screen.cheated .screen-logo-video { display: none; }
.screen.cheated .screen-logo-img { display: block; }
/* Always hide both logos during active gameplay (highest priority). */
.screen.playing .screen-logo-video,
.screen.playing .screen-logo-img {
    display: none;
}
@keyframes screen-logo-pulse {
    0%, 100% { opacity: 0.42; }
    50% { opacity: 0.6; }
}
/* Keep the message text above the logo backdrop. */
#top-msg, #mid-msg, #main-msg, #sub-msg, .game-over-explanation {
    position: relative;
    z-index: 1;
}

#top-msg { font-size: 12px; color: #ff9d4a; margin-bottom: 5px; }
#mid-msg { font-family: system-ui, sans-serif; font-size: 12px; font-weight: bold; margin-bottom: 10px; }
#main-msg { font-size: 16px; margin-bottom: 10px; }
#sub-msg { font-family: system-ui, sans-serif; font-size: 12px; }

.blink {
    animation: blinker 1s linear infinite;
}
@keyframes blinker {
    50% { opacity: 0; }
}

    align-items: center;
    box-shadow: 0px 4px 0px #9ca3af, 0px 5px 3px rgba(0,0,0,0.4);
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
    position: relative;
    top: 5px;
}
.btn-side:first-child {
    border-radius: 30px 10px 25px 40px;
    transform: rotate(-10deg);
    margin-right: -15px;
    padding-right: 15px;
}
.btn-side:first-child:active {
    transform: rotate(-10deg) translateY(4px);
    box-shadow: 0px 0px 0px #9ca3af, 0px 1px 2px rgba(0,0,0,0.4);
}
.btn-side:last-child {
    border-radius: 10px 30px 40px 25px;
    transform: rotate(10deg);
    margin-left: -15px;
    padding-left: 15px;
}
.btn-side:last-child:active {
    transform: rotate(10deg) translateY(4px);
    box-shadow: 0px 0px 0px #9ca3af, 0px 1px 2px rgba(0,0,0,0.4);
}

/* Old instructions removed */
.game-wrapper {
    display: flex;
    align-items: center;
    gap: 40px;
}

/* Shared Panel Style for Scoreboard and Topic */
.scoreboard-panel, .topic-panel {
    /* Matte plastic casing: fine grayscale grain over the panel color, matching
       the GameBoy phone-casing texture, so the frame around the LCD displays
       reads as physical plastic. */
    background-color: #23272b;
    background-image:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='pnoise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23pnoise)' opacity='0.28'/%3E%3C/svg%3E");
    background-size: 140px 140px;
    background-blend-mode: soft-light;
    border: 2px solid #3a4048;
    border-radius: 20px;
    padding: 20px;
    width: 250px;
    height: 600px;
    color: #dedfe0;
    box-shadow: 10px 10px 30px rgba(0,0,0,0.6);
    display: flex;
    flex-direction: column;
    position: relative;
}

.panel-tab {
    display: none; /* Hidden on desktop */
}
/* Panel titles styled as mini retro LCD screens */
.scoreboard-panel h2, .topic-panel h2 {
    text-align: center;
    margin: 0 0 15px;
    padding: 12px;
    font-size: 12px;
    color: #f6c231;
    font-family: 'Press Start 2P', monospace;
    text-shadow: 1px 1px 0 #27272A;
    background-color: #1a1a1a;
    background-image: linear-gradient(rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, 0.18) 50%);
    background-size: 100% 3px;
    border: 2px solid #27272A;
    border-radius: 8px;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.7);
}

/* Shared retro LCD screen for the topic + score lists */
.topic-list, .score-list {
    background-color: #1a1a1a;
    background-image: linear-gradient(rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, 0.18) 50%);
    background-size: 100% 3px;
    border: 2px solid #27272A;
    border-radius: 8px;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.7);
}

.topic-list {
    list-style: none;
    padding: 12px;
    margin: 0;
    overflow-y: auto;
    flex-grow: 1;
}

.score-list {
    list-style: none;
    padding: 10px;
    margin: 0;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    gap: 6px;
    overflow: hidden; /* No scrollbars */
}

.score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 12px;
    background-color: rgba(0, 0, 0, 0.35); /* translucent so the LCD scanlines show through */
    border-bottom: 2px solid #f6c231;
    border-radius: 8px;
    flex: 1; /* Perfectly distribute available height */
    min-height: 0; /* Allow shrinking if needed */
    max-height: 45px; /* Prevent them from becoming huge when there are few scores */
}

.score-item .rank-info {
    display: flex;
    align-items: center;
    gap: 10px;
    white-space: nowrap;
    text-overflow: ellipsis;
    flex: 1;
    min-width: 0;
}

.score-item .player-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: bold;
    color: var(--rank-color, #f6c231);
    text-shadow: 0 0 4px rgba(0, 0, 0, 0.55);
}

.score-item .score-val {
    color: var(--rank-color, #f6c231);
    font-size: 10px;
    flex-shrink: 0;
    margin-left: 10px;
}

/* Rank colour spectrum drawn from the TEMA topic palette.
   Warm gold (best) flows down through orange, green, teal and blue
   to purple (worst) so a "better colour" reads as a better score. */
.score-item.rank-1  { --rank-color: #ffd343; } /* gold   (python) */
.score-item.rank-2  { --rank-color: #ffb13c; } /* amber           */
.score-item.rank-3  { --rank-color: #ff8c42; } /* orange          */
.score-item.rank-4  { --rank-color: #ff7a52; } /* red-orange (html)*/
.score-item.rank-5  { --rank-color: #98c379; } /* lime   (bash)   */
.score-item.rank-6  { --rank-color: #4caf78; } /* green  (excel)  */
.score-item.rank-7  { --rank-color: #2bb5a8; } /* teal            */
.score-item.rank-8  { --rank-color: #5391fe; } /* blue   (powershell)*/
.score-item.rank-9  { --rank-color: #8a7be0; } /* violet          */
.score-item.rank-10 { --rank-color: #b072c8; } /* purple (csharp) */


/* Retro pixel-art metal medals for the top 3: a chunky octagonal coin
   with hard-edged metal shading bands, a dark pixel outline and a small
   ribbon. No glow, no smooth gradients — flat banded metal. */
.medal {
    position: relative;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    width: 28px;
    height: 28px;
    margin-top: 9px; /* leave room for the ribbon above */
    flex-shrink: 0;
    border-radius: 50%;
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    color: var(--ink);
    text-shadow: 1px 1px 0 var(--ink-hi);
    user-select: none;
    -webkit-user-select: none;
    /* Domed metal coin: hard light->dark bands for a pixel-stamped sheen */
    background:
        linear-gradient(180deg,
            var(--m-hi) 0 30%,
            var(--m-mid) 30% 62%,
            var(--m-lo) 62% 100%);
    image-rendering: pixelated;
    transition: transform 0.08s ease, opacity 0.2s ease;
}
/* Beveled rim + engraved inner ring (concentric pixel rings) */
.medal::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 50%;
    box-shadow:
        inset 0 0 0 2px var(--m-edge),
        inset 0 0 0 3px var(--m-hi),
        inset 0 0 0 5px var(--m-lo);
    pointer-events: none;
}
/* Ribbon bow/knot sitting above the coin (visible by default, fades out
   together with the coin when the medal is switched off). */
.medal::before {
    content: '';
    position: absolute;
    bottom: calc(100% - 6px); /* tucks its lower tips onto the coin's top */
    left: 50%;
    width: 22px;
    height: 14px;
    transform: translateX(-50%);
    background:
        linear-gradient(90deg,
            var(--ribbon-a) 0 50%,
            var(--ribbon-b) 50% 100%);
    /* bowtie knot: two triangular tails meeting at the centre */
    clip-path: polygon(0 0, 50% 55%, 100% 0, 100% 100%, 50% 45%, 0 100%);
}
/* OFF state: the medal vanishes completely (kept for future use; medals are
   currently static and non-interactive) */
.medal.off {
    opacity: 0;
}
.medal-1 {
    /* gold */
    --m-hi: #fff1a8;
    --m-mid: #f0c020;
    --m-lo: #a9760a;
    --m-edge: #5e3f00;
    --ink: #6e4a00;
    --ink-hi: #fff1a8;
    --ribbon-a: #a93226;
    --ribbon-b: #e74c3c;
}
.medal-2 {
    /* silver */
    --m-hi: #ffffff;
    --m-mid: #cfcfcf;
    --m-lo: #8a8a8a;
    --m-edge: #4a4a4a;
    --ink: #555555;
    --ink-hi: #ffffff;
    --ribbon-a: #2c3e50;
    --ribbon-b: #5d6d7e;
}
.medal-3 {
    /* bronze */
    --m-hi: #f2bd8b;
    --m-mid: #cd7f32;
    --m-lo: #834319;
    --m-edge: #4a2408;
    --ink: #5a2f0c;
    --ink-hi: #f2bd8b;
    --ribbon-a: #6b3f18;
    --ribbon-b: #b3692c;
}

/* Plain rank number for places 4+ */
.rank-num {
    display: inline-block;
    width: 24px;
    text-align: center;
    font-family: 'Press Start 2P', monospace;
    font-size: 9px;
    color: var(--rank-color, #f6c231);
    flex-shrink: 0;
}

.topic-item {
    padding: 15px;
    margin-bottom: 10px;
    /* Translucent dark + fine scanlines so the buttons read as part of the LCD screen */
    background-color: rgba(0, 0, 0, 0.35);
    background-image: linear-gradient(rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, 0.18) 50%);
    background-size: 100% 3px;
    border: 2px solid #444;
    border-radius: 10px;
    cursor: pointer;
    text-align: center;
    color: #ff6900;
    font-weight: bold;
    transition: background-color 0.2s ease-in-out;
    user-select: none;
    -webkit-user-select: none;
}
.topic-item:hover {
    background-color: rgba(255, 105, 0, 0.18);
    border-color: #ff6900;
}
.topic-item.active {
    background-color: #f6c231;
    color: #27272A;
    border-color: #f6c231;
    box-shadow: 0 0 15px rgba(246, 194, 49, 0.4);
}

/* Unselected topic text colored to match each sub-topic pill accent */
.topic-item:not(.active)[data-topic="BASH"] { color: #98c379; }
.topic-item:not(.active)[data-topic="POWERSHELL"] { color: #5391fe; }
.topic-item:not(.active)[data-topic="CSHARP"] { color: #b072c8; }
.topic-item:not(.active)[data-topic="EXCEL"] { color: #4caf78; }
.topic-item:not(.active)[data-topic="PYTHON"] { color: #ffd343; }
.topic-item:not(.active)[data-topic="HTML_CSS_JS"] { color: #ff7a52; }

/* Modals */
.name-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(5px);
    z-index: 100;
    justify-content: center;
    align-items: center;
}

.question-modal {
    display: flex;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0,0,0,0.85);
    backdrop-filter: blur(5px);
    z-index: 100;
    justify-content: center;
    align-items: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.question-modal.open {
    opacity: 1;
    visibility: visible;
}

.countdown-modal {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: transparent;
    pointer-events: none;
    z-index: 100;
    justify-content: center;
    align-items: center;
}

.name-modal-content {
    background: #27272A;
    padding: 30px;
    text-align: center;
    color: #F4F4F5;
    border-radius: 20px;
    border: 2px solid #ff9d4a;
    box-shadow: 0 15px 40px rgba(0,0,0,0.8);
}

/* Modal title: plain pixel title (no CRT screen) */
.name-modal-content h2 {
    color: #f6c231;
    text-shadow: 2px 2px 0 #000;
}
.name-modal-content label {
    display: block;
    color: #e0e0e0;
    margin-top: 18px;
}

.name-modal-content input {
    padding: 12px;
    font-size: 16px;
    width: 80%;
    margin: 20px 0;
    /* Plain dark field (scanline texture removed) */
    background-color: #1a1a1a;
    color: #ffd75e;
    text-shadow: 0 0 6px rgba(246, 194, 49, 0.7);
    border: 2px solid #ff8c33;
    border-radius: 8px;
    text-align: center;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.7);
}

.name-modal-content button {
    padding: 15px 30px;
    color: #27272A;
    background: #f6c231;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    transition: 0.2s;
}
.name-modal-content button:hover {
    transform: scale(1.05);
}

.question-modal-content {
    background: #27272A;
    padding: 30px 30px 48px;
    text-align: center;
    color: #F4F4F5;
    position: relative;
    border-radius: 20px;
    border: 2px solid #ff9d4a;
    box-shadow: 0 15px 40px rgba(0,0,0,0.8);
    width: 90%;
    max-width: 600px;
    transform: translateY(-100vh);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.question-modal.open .question-modal-content {
    transform: translateY(0);
}

.q-pohvala {
    color: #ff9d4a;
    font-size: 32px;
    margin-top: 0;
    margin-bottom: 10px;
    display: none;
}

.q-explanation-container {
    display: none;
    margin-bottom: 20px;
    text-align: left;
    background: #18181B;
    padding: 15px;
    border-radius: 10px;
    border-left: 4px solid #f6c231;
}

.go-btn {
    display: none;
    background-color: #22C55E;
    /* Subtle scanlines over the solid colour (texture only, not a screen) */
    background-image: linear-gradient(rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, 0.16) 50%);
    background-size: 100% 3px;
    color: #27272A;
    font-size: 24px;
    font-weight: bold;
    border: none;
    padding: 10px 40px;
    border-radius: 10px;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(34, 197, 94, 0.5);
    transition: transform 0.1s;
}

.go-btn:hover {
    transform: scale(1.05);
}


.timer-text {
    font-size: 24px;
    color: #ff9d4a;
    margin-bottom: 20px;
    font-weight: bold;
}
.q-subtopic {
    display: none;
    position: absolute;
    bottom: 14px;
    right: 24px;
    margin: 0;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 8px;
    font-weight: 700;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    color: #fff;
    background: #52525b;
    border: 1px solid rgba(255, 255, 255, 0.25);
    z-index: 2;
}
.q-subtopic.subtopic-html {
    background: #e34f26;
    border-color: #ff7a52;
}
.q-subtopic.subtopic-css {
    background: #1572b6;
    border-color: #38bdf8;
}
.q-subtopic.subtopic-javascript {
    background: #d9b400;
    border-color: #f7df1e;
    color: #1a1a1a;
}
.q-subtopic.subtopic-bash {
    background: #3e4451;
    border-color: #98c379;
}
.q-subtopic.subtopic-powershell {
    background: #012456;
    border-color: #5391fe;
}
.q-subtopic.subtopic-csharp {
    background: #68217a;
    border-color: #b072c8;
}
.q-subtopic.subtopic-excel {
    background: #217346;
    border-color: #4caf78;
}
.q-subtopic.subtopic-python {
    background: #2b5b84;
    border-color: #ffd343;
}
.question-text {
    font-size: 18px;
    margin-bottom: 30px;
    line-height: 1.5;
    color: #f6c231;
    /* Retro LCD screen look: dark screen + fine scanlines */
    background-color: #1a1a1a;
    background-image: linear-gradient(rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, 0.18) 50%);
    background-size: 100% 3px;
    padding: 18px;
    border: 2px solid #27272A;
    border-radius: 8px;
    box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.7);
}
.answers-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}
.answer-btn {
    background-color: #27272A;
    color: #F4F4F5;
    border: 2px solid #444;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: bold;
    line-height: 1.4;
    transition: 0.2s;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
    -webkit-user-select: none;
    /* Allow long code answers to wrap and the grid cell to shrink,
       so buttons stay inside the modal instead of overflowing. */
    min-width: 0;
    overflow-wrap: break-word;
    word-break: break-word;
}
.answer-btn:hover:not(:disabled) {
    border-color: #ff8c33;
    background-color: #2a2a2a;
}
.answer-btn:disabled {
    pointer-events: none;
}
.answer-btn.correct {
    background-color: #22C55E !important;
    /* Scanline texture over the solid colour (not a display) */
    background-image: linear-gradient(rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, 0.16) 50%) !important;
    background-size: 100% 3px !important;
    color: #27272A !important;
    border-color: #22C55E !important;
    box-shadow: 0 0 15px rgba(34, 197, 94, 0.5);
}
.answer-btn.wrong {
    background-color: #EF4444 !important;
    /* Scanline texture over the solid colour (not a display) */
    background-image: linear-gradient(rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, 0.16) 50%) !important;
    background-size: 100% 3px !important;
    color: #fff !important;
    border-color: #EF4444 !important;
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.5);
}

.countdown-text {
    font-size: 120px;
    color: #f6c231;
    text-shadow: 0px 10px 20px rgba(0,0,0,0.8);
}

/* Responsive Design & Gamepad Controls */
/* 3-column grid: power sits at the exact horizontal centre of the casing,
   D-pad and A/B mirror each other in the equal side columns. */
.gamepad-controls {
    display: grid;
    grid-template-columns: 1fr 30px 1fr;
    align-items: end;
    width: 100%;
    margin-top: 20px;
}

.mobile-dpad {
    position: relative;
    width: 140px;
    height: 140px;
    justify-self: center;
}

/* Embossed dark cross — single matte moulded piece (matches reference) */
.dpad-cross {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    width: 120px; height: 120px;
    pointer-events: none;
    filter: drop-shadow(0 5px 4px rgba(0,0,0,0.55));
}
.dpad-cross-h, .dpad-cross-v {
    position: absolute;
    background: linear-gradient(160deg, #34343a 0%, #232327 48%, #131316 100%);
    border-radius: 6px;
    box-shadow:
        inset 0 1px 1px rgba(255,255,255,0.06),
        inset 0 -5px 6px rgba(0,0,0,0.5);
}
.dpad-cross-h {
    top: 40px; left: 0;
    width: 120px; height: 40px;
}
.dpad-cross-v {
    top: 0; left: 40px;
    width: 40px; height: 120px;
}
.dpad-center-circle {
    position: absolute;
    top: 47px; left: 47px;
    width: 26px; height: 26px;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 38%, #1b1b1f 0%, #0a0a0c 72%);
    box-shadow:
        inset 0 2px 4px rgba(0,0,0,0.7),
        inset 0 -1px 1px rgba(255,255,255,0.05);
}

/* Direction buttons hold large, non-overlapping invisible hit areas
   (a clean 3x3 grid: each edge-centre cell is one direction). */
.dpad-btn {
    position: absolute;
    background: transparent;
    border: none;
    padding: 0;
    margin: 0;
    cursor: pointer;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
}
.dpad-btn.up    { top: 0;       left: 33.333%; width: 33.334%; height: 33.333%; }
.dpad-btn.down  { bottom: 0;    left: 33.333%; width: 33.334%; height: 33.333%; }
.dpad-btn.left  { top: 33.333%; left: 0;       width: 33.333%; height: 33.334%; }
.dpad-btn.right { top: 33.333%; right: 0;      width: 33.333%; height: 33.334%; }

/* Dark engraved arrow glyphs cut into the cross arms */
.dpad-arrow {
    font-size: 13px;
    line-height: 1;
    color: #141418;
    text-shadow: 0 1px 0 rgba(255,255,255,0.10);
    pointer-events: none;
}

/* 3D press feedback — subtle darken only, no movement */
.dpad-btn:active .dpad-arrow {
    color: #050506;
    text-shadow: 0 1px 0 rgba(255,255,255,0.06);
}

/* Empty spacer column (power button removed) keeps D-pad and A/B fixed. */
.mobile-power {
    width: 30px;
    height: 1px;
}

.mobile-ab {
    display: flex;
    align-items: flex-end;
    gap: 15px;
    justify-self: center;
    margin-bottom: 10px;
}

.ab-btn {
    width: 50px;
    height: 48px;
    border-radius: 50%;
    background: radial-gradient(circle at 50% 30%, #2c2c31 0%, #1a1a1d 60%, #101012 100%);
    border: none;
    color: #e0a92e;
    font-family: 'Press Start 2P', monospace;
    font-size: 14px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0px 4px 0px #0a0a0c, 0px 5px 4px rgba(0,0,0,0.45), inset 0 1px 1px rgba(255,255,255,0.05);
    transition: transform 0.1s, box-shadow 0.1s;
    user-select: none;
    -webkit-user-select: none;
    touch-action: manipulation;
    text-shadow: 0 1px 1px rgba(0,0,0,0.7);
}

/* A sits up and to the right of B (diagonal, like the reference) */
.mobile-ab .ab-btn:last-child {
    margin-bottom: 32px;
}

.ab-btn:active {
    transform: translateY(4px);
    box-shadow: 0px 0px 0px #0a0a0c, 0px 1px 2px rgba(0,0,0,0.5), inset 0 1px 1px rgba(255,255,255,0.05);
}

@media (max-width: 950px) {
    body {
        height: auto;
        padding: 20px 0;
        overflow-x: hidden;
    }
    
    .game-wrapper {
        justify-content: center;
    }
    
    /* Mobile Slide-Out Panels */
    .scoreboard-panel, .topic-panel {
        position: fixed;
        top: 50%;
        transform: translateY(-50%);
        z-index: 1000;
        transition: left 0.3s ease, right 0.3s ease;
        height: 80vh;
        max-height: 600px;
        width: 300px;
    }
    
    .scoreboard-panel {
        left: -300px; /* Hide off screen */
    }
    .scoreboard-panel.open {
        left: 0;
    }
    
    .topic-panel {
        right: -300px; /* Hide off screen */
    }
    .topic-panel.open {
        right: 0;
    }
    
    .panel-tab {
        display: flex;
        position: absolute;
        top: 50%;
        /* Woven nylon-strap fabric: cross-hatched warp/weft threads over a
           muted orange (softer so the black text contrast is gentler), with a
           soft sheen so it reads like a webbing wrist wrap from the panel. */
        background-color: #d97a38;
        background-image:
            repeating-linear-gradient(45deg, rgba(0, 0, 0, 0.12) 0 1px, transparent 1px 3px),
            repeating-linear-gradient(-45deg, rgba(0, 0, 0, 0.12) 0 1px, transparent 1px 3px),
            repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.12) 0 1px, transparent 1px 2px);
        color: #1a1a1a;
        font-weight: bold;
        font-size: 14px;
        padding: 20px 10px;
        cursor: pointer;
        writing-mode: vertical-rl;
        text-align: center;
        border: 2px solid #32373c;
        z-index: 1001;
        font-family: 'Press Start 2P', monospace;
        user-select: none;
        -webkit-user-select: none;
    }
    /* Overlock stitching line along the nylon edge */
    .panel-tab::after {
        content: '';
        position: absolute;
        inset: 4px;
        border: 1px dashed rgba(0, 0, 0, 0.4);
        border-radius: inherit;
        pointer-events: none;
    }
    /* Retro brushed-metal seam bridging the panel and the nylon strap,
       so the two read as one seamless attached piece (the straight edge
       of every tab is its local-left, which faces the panel). */
    .panel-tab::before {
        content: '';
        position: absolute;
        top: -2px;
        bottom: -2px;
        left: -6px;
        width: 6px;
        background:
            repeating-linear-gradient(0deg, rgba(0,0,0,0.18) 0 1px, transparent 1px 3px),
            linear-gradient(90deg, #5a6066 0%, #aeb4ba 35%, #e6eaed 50%, #aeb4ba 65%, #5a6066 100%);
        border: 2px solid #32373c;
        border-radius: 3px;
        box-shadow: 1px 0 3px rgba(0, 0, 0, 0.45);
        z-index: 1002;
        pointer-events: none;
    }
    
    .left-tab {
        right: -36px; /* overlap 2px into the panel to seal the seam */
        border-radius: 0 10px 10px 0;
        border-left: none; /* flush against the panel it extends from */
        transform: translateY(-50%);
        box-shadow: 4px 3px 9px rgba(0, 0, 0, 0.45);
    }
    
    .right-tab {
        left: -36px; /* overlap 2px into the panel to seal the seam */
        border-radius: 0 10px 10px 0;
        border-left: none; /* flush against the panel it extends from */
        transform: translateY(-50%) rotate(180deg);
        box-shadow: 4px 3px 9px rgba(0, 0, 0, 0.45);
    }

    .answers-grid {
        grid-template-columns: 1fr; /* Stack answers vertically on mobile */
    }
    
    
    .phone-casing {
        height: auto;
        padding-bottom: 40px;
    }
    
    .question-modal-content, .name-modal-content {
        padding: 15px;
        width: 95%;
    }
    .question-modal-content {
        padding-bottom: 42px;
    }
    
    .timer-text {
        font-size: 20px;
        margin-bottom: 10px;
    }
    
    .question-text {
        font-size: 14px;
        margin-bottom: 15px;
    }

    .signature-dock {
        bottom: 10px;
    }
}


/* School Branding — sliding retro metal plate with a nylon INFO tab */
.signature-dock {
    position: fixed;
    left: 0;
    bottom: 20px;
    z-index: 100;
    display: flex;
    align-items: stretch;
    transition: transform 0.45s cubic-bezier(0.22, 0.61, 0.36, 1);
}
/* Collapsed: slide left until only the tab pokes out (tab ≈ 30px wide) */
.signature-dock.collapsed {
    transform: translateX(calc(-100% + 30px));
}

.school-branding {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px 18px;
    font-family: system-ui, -apple-system, sans-serif;
    color: #1f2429;
    font-size: 7px;
    /* Brushed retro metal plate: vertical sheen + fine machined ridges,
       with four corner rivets. */
    background-color: #b9bec3;
    background-image:
        radial-gradient(circle at 9px 9px, #6b7177 0 2px, transparent 2px),
        radial-gradient(circle at 9px calc(100% - 9px), #6b7177 0 2px, transparent 2px),
        radial-gradient(circle at calc(100% - 9px) 9px, #6b7177 0 2px, transparent 2px),
        radial-gradient(circle at calc(100% - 9px) calc(100% - 9px), #6b7177 0 2px, transparent 2px),
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.22) 0 1px, transparent 1px 3px),
        linear-gradient(180deg, #d9dde0 0%, #aab0b6 55%, #8e949a 100%);
    border: 2px solid #4f555b;
    border-left: none;
    border-radius: 0 10px 10px 0;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

.school-logo {
    width: 50px;
    height: auto;
    border-radius: 5px;
    background: white;
    padding: 3px;
    box-shadow: 0 2px 5px rgba(0,0,0,0.5);
}

/* Snake game logo (transparent PNG) above the RB school logo */
.school-logo-stack {
    position: relative;
    flex-shrink: 0;
    display: flex;
}
.brand-snake-logo {
    position: absolute;
    width: 60px;
    height: 60px;
    left: 50%;
    bottom: 45px;
    transform: translateX(-50%);
    image-rendering: pixelated;
    pointer-events: none;
    opacity: 0.85;
}

.school-desc {
    text-align: left;
}

.school-desc a {
    color: #23272b;
    text-decoration: none;
    font-weight: bold;
    display: inline-block;
    padding: 8px 0;
}
.school-desc a:hover {
    color: #b34700;
    text-decoration: underline;
}

.turnstile-policy-link {
    font-size: 0.8em;
    opacity: 0.7;
    display: block;
    margin-top: 5px;
}

/* Nylon INFO tab on the right side of the metal plate */
.signature-tab {
    align-self: center;
    position: relative;
    /* Woven nylon-strap fabric over muted orange (matches the panel tabs) */
    background-color: #d97a38;
    background-image:
        repeating-linear-gradient(45deg, rgba(0, 0, 0, 0.12) 0 1px, transparent 1px 3px),
        repeating-linear-gradient(-45deg, rgba(0, 0, 0, 0.12) 0 1px, transparent 1px 3px),
        repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.12) 0 1px, transparent 1px 2px);
    color: #1a1a1a;
    font-weight: bold;
    font-size: 12px;
    font-family: 'Press Start 2P', monospace;
    padding: 16px 8px;
    writing-mode: vertical-rl;
    text-align: center;
    border: 2px solid #32373c;
    border-left: none;
    border-radius: 0 10px 10px 0;
    box-shadow: 4px 3px 9px rgba(0, 0, 0, 0.45);
    cursor: pointer;
    user-select: none;
    -webkit-user-select: none;
}
/* Retro brushed-metal seam connecting the plate and the nylon tab */
.signature-tab::before {
    content: '';
    position: absolute;
    top: -2px;
    bottom: -2px;
    left: -6px;
    width: 6px;
    background:
        repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.18) 0 1px, transparent 1px 3px),
        linear-gradient(90deg, #5a6066 0%, #aeb4ba 35%, #e6eaed 50%, #aeb4ba 65%, #5a6066 100%);
    border: 2px solid #32373c;
    border-radius: 3px;
    box-shadow: 1px 0 3px rgba(0, 0, 0, 0.45);
    z-index: 2;
    pointer-events: none;
}

/* Utility classes replacing inline styles */
.hidden { display: none !important; }
.no-margin-top { margin-top: 0 !important; }
.teaching-panel-buttons { display: flex; gap: 15px; justify-content: center; align-items: center; margin-top: 15px; }
.q-panel-buttons { display: flex; gap: 15px; justify-content: center; align-items: center; margin-top: 20px; }
.msg-top { font-size: 12px; margin-bottom: 2px; }
.msg-mid { font-size: 12px; margin-bottom: 5px; }
.game-over-explanation { display: none; font-size: 10px; margin-top: 10px; background: rgba(0,0,0,0.8); padding: 5px; border-radius: 4px; color: #F4F4F5; border-left: 2px solid #ff6900; line-height: 1.2; }
.q-explanation-text { font-size: 16px; margin-bottom: 10px; }
.q-example-text { font-size: 14px; color: #A1A1AA; }
.endless-glow { filter: drop-shadow(0 0 10px #ff0000); }
