/**
 * CIPHER SUMS — Arithmetic Logic Lab
 * Cyber-Cipher Matrix Stylesheet
 * 100vh Viewport Locked — Zero Vertical Scrollbars
 * Pure Vanilla CSS3 — Zero External Libraries
 */

:root {
    --bg-dark: #0a1118;
    --bg-card: #0e1822;
    --bg-glass: rgba(14, 24, 34, 0.9);
    --border-cyan: rgba(0, 229, 255, 0.35);

    --neon-cyan: #00e5ff;
    --neon-gold: #fbbf24;
    --neon-emerald: #10b981;
    --neon-violet: #8b5cf6;
    --neon-coral: #f43f5e;

    --text-white: #ffffff;
    --text-muted: #94a3b8;

    --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: ui-monospace, "SF Mono", Monaco, "Cascadia Mono", monospace;
}

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

html, body {
    width: 100vw;
    height: 100vh;
    overflow: hidden;
    background-color: var(--bg-dark);
    font-family: var(--font-ui);
    color: var(--text-white);
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Master Viewport Container */
#app-root {
    width: 100%;
    height: 100%;
    max-width: 600px;
    max-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow: hidden;
    background: radial-gradient(circle at 50% 25%, #10212e 0%, #0a1118 65%, #05090e 100%);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.9);
}

/* Screen Transitions */
.app-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    z-index: 10;
}

.app-screen.active {
    display: flex;
}

/* ================================================= */
/* 1. LOADING SCREEN                                 */
/* ================================================= */
.loading-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 24px;
    text-align: center;
}

.loader-emblem-box {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 229, 255, 0.25) 0%, rgba(14, 24, 34, 0.8) 70%);
    border: 2px solid var(--border-cyan);
    box-shadow: 0 0 35px rgba(0, 229, 255, 0.45);
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 22px;
    animation: lockGlow 2.4s ease-in-out infinite;
}

@keyframes lockGlow {
    0%, 100% { transform: scale(1); box-shadow: 0 0 30px rgba(0, 229, 255, 0.4); }
    50% { transform: scale(1.06); box-shadow: 0 0 45px rgba(251, 191, 36, 0.6); }
}

.loader-logo-img {
    width: 82px;
    height: 82px;
    object-fit: contain;
}

.loader-title {
    font-size: 32px;
    font-weight: 900;
    letter-spacing: 5px;
    color: #ffffff;
    text-shadow: 0 0 20px rgba(0, 229, 255, 0.7);
    margin-bottom: 6px;
}

.loader-subtitle {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--neon-cyan);
    letter-spacing: 2.5px;
    text-transform: uppercase;
    margin-bottom: 26px;
}

.loader-track {
    width: 220px;
    height: 6px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    overflow: hidden;
    border: 1px solid rgba(0, 229, 255, 0.3);
    margin-bottom: 12px;
}

.loader-bar {
    width: 0%;
    height: 100%;
    background: linear-gradient(90deg, #00e5ff, #fbbf24);
    border-radius: 4px;
    box-shadow: 0 0 10px #00e5ff;
    transition: width 0.1s linear;
}

.loader-status-text {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-muted);
    letter-spacing: 1.5px;
}

/* ================================================= */
/* 2. MAIN MENU SCREEN (FULL HEIGHT 100VH)           */
/* ================================================= */
.menu-stage-layout {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 24px 18px 20px;
    box-sizing: border-box;
}

.menu-brand-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}

.menu-emblem-halo {
    width: 104px;
    height: 104px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(0, 229, 255, 0.25) 0%, rgba(14, 24, 34, 0.8) 70%);
    border: 2px solid var(--border-cyan);
    box-shadow: 0 0 38px rgba(0, 229, 255, 0.45);
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 12px;
}

.menu-logo-img {
    width: 84px;
    height: 84px;
    object-fit: contain;
}

.menu-title {
    font-size: 38px;
    font-weight: 900;
    letter-spacing: 5px;
    color: #ffffff;
    text-shadow: 0 0 25px rgba(0, 229, 255, 0.7);
    margin-bottom: 6px;
}

.menu-tagline-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 5px 16px;
    border-radius: 20px;
    background: rgba(0, 229, 255, 0.12);
    border: 1px solid rgba(0, 229, 255, 0.35);
    font-size: 11.5px;
    font-weight: 800;
    letter-spacing: 2px;
    color: var(--neon-cyan);
}

.tagline-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #00e5ff;
    box-shadow: 0 0 8px #00e5ff;
}

/* Menu Stats Overview */
.menu-stats-strip {
    display: flex;
    gap: 12px;
    width: 100%;
    max-width: 380px;
}

.menu-stat-pill {
    flex: 1;
    background: var(--bg-glass);
    border: 1.2px solid var(--border-cyan);
    border-radius: 14px;
    padding: 11px 14px;
    display: flex;
    flex-direction: column;
    align-items: center;
    backdrop-filter: blur(8px);
}

.stat-sub-label {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: 3px;
}

.stat-bold-val {
    font-family: var(--font-mono);
    font-size: 18px;
    font-weight: 900;
    color: var(--neon-cyan);
}

/* Menu Actions Stack (Strictly 5 buttons) */
.menu-actions-stack {
    width: 100%;
    max-width: 380px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.hero-solve-btn {
    width: 100%;
    height: 64px;
    border-radius: 16px;
    background: linear-gradient(135deg, #00e5ff 0%, #fbbf24 100%);
    border: none;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 14px;
    box-shadow: 0 8px 25px rgba(0, 229, 255, 0.45);
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.hero-solve-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(251, 191, 36, 0.6);
}

.hero-solve-btn:active {
    transform: translateY(1px);
}

.hero-btn-icon {
    width: 32px;
    height: 32px;
    object-fit: contain;
}

.hero-btn-text {
    font-size: 19px;
    font-weight: 900;
    letter-spacing: 2px;
    color: #0a1118;
    text-transform: uppercase;
}

.menu-action-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.menu-action-btn {
    height: 56px;
    border-radius: 14px;
    background: var(--bg-glass);
    border: 1.2px solid var(--border-cyan);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.15s ease;
    backdrop-filter: blur(8px);
}

.menu-action-btn:hover {
    background: rgba(0, 229, 255, 0.18);
    border-color: var(--neon-cyan);
    transform: translateY(-2px);
}

.menu-action-btn:active {
    transform: translateY(1px);
}

.menu-btn-icon {
    width: 26px;
    height: 26px;
    object-fit: contain;
}

.menu-btn-label {
    font-size: 15px;
    font-weight: 800;
    color: var(--text-white);
    letter-spacing: 0.5px;
}

.menu-system-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    letter-spacing: 1.2px;
}

.footer-orb {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #00e5ff;
    box-shadow: 0 0 8px #00e5ff;
}

/* ================================================= */
/* 3. LEVELS SCREEN                                  */
/* ================================================= */
.levels-stage-layout {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 16px 14px;
    box-sizing: border-box;
}

.screen-top-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.icon-nav-btn {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: var(--bg-glass);
    border: 1.2px solid var(--border-cyan);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.15s ease;
}

.icon-nav-btn:hover {
    border-color: var(--neon-cyan);
    background: rgba(0, 229, 255, 0.2);
}

.nav-btn-img {
    width: 26px;
    height: 26px;
    object-fit: contain;
}

.top-bar-title-box {
    text-align: center;
}

.top-bar-title {
    font-size: 20px;
    font-weight: 900;
    letter-spacing: 2px;
    color: #ffffff;
}

.top-bar-subtitle {
    font-family: var(--font-mono);
    font-size: 10.5px;
    color: var(--neon-cyan);
    letter-spacing: 1.5px;
}

.top-bar-stars-badge {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(251, 191, 36, 0.15);
    border: 1px solid rgba(251, 191, 36, 0.35);
    padding: 7px 12px;
    border-radius: 12px;
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 800;
    color: var(--neon-gold);
}

.mini-star-icon {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

/* Sector Tabs */
.sector-tab-strip {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.sector-tab-btn {
    flex: 1;
    height: 42px;
    border-radius: 12px;
    background: rgba(14, 24, 34, 0.6);
    border: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.5px;
    transition: all 0.15s ease;
}

.sector-tab-btn.active {
    background: rgba(0, 229, 255, 0.18);
    border-color: var(--neon-cyan);
    color: #ffffff;
    box-shadow: 0 0 12px rgba(0, 229, 255, 0.25);
}

.sector-tab-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-muted);
}

.sector-tab-btn.active .sector-tab-dot {
    background: var(--neon-cyan);
    box-shadow: 0 0 8px var(--neon-cyan);
}

/* Sector Spotlight Banner */
.sector-info-banner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, rgba(0, 229, 255, 0.15) 0%, rgba(14, 24, 34, 0.8) 100%);
    border: 1.2px solid var(--border-cyan);
    border-radius: 14px;
    padding: 11px 15px;
    margin-bottom: 12px;
    flex-shrink: 0;
}

.sector-banner-left {
    max-width: 75%;
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.sector-banner-tag {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: var(--neon-cyan);
    text-transform: uppercase;
}

.sector-banner-title {
    font-size: 15.5px;
    font-weight: 800;
    color: #ffffff;
    margin: 0;
}

.sector-banner-desc {
    font-size: 11.5px;
    line-height: 1.35;
    color: var(--text-muted);
    margin: 0;
}

.sector-banner-progress {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    background: rgba(10, 17, 24, 0.7);
    padding: 6px 12px;
    border-radius: 10px;
    border: 1px solid var(--border-cyan);
    min-width: 68px;
}

.sector-prog-label {
    font-family: var(--font-mono);
    font-size: 9.5px;
    color: var(--text-muted);
    letter-spacing: 1px;
}

.sector-prog-val {
    font-family: var(--font-mono);
    font-size: 14.5px;
    font-weight: 900;
    color: var(--neon-cyan);
}

/* Levels Grid */
.levels-scroll-container {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 16px;
}

.levels-scroll-container::-webkit-scrollbar {
    width: 5px;
}
.levels-scroll-container::-webkit-scrollbar-thumb {
    background: var(--border-cyan);
    border-radius: 4px;
}

.sector-levels-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
}

.level-card-node {
    aspect-ratio: 1;
    min-width: 0;
    width: 100%;
    background: rgba(14, 24, 34, 0.85);
    border: 1.4px solid var(--border-cyan);
    border-radius: 14px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 8px 4px 6px;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.level-card-node:hover:not(.locked) {
    transform: translateY(-2px);
    border-color: var(--neon-cyan);
    box-shadow: 0 6px 18px rgba(0, 229, 255, 0.35);
}

.level-card-node.locked {
    opacity: 0.45;
    cursor: not-allowed;
    background: rgba(10, 17, 24, 0.6);
    border-color: rgba(255, 255, 255, 0.1);
}

.node-number {
    font-family: var(--font-mono);
    font-size: 19px;
    font-weight: 900;
    color: #ffffff;
    line-height: 1;
}

.node-title {
    font-size: 9.5px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.88);
    text-align: center;
    line-height: 1.1;
    max-width: 100%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 2px;
}

.node-stars {
    font-size: 13px;
    color: var(--neon-gold);
    letter-spacing: 1px;
    line-height: 1;
}

/* ================================================= */
/* 4. GAMEPLAY SCREEN                                */
/* ================================================= */
.gameplay-stage-layout {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    padding: 8px 10px;
    box-sizing: border-box;
    justify-content: space-between;
}

/* Cipher Sequencer Top HUD */
.gameplay-hud-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg-glass);
    border: 1.2px solid var(--border-cyan);
    border-radius: 14px;
    padding: 8px 12px;
    gap: 8px;
    flex-shrink: 0;
}

.hud-stage-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
    flex: 1;
}

.hud-stage-tag {
    font-family: var(--font-mono);
    font-size: 9.5px;
    font-weight: 800;
    color: var(--neon-cyan);
    letter-spacing: 1.2px;
}

.hud-stage-title {
    font-size: 15px;
    font-weight: 900;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.moves-badge-box {
    background: rgba(251, 191, 36, 0.12);
    border: 1px solid rgba(251, 191, 36, 0.35);
    border-radius: 10px;
    padding: 5px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 50px;
    flex-shrink: 0;
}

.moves-box-label {
    font-family: var(--font-mono);
    font-size: 8.5px;
    color: var(--neon-gold);
    letter-spacing: 0.8px;
    font-weight: 800;
}

.moves-box-val {
    font-family: var(--font-mono);
    font-size: 14.5px;
    font-weight: 900;
    color: #ffffff;
}

.progress-badge-box {
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.35);
    border-radius: 10px;
    padding: 5px 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 58px;
    flex-shrink: 0;
}

.prog-box-label {
    font-family: var(--font-mono);
    font-size: 8.5px;
    color: var(--neon-emerald);
}

.prog-box-val {
    font-family: var(--font-mono);
    font-size: 14.5px;
    font-weight: 900;
    color: #ffffff;
}

/* Central Equation Board Canvas Card */
.board-viewport-card {
    flex: 1;
    min-height: 200px;
    width: 100%;
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    border: 1.5px solid var(--border-cyan);
    box-shadow: inset 0 0 35px rgba(0, 0, 0, 0.8), 0 0 25px rgba(0, 229, 255, 0.18);
    margin: 8px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #0a1118;
}

#board-canvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: pointer;
}

/* Lower Number Tray Bench */
.synthesizer-bench {
    background: var(--bg-glass);
    border: 1.4px solid var(--border-cyan);
    border-radius: 16px;
    padding: 8px 10px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
    backdrop-filter: blur(10px);
}

.bench-prompt-strip {
    background: rgba(10, 17, 24, 0.8);
    border: 1px solid var(--border-cyan);
    border-radius: 10px;
    padding: 8px 12px;
    text-align: center;
    font-family: var(--font-mono);
    font-size: 11.5px;
    font-weight: 800;
    letter-spacing: 0.8px;
    color: #ffffff;
}

/* Number Tile Tray Row */
.number-tray-row {
    display: flex;
    gap: 10px;
    align-items: center;
    justify-content: center;
    min-height: 62px;
    overflow-x: auto;
    padding: 4px 6px;
}

.number-tray-row::-webkit-scrollbar {
    height: 4px;
}
.number-tray-row::-webkit-scrollbar-thumb {
    background: var(--border-cyan);
    border-radius: 2px;
}

.btn-number-tile {
    min-width: 58px;
    height: 58px;
    border-radius: 14px;
    background: linear-gradient(135deg, #1e3a52, #142838);
    border: 1.8px solid var(--neon-cyan);
    box-shadow: 0 4px 14px rgba(0, 229, 255, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, opacity 0.15s ease;
}

.btn-number-tile:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(0, 229, 255, 0.45);
    border-color: #ffffff;
}

.btn-number-tile:active {
    transform: scale(0.95);
}

.btn-number-tile.used {
    opacity: 0.25;
    cursor: not-allowed;
    border-color: rgba(255, 255, 255, 0.15);
    box-shadow: none;
    transform: none;
}

.tile-number-val {
    font-family: var(--font-mono);
    font-size: 23px;
    font-weight: 900;
    color: #ffffff;
}

/* Utilities Row */
.bench-utilities-row {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.bench-utility-btn {
    height: 40px;
    padding: 0 16px;
    border-radius: 12px;
    background: rgba(10, 17, 24, 0.7);
    border: 1.2px solid var(--border-cyan);
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--text-white);
    font-size: 13px;
    font-weight: 800;
    transition: all 0.15s ease;
}

.bench-utility-btn:hover {
    border-color: var(--neon-cyan);
    background: rgba(0, 229, 255, 0.15);
}

.util-btn-img {
    width: 18px;
    height: 18px;
    object-fit: contain;
}

/* ================================================= */
/* 5. MODALS & DIALOGS                               */
/* ================================================= */
.cipher-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(5, 9, 14, 0.88);
    backdrop-filter: blur(8px);
    display: none;
    justify-content: center;
    align-items: center;
    padding: 16px;
    box-sizing: border-box;
    z-index: 100;
}

.cipher-modal-overlay.active {
    display: flex;
}

.cipher-modal-dialog {
    width: 100%;
    max-width: 400px;
    background: #0e1822;
    border: 1.6px solid var(--border-cyan);
    border-radius: 20px;
    padding: 22px 20px;
    box-shadow: 0 16px 45px rgba(0, 0, 0, 0.9), 0 0 35px rgba(0, 229, 255, 0.25);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-header-row {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.modal-header-tag {
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-title {
    font-size: 20px;
    font-weight: 900;
    letter-spacing: 1.5px;
    color: #ffffff;
}

.modal-close-cross {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 26px;
    cursor: pointer;
    line-height: 1;
}

.modal-body-copy {
    font-size: 13.5px;
    line-height: 1.5;
    color: #cbd5e1;
    margin-bottom: 18px;
    text-align: left;
}

.modal-body-copy p {
    margin-bottom: 10px;
}

.modal-primary-btn {
    width: 100%;
    height: 52px;
    border-radius: 14px;
    background: linear-gradient(135deg, #00e5ff 0%, #fbbf24 100%);
    border: none;
    font-size: 16px;
    font-weight: 900;
    letter-spacing: 1.5px;
    color: #0a1118;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 229, 255, 0.4);
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Victory Modal Specifics */
.victory-halo-emblem {
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(251, 191, 36, 0.3) 0%, rgba(14, 24, 34, 0.8) 70%);
    border: 2px solid rgba(251, 191, 36, 0.6);
    box-shadow: 0 0 35px rgba(251, 191, 36, 0.45);
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 12px;
}

.victory-wreath-img {
    width: 58px;
    height: 58px;
    object-fit: contain;
}

.victory-stars-strip {
    display: flex;
    gap: 10px;
    font-size: 30px;
    color: rgba(255, 255, 255, 0.2);
    margin: 8px 0 14px;
}

.star-badge.active {
    color: var(--neon-gold);
    text-shadow: 0 0 15px rgba(251, 191, 36, 0.8);
}

.stem-discovery-card {
    background: rgba(0, 229, 255, 0.1);
    border: 1.2px solid rgba(0, 229, 255, 0.35);
    border-radius: 14px;
    padding: 12px 14px;
    text-align: left;
    margin-bottom: 18px;
    width: 100%;
}

.stem-tagline {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 11px;
    font-weight: 800;
    color: var(--neon-cyan);
    letter-spacing: 1.2px;
    margin-bottom: 6px;
}

.stem-fact-copy {
    font-size: 13px;
    line-height: 1.45;
    color: #e2e8f0;
}

.dialog-actions-row {
    width: 100%;
    display: flex;
    gap: 10px;
}

.dialog-btn-action {
    flex: 1;
    height: 50px;
    border-radius: 14px;
    border: none;
    font-size: 15px;
    font-weight: 800;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.dialog-btn-action.secondary {
    background: rgba(255, 255, 255, 0.08);
    border: 1.2px solid var(--border-cyan);
    color: #ffffff;
}

.dialog-btn-action.primary {
    background: linear-gradient(135deg, #00e5ff 0%, #fbbf24 100%);
    color: #0a1118;
    box-shadow: 0 4px 16px rgba(0, 229, 255, 0.4);
}

/* Settings Items */
.settings-items-stack {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.setting-row-box {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(10, 17, 24, 0.6);
    border: 1px solid var(--border-cyan);
    border-radius: 12px;
    padding: 10px 14px;
}

.setting-title {
    font-size: 13px;
    font-weight: 700;
    color: #ffffff;
}

.setting-toggle-pill {
    padding: 6px 14px;
    border-radius: 16px;
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 800;
    background: rgba(0, 229, 255, 0.2);
    border: 1px solid var(--neon-cyan);
    color: var(--neon-cyan);
    cursor: pointer;
}

.setting-toggle-pill.danger {
    background: rgba(244, 63, 94, 0.15);
    border-color: #f43f5e;
    color: #fb7185;
}

/* Responsive Compact Height for Gameplay Viewports (Laptops / Windowed Desktops) */
@media (max-height: 680px) {
    .gameplay-stage-layout {
        padding: 5px 8px;
    }
    .gameplay-hud-bar {
        padding: 5px 10px;
    }
    .board-viewport-card {
        margin: 4px 0;
    }
    .synthesizer-bench {
        padding: 5px 8px;
        gap: 4px;
    }
    .bench-prompt-strip {
        padding: 5px 8px;
        font-size: 10.5px;
    }
    .number-tray-row {
        min-height: 52px;
        padding: 2px 4px;
    }
    .btn-number-tile {
        min-width: 48px;
        height: 48px;
        font-size: 20px;
    }
    .bench-utility-btn {
        height: 32px;
        padding: 0 12px;
        font-size: 11.5px;
    }
}

/* Responsive Landscape Optimizations */
@media (max-height: 500px) and (orientation: landscape) {
    .menu-stage-layout {
        padding: 10px 18px;
    }
    .menu-emblem-halo {
        width: 50px;
        height: 50px;
        margin-bottom: 4px;
    }
    .menu-logo-img {
        width: 40px;
        height: 40px;
    }
    .menu-title {
        font-size: 22px;
        margin-bottom: 2px;
    }
    .hero-solve-btn {
        height: 44px;
    }
    .menu-action-btn {
        height: 38px;
    }
    .gameplay-stage-layout {
        padding: 4px 8px;
    }
    .board-viewport-card {
        min-height: 140px;
        margin: 4px 0;
    }
    .synthesizer-bench {
        padding: 6px 10px;
        gap: 4px;
    }
    .btn-number-tile {
        height: 38px;
        min-width: 38px;
    }
}


/* ================================================= */
/* BRAND LOGO (same artwork as the marketplace thumbnail) */
/* ================================================= */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.brand-logo-img {
    display: block;
    width: auto;
    max-width: 86%;
    object-fit: contain;
    user-select: none;
    -webkit-user-drag: none;
    filter: drop-shadow(0 0 18px rgba(0, 229, 255, 0.35));
}

.brand-logo-loader {
    height: clamp(150px, 30vh, 270px);
    margin-bottom: 22px;
    animation: brandPulse 2.8s ease-in-out infinite;
}

.brand-logo-menu {
    height: clamp(130px, 29vh, 250px);
    animation: brandFloat 5s ease-in-out infinite;
}

@keyframes brandPulse {
    0%, 100% { transform: scale(1); filter: drop-shadow(0 0 14px rgba(0, 229, 255, 0.35)); }
    50% { transform: scale(1.03); filter: drop-shadow(0 0 26px rgba(251, 191, 36, 0.45)); }
}

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

@media (max-height: 680px) {
    .brand-logo-menu { height: clamp(90px, 20vh, 140px); }
}

@media (max-height: 500px) and (orientation: landscape) {
    .brand-logo-menu { height: 78px; }
    .brand-logo-loader { height: 120px; margin-bottom: 10px; }
}

@media (prefers-reduced-motion: reduce) {
    .brand-logo-loader, .brand-logo-menu { animation: none; }
}

/* Remove the 300ms tap delay on touch devices and block double-tap zoom */
html, body, button, canvas { touch-action: manipulation; }


/* ================================================= */
/* MAIN MENU REDESIGN (v1.2)                         */
/* Centered stack with controlled spacing between    */
/* logo, stats and buttons (no more stretched gaps). */
/* ================================================= */
#screen-menu {
    background:
        radial-gradient(ellipse 80% 45% at 50% 22%, rgba(0, 229, 255, 0.16) 0%, rgba(0, 229, 255, 0) 70%),
        radial-gradient(ellipse 70% 40% at 50% 100%, rgba(139, 92, 246, 0.14) 0%, rgba(139, 92, 246, 0) 70%),
        linear-gradient(180deg, #0a1118 0%, #070c12 100%);
    overflow: hidden;
}
#screen-menu::before {                     /* faint blueprint grid */
    content: "";
    position: absolute;
    inset: 0;
    background-image:
        linear-gradient(rgba(0, 229, 255, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(0, 229, 255, 0.045) 1px, transparent 1px);
    background-size: 34px 34px;
    -webkit-mask-image: radial-gradient(ellipse at center, #000 30%, transparent 78%);
            mask-image: radial-gradient(ellipse at center, #000 30%, transparent 78%);
    pointer-events: none;
}

.menu-stage-layout {
    position: relative;
    justify-content: center;
    gap: clamp(14px, 3.2vh, 30px);
    padding: 20px 20px clamp(44px, 7vh, 64px);
}

/* floating symbols */
.menu-bg-symbols { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.menu-bg-symbols span {
    position: absolute;
    font-family: var(--font-mono);
    font-weight: 900;
    color: var(--neon-cyan);
    opacity: 0.13;
    text-shadow: 0 0 14px currentColor;
    animation: symbolDrift 9s ease-in-out infinite;
}
.menu-bg-symbols span:nth-child(1) { left: 7%;  top: 12%; font-size: 34px; }
.menu-bg-symbols span:nth-child(2) { left: 86%; top: 9%;  font-size: 30px; color: var(--neon-gold); animation-delay: -2s; }
.menu-bg-symbols span:nth-child(3) { left: 90%; top: 40%; font-size: 38px; color: var(--neon-violet); animation-delay: -4s; }
.menu-bg-symbols span:nth-child(4) { left: 5%;  top: 46%; font-size: 36px; color: var(--neon-emerald); animation-delay: -6s; }
.menu-bg-symbols span:nth-child(5) { left: 12%; top: 80%; font-size: 32px; color: var(--neon-gold); animation-delay: -3s; }
.menu-bg-symbols span:nth-child(6) { left: 82%; top: 82%; font-size: 40px; animation-delay: -5s; }
.menu-bg-symbols span:nth-child(7) { left: 22%; top: 28%; font-size: 24px; color: var(--neon-violet); animation-delay: -1s; }
.menu-bg-symbols span:nth-child(8) { left: 72%; top: 26%; font-size: 26px; color: var(--neon-emerald); animation-delay: -7s; }
@keyframes symbolDrift {
    0%, 100% { transform: translateY(0) rotate(-6deg); }
    50%      { transform: translateY(-14px) rotate(6deg); }
}

/* brand: logo sits close to the content below it */
.menu-brand-header { position: relative; z-index: 1; }
.brand-logo-menu { height: clamp(130px, 27vh, 240px); margin-bottom: 0; }

/* stats: one glass panel with a divider */
.menu-stats-strip {
    position: relative;
    z-index: 1;
    gap: 0;
    padding: 4px 0;
    background: linear-gradient(180deg, rgba(14, 24, 34, 0.92) 0%, rgba(10, 17, 24, 0.92) 100%);
    border: 1.2px solid var(--border-cyan);
    border-radius: 18px;
    box-shadow: 0 8px 26px rgba(0, 0, 0, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.menu-stat-pill {
    background: transparent;
    border: none;
    border-radius: 0;
    padding: 9px 12px;
    backdrop-filter: none;
}
.menu-stat-pill + .menu-stat-pill { border-left: 1px solid rgba(0, 229, 255, 0.22); }
.stat-bold-val { font-size: 19px; text-shadow: 0 0 12px rgba(0, 229, 255, 0.55); }
.menu-stat-pill:nth-child(2) .stat-bold-val { color: var(--neon-gold); text-shadow: 0 0 12px rgba(251, 191, 36, 0.55); }

/* actions */
.menu-actions-stack { position: relative; z-index: 1; gap: 12px; }

.hero-solve-btn {
    position: relative;
    overflow: hidden;
    height: 66px;
    border-radius: 18px;
    box-shadow: 0 10px 28px rgba(0, 229, 255, 0.38), inset 0 2px 0 rgba(255, 255, 255, 0.35), inset 0 -3px 0 rgba(0, 0, 0, 0.18);
}
.hero-solve-btn::after {                   /* moving shine */
    content: "";
    position: absolute;
    top: 0; left: -60%;
    width: 40%; height: 100%;
    background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.45), transparent);
    transform: skewX(-18deg);
    animation: heroShine 3.6s ease-in-out infinite;
}
@keyframes heroShine {
    0%, 55% { left: -60%; }
    100%    { left: 140%; }
}

.menu-action-grid { gap: 10px; }
.menu-action-btn {
    height: 58px;
    flex-direction: row;
    border-radius: 16px;
    background: linear-gradient(180deg, rgba(20, 34, 48, 0.92) 0%, rgba(12, 21, 30, 0.92) 100%);
    box-shadow: 0 5px 14px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.06);
}
.menu-action-btn:hover { box-shadow: 0 8px 20px rgba(0, 229, 255, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.1); }
.menu-btn-icon { width: 24px; height: 24px; }

/* footer pinned to the bottom instead of stretching the layout */
.menu-system-footer {
    position: absolute;
    bottom: clamp(12px, 2.4vh, 20px);
    left: 0; right: 0;
    justify-content: center;
    z-index: 1;
}

@media (prefers-reduced-motion: reduce) {
    .menu-bg-symbols span, .hero-solve-btn::after { animation: none; }
}

/* short phones */
@media (max-height: 680px) {
    .brand-logo-menu { height: clamp(90px, 22vh, 140px); }
    .menu-stage-layout { gap: 12px; padding-bottom: 40px; }
    .hero-solve-btn { height: 56px; }
    .menu-action-btn { height: 48px; }
    .menu-stat-pill { padding: 6px 10px; }
    .stat-bold-val { font-size: 17px; }
}

/* landscape phones: logo + stats on the left, buttons on the right */
@media (max-height: 500px) and (orientation: landscape) {
    .menu-stage-layout {
        display: grid;
        grid-template-columns: 1fr 1fr;
        grid-template-areas: "brand actions" "stats actions";
        align-content: center;
        align-items: center;
        justify-items: center;
        column-gap: 24px;
        row-gap: 10px;
        padding: 10px 24px 30px;
    }
    .menu-brand-header { grid-area: brand; }
    .menu-stats-strip { grid-area: stats; max-width: 300px; }
    .menu-actions-stack { grid-area: actions; max-width: 340px; gap: 8px; }
    .brand-logo-menu { height: 120px; }
    .hero-solve-btn { height: 46px; }
    .menu-action-btn { height: 40px; }
    .menu-system-footer { bottom: 8px; font-size: 10px; }
    .menu-bg-symbols { display: none; }
    .menu-action-btn { gap: 6px; padding: 0 6px; }
    .menu-btn-label { font-size: 13px; letter-spacing: 0; white-space: nowrap; }
    .menu-btn-icon { width: 20px; height: 20px; }
}
