:root {
    --vh: 1vh;
}

html, body {
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden; 
}

body {
    font-family: 'Fredoka', system-ui, -apple-system, sans-serif;
    background-color: #18181b; 
    color: #f4f4f5; 
    display: flex;
    flex-direction: column;
}

.page-container {
    width: 100%;
    height: 100vh;
    height: calc(var(--vh, 1vh) * 100);
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

.leaderboard-panel {
    display: none;
}

.game-wrapper {
    width: 100%;
    max-width: 64rem;
    margin: 0 auto;
    padding: 1rem;
    box-sizing: border-box;
    flex: 1 1 auto;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

footer {
    flex-shrink: 0;
    padding: 1rem;
    padding-top: 0;
    box-sizing: border-box;
}

.footer-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
}

.footer-logo {
    height: 2rem;
    transition: transform 0.2s ease-in-out;
}

.footer-logo.large {
    height: 2.25rem;
}

.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.08);
}

.canvas-container {
    position: relative;
    width: 100%;
    flex-grow: 1; 
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    touch-action: none;
}

#game-container {
    background-color: #27272a;
    border-radius: 0.75rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
    transition: box-shadow 0.3s ease-in-out;
    width: 100%;
    height: 100%;
    max-width: 100%;
    max-height: 100%;
    aspect-ratio: 16 / 9;
    position: relative;
    overflow: hidden;
    touch-action: none;
}

.game-area-wrapper.stability-warning {
    box-shadow: 0 0 30px 10px rgba(239, 68, 68, 0.5), inset 0 0 30px 10px rgba(239, 68, 68, 0.35);
    animation: pulse-border-red 1s infinite;
}

@keyframes pulse-border-red {
    0%, 100% { border: 2px solid #ef4444; }
    50% { border: 2px solid #f87171; }
}

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

.hud-element {
    font-family: 'Fredoka', sans-serif;
    font-size: 1rem;
    font-weight: 700;
    background: rgba(24, 24, 27, 0.85);
    backdrop-filter: blur(6px);
    padding: 0.5rem 1rem;
    border-radius: 0.75rem;
    border: 2px solid #52525b;
    letter-spacing: 0.5px;
    transition: color 0.3s, border-color 0.3s, transform 0.2s;
    white-space: nowrap;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.streak {
    color: #facc15;
    border-color: rgba(250, 204, 21, 0.5);
}

.stability-container {
    flex-grow: 1;
    text-align: center;
    min-width: 100px;
}

.hud-label {
    font-family: 'Fredoka', sans-serif;
    font-size: 0.85rem;
    font-weight: 600;
    display: block;
    margin-bottom: 0.25rem;
    letter-spacing: 0.5px;
    color: #e4e4e7;
}

.stability-bar {
    width: 100%;
    height: 1.35rem;
    background-color: rgba(0, 0, 0, 0.6);
    border: 2px solid #52525b;
    border-radius: 0.5rem;
    padding: 2px;
    box-sizing: border-box;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5);
}

.stability-fill {
    height: 100%;
    width: 100%;
    background-color: #22c55e;
    border-radius: 0.25rem;
    transition: width 0.3s ease-in-out, background-color 0.3s ease-in-out;
}

.hud-mute-button {
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #e4e4e7;
}

.hud-mute-button:hover {
    border-color: #22c55e;
    color: #22c55e;
}

/* Modals Core */
.modal {
    position: absolute;
    inset: 0;
    background-color: rgba(10, 10, 12, 0.92);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    border-radius: 0.75rem;
    z-index: 100;
    box-sizing: border-box;
}

#startContent {
    display: flex;
    flex-direction: column;
    flex-grow: 1;
    min-height: 0;
    width: 100%;
}

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

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

#game-over-modal .modal-body,
#mainLeaderboardModal .modal-body {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.modal-footer {
    flex-shrink: 0;
    padding-top: 0.75rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
}

.modal-footer-buttons {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    width: 100%;
    max-width: 28rem;
    margin: 0 auto;
}

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

@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); }
}

.modal-title {
    font-family: 'Fredoka', sans-serif;
    font-size: 2.75rem;
    letter-spacing: 1px;
    font-weight: 700;
    color: white;
    margin-bottom: 0.2rem;
    text-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

.modal-subtitle {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.25rem;
    letter-spacing: 0.5px;
    color: #facc15;
    font-weight: 600;
}

.game-over-title {
    font-family: 'Fredoka', sans-serif;
    font-size: 2.25rem;
    font-weight: 700;
}

.failure-title {
    color: #ef4444;
}

.intro-box {
    width: 100%;
    max-width: 56rem;
    margin: 0 auto 0.75rem auto;
    padding: 0.75rem;
    background-color: rgba(24, 24, 27, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    box-sizing: border-box;
}

.cards-hint {
    font-family: 'Fredoka', sans-serif;
    font-size: 0.8rem;
    color: #a1a1aa;
    text-align: center;
    letter-spacing: 0.3px;
    font-weight: 500;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.65rem;
    width: 100%;
}

@media (min-width: 640px) {
    .cards-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

.character-card {
    position: relative;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 0.85rem;
    padding: 0.65rem 0.5rem 0.6rem 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    user-select: none;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.2s ease, border-color 0.2s ease, background 0.2s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.character-card:hover {
    animation: wiggle 0.4s ease-in-out;
    transform: translateY(-4px) scale(1.03);
    background: rgba(255, 255, 255, 0.08);
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
}

.character-card:active {
    transform: scale(0.96);
}

#start-game-btn:hover {
    animation: pulse-wiggle 0.6s ease-in-out;
}

.card-hero { border-color: rgba(34, 197, 94, 0.45); }
.card-hero:hover { border-color: #22c55e; box-shadow: 0 8px 24px rgba(34, 197, 94, 0.25); }
.card-ally { border-color: rgba(245, 158, 11, 0.45); }
.card-ally:hover { border-color: #f59e0b; box-shadow: 0 8px 24px rgba(245, 158, 11, 0.2); }
.card-threat { border-color: rgba(239, 68, 68, 0.45); }
.card-threat:hover { border-color: #ef4444; box-shadow: 0 8px 24px rgba(239, 68, 68, 0.2); }
.card-powerup { border-color: rgba(56, 189, 248, 0.45); }
.card-powerup:hover { border-color: #38bdf8; box-shadow: 0 8px 24px rgba(56, 189, 248, 0.2); }

.card-badge {
    font-family: 'Fredoka', sans-serif;
    font-size: 0.65rem;
    font-weight: 700;
    padding: 0.15rem 0.55rem;
    border-radius: 9999px;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin-bottom: 0.35rem;
    line-height: 1.2;
}

.badge-hero { background: rgba(34, 197, 94, 0.2); color: #86efac; border: 1px solid rgba(34, 197, 94, 0.4); }
.badge-ally { background: rgba(245, 158, 11, 0.2); color: #fcd34d; border: 1px solid rgba(245, 158, 11, 0.4); }
.badge-threat { background: rgba(239, 68, 68, 0.2); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.4); }
.badge-powerup { background: rgba(56, 189, 248, 0.2); color: #7dd3fc; border: 1px solid rgba(56, 189, 248, 0.4); }

.card-portrait, .icon-container {
    width: 3.5rem;
    height: 3.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.25);
    border-radius: 0.65rem;
    padding: 0.3rem;
    box-sizing: border-box;
    margin-bottom: 0.35rem;
    transition: transform 0.2s ease;
}

.character-card:hover .card-portrait,
.character-card:hover .icon-container {
    transform: scale(1.08);
}

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

.card-name {
    font-family: 'Fredoka', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    line-height: 1.2;
    margin-bottom: 0.2rem;
}

.card-ability {
    font-family: 'Fredoka', sans-serif;
    font-size: 0.75rem;
    color: #d4d4d8;
    line-height: 1.25;
    font-weight: 500;
}

.text-good { color: #4ade80; }
.text-bad { color: #f87171; }
.text-opportunist { color: #c084fc; }
.text-powerup-slomo { color: #60a5fa; }
.text-powerup-gold { color: #facc15; }
.text-powerup-purple { color: #c084fc; }

.player-name-input {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.1rem;
    font-weight: 600;
    background-color: #27272a;
    color: white;
    width: 100%;
    max-width: 28rem;
    text-align: center;
    padding: 0.6rem 1rem;
    border-radius: 0.65rem;
    border: 2px solid #52525b;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.player-name-input:focus {
    outline: none;
    border-color: #22c55e;
}

.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', sans-serif;
    color: white;
    font-weight: 700;
    padding: 0.75rem 1.75rem;
    border-radius: 0.75rem;
    font-size: 1.2rem;
    letter-spacing: 0.5px;
    border: none;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease, background-color 0.2s;
}

.btn-primary { background-color: #22c55e; }
.btn-primary:hover {
    background-color: #16a34a;
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 18px rgba(34, 197, 94, 0.4);
}
.btn-primary:active { transform: translateY(1px) scale(0.98); }

.btn-secondary { background-color: #3b82f6; }
.btn-secondary:hover {
    background-color: #2563eb;
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 6px 18px rgba(59, 130, 246, 0.4);
}
.btn-secondary:active { transform: translateY(1px) scale(0.98); }

#backToMenuBtn, #backToMenuGameOverBtn { background-color: #4b5563; }
#backToMenuBtn:hover, #backToMenuGameOverBtn:hover {
    background-color: #374151;
    transform: translateY(-2px) scale(1.02);
}

/* How to Play Corner Button and Modals */
.tutorial-corner-btn {
    position: absolute;
    top: 1rem;
    left: 1rem;
    right: auto; /* right: 1.25rem */
    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;
    text-transform: uppercase;
    color: #f4f4f5;
    background: rgba(124, 58, 237, 0.35);
    border: 1.5px solid #a855f7;
    border-radius: 9999px;
    padding: 0.35rem 0.85rem;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    transition: all 0.2s;
    white-space: nowrap;
}

.tutorial-corner-btn svg {
    width: 1rem;
    height: 1rem;
    flex-shrink: 0;
}

.tutorial-corner-btn:hover {
    background: #7c3aed;
    color: #ffffff;
    box-shadow: 0 0 15px rgba(168, 85, 247, 0.6);
    transform: translateY(-1px);
}

#howToModal, #factModal, #mainLeaderboardModal {
    position: fixed;
    inset: 0;
    z-index: 100;
    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;
}

.how-to-card {
    position: relative;
    background: #18181b;
    border: 2px solid #a855f7;
    border-radius: 1.25rem;
    padding: 1.5rem 1.5rem 1.25rem 1.5rem;
    max-width: 48rem;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: 0 20px 45px rgba(0, 0, 0, 0.65);
    animation: scale-up 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    margin: auto;
    box-sizing: border-box;
}

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

.how-to-title {
    font-size: 1.75rem;
    font-weight: 700;
    color: white;
    margin: 0.5rem 0 0.25rem 0;
}

.tutorial-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    max-width: 48rem;
    width: 100%;
    margin: 0 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: center;
    text-align: left;
}

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

.tutorial-step-img {
    width: 2.75rem;
    height: 2.75rem;
    flex-shrink: 0;
}

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

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

/* Science Fact Modal */
.fact-card {
    position: relative;
    background: #18181b;
    border: 2px solid #38bdf8;
    border-radius: 1.25rem;
    padding: 1.5rem;
    max-width: 24rem;
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6);
    animation: fact-pop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.fact-header {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.fact-close-btn {
    background: transparent;
    border: none;
    color: #a1a1aa;
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 0.25rem;
    transition: color 0.15s;
}

.fact-close-btn:hover {
    color: #ffffff;
}

.fact-portrait {
    width: 5.5rem;
    height: 5.5rem;
    background: rgba(0, 0, 0, 0.35);
    border-radius: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    margin-bottom: 0.85rem;
    animation: wiggle 2s infinite ease-in-out;
}

.fact-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.fact-title {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    color: #ffffff;
    margin-bottom: 0.5rem;
}

.fact-text {
    font-family: 'Fredoka', sans-serif;
    font-size: 0.95rem;
    color: #e4e4e7;
    line-height: 1.45;
    margin-bottom: 1.25rem;
}

.fact-btn {
    min-width: 8rem;
    padding: 0.65rem 1.5rem;
}

/* Leaderboard Sidebar & Row Styles */
.leaderboard-box {
    width: 100%;
    max-width: 24rem;
    margin: auto;
    background: #18181b;
    padding: 1rem;
    border-radius: 0.75rem;
    border: 1px solid #3f3f46;
    box-sizing: border-box;
}

.leaderboard-podium-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.55rem 0.75rem;
    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', sans-serif;
    font-weight: 700;
    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', sans-serif;
    font-size: 0.62rem;
    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: 700;
    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;
}

.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', 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', sans-serif;
    font-size: 0.95rem;
    font-weight: 700;
    color: #cbd5e1;
}

.leaderboard-tip {
    margin-top: 0.75rem;
    padding: 0.65rem 0.75rem;
    background: rgba(250, 204, 21, 0.08);
    border: 1px dashed rgba(250, 204, 21, 0.35);
    border-radius: 0.65rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-family: 'Fredoka', sans-serif;
    font-size: 0.75rem;
    color: #fef08a;
    line-height: 1.3;
}

.leaderboard-tip-icon {
    width: 1.5rem;
    height: 1.5rem;
    flex-shrink: 0;
}

.leaderboard-empty {
    padding: 1.5rem 0.5rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
}

.leaderboard-empty-title {
    font-family: 'Fredoka', sans-serif;
    font-size: 0.9rem;
    font-weight: 700;
    color: #facc15;
    letter-spacing: 0.5px;
}

.leaderboard-subtext {
    font-size: 0.8rem;
    color: #a1a1aa;
}

/* Modal Visibility & Scrollbars */
.modal.hidden,
#factModal.hidden,
#howToModal.hidden,
#start-modal.hidden,
#game-over-modal.hidden,
#mainLeaderboardModal.hidden,
#soundOffIcon.hidden,
#wave-warning.hidden {
    display: none !important;
}

.modal-body::-webkit-scrollbar,
.how-to-card::-webkit-scrollbar {
    width: 8px;
}

.modal-body::-webkit-scrollbar-track,
.how-to-card::-webkit-scrollbar-track {
    background: #27272a;
    border-radius: 4px;
}

.modal-body::-webkit-scrollbar-thumb,
.how-to-card::-webkit-scrollbar-thumb {
    background-color: #facc15;
    border-radius: 6px;
    border: 2px solid #27272a;
}

/* Mitosis Manager Specific Gameplay Elements */
.game-bins-area {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 20%; 
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    align-items: center;
    padding: 0.75rem 0.5rem;
    box-sizing: border-box;
    z-index: 10;
}

.bin {
    width: 92%;
    height: 44%;
    border: 2px dashed rgba(255, 255, 255, 0.25);
    border-radius: 0.85rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 0.4rem;
    box-sizing: border-box;
    font-weight: 700;
    color: #e4e4e7;
    transition: transform 0.2s cubic-bezier(0.34, 1.56, 0.64, 1), background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
    background: rgba(24, 24, 27, 0.6);
    user-select: none;
}

.bin-title {
    font-size: 0.9rem;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.bin-hint {
    font-size: 0.7rem;
    font-weight: 500;
    opacity: 0.8;
    margin-top: 0.2rem;
}

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

.bin-icon-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.4));
}

.bin.repair {
    border-color: rgba(59, 130, 246, 0.5);
    color: #93c5fd;
}

.bin.repair .bin-icon-box {
    background: rgba(59, 130, 246, 0.15);
}

.bin.repair.hover-target {
    background-color: rgba(59, 130, 246, 0.25);
    border-color: #60a5fa;
    border-style: solid;
    transform: scale(1.08);
    box-shadow: 0 0 24px rgba(59, 130, 246, 0.45);
}

.bin.apoptosis {
    border-color: rgba(239, 68, 68, 0.5);
    color: #fca5a5;
}

.bin.apoptosis .bin-icon-box {
    background: rgba(239, 68, 68, 0.15);
}

.bin.apoptosis.hover-target {
    background-color: rgba(239, 68, 68, 0.25);
    border-color: #f87171;
    border-style: solid;
    transform: scale(1.08);
    box-shadow: 0 0 24px rgba(239, 68, 68, 0.45);
}

.conveyor-area {
    position: absolute;
    left: 20%; 
    top: 0;
    bottom: 0;
    width: 68%; 
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    padding: 0.75rem 0;
    box-sizing: border-box;
}

.conveyor-belt {
    width: 100%;
    height: 28%; 
    background: linear-gradient(180deg, #3f3f46 0%, #27272a 100%);
    border-top: 2.5px solid rgba(255, 255, 255, 0.12);
    border-bottom: 2.5px solid rgba(0, 0, 0, 0.5);
    border-radius: 0.5rem;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.4);
}

.conveyor-belt::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    width: 200%;
    height: 6px;
    margin-top: -3px;
    background-image: repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.2) 0px, rgba(255, 255, 255, 0.2) 16px, transparent 16px, transparent 32px);
    animation: conveyor-move 0.8s linear infinite;
}

@keyframes conveyor-move {
    from { transform: translateX(0); }
    to { transform: translateX(-32px); }
}

.game-zones {
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 12%; 
    background: linear-gradient(90deg, rgba(34, 197, 94, 0.15) 0%, rgba(34, 197, 94, 0.3) 100%);
    border: 2px dashed rgba(34, 197, 94, 0.6);
    border-radius: 0 0.85rem 0.85rem 0;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.25rem;
    font-weight: 700;
    color: #4ade80;
    letter-spacing: 2px;
    text-align: center;
    text-shadow: 0 0 10px rgba(34, 197, 94, 0.5);
}

.divide-text {
    line-height: 1.4;
}

#cytokinesis-layer {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 80;
}

.daughter-cell-anim {
    position: absolute;
    width: 36px;
    height: 36px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    animation: cytokinesis-float 1.2s ease-out forwards;
    filter: drop-shadow(0 4px 8px rgba(34, 197, 94, 0.6));
}

@keyframes cytokinesis-float {
    0% {
        transform: scale(0.6) translate(0, 0);
        opacity: 1;
    }
    50% {
        transform: scale(1.1) translate(15px, var(--dy, -20px));
        opacity: 1;
    }
    100% {
        transform: scale(0.9) translate(40px, calc(var(--dy, -20px) * 1.6));
        opacity: 0;
    }
}

.wave-warning-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: rgba(15, 6, 26, 0.75);
    backdrop-filter: blur(4px);
    z-index: 1000;
    pointer-events: none;
    animation: flash-warning 0.6s infinite alternate;
}

#wave-warning-title {
    font-size: 2.75rem;
    font-weight: 700;
    color: #f87171;
    text-shadow: 0 0 20px #ef4444, 0 0 40px #ef4444;
    letter-spacing: 2px;
}

.wave-warning-subtitle {
    font-size: 1.25rem;
    font-weight: 600;
    color: #fecaca;
    margin-top: 0.5rem;
}

@keyframes flash-warning {
    from { opacity: 1; transform: scale(1); }
    to { opacity: 0.8; transform: scale(1.02); }
}

.cell {
    position: absolute;
    width: 52px;
    height: 52px;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
    user-select: none;
    will-change: transform;
    cursor: grab;
    transition: transform 0.1s linear, filter 0.3s ease;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    z-index: 50;
    touch-action: none;
}

.cell.healthy {
    background-image: url('img/healthy_cell.png');
}

.cell.damaged {
    background-image: url('img/damaged_cell.png');
    animation: pulse-red 1s infinite;
}

.cell.mutated {
    background-image: url('img/mutated_cell.png');
    animation: pulse-purple 0.7s infinite;
}

.cell.dragging {
    cursor: grabbing;
    z-index: 1000;
    transform: scale(1.15);
    filter: drop-shadow(0 0 12px white);
    transition: none;
}

@keyframes pulse-red {
    50% { filter: drop-shadow(0 0 12px #ef4444); }
}

@keyframes pulse-purple {
    50% { filter: drop-shadow(0 0 12px #a855f7); }
}

.powerup {
    position: absolute;
    width: 44px;
    height: 44px;
    box-sizing: border-box;
    display: flex;
    justify-content: center;
    align-items: center;
    user-select: none;
    will-change: transform;
    cursor: pointer;
    transition: transform 0.1s linear, filter 0.3s ease;
    z-index: 60;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    touch-action: none;
}

.powerup.slowmo {
    background-image: url('img/g1_powerup.png');
    animation: pulse-blue 1s infinite;
}

.powerup.p53 {
    background-image: url('img/p53_guardian.png');
    animation: pulse-gold 1s infinite;
}

.powerup.caspase {
    background-image: url('img/caspase_cleaner.png');
    animation: pulse-purple-light 1s infinite;
}

@keyframes pulse-blue {
    50% { filter: drop-shadow(0 0 12px #60a5fa); }
}

@keyframes pulse-gold {
    50% { filter: drop-shadow(0 0 12px #facc15); }
}

@keyframes pulse-purple-light {
    50% { filter: drop-shadow(0 0 12px #c084fc); }
}

.game-area-wrapper.slo-mo {
    box-shadow: 0 0 30px 10px rgba(59, 130, 246, 0.5), inset 0 0 30px 10px rgba(59, 130, 246, 0.35);
}

#game-container.slo-mo {
    filter: hue-rotate(-15deg);
}

#score-pop-container {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 101;
}

.score-pop {
    position: absolute;
    font-size: 1.25rem;
    font-weight: 700;
    pointer-events: none;
    animation: score-pop-animation 1s ease-out forwards;
    white-space: nowrap;
}

.score-positive {
    color: #fde047;
    text-shadow: 0 0 8px #f59e0b;
}

.score-negative {
    color: #f87171;
    text-shadow: 0 0 8px #ef4444;
}

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

.science-fact-box {
    background: rgba(0, 0, 0, 0.35);
    border: 1.5px solid rgba(167, 139, 250, 0.5);
    border-radius: 0.85rem;
    padding: 1.25rem;
    max-width: 40rem;
    margin: 0 auto;
    text-align: center;
}

.science-fact-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #c4b5fd;
    margin: 0 0 0.5rem 0;
}

.science-fact-text {
    font-size: 1.1rem;
    color: #f4f4f5;
    line-height: 1.4;
    margin: 0;
}

.final-score-text {
    font-size: 1.25rem;
    color: #f4f4f5;
    margin: 0.25rem 0 0.5rem 0;
    font-weight: 600;
}

.leaderboard-rank-text {
    font-size: 1.1rem;
    color: #facc15;
    margin-bottom: 1rem;
    font-weight: 600;
}

/* Responsive Media Queries matching Immune Rush */
@media (max-width: 640px) {
    .hud {
        display: grid;
        grid-template-areas:
            "score time"
            "stability stability";
        grid-template-columns: 1fr 1fr;
        row-gap: 0.5rem;
        align-items: center;
    }
    #scoreContainer { grid-area: score; justify-self: start; }
    .stability-container { grid-area: stability; }
    #timeContainer { grid-area: time; justify-self: end; }
    .hud-mute-button { display: none; }
    #streakContainer { display: none; }
    .modal-title { font-size: 2rem; }
    .modal-subtitle { font-size: 1.1rem; }
    .game-over-title { font-size: 1.75rem; }
    .icon-container { width: 2.75rem; height: 2.75rem; }
    .card-name { font-size: 0.85rem; }
    .card-ability { font-size: 0.7rem; }
    .btn-primary, .btn-secondary { font-size: 1.05rem; padding: 0.6rem 1.2rem; }
    .hud-label { display: none; }
}

@media (min-width: 1024px) {
    .page-container {
        display: grid;
        grid-template-columns: minmax(0, 3.2fr) minmax(0, 1fr);
        width: 100%;
        max-width: 86rem;
        margin: 0 auto;
        padding: 0.75rem 1rem;
        gap: 1.25rem;
        flex: 1 1 auto;
        min-height: 0;
        box-sizing: border-box;
        align-items: stretch;
    }

    .game-wrapper {
        max-width: 100%;
        padding: 0;
    }

    .leaderboard-panel {
        display: flex !important;
        flex-direction: column;
        background-color: rgba(24, 24, 27, 0.85);
        backdrop-filter: blur(8px);
        border-radius: 0.75rem;
        padding: 1rem;
        border: 2px solid #52525b;
        min-height: 0;
        box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    }

    .leaderboard-panel-title {
        font-family: 'Fredoka', sans-serif;
        font-size: 1.35rem;
        font-weight: 700;
        color: #facc15;
        margin: 0 0 0.75rem 0;
        text-align: center;
        letter-spacing: 0.5px;
    }

    #desktopLeaderboardList {
        overflow-y: auto;
        flex-grow: 1;
        min-height: 0;
        background: transparent;
        border: none;
        padding: 0;
        max-width: 100%;
    }

    #leaderboardBtn,
    #leaderboardGameOverBtn {
        display: none !important;
    }
}

.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: 640px) and (orientation: landscape), screen and (max-width: 1023px) and (orientation: landscape) {
    footer,
    .global-footer {
        display: none !important;
    }
    .page-container {
        padding: 0.25rem 0.5rem;
        gap: 0.25rem;
        height: 100vh;
        height: calc(var(--vh, 1vh) * 100);
    }
    .game-wrapper {
        max-width: 100%;
        height: 100%;
        min-height: 0;
        flex: 1 1 auto;
    }
    .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;
    }
    .stability-container {
        min-width: 70px;
        max-width: 180px;
        flex-grow: 1;
    }
    .stability-bar {
        height: 0.95rem;
        border-radius: 0.35rem;
        width: 100%;
        max-width: 140px;
    }
    .hud-mute-button {
        display: flex !important;
        padding: 0.2rem 0.4rem;
    }
    .canvas-container,
    .game-area-wrapper,
    #game-area-wrapper,
    #game-container {
        min-height: 0;
        flex: 1 1 auto;
        height: 100%;
    }
    canvas {
        max-height: 100%;
        max-width: 100%;
    }
    .modal {
        padding: 0.35rem 0.5rem;
        justify-content: space-between;
    }
    #startContent {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        height: 100%;
        width: 100%;
    }
    .modal-header {
        padding-bottom: 0.1rem;
    }
    .modal-title {
        font-size: clamp(1.1rem, 2.5vw, 1.35rem);
        line-height: 1.1;
        margin-bottom: 0.1rem;
    }
    .modal-subtitle {
        font-size: clamp(0.65rem, 1.5vw, 0.75rem);
        margin: 0 0 0.15rem 0;
    }
    .tutorial-corner-btn {
        top: 0.35rem;
        left: 0.35rem;
        right: auto !important;
        padding: 0.18rem 0.45rem;
        font-size: 0.68rem;
        gap: 0.25rem;
        white-space: nowrap;
        height: 24px;
    }
    .tutorial-corner-btn svg {
        width: 0.75rem;
        height: 0.75rem;
        flex-shrink: 0;
    }
    .intro-box {
        padding: 0.25rem 0.4rem;
        margin-bottom: 0.2rem;
        gap: 0.2rem;
        max-width: 100%;
    }
    .cards-hint {
        font-size: 0.65rem;
        margin-bottom: 0.15rem;
    }
    .cards-grid {
        display: grid !important;
        grid-template-columns: repeat(6, 1fr) !important;
        gap: 0.25rem;
        width: 100%;
    }
    @media (max-width: 580px) {
        .cards-grid {
            grid-template-columns: repeat(4, 1fr) !important;
        }
    }
    .character-card {
        padding: 0.25rem 0.15rem;
        border-radius: 0.5rem;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        min-width: 0;
    }
    .card-badge {
        font-size: 0.5rem;
        padding: 0.05rem 0.25rem;
        margin-bottom: 0.12rem;
        line-height: 1;
    }
    .card-portrait, .icon-container {
        width: 2.15rem;
        height: 2.15rem;
        padding: 0.15rem;
        margin-bottom: 0.12rem;
        border-radius: 0.45rem;
    }
    .card-portrait img, .icon-container img {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
    }
    .card-name {
        font-size: 0.62rem;
        font-weight: 700;
        margin-bottom: 0;
        line-height: 1.1;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 100%;
    }
    .card-ability {
        display: none !important;
    }
    .modal-footer {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: wrap !important;
        justify-content: center !important;
        align-items: center !important;
        padding-top: 0.2rem !important;
        gap: 0.4rem !important;
        width: 100%;
    }
    .player-name-input {
        padding: 0.3rem 0.6rem;
        font-size: 0.82rem;
        height: 32px;
        max-width: 11rem;
        border-radius: 0.5rem;
        margin: 0;
    }
    .modal-footer-buttons {
        display: flex !important;
        flex-direction: row !important;
        gap: 0.4rem !important;
        width: auto !important;
        margin-top: 0 !important;
    }
    .btn-primary, .btn-secondary {
        padding: 0.3rem 0.85rem;
        font-size: 0.82rem;
        height: 32px;
        border-radius: 0.5rem;
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }
    .game-over-title {
        font-size: 1.3rem;
        line-height: 1.1;
        margin-bottom: 0.1rem;
    }
    .final-score-text {
        font-size: 0.85rem;
        margin: 0.1rem 0;
    }
    .leaderboard-rank-text {
        font-size: 0.82rem;
        margin-bottom: 0.25rem;
    }
    .science-fact-box {
        padding: 0.35rem 0.6rem;
        max-width: 22rem;
        margin: 0.15rem auto;
        border-radius: 0.6rem;
    }
    .science-fact-title {
        font-size: 0.85rem;
        margin-bottom: 0.15rem;
    }
    .science-fact-text {
        font-size: 0.72rem;
        line-height: 1.2;
    }
    #game-over-modal .modal-footer-buttons {
        display: flex !important;
        flex-direction: row !important;
        gap: 0.4rem !important;
        width: auto !important;
    }
    #mainLeaderboardModal .modal-body,
    .how-to-card,
    .fact-card {
        max-height: 85vh;
        overflow-y: auto;
    }
    .how-to-card {
        max-width: 38rem;
        padding: 0.6rem 0.8rem;
        border-radius: 0.85rem;
    }
    .how-to-header-badge {
        font-size: 0.65rem;
        padding: 0.1rem 0.5rem;
    }
    .how-to-title {
        font-size: 1.15rem;
        margin: 0.2rem 0;
    }
    .tutorial-cards {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 0.35rem;
        margin-bottom: 0.35rem;
    }
    .tutorial-card {
        padding: 0.3rem 0.25rem;
        border-radius: 0.5rem;
        flex-direction: column;
        align-items: center;
        text-align: center;
        gap: 0.2rem;
    }
    .tutorial-step {
        width: 18px;
        height: 18px;
        font-size: 0.65rem;
    }
    .tutorial-step-img {
        width: 1.85rem;
        height: 1.85rem;
    }
    .tutorial-title {
        font-size: 0.68rem;
        margin-bottom: 0.1rem;
        line-height: 1.1;
    }
    .tutorial-desc {
        font-size: 0.58rem;
        line-height: 1.15;
    }
    .fact-card {
        max-width: 22rem;
        padding: 0.6rem 0.85rem;
        border-radius: 0.85rem;
    }
    .fact-header {
        margin-bottom: 0.25rem;
    }
    .fact-portrait {
        width: 2.85rem;
        height: 2.85rem;
        padding: 0.25rem;
        margin-bottom: 0.25rem;
    }
    .fact-title {
        font-size: 1.05rem;
        margin-bottom: 0.2rem;
    }
    .fact-text {
        font-size: 0.75rem;
        line-height: 1.25;
        margin-bottom: 0.4rem;
    }
    .fact-btn {
        padding: 0.3rem 1rem;
        font-size: 0.82rem;
        height: 30px;
    }
    .bin {
        padding: 0.2rem 0.15rem;
        border-radius: 0.5rem;
    }
    .bin-title {
        font-size: 0.72rem;
        margin-bottom: 0.1rem;
    }
    .bin-icon-box {
        width: 2.25rem;
        height: 2.25rem;
        padding: 0.2rem;
    }
    .bin-hint {
        font-size: 0.58rem;
        margin-top: 0.1rem;
    }
    .game-zones {
        font-size: 0.85rem;
        letter-spacing: 1px;
    }
    .divide-text {
        line-height: 1.2;
    }
    .cell {
        width: 44px;
        height: 44px;
    }
    .powerup {
        width: 38px;
        height: 38px;
    }
}

.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; }
