:root {
    --bg-gradient: linear-gradient(135deg, #0a0f1a 0%, #1a2332 50%, #0d1520 100%);
    --container-bg: rgba(16, 20, 30, 0.9);
    --primary-color: #00f2ff;
    --secondary-color: #00d4aa;
    --success-color: #00ff88;
    --text-color: #ecf0f1;
    --wall-top: #6b7a8f;
    --wall-front: #4a5568;
    --wall-side: #2d3748;
    --wall-dark: #1a202c;
    --floor-color: #141a24;
    --box-color: #f39c12;
}

body {
    font-family: 'Orbitron', 'Segoe UI', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    margin: 0;
    background: var(--bg-gradient);
    color: var(--text-color);
    padding: 10px;
    box-sizing: border-box;
    overflow-x: hidden;
}

/* Scrollbar cleanup */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

#game-container {
    text-align: center;
    background: var(--container-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 30px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow:
        0 0 40px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.05),
        0 0 20px rgba(0, 242, 255, 0.1);
    max-width: 98vw;
    width: min(980px, 98vw);
    margin: auto;
    position: relative;
    transition: transform 0.3s ease;
}

h1 {
    margin: 0 0 10px 0;
    font-size: 3em;
    letter-spacing: 2px;
    text-transform: uppercase;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
}

.title-text {
    background: linear-gradient(to right, #00f2ff, #bc13fe);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 0 20px rgba(188, 19, 254, 0.3);
}

.subtitle {
    color: #a0aec0;
    font-size: 1rem;
    margin-bottom: 25px;
    font-weight: 300;
    letter-spacing: 1px;
}

.games-hub-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--primary-color);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.6px;
    margin-bottom: 22px;
    transition: color 0.2s ease, text-shadow 0.2s ease;
}

.games-hub-link:hover {
    color: #7ff7ff;
    text-shadow: 0 0 14px rgba(0, 242, 255, 0.28);
}

/* Game Stats Panel */
#game-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    margin: 15px 0;
    padding: 10px;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 6px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

#stats-row {
    display: flex;
    justify-content: center;
    gap: 30px;
    width: 100%;
}

.info-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    min-width: 80px;
}

.info-label {
    font-size: 0.75rem;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}

.info-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
    text-shadow: 0 0 10px rgba(0, 242, 255, 0.3);
}

/* Level Selector */
#level-selector {
    margin: 15px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    max-width: 95vw;
}

.inline-label {
    font-size: 0.75rem;
    color: #718096;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-left: 6px;
}

#level-selector select {
    background: #1a202c;
    color: #e2e8f0;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 8px 16px;
    font-family: 'Orbitron', sans-serif;
    font-size: 14px;
    cursor: pointer;
    outline: none;
    transition: all 0.3s;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23cbd5e0' viewBox='0 0 16 16'%3E%3Cpath d='M7.247 11.14 2.451 5.658C1.885 5.013 2.345 4 3.204 4h9.592a1 1 0 0 1 .753 1.659l-4.796 5.48a1 1 0 0 1-1.506 0z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 35px;
}

#level-selector select option {
    background-color: #1a202c;
    color: #e2e8f0;
    padding: 10px;
}

.import-btn-small {
    padding: 8px 16px !important;
    font-size: 0.8rem !important;
    margin: 0 !important;
}

.spinner {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.18);
    border-top-color: var(--primary-color);
    box-shadow: 0 0 12px rgba(0, 242, 255, 0.15);
    animation: spin 0.9s linear infinite;
}

.spinner-hidden {
    display: none;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

#level-selector select:hover,
#level-selector select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 15px rgba(0, 242, 255, 0.2);
}

/* Mobile adjustment for selector alignment */
@media (max-width: 900px) {
    #level-selector {
        gap: 8px;
        margin: 10px 0;
    }
}

/* Game Board Area */
#game-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin: 15px 0;
}

.board-stack {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

#game-board {
    display: grid;
    border: none;
    background: rgba(0, 0, 0, 0.5);
    padding: 12px;
    border-radius: 6px;
    box-shadow:
        inset 0 0 30px rgba(0, 0, 0, 0.8),
        0 20px 40px rgba(0, 0, 0, 0.4);
    position: relative;
    /* Center the grid */
    margin: 0 auto;
}

/* CELL STYLING - THE CORE VISUALS */
.cell {
    width: 44px;
    height: 44px;
    position: relative;
    box-sizing: border-box;
    background-color: var(--floor-color);
}

/* Floor: Clean dark tile */
.floor {
    background-color: var(--floor-color);
}

/* Wall: 3D Industrial Block with depth */
.wall {
    background: var(--floor-color);
    position: relative;
    z-index: 1;
}

.wall::before {
    content: '';
    position: absolute;
    inset: 0;
    /* 3D block effect - top surface lighter, sides darker */
    background:
        linear-gradient(180deg,
            var(--wall-top) 0%,
            var(--wall-front) 15%,
            var(--wall-front) 85%,
            var(--wall-dark) 100%);
    border-top: 3px solid rgba(255, 255, 255, 0.25);
    border-left: 3px solid rgba(255, 255, 255, 0.15);
    border-right: 3px solid rgba(0, 0, 0, 0.4);
    border-bottom: 3px solid rgba(0, 0, 0, 0.6);
}

.wall::after {
    content: '';
    position: absolute;
    top: 6px;
    left: 6px;
    right: 6px;
    bottom: 6px;
    background:
        linear-gradient(135deg,
            rgba(255, 255, 255, 0.08) 0%,
            transparent 50%,
            rgba(0, 0, 0, 0.15) 100%);
    border: 1px solid rgba(0, 0, 0, 0.3);
    border-radius: 2px;
}

/* Target: Glowing Holographic Pad */
.target {
    background-color: rgba(46, 204, 113, 0.15);
    box-shadow:
        inset 0 0 15px rgba(46, 204, 113, 0.2),
        0 0 10px rgba(46, 204, 113, 0.1);
    display: flex;
    justify-content: center;
    align-items: center;
}

.target::after {
    content: '';
    width: 16px;
    height: 16px;
    border: 3px solid var(--success-color);
    background: transparent;
    box-shadow: 0 0 15px var(--success-color);
    animation: pulse-target 3s infinite;
}

/* Box: 3D Sci-Fi Crate */
.box {
    background-color: var(--floor-color);
    position: relative;
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* The Orange Crate Object */
.box::after {
    content: '';
    position: absolute;
    inset: 4px;
    background: linear-gradient(135deg, #d35400, #e67e22);
    border-radius: 2px;
    border: 2px solid #a04000;
    box-shadow:
        0 6px 10px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.2);
    z-index: 1;
    transition: transform 0.2s ease-out;
}

@keyframes box-push {
    0% { transform: scale(1); }
    50% { transform: scale(0.92); }
    100% { transform: scale(1); }
}

.pushed-anim::after {
    animation: box-push 0.25s ease-out;
}

/* Crate Details */
.box::before {
    content: '';
    position: absolute;
    inset: 10px;
    border: 1px solid rgba(0, 0, 0, 0.3);
    background: rgba(0, 0, 0, 0.1);
    border-radius: 2px;
    z-index: 2;
}

/* Box on Target: Glowing Success State */
.box-on-target {
    background-color: rgba(46, 204, 113, 0.1);
    position: relative;
    z-index: 10;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* The Green Crate Object */
.box-on-target::after {
    content: '';
    position: absolute;
    width: 80%;
    height: 80%;
    background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
    border-radius: 2px;
    box-shadow:
        0 0 15px rgba(46, 204, 113, 0.5),
        inset 0 0 0 1px rgba(255, 255, 255, 0.3);
    z-index: 1;
    transition: transform 0.2s ease-out;
    animation: pulse-box 2s infinite alternate;
}

/* Success Checkmark */
.box-on-target::before {
    content: '✓';
    color: white;
    font-size: 20px;
    font-weight: bold;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    z-index: 2;
}

@keyframes pulse-box {
    0% {
        transform: scale(1);
        box-shadow: 0 0 15px rgba(46, 204, 113, 0.5);
    }

    100% {
        transform: scale(1.05);
        box-shadow: 0 0 25px rgba(46, 204, 113, 0.8);
    }
}

/* Player: Futuristic Character */
.player {
    background: transparent;
    box-shadow: none;
    z-index: 20;
    display: flex;
    justify-content: center;
    align-items: center;
    --face-rot: 0deg;
}

.player-base-floor {
    background-color: var(--floor-color);
}

.player-base-target {
    background-color: rgba(46, 204, 113, 0.15);
}

.player-facing-up {
    --face-rot: 0deg;
}

.player-facing-down {
    --face-rot: 0deg;
}

.player-facing-left {
    --face-rot: 0deg;
}

.player-facing-right {
    --face-rot: 0deg;
}

.player::before {
    content: '🤖';
    /* Robot emoji or similar */
    font-size: 32px;
    animation: float-player 4.2s ease-in-out infinite;
    filter: drop-shadow(0 5px 5px rgba(0, 0, 0, 0.5));
    /* Shadow applied to character */
    transform-origin: 50% 60%;
}

.robot-angry .player::before,
.robot-angry .player-on-target::before {
    /* Angry robot mode */
    animation: angry-robot 0.18s infinite linear;
    filter: drop-shadow(0 0 14px rgba(255, 72, 72, 0.9));
}

.robot-angry .player::after {
    content: '💢';
    position: absolute;
    top: 4px;
    right: 6px;
    font-size: 14px;
    z-index: 30;
    filter: drop-shadow(0 0 10px rgba(255, 72, 72, 0.6));
}

@keyframes angry-robot {
    0% {
        transform: translate(-1px, 0) rotate(0deg) scale(1.08);
    }

    25% {
        transform: translate(1px, -1px) rotate(0deg) scale(1.08);
    }

    50% {
        transform: translate(1px, 1px) rotate(0deg) scale(1.08);
    }

    75% {
        transform: translate(-1px, 1px) rotate(0deg) scale(1.08);
    }

    100% {
        transform: translate(-1px, 0) rotate(0deg) scale(1.08);
    }
}

.player-moving-left::before,
.player-on-target-moving-left::before {
    animation: player-move-left 0.16s ease-out !important;
}

.player-moving-right::before,
.player-on-target-moving-right::before {
    animation: player-move-right 0.16s ease-out !important;
}

.player-moving-up::before,
.player-on-target-moving-up::before {
    animation: player-move-up 0.16s ease-out !important;
}

.player-moving-down::before,
.player-on-target-moving-down::before {
    animation: player-move-down 0.16s ease-out !important;
}

.player-moving::before,
.player-on-target-moving::before {
    animation: player-move-bob 0.16s ease-out !important;
}

@keyframes player-move-bob {
    0% {
        transform: translateY(0) rotate(0deg) scaleX(1.02) scaleY(0.98);
    }
    30% {
        transform: translateY(-1.5px) rotate(0deg) scaleX(0.995) scaleY(1.03);
    }
    70% {
        transform: translateY(-0.5px) rotate(0deg) scaleX(1.01) scaleY(0.995);
    }
    100% {
        transform: translateY(0) rotate(0deg) scale(1.08);
    }
}

@keyframes player-move-left {
    0% {
        transform: translateY(0) rotate(calc(var(--face-rot) - 2deg)) scaleX(1.02) scaleY(0.98);
    }
    30% {
        transform: translateY(-1.5px) rotate(calc(var(--face-rot) - 4deg)) scaleX(0.995) scaleY(1.03);
    }
    70% {
        transform: translateY(-0.5px) rotate(calc(var(--face-rot) - 2deg)) scaleX(1.01) scaleY(0.995);
    }
    100% {
        transform: translateY(0) rotate(var(--face-rot)) scale(1.08);
    }
}

@keyframes player-move-right {
    0% {
        transform: translateY(0) rotate(calc(var(--face-rot) + 2deg)) scaleX(1.02) scaleY(0.98);
    }
    30% {
        transform: translateY(-1.5px) rotate(calc(var(--face-rot) + 4deg)) scaleX(0.995) scaleY(1.03);
    }
    70% {
        transform: translateY(-0.5px) rotate(calc(var(--face-rot) + 2deg)) scaleX(1.01) scaleY(0.995);
    }
    100% {
        transform: translateY(0) rotate(var(--face-rot)) scale(1.08);
    }
}

@keyframes player-move-up {
    0% {
        transform: translateY(0) rotate(0deg) scaleX(1.02) scaleY(0.98);
    }
    30% {
        transform: translateY(-1.6px) rotate(0deg) scaleX(0.995) scaleY(1.03);
    }
    70% {
        transform: translateY(-0.6px) rotate(0deg) scaleX(1.01) scaleY(0.995);
    }
    100% {
        transform: translateY(0) rotate(0deg) scale(1.08);
    }
}

@keyframes player-move-down {
    0% {
        transform: translateY(0) rotate(0deg) scaleX(1.02) scaleY(0.98);
    }
    30% {
        transform: translateY(-1.1px) rotate(0deg) scaleX(0.995) scaleY(1.03);
    }
    70% {
        transform: translateY(-0.3px) rotate(0deg) scaleX(1.01) scaleY(0.995);
    }
    100% {
        transform: translateY(0) rotate(0deg) scale(1.08);
    }
}

.player-on-target {
    background: transparent;
    z-index: 20;
    display: flex;
    justify-content: center;
    align-items: center;
    /* Preserve target effect */
    box-shadow:
        inset 0 0 15px rgba(46, 204, 113, 0.2),
        0 0 10px rgba(46, 204, 113, 0.1);
}

.player-on-target::before {
    content: '🤖';
    font-size: 32px;
    filter: drop-shadow(0 0 10px var(--success-color));
    animation: float-player 4.2s ease-in-out infinite;
    transform-origin: 50% 60%;
}

.player-on-target::after {
    content: '';
    position: absolute;
    width: 16px;
    height: 16px;
    border: 3px solid var(--success-color);
    background: transparent;
    box-shadow: 0 0 15px var(--success-color);
    animation: pulse-target 3s infinite;
    z-index: -1;
}

.robot-angry .player-on-target::after {
    content: '💢';
    position: absolute;
    top: 4px;
    right: 6px;
    font-size: 14px;
    z-index: 30;
    filter: drop-shadow(0 0 10px rgba(255, 72, 72, 0.6));
    /* Reset animations/styles from the pulse */
    width: auto;
    height: auto;
    border: none;
    background: none;
    box-shadow: none;
    animation: none;
}

#message-content {
    width: 100%;
    max-width: 700px;
    padding: 4px;
    background: transparent;
    text-align: center;
}

#message-content h3 {
    color: var(--primary-color);
    margin: 0;
    font-size: 0.75rem;
    font-weight: bold;
    letter-spacing: 0.5px;
    text-transform: uppercase;
}

#message-content p {
    color: #cbd5e0;
    line-height: 1.35;
    font-size: 0.7rem;
    margin: 4px 0 0 0;
}

/* Controls */
#controls {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 15px;
    margin-top: 30px;
}

.btn {
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    font-family: 'Orbitron', sans-serif;
    font-size: 0.9rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
}

.btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.btn:active:not(:disabled) {
    transform: translateY(0);
}

#reset-btn {
    border-color: #e74c3c;
    color: #e74c3c;
}

#reset-btn:hover {
    background: rgba(231, 76, 60, 0.2);
}

#undo-btn {
    border-color: #f39c12;
    color: #f39c12;
}

#undo-btn:hover {
    background: rgba(243, 156, 18, 0.2);
}

#prev-btn,
#next-btn {
    border-color: #3498db;
    color: #3498db;
}

#prev-btn:hover,
#next-btn:hover {
    background: rgba(52, 152, 219, 0.2);
}

#music-btn {
    border-color: #9b59b6;
    color: #9b59b6;
}

#music-btn:hover {
    background: rgba(155, 89, 182, 0.2);
}

.btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    border-color: #555;
    color: #555;
}

/* Instructions */
#instructions {
    margin-top: 30px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    font-size: 0.9rem;
    color: #a0aec0;
    max-width: 600px;
    margin-left: auto;
    margin-right: auto;
}

.instruction-title {
    color: var(--primary-color);
    font-weight: bold;
    margin-bottom: 10px;
    display: block;
}

.key {
    display: inline-block;
    padding: 2px 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    color: #fff;
    font-family: monospace;
    margin: 0 2px;
}

.mobile-tip {
    margin-top: 15px;
    font-size: 0.85rem;
    color: #9aa5b1;
}

.credits {
    margin-top: 12px;
    font-size: 0.75rem;
    color: #718096;
}

.credits a {
    color: var(--primary-color);
    text-decoration: none;
}

.credits a:hover {
    text-decoration: underline;
}

/* Mobile Controls */
#mobile-controls {
    display: none;
    margin-top: 25px;
    justify-content: center;
    width: 100%;
}

.mobile-controls-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 40px;
    width: 100%;
    max-width: 500px;
}

.control-group {
    display: flex;
    gap: 20px;
}

.d-pad-btn {
    width: 72px;
    height: 72px;
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 18px;
    font-size: 28px;
    color: var(--primary-color);
    box-shadow:
        0 4px 15px rgba(0, 0, 0, 0.3),
        inset 0 0 0 1px rgba(255, 255, 255, 0.05);
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    touch-action: manipulation;
    user-select: none;
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.d-pad-btn:focus-visible {
    outline: 3px solid rgba(0, 242, 255, 0.8);
    outline-offset: 3px;
}

.d-pad-btn:active {
    background: rgba(255, 255, 255, 0.25);
    transform: scale(0.94);
}

@media (max-width: 1024px) {
    #mobile-controls {
        display: flex;
    }
}

/* Animations */
@keyframes pulse-target {
    0% {
        transform: scale(0.8);
        opacity: 0.5;
    }

    50% {
        transform: scale(1.2);
        opacity: 0.8;
    }

    100% {
        transform: scale(0.8);
        opacity: 0.5;
    }
}

@keyframes float-player {

    0%,
    100% {
        transform: translateY(0) rotate(var(--face-rot)) scaleX(1.08) scaleY(1);
    }

    20% {
        transform: translateY(-1.5px) rotate(var(--face-rot)) scaleX(1.08) scaleY(1);
    }

    40% {
        transform: translateY(-0.9px) rotate(var(--face-rot)) scaleX(1.08) scaleY(1);
    }

    55% {
        transform: translateY(-1.5px) rotate(var(--face-rot)) scaleX(1.08) scaleY(1);
    }

    /* Quick blink */
    56% {
        transform: translateY(-1.45px) rotate(var(--face-rot)) scaleX(1.08) scaleY(0.12);
    }

    58% {
        transform: translateY(-1.3px) rotate(var(--face-rot)) scaleX(1.08) scaleY(1);
    }

    75% {
        transform: translateY(-0.5px) rotate(var(--face-rot)) scaleX(1.08) scaleY(1);
    }
}

/* Missing Animations from JS interactions */
.celebrating {
    animation: board-celebrate 1.5s ease-in-out;
}

@keyframes board-celebrate {

    0%,
    100% {
        box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    }

    50% {
        box-shadow: 0 0 60px rgba(0, 255, 136, 0.5), 0 20px 40px rgba(0, 0, 0, 0.4);
    }
}

.success-particle {
    position: absolute;
    pointer-events: none;
    z-index: 100;
    border-radius: 50%;
    /* JS handles the rest of the particle animation/style */
}

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

.modal-content {
    background: var(--container-bg);
    padding: 30px;
    border-radius: 24px;
    border: 1px solid rgba(0, 242, 255, 0.3);
    width: 90%;
    max-width: 500px;
    text-align: center;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
}

.modal-content h3 {
    margin-top: 0;
    color: var(--primary-color);
    letter-spacing: 2px;
}

#xsb-input,
#xsb-output {
    width: 100%;
    height: 200px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #fff;
    padding: 15px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    margin: 20px 0;
    resize: none;
    outline: none;
    box-sizing: border-box;
}

#xsb-input:focus,
#xsb-output:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 10px rgba(0, 242, 255, 0.2);
}

#xsb-output[readonly] {
    opacity: 0.95;
}

.modal-buttons {
    display: flex;
    justify-content: center;
    gap: 15px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    #level-selector {
        gap: 8px;
    }

    #level-selector select,
    #level-selector button,
    #level-selector .spinner {
        flex: 1 1 140px;
    }

    #game-area {
        flex-direction: column;
        align-items: center;
    }

    #message-panel {
        width: 100%;
        max-width: 520px;
    }

    #game-board {
        padding: 8px;
    }

    .cell {
        width: 32px;
        height: 32px;
    }

    .player::before {
        font-size: 24px;
    }

    .box::before {
        border-width: 1px;
    }

    h1 {
        font-size: 2rem;
    }

    .games-hub-link {
        font-size: 0.82rem;
        line-height: 1.4;
        max-width: min(100%, 320px);
        margin-bottom: 18px;
        overflow-wrap: anywhere;
    }

    #game-container {
        padding: 15px;
    }

    .mobile-controls-container {
        gap: 20px;
    }

    .d-pad-btn {
        width: 64px;
        height: 64px;
        font-size: 24px;
    }
}
