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

/* Safe areas: CSS variables so the test-only ?insets= can override them */
:root {
    --sa-l: env(safe-area-inset-left, 0px);
    --sa-t: env(safe-area-inset-top, 0px);
    --sa-r: env(safe-area-inset-right, 0px);
    --sa-b: env(safe-area-inset-bottom, 0px);
    --vh: 100dvh;
    --btn: 68px;
    --yellow: #f2d33a;
    --ui-dark: #1d3a1f;
    --logo-bottom: 300px;
}

html, body {
    height: 100%;
}

body {
    font-family: 'Courier New', monospace;
    background: linear-gradient(135deg, #1a4d2e 0%, #0f2615 100%);
    color: #fff;
    overflow: hidden;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    overscroll-behavior: none;
}

[hidden] { display: none !important; }

#insetProbe {
    position: fixed;
    left: 0; top: 0;
    width: 0; height: 0;
    visibility: hidden;
    pointer-events: none;
    padding: var(--sa-t) var(--sa-r) var(--sa-b) var(--sa-l);
}

.glyph {
    width: 1em;
    height: 1em;
    fill: currentColor;
    vertical-align: -0.12em;
    shape-rendering: crispEdges;
    flex-shrink: 0;
}

button .glyph { margin-right: 0.4em; }

h1, h2, h3, p, button { text-wrap: balance; }

#gameContainer {
    width: 100vw;
    height: var(--vh);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Screens */
.screen {
    display: none;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    padding: 20px;
    overflow-y: auto;
}

.screen.active {
    display: flex;
}

/* Title Screen */
#titleScreen {
    background: radial-gradient(circle, rgba(26,77,46,0.9) 0%, rgba(15,38,21,0.95) 100%);
    text-align: center;
}

#titleScreen h1 {
    font-size: clamp(2rem, 8vw, 4rem);
    text-shadow: 3px 3px 6px rgba(0,0,0,0.8),
                 0 0 20px rgba(76,175,80,0.5);
    margin-bottom: 10px;
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}

.subtitle {
    font-size: clamp(1rem, 3vw, 1.5rem);
    color: #4CAF50;
    margin-bottom: 30px;
}

.game-btn {
    background: linear-gradient(135deg, #4CAF50 0%, #45a049 100%);
    color: white;
    border: 3px solid #2d6a2f;
    padding: 15px 40px;
    font-size: clamp(1rem, 3vw, 1.5rem);
    font-weight: bold;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    font-family: 'Courier New', monospace;
}

.game-btn:hover {
    background: linear-gradient(135deg, #45a049 0%, #4CAF50 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.4);
}

.game-btn:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

/* Game Screen */
#gameScreen {
    background: #1a4d2e;
}

/* HUD */
#hud {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
    pointer-events: none;
    flex-wrap: wrap;
}

.player-hud {
    background: rgba(0, 0, 0, 0.7);
    padding: 10px;
    border-radius: 8px;
    border: 2px solid #4CAF50;
    min-width: 150px;
}

.hud-top {
    display: flex;
    gap: 10px;
    align-items: center;
}

.player-portrait {
    width: 60px;
    height: 60px;
    object-fit: contain;
    image-rendering: pixelated;
    flex-shrink: 0;
}

.hud-info {
    flex: 1;
    min-width: 0;
}

.player-name {
    font-size: clamp(0.9rem, 2.5vw, 1.2rem);
    font-weight: bold;
    margin-bottom: 5px;
}

.health-bar {
    width: 100%;
    height: 20px;
    background: rgba(255, 0, 0, 0.3);
    border: 2px solid #fff;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 5px;
}

.health-fill {
    height: 100%;
    background: linear-gradient(90deg, #4CAF50 0%, #45a049 100%);
    width: 100%;
    transition: width 0.3s ease;
}

.combo {
    font-size: clamp(0.8rem, 2vw, 1rem);
    color: #FFD700;
}

.wave-info {
    background: rgba(0, 0, 0, 0.7);
    padding: 10px 20px;
    border-radius: 8px;
    border: 2px solid #FFD700;
    text-align: center;
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
}

.pause-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.pause-content {
    text-align: center;
    color: white;
}

.pause-content h2 {
    font-size: 4rem;
    margin: 0 0 20px 0;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.8);
}

.pause-content p {
    font-size: 1.5rem;
    margin: 0;
    opacity: 0.8;
}

#waveNumber {
    font-size: clamp(1rem, 3vw, 1.5rem);
    font-weight: bold;
    color: #FFD700;
}

#enemyCount {
    font-size: clamp(0.8rem, 2vw, 1rem);
    color: #fff;
}

#desktopControls {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 40px;
    justify-content: center;
    align-items: center;
    padding: 12px 24px;
    background: rgba(0, 0, 0, 0.7);
    border-radius: 8px;
    font-size: 14px;
    color: #fff;
    z-index: 10;
}

.control-hint {
    display: flex;
    gap: 8px;
    align-items: center;
}

.player-label {
    font-weight: bold;
    padding: 4px 8px;
    border-radius: 4px;
}

.keys {
    background: rgba(255, 255, 255, 0.2);
    padding: 4px 8px;
    border-radius: 4px;
    font-weight: bold;
    font-family: monospace;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Game Over Screen */
#gameOverScreen {
    text-align: center;
}

.game-over-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: 0;
}

.game-over-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle, rgba(76,175,80,0.4) 0%, rgba(76,175,80,0.6) 100%);
    z-index: 1;
}

.game-over-logo {
    width: clamp(300px, 60vw, 550px);
    max-width: 90%;
    display: block;
    margin: 0 auto 10px;
    filter: drop-shadow(3px 3px 6px rgba(0,0,0,0.8));
}

.game-over-scores-wrapper {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    justify-items: center;
    gap: 15px;
    margin: 15px 0;
}

.game-over-snake-portrait {
    width: 70px !important;
    height: 70px !important;
    object-fit: contain;
    image-rendering: pixelated;
    filter: drop-shadow(2px 2px 4px rgba(0,0,0,0.8));
    justify-self: end;
    position: static !important;
    left: auto !important;
    top: auto !important;
}

.game-over-snake-portrait.rolling {
    animation: rollOnce 0.6s linear;
}

.game-over-snake-portrait.jumping {
    animation: jumpOnce 0.5s ease-out;
}

.game-over-scores-center {
    text-align: center;
}

.game-over-spacer {
    width: 70px;
}

#gameOverScreen h1 {
    font-size: clamp(2rem, 8vw, 4rem);
    color: #ff6b6b;
    text-shadow: 3px 3px 6px rgba(0,0,0,0.8);
    margin-bottom: 20px;
}

#finalScore, #finalWave {
    font-size: clamp(1.2rem, 4vw, 2rem);
    margin: 15px 0;
    color: #FFD700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
}

.frog-counts {
    margin: 20px 0;
    padding: 15px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 10px;
    border: 2px solid rgba(76, 175, 80, 0.4);
}

.frog-counts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
    gap: 10px;
}

.frog-counts h3 {
    font-size: clamp(1rem, 3vw, 1.5rem);
    color: #4CAF50;
    margin: 0;
    flex: 1;
    text-align: center;
}

.parade-control-btn {
    background: rgba(76, 175, 80, 0.3);
    border: 2px solid rgba(76, 175, 80, 0.5);
    color: #4CAF50;
    padding: 6px 12px;
    border-radius: 5px;
    cursor: pointer;
    font-size: clamp(0.85rem, 2.5vw, 1rem);
    font-weight: bold;
    font-family: 'Courier New', monospace;
    transition: all 0.2s;
    min-width: 40px;
    width: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.parade-control-btn:hover {
    background: rgba(76, 175, 80, 0.5);
    border-color: #4CAF50;
    transform: scale(1.05);
}

.parade-control-btn:active {
    transform: scale(0.95);
}

#paradeReplayBtn {
    font-size: clamp(1.2rem, 3vw, 1.5rem);
}

#paradeReplayBtn.rotating {
    animation: rotateOnce 0.5s ease-in-out;
}

@keyframes rotateOnce {
    from {
        transform: rotate(0deg);
    }
    to {
        transform: rotate(360deg);
    }
}

@keyframes rollOnce {
    from {
        transform: rotate(0deg) scale(0.8);
    }
    to {
        transform: rotate(360deg) scale(0.8);
    }
}

@keyframes jumpOnce {
    0% { transform: translateY(0); }
    50% { transform: translateY(-100px); }
    100% { transform: translateY(0); }
}

.frog-count-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    max-width: 400px;
    margin: 0 auto;
}

.frog-count-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 5px;
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
}

.frog-icon {
    height: 32px;
    width: auto;
    image-rendering: crisp-edges;
    image-rendering: pixelated;
    filter: drop-shadow(2px 2px 2px rgba(0, 0, 0, 0.5));
}

.frog-count-item span {
    color: #FFD700;
    font-weight: bold;
    font-size: clamp(1rem, 3vw, 1.3rem);
}

@media (max-width: 500px) {
    .frog-count-grid {
        grid-template-columns: 1fr;
    }
}

.game-over-content {
    position: relative;
    z-index: 2;
    pointer-events: auto;
    margin-top: -50px;
}

.game-over-buttons {
    display: flex;
    gap: 15px;
    margin-top: 20px;
    justify-content: center;
    flex-wrap: wrap;
}

.secondary-btn {
    background: linear-gradient(135deg, #666 0%, #555 100%);
    border-color: #444;
}

.secondary-btn:hover {
    background: linear-gradient(135deg, #555 0%, #666 100%);
}

.share-btn {
    background: linear-gradient(135deg, #2196F3 0%, #1976D2 100%);
    border-color: #0D47A1;
}

.share-btn:hover {
    background: linear-gradient(135deg, #1976D2 0%, #2196F3 100%);
}

.share-feedback {
    position: absolute;
    bottom: -50px;
    left: 50%;
    transform: translateX(-50%);
    padding: 10px 20px;
    background: rgba(76, 175, 80, 0.9);
    color: white;
    border-radius: 5px;
    font-weight: bold;
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    animation: fadeInOut 2s ease-in-out;
    white-space: nowrap;
}

@keyframes fadeInOut {
    0% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
    20% { opacity: 1; transform: translateX(-50%) translateY(0); }
    80% { opacity: 1; transform: translateX(-50%) translateY(0); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-10px); }
}

.shared-result-banner {
    padding: 8px 16px;
    background: rgba(33, 150, 243, 0.9);
    color: white;
    border-radius: 5px;
    font-weight: bold;
    font-size: clamp(0.85rem, 2.5vw, 1rem);
    margin-bottom: 15px;
    display: inline-block;
}

#paradeCanvas {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    image-rendering: crisp-edges;
    image-rendering: pixelated;
}

/* Version Number */
#version {
    position: fixed;
    bottom: 10px;
    right: 10px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
    font-family: 'Courier New', monospace;
    z-index: 1000;
    pointer-events: none;
}


/* Audio Toggle Button */
.audio-toggle {
    position: fixed;
    bottom: 10px;
    left: 10px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid rgba(76, 175, 80, 0.5);
    cursor: pointer;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    transition: all 0.3s ease;
    padding: 0;
}

.audio-toggle:hover {
    background: rgba(0, 0, 0, 0.9);
    border-color: #4CAF50;
    transform: scale(1.1);
}

.audio-toggle:active {
    transform: scale(0.95);
}

.audio-icon {
    display: none;
    line-height: 1;
}

/* Show muted icon by default */
.audio-toggle .audio-icon.muted {
    display: block;
}

/* When unmuted, show unmuted icon */
.audio-toggle.unmuted .audio-icon.muted {
    display: none;
}

.audio-toggle.unmuted .audio-icon.unmuted {
    display: block;
}

/* Audio Tooltip */
.audio-tooltip {
    position: absolute;
    bottom: 60px;
    left: 0;
    background: rgba(0, 0, 0, 0.9);
    color: #fff;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 1001;
}

.audio-toggle:hover .audio-tooltip {
    opacity: 1;
}

/* Volume Control Menu */
.volume-menu {
    position: fixed;
    bottom: 70px;
    left: 10px;
    background: rgba(0, 0, 0, 0.95);
    border: 2px solid #4CAF50;
    border-radius: 12px;
    padding: 16px;
    min-width: 220px;
    display: none;
    z-index: 1001;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

.volume-menu.visible {
    display: block;
}

.volume-menu-header {
    font-size: 1.1rem;
    font-weight: bold;
    color: #4CAF50;
    margin-bottom: 12px;
    text-align: center;
}

.volume-control {
    margin-bottom: 12px;
}

.volume-control:last-child {
    margin-bottom: 0;
}

.volume-control label {
    display: block;
    color: #fff;
    font-size: 0.9rem;
    margin-bottom: 6px;
    font-family: 'Courier New', monospace;
}

.volume-control input[type="range"] {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.2);
    outline: none;
    -webkit-appearance: none;
    cursor: pointer;
}

.volume-control input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #4CAF50;
    cursor: pointer;
    transition: background 0.2s;
}

.volume-control input[type="range"]::-webkit-slider-thumb:hover {
    background: #45a049;
}

.volume-control input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #4CAF50;
    cursor: pointer;
    border: none;
    transition: background 0.2s;
}

.volume-control input[type="range"]::-moz-range-thumb:hover {
    background: #45a049;
}


/* ================= Title ================= */
/* Until the title's pictures are in: just a quiet loading line, nothing to jump later */
body:not(.ready) #titleScreen .title-overlay,
body:not(.ready) #audioToggle,
body:not(.ready) #version { visibility: hidden; }
body:not(.ready) #gameContainer {
    background: radial-gradient(circle, #1a4d2e 0%, #0f2615 100%);
}
body:not(.ready) #gameContainer::after {
    content: 'Loading\2026  ' attr(data-loading);
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    color: var(--yellow);
    font-weight: bold;
    font-size: clamp(1.25rem, 4vw, 1.75rem);
    letter-spacing: 0.06em;
    white-space: nowrap;
    text-shadow: 2px 2px 0 var(--ui-dark);
}


#titleCanvas {
    position: absolute;
    top: 0;
    left: 0;
    z-index: 0;
}

#titleScreen {
    justify-content: flex-start;
    padding: 0;
    overflow: hidden;
}

#titleScreen .title-overlay {
    position: absolute;
    left: 0;
    right: 0;
    top: calc(var(--logo-bottom) + 12px);
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 0 16px;
    pointer-events: none;
}

#titleScreen .title-overlay > * { pointer-events: auto; }

.title-best {
    font-size: clamp(0.95rem, 2.4vw, 1.2rem);
    font-weight: bold;
    color: #FFD700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.9);
}

.press-any {
    font-size: 0.85rem;
    color: rgba(255,255,255,0.85);
    text-shadow: 1px 1px 3px rgba(0,0,0,0.9);
}

.sound-hint {
    font-size: 0.9rem;
    color: var(--yellow);
    background: rgba(0,0,0,0.6);
    padding: 4px 10px;
    border-radius: 6px;
}

.title-links {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: center;
}

.link-btn {
    background: rgba(0,0,0,0.55);
    color: #fff;
    border: 2px solid rgba(76,175,80,0.7);
    border-radius: 8px;
    padding: 8px 16px;
    min-height: 44px;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: clamp(0.9rem, 2.2vw, 1.05rem);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
}

.link-btn:hover { border-color: #4CAF50; background: rgba(0,0,0,0.75); }
.link-btn .glyph { color: var(--yellow); }

/* How to play: a panel that opens on demand */
#instructions {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1500;
    background: rgba(0,0,0,0.6);
    align-items: center;
    justify-content: center;
    padding: max(10px, var(--sa-t)) max(10px, var(--sa-r)) max(10px, var(--sa-b)) max(10px, var(--sa-l));
}

#instructions.expanded { display: flex; }

.instructions-box {
    background: rgba(10, 30, 15, 0.95);
    border: 2px solid #4CAF50;
    border-radius: 12px;
    width: min(760px, 100%);
    max-height: 100%;
    display: flex;
    flex-direction: column;
    padding: 14px 18px;
}

.instructions-header {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-bottom: 6px;
}

#instructions h2 {
    font-size: clamp(1.3rem, 4vw, 1.8rem);
    color: #4CAF50;
}

.close-instructions-btn {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255,255,255,0.12);
    border: 2px solid rgba(255,255,255,0.35);
    color: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
}

.close-instructions-btn .glyph { margin: 0; }

.instructions-content {
    overflow-y: auto;
    text-align: center;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}

#instructions h3 {
    font-size: clamp(1rem, 3vw, 1.2rem);
    margin: 10px 0 4px;
    color: #76d275;
}

#instructions p {
    font-size: clamp(0.85rem, 2.3vw, 1rem);
    margin: 5px 0;
    line-height: 1.5;
}

.tip-icon {
    height: 1.4em;
    width: auto;
    vertical-align: middle;
    image-rendering: auto;
}

.pad-note { color: var(--yellow); }

/* Which words show: keys, touch or controller (whatever was used last) */
.for-keys, .for-touch, .for-pad, .hint-pad { display: none; }
body[data-hints="keys"] .for-keys,
body[data-hints="touch"] .for-touch,
body[data-hints="pad"] .for-pad,
body.pad-seen .for-pad { display: block; }
body[data-hints="pad"] .hint-keys { display: none; }
body[data-hints="pad"] .hint-pad { display: inline; }
body.touch-mode .press-any .hint-keys { display: none; }
body.pad-seen .hint-pad-unseen,
body.touch-mode .hint-pad-unseen { display: none; }
body.touch-mode:not(.pad-seen) .press-any { display: none; }

/* Controller button names */
.pad-btn {
    display: inline-flex;
    align-items: center;
    vertical-align: -0.2em;
}
.pad-text {
    font-weight: bold;
    background: var(--ui-dark);
    color: var(--yellow);
    border: 1px solid var(--yellow);
    border-radius: 4px;
    padding: 0 5px;
    line-height: 1.3;
    font-size: 0.9em;
}

/* The controller's focus ring */
body.input-gamepad .pad-focus {
    outline: 3px solid var(--yellow) !important;
    outline-offset: 3px;
    box-shadow: 0 0 0 6px rgba(242, 211, 58, 0.25), 0 4px 10px rgba(0,0,0,0.5);
}

/* ================= Game screen ================= */
#gameScreen {
    padding: 0;
    overflow: hidden;
}

#gameCanvas {
    position: absolute;
    display: block;
    background: #2d5f3f;
    box-shadow: 0 0 30px rgba(0,0,0,0.8);
    outline: 3px solid #1a3a2a;
}

body.touch-mode #gameCanvas {
    outline: none;
    box-shadow: none;
}

.combo-star {
    height: 1.1em;
    width: auto;
    vertical-align: -0.2em;
    margin-left: 4px;
    opacity: 0;
}

.combo-star.pulse { animation: starPulse 0.6s ease-out; }

@keyframes starPulse {
    0% { opacity: 0; transform: scale(0.4); }
    30% { opacity: 1; transform: scale(1.5); }
    100% { opacity: 0; transform: scale(1); }
}

.hud-buttons {
    position: absolute;
    top: 0;
    right: 0;
    display: flex;
    gap: 6px;
    pointer-events: auto;
}

.hud-btn {
    width: 44px;
    height: 44px;
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.6);
    border: 2px solid rgba(242, 211, 58, 0.7);
    color: var(--yellow);
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
}

.hud-btn .glyph { margin: 0; }

.touch-only { display: none !important; }
body.touch-mode .touch-only { display: flex !important; }
body.touch-mode .desktop-only { display: none !important; }

/* Pause */
.pause-content h2 { font-size: clamp(2.2rem, 9vw, 4rem); margin-bottom: 10px; }
.pause-hint { font-size: 1.1rem; opacity: 0.85; margin-bottom: 8px; }
.pad-lost { color: #ff8a80; font-weight: bold; margin-bottom: 8px; }
.pause-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: stretch;
    width: min(320px, 80vw);
    margin: 10px auto 0;
}
.pause-buttons .game-btn { padding: 10px 20px; font-size: clamp(1rem, 2.6vw, 1.25rem); display: flex; align-items: center; justify-content: center; }
.pause-buttons .glyph { color: var(--yellow); }
body.touch-mode .pause-hint .hint-keys { display: none; }

.countdown {
    position: absolute;
    left: 50%;
    top: 40%;
    transform: translate(-50%, -50%);
    font-size: clamp(4rem, 18vh, 8rem);
    font-weight: bold;
    color: var(--yellow);
    text-shadow: 4px 4px 0 var(--ui-dark), 0 0 20px rgba(0,0,0,0.8);
    pointer-events: none;
    z-index: 900;
}

/* Touch: slim HUD across the top */
body.touch-mode #hud {
    top: max(4px, var(--sa-t));
    left: max(6px, var(--sa-l));
    right: max(6px, var(--sa-r));
    align-items: flex-start;
    flex-wrap: nowrap;
    font-size: 0.8rem;
}
body.touch-mode .player-hud { padding: 4px 8px; min-width: 0; border-width: 2px; }
body.touch-mode .player-portrait { width: 34px; height: 34px; }
body.touch-mode .hud-top { gap: 6px; }
body.touch-mode .player-name { display: none; }
body.touch-mode .health-bar { width: 110px; height: 12px; margin-bottom: 2px; border-width: 1px; }
body.touch-mode .combo { font-size: 0.8rem; }
body.touch-mode .wave-info { padding: 3px 12px; top: 0; }
body.touch-mode #waveNumber { font-size: 0.95rem; }
body.touch-mode #enemyCount { font-size: 0.8rem; }
body.touch-mode .hud-buttons { right: 50px; }
body.touch-mode[data-screen="game"] #audioToggle {
    top: max(4px, var(--sa-t));
    right: max(6px, var(--sa-r));
    left: auto;
    bottom: auto;
    width: 44px;
    height: 44px;
    border-radius: 8px;
}
body.touch-mode[data-screen="game"] #version { display: none; }
body.touch-mode .audio-tooltip { display: none; }

/* Touch: floating stick in the left 40%, Roll and Whip bottom right */
#mobileControls {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 50;
}

#stickArea {
    position: absolute;
    left: 0;
    top: calc(max(4px, var(--sa-t)) + 56px);
    bottom: 0;
    width: 40%;
    pointer-events: auto;
    touch-action: none;
}

#stickBase {
    position: fixed;
    left: 0;
    top: 0;
    width: 110px;
    height: 110px;
    border-radius: 50%;
    border: 3px solid rgba(242, 211, 58, 0.75);
    background: rgba(29, 58, 31, 0.35);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.12s;
}
#stickBase.visible { opacity: 1; }
#stickBase.faded { opacity: 0.25; transition: opacity 0.15s; }

#stickKnob {
    position: absolute;
    left: 31px;
    top: 31px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(242, 211, 58, 0.9);
    border: 3px solid var(--ui-dark);
}

#stickHint {
    position: absolute;
    left: calc(max(8px, var(--sa-l)) + 40px);
    bottom: 6px;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    border: 3px solid rgba(242, 211, 58, 0.4);
    opacity: 0;
    pointer-events: none;
}
#stickHint.visible { opacity: 1; }

.action-buttons {
    position: absolute;
    right: max(8px, var(--sa-r));
    bottom: 5px;
    display: flex;
    gap: 8px;
    pointer-events: auto;
}

.action-btn {
    width: var(--btn);
    height: var(--btn);
    border-radius: 50%;
    background: rgba(29, 58, 31, 0.7);
    border: 3px solid rgba(242, 211, 58, 0.85);
    color: var(--yellow);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0;
    touch-action: none;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 10px;
    line-height: 1;
    transition: transform 0.06s, opacity 0.15s;
    -webkit-user-select: none;
    user-select: none;
}

.action-btn img {
    width: 62%;
    height: auto;
    pointer-events: none;
    image-rendering: auto;
}

.action-btn span { margin-top: 1px; pointer-events: none; }
.action-btn.pressed { transform: scale(0.9); background: rgba(29, 58, 31, 0.9); }
.action-btn.faded { opacity: 0.25; }
.icon-blaze { display: none; }
body[data-snake="blaze"] .icon-blaze { display: block; }
body[data-snake="blaze"] .icon-jade { display: none; }

/* Turn your phone */
.turn-overlay {
    position: fixed;
    inset: 0;
    z-index: 1200;
    background: #0a190e;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
}
.turn-overlay[hidden] { display: none; }
.turn-pic { width: 128px; height: 128px; }
.turn-main { font-size: 1.5rem; font-weight: bold; margin: 12px 0 8px; color: #fff; }
.turn-sub { font-size: 0.95rem; opacity: 0.8; margin-bottom: 20px; }

/* ================= Game over ================= */
.game-over-buttons .glyph { color: #fff; }
.parade-control-btn { color: var(--yellow); min-height: 36px; }
.parade-control-btn .glyph { margin: 0; }
.parade-control-btn .chev { width: 0.5em; height: 1em; fill: currentColor; display: none; }
.parade-control-btn[data-speed="1"] .c1,
.parade-control-btn[data-speed="2"] .c1, .parade-control-btn[data-speed="2"] .c2,
.parade-control-btn[data-speed="3"] .chev { display: block; }

#finalBest {
    font-size: clamp(1rem, 3vw, 1.4rem);
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.8);
    margin: 6px 0;
}

.new-best {
    color: var(--yellow);
    font-weight: bold;
    margin-left: 6px;
    display: inline-block;
}
.new-best.flash { animation: bestFlash 0.9s ease-out 2; }
@keyframes bestFlash {
    0% { transform: scale(0.6); opacity: 0; }
    40% { transform: scale(1.3); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

.share-feedback { display: block; }
.share-feedback[hidden] { display: none; }
.share-feedback.show { animation: fadeInOut 2s ease-in-out; }
.share-link {
    display: block;
    margin: 10px auto 0;
    width: min(520px, 90vw);
    padding: 6px 8px;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    background: rgba(0,0,0,0.7);
    color: #fff;
    border: 1px solid var(--yellow);
    border-radius: 6px;
    -webkit-user-select: text;
    user-select: text;
}
.share-link[hidden] { display: none; }

#gameOverScreen { overflow: hidden; }
#paradeCanvas { pointer-events: none; }

/* Game over fits the window: the logo gives way first */
.game-over-content { margin-top: 0; max-height: 100%; }
.game-over-logo { width: auto; height: min(24vh, 230px); max-width: 90%; }
#finalScore, #finalWave { margin: 6px 0; }
.frog-counts { margin: 12px auto; }

/* Short windows and landscape phones: everything fits without scrolling */
@media (max-height: 520px) {
    .game-over-content { margin-top: 0; }
    .game-over-logo { width: auto; height: min(18vh, 100px); margin-bottom: 0; }
    .game-over-scores-wrapper { margin: 4px 0; gap: 10px; }
    .game-over-snake-portrait { width: 48px !important; height: 48px !important; }
    .game-over-spacer { width: 48px; }
    .game-over-scores-center { display: flex; gap: 16px; align-items: baseline; flex-wrap: wrap; justify-content: center; }
    #finalScore, #finalWave, #finalBest { margin: 2px 0; font-size: clamp(0.95rem, 4.2vh, 1.25rem); }
    .frog-counts { margin: 6px auto; padding: 6px 10px; }
    .frog-counts-header { margin-bottom: 4px; }
    .frog-counts h3 { font-size: 1rem; }
    .frog-count-grid { grid-template-columns: repeat(4, 1fr); max-width: 560px; gap: 6px; }
    .frog-count-item { padding: 4px 8px; }
    .frog-icon { height: 26px; }
    .game-over-buttons { margin-top: 6px; flex-wrap: nowrap; gap: 10px; }
    .game-over-buttons .game-btn { padding: 8px 16px; font-size: 1rem; }
    #titleScreen .game-btn { padding: 10px 34px; }
    .title-links .link-btn { min-height: 40px; padding: 6px 12px; }
    #titleScreen .title-overlay { gap: 5px; }
}

@media (max-height: 520px) {
    .pause-content h2 { font-size: 2.2rem; margin-bottom: 2px; }
    .pause-hint { margin-bottom: 4px; }
    .pause-buttons { display: grid; grid-template-columns: 1fr 1fr; width: min(560px, 86vw); gap: 8px; }
    .pause-buttons .game-btn { padding: 8px 12px; font-size: 1rem; }
}

/* Portrait phones: buttons stack, tally two by two */
@media (max-width: 520px) and (orientation: portrait) {
    .game-over-scores-wrapper { grid-template-columns: auto auto; justify-content: center; }
    .game-over-spacer { display: none; }
    #finalScore, #finalWave { font-size: 1.15rem; white-space: nowrap; }
    #finalBest { font-size: 1rem; }
    .game-over-buttons { flex-direction: column; align-items: stretch; width: min(320px, 86vw); margin-left: auto; margin-right: auto; }
}

/* ================= Settings (the volume menu) ================= */
.volume-menu {
    left: 50%;
    top: 50%;
    bottom: auto;
    transform: translate(-50%, -50%);
    z-index: 1600;
    width: min(320px, calc(100vw - 24px));
    max-height: calc(var(--vh) - 16px);
    overflow-y: auto;
    border-color: var(--yellow);
    background: #0a1e0f;
}
/* Dims everything behind Settings, like How to Play */
.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1550;
    background: rgba(0, 0, 0, 0.6);
}
.volume-menu-header { color: var(--yellow); }
.volume-control input[type="range"] { height: 28px; background: transparent; }
.volume-control input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: rgba(255,255,255,0.25); }
.volume-control input[type="range"]::-webkit-slider-thumb { width: 22px; height: 22px; margin-top: -8px; background: var(--yellow); }
.volume-control input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; background: var(--yellow); }
.volume-control input[type="range"].pad-focus { outline-offset: 2px; }
.toggle-btn {
    display: block;
    width: 100%;
    margin: 8px 0;
    padding: 10px;
    min-height: 44px;
    background: rgba(255,255,255,0.08);
    border: 2px solid rgba(255,255,255,0.3);
    border-radius: 8px;
    color: #fff;
    font-family: 'Courier New', monospace;
    font-weight: bold;
    font-size: 0.95rem;
    cursor: pointer;
}
.toggle-btn[aria-checked="true"] .toggle-state { color: var(--yellow); }
.small-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 10px;
    font-size: 1rem;
    margin-top: 8px;
}
.small-btn .glyph { color: var(--yellow); }

/* Speaker */
.audio-toggle {
    left: max(10px, var(--sa-l));
    bottom: max(10px, var(--sa-b));
    color: var(--yellow);
    font-size: 22px;
    -webkit-touch-callout: none;
    user-select: none;
    -webkit-user-select: none;
}
.audio-toggle .glyph { margin: 0; width: 24px; height: 24px; }
#version { right: max(10px, var(--sa-r)); bottom: max(10px, var(--sa-b)); }

gh-feedback { font-family: 'Courier New', monospace; }

@media (prefers-reduced-motion: reduce) {
    .combo-star.pulse, .new-best.flash, #paradeReplayBtn.rotating { animation: none; }
}

.keys { white-space: nowrap; }
.control-hint { flex-wrap: wrap; justify-content: center; row-gap: 6px; }
#desktopControls { max-width: calc(100vw - 140px); }
/* The speaker never sits on the game-over buttons */
#gameOverScreen .game-over-content { padding-bottom: 8px; }
@media (max-height: 520px) {
    body[data-screen="gameover"] .game-over-buttons { padding-left: 60px; padding-right: 60px; }
}
.hint-pair { white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.control-hint { column-gap: 14px; }

/* Short landscape phones: Settings in a wide, compact grid so Close always fits */
@media (max-height: 420px) {
    .volume-menu.visible {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        column-gap: 14px;
        align-items: center;
        width: min(600px, calc(100vw - 24px));
        padding: 10px 14px;
    }
    .volume-menu-header { grid-column: 1 / -1; margin-bottom: 4px; }
    .volume-menu .volume-control { margin-bottom: 4px; }
    .volume-menu .toggle-btn, .volume-menu .game-btn { margin: 4px 0; width: 100%; }
}


/* ================= Play-test fixes ================= */
.nowrap { white-space: nowrap; }

/* Game over: the parade hops behind solid panels, so frogs never sit on words or buttons */
.game-over-scores-center {
    background: rgba(8, 22, 11, 0.78);
    border-radius: 10px;
    padding: 4px 14px;
}
#finalScore, #finalWave, #finalBest { text-shadow: 2px 2px 0 #000, -1px -1px 0 #000, 1px -1px 0 #000, -1px 1px 0 #000; }
.frog-counts { background: #0f2615; border-color: rgba(76, 175, 80, 0.6); }
.frog-count-item { background: rgba(255, 255, 255, 0.06); }
.frog-counts h3 { color: #76d275; }

/* Pause: room between the hint and Resume */
.pause-content .pause-hint { margin-bottom: 18px; }

/* Title: Best sits clear of Start and its controller ring */
.title-best { margin-top: 10px; }
.press-any .pad-glyph { width: 1.4em; height: 1.4em; }
.press-any .pad-btn { vertical-align: -0.35em; }

/* Controller prompt bar: bigger glyphs, centred, "[glyphs] Action · ..." */
body[data-hints="pad"] .control-hint.hint-pad { display: flex; }
#desktopControls .control-hint { column-gap: 0; flex-wrap: nowrap; }
#desktopControls .hint-pair + .hint-pair::before {
    content: '\00b7';
    margin: 0 12px;
    color: rgba(255, 255, 255, 0.55);
    font-weight: bold;
}
#desktopControls [data-pad] { display: inline-flex; align-items: center; gap: 4px; }
#desktopControls .pad-btn { vertical-align: middle; }
#desktopControls .pad-glyph { width: 1.6em; height: 1.6em; display: block; }
#desktopControls .pad-text { line-height: 1.5; font-size: 0.95em; }
#desktopControls { max-width: calc(100vw - 130px); white-space: nowrap; }
@media (max-width: 900px) {
    #desktopControls { padding: 10px 16px; font-size: 13px; }
    #desktopControls .hint-pair + .hint-pair::before { margin: 0 8px; }
}

/* Short screens and landscape phones: Resume across the top, the rest in one row below */
@media (max-height: 520px) {
    .pause-buttons { display: flex; flex-direction: row; flex-wrap: wrap; justify-content: center; }
    .pause-buttons .game-btn { flex: 1 1 0; min-width: 0; white-space: nowrap; }
    .pause-buttons #resumeBtn { flex-basis: 100%; }
    .pause-content .pause-hint { margin-bottom: 10px; }
}

/* Short windows: the stats line keeps a margin each side */
@media (max-height: 520px) {
    .game-over-scores-wrapper { max-width: min(680px, calc(100vw - 48px)); margin-left: auto; margin-right: auto; }
    .game-over-scores-center { column-gap: 14px; row-gap: 0; }
}

/* Portrait phones: smaller logo, tally two by two, buttons clear of the speaker; scrolls only if it must */
@media (max-width: 520px) and (orientation: portrait) {
    #gameOverScreen {
        justify-content: flex-start;
        overflow-y: auto;
        padding: max(10px, var(--sa-t)) 12px calc(max(10px, var(--sa-b)) + 62px);
    }
    #gameOverScreen .game-over-content { margin: auto 0; max-height: none; width: 100%; padding-bottom: 0; }
    .game-over-logo { height: min(12vh, 100px); margin-bottom: 0; }
    .game-over-scores-wrapper { margin: 6px 0; gap: 8px; }
    .game-over-snake-portrait { width: 52px !important; height: 52px !important; }
    #finalScore, #finalWave { margin: 2px 0; font-size: 1.05rem; }
    #finalBest { margin: 2px 0; font-size: 0.95rem; }
    .frog-counts { margin: 6px auto; padding: 8px 10px; }
    .frog-counts-header { margin-bottom: 6px; }
    .frog-counts h3 { font-size: 1rem; }
    .frog-count-grid { grid-template-columns: repeat(2, 1fr); gap: 6px; }
    .frog-count-item { padding: 4px 8px; }
    .frog-icon { height: 26px; }
    .game-over-buttons { margin-top: 8px; gap: 8px; }
    .game-over-buttons .game-btn { padding: 10px 16px; font-size: 1.05rem; }
}


/* ================= Polish fixes ================= */
/* Title: which snake, and how to change it */
.choose-hint {
    font-size: 0.9rem;
    color: #fff;
    background: rgba(0, 0, 0, 0.55);
    padding: 3px 10px;
    border-radius: 6px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.9);
}
.choose-hint .hint-touch { display: none; }
body[data-hints="touch"] .choose-hint .hint-keys { display: none; }
body[data-hints="touch"] .choose-hint .hint-touch { display: inline; }
.arrow-pair { display: inline-flex; gap: 5px; vertical-align: -0.3em; color: var(--yellow); }
.arrow-pair .glyph.arrow {
    width: 1.5em; height: 1.4em; margin: 0; padding: 3px 6px;
    background: rgba(255, 255, 255, 0.15); border: 1px solid rgba(255, 255, 255, 0.35); border-radius: 4px;
}
.choose-hint .pad-btn { vertical-align: 0; }

/* One dialog look: How to Play and Settings */
.instructions-box, .volume-menu {
    background: #0a1e0f;
    border: 2px solid var(--yellow);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}
.dialog-header {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    min-height: 44px;
    margin-bottom: 6px;
}
#instructions h2, .volume-menu-header {
    font-size: clamp(1.2rem, 3.6vw, 1.6rem);
    color: var(--yellow);
    margin: 0;
}
.volume-menu .close-instructions-btn { right: -4px; }
.settings-actions { display: flex; flex-direction: column; }
.settings-actions .toggle-btn { margin: 8px 0 0; }
@media (max-height: 420px) {
    .volume-menu .dialog-header { grid-column: 1 / -1; margin-bottom: 2px; min-height: 40px; }
    .settings-actions { grid-column: 1 / -1; flex-direction: row; justify-content: center; gap: 14px; }
    .settings-actions > * { flex: 0 1 calc((100% - 28px) / 3); }
    .volume-menu .settings-actions .toggle-btn, .volume-menu .settings-actions .game-btn { margin: 4px 0; width: auto; }
}

/* How to Play: one control per line, keys | action */
.ctl-grid {
    display: grid;
    grid-template-columns: max-content max-content;
    justify-content: center;
    column-gap: 14px;
    row-gap: 6px;
    margin: 6px auto;
    font-size: clamp(0.85rem, 2.3vw, 1rem);
    text-align: left;
    align-items: center;
}
.ctl-k { text-align: right; white-space: nowrap; display: inline-flex; align-items: center; justify-content: flex-end; gap: 6px; }
.ctl-k [data-pad] { display: inline-flex; align-items: center; gap: 4px; }
.ctl-k .pad-btn { vertical-align: 0; }
.for-touch .ctl-grid .ctl-k { display: block; }
/* Keys and a controller both in use, on a wide window: the two lists side by side */
@media (min-width: 700px) {
    body.pad-seen:not([data-hints="pad"]) .instructions-content { display: grid; grid-template-columns: 1fr 1fr; column-gap: 12px; align-items: start; }
    body.pad-seen:not([data-hints="pad"]) .instructions-content > * { grid-column: 1 / -1; }
    body.pad-seen:not([data-hints="pad"]) .instructions-content > .controls-section { grid-column: auto; }
}
.ctl-a { color: #fff; white-space: nowrap; }
.ctl-grid .keys { padding: 2px 7px; }
.for-touch .ctl-grid { grid-template-columns: auto auto; column-gap: 10px; }
.for-touch .ctl-grid .ctl-k, .for-touch .ctl-grid .ctl-a { white-space: normal; text-wrap: balance; }

/* Game over */
.shared-heading {
    font-size: clamp(1rem, 3vw, 1.4rem);
    font-weight: bold;
    color: var(--yellow);
    background: rgba(8, 22, 11, 0.92);
    border: 2px solid var(--yellow);
    border-radius: 8px;
    padding: 4px 14px;
    margin: 4px auto 6px;
    width: fit-content;
    max-width: 92vw;
}
.parade-control-btn.gone { visibility: hidden; }
#paradeSpeedText { display: inline-block; min-width: 2ch; }
.game-over-scores-center { background: rgba(8, 22, 11, 0.94); }

/* 800x600-ish windows: the desktop layout, a little tighter */
@media (min-height: 521px) and (max-height: 680px) {
    .game-over-logo { height: min(15vh, 110px); margin-bottom: 4px; }
    .game-over-scores-wrapper { margin: 6px 0; }
    #finalScore, #finalWave { margin: 2px 0; font-size: clamp(1.1rem, 3.4vw, 1.6rem); }
    #finalBest { margin: 2px 0; }
    .frog-counts { margin: 8px auto; padding: 10px 14px; }
    .frog-counts-header { margin-bottom: 8px; }
    .game-over-buttons { margin-top: 10px; }
    .game-over-buttons .game-btn { padding: 10px 24px; font-size: 1.1rem; }
}

/* Compact game over: stats as separate chips, never one run-on line */
@media (max-height: 520px) {
    .game-over-scores-center { background: none; padding: 0; gap: 8px; }
    #finalScore, #finalWave, #finalBest {
        background: rgba(8, 22, 11, 0.94);
        border: 1px solid rgba(242, 211, 58, 0.45);
        border-radius: 8px;
        padding: 1px 10px;
        white-space: nowrap;
    }
    .long-label { display: none; }
    .shared-heading { font-size: 1rem; padding: 2px 12px; margin: 2px auto 4px; }
}
@media (max-width: 520px) and (orientation: portrait) {
    .long-label { display: none; }
}

/* Parade: corner controls sit on their own backing above the frogs */
body[data-screen="gameover"] .audio-toggle { background: rgba(8, 22, 11, 0.95); border-color: rgba(242, 211, 58, 0.6); }
body[data-screen="gameover"] #version {
    background: rgba(8, 22, 11, 0.9);
    color: rgba(255, 255, 255, 0.75);
    padding: 2px 6px;
    border-radius: 4px;
}

/* Played upright: the HUD stacks, Wave below the health box */
body.touch-mode.portrait[data-screen="game"] .wave-info { top: 54px; }

/* Keyboard hint bar: one line down to 800 px wide */
@media (max-width: 900px) {
    #desktopControls { padding: 8px 14px; font-size: 13px; }
    #desktopControls .hint-pair { gap: 4px; }
    #desktopControls .hint-pair + .hint-pair::before { margin: 0 6px; }
    #desktopControls .keys { padding: 3px 6px; }
}

/* The sound line on Pause: a hint, not a headline */
.pause-content .sound-hint { font-size: 1rem; width: fit-content; margin: 0 auto 10px; opacity: 1; }

/* Short screens: the title's small lines share one row so the buttons always fit */
.row-break { display: none; }
@media (max-height: 520px) {
    #titleScreen .title-overlay { flex-direction: row; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0; }
    #titleScreen .title-overlay > * { margin: 3px 6px; }
    #titleScreen .title-overlay > .row-break { display: block; flex-basis: 100%; height: 0; margin: 0; }
    #titleScreen .title-overlay > .title-links { flex-basis: 100%; }
    .title-best { font-size: 0.95rem; }
}

/* Title screen only: a small link to the gallery, beside the speaker */
.corner-link {
    position: fixed;
    left: calc(max(10px, var(--sa-l)) + 62px);
    bottom: calc(max(10px, var(--sa-b)) + 15px);
    z-index: 1000;
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.6);
    text-decoration: none;
    background: rgba(10, 25, 14, 0.55);
    padding: 3px 7px;
    border-radius: 6px;
    display: none;
}
.corner-link:hover, .corner-link:focus-visible { color: #f2d33a; text-decoration: underline; }
body.ready[data-screen="title"] .corner-link { display: block; }
@media (max-height: 420px), (max-width: 520px) { .corner-link { font-size: 0.7rem; } }
