/* ============================================
   SLICE EDU - Educational Game
   Responsive Design for All Screen Sizes
   ============================================ */

:root {
    /* Base scaling - adjust based on viewport */
    --scale: min(1vw, 1vh);
    --font-scale: clamp(12px, 1.2vw, 18px);
}

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

html,
body {
    font-family: 'Nunito', 'Segoe UI', sans-serif;
    font-size: var(--font-scale);
    overflow: hidden;
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    touch-action: none;
}

/* ============ SCREEN SYSTEM ============ */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ============ MENU SCREEN ============ */
.menu-screen {
    background:
        linear-gradient(135deg, rgba(26, 26, 46, 0.85) 0%, rgba(22, 33, 62, 0.85) 25%, rgba(15, 52, 96, 0.85) 50%, rgba(26, 26, 46, 0.85) 75%, rgba(45, 45, 68, 0.85) 100%),
        url('bg.png') center center / cover no-repeat fixed;
    background-size: 400% 400%, cover;
    animation: gradientBG 15s ease infinite;
}

@keyframes gradientBG {
    0% {
        background-position: 0% 50%;
    }

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

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

.menu-container {
    text-align: center;
    z-index: 10;
    padding: clamp(10px, 2vh, 30px);
    margin-bottom: clamp(40px, 8vh, 100px);
}

/* ============ FOOTER ============ */
.main-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: clamp(2px, 0.5vh, 6px);
    padding: clamp(8px, 1.5vh, 15px);
}

.footer-copyright {
    font-family: 'Georgia', 'Times New Roman', serif;
    font-size: clamp(0.7rem, 1vw, 0.9rem);
    color: #FFD700;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
    letter-spacing: 1px;
}

.footer-created {
    font-family: 'Nunito', sans-serif;
    font-size: clamp(0.65rem, 0.9vw, 0.85rem);
    color: rgba(255, 255, 255, 0.8);
    font-weight: 600;
}


/* ============ GAME TITLE ============ */
.game-title-img {
    max-width: clamp(200px, 40vw, 500px);
    max-height: 15vh;
    width: auto;
    height: auto;
    object-fit: contain;
    margin-bottom: clamp(10px, 1.5vh, 20px);
    animation: floatTitle 3s ease-in-out infinite;
    filter: drop-shadow(0 10px 30px rgba(102, 126, 234, 0.5));
}

@keyframes floatTitle {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

.subtitle {
    font-size: clamp(1rem, 1.5vw, 1.5rem);
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    margin-bottom: clamp(15px, 3vh, 40px);
}

.section-title {
    font-size: clamp(1.2rem, 1.8vw, 2rem);
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    margin-bottom: clamp(10px, 2vh, 25px);
}

.screen-title {
    font-size: clamp(1.5rem, 2.5vw, 3rem);
    color: white;
    text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.3);
    margin-bottom: clamp(5px, 1vh, 15px);
}

/* ============ 3D BUTTONS ============ */
.button-group {
    display: flex;
    gap: clamp(10px, 2vw, 25px);
    justify-content: center;
    flex-wrap: wrap;
}

/* Make menu buttons equal width */
.menu-section .button-group .btn-3d {
    flex: 1;
    min-width: clamp(140px, 18vw, 220px);
    max-width: clamp(180px, 22vw, 280px);
}


.button-group.vertical {
    flex-direction: column;
    align-items: center;
}

.btn-3d {
    position: relative;
    padding: clamp(15px, 2.5vh, 35px) clamp(25px, 4vw, 60px);
    border: none;
    border-radius: clamp(15px, 2vw, 30px);
    cursor: pointer;
    font-family: inherit;
    text-align: center;
    transition: all 0.15s ease;
    min-width: clamp(150px, 15vw, 250px);
    transform: translateY(0);
    box-shadow:
        0 6px 0 rgba(0, 0, 0, 0.3),
        0 8px 20px rgba(0, 0, 0, 0.2);
}

.btn-3d:hover {
    transform: translateY(-3px);
    box-shadow:
        0 9px 0 rgba(0, 0, 0, 0.3),
        0 12px 25px rgba(0, 0, 0, 0.25);
}

.btn-3d:active {
    transform: translateY(4px);
    box-shadow:
        0 2px 0 rgba(0, 0, 0, 0.3),
        0 4px 10px rgba(0, 0, 0, 0.2);
}

.btn-3d.large {
    padding: clamp(20px, 3vh, 40px) clamp(40px, 5vw, 80px);
    min-width: clamp(250px, 25vw, 400px);
    width: clamp(250px, 25vw, 400px);
}

/* Button Colors */
.btn-red {
    background: linear-gradient(180deg, #FF6B6B 0%, #EE5A5A 100%);
    box-shadow: 0 6px 0 #CC4444, 0 8px 20px rgba(0, 0, 0, 0.2);
}

.btn-red:hover {
    box-shadow: 0 9px 0 #CC4444, 0 12px 25px rgba(0, 0, 0, 0.25);
}

.btn-red:active {
    box-shadow: 0 2px 0 #CC4444, 0 4px 10px rgba(0, 0, 0, 0.2);
}

.btn-green {
    background: linear-gradient(180deg, #26de81 0%, #20c997 100%);
    box-shadow: 0 6px 0 #1BA872, 0 8px 20px rgba(0, 0, 0, 0.2);
}

.btn-green:hover {
    box-shadow: 0 9px 0 #1BA872, 0 12px 25px rgba(0, 0, 0, 0.25);
}

.btn-green:active {
    box-shadow: 0 2px 0 #1BA872, 0 4px 10px rgba(0, 0, 0, 0.2);
}

.btn-blue {
    background: linear-gradient(180deg, #4ECDC4 0%, #44A3AA 100%);
    box-shadow: 0 6px 0 #3A8A8F, 0 8px 20px rgba(0, 0, 0, 0.2);
}

.btn-blue:hover {
    box-shadow: 0 9px 0 #3A8A8F, 0 12px 25px rgba(0, 0, 0, 0.25);
}

.btn-blue:active {
    box-shadow: 0 2px 0 #3A8A8F, 0 4px 10px rgba(0, 0, 0, 0.2);
}

.btn-purple {
    background: linear-gradient(180deg, #A55EEA 0%, #8854D0 100%);
    box-shadow: 0 6px 0 #6C44A8, 0 8px 20px rgba(0, 0, 0, 0.2);
}

.btn-purple:hover {
    box-shadow: 0 9px 0 #6C44A8, 0 12px 25px rgba(0, 0, 0, 0.25);
}

.btn-purple:active {
    box-shadow: 0 2px 0 #6C44A8, 0 4px 10px rgba(0, 0, 0, 0.2);
}

.btn-orange {
    background: linear-gradient(180deg, #FFA502 0%, #E59400 100%);
    box-shadow: 0 6px 0 #CC8400, 0 8px 20px rgba(0, 0, 0, 0.2);
}

.btn-orange:hover {
    box-shadow: 0 9px 0 #CC8400, 0 12px 25px rgba(0, 0, 0, 0.25);
}

.btn-orange:active {
    box-shadow: 0 2px 0 #CC8400, 0 4px 10px rgba(0, 0, 0, 0.2);
}

/* Button Content - Responsive */
.btn-icon {
    display: block;
    font-size: clamp(1.5rem, 2.5vw, 3rem);
    margin-bottom: clamp(3px, 0.5vh, 10px);
}

.btn-text {
    display: block;
    font-size: clamp(1rem, 1.5vw, 2rem);
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 3px rgba(0, 0, 0, 0.3);
}

.btn-desc {
    display: block;
    font-size: clamp(0.7rem, 1vw, 1.1rem);
    color: rgba(255, 255, 255, 0.9);
    margin-top: clamp(3px, 0.5vh, 10px);
    white-space: nowrap;
}


/* Footer */
.main-footer {
    position: fixed;
    bottom: clamp(10px, 2vh, 30px);
    left: 0;
    right: 0;
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
    font-size: clamp(0.8rem, 1.2vw, 1.4rem);
    line-height: 1.6;
    z-index: 100;
    font-weight: 500;
}

/* ============ BACK BUTTON ============ */
.btn-back {
    position: absolute;
    top: clamp(10px, 2vh, 25px);
    left: clamp(10px, 2vw, 25px);
    padding: clamp(6px, 1vh, 12px) clamp(15px, 2vw, 30px);
    font-size: clamp(0.8rem, 1.1vw, 1.2rem);
    font-weight: bold;
    color: white;
    background: rgba(0, 0, 0, 0.3);
    border: 2px solid white;
    border-radius: 30px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-back:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateX(-5px);
}

/* ============ MODE BADGE ============ */
.mode-badge {
    display: inline-block;
    padding: clamp(6px, 1vh, 12px) clamp(15px, 2vw, 35px);
    background: rgba(0, 0, 0, 0.3);
    border-radius: 30px;
    color: white;
    font-size: clamp(0.9rem, 1.2vw, 1.3rem);
    margin-bottom: clamp(15px, 3vh, 40px);
}

/* ============ GAME TYPE SCREEN ============ */
.game-type-screen {
    background:
        linear-gradient(135deg, rgba(102, 126, 234, 0.85) 0%, rgba(118, 75, 162, 0.85) 50%, rgba(240, 147, 251, 0.85) 100%),
        url('bg.png') center center / cover no-repeat fixed;
}

/* ============ LEVEL SCREEN ============ */
.level-screen {
    background:
        linear-gradient(135deg, rgba(17, 153, 142, 0.85) 0%, rgba(56, 239, 125, 0.85) 100%),
        url('bg.png') center center / cover no-repeat fixed;
}

.level-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(clamp(140px, 15vw, 220px), 1fr));
    gap: clamp(10px, 1.5vw, 25px);
    max-width: min(900px, 90vw);
    margin: 0 auto;
    padding: clamp(10px, 2vw, 25px);
}

.level-btn {
    padding: clamp(15px, 2vh, 30px);
    border: none;
    border-radius: clamp(12px, 1.5vw, 25px);
    cursor: pointer;
    text-align: center;
    transition: all 0.2s;
    background: white;
    box-shadow: 0 5px 0 rgba(0, 0, 0, 0.2), 0 8px 20px rgba(0, 0, 0, 0.1);
}

.level-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 0 rgba(0, 0, 0, 0.2), 0 15px 30px rgba(0, 0, 0, 0.15);
}

.level-btn:active {
    transform: translateY(3px);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2);
}

.level-number {
    display: block;
    font-size: clamp(1.5rem, 2.5vw, 3rem);
    font-weight: bold;
    color: #667eea;
    margin-bottom: clamp(3px, 0.5vh, 8px);
}

.level-name {
    display: block;
    font-size: clamp(0.8rem, 1.1vw, 1.2rem);
    font-weight: bold;
    color: #333;
}

/* ============ GAME SCREEN ============ */
.game-screen {
    background:
        linear-gradient(135deg, rgba(26, 26, 46, 0.7) 0%, rgba(22, 33, 62, 0.7) 100%),
        url('bg.png') center center / cover no-repeat fixed;
    flex-direction: column;
    padding: 0;
}

/* Game Header - Compact & Responsive */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: clamp(3px, 0.5vh, 8px) clamp(8px, 1.5vw, 20px);
    background: linear-gradient(180deg, rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0.3) 100%);
    width: 100%;
    flex-shrink: 0;
    max-height: 8vh;
}

/* Player Stats - Compact */
.player-stats {
    display: flex;
    align-items: center;
    padding: clamp(3px, 0.5vh, 8px) clamp(8px, 1vw, 15px);
    border-radius: clamp(15px, 2vw, 30px);
    gap: clamp(6px, 1vw, 15px);
}

.p1-stats {
    background: linear-gradient(135deg, #C0392B, #E74C3C);
    border: 2px solid #FF6B6B;
    box-shadow: 0 0 10px rgba(255, 100, 100, 0.4);
}

.p2-stats {
    background: linear-gradient(135deg, #1E8449, #27AE60);
    border: 2px solid #58D68D;
    box-shadow: 0 0 10px rgba(100, 255, 100, 0.4);
}

.player-stats .player-label {
    font-size: clamp(0.7rem, 1vw, 1.1rem);
    color: white;
    font-weight: bold;
}

.stat-item {
    display: flex;
    align-items: center;
    gap: 2px;
    color: white;
    font-size: clamp(0.7rem, 1vw, 1.2rem);
}

.stat-item b {
    font-size: clamp(0.8rem, 1.2vw, 1.4rem);
    min-width: 18px;
    text-align: center;
}

.header-left,
.header-right {
    display: flex;
    align-items: center;
    gap: clamp(8px, 1.5vw, 20px);
    flex: 0 0 auto;
}

.header-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: clamp(2px, 0.3vh, 6px);
    flex: 1;
}

.header-info {
    display: flex;
    align-items: center;
    gap: clamp(10px, 2vw, 25px);
}

.header-title-img {
    height: clamp(20px, 3vh, 40px);
    width: auto;
    object-fit: contain;
}

.wave-display {
    font-size: clamp(0.7rem, 1vw, 1.3rem);
    color: white;
    font-weight: bold;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: clamp(2px, 0.4vh, 6px) clamp(8px, 1.2vw, 18px);
    border-radius: 15px;
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.5);
}

.timer-display {
    font-size: clamp(0.8rem, 1.2vw, 1.5rem);
    color: white;
    font-weight: bold;
    background: rgba(0, 0, 0, 0.4);
    padding: clamp(2px, 0.4vh, 6px) clamp(10px, 1.5vw, 25px);
    border-radius: 20px;
}

.timer-display b {
    color: #FFD700;
    font-size: 1.1em;
}

/* Wave Notification Animation */
@keyframes waveNotify {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }

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

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

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

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

/* Game Container */
.game-container {
    flex: 1;
    display: flex;
    align-items: stretch;
    justify-content: center;
    width: 100%;
    height: 100%;
    min-height: 0;
    background: transparent;
    overflow: hidden;
    position: relative;
}

#gameCanvas {
    width: 100%;
    height: 100%;
    display: block;
    background: transparent;
    cursor: crosshair;
    touch-action: none;
}

/* Split Divider for Duel Mode */
.split-divider {
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 10;
}

.divider-line {
    width: 3px;
    flex: 1;
    background: linear-gradient(180deg,
            rgba(255, 255, 255, 0) 0%,
            rgba(255, 255, 255, 0.5) 20%,
            rgba(255, 255, 255, 0.5) 80%,
            rgba(255, 255, 255, 0) 100%);
}

.divider-text {
    background: linear-gradient(135deg, #FFD700, #FFA500);
    color: #1a1a2e;
    padding: clamp(8px, 1.5vh, 18px) clamp(12px, 2vw, 28px);
    border-radius: 50%;
    font-size: clamp(1rem, 1.5vw, 1.8rem);
    font-weight: bold;
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
    animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.6);
    }

    50% {
        transform: scale(1.1);
        box-shadow: 0 0 35px rgba(255, 215, 0, 0.8);
    }
}

/* Player Zone Labels */
.player-zone {
    position: absolute;
    bottom: clamp(10px, 2vh, 25px);
    padding: clamp(5px, 1vh, 12px) clamp(12px, 2vw, 28px);
    border-radius: 20px;
    font-size: clamp(0.8rem, 1.2vw, 1.4rem);
    font-weight: bold;
    color: white;
    pointer-events: none;
    z-index: 5;
}

.p1-zone {
    left: clamp(10px, 2vw, 25px);
    background: linear-gradient(135deg, rgba(255, 100, 100, 0.8), rgba(200, 50, 50, 0.8));
    box-shadow: 0 0 15px rgba(255, 100, 100, 0.5);
}

.p2-zone {
    right: clamp(10px, 2vw, 25px);
    background: linear-gradient(135deg, rgba(100, 255, 100, 0.8), rgba(50, 200, 50, 0.8));
    box-shadow: 0 0 15px rgba(100, 255, 100, 0.5);
}

/* Question Panel - Compact */
.question-panel {
    display: flex;
    justify-content: center;
    gap: clamp(5px, 1vw, 12px);
    padding: clamp(4px, 0.6vh, 10px) clamp(8px, 1.5vw, 18px);
    background: transparent;
    flex-shrink: 0;
    max-height: 7vh;
}

.question-box {
    padding: clamp(5px, 0.8vh, 12px) clamp(10px, 1.5vw, 25px);
    background: linear-gradient(135deg, #3498DB, #2980B9);
    border-radius: clamp(8px, 1vw, 15px);
    text-align: center;
    border: 2px solid #5DADE2;
    box-shadow: 0 2px 0 #1A5276, 0 0 10px rgba(52, 152, 219, 0.3);
    font-size: clamp(0.8rem, 1.2vw, 1.4rem);
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
    white-space: nowrap;
    transition: all 0.3s ease;
}

.question-box.flash-correct {
    animation: flashGreen 0.8s ease-out;
    background: linear-gradient(135deg, #2ECC71, #27AE60);
    border-color: #58D68D;
    box-shadow: 0 0 20px #2ECC71, 0 2px 0 #145A32;
    transform: scale(1.1);
}

@keyframes flashGreen {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 rgba(46, 204, 113, 0);
    }

    30% {
        transform: scale(1.15);
        box-shadow: 0 0 30px rgba(46, 204, 113, 0.8);
    }

    100% {
        transform: scale(1);
        box-shadow: 0 0 0 rgba(46, 204, 113, 0);
    }
}

/* Game Controls - Compact Footer */
.game-controls {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: clamp(3px, 0.5vh, 10px) clamp(10px, 2vw, 25px);
    background: transparent;
    flex-shrink: 0;
    width: 100%;
    max-height: 6vh;
}

.footer-left,
.footer-right {
    color: rgba(255, 255, 255, 0.6);
    font-size: clamp(0.6rem, 0.9vw, 1rem);
    white-space: nowrap;
}

.controls-center {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: clamp(8px, 1.5vw, 18px);
}

.btn-control {
    padding: clamp(5px, 0.8vh, 12px) clamp(12px, 2vw, 28px);
    font-size: clamp(0.7rem, 1vw, 1.1rem);
    font-weight: bold;
    color: white;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid white;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-control:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.05);
}

.btn-exit {
    background: rgba(255, 100, 100, 0.3);
    border-color: #FF6B6B;
}

/* ============ RESULT SCREEN ============ */
.result-screen {
    background:
        linear-gradient(135deg, rgba(102, 126, 234, 0.85) 0%, rgba(118, 75, 162, 0.85) 100%),
        url('bg.png') center center / cover no-repeat fixed;
}

.result-container {
    text-align: center;
    padding: clamp(10px, 2vh, 25px) clamp(15px, 2.5vw, 30px);
    background: rgba(255, 255, 255, 0.1);
    border-radius: clamp(12px, 2vw, 25px);
    backdrop-filter: blur(10px);
    max-width: 90vw;
}

.result-crown {
    font-size: clamp(2rem, 4vw, 4rem);
    animation: bounce 1s ease infinite;
    margin-bottom: -5px;
}

@keyframes bounce {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-8px);
    }
}

.result-title {
    font-size: clamp(1.3rem, 2.5vw, 2.5rem);
    color: #FFD700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    margin: clamp(3px, 0.5vh, 10px) 0 clamp(8px, 1.5vh, 20px);
    line-height: 1.3;
}

/* Subtitle for "Kehabisan Nyawa" message */
.result-sub {
    display: block;
    font-size: clamp(0.8rem, 1.3vw, 1.3rem);
    color: rgba(255, 255, 255, 0.9);
    font-weight: normal;
    margin-top: 5px;
}

.result-scores {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: clamp(10px, 2vw, 25px);
    margin-bottom: clamp(8px, 1.5vh, 20px);
}

.result-player {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: clamp(8px, 1.5vh, 20px) clamp(18px, 3vw, 45px);
    border-radius: clamp(10px, 1.5vw, 20px);
    min-width: clamp(80px, 10vw, 150px);
}

.result-player.p1 {
    background: linear-gradient(135deg, #FF6B6B, #EE5A5A);
    box-shadow: 0 0 15px rgba(255, 100, 100, 0.5);
}

.result-player.p2 {
    background: linear-gradient(135deg, #26de81, #20c997);
    box-shadow: 0 0 15px rgba(100, 255, 100, 0.5);
}

.result-label {
    font-size: clamp(0.8rem, 1.2vw, 1.3rem);
    color: white;
    margin-bottom: clamp(2px, 0.5vh, 6px);
    white-space: nowrap;
}

.result-points {
    font-size: clamp(2rem, 3.5vw, 4rem);
    color: white;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    line-height: 1;
}

.result-vs {
    font-size: clamp(1rem, 1.5vw, 1.8rem);
    color: white;
    font-weight: bold;
}

.result-stats {
    color: white;
    font-size: clamp(0.75rem, 1vw, 1rem);
    margin-bottom: clamp(8px, 1.5vh, 20px);
}

.result-subtitle {
    font-size: clamp(0.85rem, 1.1vw, 1.2rem);
    margin-bottom: clamp(5px, 1vh, 12px);
    color: #FFD700;
    font-weight: bold;
}

.result-table {
    width: 100%;
    max-width: min(300px, 75vw);
    margin: 0 auto;
    border-collapse: collapse;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    overflow: hidden;
}

.result-table th,
.result-table td {
    padding: clamp(4px, 0.6vh, 8px) clamp(8px, 1vw, 14px);
    text-align: center;
}

.result-table th {
    background: rgba(0, 0, 0, 0.3);
    font-size: clamp(0.7rem, 0.9vw, 1rem);
}

.result-table tr:nth-child(even) {
    background: rgba(255, 255, 255, 0.05);
}

.result-table td:first-child {
    text-align: left;
    font-weight: bold;
}

.result-table td:nth-child(2) {
    color: #FF6B6B;
    font-weight: bold;
    font-size: 1.1em;
}

.result-table td:nth-child(3) {
    color: #58D68D;
    font-weight: bold;
    font-size: 1.1em;
}

.result-buttons {
    display: flex;
    gap: clamp(6px, 1vw, 12px);
    justify-content: center;
    flex-wrap: wrap;
}

.result-buttons .btn-3d {
    padding: clamp(8px, 1.2vh, 14px) clamp(14px, 2vw, 28px);
}

.result-buttons .btn-icon {
    font-size: clamp(0.9rem, 1.3vw, 1.5rem);
    margin-bottom: 2px;
}

.result-buttons .btn-text {
    font-size: clamp(0.7rem, 1vw, 1.1rem);
}

/* ============ SETTINGS BUTTON (Small) ============ */
.btn-settings {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    color: white;
    border: none;
    padding: 8px 20px;
    border-radius: 20px;
    font-size: clamp(0.8rem, 1vw, 1rem);
    font-weight: bold;
    cursor: pointer;
    margin-top: 15px;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
    transition: all 0.2s;
}

.btn-settings:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
}

/* ============ SETTINGS SCREEN (Compact) ============ */
.settings-screen {
    background:
        linear-gradient(135deg, rgba(44, 62, 80, 0.85) 0%, rgba(76, 161, 175, 0.85) 100%),
        url('bg.png') center center / cover no-repeat fixed;
}

.settings-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}

.btn-back-float {
    background: rgba(0, 0, 0, 0.3);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
    padding: 8px 16px;
    border-radius: 20px;
    font-size: clamp(0.8rem, 1vw, 0.95rem);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-back-float:hover {
    background: rgba(0, 0, 0, 0.5);
    transform: scale(1.05);
}

.settings-container.compact {
    text-align: center;
    padding: clamp(12px, 2vh, 25px) clamp(15px, 2.5vw, 30px);
    background: rgba(255, 255, 255, 0.1);
    border-radius: clamp(12px, 2vw, 20px);
    backdrop-filter: blur(10px);
    width: clamp(300px, 35vw, 450px);
    max-width: 90vw;
}

.settings-title {
    color: white;
    font-size: clamp(1rem, 1.8vw, 1.5rem);
    margin: clamp(3px, 0.5vh, 8px) 0 clamp(10px, 1.5vh, 18px);
}



.settings-grid.compact {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 15px;
}

.setting-item-compact {
    background: rgba(0, 0, 0, 0.3);
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.setting-item-compact .hint {
    color: #7FD8E8;
    font-size: clamp(0.7rem, 0.9vw, 0.8rem);
    font-style: italic;
    margin: 6px 0 0;
    text-align: left;
    opacity: 0.9;
}

.setting-row {
    display: flex;
    align-items: center;
    gap: 10px;
}


.setting-row label {
    color: #FFFFFF;
    font-size: clamp(0.85rem, 1.1vw, 1rem);
    font-weight: bold;
    min-width: 95px;
    text-align: left;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}


.setting-row input[type="range"] {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.3);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.setting-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #FFD700;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.setting-row input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #FFD700;
    cursor: pointer;
    border: none;
}

.setting-row span {
    color: #FFD700;
    font-size: clamp(1rem, 1.3vw, 1.2rem);
    font-weight: bold;
    min-width: 45px;
    text-align: right;
    text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
}


.settings-buttons.compact {
    display: flex;
    gap: 10px;
    justify-content: center;
}

.btn-compact {
    border: none;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: clamp(0.8rem, 1vw, 0.95rem);
    font-weight: bold;
    cursor: pointer;
    color: white;
    transition: all 0.2s;
}

.btn-compact.btn-green {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
}

.btn-compact.btn-red {
    background: linear-gradient(135deg, #c0392b 0%, #e74c3c 100%);
}

.btn-compact:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* ============ TOAST NOTIFICATION ============ */
.toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-30px);
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

@keyframes slideUp {
    from {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }

    to {
        opacity: 0;
        transform: translateX(-50%) translateY(-30px);
    }
}

.toast-container.hiding {
    animation: slideUp 0.3s ease-in forwards;
}

.toast-content {
    display: flex;
    align-items: center;
    gap: clamp(10px, 1.5vw, 15px);
    padding: clamp(12px, 2vh, 20px) clamp(20px, 3vw, 35px);
    background: linear-gradient(135deg, rgba(39, 174, 96, 0.95) 0%, rgba(46, 204, 113, 0.95) 100%);
    border-radius: clamp(10px, 1.5vw, 15px);
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.toast-content.reset {
    background: linear-gradient(135deg, rgba(52, 152, 219, 0.95) 0%, rgba(41, 128, 185, 0.95) 100%);
}

.toast-icon {
    font-size: clamp(1.5rem, 2.5vw, 2rem);
}

.toast-message {
    color: white;
    font-size: clamp(0.9rem, 1.5vw, 1.2rem);
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}