/* CRT Amber Monochrome Theme */
@import url('https://fonts.googleapis.com/css2?family=Share+Tech+Mono&display=swap');

/* Custom Eck font for headings */
@font-face {
    font-family: 'Eck';
    src: url('Eckmannpsych-Large.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

/* Base styles with CRT effects */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Share Tech Mono', monospace;
    line-height: 1.6;
    background-color: #000;
    color: #ffb000;
    padding: 20px;
    font-size: 14px;
    text-shadow: 0 0 1px #ffb000;
    position: relative;
    overflow-x: hidden;
}

/* CRT Screen effect overlay */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: 
        linear-gradient(transparent 50%, rgba(0, 255, 0, 0.01) 50%),
        linear-gradient(90deg, transparent 50%, rgba(255, 0, 0, 0.01) 50%);
    background-size: 1px 2px, 2px 1px;
    pointer-events: none;
    z-index: 1000;
    animation: crt-flicker 2s infinite linear alternate;
}

@keyframes crt-flicker {
    0% { opacity: 1; }
    95% { opacity: 1; }
    97% { opacity: 0.99; }
    100% { opacity: 1; }
}

/* Scanline effect */
body::after {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 2px,
        rgba(255, 176, 0, 0.02) 3px,
        rgba(255, 176, 0, 0.02) 4px
    );
    pointer-events: none;
    z-index: 999;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
    z-index: 1;
}

h1 {
    font-family: 'Eck', 'Share Tech Mono', monospace !important;
    text-align: center;
    margin-bottom: 20px;
    color: #ffb000;
    text-shadow: 0 0 2px #ffb000;
    font-size: 4em;
    font-weight: normal;
    letter-spacing: 0.05em;
}

/* Game area layout */
.game-area {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
}

.board-container {
    flex: 0 1 auto;
    padding: 10px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    align-self: flex-start;
    min-width: 660px;
    /* border: 2px solid #ffb000;
    border-radius: 8px; */
    background: rgba(255, 176, 0, 0.05);
    box-shadow: 0 0 5px rgba(255, 176, 0, 0.15);
}

.control-panel {
    flex: 1;
    min-width: 450px;
    padding: 10px;
    /* border: 2px solid #ffb000;
    border-radius: 8px; */
    background: rgba(255, 176, 0, 0.05);
    box-shadow: 0 0 5px rgba(255, 176, 0, 0.15);
}

/* Board styling */
#board {
    display: grid;
    grid-template-columns: repeat(10, 64px);
    grid-template-rows: repeat(10, 64px);
    gap: 0;
    background-color: #1a1100;
    /* border: 3px solid #ffb000; */
    box-sizing: border-box;
    max-width: fit-content;
    margin: 0 auto;
    box-shadow: 0 0 6px rgba(255, 176, 0, 0.2);
}

.tile {
    width: 64px;
    height: 64px;
    background-color: #1a1100;
    position: relative;
    /* Removed flexbox centering since objects use absolute positioning */
    transition: background-color 0.2s;
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    border-right: 1px dashed #554400;
    border-bottom: 1px dashed #554400;
}

/* Remove right border from rightmost tiles */
.tile:nth-child(10n) {
    border-right: none;
}

/* Remove bottom border from bottom row tiles */
.tile:nth-last-child(-n+10) {
    border-bottom: none;
}

.tile:hover {
    background-color: #2a1f00;
    box-shadow: inset 0 0 6px rgba(255, 176, 0, 0.2);
}

/* Rover destination tile highlight */
.tile.rover-destination {
    background-color: #332200 !important;
    box-shadow: inset 0 0 10px rgba(255, 176, 0, 0.4);
    animation: pulse-tile 0.8s ease-in-out;
}

@keyframes pulse-tile {
    0% { background-color: #1a1100; }
    50% { background-color: #332200; }
    100% { background-color: #1a1100; }
}

/* Coordinate labels */
.tile::before {
    content: attr(data-coords);
    position: absolute;
    bottom: 2px;
    right: 2px;
    font-size: 10px;
    color: #996600;
    font-family: 'Share Tech Mono', monospace;
}

/* Rover styling - narrow arrowhead with concave base */
.rover {
    width: 36px;
    height: 42px;
    position: absolute;
    top: 50%;
    left: 50%;
    margin-top: -21px; /* Half of height */
    margin-left: -18px; /* Half of width */
    transform: rotate(var(--rover-rotation, 0deg));
    transform-origin: center;
    filter: drop-shadow(0 0 3px #ffb000);
    transition: filter 0.3s ease;
    z-index: 10;
    background-color: #ffb000;
    clip-path: polygon(50% 0%, 100% 100%, 50% 85%, 0% 100%);
}

.rover-moving {
    animation: pulse-rover-amber 0.5s;
    filter: drop-shadow(0 0 6px #ffb000);
}

.rover-rotating {
    animation: flash-rover-amber 0.6s;
}

@keyframes pulse-rover-amber {
    0% { transform: scale(1) rotate(var(--rover-rotation, 0deg)); }
    50% { transform: scale(1.2) rotate(var(--rover-rotation, 0deg)); filter: drop-shadow(0 0 8px #ffb000); }
    100% { transform: scale(1) rotate(var(--rover-rotation, 0deg)); }
}

@keyframes flash-rover-amber {
    0% { 
        filter: drop-shadow(0 0 3px #ffb000);
        transform: rotate(var(--rover-rotation, 0deg));
    }
    50% { 
        filter: drop-shadow(0 0 6px #ffb000);
        transform: rotate(var(--rover-rotation, 0deg));
    }
    100% { 
        filter: drop-shadow(0 0 3px #ffb000);
        transform: rotate(var(--rover-rotation, 0deg));
    }
}


/* Sample styling */
.sample {
    width: 24px;
    height: 24px;
    background-color: #ffb000;
    border-radius: 4px;
    box-shadow: 0 0 5px #ffb000;
    animation: pulse-amber 2s infinite;
    z-index: 5;
    border: 1px solid #cc8800;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

@keyframes pulse-amber {
    0% { transform: translate(-50%, -50%) scale(1); box-shadow: 0 0 5px #ffb000; }
    50% { transform: translate(-50%, -50%) scale(1.1); box-shadow: 0 0 8px #ffb000; }
    100% { transform: translate(-50%, -50%) scale(1); box-shadow: 0 0 5px #ffb000; }
}

/* Hazard styling - X shape */
.hazard {
    width: 40px;
    height: 40px;
    background-color: #ffb000;
    clip-path: polygon(20% 0%, 0% 20%, 30% 50%, 0% 80%, 20% 100%, 50% 70%, 80% 100%, 100% 80%, 70% 50%, 100% 20%, 80% 0%, 50% 30%);
    box-shadow: 0 0 8px #ffb000;
    animation: rotate-amber 8s linear infinite;
    z-index: 5;
    opacity: 0.8;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

@keyframes rotate-amber {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Deadly hazard styling */
.deadly-hazard {
    width: 100%;
    height: 100%;
    background-color: #000;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 3;
    border-radius: 0;
    box-shadow: inset 0 0 8px #ffb000;
    border: 2px solid #ffb000;
}

/* Deadly hazard hit effect */
.deadly-hazard-hit {
    animation: deadly-hazard-warning-amber 0.7s ease-in-out;
    box-shadow: inset 0 0 15px #ffb000;
}

@keyframes deadly-hazard-warning-amber {
    0% { background-color: #1a1100; }
    25% { background-color: #000; }
    50% { background-color: #ffb000; }
    75% { background-color: #000; }
    100% { background-color: #1a1100; }
}

/* Hazard hit effect */
.hazard-hit {
    animation: hazard-warning-amber 0.7s ease-in-out;
    box-shadow: inset 0 0 10px #ffb000;
}

@keyframes hazard-warning-amber {
    0% { background-color: #1a1100; }
    25% { background-color: #332200; }
    50% { background-color: #ffb000; }
    75% { background-color: #332200; }
    100% { background-color: #1a1100; }
}

/* Sample collection effect */
.sample-collected {
    animation: sample-collect-amber 0.7s ease-in-out;
    box-shadow: inset 0 0 10px #ffb000;
}

@keyframes sample-collect-amber {
    0% { background-color: #1a1100; }
    50% { background-color: #332200; }
    100% { background-color: #1a1100; }
}

/* Resource bar styling */
.resource-tracker {
    margin-bottom: 20px;
    position: relative;
}

#resource-bar {
    display: flex;
    border: 2px solid #ffb000;
    height: 50px;
    margin-top: 10px;
    position: relative;
    z-index: 1;
    width: 500px;
    max-width: 100%;
    background: #000;
    box-shadow: 0 0 8px rgba(255, 176, 0, 0.2);
}

.resource-cell {
    flex: 1;
    border-right: 1px solid #ffb000;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #1a1100;
    color: #ffb000;
    font-family: 'VT323', monospace;
}

.resource-cell:last-child {
    border-right: none;
}

/* Resource cell states */
.resource-cell.current {
    background-color: #554400 !important;
    box-shadow: inset 0 0 10px rgba(255, 176, 0, 0.3);
}

#resource-marker {
    visibility: hidden;
    width: 30px;
    height: 30px;
    background-color: #ffb000;
    border-radius: 50%;
    position: absolute;
    top: 35px;
    left: 15px;
    transform: translateX(-50%);
    z-index: 2;
    box-shadow: 0 0 8px #ffb000;
    border: 2px solid #cc8800;
}

/* Card styling */
.hand, .stack, .shared-memory {
    display: flex;
    gap: 10px;
    min-height: 100px;
    padding: 10px;
    background-color: #1a1100;
    border-radius: 4px;
    margin-bottom: 15px;
    border: 1px solid #ffb000;
    box-shadow: 0 0 6px rgba(255, 176, 0, 0.15);
    perspective: 1000px;
}

.stack {
    position: relative;
    min-height: 140px;
    height: auto;
    padding-left: 20px;
    padding-bottom: 20px;
}

/* Card styling with 3D effects for flipping */
.card {
    width: 80px;
    height: 120px;
    border-radius: 8px;
    cursor: pointer;
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.3s ease, opacity 0.3s ease;
}

/* Card face - front side with instructions */
.card-face {
    width: 100%;
    height: 100%;
    position: absolute;
    backface-visibility: hidden;
    border-radius: 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    font-size: 14px;
    padding: 5px;
    box-shadow: 0 0 6px rgba(255, 176, 0, 0.2);
    background: #1a1100;
    border: 2px solid #ffb000;
    color: #ffb000;
    font-family: 'VT323', monospace;
}

/* Card back */
.card-back {
    width: 100%;
    height: 100%;
    position: absolute;
    backface-visibility: hidden;
    border-radius: 8px;
    background: #000;
    border: 2px solid #ffb000;
    box-shadow: 0 0 8px rgba(255, 176, 0, 0.2);
    transform: rotateY(180deg);
}

/* Card back pattern */
.card-back::after {
    content: '';
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    bottom: 10px;
    background: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 2px,
        rgba(255, 176, 0, 0.2) 2px,
        rgba(255, 176, 0, 0.2) 4px
    );
    border-radius: 5px;
}

/* Flipped state */
.card.flipped {
    transform: rotateY(180deg);
}

/* Cards in instruction stack are always face-up */
#instruction-stack .card {
    transform: rotateY(0deg);
}

/* Cards in the player's hand */
.card.playable {
    cursor: grab;
    transform: rotateY(0deg);
}

#player-hand .card:hover {
    transform: translateY(-4px) scale(1.04) rotateX(-5deg) !important;
    box-shadow: 
        0 15px 20px rgba(0, 0, 0, 0.8),
        0 12px 20px rgba(255, 176, 0, 0.3),
        0 0 20px rgba(255, 176, 0, 0.5) !important;
    z-index: 20 !important;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.1s ease;
}

/* Card hover overlay */
.card-hover-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    border-radius: 8px;
    overflow: hidden;
    pointer-events: none;
}

#player-hand .card:hover .card-hover-overlay {
    display: flex;
    pointer-events: auto;
}

.card-zone {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    background: rgba(255, 176, 0, 0.2);
    border: 1px solid #ffb000;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: 'VT323', monospace;
    font-size: 14px;
    color: #ffb000;
}

.memory-zone {
    border-bottom: 1px solid #ffb000;
    flex-direction: column;
}

.stack-zone {
    border-top: 1px solid #ffb000;
    flex-direction: column;
}

.zone-arrow {
    font-size: 20px;
    font-weight: bold;
}

.zone-label {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.card-zone:hover:not(.disabled) {
    background: rgba(0, 0, 0, 0.9);
    color: #ffb000;
    text-shadow: 0 0 4px rgba(255, 176, 0, 0.6);
    border-width: 3px;
}

.card-zone.disabled {
    background: rgba(0, 0, 0, 0.9);
    color: #554400;
    cursor: not-allowed;
    opacity: 0.5;
}

.card-zone.disabled:hover {
    background: rgba(0, 0, 0, 0.9);
    color: #554400;
}

.card.playable:active {
    cursor: grabbing;
    transform: translateY(-3px) scale(1.02) rotateY(0deg);
    transition: transform 0.1s, box-shadow 0.1s;
}

/* Card animating between containers */
.card-animating {
    z-index: 2000 !important;
}

.card.playable .card-face {
    box-shadow: 0 0 15px rgba(255, 176, 0, 0.4);
    background: #332200;
}

/* Cards in the stack */
#instruction-stack .card {
    margin-bottom: 5px;
    box-shadow: 0 0 6px rgba(255, 176, 0, 0.2);
    transition: all 0.2s ease-in-out;
}

#instruction-stack .card:hover {
    transform: translateY(-3px) rotateY(0deg);
    box-shadow: 0 0 10px rgba(255, 176, 0, 0.3);
    z-index: 10;
}

/* Flipped card in instruction stack that is being executed */
#instruction-stack .card.active {
    transform: rotateY(0deg) scale(1.15);
    z-index: 100;
    box-shadow: 0 0 12px #ffb000;
}

/* Card face when actively executing */
#instruction-stack .card.active .card-face {
    box-shadow: 0 0 15px 8px #ffb000 !important;
    border: 2px solid #ffb000 !important;
    background-color: #554400 !important;
}

/* Stack card positioning */
#instruction-stack .card {
    display: inline-block;
    position: relative;
    margin-right: -40px;
    margin-bottom: 5px;
    transition: transform 0.2s ease-out, margin-right 0.2s ease-out;
}

#instruction-stack .card:hover {
    transform: translateY(-10px) rotateY(0deg);
    margin-right: -20px;
    z-index: 10;
}

#instruction-stack .card {
    box-shadow: -2px 2px 5px rgba(255, 176, 0, 0.3);
}

#instruction-stack .card:last-child {
    box-shadow: -3px 3px 8px rgba(255, 176, 0, 0.4);
    border-color: #ffb000;
}

/* Shared memory section layout */
.shared-memory-section {
    margin-top: 20px;
    border: 2px solid #ffb000;
    border-radius: 4px;
    padding: 10px;
    background-color: #1a1100;
    box-shadow: 0 0 15px rgba(255, 176, 0, 0.2);
}

.shared-memory-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.shared-memory-header h3 {
    margin: 0;
    color: #ffb000;
    text-shadow: 0 0 2px #ffb000;
}

.memory-info {
    padding: 5px 10px;
    background-color: #332200;
    border-radius: 4px;
    border: 1px solid #ffb000;
    flex-shrink: 0;
    font-size: 14px;
    font-weight: bold;
    color: #ffb000;
    font-family: 'VT323', monospace;
}

.shared-memory {
    background-color: #332200;
    border: 1px solid #ffb000;
    min-height: 120px;
}

/* Shared memory cards styling */
.shared-memory-card {
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

#shared-memory .card:hover {
    transform: translateY(-4px) scale(1.04) rotateX(-4deg) !important;
    box-shadow: 
        0 15px 20px rgba(0, 0, 0, 0.75),
        0 10px 16px rgba(255, 176, 0, 0.3),
        0 0 18px rgba(255, 176, 0, 0.4) !important;
    z-index: 20 !important;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.1s ease;
}

.shared-memory-card .card-face {
    background: #332200;
    border-color: #ffb000;
}

.shared-memory-help {
    margin-top: 10px;
    text-align: center;
}

.shared-memory-help small {
    color: #cc8800;
    font-style: italic;
    font-family: 'VT323', monospace;
}

/* Stack section layout */
.stack-section {
    margin-top: 20px;
    border: 2px solid #ffb000;
    border-radius: 4px;
    padding: 10px;
    background-color: #1a1100;
    box-shadow: 0 0 15px rgba(255, 176, 0, 0.2);
}

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

.stack-header h3 {
    margin: 0;
    color: #ffb000;
    text-shadow: 0 0 2px #ffb000;
}

/* Execution status */
.execution-status {
    padding: 5px 10px;
    background-color: #332200;
    border-radius: 4px;
    border: 1px solid #ffb000;
    flex-shrink: 0;
    color: #ffb000;
    font-family: 'VT323', monospace;
    max-width: 50%;
    overflow: hidden;
}

.execution-status p {
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

#current-action {
    font-weight: bold;
    color: #ffb000;
    text-shadow: 0 0 2px #ffb000;
}

#current-score {
    font-weight: bold;
    font-size: 1.2em;
    color: #ffb000;
    text-shadow: 0 0 3px #ffb000;
}

/* Actions area */
.actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 10px;
}

/* Buttons */
button {
    padding: 10px 15px;
    background-color: #332200;
    color: #ffb000;
    border: 2px solid #ffb000;
    border-radius: 4px;
    cursor: pointer;
    font-size: 15px;
    font-family: 'VT323', monospace;
    transition: all 0.2s ease;
    box-shadow: 0 0 2px rgba(255, 176, 0, 0.15);
}

button:hover {
    background-color: #ffb000;
    color: #000;
    box-shadow: 0 0 5px rgba(255, 176, 0, 0.25);
}

button:disabled {
    background-color: #1a1100;
    color: #554400;
    border-color: #554400;
    cursor: not-allowed;
    box-shadow: none;
    text-shadow: none;
}

button:disabled:hover {
    background-color: #1a1100;
    color: #554400;
    border-color: #554400;
}

#restart-game {
    background-color: #4d1a00;
    border-color: #ffb000;
}

#restart-game:hover {
    background-color: #ffb000;
    color: #000;
}

/* Game status */
.game-status {
    margin-top: 20px;
    color: #ffb000;
    font-family: 'VT323', monospace;
}

/* Card deck status indicators */
.card-status {
    display: flex;
    justify-content: space-between;
    margin-top: 15px;
    margin-bottom: 15px;
    font-size: 14px;
    color: #cc8800;
    font-family: 'VT323', monospace;
}

.card-status span {
    font-weight: bold;
    color: #ffb000;
    text-shadow: 0 0 1px #ffb000;
}

/* Game settings */
.game-settings {
    display: flex;
    justify-content: space-between;
    margin-bottom: 15px;
    padding: 10px;
    background-color: #1a1100;
    border-radius: 4px;
    border: 2px solid #ffb000;
    box-shadow: 0 0 6px rgba(255, 176, 0, 0.15);
}

.setting-group {
    display: flex;
    align-items: center;
    gap: 8px;
}

.setting-group label {
    font-weight: bold;
    color: #ffb000;
    font-family: 'VT323', monospace;
    text-shadow: 0 0 1px #ffb000;
}

.setting-group select {
    padding: 8px 12px;
    border-radius: 4px;
    border: 2px solid #ffb000;
    background-color: #332200;
    color: #ffb000;
    font-size: 14px;
    font-family: 'VT323', monospace;
    cursor: pointer;
    box-shadow: 0 0 3px rgba(255, 176, 0, 0.2);
}

/* Card placement modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: all;
}

.modal.positioned {
    justify-content: flex-start;
    align-items: flex-start;
}

.modal-content {
    background-color: #1a1100;
    border: 3px solid #ffb000;
    border-radius: 8px;
    box-shadow: 0 0 15px rgba(255, 176, 0, 0.3);
    padding: 0;
    display: flex;
    flex-direction: column;
    min-width: 200px;
    overflow: hidden;
}


/* Discard selection modal */
#discard-selection-modal .modal-content {
    min-width: 400px;
    padding: 20px;
}

#discard-selection-modal h3 {
    margin: 0 0 10px 0;
    color: #ffb000;
    text-align: center;
    text-shadow: 0 0 2px #ffb000;
    font-family: 'VT323', monospace;
}

.discard-counter {
    margin: 0 0 15px 0;
    text-align: center;
    font-weight: bold;
    color: #cc8800;
    font-family: 'VT323', monospace;
}

.discard-cards {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 20px;
    justify-content: center;
    min-height: 80px;
}

.selectable-card {
    cursor: pointer;
    opacity: 0.8;
    transform: scale(0.8);
    transition: all 0.2s ease;
}

.selectable-card:hover {
    opacity: 1;
    transform: scale(0.85);
}

.selectable-card.selected {
    opacity: 1;
    transform: scale(0.85);
    box-shadow: 0 0 0 3px #ffb000;
}

.confirm-discard {
    padding: 10px 20px;
    background-color: #4d1a00;
    color: #ffb000;
    border: 2px solid #ffb000;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    font-family: 'VT323', monospace;
    align-self: center;
    box-shadow: 0 0 6px rgba(255, 176, 0, 0.2);
}

.confirm-discard:disabled {
    background-color: #1a1100;
    color: #554400;
    border-color: #554400;
    cursor: not-allowed;
    box-shadow: none;
}

.confirm-discard:not(:disabled):hover {
    background-color: #ffb000;
    color: #000;
    box-shadow: 0 0 10px rgba(255, 176, 0, 0.4);
}

/* Level selection modal */
.level-modal {
    background-color: rgba(0, 0, 0, 0.9);
}

.level-modal-content {
    background: #1a1100;
    color: #ffb000;
    padding: 30px;
    border-radius: 16px;
    /*border: 3px solid #ffb000; */
    box-shadow: 0 0 20px rgba(255, 176, 0, 0.3);
    max-width: 800px;
    width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
}

.level-modal-header {
    text-align: center;
    margin-bottom: 30px;
}

.level-modal-header h2 {
    font-family: 'Eck', 'Share Tech Mono', monospace;
    font-size: 4em;
    margin-bottom: 10px;
    text-shadow: 0 0 4px #ffb000;
    font-weight: normal;
}

.level-modal-header p {
    font-size: 1.2em;
    opacity: 0.9;
    font-family: 'VT323', monospace;
}

/* Instructions link in level modal */
.instructions-link {
    color: #ffb000;
    text-decoration: none;
    font-family: 'VT323', monospace;
    transition: all 0.2s ease;
    border-bottom: 1px dashed transparent;
}

.instructions-link:hover {
    color: #ffb000;
    text-shadow: 0 0 3px #ffb000;
    border-bottom: 1px dashed #ffb000;
}

/* Tab system */
.level-selection-tabs {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
    justify-content: center;
}

.tab-button {
    padding: 12px 24px;
    background: #332200;
    color: #ffb000;
    border: 2px solid #ffb000;
    border-radius: 25px;
    cursor: pointer;
    font-size: 1em;
    font-family: 'VT323', monospace;
    transition: all 0.3s ease;
    box-shadow: 0 0 6px rgba(255, 176, 0, 0.15);
}

.tab-button:hover {
    background: #554400;
    box-shadow: 0 0 15px rgba(255, 176, 0, 0.4);
}

.tab-button.active {
    background: #ffb000;
    color: #000;
    box-shadow: 0 0 10px rgba(255, 176, 0, 0.4);
}

/* Locked tab styles */
.tab-button.locked {
    background: #1a1100;
    color: #554400;
    border-color: #554400;
    cursor: not-allowed;
    opacity: 0.6;
}

.tab-button.locked:hover {
    background: #1a1100;
    box-shadow: none;
    transform: none;
}

/* Tab content */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

/* Random settings */
.random-settings {
    background: #332200;
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid #ffb000;
    box-shadow: 0 0 15px rgba(255, 176, 0, 0.2);
}

.random-settings h3 {
    margin-bottom: 20px;
    text-align: center;
    color: #ffb000;
    text-shadow: 0 0 2px #ffb000;
    font-family: 'VT323', monospace;
}

/* Hybrid mode styles */
.hybrid-description {
    background: #332200;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
    text-align: center;
    border: 1px solid #ffb000;
    box-shadow: 0 0 15px rgba(255, 176, 0, 0.2);
}

.hybrid-description h3 {
    margin-bottom: 10px;
    color: #ffb000;
    text-shadow: 0 0 2px #ffb000;
    font-family: 'VT323', monospace;
}

.hybrid-description p {
    font-size: 1em;
    opacity: 0.9;
    line-height: 1.4;
    font-family: 'VT323', monospace;
}

.hybrid-settings {
    background: #332200;
    padding: 25px;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid #ffb000;
    box-shadow: 0 0 15px rgba(255, 176, 0, 0.2);
}

.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
}

.setting-row label {
    flex: 1;
    text-align: left;
    font-weight: bold;
    color: #ffb000;
    font-family: 'VT323', monospace;
}

.setting-row select {
    flex: 0 0 120px;
    padding: 8px;
    border: 2px solid #ffb000;
    border-radius: 6px;
    background: #1a1100;
    color: #ffb000;
    font-size: 14px;
    font-family: 'VT323', monospace;
}

/* Difficulty filter */
.difficulty-filter {
    display: flex;
    gap: 8px;
    margin-bottom: 25px;
    justify-content: center;
    flex-wrap: wrap;
}

.difficulty-btn {
    padding: 8px 16px;
    background: #332200;
    color: #ffb000;
    border: 1px solid #ffb000;
    border-radius: 20px;
    cursor: pointer;
    font-size: 1em;
    font-family: 'VT323', monospace;
    transition: all 0.3s ease;
    box-shadow: 0 0 5px rgba(255, 176, 0, 0.2);
}

.difficulty-btn:hover {
    background: #554400;
    box-shadow: 0 0 10px rgba(255, 176, 0, 0.4);
}

.difficulty-btn.active {
    background: #ffb000;
    color: #000;
    box-shadow: 0 0 8px rgba(255, 176, 0, 0.4);
}

/* Scenarios grid */
.scenarios-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
    max-height: 400px;
    overflow-y: auto;
    padding: 10px;
}

.scenario-card {
    background: #332200;
    border: 2px solid #ffb000;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: left;
    box-shadow: 0 0 6px rgba(255, 176, 0, 0.15);
}

.scenario-card:hover {
    background: #554400;
    box-shadow: 0 0 20px rgba(255, 176, 0, 0.4);
    transform: translateY(-2px);
}

.scenario-card.selected {
    background: #ffb000;
    color: #000;
    box-shadow: 0 0 25px rgba(255, 176, 0, 0.6);
}

.scenario-card h4 {
    margin-bottom: 8px;
    font-size: 1.2em;
    font-family: 'VT323', monospace;
}

.scenario-difficulty {
    display: inline-block;
    padding: 3px 8px;
    background: rgba(255, 176, 0, 0.3);
    border-radius: 12px;
    font-size: 0.9em;
    margin-bottom: 10px;
    font-family: 'VT323', monospace;
}

.scenario-card.selected .scenario-difficulty {
    background: rgba(0, 0, 0, 0.3);
}

.scenario-description {
    font-size: 1em;
    line-height: 1.4;
    opacity: 0.9;
    font-family: 'VT323', monospace;
}

.scenario-card.selected .scenario-description {
    opacity: 0.8;
}

.scenario-stats {
    margin-top: 10px;
    font-size: 0.9em;
    opacity: 0.8;
    font-family: 'VT323', monospace;
}

/* Start button */
.start-button {
    padding: 15px 40px;
    background: #332200;
    color: #ffb000;
    border: 3px solid #ffb000;
    border-radius: 25px;
    font-size: 1.2em;
    font-family: 'VT323', monospace;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 5px rgba(255, 176, 0, 0.15);
    display: block;
    margin: 0 auto;
}

.start-button:hover {
    background: #ffb000;
    color: #000;
    transform: translateY(-2px);
    box-shadow: 0 0 12px rgba(255, 176, 0, 0.4);
}

.start-button:disabled {
    background: #1a1100;
    color: #554400;
    border-color: #554400;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
    text-shadow: none;
}

/* Endless mode styles */
.endless-description {
    text-align: center;
    margin-bottom: 30px;
}

.endless-description h3 {
    font-size: 1.8em;
    margin-bottom: 10px;
    text-shadow: 0 0 4px rgba(255, 176, 0, 0.4);
}

.endless-description p {
    font-size: 1.1em;
    color: rgba(255, 176, 0, 0.8);
}

.endless-options {
    padding: 20px;
}

.endless-options h4 {
    text-align: center;
    margin-bottom: 20px;
    font-size: 1.3em;
}

.endless-start-buttons {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-bottom: 30px;
}

.endless-start-btn {
    background: #332200;
    border: 2px solid #ffb000;
    border-radius: 12px;
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.endless-start-btn:hover {
    background: #554400;
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(255, 176, 0, 0.4);
}

.endless-start-btn:active {
    transform: translateY(0);
}

/* Locked tier button styles */
.endless-start-btn.locked {
    background: #1a1100;
    border-color: #554400;
    cursor: not-allowed;
    opacity: 0.6;
}

.endless-start-btn.locked:hover {
    background: #1a1100;
    transform: none;
    box-shadow: none;
}

.endless-start-btn.locked .start-title {
    color: #554400;
}

.endless-start-btn.locked .start-desc {
    color: rgba(85, 68, 0, 0.8);
}

.start-title {
    font-size: 1.4em;
    font-weight: bold;
    color: #ffb000;
    font-family: 'VT323', monospace;
}

.start-desc {
    font-size: 0.9em;
    color: rgba(255, 176, 0, 0.7);
}

.endless-stats {
    text-align: center;
    padding: 20px;
}

.endless-stats p {
    font-size: 1.2em;
    margin: 5px 0;
}

#endless-best, #endless-high-score {
    color: #ffb000;
    font-weight: bold;
    font-size: 1.3em;
}

/* Tutorial overlay styles */
.tutorial-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    min-height: 100vh;
    pointer-events: none;
    z-index: 9999;
}

.tutorial-content {
    position: absolute;
    background: #1a1100;
    border: 3px solid #ffb000;
    border-radius: 12px;
    padding: 35px 25px 20px 25px;
    max-width: 400px;
    pointer-events: auto;
    box-shadow: 0 0 30px rgba(255, 176, 0, 0.5), 0 0 60px rgba(255, 176, 0, 0.3);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tutorial-overlay.visible .tutorial-content {
    opacity: 1;
}

.tutorial-message {
    color: #ffb000;
    font-size: 1.1em;
    line-height: 1.5;
    margin-bottom: 15px;
    font-family: 'VT323', monospace;
    text-shadow: 0 0 3px rgba(255, 176, 0, 0.5);
}

.tutorial-close {
    position: absolute;
    top: 8px;
    right: 8px;
    background: transparent;
    color: #ffb000;
    border: 1px solid #ffb000;
    border-radius: 4px;
    width: 24px;
    height: 24px;
    font-size: 1.2em;
    cursor: pointer;
    font-family: 'VT323', monospace;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0;
}

.tutorial-close:hover {
    background: #ffb000;
    color: #000;
    box-shadow: 0 0 10px rgba(255, 176, 0, 0.5);
}

/* Tutorial arrows */
.tutorial-arrow {
    position: absolute;
    width: 0;
    height: 0;
    border-style: solid;
}

.tutorial-arrow.arrow-down {
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 15px 15px 0 15px;
    border-color: #ffb000 transparent transparent transparent;
}

.tutorial-arrow.arrow-up {
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    border-width: 0 15px 15px 15px;
    border-color: transparent transparent #ffb000 transparent;
}

.tutorial-arrow.arrow-left {
    left: -15px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 15px 15px 15px 0;
    border-color: transparent #ffb000 transparent transparent;
}

.tutorial-arrow.arrow-right {
    right: -15px;
    top: 50%;
    transform: translateY(-50%);
    border-width: 15px 0 15px 15px;
    border-color: transparent transparent transparent #ffb000;
}

/* Highlight effect for tutorial elements */
.tutorial-highlight {
    position: relative;
    z-index: 9998;
    box-shadow: 0 0 20px rgba(255, 176, 0, 0.8), 0 0 40px rgba(255, 176, 0, 0.5) !important;
    animation: tutorial-pulse 2s ease-in-out infinite;
}

@keyframes tutorial-pulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(255, 176, 0, 0.8), 0 0 40px rgba(255, 176, 0, 0.5);
    }
    50% {
        box-shadow: 0 0 30px rgba(255, 176, 0, 1), 0 0 60px rgba(255, 176, 0, 0.7);
    }
}

/* Instructions modal styles */
.instructions-modal {
    background-color: rgba(0, 0, 0, 0.9);
}

.instructions-modal-content {
    background: #1a1100;
    color: #ffb000;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 0 20px rgba(255, 176, 0, 0.3);
    max-width: 900px;
    width: 90vw;
    max-height: 85vh;
    overflow-y: auto;
    margin: 20px;
}

/* Custom scrollbar for instructions modal */
.instructions-modal-content::-webkit-scrollbar {
    width: 10px;
}

.instructions-modal-content::-webkit-scrollbar-track {
    background: #332200;
    border-radius: 5px;
}

.instructions-modal-content::-webkit-scrollbar-thumb {
    background: #ffb000;
    border-radius: 5px;
}

.instructions-modal-content::-webkit-scrollbar-thumb:hover {
    background: #cc8800;
}

.instructions-modal-header {
    text-align: center;
    margin-bottom: 40px;
    border-bottom: 2px solid #ffb000;
    padding-bottom: 20px;
}

.instructions-modal-header h2 {
    font-family: 'Eck', 'Share Tech Mono', monospace;
    font-size: 3.5em;
    margin-bottom: 10px;
    text-shadow: 0 0 4px #ffb000;
    font-weight: normal;
}

.instructions-modal-header p {
    font-size: 1.1em;
    opacity: 0.9;
    font-family: 'Share Tech Mono', monospace;
    color: #cc8800;
}

.instructions-body {
    line-height: 1.6;
}

.instructions-body section {
    margin-bottom: 30px;
}

.instructions-body h3 {
    color: #ffb000;
    font-size: 1.5em;
    margin-bottom: 15px;
    text-shadow: 0 0 2px #ffb000;
    font-family: 'Share Tech Mono', monospace;
}

.instructions-body h4 {
    color: #ffb000;
    font-size: 1.2em;
    margin-top: 20px;
    margin-bottom: 10px;
    font-family: 'Share Tech Mono', monospace;
}

.instructions-body p {
    margin-bottom: 15px;
    font-family: 'Share Tech Mono', monospace;
    color: #ffb000;
    opacity: 0.9;
}

.instructions-body ul {
    margin-left: 30px;
    margin-bottom: 15px;
}

.instructions-body li {
    margin-bottom: 8px;
    font-family: 'Share Tech Mono', monospace;
    color: #ffb000;
    opacity: 0.9;
}

.instructions-body strong {
    color: #ffb000;
    text-shadow: 0 0 1px #ffb000;
}

.instructions-footer {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px dashed #554400;
    text-align: center;
}

.instructions-footer small {
    color: #cc8800;
    font-style: italic;
    font-family: 'Share Tech Mono', monospace;
    opacity: 0.8;
}

/* Game result modal */
.game-result-modal {
    background-color: rgba(0, 0, 0, 0.9);
}

.game-result-modal-content {
    background: #1a1100;
    color: #ffb000;
    padding: 50px;
    border-radius: 16px;
    box-shadow: 0 0 30px rgba(255, 176, 0, 0.4);
    max-width: 600px;
    text-align: center;
    border: 3px solid #ffb000;
}

.game-result-modal-content h1 {
    font-family: 'Eck', 'Share Tech Mono', monospace !important;
    font-size: 4em;
    margin-bottom: 30px;
    color: #ffb000;
    text-shadow: 0 0 4px #ffb000;
    font-weight: normal;
    letter-spacing: 0.05em;
}

#game-result-message {
    font-size: 1.3em;
    margin-bottom: 40px;
    font-family: 'Share Tech Mono', monospace;
    color: #ffb000;
    line-height: 1.5;
    white-space: pre-line;
}

.game-result-buttons {
    display: flex;
    justify-content: center;
    gap: 20px;
}

.result-button {
    padding: 15px 40px;
    background: #332200;
    color: #ffb000;
    border: 3px solid #ffb000;
    border-radius: 25px;
    font-size: 1.2em;
    font-family: 'Share Tech Mono', monospace;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 0 10px rgba(255, 176, 0, 0.3);
}

.result-button:hover {
    background: #ffb000;
    color: #000;
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(255, 176, 0, 0.6);
}

/* Special styling for failure state */
.game-result-modal.failure .game-result-modal-content {
    border-color: #ff0000;
    box-shadow: 0 0 30px rgba(255, 0, 0, 0.4);
}

.game-result-modal.failure h1 {
    color: #ff0000;
    text-shadow: 0 0 4px #ff0000;
}

.game-result-modal.failure #game-result-message {
    color: #ff6666;
}

.game-result-modal.failure .result-button {
    border-color: #ff0000;
    color: #ff0000;
}

.game-result-modal.failure .result-button:hover {
    background: #ff0000;
    color: #000;
    box-shadow: 0 0 20px rgba(255, 0, 0, 0.6);
}