html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
    box-sizing: border-box;
}

body {
    font-family: 'Fredoka', cursive, sans-serif;
    background-color: #12071f;
    background-image: radial-gradient(circle at 50% 15%, #23083d 0%, #120520 60%, #080110 100%);
    color: #f4f4f5;
    -webkit-font-smoothing: antialiased;
}

.page-container {
    display: flex;
    flex-direction: column;
    height: 100vh; 
    height: calc(var(--vh, 1vh) * 100);
    padding: 1rem;
    gap: 1rem;
    box-sizing: border-box;
}

.hud-container { flex-shrink: 0; }
.game-wrapper {
    flex-grow: 1;
    min-height: 0;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

.leaderboard-panel { display: none; }
.global-footer { flex-shrink: 0; }

.hud {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.hud-left { text-align: left; }
.hud-right { text-align: right; }
.hud-center { flex-grow: 1; text-align: center; }

.hud-element {
    font-family: 'Fredoka', cursive, sans-serif;
    background-color: rgba(26, 12, 38, 0.85);
    padding: 0.5rem 1.25rem;
    border-radius: 9999px;
    border: 2px solid #7c3aed;
    letter-spacing: 1px;
    white-space: nowrap;
    min-width: 140px;
    font-size: 1.05rem;
    font-weight: 700;
    color: #facc15;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
}

.hud-mute-button {
    background-color: rgba(26, 12, 38, 0.85);
    border: 2px solid #7c3aed;
    border-radius: 9999px;
    padding: 0.5rem;
    min-width: unset;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #facc15;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    transition: transform 0.15s ease, background-color 0.2s, box-shadow 0.2s;
}

.hud-mute-button:hover {
    transform: scale(1.08);
    background: rgba(124, 58, 237, 0.3);
    box-shadow: 0 0 12px rgba(124, 58, 237, 0.6);
}

.hud-icon {
    width: 1.5rem;
    height: 1.5rem;
}

.icon-container {
    width: 3.25rem;
    height: 3.25rem;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 0.65rem;
    padding: 0.35rem;
    box-sizing: border-box;
    transition: transform 0.2s ease, background-color 0.2s ease;
}

.icon-container img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
}

.guide-pillar:hover .icon-container,
.icon-container:hover {
    transform: scale(1.08);
    background: rgba(255, 255, 255, 0.14);
}

.gut-barrier-container {
    min-width: 120px;
    max-width: 480px;
    margin: 0 auto;
}

.hud-label {
    font-family: 'Fredoka', cursive, sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    display: block;
    margin-bottom: 0.25rem;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #a7f3d0;
    text-shadow: 0 0 10px rgba(16, 185, 129, 0.5);
}

.gut-barrier-bar {
    width: 100%;
    height: 1.35rem;
    background-color: rgba(10, 4, 16, 0.9);
    border: 2px solid #059669;
    border-radius: 9999px;
    padding: 2px;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.6);
    box-sizing: border-box;
}

.gut-barrier-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #059669 0%, #10b981 50%, #34d399 100%);
    border-radius: 9999px;
    box-shadow: 0 0 10px rgba(52, 211, 153, 0.6);
    transition: width 0.3s ease-in-out, background-color 0.3s ease-in-out;
}

/* SCFA Super-Shot Button */
.scfa-button-container {
    position: absolute;
    bottom: 15px;
    left: 50%;
    transform: translateX(-50%);
    width: 70px;
    height: 70px;
    cursor: not-allowed;
    opacity: 0.5;
    transition: opacity 0.3s, transform 0.3s;
    z-index: 50;
}

.scfa-button-container.ready {
    cursor: pointer;
    opacity: 1;
    transform: translateX(-50%) scale(1.1);
    animation: pulse-border-scfa 1.5s infinite;
}

.scfa-button-container.charge-pulse {
    animation: charge-pulse-animation 0.3s ease-out;
}

@keyframes charge-pulse-animation {
    0%, 100% { transform: translateX(-50%) scale(1); }
    50% { transform: translateX(-50%) scale(1.15); }
}

@keyframes pulse-border-scfa {
    0%, 100% { filter: drop-shadow(0 0 5px #a78bfa); }
    50% { filter: drop-shadow(0 0 15px #c4b5fd); }
}

.scfa-svg { width: 100%; height: 100%; }
.scfa-bg { fill: rgba(0, 0, 0, 0.45); stroke: #7c3aed; stroke-width: 8; }
.scfa-progress {
    fill: none;
    stroke: #a78bfa;
    stroke-width: 14;
    stroke-linecap: round;
    transform: rotate(-90deg);
    transform-origin: 50% 50%;
    stroke-dasharray: 339.292;
    stroke-dashoffset: 339.292;
    transition: stroke-dashoffset 0.3s linear;
}

.scfa-icon {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.scfa-bolt-svg {
    width: 26px;
    height: 26px;
    fill: #c4b5fd;
    filter: drop-shadow(0 0 4px #8b5cf6);
}

.scfa-button-container.ready .scfa-bolt-svg {
    fill: #ffffff;
    filter: drop-shadow(0 0 10px #c4b5fd) drop-shadow(0 0 20px #a855f7);
}

/* Ambient Particles */
#ambient-particles {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
    z-index: 2;
}

.ambient-mote {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    opacity: 0.35;
    background: radial-gradient(circle, #c084fc 0%, transparent 75%);
    animation: float-drift linear infinite;
}

.ambient-bubble {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    border: 1px solid rgba(192, 132, 252, 0.3);
    background: rgba(168, 85, 247, 0.08);
    box-shadow: inset 0 0 4px rgba(236, 72, 153, 0.2);
    animation: bubble-rise linear infinite;
}

@keyframes float-drift {
    0% { transform: translateY(0) translateX(0); opacity: 0.2; }
    50% { transform: translateY(-20px) translateX(12px); opacity: 0.45; }
    100% { transform: translateY(0) translateX(0); opacity: 0.2; }
}

@keyframes bubble-rise {
    0% { transform: translateY(20px) scale(0.8); opacity: 0; }
    30% { opacity: 0.35; }
    70% { opacity: 0.35; }
    100% { transform: translateY(-60px) scale(1.1); opacity: 0; }
}

/* Combo Streak Banner */
.combo-display {
    position: absolute;
    top: 15px;
    left: 20px;
    display: flex;
    align-items: center;
    gap: 0.45rem;
    z-index: 60;
    pointer-events: none;
    background: rgba(15, 6, 23, 0.85);
    border: 1.5px solid #eab308;
    border-radius: 9999px;
    padding: 0.3rem 0.85rem;
    box-shadow: 0 0 15px rgba(234, 179, 8, 0.4);
    animation: combo-appear 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.combo-count {
    font-family: 'Fredoka', cursive, sans-serif;
    font-size: 1.2rem;
    font-weight: 800;
    color: #facc15;
    text-shadow: 0 0 8px #ca8a04;
}

.combo-label {
    font-family: 'Fredoka', cursive, sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    color: #ffffff;
    letter-spacing: 1px;
    background: #e11d48;
    padding: 2px 7px;
    border-radius: 9999px;
}

@keyframes combo-appear {
    0% { transform: scale(0.6) translateY(-10px); opacity: 0; }
    100% { transform: scale(1) translateY(0); opacity: 1; }
}

/* Notifications */
#notification-container {
    position: absolute;
    top: 35%;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    pointer-events: none;
    z-index: 100;
}

.notification-item {
    font-family: 'Fredoka', cursive, sans-serif;
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: 1px;
    text-shadow: 0 0 10px black, 0 0 25px black;
    animation: ready-pulse 0.5s ease-out, fade-in 0.3s ease-out;
    opacity: 1;
    transition: opacity 0.5s ease-out;
}

.notification-item.fade-out { opacity: 0; }
.text-blue { color: #60a5fa; }
.text-yellow { color: #facc15; }
.text-white { color: #f4f4f5; }
.text-red { color: #ef4444; }
.text-purple { color: #c4b5fd; }
.text-cyan { color: #8be9fd; }
.text-green { color: #22c55e; }

@keyframes ready-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Screen Vignettes */
#barrier-damage-vignette {
    position: absolute;
    inset: 0;
    border-radius: 0.75rem;
    box-shadow: inset 0 0 80px 40px rgba(239, 68, 68, 0.85);
    pointer-events: none;
    z-index: 95;
    animation: damage-flash 0.35s ease-out;
}

@keyframes damage-flash {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

#slomo-vignette {
    position: absolute;
    inset: 0;
    border-radius: 0.75rem;
    box-shadow: inset 0 0 80px 40px rgba(56, 189, 248, 0.45);
    pointer-events: none;
    z-index: 85;
}

#multiplier-aura {
    position: absolute;
    inset: 0;
    border-radius: 0.75rem;
    box-shadow: inset 0 0 80px 40px rgba(250, 204, 21, 0.35);
    pointer-events: none;
    z-index: 85;
}

#cortisol-vignette {
    position: absolute;
    inset: 0;
    border-radius: 0.75rem;
    box-shadow: inset 0 0 80px 40px rgba(239, 68, 68, 0.5);
    pointer-events: none;
    z-index: 100;
    animation: pulse-vignette 1s infinite;
}

@keyframes pulse-vignette {
    50% { opacity: 0.7; }
}

#super-shot-wave {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 10px;
    height: 10px;
    background-color: #c4b5fd;
    border-radius: 50%;
    pointer-events: none;
    z-index: 99;
}

.wave-animate {
    animation: wave-pulse-fullscreen 0.5s ease-out forwards;
}

@keyframes wave-pulse-fullscreen {
    0% { transform: translate(-50%, -50%) scale(1); opacity: 0.8; }
    100% { transform: translate(-50%, -50%) scale(200); opacity: 0; }
}

/* Game Area Wrapper (Main Canvas) */
.game-area-wrapper {
    position: relative;
    width: 100%;
    max-width: 100%;
    max-height: 100%;
    aspect-ratio: 16 / 9;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0.75rem;
    overflow: hidden;
    background-color: #1a0b29;
    background-image: radial-gradient(circle at 50% 50%, #240b3b 0%, #12041e 100%);
    border: 2px solid #7c3aed;
    box-shadow: 0 0 30px rgba(124, 58, 237, 0.35);
}

.game-area-wrapper.shake {
    animation: screen-shake 0.15s ease-in-out;
}

@keyframes screen-shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    50% { transform: translateX(5px); }
    75% { transform: translateX(-5px); }
}

#game-container {
    width: 100%;
    height: 100%;
    position: relative;
    box-sizing: border-box;
    transition: filter 0.5s ease;
    cursor: url("data:image/svg+xml,%3Csvg xmlns='https://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24' fill='none' stroke='%23ef4444' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='3'%3E%3C/circle%3E%3Cline x1='12' y1='2' x2='12' y2='6'%3E%3C/line%3E%3Cline x1='12' y1='18' x2='12' y2='22'%3E%3C/line%3E%3Cline x1='22' y1='12' x2='18' y2='12'%3E%3C/line%3E%3Cline x1='6' y1='12' x2='2' y2='12'%3E%3C/line%3E%3C/svg%3E") 12 12, auto;
}

#game-container.slo-mo {
    filter: drop-shadow(0 0 15px #3b82f6);
}

/* Modals */
.modal {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 50% 30%, rgba(32, 12, 48, 0.97) 0%, rgba(16, 6, 24, 0.98) 100%);
    backdrop-filter: blur(8px);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 1.5rem;
    gap: 1.15rem;
    z-index: 100;
    box-sizing: border-box;
}

.modal-header {
    flex-shrink: 0;
    padding-bottom: 0;
    text-align: center;
}

.modal-body {
    flex-grow: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    overflow-y: auto;
    width: 100%;
    min-height: 0;
}

.modal-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-shrink: 0;
    width: 100%;
    max-width: 26rem;
    gap: 0.75rem;
    padding-top: 0.25rem;
    margin: 0 auto;
}

.modal-title {
    font-family: 'Fredoka', cursive, sans-serif;
    font-size: 2.15rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: white;
    text-shadow: 0 0 15px rgba(168, 85, 247, 0.6);
    margin: 0 0 0.15rem 0;
}

.modal-subtitle {
    font-family: 'Fredoka', cursive, sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: #facc15;
    margin: 0;
}

.tutorial-corner-btn {
    position: absolute;
    top: 1rem;
    left: 1rem;
    font-family: 'Fredoka', cursive, sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: #e9d5ff;
    background: rgba(255, 255, 255, 0.08);
    border: 1.5px solid rgba(168, 85, 247, 0.5);
    border-radius: 9999px;
    padding: 0.4rem 0.85rem;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    transition: all 0.2s ease;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    backdrop-filter: blur(6px);
}

.tutorial-corner-btn:hover {
    background: rgba(168, 85, 247, 0.25);
    border-color: rgba(168, 85, 247, 0.9);
    color: #ffffff;
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.6);
    transform: translateY(-2px) scale(1.03);
}

.game-over-title {
    font-size: 2rem;
    font-family: 'Fredoka', cursive, sans-serif;
}

.failure-title { color: #ef4444; }
.final-score-text {
    font-family: 'Fredoka', cursive, sans-serif;
    font-size: 1.35rem;
    color: #f4f4f5;
    margin-bottom: 0.5rem;
}

.leaderboard-rank-text {
    font-family: 'Fredoka', cursive, sans-serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: #facc15;
    margin-bottom: 1.5rem;
}

/* 3-Pillar Visual Guide */
.intro-guide {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
    max-width: 56rem;
    margin: 0 auto;
    width: 100%;
}

.guide-pillar {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 1rem;
    padding: 1.1rem 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: space-between;
    text-align: center;
    gap: 0.75rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s, border-color 0.2s;
}

.guide-pillar:hover {
    transform: translateY(-2px);
}

.pillar-bad {
    border: 1.5px solid rgba(239, 68, 68, 0.5);
    background: linear-gradient(180deg, rgba(239, 68, 68, 0.1) 0%, rgba(26, 10, 36, 0.8) 100%);
}

.pillar-good {
    border: 1.5px solid rgba(34, 197, 94, 0.5);
    background: linear-gradient(180deg, rgba(34, 197, 94, 0.1) 0%, rgba(26, 10, 36, 0.8) 100%);
}

.pillar-powerup {
    border: 1.5px solid rgba(168, 85, 247, 0.5);
    background: linear-gradient(180deg, rgba(168, 85, 247, 0.1) 0%, rgba(26, 10, 36, 0.8) 100%);
}

.pillar-header {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.pillar-badge {
    font-family: 'Fredoka', cursive, sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
    letter-spacing: 0.5px;
}

.badge-bad { background: #ef4444; color: white; }
.badge-good { background: #22c55e; color: white; }
.badge-powerup { background: #a855f7; color: white; }

.pillar-title {
    font-family: 'Fredoka', cursive, sans-serif;
    font-size: 0.92rem;
    font-weight: 700;
    color: #f4f4f5;
}

.pillar-sprites {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    flex-wrap: nowrap;
    width: 100%;
}

.pillar-sprites .icon-container {
    width: 2.65rem;
    height: 2.65rem;
    padding: 0.25rem;
    flex-shrink: 0;
}

.pillar-good .pillar-sprites .icon-container {
    width: 2.85rem;
    height: 2.85rem;
    padding: 0.3rem;
}

.pillar-sprites img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
    transition: transform 0.2s;
}

.pillar-sprites img:hover {
    transform: scale(1.18);
}

.pillar-desc {
    font-family: 'Fredoka', cursive, sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Menu Mission Banner */
.menu-mission-banner {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin: 0 auto;
    max-width: 54rem;
    width: 100%;
}

.mission-pill {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(168, 85, 247, 0.35);
    border-radius: 9999px;
    padding: 0.4rem 1rem;
    font-family: 'Fredoka', cursive, sans-serif;
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #e4e4e7;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.mission-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dot-red { background: #ef4444; box-shadow: 0 0 6px #ef4444; }
.dot-green { background: #22c55e; box-shadow: 0 0 6px #22c55e; }
.dot-yellow { background: #facc15; box-shadow: 0 0 6px #facc15; }

.text-good { color: #22c55e; }
.text-bad { color: #ef4444; }
.text-powerup-multiplier { color: #facc15; }

/* Input & Buttons */
.player-name-input {
    background-color: rgba(255, 255, 255, 0.08);
    color: white;
    width: 100%;
    max-width: 24rem;
    text-align: center;
    padding: 0.55rem 1.25rem;
    border-radius: 9999px;
    border: 2px solid #7c3aed;
    margin: 0;
    font-family: 'Fredoka', cursive, sans-serif;
    font-size: 0.95rem;
    font-weight: 600;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}

.player-name-input:focus {
    outline: none;
    border-color: #a855f7;
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.5);
}

.player-name-input.shake-input {
    animation: input-shake 0.4s;
}

@keyframes input-shake {
    10%, 90% { transform: translateX(-3px); }
    20%, 80% { transform: translateX(3px); }
    30%, 50%, 70% { transform: translateX(-3px); }
    40%, 60% { transform: translateX(3px); }
}

.btn-primary, .btn-secondary {
    font-family: 'Fredoka', cursive, sans-serif;
    font-weight: 700;
    border-radius: 9999px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    transition: background-color 0.2s, transform 0.1s, box-shadow 0.2s;
    border: none;
    cursor: pointer;
}

.btn-primary {
    background: linear-gradient(180deg, #22c55e 0%, #16a34a 100%);
    color: white;
    font-size: 1.15rem;
    padding: 0.65rem 3.5rem;
    white-space: nowrap;
    min-width: 240px;
    box-shadow: 0 4px 0 #15803d, 0 6px 15px rgba(34, 197, 94, 0.4);
}

.btn-primary:hover {
    background: linear-gradient(180deg, #34d399 0%, #22c55e 100%);
    transform: translateY(-2px);
    box-shadow: 0 6px 0 #15803d, 0 8px 20px rgba(34, 197, 94, 0.5);
}

.btn-primary:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #15803d;
}

.btn-secondary {
    background: #7c3aed;
    color: white;
    font-size: 0.95rem;
    padding: 0.55rem 1.5rem;
    box-shadow: 0 4px 0 #6d28d9, 0 6px 15px rgba(124, 58, 237, 0.4);
}

.btn-secondary:hover {
    background: #6d28d9;
    transform: translateY(-2px);
}

.btn-secondary:active {
    transform: translateY(2px);
    box-shadow: 0 2px 0 #6d28d9;
}

.inspectable-sprite {
    cursor: pointer;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.inspectable-sprite:hover {
    transform: scale(1.25) translateY(-2px);
    filter: drop-shadow(0 4px 10px rgba(168, 85, 247, 0.7));
}

/* How to Card and Tutorial Styles */
.how-to-card {
    position: relative;
    width: 100%;
    max-width: 48rem;
    max-height: 90vh;
    margin: auto;
    overflow-y: auto;
    background: linear-gradient(135deg, rgba(30, 10, 48, 0.96) 0%, rgba(15, 6, 26, 0.98) 100%);
    border: 2px solid rgba(168, 85, 247, 0.45);
    border-radius: 1.25rem;
    padding: 1.5rem 1.75rem;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.7), 0 0 30px rgba(168, 85, 247, 0.25);
    text-align: center;
    box-sizing: border-box;
}

.how-to-header-badge {
    display: inline-block;
    font-family: 'Fredoka', cursive, sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    background: rgba(168, 85, 247, 0.2);
    color: #c084fc;
    border: 1px solid rgba(168, 85, 247, 0.4);
    border-radius: 9999px;
    padding: 0.2rem 0.75rem;
    margin-bottom: 0.5rem;
}

.tutorial-cards,
.tutorial-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    max-width: 48rem;
    width: 100%;
    margin: 1rem auto;
}

.tutorial-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1.5px solid rgba(168, 85, 247, 0.3);
    border-radius: 0.75rem;
    padding: 0.75rem;
    display: flex;
    gap: 0.65rem;
    align-items: flex-start;
    text-align: left;
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.tutorial-card:hover {
    transform: translateY(-2px);
    border-color: rgba(168, 85, 247, 0.7);
}

.tutorial-step {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    background: #7c3aed;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Fredoka', cursive, sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    flex-shrink: 0;
}

.tutorial-icon-box {
    width: 3.25rem;
    height: 3.25rem;
    flex-shrink: 0;
}

.tutorial-title {
    font-family: 'Fredoka', cursive, sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    margin-bottom: 0.2rem;
}

.tutorial-desc {
    font-family: 'Fredoka', cursive, sans-serif;
    font-size: 0.78rem;
    color: #d4d4d8;
    line-height: 1.4;
    margin: 0;
}

@media (max-width: 640px) {
    .tutorial-cards,
    .tutorial-grid {
        grid-template-columns: 1fr;
        gap: 0.5rem;
    }
}

/* Microbe Detail Card Modal */
.modal-card-wrapper {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: center !important;
    padding: 1.5rem !important;
}

.microbe-inspect-card {
    background: radial-gradient(circle at 50% 20%, #290d40 0%, #11041f 100%);
    border: 2px solid #a855f7;
    border-radius: 1.25rem;
    padding: 1.5rem 2rem;
    max-width: 28rem;
    width: 92%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.75rem;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7), 0 0 25px rgba(168, 85, 247, 0.35);
    animation: card-pop 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.microbe-card-content,
.microbe-card-sidebar,
.microbe-card-main {
    display: contents;
}

@keyframes card-pop {
    0% { transform: scale(0.9); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.card-top-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.microbe-type-label {
    font-family: 'Fredoka', cursive, sans-serif;
    font-size: 0.75rem;
    font-weight: 700;
    color: #c084fc;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.fact-close-btn {
    background: none;
    border: none;
    color: #a1a1aa;
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
    padding: 0.2rem 0.5rem;
    border-radius: 0.25rem;
    transition: color 0.2s, background-color 0.2s;
}

.fact-close-btn:hover {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.1);
}

.microbe-card-title {
    font-family: 'Fredoka', cursive, sans-serif;
    font-size: 1.75rem;
    font-weight: 800;
    color: #ffffff;
    margin: 0;
    text-shadow: 0 0 10px rgba(168, 85, 247, 0.5);
}

.microbe-card-avatar {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(168, 85, 247, 0.2) 0%, rgba(0, 0, 0, 0.4) 100%);
    border: 2px solid rgba(168, 85, 247, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 0 20px rgba(168, 85, 247, 0.3);
    margin: 0.25rem 0;
}

.microbe-inspect-img {
    width: 72px;
    height: 72px;
    object-fit: contain;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.6));
}

.microbe-card-desc {
    font-size: 0.82rem;
    color: #e4e4e7;
    line-height: 1.45;
    font-weight: 500;
    margin: 0;
}

.card-science-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    width: 100%;
}

.card-stat-pill {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.5rem;
    padding: 0.4rem 0.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.stat-pill-label {
    font-size: 0.62rem;
    font-weight: 800;
    color: #a1a1aa;
    letter-spacing: 0.5px;
    white-space: nowrap;
}

.stat-pill-val {
    font-family: 'Fredoka', cursive, sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    color: #facc15;
    line-height: 1.2;
}

/* Game Over Match Summary Stats Grid */
.game-over-body {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 1.15rem;
    width: 100%;
    max-width: 44rem;
    margin: 0 auto;
}

.game-over-stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.85rem;
    width: 100%;
}

.game-over-stat-card {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 0.85rem;
    padding: 0.75rem 0.85rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
    border: 1.5px solid rgba(255, 255, 255, 0.08);
    transition: transform 0.2s;
}

.stat-card-pathogen {
    border-color: rgba(239, 68, 68, 0.4);
    background: linear-gradient(180deg, rgba(239, 68, 68, 0.12) 0%, rgba(26, 10, 36, 0.6) 100%);
}

.stat-card-probiotic {
    border-color: rgba(34, 197, 94, 0.4);
    background: linear-gradient(180deg, rgba(34, 197, 94, 0.12) 0%, rgba(26, 10, 36, 0.6) 100%);
}

.stat-card-powerup {
    border-color: rgba(168, 85, 247, 0.4);
    background: linear-gradient(180deg, rgba(168, 85, 247, 0.12) 0%, rgba(26, 10, 36, 0.6) 100%);
}

.game-over-stat-icon {
    width: 42px;
    height: 42px;
    object-fit: contain;
    filter: drop-shadow(0 2px 5px rgba(0, 0, 0, 0.5));
    flex-shrink: 0;
}

.game-over-stat-info {
    display: flex;
    flex-direction: column;
    text-align: left;
    gap: 0.1rem;
}

.game-over-stat-val {
    font-family: 'Fredoka', cursive, sans-serif;
    font-size: 1.5rem;
    font-weight: 800;
    color: #ffffff;
    line-height: 1.1;
}

.stat-card-pathogen .game-over-stat-val { color: #fca5a5; }
.stat-card-probiotic .game-over-stat-val { color: #86efac; }
.stat-card-powerup .game-over-stat-val { color: #facc15; }

.game-over-stat-label {
    font-family: 'Fredoka', cursive, sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #a1a1aa;
    text-transform: uppercase;
}

/* Science Fact Card in Game Over (Enlarged and Readable) */
.science-fact-card {
    background: linear-gradient(180deg, rgba(168, 85, 247, 0.16) 0%, rgba(22, 8, 34, 0.9) 100%);
    border: 1.5px solid rgba(168, 85, 247, 0.5);
    border-radius: 1rem;
    padding: 1.15rem 1.75rem;
    max-width: 44rem;
    width: 100%;
    margin: 0 auto;
    text-align: center;
    box-shadow: 0 4px 25px rgba(0, 0, 0, 0.5), 0 0 20px rgba(168, 85, 247, 0.25);
    animation: fact-glow 3s infinite alternate ease-in-out;
    box-sizing: border-box;
}

@keyframes fact-glow {
    0% { border-color: rgba(168, 85, 247, 0.5); }
    100% { border-color: rgba(216, 180, 254, 0.8); box-shadow: 0 4px 25px rgba(0, 0, 0, 0.5), 0 0 25px rgba(168, 85, 247, 0.45); }
}

.science-fact-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.45rem;
}

.science-fact-badge {
    font-family: 'Fredoka', cursive, sans-serif;
    font-size: 0.85rem;
    font-weight: 800;
    letter-spacing: 1.5px;
    color: #c084fc;
    text-transform: uppercase;
}

.science-fact-text {
    font-family: 'Fredoka', cursive, sans-serif;
    font-size: 1.05rem;
    font-weight: 600;
    color: #ffffff;
    line-height: 1.55;
    margin: 0;
}

.microbe-card-action {
    font-family: 'Fredoka', cursive, sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    padding: 0.4rem 1.1rem;
    border-radius: 9999px;
    text-transform: uppercase;
}

.action-shoot {
    background: rgba(239, 68, 68, 0.2);
    border: 1.5px solid #ef4444;
    color: #fca5a5;
}

.action-protect {
    background: rgba(34, 197, 94, 0.2);
    border: 1.5px solid #22c55e;
    color: #86efac;
}

.action-collect {
    background: rgba(168, 85, 247, 0.2);
    border: 1.5px solid #a855f7;
    color: #d8b4fe;
}

.btn-inspect-close {
    margin-top: 0.35rem;
    padding: 0.55rem 2.5rem;
    font-size: 1rem;
}

.microbe-badge {
    font-family: 'Fredoka', cursive, sans-serif;
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 9px;
    border-radius: 9999px;
    letter-spacing: 1px;
    display: inline-block;
    margin-bottom: 0.2rem;
}

.badge-boss {
    background: #f59e0b;
    color: white;
}

.hidden,
.modal.hidden,
#loading-modal.hidden,
#start-modal.hidden,
#tutorial-modal.hidden,
#microbe-info-modal.hidden,
#game-over-modal.hidden,
#diet-modal.hidden,
#mainLeaderboardModal.hidden,
#soundOffIcon.hidden {
    display: none !important;
}

/* Diet Choices */
.diet-choices {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    max-width: 48rem;
    margin: 0 auto;
    width: 100%;
}

.diet-choice-btn {
    background-color: rgba(255, 255, 255, 0.04);
    border: 2px solid #7c3aed;
    border-radius: 0.75rem;
    padding: 0.75rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Fredoka', cursive, sans-serif;
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    flex-grow: 1;
}

.diet-choice-btn:hover {
    background-color: rgba(255, 255, 255, 0.08);
    border-color: #a855f7;
}

.diet-choice-btn.selected.fibre {
    border-color: #22c55e;
    background-color: rgba(34, 197, 94, 0.25);
    box-shadow: 0 0 15px rgba(34, 197, 94, 0.3);
}

.diet-choice-btn.selected.balanced {
    border-color: #3b82f6;
    background-color: rgba(59, 130, 246, 0.25);
    box-shadow: 0 0 15px rgba(59, 130, 246, 0.3);
}

.diet-choice-btn.selected.sugar {
    border-color: #ef4444;
    background-color: rgba(239, 68, 68, 0.25);
    box-shadow: 0 0 15px rgba(239, 68, 68, 0.3);
}

.diet-choice-btn img {
    width: 60px;
    height: 60px;
    margin-bottom: 0.75rem;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5));
}

.diet-title {
    font-family: 'Fredoka', cursive, sans-serif;
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.diet-desc {
    font-size: 0.75rem;
    color: #d4d4d8;
    line-height: 1.4;
    flex-grow: 1;
}

/* Leaderboard */
.leaderboard-title {
    font-family: 'Fredoka', cursive, sans-serif;
    font-size: 1.25rem;
    color: #facc15;
    margin-bottom: 0.5rem;
}

.leaderboard-box {
    background: rgba(0, 0, 0, 0.35);
    padding: 0.75rem;
    border-radius: 0.5rem;
    font-family: 'Fredoka', cursive, sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    border: 1px solid rgba(124, 58, 237, 0.3);
}

.leaderboard-box > div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.35rem 0.5rem;
}

.leaderboard-box > div.leaderboard-empty {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    text-align: center !important;
    padding: 1.5rem 0.5rem !important;
    gap: 0.35rem !important;
}

.leaderboard-trophy-badge {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background: rgba(250, 204, 21, 0.12);
    border: 1.5px solid rgba(250, 204, 21, 0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 0.25rem;
    box-shadow: 0 0 15px rgba(250, 204, 21, 0.2);
}

.leaderboard-empty-title {
    font-family: 'Fredoka', cursive, sans-serif;
    color: #ffffff;
    font-weight: 700;
    font-size: 0.95rem;
    letter-spacing: 1px;
    text-align: center;
}

.leaderboard-subtext {
    font-size: 0.72rem;
    color: #c084fc;
    font-weight: 500;
    text-align: center;
    margin-bottom: 0.5rem;
}

.leaderboard-ghost-podium {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    width: 100%;
}

.ghost-slot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.03);
    border: 1px dashed rgba(168, 85, 247, 0.3);
    border-radius: 0.45rem;
    padding: 0.4rem 0.65rem;
    font-family: 'Fredoka', cursive, sans-serif;
    font-size: 0.78rem;
    color: #a1a1aa;
}

.ghost-slot.ghost-gold {
    border-color: rgba(250, 204, 21, 0.5);
    background: rgba(250, 204, 21, 0.05);
}

.ghost-rank {
    font-family: 'Fredoka', cursive, sans-serif;
    font-weight: 800;
    color: #facc15;
}

.ghost-name {
    font-style: italic;
    font-size: 0.72rem;
}

.ghost-pts {
    color: #71717a;
    font-weight: 700;
}

.leaderboard-panel-title {
    font-family: 'Fredoka', cursive, sans-serif;
    font-size: 1.35rem;
    font-weight: 800;
    text-align: center;
    margin-bottom: 0.75rem;
    color: #facc15;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.leaderboard-tip {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(168, 85, 247, 0.1);
    border: 1px dashed rgba(168, 85, 247, 0.35);
    border-radius: 0.65rem;
    padding: 0.5rem 0.75rem;
    margin-top: 0.75rem;
    font-family: 'Fredoka', cursive, sans-serif;
    font-size: 0.8rem;
    color: #d8b4fe;
}

.leaderboard-tip-icon-box {
    width: 2.25rem;
    height: 2.25rem;
    background: rgba(168, 85, 247, 0.15);
    padding: 0.2rem;
    flex-shrink: 0;
}

/* Leaderboard Podium & List Styling */
.leaderboard-player {
    display: flex;
    align-items: center;
    gap: 0.85rem;
    min-width: 0;
}

.leaderboard-podium-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.55rem 0.85rem;
    margin-bottom: 0.5rem;
    border-radius: 0.65rem;
    background: rgba(255, 255, 255, 0.04);
    transition: transform 0.15s ease-out;
}

.leaderboard-podium-card:hover {
    transform: translateX(2px);
}

.podium-rank-1 {
    background: linear-gradient(90deg, rgba(250, 204, 21, 0.2) 0%, rgba(35, 12, 50, 0.7) 100%);
    border: 1.5px solid rgba(250, 204, 21, 0.6);
    box-shadow: 0 4px 15px rgba(250, 204, 21, 0.2);
}

.podium-rank-2 {
    background: linear-gradient(90deg, rgba(203, 213, 225, 0.16) 0%, rgba(35, 12, 50, 0.7) 100%);
    border: 1.5px solid rgba(203, 213, 225, 0.5);
    box-shadow: 0 3px 12px rgba(203, 213, 225, 0.15);
}

.podium-rank-3 {
    background: linear-gradient(90deg, rgba(217, 119, 6, 0.16) 0%, rgba(35, 12, 50, 0.7) 100%);
    border: 1.5px solid rgba(217, 119, 6, 0.5);
    box-shadow: 0 3px 12px rgba(217, 119, 6, 0.15);
}

.podium-badge {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Fredoka', cursive, sans-serif;
    font-weight: 800;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.podium-badge.rank-1 {
    background: linear-gradient(135deg, #facc15 0%, #ca8a04 100%);
    color: #1e092b;
    box-shadow: 0 0 10px rgba(250, 204, 21, 0.6);
}

.podium-badge.rank-2 {
    background: linear-gradient(135deg, #f1f5f9 0%, #94a3b8 100%);
    color: #0f172a;
    box-shadow: 0 0 10px rgba(203, 213, 225, 0.5);
}

.podium-badge.rank-3 {
    background: linear-gradient(135deg, #f59e0b 0%, #b45309 100%);
    color: #ffffff;
    box-shadow: 0 0 10px rgba(217, 119, 6, 0.5);
}

.podium-player-info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.podium-player-info .player-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: #ffffff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.podium-rank-tag {
    font-family: 'Fredoka', cursive, sans-serif;
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #a1a1aa;
    text-transform: uppercase;
}

.podium-open {
    border-style: dashed;
    opacity: 0.55;
}

.player-name-empty {
    color: #71717a;
    font-style: italic;
    font-size: 0.85rem;
}

.player-score-empty {
    color: #52525b;
}

.score-glow-1 {
    color: #facc15;
    font-weight: 800;
    text-shadow: 0 0 10px rgba(250, 204, 21, 0.4);
}

.score-glow-2 {
    color: #e2e8f0;
    font-weight: 700;
}

.score-glow-3 {
    color: #fbbf24;
    font-weight: 700;
}

/* Normal rows for ranks 4 to 10 */
.leaderboard-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.45rem 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    transition: background-color 0.15s;
}

.leaderboard-row:hover {
    background-color: rgba(255, 255, 255, 0.03);
}

.leaderboard-row .rank-badge {
    width: 22px;
    height: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Fredoka', cursive, sans-serif;
    font-weight: 700;
    font-size: 0.85rem;
    color: #9ca3af;
    flex-shrink: 0;
}

.leaderboard-row .player-name {
    font-size: 0.88rem;
    color: #e4e4e7;
    font-weight: 600;
}

.leaderboard-row .player-score {
    font-family: 'Fredoka', cursive, sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: #cbd5e1;
}

/* In-game Sprites & Effects */
.microbe {
    position: absolute;
    width: 50px;
    height: 50px;
    user-select: none;
    will-change: transform;
    transition: opacity 0.2s;
}

.microbe .sprite {
    animation: microbe-swim 1.2s ease-in-out infinite alternate;
}

@keyframes microbe-swim {
    0% { transform: translateY(-3px) rotate(-3deg); }
    100% { transform: translateY(3px) rotate(3deg); }
}

.microbe.hit-pulse {
    animation: hit-squash 0.15s ease-out;
}

@keyframes hit-squash {
    0% { transform: scale(1.3); filter: brightness(2); }
    100% { transform: scale(1); filter: brightness(1); }
}

.microbe.powerup {
    animation: glow 1.5s infinite alternate;
}

.shield-effect::after {
    content: '';
    position: absolute;
    inset: -12px;
    border: 3px solid rgba(147, 197, 253, 0.85);
    border-radius: 50%;
    animation: pulse-shield 1.5s infinite;
    pointer-events: none;
    box-shadow: 0 0 12px rgba(147, 197, 253, 0.6);
}

@keyframes pulse-shield {
    0%, 100% { transform: scale(0.92); opacity: 0.7; }
    50% { transform: scale(1.1); opacity: 1; }
}

.sprite {
    width: 100%;
    height: 100%;
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    transition: background-image 0.3s ease-in-out;
}

.sprite.lactobacillus { background-image: url('img/sprites/lactobacillus.png'); filter: drop-shadow(0 2px 6px rgba(34, 197, 94, 0.35)); }
.sprite.bifidobacterium { background-image: url('img/sprites/bifidobacterium.png'); filter: drop-shadow(0 2px 6px rgba(34, 197, 94, 0.35)); }
.sprite.s_boulardii { background-image: url('img/sprites/s_boulardii.png'); filter: drop-shadow(0 2px 6px rgba(34, 197, 94, 0.35)); }
.sprite.c_difficile { background-image: url('img/sprites/c_difficile.png'); filter: drop-shadow(0 2px 6px rgba(239, 68, 68, 0.4)); }
.sprite.salmonella { background-image: url('img/sprites/salmonella.png'); filter: drop-shadow(0 2px 6px rgba(239, 68, 68, 0.4)); }
.sprite.h_pylori { background-image: url('img/sprites/h_pylori.png'); filter: drop-shadow(0 2px 6px rgba(239, 68, 68, 0.4)); }
.sprite.e_coli { background-image: url('img/sprites/normal_ecoli.png'); }
.sprite.e_coli.enraged { background-image: url('img/sprites/enraged_ecoli.png'); animation: pulse-red 0.4s infinite alternate; }

.sprite.slomo { background-image: url('img/sprites/banana.png'); filter: drop-shadow(0 0 10px #60a5fa); }
.sprite.multiplier { background-image: url('img/sprites/onion.png'); filter: drop-shadow(0 0 10px #facc15); }
.sprite.shield { background-image: url('img/sprites/garlic.png'); filter: drop-shadow(0 0 10px #f4f4f5); }
.sprite.antibiotic { background-image: url('img/sprites/antibiotic_pill.png'); filter: drop-shadow(0 0 10px #ef4444); }
.sprite.phage_pod { background-image: url('img/sprites/phage_pod.png'); filter: drop-shadow(0 0 10px #22d3ee); }
.sprite.kefir { background-image: url('img/sprites/kefir.png'); filter: drop-shadow(0 0 10px #a855f7); }
.sprite.diet_fibre { background-image: url('img/sprites/diet_fibre.png'); }
.sprite.diet_balanced { background-image: url('img/sprites/diet_balanced.png'); }
.sprite.diet_sugar { background-image: url('img/sprites/diet_sugar.png'); }

.biofilm-bunker {
    position: absolute;
    width: 250px;
    height: 200px;
    z-index: 20;
    transition: transform 0.1s;
}

.biofilm-bunker .sprite {
    background-image: url('img/sprites/biofilm_bunker.png');
    filter: drop-shadow(0 0 20px #d97706);
    animation: bunker-pulse 1.8s ease-in-out infinite alternate;
}

@keyframes bunker-pulse {
    0% { transform: scale(1); }
    100% { transform: scale(1.03); filter: drop-shadow(0 0 28px #f59e0b); }
}

.biofilm-bunker.hit { transform: scale(0.96); }
.biofilm-bunker.hit .sprite { filter: brightness(2); }

.biofilm-health-bar {
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 80%;
    height: 15px;
    background-color: rgba(0, 0, 0, 0.7);
    border: 2px solid #a1a1aa;
    border-radius: 5px;
    padding: 2px;
}

.biofilm-health-fill {
    width: 100%;
    height: 100%;
    background-color: #ef4444;
    border-radius: 3px;
    transition: width 0.2s ease-out;
}

.biofilm-prompt {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    font-family: 'Fredoka', cursive, sans-serif;
    font-size: 1.5rem;
    color: #facc15;
    text-shadow: 0 0 5px black;
    animation: pulse-text 1s infinite;
    pointer-events: none;
    white-space: nowrap;
}

.phage-drone {
    position: absolute;
    width: 28px;
    height: 28px;
    background-image: url('img/sprites/phage_drone.png');
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
    will-change: transform, opacity;
    transition: opacity 0.5s ease-out;
    filter: drop-shadow(0 0 8px #8be9fd);
    pointer-events: none;
}

.zap-effect {
    position: absolute;
    height: 4px;
    background: linear-gradient(90deg, #38bdf8, #ffffff, #8be9fd);
    box-shadow: 0 0 8px #38bdf8;
    animation: zap-fade 0.12s ease-out forwards;
    pointer-events: none;
    transform-origin: 0 50%;
}

@keyframes zap-fade {
    from { opacity: 1; }
    to { opacity: 0; }
}

@keyframes pulse-red {
    0% { filter: drop-shadow(0 0 10px #ef4444); }
    100% { filter: drop-shadow(0 0 20px #dc2626); }
}

.hit-marker, .explosion {
    position: absolute;
    transform: translate(-50%, -50%) scale(0);
    pointer-events: none;
    border-radius: 50%;
}

.hit-marker {
    width: 34px;
    height: 34px;
    border: 2px solid #f87171;
    background-color: rgba(239, 68, 68, 0.3);
    box-shadow: 0 0 12px rgba(239, 68, 68, 0.6);
    animation: hit-animation 0.25s ease-out;
}

.explosion {
    background: radial-gradient(circle, #fef08a 0%, #facc15 40%, #ef4444 80%, transparent 100%);
    animation: explosion-animation 0.45s ease-out;
}

@keyframes hit-animation {
    from { transform: translate(-50%, -50%) scale(0.2); opacity: 1; }
    to { transform: translate(-50%, -50%) scale(2.2); opacity: 0; }
}

@keyframes explosion-animation {
    0% { transform: translate(-50%, -50%) scale(0); opacity: 1; }
    100% { transform: translate(-50%, -50%) scale(12); opacity: 0; }
}

.shockwave-ring {
    position: absolute;
    border: 2px solid #a78bfa;
    border-radius: 50%;
    pointer-events: none;
    animation: shockwave-ring-expand 0.35s ease-out forwards;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 10px #c4b5fd;
}

@keyframes shockwave-ring-expand {
    0% { width: 10px; height: 10px; opacity: 1; }
    100% { width: 140px; height: 140px; opacity: 0; }
}

.super-lightning-line {
    position: absolute;
    height: 3px;
    background: linear-gradient(90deg, #c4b5fd, #ffffff, #a855f7);
    box-shadow: 0 0 10px #c4b5fd, 0 0 20px #8b5cf6;
    transform-origin: 0 50%;
    pointer-events: none;
    z-index: 98;
    animation: lightning-zap 0.2s ease-out forwards;
}

@keyframes lightning-zap {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

.score-pop {
    position: absolute;
    font-family: 'Fredoka', cursive, sans-serif;
    font-size: 1.35rem;
    font-weight: 800;
    pointer-events: none;
    z-index: 101;
    animation: score-pop-animation 0.9s ease-out forwards;
}

.score-positive { color: #fde047; text-shadow: 0 0 8px #f59e0b; }
.score-negative { color: #f87171; text-shadow: 0 0 8px #ef4444; }
.score-pop.score-combo { font-size: 1.5rem; color: #facc15; text-shadow: 0 0 12px #eab308; }

@keyframes score-pop-animation {
    0% { transform: translate(-50%, 0) scale(0.8); opacity: 1; }
    50% { transform: translate(-50%, -25px) scale(1.15); }
    100% { transform: translate(-50%, -50px) scale(1); opacity: 0; }
}

.particle, .scfa-particle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    will-change: transform, opacity;
}

.particle { width: 6px; height: 6px; }
.particle.slime { box-shadow: 0 0 8px currentColor; }
.scfa-particle { width: 16px; height: 16px; background-color: #c4b5fd; filter: drop-shadow(0 0 10px #a78bfa); }

@keyframes glow {
    from { transform: scale(1); }
    to { transform: scale(1.12); }
}

@keyframes pulse-text {
    50% { transform: scale(1.1); }
}

/* Responsive CSS Grid Layout (Preserves Rock-Solid Architecture) */
@media (min-width: 768px) { 
    .diet-choices {
        flex-direction: row;
        align-items: stretch;
    }
}

@media (min-width: 1024px) {
    body {
        display: flex;
        justify-content: center;
        align-items: center;
    }
    .page-container {
        display: grid;
        grid-template-columns: minmax(0, 3.2fr) minmax(0, 1fr);
        grid-template-rows: auto 1fr auto;
        grid-template-areas:
            "header header"
            "main   leaderboard"
            "footer footer";
        width: 100%;
        height: 96vh;
        max-height: 900px;
        max-width: 90rem;
        gap: 1.25rem;
        align-content: stretch;
    }
    .hud-container { grid-area: header; }
    .game-wrapper {
        grid-area: main;
        min-height: 0;
        height: 100%;
        display: flex;
        flex-direction: column;
    }
    .game-area-wrapper,
    #game-area-wrapper {
        width: 100%;
        height: 100%;
        flex-grow: 1;
        aspect-ratio: unset;
        min-height: 0;
        box-sizing: border-box;
    }
    .leaderboard-panel { 
        grid-area: leaderboard;
        display: flex; 
        flex-direction: column;
        background-color: #1a0a2a;
        border-radius: 0.75rem;
        padding: 1rem;
        border: 2px solid #7c3aed;
        height: 100%;
        min-height: 0;
        box-sizing: border-box;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    }
    .leaderboard-box {
        overflow-y: auto;
        flex-grow: 1;
        min-height: 0;
        scrollbar-width: thin;
        scrollbar-color: #7c3aed #1a0a2a;
    }
    .leaderboard-box::-webkit-scrollbar {
        width: 6px;
    }
    .leaderboard-box::-webkit-scrollbar-track {
        background: #1a0a2a;
    }
    .leaderboard-box::-webkit-scrollbar-thumb {
        background-color: #7c3aed;
        border-radius: 4px;
        border: 1px solid #1a0a2a;
    }
    .global-footer { grid-area: footer; }
    #leaderboardBtn,
    #leaderboardGameOverBtn {
        display: none !important;
    }

    .modal-footer-buttons {
        display: flex;
        justify-content: center;
        align-items: center;
        width: 100%;
    }

    #start-game-btn {
        margin: 0 auto;
        display: inline-block;
    }
}

@media (max-width: 640px) { 
    .modal-title { font-size: 1.75rem; } 
    .intro-guide { grid-template-columns: 1fr; } 
    .score-pop { font-size: 1rem; } 
}

.modal-body::-webkit-scrollbar { width: 8px; }
.modal-body::-webkit-scrollbar-track { background: #1a0a2a; }
.modal-body::-webkit-scrollbar-thumb { background-color: #7c3aed; border-radius: 4px; border: 2px solid #1a0a2a; }

.footer-content { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-bottom: 0.5rem; }
.footer-logo { height: 2rem; transition: transform 0.2s ease-in-out; }
.footer-logo.large { height: 2.5rem; }
.footer-link { display: flex; align-items: center; gap: 0.75rem; text-decoration: none; color: #a1a1aa; transition: color 0.2s; }
.footer-link:hover { color: #f4f4f5; }
.footer-link:hover .footer-logo { transform: scale(1.1); }
.footer-credit { text-align: center; font-size: 1rem; color: #a1a1aa; font-family: 'Gaegu', cursive; }
.footer-credit a { color: inherit; text-decoration: none; transition: color 0.2s; }
.footer-credit a:hover { color: #f4f4f5; }

/* Micro-Animations */
@keyframes wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(-3deg) scale(1.03); }
    75% { transform: rotate(3deg) scale(1.03); }
}

@keyframes pulse-wiggle {
    0%, 100% { transform: scale(1) rotate(0deg); }
    20% { transform: scale(1.04) rotate(-2deg); }
    40% { transform: scale(1.04) rotate(2deg); }
    60% { transform: scale(1.02) rotate(-1deg); }
    80% { transform: scale(1.02) rotate(1deg); }
}

.inspectable-sprite:hover,
.guide-pillar:hover,
.diet-choice-btn:hover {
    animation: wiggle 0.4s ease-in-out;
}

.hud-mute-button {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    transition: transform 0.15s ease, background-color 0.2s, border-color 0.2s;
}

.hud-mute-button:hover {
    transform: scale(1.06);
    background: rgba(39, 39, 42, 0.95);
    border-color: #a1a1aa;
}

.hud-mute-button:active {
    transform: scale(0.95);
}

.hud-mute-button svg {
    width: 1.25rem;
    height: 1.25rem;
    display: block;
}

#rotate-warning {
    display: none;
    position: fixed;
    inset: 0;
    background-color: #18181b;
    color: #f4f4f5;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    z-index: 200;
    padding: 1.5rem;
    font-family: 'Fredoka', sans-serif;
}

.rotate-icon {
    width: 4.5rem;
    height: 4.5rem;
    margin-bottom: 1.25rem;
    color: #38bdf8;
    animation: rotate-pulse 2s infinite ease-in-out;
}

@keyframes rotate-pulse {
    0%, 100% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(90deg) scale(1.08); }
}

@media screen and (max-width: 1023px) and (orientation: portrait) {
    .page-container, footer {
        display: none !important;
    }
    #rotate-warning {
        display: flex !important;
    }
}

@media screen and (max-height: 540px) and (orientation: landscape) {
    footer {
        display: none !important;
    }
    .page-container {
        padding: 0.25rem 0.5rem;
    }
    .game-wrapper {
        max-width: 100%;
        height: 100%;
    }
    .leaderboard-panel {
        display: none !important;
    }
    .hud {
        display: flex !important;
        flex-direction: row !important;
        justify-content: space-between !important;
        align-items: center !important;
        margin-bottom: 0.25rem !important;
        gap: 0.35rem !important;
    }
    .hud-element {
        font-size: 0.78rem;
        padding: 0.2rem 0.5rem;
        border-radius: 0.5rem;
    }
    .hud-label {
        display: none !important;
    }
    .integrity-container {
        min-width: 70px;
        max-width: 180px;
        flex-grow: 1;
    }
    .integrity-bar {
        height: 0.95rem;
        border-radius: 0.35rem;
    }
    .hud-mute-button {
        display: flex !important;
        padding: 0.2rem 0.4rem;
    }
    .canvas-container,
    .game-area-wrapper,
    #game-container {
        min-height: 0;
        flex: 1 1 auto;
    }
    canvas {
        max-height: 100%;
        max-width: 100%;
    }
    .modal {
        padding: 0.35rem 0.6rem;
    }
    .modal-header {
        padding-bottom: 0.15rem;
    }
    .modal-title {
        font-size: 1.3rem;
        line-height: 1.1;
    }
    .modal-subtitle {
        font-size: 0.7rem;
        margin: 0;
    }
    .tutorial-corner-btn {
        top: 0.35rem;
        left: 0.35rem;
        right: auto !important;
        padding: 0.2rem 0.5rem;
        font-size: 0.7rem;
    }
    .modal-body {
        gap: 0.35rem !important;
        max-height: 75vh !important;
        overflow-y: auto !important;
    }
    .intro-guide {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 0.35rem !important;
        max-width: 100% !important;
    }
    .guide-pillar {
        padding: 0.25rem 0.35rem !important;
        border-radius: 0.55rem !important;
        gap: 0.15rem !important;
    }
    .pillar-header {
        gap: 0.25rem !important;
    }
    .pillar-badge {
        font-size: 0.52rem !important;
        padding: 1px 4px !important;
    }
    .pillar-title {
        font-size: 0.7rem !important;
    }
    .pillar-sprites {
        display: flex !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        gap: 0.15rem !important;
    }
    .pillar-sprites .icon-container {
        width: 1.75rem !important;
        height: 1.75rem !important;
        padding: 0.1rem !important;
    }
    .pillar-desc {
        font-size: 0.56rem !important;
        line-height: 1.1 !important;
        margin: 0 !important;
    }
    .menu-mission-banner {
        display: flex !important;
        gap: 0.35rem !important;
        margin-top: 0.1rem !important;
    }
    .mission-pill {
        padding: 0.12rem 0.4rem !important;
        font-size: 0.58rem !important;
    }
    .modal-footer {
        padding-top: 0.15rem !important;
        gap: 0.25rem !important;
    }
    .player-name-input {
        padding: 0.25rem 0.6rem !important;
        font-size: 0.78rem !important;
        max-width: 14rem !important;
        border-radius: 0.5rem !important;
    }
    .modal-footer-buttons {
        margin-top: 0.15rem !important;
        gap: 0.4rem !important;
    }
    .btn-primary, .btn-secondary {
        padding: 0.3rem 1.25rem !important;
        font-size: 0.8rem !important;
        border-radius: 0.5rem !important;
    }

    /* Microbe Detail Card Modal Mobile Landscape */
    .modal-card-wrapper {
        padding: 0.2rem 0.4rem !important;
        justify-content: center !important;
        align-items: center !important;
    }
    .microbe-inspect-card {
        padding: 0.4rem 0.75rem !important;
        max-width: 580px !important;
        width: 96% !important;
        gap: 0.3rem !important;
        border-radius: 0.75rem !important;
        border-width: 1.5px !important;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.7), 0 0 15px rgba(168, 85, 247, 0.25) !important;
    }
    .card-top-row {
        width: 100% !important;
        margin-bottom: 0 !important;
    }
    .microbe-badge {
        font-size: 0.55rem !important;
        padding: 2px 6px !important;
        margin-bottom: 0 !important;
    }
    .microbe-type-label {
        font-size: 0.6rem !important;
        letter-spacing: 0.5px !important;
    }
    .fact-close-btn {
        font-size: 1.1rem !important;
        padding: 0 0.25rem !important;
        line-height: 1 !important;
    }
    .microbe-card-content {
        display: grid !important;
        grid-template-columns: 125px 1fr !important;
        gap: 0.65rem !important;
        align-items: center !important;
        width: 100% !important;
    }
    .microbe-card-sidebar {
        display: flex !important;
        flex-direction: column !important;
        align-items: center !important;
        gap: 0.25rem !important;
    }
    .microbe-card-avatar {
        width: 52px !important;
        height: 52px !important;
        margin: 0 !important;
        border-width: 1.5px !important;
    }
    .microbe-inspect-img {
        width: 38px !important;
        height: 38px !important;
    }
    .microbe-card-action {
        font-size: 0.58rem !important;
        padding: 0.18rem 0.45rem !important;
        line-height: 1.15 !important;
        text-align: center !important;
        white-space: normal !important;
        border-width: 1px !important;
    }
    .microbe-card-main {
        display: flex !important;
        flex-direction: column !important;
        gap: 0.22rem !important;
        text-align: left !important;
        min-width: 0 !important;
    }
    .microbe-card-title {
        font-size: 1.05rem !important;
        text-align: left !important;
        line-height: 1.15 !important;
        margin: 0 !important;
    }
    .microbe-card-desc {
        font-size: 0.68rem !important;
        line-height: 1.25 !important;
        text-align: left !important;
        margin: 0 !important;
    }
    .card-science-grid {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 0.3rem !important;
        width: 100% !important;
    }
    .card-stat-pill {
        padding: 0.18rem 0.35rem !important;
        border-radius: 0.35rem !important;
        gap: 0.08rem !important;
    }
    .stat-pill-label {
        font-size: 0.52rem !important;
        letter-spacing: 0.3px !important;
    }
    .stat-pill-val {
        font-size: 0.68rem !important;
        line-height: 1.15 !important;
    }
    .btn-inspect-close {
        align-self: flex-start !important;
        margin-top: 0.1rem !important;
        padding: 0.28rem 1.6rem !important;
        font-size: 0.75rem !important;
    }

    /* Diet Modal Mobile Landscape */
    .diet-choices {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 0.35rem !important;
    }
    .diet-choice-btn {
        padding: 0.35rem 0.4rem !important;
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
        gap: 0.15rem !important;
        border-radius: 0.5rem !important;
    }
    .diet-choice-btn .icon-container {
        width: 2rem !important;
        height: 2rem !important;
        padding: 0.15rem !important;
        margin: 0 0 0.1rem 0 !important;
    }
    .diet-title {
        font-size: 0.75rem !important;
    }
    .diet-desc {
        font-size: 0.58rem !important;
        line-height: 1.15 !important;
    }
    #confirm-diet-btn {
        padding: 0.3rem 1.5rem !important;
        font-size: 0.82rem !important;
    }

    /* Game Over Modal Mobile Landscape */
    .game-over-title {
        font-size: 1.25rem !important;
    }
    .game-over-body {
        gap: 0.3rem !important;
    }
    .game-over-stats-grid {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 0.35rem !important;
    }
    .game-over-stat-card {
        padding: 0.25rem 0.45rem !important;
        gap: 0.35rem !important;
        border-radius: 0.5rem !important;
    }
    .game-over-stat-icon {
        width: 26px !important;
        height: 26px !important;
    }
    .game-over-stat-val {
        font-size: 0.95rem !important;
    }
    .game-over-stat-label {
        font-size: 0.52rem !important;
    }
    .science-fact-card {
        padding: 0.25rem 0.5rem !important;
        border-radius: 0.5rem !important;
        margin: 0.1rem 0 !important;
    }
    .science-fact-header {
        margin-bottom: 0.15rem !important;
    }
    .science-flask-icon {
        width: 16px !important;
        height: 16px !important;
    }
    .science-fact-badge {
        font-size: 0.55rem !important;
    }
    .science-fact-text {
        font-size: 0.65rem !important;
        line-height: 1.25 !important;
    }

    #mainLeaderboardModal .modal-body,
    .how-to-card,
    .fact-card {
        max-height: 85vh;
        overflow-y: auto;
    }
    .tutorial-cards {
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 0.35rem;
    }
    .tutorial-card {
        padding: 0.4rem;
    }
    .tutorial-step-img {
        width: 2rem;
        height: 2rem;
    }
}

.science-corner-btn {
    position: absolute;
    top: 1rem;
    left: auto;
    right: 1rem;
    z-index: 20;
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-family: 'Fredoka', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.5px;
    color: #f4f4f5;
    background: rgba(5, 150, 105, 0.35);
    border: 1.5px solid #34d399;
    border-radius: 9999px;
    padding: 0.35rem 1rem;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    transition: all 0.2s;
}
.science-corner-btn:hover {
    background: #059669;
    color: #ffffff;
    box-shadow: 0 0 15px rgba(52, 211, 153, 0.6);
    transform: translateY(-1px);
}
#scienceInfoModal {
    position: fixed;
    inset: 0;
    z-index: 110;
    background: rgba(10, 10, 15, 0.85);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem;
    box-sizing: border-box;
}
#scienceInfoModal.hidden {
    display: none !important;
}
.science-info-card {
    position: relative;
    background: #18181b;
    border: 2px solid #34d399;
    border-radius: 1.25rem;
    padding: 1.5rem;
    max-width: 48rem;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.65);
    margin: auto;
}
.science-info-body {
    text-align: left;
    color: #d4d4d8;
    font-family: 'Fredoka', sans-serif;
    font-size: 0.85rem;
    line-height: 1.55;
    width: 100%;
}
.science-info-body h3 {
    color: #6ee7b7;
    font-size: 0.95rem;
    font-weight: 700;
    margin: 1rem 0 0.4rem 0;
}
.science-info-body p { margin: 0.5rem 0; }
.science-info-body ul {
    margin: 0.3rem 0 0.6rem 1.1rem;
    list-style: disc;
}
.science-info-body li { margin: 0.2rem 0; }
.science-info-body a {
    color: #38bdf8;
    text-decoration: underline;
}
.science-info-body a:hover { color: #7dd3fc; }
.science-grade { font-size: 0.8rem; color: #a1a1aa; }
@media (max-width: 1024px) {
    .science-corner-btn {
        top: 0.35rem;
        right: 0.35rem;
        left: auto !important;
        padding: 0.2rem 0.5rem;
        font-size: 0.7rem;
    }
}

.footer-legal {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.9rem;
    margin-top: 0.4rem;
    font-family: 'Fredoka', sans-serif;
    font-size: 0.7rem;
}
.footer-legal a, .footer-legal-btn {
    color: #71717a;
    text-decoration: none;
    background: none;
    border: none;
    padding: 0;
    font: inherit;
    cursor: pointer;
}
.footer-legal a:hover, .footer-legal-btn:hover { color: #34d399; }
