/* ========================================
   When I Dream - Gamified Theme
   ======================================== */

/* Pause state styles */
.timer-paused {
    color: var(--text-secondary);
    font-size: 2.5rem !important;
    animation: blink 1.5s infinite;
}

@keyframes blink {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.5;
    }
}

/* CSS Variables */
:root {
    /* Core Gradients */
    --grad-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --grad-gold: linear-gradient(135deg, #f6d365 0%, #fda085 100%);
    --grad-success: linear-gradient(135deg, #0ba360 0%, #3cba92 100%);
    --grad-danger: linear-gradient(135deg, #ff512f 0%, #dd2476 100%);
    --grad-dreamer: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);

    /* Colors */
    --accent-gold: #f6d365;
    --text-primary: #2d3748;
    --text-secondary: #718096;
    --bg-page: #f7fafc;

    /* Role Colors */
    --color-dreamer: #4facfe;
    --color-fairy: #0ba360;
    --color-imp: #ff512f;
    --color-trickster: #f6d365;

    /* Spacing */
    --spacing-xs: 0.25rem;
    --spacing-sm: 0.5rem;
    --spacing-md: 1rem;
    --spacing-lg: 1.5rem;
    --spacing-xl: 2rem;
    --spacing-xxl: 3rem;

    /* Radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-xl: 30px;

    /* Shadows */
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.05);
    --shadow-card: 0 10px 15px -3px rgba(0, 0, 0, 0.1),
        0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-floating: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
        0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-glow: 0 0 15px rgba(118, 75, 162, 0.3);

    /* Typography */
    --font-display: 'Outfit', sans-serif;
    --font-body: 'Inter', sans-serif;

    /* Animation */
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark Theme Removed */

/* Reset */
*,
*::before,
*::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 18px;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--bg-page);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
    transition: background-color var(--transition);
}

body {
    background: linear-gradient(135deg, #f5f7fa 0%, #e8eef5 25%, #f5f7fa 50%, #dfe7f2 75%, #f5f7fa 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
}

@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

    50% {
        background-position: 100% 50%;
    }

    100% {
        background-position: 0% 50%;
    }
}

#app {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: var(--spacing-md);
    max-width: 1200px;
    margin: 0 auto;
}

.screen {
    width: 100%;
    max-width: 600px;
    text-align: center;
    animation: fadeIn 0.4s ease-out;
    margin: auto 0;
    /* Center vertically if space allows */
    padding-top: 60px;
    /* Space for fixed elements like settings button */
}

/* Dream Mode: Full Height Flex Layout and Paused State support */
.screen.dream-mode {
    height: 100vh;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 1rem;
    padding-bottom: 1rem;
    margin: 0 auto;
    max-width: 600px;
    overflow: hidden;
    position: relative;
    /* For overlay */
}

/* Paused Overlay */
.paused-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: transparent;
    /* No dimming as requested */
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    /* Allow clicking through to buttons */
    animation: fadeIn 0.3s ease;
}

.paused-content {
    background: rgba(0, 0, 0, 0.7);
    padding: 1rem 2rem;
    border-radius: var(--radius-lg);
    pointer-events: auto;
    /* Maybe allow clicking text? Not needed really */
    pointer-events: none;
    /* Keep transparent */
    backdrop-filter: blur(4px);
}

.paused-content h1 {
    color: white;
    font-size: 3rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    margin: 0;
    font-weight: 900;
    animation: pulse 1s infinite;
}


#app.paused-mode::before {
    /* Optional: Global dim if desired, but overlay handles the game area */
}

/* Typography */
h1,
h2,
h3,
h4 {
    font-family: var(--font-display);
    font-weight: 700;
    line-height: 1.2;
}

h1 {
    font-size: clamp(2.5rem, 5vw, 4rem);
    margin-bottom: var(--spacing-lg);
}

/* Gradient Text Utility */
.gradient-text {
    background: var(--grad-gold);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

/* Force Solid Text */
.text-solid {
    background: none !important;
    -webkit-text-fill-color: initial !important;
    text-fill-color: initial !important;
    background-clip: border-box !important;
    -webkit-background-clip: border-box !important;
}

h2 {
    font-size: clamp(1.8rem, 4vw, 2.5rem);
    color: var(--text-primary);
    margin-bottom: var(--spacing-md);
}

h3 {
    font-size: 1.5rem;
    color: #5a67d8;
    /* Indigo */
    margin-bottom: var(--spacing-sm);
}

/* Cards */
.card {
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    padding: var(--spacing-lg);
    margin-bottom: var(--spacing-md);
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: transform var(--transition);
}





@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Buttons */
.btn {
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    padding: var(--spacing-md) var(--spacing-xl);
    border: none;
    border-radius: var(--radius-xl);
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    min-width: 200px;
}

.btn:active {
    transform: scale(0.98);
}

.btn-primary {
    background: var(--grad-primary);
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-primary:hover {
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
    transform: translateY(-2px);
}

.btn-gold {
    background: var(--grad-gold);
    color: #744210;
    box-shadow: 0 4px 15px rgba(246, 211, 101, 0.4);
}

.btn-gold:hover {
    box-shadow: 0 6px 20px rgba(246, 211, 101, 0.6);
    transform: translateY(-2px);
}

.btn-secondary {
    background: white;
    color: var(--text-primary);
    border: 2px solid #e2e8f0;
}



.btn-secondary:hover {
    background: #f7fafc;
    border-color: #cbd5e0;
}

.btn-danger {
    background: var(--grad-danger);
    color: white;
    box-shadow: 0 4px 15px rgba(255, 81, 47, 0.3);
}

.btn-small {
    padding: 0.5rem 1rem;
    min-width: auto;
    font-size: 0.9rem;
    border-radius: var(--radius-md);
}

/* Button Groups */
.btn-group {
    display: flex;
    flex-direction: column;
    gap: var(--spacing-md);
    margin-top: var(--spacing-lg);
}

.btn-group-horizontal {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--spacing-md);
}

/* Inputs */
.form-control {
    width: 100%;
    padding: var(--spacing-md);
    border-radius: var(--radius-md);
    border: 2px solid #e2e8f0;
    font-family: var(--font-body);
    font-size: 1rem;
    background: white;
    transition: all 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

/* Player Input Labels */
.player-input-label {
    text-align: left;
    display: block;
    font-size: 1.2rem;
    font-weight: 800;
    margin-bottom: 0.5rem;
    margin-left: 0.5rem;
    background: var(--grad-primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

/* ----- GAMIFIED ELEMENTS ----- */

/* Visual Timer */
.timer-controls {
    text-align: center;
}

.timer {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 4.2rem;
    color: var(--text-primary);
    line-height: 1;
    margin-bottom: 0.5rem;
}

.timer.warning {
    color: #f6ad55;
}

.timer.danger {
    color: #fc8181;
    animation: pulse 0.5s infinite;
}

.timer-container {
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
}

.timer-progress-bg {
    height: 12px;
    background: #e2e8f0;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 0.5rem;
}

.timer-progress-fill {
    height: 100%;
    background: var(--grad-primary);
    width: 100%;
    transition: width 1s linear, background 0.3s;
}

/* Word Display */
.word-display {
    font-family: var(--font-display);
    font-size: clamp(3rem, 8vw, 6rem);
    font-weight: 800;
    text-transform: uppercase;
    color: var(--text-primary);
    text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.05);
    background: white;
    padding: 2rem 1rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-floating);
    margin: 1rem 0;
    position: relative;
    border-bottom: 6px solid #e2e8f0;
    transition: transform 0.2s;
}

.word-display:hover {
    transform: translateY(-2px);
}

/* Gamified Lists */
.word-lists {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin: 1rem 0;
}

.gamified-list {
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    border: 1px solid rgba(0, 0, 0, 0.05);
}

.gamified-list.correct {
    border-top: 4px solid #3cba92;
}

.gamified-list.wrong {
    border-top: 4px solid #dd2476;
}

.list-header {
    padding: 0.75rem 1rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    font-family: var(--font-display);
}

.gamified-list.correct .list-header {
    background: rgba(60, 186, 146, 0.1);
    color: #0ba360;
}

.gamified-list.wrong .list-header {
    background: rgba(221, 36, 118, 0.1);
    color: #dd2476;
}

.count-badge {
    background: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.8rem;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.word-list ul {
    list-style: none;
    max-height: 200px;
    overflow-y: auto;
    padding: 0.5rem;
}

.word-list li {
    padding: 0.4rem 0.8rem;
    border-bottom: 1px solid #f7fafc;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

/* Action Buttons */
.action-buttons {
    display: flex;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 5rem;
    /* Increased from 2rem to lower buttons */
}

.action-btn {
    width: 110px;
    height: 110px;
    border-radius: 50%;
    border: none;
    /* font-size removed, using SVGs */
    color: white;
    cursor: pointer;
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);
    transition: transform 0.1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

.action-btn:active {
    transform: scale(0.9);
}

.action-btn:hover {
    transform: scale(1.1);
}

.action-btn.correct {
    background: var(--grad-success);
    box-shadow: 0 10px 20px rgba(60, 186, 146, 0.4);
}

.action-btn.wrong {
    background: var(--grad-danger);
    box-shadow: 0 10px 20px rgba(221, 36, 118, 0.4);
}

.action-btn.skip {
    background: linear-gradient(135deg, #cbd5e0 0%, #a0aec0 100%);
    box-shadow: 0 10px 20px rgba(0, 0, 0, 0.1);
}
}

/* Fixed Game Footer */
/* Flex Footer (formerly Fixed) */
.fixed-game-footer {
    position: relative;
    /* Part of flow */
    bottom: auto;
    left: auto;
    transform: none;
    width: 100%;
    /* max-width handled by parent .screen */
    background: transparent;
    padding: 0;
    margin-top: auto;
    /* Push to bottom if content is short */
    margin-bottom: 270px;
    /* Lift up drastically + 20px */
    box-shadow: none;
    z-index: 100;
    flex-shrink: 0;
    /* Never shrink */
    display: flex;
    flex-direction: column;
    align-items: center;
}

.fixed-game-footer .action-buttons {
    margin: 0;
    width: 100%;
    justify-content: center;
    gap: 1.5rem;
    padding-bottom: 10px;
}

@media (min-width: 769px) {
    .fixed-game-footer .action-buttons {
        gap: 3rem;
    }

    .fixed-game-footer {
        bottom: auto;
        /* Reset */
        margin-bottom: 8vh;
        /* Lowered from 15vh */
    }

    .action-btn {
        width: 110px;
        height: 110px;
        font-size: 3.5rem;
    }
}

font-size: 3.5rem;
}
}

.fixed-game-footer .counters-row {
    display: flex;
    width: 100%;
    max-width: 500px;
    justify-content: space-around;
    font-family: var(--font-display);
    font-weight: 800;
}

.counter-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.2rem;
    padding: 0.25rem 1rem;
    border-radius: var(--radius-xl);
    background: #f7fafc;
}

.counter-item.correct {
    color: #0ba360;
    background: rgba(11, 163, 96, 0.1);
}

.counter-item.wrong {
    color: #dd2476;
    background: rgba(221, 36, 118, 0.1);
}



/* Dynamic Font Sizes */
.word-display.text-md {
    font-size: clamp(2.5rem, 6vw, 4rem);
}

.word-display.text-lg {
    font-size: clamp(2rem, 5vw, 3rem);
}

.word-display.text-xl {
    font-size: clamp(1.5rem, 4vw, 2.5rem);
}

/* Modals */
.modal-overlay,
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    padding: 1rem;
}

.modal {
    position: relative;
    background: white;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-floating);
    width: 100%;
    max-width: 700px;
    max-height: 85vh;
    overflow-y: auto;
    padding: 2rem;
    animation: zoomIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@media (max-width: 768px) {
    .modal {
        max-width: 500px;
        max-height: 80vh;
        /* Better for mobile */
    }
}

@keyframes zoomIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid #f7fafc;
    padding-bottom: 1rem;
}

.modal-close {
    background: none;
    border: none;
    font-size: 2rem;
    cursor: pointer;
    color: var(--text-secondary);
}

/* Floating close button (superimposed in corner) */
.modal-close-floating {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(255, 255, 255, 0.95);
    border: 2px solid #fc8181;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 1.75rem;
    line-height: 1;
    cursor: pointer;
    color: #e53e3e;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    box-shadow: 0 2px 8px rgba(229, 62, 62, 0.25);
    transition: all 0.2s;
}

.modal-close-floating:hover {
    background: #fff5f5;
    color: #c53030;
    border-color: #e53e3e;
    transform: scale(1.1);
}





/* Modal footer with centered button */
.modal-footer-btn {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 2rem;
    padding-top: 1.5rem;
    border-top: 2px solid #f7fafc;
}



/* Modal Tabs Styling */
.modal-tabs-header {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    padding: 0.5rem;
    background: #f7fafc;
    border-radius: var(--radius-lg);
    justify-content: center;
}

@media (max-width: 600px) {
    .modal-tabs-header {
        flex-wrap: wrap;
    }
}



.modal-tab-btn {
    flex: 1;
    min-width: 100px;
    padding: 0.75rem 1.25rem;
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    font-family: var(--font-display);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    background: white;
    color: #718096;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.modal-tab-btn:hover:not(.active) {
    border-color: #e2e8f0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.08);
}

.modal-tab-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.35);
}

@media (max-width: 600px) {
    .modal-tabs-header {
        gap: 0.35rem;
        padding: 0.35rem;
    }

    .modal-tab-btn {
        min-width: 70px;
        padding: 0.6rem 0.75rem;
        font-size: 0.85rem;
    }
}

/* Recall Items */
.recall-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.75rem;
    max-height: 40vh;
    overflow-y: auto;
}

.word-recall-item {
    background: white;
    border: 2px solid #e2e8f0;
    border-radius: var(--radius-md);
    padding: 1rem;
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: all 0.2s;
}

.word-recall-item:hover {
    border-color: #cbd5e0;
}

/* Modern Game Menu */
.game-menu-container {
    text-align: left;
}

.menu-section-title {
    font-family: var(--font-display);
    border-bottom: 2px solid #f0f0f0;
    padding-bottom: 0.5rem;
    color: var(--text-secondary);
}

.menu-actions-grid .btn {
    font-family: var(--font-body);
    font-weight: 600;
    text-transform: none;
    letter-spacing: normal;
    background: white;
    border: 1px solid #e2e8f0;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
    transition: all 0.2s;
    border-radius: var(--radius-md);
    color: var(--text-primary);
}

.menu-actions-grid .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border-color: #cbd5e0;
}

/* Config Modal specific */
.config-modal-content {
    text-align: center;
}

.word-recall-item.selected {
    border-color: #f6ad55;
    background: #fffaf0;
    box-shadow: 0 2px 5px rgba(246, 173, 85, 0.2);
}

.word-recall-item .text {
    font-weight: 500;
    margin-left: 1rem;
    font-size: 1.1rem;
}

.word-recall-item .checkbox {
    font-size: 1.25rem;
    color: #cbd5e0;
}

.word-recall-item.selected .checkbox {
    color: #ed8936;
}

/* Settings Button specific */
.settings-btn {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 48px;
    height: 48px;
    background: white;
    border-radius: 50%;
    box-shadow: var(--shadow-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    border: 1px solid #e2e8f0;
    z-index: 2000;
    cursor: pointer;
    transition: all 0.2s;
}

.settings-btn:hover {
    background: #f7fafc;
    transform: rotate(90deg);
}



/* Utilities */
.text-muted {
    color: var(--text-secondary);
}

.text-success {
    color: #0ba360;
    font-weight: 700;
}

.text-danger {
    color: #dd2476;
    font-weight: 700;
}

.text-warning {
    color: #ed8936;
    font-weight: 700;
}

.mb-md {
    margin-bottom: 1rem;
}

.mb-lg {
    margin-bottom: 1.5rem;
}

.mt-lg {
    margin-top: 1.5rem;
}

.hidden {
    display: none !important;
}

/* Responsive */
@media (max-width: 600px) {
    h1 {
        font-size: 2.5rem;
    }

    .word-display {
        font-size: 3.5rem;
        padding: 2rem 1rem;
    }

    .action-btn {
        width: 70px;
        height: 70px;
        font-size: 2rem;
    }

    .word-lists {
        grid-template-columns: 1fr 1fr;
        gap: 1rem;
        margin-bottom: 7rem;
        /* Space for footer */
    }
}

/* ==========================================================================
   NEW STYLES: Scoring Grid & Desktop Optimizations 
   ========================================================================== */

/* Scoring Grid System */
.score-player-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
    margin: 2rem 0;
}

.player-score-card {
    background: white;
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    border: 1px solid rgba(0, 0, 0, 0.05);
    transition: transform 0.2s;
    position: relative;
    overflow: hidden;
}

.player-score-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-card);
}

.player-score-card.dreamer-border {
    border-top: 6px solid var(--color-dreamer);
}

.player-score-card.fairy-border {
    border-top: 6px solid var(--color-fairy);
}

.player-score-card.imp-border {
    border-top: 6px solid var(--color-imp);
}

.player-score-card.trickster-border {
    border-top: 6px solid var(--color-trickster);
}

.player-role-icon {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    font-family: "Segoe UI Emoji", "Noto Color Emoji", sans-serif;
}

.player-score-card .player-name {
    font-size: 1.25rem;
    font-weight: 700;
    margin-bottom: 0.25rem;
}

.player-score-card .player-reason {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
    line-height: 1.2;
}

.player-score-card .player-points {
    font-size: 2.5rem;
    font-family: var(--font-display);
    font-weight: 800;
    color: var(--accent-gold);
    background: #fffaf0;
    width: 100%;
    padding: 0.5rem;
    border-radius: var(--radius-md);
}

/* Stats Row */
.stats-row {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}

.stat-box {
    text-align: center;
    padding: 1rem;
    background: #f7fafc;
    border-radius: var(--radius-md);
    min-width: 120px;
}

.stat-box .stat-number {
    display: block;
    font-size: 3rem;
    font-family: var(--font-display);
    font-weight: 800;
    line-height: 1;
}

.stat-box .stat-label {
    text-transform: uppercase;
    font-size: 0.8rem;
    letter-spacing: 0.1em;
    font-weight: 600;
    margin-top: 0.5rem;
    display: block;
}

.stat-box.success .stat-number {
    color: #0ba360;
}

.stat-box.danger .stat-number {
    color: #dd2476;
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding: 0 0.5rem;
}

.balance-msg {
    text-align: center;
    font-weight: 700;
    padding: 1rem;
    border-radius: var(--radius-md);
    background: #edf2f7;
    margin-top: 1rem;
}

.balance-msg.success {
    background: #f0fff4;
    color: #0ba360;
    border: 1px solid #c6f6d5;
}

/* Role Reveal Desktop Resizing (Aggressive !important to override inline styles) */
@media (min-width: 768px) {
    .role-icon {
        font-size: 10rem !important;
        /* Huge icon for desktop */
        margin: 3rem 0 !important;
    }

    .card h1 {
        font-size: 5rem !important;
        /* Huge name title */
        background: var(--grad-gold);
        -webkit-background-clip: text;
        -webkit-text-fill-color: transparent;
    }

    .text-muted.mt-lg {
        font-size: 1.8rem !important;
        /* Readable description text */
        line-height: 1.6;
        color: var(--text-primary) !important;
    }
}

/* =========================================
   COMPACT RESULTS SCREEN
   ========================================= */

.results-screen-compact {
    height: 100vh;
    padding: 1rem;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.results-header-compact {
    text-align: center;
    margin-bottom: 2rem;
    flex-shrink: 0;
}

.results-header-compact h1 {
    font-size: 3rem;
    margin-bottom: 0.25rem;
}

.results-header-compact p {
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.results-layout-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 1.5rem;
    flex: 1;
    min-height: 0;
    /* Important for grid scroll */
    max-width: 1200px;
    width: 100%;
    margin: 0 auto;
}

/* Sidebar Stats */
.sidebar-column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.stats-card-compact {
    padding: 1.5rem;
    flex: 1;
    display: flex;
    flex-direction: column;
}

.stats-grid-mini {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-top: auto;
    margin-bottom: auto;
}

.stat-mini {
    background: #f7fafc;
    padding: 1rem;
    border-radius: var(--radius-md);
    text-align: center;
}

.stat-mini .val {
    display: block;
    font-size: 2rem;
    font-weight: 800;
    line-height: 1;
    color: var(--text-primary);
}

.stat-mini .lbl {
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--text-secondary);
}

.stat-mini.success .val {
    color: #0ba360;
}

.action-buttons-vertical {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* Podium & Ranking */
.ranking-card {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background: #fff;
    padding: 0;
    /* Custom padding for this card */
}

.podium-container {
    display: flex;
    justify-content: center;
    align-items: flex-end;
    height: 250px;
    padding-bottom: 2rem;
    gap: 1rem;
    background: linear-gradient(to bottom, #fff, #f7fafc);
    border-bottom: 1px solid #edf2f7;
    margin-bottom: 0;
}

.podium-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100px;
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.podium-step:hover {
    transform: translateY(-5px);
}

.podium-step.place-1 {
    order: 2;
    z-index: 2;
}

.podium-step.place-2 {
    order: 1;
    z-index: 1;
}

.podium-step.place-3 {
    order: 3;
    z-index: 1;
}

.podium-avatar {
    font-size: 3rem;
    margin-bottom: 0.5rem;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.1));
}

.podium-bar {
    width: 100%;
    background: var(--grad-gold);
    border-radius: 10px 10px 0 0;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 0.5rem;
    color: #744210;
    font-weight: 800;
    font-family: var(--font-display);
    font-size: 1.5rem;
    box-shadow: 0 4px 15px rgba(246, 211, 101, 0.3);
}

.podium-step.place-1 .podium-bar {
    height: 160px;
}

.podium-step.place-2 .podium-bar {
    height: 110px;
    background: linear-gradient(135deg, #e2e8f0 0%, #cbd5e0 100%);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
    color: #4a5568;
}

.podium-step.place-3 .podium-bar {
    height: 80px;
    background: linear-gradient(135deg, #ed8936 0%, #dd6b20 100%);
    box-shadow: 0 4px 10px rgba(230, 126, 34, 0.3);
    color: white;
}

.podium-name {
    margin-top: 0.5rem;
    font-weight: 700;
    font-size: 1.1rem;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
}

.ranking-list-compact {
    flex: 1;
    overflow-y: auto;
    padding: 1rem 2rem;
}

.rank-row {
    display: flex;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid #f7fafc;
    align-items: center;
    transition: background 0.2s;
    border-radius: var(--radius-md);
}

.rank-row:hover {
    background: #f7fafc;
}

.rank-pos {
    font-weight: 700;
    color: var(--text-secondary);
    width: 40px;
    font-size: 1.1rem;
}

.rank-name {
    flex: 1;
    font-weight: 600;
    font-size: 1.1rem;
}

.rank-score {
    font-weight: 800;
    font-family: var(--font-display);
    font-size: 1.25rem;
}

.w-100 {
    width: 100%;
    border-radius: var(--radius-md);
    padding: 1rem;
}

/* Mobile fallback */
@media (max-width: 850px) {
    .results-layout-grid {
        grid-template-columns: 1fr;
        overflow-y: auto;
        display: block;
    }

    .results-screen-compact {
        height: auto;
        overflow-y: auto;
        padding: 1rem;
    }

    .sidebar-column {
        margin-top: 2rem;
    }

    .podium-container {
        height: 200px;
    }

    .podium-step {
        width: 80px;
    }

    .podium-step.place-1 .podium-bar {
        height: 120px;
    }
}

/* =========================================
   SCOREBOARD TABLE STYLES
   ========================================= */

.scoreboard-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9rem;
    min-width: max-content;
    /* Ensure it expands horizontally */
}

.scoreboard-table th,
.scoreboard-table td {
    padding: 0.75rem 0.5rem;
    text-align: center;
    border-bottom: 1px solid #edf2f7;
    white-space: nowrap;
}

.scoreboard-table th {
    background: #f7fafc;
    font-weight: 700;
    color: var(--text-secondary);
    text-transform: uppercase;
    font-size: 0.8rem;
    position: sticky;
    top: 0;
    z-index: 20;
}

/* Sticky First Column (Player Name) */
.scoreboard-table th:first-child,
.scoreboard-table td:first-child {
    text-align: left;
    font-weight: 700;
    position: sticky;
    left: 0;
    background: white;
    z-index: 15;
    border-right: 2px solid #f7fafc;
    min-width: 100px;
    padding-left: 1rem;
}

.scoreboard-table th:first-child {
    background: #f7fafc;
    z-index: 25;
}

.score-cell {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.25rem;
}

.role-icon-tiny {
    font-size: 1.2rem;
    line-height: 1;
}

.score-val {
    font-weight: 700;
    color: var(--text-primary);
}

/* Alternating rows for readability */
.scoreboard-table tbody tr:nth-child(even) td:not(:first-child) {
    background-color: #fcfcfc;
}

.scoreboard-table tbody tr:nth-child(even) td:first-child {
    background-color: #f9f9f9;
}

/* =========================================
   STEPPER CONTROLS
   ========================================= */

.stepper-control {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    margin-top: 0.5rem;
    user-select: none;
}

.stepper-value {
    font-size: 2.5rem;
    font-weight: 800;
    min-width: 80px;
    text-align: center;
    color: var(--text-primary);
    font-feature-settings: "tnum";
    font-variant-numeric: tabular-nums;
}

.btn-icon {
    width: 60px !important;
    height: 60px !important;
    min-width: 60px !important;
    font-size: 1.2rem;
    font-weight: 800;
    padding: 0 !important;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50% !important;
    transition: transform 0.1s;
    background: white;
    border: 2px solid #e2e8f0;
}

.btn-decrease {
    background: #fff5f5 !important;
    color: #e53e3e !important;
    border-color: #fed7d7 !important;
}

.btn-decrease:hover {
    background: #fed7d7 !important;
}

.btn-increase {
    background: #f0fff4 !important;
    color: #38a169 !important;
    border-color: #c6f6d5 !important;
}

.btn-increase:hover {
    background: #c6f6d5 !important;
}

.btn-icon:active {
    transform: scale(0.9);
}

.stepper-control .btn-icon {
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* ========================================
   New Game UI Stats (Bubbles)
   ======================================== */

.game-stats-container {
    margin-top: 2rem !important;
}

.score-bubble {
    width: 70px;
    height: 70px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    font-weight: 800;
    color: white;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    position: absolute;
    top: -25px;
    /* Floating slightly above header */
    z-index: 20;
    border: 3px solid white;
}

.correct-bubble {
    background: var(--grad-success);
    right: -5px;
    /* Reduced overlap */
}

.wrong-bubble {
    background: var(--grad-danger);
    left: -5px;
    /* Reduced overlap */
}

.styled-word-list {
    list-style: none;
    padding: 0;
    margin: 0;
}

.styled-word-list li {
    padding: 0.6rem 1rem;
    border-bottom: 1px solid #f0f0f0;
    color: var(--text-secondary);
    font-size: 1rem;
    text-transform: uppercase;
    /* Force uppercase words */
}

.styled-word-list li:last-child {
    border-bottom: none;
}

/* Mobile Responsive Adjustments */
@media (max-width: 600px) {
    .score-bubble {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
        top: -15px;
        border-width: 2px;
    }

    .game-stats-container {
        gap: 0.5rem !important;
    }

    .list-header-styled h4 {
        font-size: 0.95rem !important;
    }
}

/* Score Correction UI */
/* Score Correction UI */
.score-correction-list {
    display: flex;
    flex-direction: column;
    width: 100%;
}

.score-correction-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0;
    width: 100%;
    border-bottom: 1px solid #f0f0f0;
}

.score-correction-item .player-info {
    display: flex;
    align-items: center;
    gap: 1rem;
    /* More space between icon and name */
}

.score-correction-item .role-icon {
    font-size: 1.8rem;
    /* Slightly larger base size */
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
}


@keyframes float {
    0% {
        transform: translateY(0px);
    }

    50% {
        transform: translateY(-10px);
    }

    100% {
        transform: translateY(0px);
    }
}

.score-correction-item .player-details {
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.score-correction-item .player-name {
    font-weight: 700;
    font-size: 1.1rem;
    /* Larger text */
    line-height: 1.2;
}

.score-correction-item .player-role {
    font-size: 0.9rem;
    /* Larger subtext */
}

.score-correction-item .score-controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.btn-micro {
    width: 36px;
    /* Larger buttons for mobile */
    height: 36px;
    border-radius: 50%;
    border: none;
    background: white;
    color: var(--text-primary);
    font-weight: bold;
    font-size: 1.2rem;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-micro:hover {
    background: var(--text-primary);
    color: white;
    transform: scale(1.1);
}

.score-value {
    min-width: 35px;
    text-align: center;
    font-weight: 800;
    font-size: 1.3rem;
    /* Larger score text */
}

@keyframes pulse {
    0% {
        transform: scale(1);
        opacity: 1;
    }

    50% {
        transform: scale(1.05);
        opacity: 0.9;
        box-shadow: 0 0 15px rgba(102, 126, 234, 0.8);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.btn-pulse {
    animation: pulse 1.5s infinite;
}

/* ========================================
   Language Selector
   ======================================== */
.language-selector {
    position: relative;
    display: inline-block;
    cursor: pointer;
}

.current-lang {
    font-size: 2rem;
    padding: 0.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 2px solid #e2e8f0;
    transition: all 0.2s;
    min-width: 60px;
    min-height: 50px;
}

.current-lang:hover {
    border-color: #cbd5e0;
    box-shadow: var(--shadow-card);
}

.language-dropdown {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 0.5rem;
    background: white;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-floating);
    overflow: hidden;
    z-index: 1000;
    min-width: 140px;
}

.language-dropdown.hidden {
    display: none;
}

.lang-option {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    width: 100%;
    border: none;
    background: none;
    cursor: pointer;
    font-family: var(--font-body);
    font-size: 1rem;
    color: var(--text-primary);
    transition: background 0.15s;
}

.lang-option:hover {
    background: #f7fafc;
}

.lang-option.active {
    background: rgba(102, 126, 234, 0.1);
    color: #667eea;
    font-weight: 600;
}

.lang-flag {
    font-size: 1.5rem;
}

.lang-name {
    flex: 1;
    text-align: left;
}

/* Language selector positioning in home screen */
.home-header {
    display: flex;
    justify-content: flex-end;
    width: 100%;
    margin-bottom: 1rem;
}

/* ========================================
   Improved Language Selector
   ======================================== */

.hidden {
    display: none !important;
}

.language-selector-improved {
    position: absolute;
    top: 1rem;
    right: 1rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    z-index: 100;
}

.language-selector-inline {
    display: flex;
    gap: 1rem;
    justify-content: center;
    align-items: center;
    margin-top: 0.5rem;
    padding: 0.5rem;
    background: #f7fafc;
    border-radius: var(--radius-md);
}

.lang-flag-btn {
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    padding: 0.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    min-width: 40px;
    min-height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0.7;
}

.lang-flag-btn:hover {
    transform: scale(1.1);
    opacity: 1;
}

.lang-flag-btn.active {
    opacity: 1;
    transform: scale(1.05);
}

.lang-flag-btn .flag-icon {
    width: 32px;
    height: 24px;
    object-fit: cover;
    border-radius: 4px;
    display: block;
}

/* Mobile optimization */
@media (max-width: 768px) {
    .lang-flag-btn {
        min-width: 55px;
        min-height: 45px;
        padding: 0.4rem 0.6rem;
    }

    .lang-flag-btn .flag-icon {
        width: 28px;
        height: 21px;
    }
}

/* Touch-friendly tap targets */
@media (hover: none) and (pointer: coarse) {
    .lang-flag-btn {
        min-width: 64px;
        min-height: 56px;
    }
}

/* Extension Banner */
.extension-banner {
    background: var(--grad-danger);
    color: white;
    padding: 0.75rem;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    font-weight: 800;
    font-size: 1.1rem;
    animation: pulse 1s infinite;
    box-shadow: 0 4px 10px rgba(255, 81, 47, 0.3);
}

.extension-banner.final {
    background: #2d3748;
    animation: none;
    border: 2px solid var(--accent-gold);
}

/* Scoring Summary */
.scoring-summary-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    text-align: left;
}

.summary-col {
    background: #f7fafc;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius-sm);
    border-left: 3px solid #cbd5e0;
}

.summary-words {
    font-size: 0.85rem;
    color: var(--text-primary);
    word-break: break-word;
    font-weight: 500;
}

@media (max-width: 480px) {
    .scoring-summary-grid {
        grid-template-columns: 1fr;
    }
}

/* Player Item Edit */
.player-item-edit {
    transition: transform 0.2s, background 0.2s;
}

.player-item-edit:hover {
    background: #edf2f7 !important;
}

.player-list-edit {
    scrollbar-width: thin;
    scrollbar-color: var(--accent-gold) #f7fafc;
}

.player-list-edit::-webkit-scrollbar {
    width: 6px;
}

.player-list-edit::-webkit-scrollbar-track {
    background: #f7fafc;
}

.player-list-edit::-webkit-scrollbar-thumb {
    background-color: var(--accent-gold);
    border-radius: 10px;
}