/*
  Project: THE MATH GAME
  Description: Vibrant Neon Math Theme with Custom BG
*/

@import url('https://fonts.googleapis.com/css2?family=Play:wght@400;700&display=swap');

:root {
    --primary: #a855f7;
    --primary-glow: rgba(168, 85, 247, 0.4);
    --secondary: #e9d5ff;
    --bg-dark: #1e1b4b;
    --accent: #f59e0b;
    --glass: rgba(59, 7, 100, 0.6);
    --glass-border: rgba(168, 85, 247, 0.3);
    --shadow: 0 0 20px rgba(0, 0, 0, 0.5);
    --transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    width: 100%;
    min-height: 100vh;
    /* Allow scroll if needed */
    font-family: 'Play', sans-serif;
    color: white;
    background-color: var(--bg-dark);
    background-image: url('../assets/bg.png');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
    /* Parallax-like effect ensures best fit */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0;
    overflow: hidden;
    /* Fix viewport for desktop */
}

@media (max-width: 768px) {
    body {
        overflow-y: auto;
        /* Restore scroll for mobile/tablets */
        padding: 20px 0;
        min-height: 100vh;
        background-position: center;
    }
}

.bg-overlay {
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at center, transparent 0%, rgba(30, 27, 75, 0.6) 100%);
    z-index: -1;
}

h1 {
    font-size: 3rem;
    /* Reduced from 3.5rem to save space */
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 4px;
    text-align: center;
    margin-bottom: 0.2rem;
    /* Tighter margin */
    margin-top: 0;
    color: white;
    text-shadow: 0 0 10px var(--primary), 0 0 20px var(--primary);
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from {
        text-shadow: 0 0 10px var(--primary), 0 0 20px var(--primary);
    }

    to {
        text-shadow: 0 0 15px var(--primary), 0 0 30px var(--primary), 0 0 5px white;
    }
}

#container {
    width: 95%;
    max-width: 700px;
    background: var(--glass);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 2px solid var(--glass-border);
    border-radius: 40px;
    padding: 0.5rem 1.5rem 0.5rem 1.5rem;
    /* Reduced top padding further */
    position: relative;
    box-shadow: var(--shadow), 0 0 40px rgba(168, 85, 247, 0.1);
    animation: slideUp 0.8s ease-out;
    display: flex;
    flex-direction: column;
    height: 90vh;
    /* Fixed height for desktop */
    max-height: 850px;
    /* Prevent it from getting too tall */
    min-height: 500px;
    margin: 0;
}

@keyframes slideUp {
    from {
        transform: translateY(50px);
        opacity: 0;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

#score {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 700;
    font-size: 1.2rem;
    display: block;
    /* Show Score items */
    text-shadow: 0 0 10px rgba(168, 85, 247, 0.5);
}

#score #scorevalue {
    color: #38bdf8;
    /* Blue for score number */
    font-weight: 800;
    text-shadow: 0 0 10px rgba(56, 189, 248, 0.5);
}

#missed #wrong-score {
    color: #f87171;
    /* Red for missed number */
    font-weight: 800;
    text-shadow: 0 0 10px rgba(248, 113, 113, 0.5);
}

#correct,
#wrong {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 2rem 4rem;
    border-radius: 20px;
    font-weight: 700;
    font-size: 2rem;
    z-index: 20;
    display: none;
    backdrop-filter: blur(10px);
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

#correct {
    background: rgba(34, 197, 94, 0.9);
    color: white;
}

#wrong {
    background: rgba(239, 68, 68, 0.9);
    color: white;
}

/* Premium HUD Question Display */
/* Premium Screen Wrapper */
#hud-screen {
    width: 100%;
    height: 170px;
    /* Reduced from 200px */
    min-height: 170px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid rgba(168, 85, 247, 0.3);
    border-radius: 30px;
    box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    margin-bottom: 1.15rem;
    /* Increased slightly for clear separation */
    /* Tightened to keep instruction close */
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 1rem;
    /* Slightly tighter padding */
    box-sizing: border-box;
    /* Prevent jitter during nested animations */
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}

/* Global HUD Scanline Overlay */
#hud-screen::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, transparent 50%, rgba(255, 255, 255, 0.02) 50%);
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 5;
    /* Ensure it overlays everything inside */
}

/* Global HUD Scanline Overlay */
#hud-screen::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, transparent 50%, rgba(255, 255, 255, 0.02) 50%);
    background-size: 100% 4px;
    pointer-events: none;
    z-index: 5;
    /* Ensure it overlays everything inside */
}

/* Header Row for Metrics */
#hud-metrics {
    width: 100%;
    display: none;
    justify-content: space-between;
    align-items: center;
    /* Better vertical alignment for metrics */
    margin-bottom: 0.5rem;
    /* Reduced to allow question to use full space */
    min-height: 30px;
}

/* The Question Text Itself */
#question {
    font-size: 2.5rem;
    /* Larger size to fill space */
    font-weight: 700;
    text-align: center;
    color: rgba(255, 255, 255, 0.9);
    text-shadow: 0 0 10px rgba(168, 85, 247, 0.5);
    letter-spacing: 1px;
    text-transform: uppercase;
    line-height: 1.3;
    /* Proper spacing for wrapped text */
    flex-grow: 1;
    padding: 0 2rem;
    /* Give it breathing room */
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin: 0;
    padding: 0;
}

/* Optional scanline effect overlay */
/* Scanline effect promoted to #hud-screen for global consistence */

#instruction {
    text-align: center;
    color: var(--secondary);
    font-size: 1.4rem;
    margin-bottom: 1.2rem;
    /* Standardized gap to choices */
    opacity: 0.8;
}

#choices {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.2rem;
    /* Standardized to match vertical spacing */
    margin-bottom: 1.2rem;
    /* Standardized gap to button */
    /* Standardized gap to button */
    padding: 0 1rem;
    flex-grow: 1;
}

/* Premium Floating Glass Keys */
.box {
    width: 100%;
    height: 100%;
    min-height: 80px;
    /* Reduced from 90px */
    max-height: 100px;
    /* Reduced from 110px */

    /* Glass Surface */
    background: linear-gradient(145deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0.05));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-top: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 18px;

    /* Layout & Type */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.8rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.9);
    cursor: pointer;

    /* Depth & Shadow */
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3),
        inset 0 0 10px rgba(255, 255, 255, 0.05);
    transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.box:hover {
    transform: translateY(-5px) scale(1.02);
    background: linear-gradient(145deg, rgba(168, 85, 247, 0.2), rgba(168, 85, 247, 0.1));
    border-color: var(--primary);
    box-shadow: 0 15px 30px rgba(168, 85, 247, 0.3),
        inset 0 0 20px rgba(168, 85, 247, 0.2);
    color: white;
    text-shadow: 0 0 10px var(--primary);
}

.box:active {
    transform: translateY(2px) scale(0.98);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
    background: rgba(168, 85, 247, 0.3);
}

#secret-hint {
    position: absolute;
    bottom: 10px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.3);
    letter-spacing: 2px;
    text-transform: uppercase;
    white-space: nowrap;
    pointer-events: none;
}

#bottom-deck {
    width: 100%;
    display: flex;
    gap: 1.2rem;
    /* Standardized gap */
    margin-bottom: 1.2rem;
    /* Spacing to footer */
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

#startreset,
#share-score-bottom {
    flex: 1;
    /* Twin buttons share equal width on Game Over */
    padding: 1.2rem;
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    color: white;
    font-size: 1.4rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    border-radius: 20px;
    cursor: pointer;
    border: none;
    box-shadow: 0 8px 20px var(--primary-glow);
    text-align: center;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

#share-score-bottom {
    display: none;
    /* Hidden until Game Over */
}

#startreset:hover,
#share-score-bottom:hover {
    transform: translateY(-5px) scale(1.02);
    background: linear-gradient(135deg, var(--primary), #7c3aed);
    filter: brightness(1.2);
    box-shadow: 0 15px 30px rgba(168, 85, 247, 0.3),
        inset 0 0 20px rgba(255, 255, 255, 0.2);
    color: white;
    text-shadow: 0 0 10px white;
}

#startreset:active,
#share-score-bottom:active {
    transform: translateY(2px) scale(0.98);
}

#share-score-bottom svg {
    width: 20px;
    height: 20px;
    fill: currentColor;
}

#timeremaining {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 700;
    font-size: 1.2rem;
    display: none;
    white-space: nowrap;
    text-shadow: 0 0 10px rgba(168, 85, 247, 0.5);
}

#timeremainingvalue {
    color: white;
    font-weight: 700;
    text-shadow: 0 0 10px var(--primary);
}

#gameOver {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    /* No background - keeps HUD visible */
    border-radius: 30px;
    z-index: 50;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

#gameOver p:first-child {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 1rem;
    color: #ef4444;
    /* High-Visibility Red */
    text-shadow: 0 0 20px rgba(239, 68, 68, 0.5);
    text-transform: uppercase;
    letter-spacing: 2px;
    animation: hudScaleIn 0.4s ease-out forwards;
}

#gameOver p:nth-child(2) {
    animation: hudScaleIn 0.4s ease-out 0.15s forwards;
    opacity: 0;
}

#gameOver p:last-child {
    font-size: 1.8rem;
    color: white;
    text-transform: uppercase;
    letter-spacing: 1px;
    opacity: 0;
    animation: hudScaleIn 0.4s ease-out 0.3s forwards;
}

/* HUD-style scale-in animation */
@keyframes hudScaleIn {
    0% {
        opacity: 0;
        transform: scale(0.5);
        filter: blur(10px);
    }

    70% {
        opacity: 1;
        transform: scale(1.05);
        filter: blur(0);
    }

    100% {
        opacity: 1;
        transform: scale(1);
        filter: blur(0);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}



/* The Commutative Singularity Footer */
.footer.event-horizon {
    width: 100%;
    text-align: center;
    margin-top: auto;
    padding: 0 2rem 1.2rem 2rem;
    /* Standardized bottom padding */
    /* Reduced top padding to balance new margin */
    position: relative;
    perspective: 1200px;
    z-index: 10;
    overflow: visible;
}

.footer h3 {
    font-family: 'Play', sans-serif;
    font-size: 1rem;
    /* Reduced to fit on one line */
    color: #38bdf8;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: nowrap;
    gap: 15px;
    /* Reduced gap to prevent wrapping */
    transform-style: preserve-3d;
    white-space: nowrap;
    /* Strictly enforce single line */
}

.creator-link {
    color: #38bdf8;
    text-decoration: none;
    font-weight: 700;
    padding: 12px 24px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    display: inline-block;
}

.creator-link:hover {
    background: rgba(168, 85, 247, 0.15);
    border-color: #a855f7;
    box-shadow: 0 0 30px rgba(168, 85, 247, 0.3);
    z-index: 50;
}

.multiplier-core.singularity {
    font-size: 2.5rem;
    font-weight: 900;
    color: #ff00ff;
    text-shadow: 0 0 20px #ff00ff, 0 0 5px white;
    display: inline-block;
    cursor: pointer;
    user-select: none;
    z-index: 100;
    transition: all 0.6s cubic-bezier(0.19, 1, 0.22, 1);
    animation: periodic-spin 6s linear infinite;
    /* Noticeable idle rotation */
}

/* 3D Slingshot - Refined Physics */
.node-a.tunneling {
    animation: slingshot-left 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.node-b.tunneling {
    animation: slingshot-right 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes slingshot-left {
    0% {
        transform: translateX(0) translateZ(0);
        opacity: 1;
        filter: blur(0);
    }

    45% {
        transform: translateX(120px) translateZ(-300px) scale(0.1);
        opacity: 0.4;
        filter: blur(4px);
    }

    55% {
        transform: translateX(-120px) translateZ(-300px) scale(0.1);
        opacity: 0.4;
    }

    100% {
        transform: translateX(0) translateZ(0) scale(1);
        opacity: 1;
        filter: blur(0);
    }
}

@keyframes slingshot-right {
    0% {
        transform: translateX(0) translateZ(0);
        opacity: 1;
        filter: blur(0);
    }

    45% {
        transform: translateX(-120px) translateZ(-300px) scale(0.1);
        opacity: 0.4;
        filter: blur(4px);
    }

    55% {
        transform: translateX(120px) translateZ(-300px) scale(0.1);
        opacity: 0.4;
    }

    100% {
        transform: translateX(0) translateZ(0) scale(1);
        opacity: 1;
        filter: blur(0);
    }
}

.singularity.active {
    transform: scale(1.6) rotate(1080deg);
    color: white;
    text-shadow: 0 0 40px #38bdf8, 0 0 15px #ff00ff;
}

/* Math Atmosphere - Background Drifting Symbols */
#math-atmosphere {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.math-symbol {
    position: absolute;
    color: #38bdf8;
    opacity: 0;
    font-weight: 900;
    font-size: 1.5rem;
    filter: blur(1px);
    animation: atmosphere-drift 15s linear forwards;
    user-select: none;
}

@keyframes atmosphere-drift {
    0% {
        transform: translateY(100vh) rotate(0deg);
        opacity: 0;
    }

    20% {
        opacity: 0.15;
    }

    80% {
        opacity: 0.15;
    }

    100% {
        transform: translateY(-10vh) rotate(360deg);
        opacity: 0;
    }
}

.footer-separator,
.footer-year {
    opacity: 0.6;
    margin-left: 10px;
}

/* Timer Warning Animation */
.timer-warning {
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
}

.timer-warning #timeremainingvalue,
.timer-warning #timer-unit {
    color: #f87171 !important;
    /* Red Text */
    text-shadow: 0 0 20px;
}

/* Countdown Animation Class */
#question span.hud-animate {
    display: inline-block;
    animation: count-pulse 0.6s ease-out forwards;
    font-size: 8rem !important;
    color: white !important;
    will-change: transform, opacity;
}

@keyframes count-pulse {
    0% {
        transform: scale(0.5);
        opacity: 0;
    }

    50% {
        transform: scale(1.2);
        opacity: 1;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

/* Missed Counter (Symmetrical to Score) */
#missed {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 700;
    font-size: 1.2rem;
    display: block;
    /* Show missed items */
    text-shadow: 0 0 10px rgba(168, 85, 247, 0.5);
}

/* =========================================
   FEEDBACK MESSAGES (Correct / Wrong)
   ========================================= */
#correct,
#wrong {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    padding: 1.5rem 3rem;
    font-size: 2rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 2px;
    border-radius: 16px;
    display: none;
    z-index: 100;
    animation: feedbackPop 0.3s ease-out;
}

#correct {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.9), rgba(22, 163, 74, 0.9));
    color: white;
    box-shadow: 0 0 30px rgba(34, 197, 94, 0.5);
    border: 2px solid rgba(34, 197, 94, 0.8);
}

#wrong {
    background: linear-gradient(135deg, rgba(239, 68, 68, 0.9), rgba(220, 38, 38, 0.9));
    color: white;
    box-shadow: 0 0 30px rgba(239, 68, 68, 0.5);
    border: 2px solid rgba(239, 68, 68, 0.8);
}

@keyframes feedbackPop {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }

    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

@keyframes periodic-spin {
    0% {
        transform: scale(1) rotate(0deg);
    }

    85% {
        transform: scale(1) rotate(0deg);
    }

    90% {
        transform: scale(1.2) rotate(180deg);
    }

    95% {
        transform: scale(1.2) rotate(360deg);
    }

    100% {
        transform: scale(1) rotate(360deg);
    }
}

/* The Masterpiece Share Card (Math Sprint Style) */
#share-card {
    width: 500px;
    padding: 50px;
    background: linear-gradient(135deg, #0f0a1e 0%, #1a0a2e 50%, #0d1528 100%);
    color: white;
    border-radius: 40px;
    font-family: 'Play', sans-serif;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 3px solid var(--primary);
    box-shadow: 0 0 50px rgba(168, 85, 247, 0.4);
    position: relative;
    overflow: hidden;
}

/* Subtle Mathematical Watermark Background */
.share-watermark-bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
    pointer-events: none;
    overflow: hidden;
}

.watermark-symbol {
    position: absolute;
    font-size: 120px;
    font-weight: 900;
    color: rgba(168, 85, 247, 0.2);
    /* Increased visibility for dark theme */
    pointer-events: none;
    user-select: none;
}

.watermark-symbol.plus {
    top: -20px;
    left: -20px;
    transform: rotate(-15deg);
}

.watermark-symbol.divide {
    top: 40px;
    right: -30px;
    transform: rotate(20deg);
    font-size: 140px;
}

.watermark-symbol.times {
    bottom: 100px;
    left: -40px;
    transform: rotate(10deg);
    font-size: 160px;
    color: rgba(168, 85, 247, 0.15);
}

.watermark-symbol.minus {
    bottom: -30px;
    right: 20px;
    transform: rotate(-10deg);
}

.watermark-symbol.equals {
    top: 45%;
    left: 40%;
    opacity: 0.1;
    font-size: 180px;
    transform: translate(-50%, -50%) rotate(45deg);
}

.share-content {
    position: relative;
    z-index: 2;
    width: 100%;
}

.share-header-group {
    margin-bottom: 35px;
}

.share-header {
    font-size: 36px;
    font-weight: 800;
    color: white;
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-bottom: 5px;
    text-shadow: 0 0 10px var(--primary);
}

.share-slogan {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 700;
    letter-spacing: 1px;
}

.share-score-container {
    background: rgba(168, 85, 247, 0.1);
    border: 2px solid rgba(168, 85, 247, 0.3);
    padding: 40px 20px;
    border-radius: 30px;
    width: 100%;
    margin-bottom: 30px;
    box-shadow: inset 0 0 20px rgba(168, 85, 247, 0.2);
}

.share-score-label {
    font-size: 12px;
    color: var(--secondary);
    text-transform: uppercase;
    letter-spacing: 3px;
    font-weight: 800;
    margin-bottom: 10px;
}

.share-value {
    font-size: 85px;
    font-weight: 900;
    color: #38bdf8;
    line-height: 1;
    text-shadow: 0 0 20px rgba(56, 189, 248, 0.5);
}

.share-stat-value {
    font-size: 32px;
    font-weight: 800;
    color: white;
}

.share-body {
    width: 100%;
    display: flex;
    justify-content: center;
    margin-bottom: 40px;
}

.share-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 8px;
    font-weight: 700;
}

.share-authorship {
    width: 100%;
    padding-top: 30px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.share-authorship-label {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 3px;
    margin-bottom: 25px;
    font-weight: 700;
}

.share-badge-container {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 35px;
}

.share-badge {
    padding: 12px 28px;
    background: #7c3aed;
    color: white;
    border-radius: 12px;
    font-weight: 800;
    font-size: 16px;
    box-shadow: 0 10px 20px rgba(124, 58, 237, 0.2);
}

.share-hmi-label {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.4);
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.share-project-name {
    font-size: 16px;
    color: var(--primary);
    font-weight: 900;
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 15px;
    text-shadow: 0 0 10px rgba(168, 85, 247, 0.5);
}

.share-project-link {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    font-family: monospace;
    font-weight: 700;
}

@keyframes feedbackPop {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }

    100% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
}

/* Responsive Scaling for Mobile & Tablets */
@media (max-width: 768px) {
    h1 {
        font-size: 2.8rem;
    }

    #container {
        padding: 1rem;
        /* Tighter padding on desktop/tablet */
        height: auto;
        min-height: auto;
        max-height: none;
        /* Remove height limit for mobile */
        margin: 1rem auto;
        /* Centered on mobile */
    }

    /* Ensure footer wraps on smaller screens */
    .footer h3 {
        flex-wrap: wrap;
        white-space: normal;
        gap: 10px;
        line-height: 1.6;
    }

    .footer-separator {
        display: none;
        /* Hide separator when wrapping might occur */
    }

    #hud-screen {
        height: auto;
        /* Allow height to grow with wrapped content */
        min-height: 180px;
        padding: 1rem;
        display: flex;
        flex-direction: column;
    }

    #hud-metrics {
        flex-wrap: wrap;
        gap: 5px;
        margin-bottom: 0.5rem;
    }

    #missed {
        order: 1;
        width: 50%;
        text-align: left;
        font-size: 1rem;
    }

    #score {
        order: 2;
        width: 50%;
        text-align: right;
        font-size: 1rem;
    }

    #timeremaining {
        order: 3;
        width: 100%;
        text-align: center;
        margin-top: 5px;
        font-size: 1rem;
    }

    #question {
        font-size: 2rem;
        margin-top: 0.5rem;
    }
}

@media (max-width: 480px) {
    h1 {
        font-size: 2rem;
        letter-spacing: 2px;
    }

    #hud-screen {
        height: auto;
        /* Allow height to grow */
        min-height: 170px;
        margin-bottom: 1.5rem;
    }

    #question {
        font-size: 1.8rem;
    }

    #instruction {
        font-size: 1.1rem;
        margin-bottom: 1.5rem;
    }

    #choices {
        gap: 0.6rem;
        margin-bottom: 1.5rem;
    }

    .box {
        min-height: 70px;
        font-size: 2rem;
    }

    #bottom-deck {
        gap: 10px;
        align-items: stretch;
        /* Ensure buttons match height */
    }

    #startreset,
    #share-score-bottom {
        padding: 1rem;
        font-size: 1.1rem;
        border-radius: 15px;
        display: flex;
        align-items: center;
        justify-content: center;
        /* Ensure consistent height */
        min-height: 3.5rem;
    }

    /* Footer Responsive Wrap */
    .footer h3 {
        flex-wrap: wrap;
        white-space: normal;
        font-size: 0.9rem;
        gap: 10px;
        justify-content: center;
        width: 100%;
        line-height: 1.6;
    }

    .creator-link {
        padding: 8px 16px;
        font-size: 0.85rem;
    }

    .footer-separator {
        display: none;
    }
}

/* Tiny Device Optimization (e.g. iPhone SE) */
@media (max-width: 360px) {
    h1 {
        font-size: 1.8rem;
    }

    #question {
        font-size: 1.5rem;
    }

    .box {
        min-height: 60px;
        font-size: 1.8rem;
    }

    #container {
        padding: 0.8rem;
    }
}