@font-face {
    font-family: 'Fredoka One';
    src: url('/FredokaOne-Regular.ttf') format('truetype');
    font-weight: normal;
    font-style: normal;
}

body {
    background-color: #333;
    color: #eee;
    font-family: 'Fredoka One', cursive;
    margin: 0;
    overflow: hidden;
    display: flex; /* Use flexbox for body */
    justify-content: center;
    align-items: center;
    min-height: 100vh; /* Ensure body takes full viewport height */
}

.hidden {
    display: none !important;
}

/* --- Selection Screen --- */
#selection-screen {
    position: relative; /* Changed from absolute for easier centering */
    background-color: #2c2c3e; /* Darker, richer background */
    padding: 2.5rem 2rem; /* Increased padding */
    border-radius: 15px; /* More rounded corners */
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.7); /* Stronger shadow */
    max-height: 95vh; /* Allow scrolling if content exceeds this height */
    overflow-y: auto; /* Enable vertical scrolling */
    width: 90%; /* Max width for smaller screens */
    max-width: 1200px; /* Constrain max width for larger screens */
    border: 2px solid #5a5a7a; /* Subtle border */
    text-align: center;
}

.selection-header {
    margin-bottom: 2rem;
}

.selection-header .logo {
    max-width: 200px; /* Adjust as needed */
    height: auto;
    margin-bottom: 0.5rem;
}

h1 {
    font-size: 2.8rem;
    color: #f0f0f0;
    text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.4);
    margin-top: 0;
    margin-bottom: 1.5rem;
}

h2 {
    font-size: 1.8rem;
    color: #e0e0e0;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid #4a4a6e; /* Underline for sections */
}

.selection-container {
    margin-bottom: 2.5rem; /* More space between sections */
    background-color: #383850; /* Slightly lighter container background */
    padding: 1.5rem;
    border-radius: 10px;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3); /* Inner shadow for depth */
}

.character-grid {
    display: flex;
    justify-content: center;
    gap: 1rem; /* Slightly reduced gap for more characters per row */
    flex-wrap: wrap; 
    margin: 0 auto; 
}

.char-card {
    background-color: #4a4a6e; /* Card background */
    border: 3px solid #6c6ca0; /* Default border */
    border-radius: 10px; /* More rounded */
    padding: 0.8rem; /* Slightly less padding */
    cursor: pointer;
    transition: all 0.2s ease-in-out;
    width: 140px; /* Slightly smaller cards */
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: space-between; 
    min-height: 170px; /* Consistent height */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3); /* Card shadow */
    color: #f0f0f0; /* Default text color for non-rainbow text */
}

.char-card.lethal {
    background-color: #704040; /* Muted red background */
    border-color: #a06060;
}

.char-card.lethal.selected {
    border-color: #ff6b6b;
    box-shadow: 0 0 15px #ff6b6b; /* Stronger glow for lethal selected */
}

.char-card:hover {
    transform: translateY(-3px) scale(1.03); /* Lift effect */
    border-color: #a2daff;
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.4);
}

.char-card.selected {
    border-color: #8aff8a; /* Bright green for selected */
    box-shadow: 0 0 15px #8aff8a; /* Stronger glow */
    background-color: #557755; /* Slightly different selected background */
    transform: translateY(-2px); /* Maintain slight lift */
}

.char-card img {
    width: 90px; /* Slightly smaller image */
    height: 90px;
    object-fit: contain;
    margin-bottom: 0.4rem;
    border-radius: 5px; /* Slight roundness for images */
}

/* Make Pebble's name rainbow text */
.char-card[data-toon="pebble"] span {
    background: linear-gradient(to right, #6666ff, #0099ff , #00ff00, #ff3399, #6666ff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: rainbow_animation 6s ease-in-out infinite;
    background-size: 400% 100%;
}

.char-card span {
    display: block;
    font-weight: bold;
    font-size: 1.1rem; /* Slightly larger name font */
}

.rainbow-text {
    background: linear-gradient(to right, #6666ff, #0099ff , #00ff00, #ff3399, #6666ff);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    animation: rainbow_animation 6s ease-in-out infinite;
    background-size: 400% 100%;
}

@keyframes rainbow_animation {
    0%,100% {
        background-position: 0 0;
    }

    50% {
        background-position: 100% 0;
    }
}

/* New styles for toon stats display */
.stats-display {
    background-color: #4a4a6e;
    border: 1px solid #6c6ca0;
    border-radius: 10px;
    padding: 1.2rem;
    margin-top: 1.5rem;
    text-align: left;
    max-width: 450px; /* Slightly wider */
    margin-left: auto;
    margin-right: auto;
    box-shadow: inset 0 1px 5px rgba(0, 0, 0, 0.2);
}

.stats-display h3 {
    margin-top: 0;
    margin-bottom: 1rem;
    color: #f0f0f0;
    text-align: center;
    font-size: 1.5rem;
}

.stats-display p {
    margin: 0.5rem 0; /* More vertical spacing */
    color: #ccc;
    font-size: 1rem; /* Slightly larger font */
    display: flex; /* Align label and value */
    justify-content: space-between; /* Push value to right */
    align-items: center;
    padding: 0.2rem 0;
}

.stats-display strong {
    color: #fff;
    width: 180px; /* Align labels */
    display: inline-block;
    flex-shrink: 0; /* Prevent shrinking */
}

.stats-display span {
    flex-grow: 1; /* Allow value to take remaining space */
    text-align: right; /* Align value to the right */
    padding: 0 0 0 10px; /* Space between label and value */
}

.skill-description {
    font-style: italic;
    font-size: 0.9rem; /* Smaller for description */
    color: #b0b0d0;
    margin-top: 1rem;
    padding-top: 0.5rem;
    border-top: 1px dashed #6a6a8e; /* Separator for skill description */
    flex-direction: column; /* Stack skill label and description */
    align-items: flex-start;
}

.skill-description strong {
    width: auto; /* Allow skill label to take natural width */
    margin-bottom: 0.3rem;
}

.skill-description span {
    text-align: left; /* Align description text to the left */
    font-style: normal;
}

/* Simulation Controls */
.sim-controls {
    display: flex;
    justify-content: center;
    gap: 2.5rem; /* More space */
    align-items: center;
    background-color: #33334a;
    padding: 1.2rem;
    border-radius: 10px;
    margin-top: 1.5rem;
    box-shadow: inset 0 1px 5px rgba(0, 0, 0, 0.2);
    flex-wrap: wrap; /* Allow wrapping for adjustment controls */
}

.sim-controls div {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
}

.sim-controls label {
    font-size: 1.15rem;
    color: #f0f0f0;
}

.sim-controls input[type="number"] {
    width: 70px; /* Wider */
    padding: 8px; /* More padding */
    font-family: 'Fredoka One', cursive;
    text-align: center;
    font-size: 1.1rem;
    background-color: #555570;
    color: white;
    border: 1px solid #777790;
    border-radius: 6px;
}

.sim-controls input[type="range"] {
    width: 180px; /* Wider slider */
    -webkit-appearance: none; /* Remove default styling */
    appearance: none;
    height: 10px;
    background: #6a6a8e; /* Track color */
    border-radius: 5px;
    outline: none;
    transition: opacity .2s;
}

.sim-controls input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #8aff8a; /* Thumb color */
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

.sim-controls input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #8aff8a;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

#game-speed-value {
    font-weight: bold;
    min-width: 50px; /* Prevent layout shift */
    text-align: center;
    font-size: 1.15rem;
    color: #8aff8a; /* Highlighted value */
}

.mobile-toggle-container {
    margin-top: 2rem;
    margin-bottom: 2rem;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.6rem;
    font-size: 1.15rem;
    color: #f0f0f0;
}

.mobile-toggle-container input {
    width: 20px; /* Larger checkbox */
    height: 20px;
    cursor: pointer;
}

.mobile-toggle-container label {
    cursor: pointer;
}

#start-game-btn, .selection-toggle-button {
    padding: 12px 25px; /* Larger button */
    font-size: 1.4rem; /* Larger font */
    background-color: #4CAF50;
    color: white;
    border: none;
    border-radius: 8px; /* More rounded */
    cursor: pointer;
    transition: background-color 0.2s, transform 0.1s;
    font-weight: bold;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    margin-top: 1rem;
    margin-bottom: 1rem;
}

#start-game-btn:hover:not(:disabled), .selection-toggle-button:hover {
    background-color: #45a049;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

#start-game-btn:disabled {
    background-color: #777;
    cursor: not-allowed;
    box-shadow: none;
}

.selection-toggle-button {
    background-color: #62627a; /* A different color for the toggle button */
}

.selection-toggle-button:hover {
    background-color: #55556a;
}

/* --- Game Container --- */
#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
}

#game-canvas {
    display: block;
    background-color: #5a5a5a;
}

#hud {
    position: absolute;
    top: 10px;
    left: 10px;
    right: 10px;
    display: flex;
    justify-content: space-between; /* Space out left and right HUD elements */
    align-items: flex-start;
    pointer-events: none; /* Allow clicks to pass through HUD */
}

.hud-top-left, .hud-top-right {
    display: flex;
    flex-direction: column;
    align-items: flex-start; /* Default for left */
    gap: 10px;
}

.hud-top-right {
    align-items: flex-end; /* Align right HUD elements to the right */
}

#seen-indicator {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    width: 80px;
    height: 80px;
    opacity: 0.8;
    animation: fadeIn 0.5s ease-out;
}

#seen-indicator img {
    width: 100%;
    height: 100%;
}

#floor-counter {
    background-color: rgba(0,0,0,0.5);
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 1.2rem;
    font-weight: bold;
    color: white;
}

#health-bar {
    display: flex;
    gap: 5px;
}

.heart {
    width: 30px;
    height: 30px;
    object-fit: contain;
}

#debuffs-container {
    position: absolute;
    left: 10px;
    top: 120px; /* Position it below the other left-hud items */
    display: flex;
    gap: 5px;
}

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

#stamina-container {
    width: 200px;
    height: 20px;
    background-color: rgba(0, 0, 0, 0.5);
    border: 2px solid #333;
    border-radius: 5px;
}

#event-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.95); /* Made darker */
    z-index: 50; /* Below HUD, above canvas */
    pointer-events: none;
    display: none; /* Controlled by JS */
}

#event-overlay.active {
    display: block;
}

#player-auras {
    display: flex;
    gap: 5px;
    margin-top: 5px;
}

.aura-icon {
    width: 24px;
    height: 24px;
    object-fit: contain;
    opacity: 0.8;
}

#stamina-bar {
    width: 100%;
    height: 100%;
    background-color: #42a5f5;
    border-radius: 3px;
    transition: width 0.1s linear;
}

/* New Tape Counter and Inventory Styles */
#tapes-counter {
    display: flex;
    align-items: center;
    background-color: rgba(0,0,0,0.5);
    padding: 5px 10px;
    border-radius: 5px;
    font-size: 1.2rem;
    font-weight: bold;
    color: white;
}

#tape-icon {
    font-size: 1.5rem;
    margin-right: 8px;
}

#inventory-slots {
    display: flex;
    gap: 5px;
}

.inventory-slot {
    width: 50px;
    height: 50px;
    background-color: rgba(0,0,0,0.4);
    border: 2px solid #888;
    border-radius: 5px;
    position: relative; /* For positioning item image and hotkey */
    display: flex;
    justify-content: center;
    align-items: center;
}

.inventory-slot img {
    width: 90%;
    height: 90%;
    object-fit: contain;
}

.inventory-hotkey {
    position: absolute;
    bottom: 2px;
    right: 4px;
    font-size: 0.8rem;
    font-weight: bold;
    color: white;
    background-color: rgba(0,0,0,0.6);
    padding: 1px 3px;
    border-radius: 3px;
}

#inventory-hotkeys {
    /* This container is no longer needed with the new design */
    display: none;
}

#game-over-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.75);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

#game-over-screen h2 {
    font-size: 4rem;
    margin-bottom: 1rem;
}

#restart-btn {
    padding: 10px 20px;
    font-size: 1.2rem;
    background-color: #ff9800;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background-color 0.2s;
}

#restart-btn:hover {
    background-color: #f57c00;
}

#interaction-prompt {
    position: absolute;
    bottom: 20%;
    left: 50%;
    transform: translateX(-50%);
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 10px 20px;
    border-radius: 8px;
    font-size: 1.2rem;
    pointer-events: none;
}

#action-prompts {
    position: absolute;
    bottom: 15%;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    gap: 10px;
    align-items: center;
    pointer-events: none;
}

.action-prompt {
    background-color: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 8px 15px;
    border-radius: 8px;
    font-size: 1.1rem;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Skill Check Bar --- */
#skill-check-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 500px; /* Increased from 400px */
    height: 100px; /* Increased from 80px */
    background-color: rgba(0, 0, 0, 0.7);
    border-radius: 10px;
    display: flex;
    flex-direction: column; /* Stack bar and text */
    align-items: center;
    justify-content: center;
    overflow: hidden;
    cursor: pointer; /* Indicate it's clickable */
    color: white;
    font-size: 1.2rem; /* Increased font size */
    padding-bottom: 5px;
    z-index: 150; /* Ensure it's above the blackout overlay */
}

#skill-check-bar-outer {
    position: relative;
    width: 90%; /* Bar fills most of the container */
    height: 25px; /* Increased from 20px */
    background-color: #555; /* Miss zone background */
    border-radius: 5px;
    margin-bottom: 8px; /* Space between bar and text */
}

#skill-check-bar-inner {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: hidden; /* Keep zones inside */
    border-radius: 5px;
}

#skill-check-target-good, 
#skill-check-target-great {
    position: absolute;
    top: 0;
    height: 100%;
    border-radius: 2px;
}

#skill-check-target-good {
    background-color: white;
}

#skill-check-target-great {
    background-color: gold;
}

#skill-check-needle {
    position: absolute;
    top: 0;
    left: 0; /* Position controlled by JS */
    width: 5px; /* Increased from 4px */
    height: 100%; /* Height of the needle */
    background-color: red;
    border-radius: 2px;
}

#popup-ad-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 200;
    pointer-events: none; /* Allows clicks to go through to the game */
}

.popup-ad {
    position: absolute;
    width: 300px; /* or whatever size */
    height: auto;
    border: 5px solid yellow;
    box-shadow: 0 0 20px black;
    animation: fadeInOut 5s forwards;
    z-index: 201;
    pointer-events: auto; /* Ads are clickable */
    cursor: pointer;
}

@keyframes fadeInOut {
    0% { opacity: 0; }
    10% { opacity: 1; }
    90% { opacity: 1; }
    100% { opacity: 0; }
}

/* --- Mobile Controls --- */
#mobile-controls {
    position: absolute;
    bottom: 20px;
    left: 0;
    right: 0;
    display: none; /* Hidden by default */
    justify-content: space-between;
    align-items: flex-end;
    padding: 0 20px;
    z-index: 300; /* Ensure it's above the game canvas */
    touch-action: none; /* Prevent browser gestures */
}

#mobile-controls.visible {
    display: flex; /* Show when mobile-mode is active */
}

#joystick-area {
    width: 150px;
    height: 150px;
    position: relative;
    touch-action: none; /* stop page scroll/zoom on drag */
}

#joystick-base {
    width: 120px;
    height: 120px;
    background-color: rgba(100, 100, 100, 0.5);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    border: 2px solid rgba(200, 200, 200, 0.7);
}

#joystick-handle {
    width: 60px;
    height: 60px;
    background-color: rgba(200, 200, 200, 0.7);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    touch-action: none; /* Prevent browser default touch actions */
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
}

#mobile-sprint-btn, #mobile-interact-btn, #mobile-skill-btn {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: rgba(0, 123, 255, 0.7);
    color: white;
    font-size: 0.9rem;
    font-weight: bold;
    border: 2px solid rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
    cursor: pointer;
    user-select: none; /* Prevent text selection on touch */
    -webkit-tap-highlight-color: transparent; /* Remove tap highlight */
    touch-action: none; /* prevent scrolling on press/hold */
}

#mobile-skill-btn {
    background-color: rgba(153, 50, 204, 0.7); /* A different color for the skill button */
}

#mobile-sprint-btn:active, #mobile-interact-btn:active, #mobile-skill-btn:active {
    background-color: rgba(0, 123, 255, 0.9);
}

#mobile-skill-btn:active {
    background-color: rgba(153, 50, 204, 0.9);
}

#mobile-sprint-btn.active, #mobile-interact-btn.active, #mobile-skill-btn.active {
    background-color: rgba(0, 180, 255, 0.9); /* Visual feedback when held */
}

#mobile-skill-btn.active {
    background-color: rgba(180, 80, 255, 0.9); /* Visual feedback when held */
}

/* New styles for game mode toggle */
.game-mode-container {
    background-color: #33334a; /* Consistent with sim controls */
    padding: 1.5rem;
    border-radius: 10px;
    margin-bottom: 2.5rem;
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.3);
}

.toggle-switch {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1.5rem; /* More space */
    margin-bottom: 1rem;
}

.toggle-switch span {
    font-size: 1.3rem; /* Larger font */
    font-weight: bold;
    color: #999;
    transition: color 0.2s;
}

.toggle-switch span.active {
    color: #fff;
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.5); /* Subtle glow */
}

#game-mode-desc {
    color: #ccc;
    font-style: italic;
    min-height: 1.2em; 
    font-size: 1rem;
}

.switch {
    position: relative;
    display: inline-block;
    width: 65px; /* Slightly wider switch */
    height: 38px; /* Slightly taller switch */
}

.switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #888; /* Darker grey for off state */
    -webkit-transition: .4s;
    transition: .4s;
    box-shadow: inset 0 1px 3px rgba(0,0,0,0.3);
}

.slider:before {
    position: absolute;
    content: "";
    height: 30px; /* Larger thumb */
    width: 30px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    -webkit-transition: .4s;
    transition: .4s;
    box-shadow: 0 2px 5px rgba(0,0,0,0.3);
}

input:checked + .slider {
    background-color: #6ed06f; /* Lighter green for on state */
}

input:focus + .slider {
    box-shadow: 0 0 1px #4CAF50;
}

input:checked + .slider:before {
    -webkit-transform: translateX(27px); /* Adjust for new width */
    -ms-transform: translateX(27px);
    transform: translateX(27px);
}

.slider.round {
    border-radius: 38px; /* Match new height */
}

.slider.round:before {
    border-radius: 50%;
}

/* Loading Screen Styles */
#loading-screen {
    position: fixed; /* Use fixed for full screen overlay */
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.9); /* More opaque */
    display: flex;
    flex-direction: column; /* Center content vertically and horizontally */
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

#loading-screen.hidden {
    display: none !important;
}

.loading-gif {
    max-width: 90%; /* Larger GIF */
    max-height: 90%;
    object-fit: contain;
    border-radius: 10px; /* Slight rounding */
    box-shadow: 0 0 20px rgba(0,0,0,0.5);
}

/* Game Adjustments */
.adjustment-controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); /* Responsive grid */
    gap: 1rem; /* Adjust gap for grid */
    padding: 1rem;
}

.adjustment-controls > div {
    display: flex;
    flex-direction: row; /* Checkbox and label in a row */
    align-items: center;
    justify-content: flex-start; /* Align left */
    gap: 0.5rem;
}

.adjustment-controls label {
    font-size: 1rem;
    color: #f0f0f0;
    white-space: nowrap; /* Prevent label wrapping */
}

.adjustment-controls input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.adjustment-controls button {
    padding: 8px 12px;
    font-size: 0.9rem;
    background-color: #555570;
    color: white;
    border: 1px solid #777790;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.adjustment-controls button:hover {
    background-color: #6a6a8e;
}

.debuff-controls {
    grid-column: 1 / -1; /* Span full width */
    display: flex;
    flex-wrap: wrap; /* Allow debuff buttons to wrap */
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    background-color: #44445c; /* Slightly different background */
    padding: 0.8rem;
    border-radius: 8px;
    margin-top: 0.5rem;
}

.debuff-controls label {
    margin-right: 0.5rem;
    font-weight: bold;
    color: #e0e0e0;
}

/* Responsive adjustments for smaller screens */
@media (max-width: 768px) {
    #selection-screen {
        padding: 1.5rem 1rem;
        max-height: 98vh;
        width: 95%;
    }

    h1 {
        font-size: 2rem;
    }

    h2 {
        font-size: 1.5rem;
    }

    .char-card {
        width: 120px;
        min-height: 150px;
        padding: 0.6rem;
    }

    .char-card img {
        width: 80px;
        height: 80px;
    }

    .char-card span {
        font-size: 1rem;
    }

    .stats-display, .sim-controls {
        padding: 1rem;
    }

    .stats-display p {
        font-size: 0.9rem;
    }

    .sim-controls {
        flex-direction: column;
        gap: 1.5rem;
    }

    #start-game-btn, .selection-toggle-button {
        font-size: 1.2rem;
        padding: 10px 20px;
    }

    .toggle-switch span {
        font-size: 1.1rem;
    }

    .switch {
        width: 50px;
        height: 28px;
    }

    .slider:before {
        height: 22px;
        width: 22px;
    }

    input:checked + .slider:before {
        -webkit-transform: translateX(22px);
        -ms-transform: translateX(22px);
        transform: translateX(22px);
    }

    .adjustment-controls {
        grid-template-columns: 1fr; /* Single column on small screens */
        gap: 0.8rem;
    }

    .debuff-controls {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    .debuff-controls button {
        width: 100%; /* Full width buttons */
    }
}

/* Debug element style */
#debug-machine-progress {
    position: absolute;
    bottom: 10px;
    left: 10px;
    color: white;
    background: rgba(0,0,0,0.7);
    padding: 5px;
    border-radius: 5px;
    font-size: 0.9em;
    pointer-events: none;
    z-index: 100;
}