/* ==============================================
   HEXIFY - Main Stylesheet
   ============================================== */

/* Google Fonts */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@400;700&display=swap');

/* ==============================================
   BASE STYLES
   ============================================== */
body {
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    font-family: 'Outfit', sans-serif;
    overflow: hidden;
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    -webkit-tap-highlight-color: transparent;
    -ms-touch-action: none;
}

/* Ensure canvas receives all touch events properly */
canvas {
    touch-action: none !important;
    -webkit-touch-callout: none !important;
    -webkit-user-select: none !important;
    user-select: none !important;
    -webkit-tap-highlight-color: transparent !important;
}

/* Ensure all interactive elements can receive touch events */
button,
.play-btn-large,
.sound-toggle,
.btn,
.level-node,
.back-btn,
.powerup-btn,
.intro-btn {
    cursor: pointer;
    pointer-events: auto !important;
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

/* Fix for potential itch.io iframe issues */
html,
body {
    width: 100%;
    height: 100%;
    position: fixed;
    top: 0;
    left: 0;
}

/* ==============================================
   UI LAYER
   ============================================== */
#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 20px;
    box-sizing: border-box;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s, visibility 0s 0.5s;
}

#ui-layer.visible {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.5s, visibility 0s 0s;
}

/* ==============================================
   PAUSE BUTTON & MODAL
   ============================================== */
.pause-btn {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
    font-size: 1.4rem;
    z-index: 50;
    /* Hidden by default - only visible when ui-layer is visible */
    opacity: 0;
    visibility: hidden;
}

/* Show pause button only when ui-layer is visible (game is active) */
#ui-layer.visible .pause-btn {
    opacity: 1;
    visibility: visible;
}

.pause-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.pause-btn:active {
    transform: scale(0.95);
}

#pause-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 300;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

#pause-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.pause-card {
    background: rgba(255, 255, 255, 0.95);
    padding: 40px 50px;
    border-radius: 30px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.2);
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.pause-card h2 {
    font-size: 2rem;
    margin: 0 0 30px 0;
    color: #444;
}

.pause-btn-row {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.pause-menu-btn {
    padding: 15px 40px;
    border: none;
    border-radius: 20px;
    font-size: 1.1rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pause-menu-btn.resume {
    background: linear-gradient(135deg, #00d4aa 0%, #00f5c4 100%);
    color: white;
    box-shadow: 0 8px 20px rgba(0, 212, 170, 0.3);
}

.pause-menu-btn.resume:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 25px rgba(0, 212, 170, 0.4);
}

.pause-menu-btn.menu {
    background: #eee;
    color: #666;
}

.pause-menu-btn.menu:hover {
    background: #ddd;
}

/* ==============================================
   HEADER & SCORE
   ============================================== */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    pointer-events: auto;
    padding: 10px 5px;
}

.score-box {
    background: rgba(255, 255, 255, 0.85);
    /* More opaque */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 12px 24px;
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.8);
    text-align: center;
    min-width: 100px;
}

.label {
    font-size: 0.7rem;
    font-weight: 700;
    color: #9aa0a6;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-bottom: 4px;
}

.value {
    font-size: 1.6rem;
    font-weight: 800;
    color: #444;
    font-feature-settings: "tnum";
    /* Monospace numbers */
    line-height: 1;
}

.score-box.pulse {
    animation: scorePulse 0.3s ease-out;
}

@keyframes scorePulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
        background: rgba(255, 255, 255, 1);
        border-color: #ffd700;
    }

    100% {
        transform: scale(1);
    }
}

/* ==============================================
   GAME OVER MODAL
   ============================================== */
#game-over-modal {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
    z-index: 200;
}

#game-over-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.modal-content {
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    padding: 50px;
    border-radius: 40px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.6);
    animation: popIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    max-width: 400px;
    width: 80%;
}

@keyframes popIn {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.modal-content h2 {
    font-size: 2.5rem;
    color: #444;
    margin-bottom: 10px;
}

.modal-content p {
    font-size: 1.5rem;
    color: #666;
    margin-bottom: 30px;
}

.modal-btn-row {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.btn-secondary {
    background: #eee;
    color: #666;
}

.btn-secondary:hover {
    background: #ddd;
}

/* ==============================================
   START SCREEN
   ============================================== */
/* ==============================================
   START SCREEN - MODERN
   ============================================== */
#start-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.35);
    /* More transparent to see particles */
    backdrop-filter: blur(15px);
    /* Slightly less blur */
    -webkit-backdrop-filter: blur(15px);
    transition: opacity 0.5s ease, visibility 0.5s;
    z-index: 20;
}

#start-screen.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.logo-container {
    text-align: center;
    margin-bottom: 50px;
    animation: float 4s ease-in-out infinite;
    position: relative;
    z-index: 2;
}

h1 {
    font-size: 5rem;
    font-weight: 800;
    margin: 0;
    line-height: 1;
    background: linear-gradient(135deg, #FF6ec7 0%, #7873f5 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.1));
    letter-spacing: -2px;
}

.slogan {
    font-size: 1.2rem;
    font-weight: 600;
    color: #6a6a6a;
    margin: 10px 0 25px 0;
    letter-spacing: 3px;
    text-transform: uppercase;
    opacity: 0.8;
}

.best-score-badge {
    margin-top: 5px;
    background: white;
    padding: 8px 24px;
    border-radius: 30px;
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.08);
    font-weight: 700;
    font-size: 0.95rem;
    color: #555;
    display: inline-block;
    border: 2px solid rgba(255, 255, 255, 0.8);
}

/* ==============================================
   PLAY BUTTONS
   ============================================== */
.menu-btn-group {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    transition: transform 0.2s;
}

.menu-btn-group:hover {
    transform: translateY(-5px);
}

.play-btn-large {
    width: 90px;
    height: 90px;
    border-radius: 26px;
    /* Squircle shape */
    background: white;
    border: 1px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 15px 35px rgba(112, 112, 112, 0.15);
    color: #444;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
    /* Touch-friendly improvements */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

/* Inner Glow effect on Hover */
.play-btn-large::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, rgba(230, 230, 255, 0.4) 0%, transparent 70%);
    opacity: 0;
    transition: opacity 0.3s;
}

@media (hover: hover) {
    .play-btn-large:hover::after {
        opacity: 1;
    }

    .play-btn-large:hover {
        transform: scale(1.08);
        box-shadow: 0 20px 45px rgba(112, 112, 112, 0.2);
    }
}

.play-btn-large:active,
.play-btn-large:focus {
    transform: scale(0.95);
    outline: none;
}

/* ==============================================
   SETTINGS ROW (Sound, Theme, etc.)
   ============================================== */
.settings-row {
    position: absolute;
    bottom: 40px;
    display: flex;
    gap: 15px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(15px);
    border-radius: 40px;
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}

.sound-toggle {
    width: 44px;
    height: 44px;
    background: white;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    color: #777;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    border: none;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    /* Touch-friendly improvements */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none;
    -webkit-user-select: none;
}

/* Remove old positioning IDs */
#btn-sound,
#btn-theme,
#btn-colorblind {
    position: static;
    bottom: auto;
    right: auto;
    border: none;
}

@media (hover: hover) {
    .sound-toggle:hover {
        transform: scale(1.15);
        color: #333;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    }
}

.sound-toggle.muted {
    opacity: 0.6;
    background: #f0f0f0;
    text-decoration: line-through;
}

/* ==============================================
   ANIMATIONS
   ============================================== */
@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(168, 237, 234, 0.7);
    }

    70% {
        transform: scale(1.05);
        box-shadow: 0 0 0 20px rgba(168, 237, 234, 0);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(168, 237, 234, 0);
    }
}

@keyframes float {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* ==============================================
   LEVEL UP MESSAGE
   ============================================== */
#level-up-msg {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.5);
    background: rgba(255, 255, 255, 0.95);
    padding: 30px 50px;
    border-radius: 20px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.2);
    text-align: center;
    pointer-events: none;
    opacity: 0;
    z-index: 100;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 4px solid #FFD700;
}

#level-up-msg.active {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
    pointer-events: auto;
    cursor: pointer;
}

#level-up-msg h2 {
    margin: 0;
    font-size: 2.5rem;
    color: #FF6ec7;
    text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.1);
}

#level-up-msg p {
    margin: 10px 0 0 0;
    font-size: 1.2rem;
    color: #555;
    font-weight: bold;
}

/* ==============================================
   POWER-UP BAR
   ============================================== */
.powerup-bar {
    position: static;
    display: flex;
    flex-direction: row;
    gap: 10px;
    pointer-events: auto;
    padding: 0;
    background: transparent;
}

.powerup-btn {
    position: relative;
    width: 54px;
    height: 54px;
    background: white;
    /* Clean white background */
    border-radius: 18px;
    /* Squircle */
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
    /* Softer shadow */
    cursor: pointer;
    pointer-events: auto;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(0, 0, 0, 0.05);
    /* Very subtle border */
    overflow: visible;
}

.powerup-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 25px rgba(0, 0, 0, 0.12);
}

.powerup-btn:active {
    transform: scale(0.92);
}

.powerup-btn .icon {
    font-size: 1.5rem;
    user-select: none;
    transition: transform 0.2s ease;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.powerup-btn:hover .icon {
    transform: scale(1.1);
}

.powerup-btn .count {
    position: absolute;
    bottom: -6px;
    right: -6px;
    background: #444;
    color: white;
    font-size: 0.75rem;
    min-width: 20px;
    height: 20px;
    padding: 0 4px;
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-weight: 800;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.15);
    border: 2px solid #fff;
    z-index: 2;
}

.powerup-btn .tooltip {
    position: absolute;
    right: 70px;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 0.85rem;
    font-weight: 500;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transform: translateX(10px);
    transition: all 0.3s ease;
    z-index: 200;
}

.powerup-btn .tooltip::after {
    content: '';
    position: absolute;
    right: -6px;
    top: 50%;
    transform: translateY(-50%);
    border: 6px solid transparent;
    border-left-color: rgba(0, 0, 0, 0.85);
}

.powerup-btn:hover .tooltip {
    opacity: 1;
    transform: translateX(0);
}

/* Hammer Active */
.powerup-btn.hammer.active {
    background: linear-gradient(135deg, #FF6ec7 0%, #ff8fab 100%);
    border-color: #ff8fab;
    box-shadow: 0 0 25px rgba(255, 110, 199, 0.6),
        0 8px 32px rgba(255, 110, 199, 0.3);
    animation: pulseActive 1.5s infinite;
}

.powerup-btn.hammer.active .icon {
    filter: brightness(0) invert(1);
    animation: hammerShake 0.4s infinite;
}

/* Swap Active */
.powerup-btn.swap.active {
    background: linear-gradient(135deg, #00d4aa 0%, #00f5c4 100%);
    border-color: #00f5c4;
    box-shadow: 0 0 25px rgba(0, 212, 170, 0.6),
        0 8px 32px rgba(0, 212, 170, 0.3);
    animation: pulseActive 1.5s infinite;
}

.powerup-btn.swap.active .icon {
    animation: swapPulse 0.8s infinite;
}

/* Shuffle Animation */
.powerup-btn.shuffle.shuffling .icon {
    animation: shuffleSpin 0.5s ease-in-out;
}

/* Undo Animation */
.powerup-btn.undo.undoing .icon {
    animation: undoSpin 0.4s ease-out;
}

.powerup-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
    filter: grayscale(0.5);
    pointer-events: none;
}

.powerup-btn.disabled:hover {
    transform: none;
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.15);
}

@keyframes pulseActive {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.08);
    }
}

@keyframes hammerShake {

    0%,
    100% {
        transform: rotate(0deg) scale(1.15);
    }

    25% {
        transform: rotate(-15deg) scale(1.15);
    }

    75% {
        transform: rotate(15deg) scale(1.15);
    }
}

@keyframes swapPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.2);
    }
}

@keyframes shuffleSpin {
    0% {
        transform: rotate(0deg) scale(1);
    }

    50% {
        transform: rotate(180deg) scale(1.3);
    }

    100% {
        transform: rotate(360deg) scale(1);
    }
}

@keyframes undoSpin {
    0% {
        transform: rotate(0deg);
    }

    100% {
        transform: rotate(-360deg);
    }
}

/* Swap Selection Highlight */
.swap-highlight {
    animation: swapGlow 0.8s infinite;
}

@keyframes swapGlow {

    0%,
    100% {
        filter: drop-shadow(0 0 8px #00d4aa);
    }

    50% {
        filter: drop-shadow(0 0 20px #00f5c4);
    }
}

/* ==============================================
   MISSION BOX
   ============================================== */
.mission-box {
    position: absolute;
    bottom: 20px;
    left: 20px;
    top: auto;
    transform: none;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 10px 16px;
    border-radius: 16px;
    box-shadow: 0 4px 20px rgba(31, 38, 135, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.6);
    text-align: left;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 140px;
    max-width: 180px;
    z-index: 50;
}

.mission-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: #888;
    font-weight: bold;
    margin-bottom: 2px;
}

.mission-text {
    font-weight: bold;
    color: #444;
    font-size: 0.9rem;
}

.mission-progress-bg {
    width: 100%;
    height: 4px;
    background: #eee;
    border-radius: 2px;
    margin-top: 5px;
    overflow: hidden;
}

.mission-progress-bar {
    width: 0%;
    height: 100%;
    background: #FF6ec7;
    transition: width 0.3s;
}

/* ==============================================
   LEVEL SELECT SCREEN
   ============================================== */
#level-select-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    left: 0;
    width: 100%;
    height: 100%;
    /* Transparent with Glassmorphism to see particles behind */
    background: rgba(255, 255, 255, 0.4);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding-top: 80px;
    overflow-y: auto;
    z-index: 25;
    transition: opacity 0.5s ease;
}

#level-select-screen.hidden {
    display: none;
    opacity: 0;
}

.level-map-container {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 30px;
    max-width: 600px;
    padding: 20px;
    padding-bottom: 100px;
}

.level-node {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.4);
    border: 3px solid rgba(255, 255, 255, 0.6);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    font-size: 1.5rem;
    font-weight: bold;
    color: #555;
    cursor: pointer;
    position: relative;
    backdrop-filter: blur(5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s, background 0.2s;
}

.level-node.locked {
    filter: grayscale(1);
    opacity: 0.6;
    pointer-events: none;
    cursor: default;
}

.level-node.locked::after {
    content: '🔒';
    font-size: 1.2rem;
    position: absolute;
}

.level-node.unlocked {
    background: rgba(255, 255, 255, 0.85);
    border-color: #fff;
}

.level-node.unlocked:hover {
    transform: scale(1.1);
    background: #fff;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.2);
}

.level-node.completed {
    background: linear-gradient(135deg, #a8edea 0%, #fed6e3 100%);
    border-color: #fff;
    color: #444;
}

.level-stars {
    display: flex;
    gap: 2px;
    font-size: 0.8rem;
    margin-top: -5px;
}

.back-btn {
    position: absolute;
    top: 30px;
    left: 30px;
    background: rgba(255, 255, 255, 0.8);
    border: none;
    padding: 10px 20px;
    border-radius: 20px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
    transition: transform 0.2s;
    z-index: 30;
}

.back-btn:hover {
    transform: scale(1.05);
}

/* ==============================================
   LEVEL INTRO MODAL
   ============================================== */
#level-intro-modal {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 150;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
}

#level-intro-modal.active {
    opacity: 1;
    pointer-events: auto;
}

.intro-card {
    background: white;
    padding: 40px;
    border-radius: 30px;
    text-align: center;
    width: 80%;
    max-width: 350px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.intro-title {
    font-size: 2rem;
    font-weight: bold;
    margin-bottom: 10px;
    color: #444;
}

.intro-desc {
    font-size: 1rem;
    color: #666;
    margin-bottom: 25px;
    line-height: 1.4;
}

.goal-list {
    text-align: left;
    background: #f9f9f9;
    padding: 15px;
    border-radius: 15px;
    margin-bottom: 25px;
}

.goal-item {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    font-weight: bold;
    color: #555;
}

.intro-btn-row {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.intro-btn {
    background: linear-gradient(135deg, #FF6ec7 0%, #ff8fab 100%);
    color: white;
    border: none;
    padding: 15px 40px;
    border-radius: 25px;
    font-size: 1.2rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(255, 110, 199, 0.4);
    transition: transform 0.2s;
}

.intro-btn:hover {
    transform: scale(1.05);
}

.intro-btn.cancel-btn {
    background: #eee;
    color: #666;
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.1);
}

.intro-btn.cancel-btn:hover {
    background: #ddd;
}

/* ==============================================
   STACK TOOLTIP (Hover Info)
   ============================================== */
#stack-tooltip {
    position: fixed;
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 10px 16px;
    border-radius: 12px;
    font-size: 0.9rem;
    font-weight: 500;
    pointer-events: none;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.2s, transform 0.2s;
    z-index: 1000;
    max-width: 200px;
    text-align: center;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.3);
}

#stack-tooltip.visible {
    opacity: 1;
    transform: translateY(0);
}

#stack-tooltip .tooltip-title {
    font-weight: bold;
    margin-bottom: 6px;
    font-size: 1rem;
}

#stack-tooltip .tooltip-colors {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: center;
    margin-top: 8px;
}

#stack-tooltip .color-badge {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255, 255, 255, 0.15);
    padding: 3px 8px;
    border-radius: 10px;
    font-size: 0.8rem;
}

#stack-tooltip .color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

/* ==============================================
   IN GAME HUD
   ============================================== */
.game-info-bar {
    position: absolute;
    top: 100px;
    left: 0;
    width: 100%;
    display: flex;
    justify-content: center;
    gap: 20px;
    pointer-events: none;
    z-index: 10;
}

.info-pill {
    background: rgba(255, 255, 255, 0.9);
    padding: 8px 16px;
    border-radius: 20px;
    font-weight: bold;
    color: #555;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    gap: 8px;
}

.moves-danger {
    color: #d32f2f;
    animation: pulse 1s infinite;
}

/* ==============================================
   MOBILE OPTIMIZATION
   ============================================== */
@media (max-width: 600px) {

    /* Header compacted */
    .header {
        padding: 5px;
    }

    .score-box {
        padding: 8px 15px;
        border-radius: 16px;
        min-width: 70px;
    }

    .label {
        font-size: 0.6rem;
    }

    .value {
        font-size: 1.3rem;
    }

    /* Smaller Powerup Buttons */
    .powerup-btn {
        width: 42px;
        height: 42px;
        border-radius: 14px;
    }

    .powerup-btn .icon {
        font-size: 1.1rem;
    }

    .powerup-btn .count {
        min-width: 16px;
        height: 16px;
        font-size: 0.6rem;
        bottom: -4px;
        right: -4px;
        padding: 0 3px;
    }

    .powerup-btn .tooltip {
        display: none !important;
    }

    /* Mission Box Optimization - Move to top left to avoid hand pieces */
    .mission-box {
        top: 85px;
        left: 10px;
        bottom: auto;
        padding: 6px 12px;
        min-width: unset;
        width: auto;
        max-width: 140px;
        border-radius: 12px;
    }

    .mission-label {
        font-size: 0.55rem;
    }

    .mission-text {
        font-size: 0.75rem;
    }

    /* Game Info Bar (Campaign) - Compact & Centered */
    .game-info-bar {
        top: 85px;
        gap: 8px;
    }

    .info-pill {
        padding: 5px 12px;
        font-size: 0.8rem;
    }

    /* Start Screen Mobile */
    #start-screen {
        padding: 0;
        justify-content: center;
    }

    #start-screen h1 {
        font-size: 3.2rem;
    }

    #start-screen .slogan {
        font-size: 0.9rem;
        margin-bottom: 20px;
    }

    #start-screen .logo-container {
        margin-bottom: 30px;
        transform: scale(0.9);
    }

    .play-btn-large {
        width: 80px;
        height: 80px;
        border-radius: 22px;
    }

    /* Settings Row on Mobile */
    .settings-row {
        bottom: 25px;
        padding: 6px 12px;
        gap: 10px;
        border-radius: 30px;
    }

    .sound-toggle {
        width: 40px;
        height: 40px;
    }

    .sound-toggle span {
        font-size: 1.1rem !important;
    }

    /* Ensure no absolute positioning interferes */
    #btn-sound,
    #btn-theme,
    #btn-colorblind {
        position: static;
        width: 40px;
        height: 40px;
    }

    .modal-content {
        padding: 25px;
        width: 85%;
    }
}

/* Extra small screens (< 380px) */
@media (max-width: 380px) {
    #start-screen h1 {
        font-size: 2.5rem;
    }

    .score-box {
        padding: 6px 10px;
        min-width: 60px;
    }

    .value {
        font-size: 1.1rem;
    }

    .powerup-btn {
        width: 36px;
        height: 36px;
    }

    .play-btn-large {
        width: 70px;
        height: 70px;
    }

    .settings-row {
        bottom: 15px;
        transform: scale(0.9);
    }
}