/* Global Styles */
:root {
    --primary-color: #FF6B6B;
    /* Default Meal Theme */
    --secondary-color: #9B59B6;
    --background-color: #F7F8FA;
    --text-color: #333;
    --text-light: #777;
    --card-bg: #FFFFFF;
    --border-radius: 16px;
    --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
    --font-family: 'Noto Sans TC', sans-serif;
}

/* Utility Classes */
.hidden {
    display: none !important;
}

/* Theme Variations */
.theme-meal {
    --primary-color: #FF6B6B;
    /* Salmon */
    --secondary-color: #9B59B6;
    /* Purple */
}

.theme-tea {
    --primary-color: #E67E22;
    /* Orange/Brown for Tea */
    --secondary-color: #9B59B6;
}

.theme-special {
    --primary-color: #9B59B6;
    /* Purple for Special */
    --secondary-color: #9B59B6;
}

/* Special Theme Button Override */
.theme-special .btn-primary {
    background: linear-gradient(135deg, #A569BD, #8E44AD);
    /* Purple gradient */
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: var(--font-family);
    background-color: var(--background-color);
    color: var(--text-color);
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

.app-container {
    width: 100%;
    max-width: 480px;
    /* Mobile-first */
    background-color: #fff;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 0 20px rgba(0, 0, 0, 0.05);
}

/* PC/Tablet Layout */
@media (min-width: 768px) {
    .app-container {
        max-width: 1200px;
        /* Wider on PC */
    }
}

/* Game Board Layout */
.game-board-section {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.game-header {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 16px;
    padding: 16px 8px 8px 8px;
    position: relative;
}

.game-header .back-btn {
    position: absolute;
    left: 8px;
    top: 16px;
}

.game-header .game-title {
    flex: 1;
    text-align: center;
    margin: 0;
    padding: 0 50px;
    /* Space for back button */
}

/* Filter Controls - collapsible */
.filter-controls-wrapper {
    width: 100%;
}

.filter-toggle-btn {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 12px;
    padding: 12px 16px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    transition: all 0.3s;
}

.filter-toggle-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.filter-summary {
    display: flex;
    gap: 12px;
    align-items: center;
}

.toggle-icon {
    transition: transform 0.3s;
}

.filter-toggle-btn.expanded .toggle-icon {
    transform: rotate(180deg);
}

.filter-controls {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 12px;
    margin-top: 8px;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    max-height: 500px;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease, margin 0.3s ease, opacity 0.3s ease;
    opacity: 1;
}

.filter-controls.collapsed {
    max-height: 0;
    padding: 0 12px;
    margin-top: 0;
    opacity: 0;
}

.filter-section {
    margin-bottom: 12px;
}

.filter-section:last-child {
    margin-bottom: 0;
}

.filter-label {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #fff;
    font-weight: 600;
    font-size: 14px;
    margin-bottom: 8px;
}

.filter-icon {
    font-size: 18px;
}

/* Game Slider */
.game-slider {
    width: 100%;
    height: 8px;
    border-radius: 5px;
    background: linear-gradient(to right, #f39c12, #e74c3c);
    outline: none;
    -webkit-appearance: none;
}

.game-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    border: 3px solid #f39c12;
    transition: transform 0.2s;
}

.game-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.game-slider::-moz-range-thumb {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    border: 3px solid #f39c12;
    transition: transform 0.2s;
}

.game-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
}

/* Group Mode Controls */
.group-controls {
    padding: 16px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    margin-bottom: 16px;
}

.mode-toggle-container {
    display: flex;
    gap: 12px;
    margin-bottom: 16px;
    justify-content: center;
}

.mode-toggle-btn {
    flex: 1;
    padding: 14px 20px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.mode-toggle-btn:hover {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.5);
}

.mode-toggle-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-color: #fff;
    color: #fff;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    transform: scale(1.02);
}

.mode-toggle-btn i {
    font-size: 18px;
}

/* Price Buttons */
.price-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.price-btn {
    flex: 1;
    min-width: 70px;
    padding: 14px 16px;
    border: 3px solid #ddd;
    border-radius: 12px;
    background: #fff;
    color: #667eea;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.price-btn:hover {
    background: #f8f9ff;
    border-color: #667eea;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(102, 126, 234, 0.2);
}

.price-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
    transform: scale(1.05);
}

/* Price buttons in leader settings (on gradient background) */
#leader-settings .price-btn {
    border-color: rgba(255, 255, 255, 0.4);
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
}

#leader-settings .price-btn:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
}

#leader-settings .price-btn.active {
    background: #fff;
    color: #667eea;
    border-color: #fff;
    box-shadow: 0 4px 12px rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
}

/* Little Mary Style Game Grid */
.game-grid {
    position: relative;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 6px;
    padding: 8px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 16px;
    box-shadow:
        inset 0 0 30px rgba(0, 0, 0, 0.8),
        0 0 20px rgba(241, 196, 15, 0.5),
        0 0 40px rgba(241, 196, 15, 0.3);
    border: 4px solid #f1c40f;
    width: 100%;
    max-width: 100%;
    overflow-y: auto;
    margin-bottom: 16px;
    transition: max-height 0.5s ease, padding 0.5s ease, opacity 0.5s ease, margin 0.5s ease;
    max-height: 1000px;
    /* Arbitrary large height */
    opacity: 1;
    overflow: hidden;
}

.game-grid.collapsed {
    /* Remove collapsed state for game grid */
}

/* Neon border animation */
@keyframes neonGlow {

    0%,
    100% {
        box-shadow:
            inset 0 0 30px rgba(0, 0, 0, 0.8),
            0 0 20px rgba(241, 196, 15, 0.8),
            0 0 40px rgba(241, 196, 15, 0.5),
            0 0 60px rgba(241, 196, 15, 0.3);
    }

    50% {
        box-shadow:
            inset 0 0 30px rgba(0, 0, 0, 0.8),
            0 0 10px rgba(241, 196, 15, 0.6),
            0 0 20px rgba(241, 196, 15, 0.4),
            0 0 30px rgba(241, 196, 15, 0.2);
    }
}

.game-grid {
    animation: neonGlow 2s ease-in-out infinite;
}

/* Center content area */
.center-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60%;
    height: 50%;
    background: radial-gradient(circle, rgba(231, 76, 60, 0.15) 0%, rgba(192, 57, 43, 0.05) 100%);
    border: 2px dashed rgba(241, 196, 15, 0.5);
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    pointer-events: none;
    z-index: 1;
}

/* Smaller center content for double ring mode */
.center-content-small {
    width: 35%;
    height: 35%;
    gap: 4px;
}

.center-content-small .center-icon {
    font-size: 24px;
}

.center-content-small .center-text {
    font-size: 12px;
}

.center-content-small .rolling-text {
    font-size: 9px;
}

.center-icon {
    font-size: 32px;
    animation: bounce 1s ease-in-out infinite;
}

@keyframes bounce {

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

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

.center-text {
    font-size: 16px;
    font-weight: bold;
    color: #f1c40f;
    text-shadow:
        0 0 10px rgba(241, 196, 15, 0.8),
        0 0 20px rgba(241, 196, 15, 0.6),
        0 0 30px rgba(241, 196, 15, 0.4);
    animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {

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

    50% {
        opacity: 0.7;
        transform: scale(1.05);
    }
}

.rolling-text {
    font-size: 11px;
    color: #ecf0f1;
    opacity: 0.8;
    text-align: center;
}

/* Tablet: Larger grid */
@media (min-width: 768px) {
    .game-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 10px;
        padding: 12px;
        border: 5px solid #f1c40f;
    }
}

/* PC: Even larger grid */
@media (min-width: 1024px) {
    .game-grid {
        grid-template-columns: repeat(8, 1fr);
        gap: 12px;
        padding: 14px;
        border: 6px solid #f1c40f;
    }
}

/* Card Updates for Little Mary Grid */
.card {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 2px solid #34495e;
    border-radius: 8px;
    padding: 4px 2px;
    height: auto;
    aspect-ratio: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.2s;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    z-index: 2;
}

.card:hover {
    transform: scale(1.05);
    border-color: #f39c12;
    box-shadow: 0 4px 10px rgba(243, 156, 18, 0.4);
}

.card .card-emoji {
    font-size: 20px;
    margin-bottom: 2px;
}

.card .card-label {
    font-size: 9px;
    font-weight: bold;
    color: #2c3e50;
    line-height: 1;
    text-align: center;
}

/* Center cards are hidden */
.card.center-placeholder {
    opacity: 0;
    pointer-events: none;
    border: none;
    background: transparent;
    box-shadow: none;
}

/* Tablet: Medium cards */
@media (min-width: 768px) {
    .card {
        border: 3px solid #34495e;
        border-radius: 10px;
        padding: 6px 4px;
    }

    .card .card-emoji {
        font-size: 28px;
    }

    .card .card-label {
        font-size: 11px;
        line-height: 1.1;
    }
}

/* PC: Larger cards */
@media (min-width: 1024px) {
    .card {
        border-radius: 12px;
        padding: 8px 4px;
    }

    .card .card-emoji {
        font-size: 32px;
        margin-bottom: 4px;
    }

    .card .card-label {
        font-size: 12px;
    }
}

/* Selected State (Light up with glowing effect) */
.card.selected {
    border-color: #e74c3c;
    background: linear-gradient(135deg, #ffeaa7 0%, #fdcb6e 100%);
    box-shadow: 0 0 15px rgba(231, 76, 60, 0.8),
        0 0 30px rgba(231, 76, 60, 0.4);
    transform: scale(1.1);
    animation: selectedPulse 1.5s ease-in-out infinite;
    z-index: 2;
}

/* Card Vote Count (Group Mode) */
.card-vote-count {
    position: absolute;
    top: 4px;
    right: 4px;
    background: rgba(231, 76, 60, 0.9);
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 3px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    z-index: 2;
}

.card-vote-count .vote-icon {
    font-size: 10px;
}

.card.voted .card-vote-count {
    background: rgba(46, 213, 115, 0.9);
}

@keyframes selectedPulse {
    0% {
        box-shadow:
            0 0 20px rgba(231, 76, 60, 0.8),
            0 0 40px rgba(231, 76, 60, 0.6),
            0 4px 8px rgba(0, 0, 0, 0.3);
    }

    100% {
        box-shadow:
            0 0 30px rgba(231, 76, 60, 1),
            0 0 60px rgba(231, 76, 60, 0.8),
            0 4px 8px rgba(0, 0, 0, 0.3);
    }
}

/* Footer Updates */
.content-area {
    /* Ensure enough space for the fixed footer */
    padding-bottom: 280px;
    /* Increased from default/implicit */
    flex: 1;
    width: 100%;
}

.action-footer {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background-color: rgba(255, 255, 255, 0.95);
    /* Slightly transparent */
    backdrop-filter: blur(10px);
    padding: 12px 16px 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.1);
    z-index: 200;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
}

@media (min-width: 768px) {
    .action-footer {
        max-width: 1200px;
        padding: 16px 24px 24px;
    }
}

.category-toggles {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 12px;
    justify-content: center;
    max-height: none;
    overflow: visible;
}

.toggle-btn {
    padding: 10px 18px;
    border: 2px solid #e0e0e0;
    border-radius: 24px;
    background-color: #ffffff;
    color: #666;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
    white-space: nowrap;
}

.toggle-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.12);
    border-color: #ccc;
}

.toggle-btn.active {
    background: linear-gradient(135deg, #FF6B6B 0%, #FF5252 100%);
    color: #fff;
    border-color: #FF5252;
    box-shadow: 0 4px 12px rgba(255, 107, 107, 0.4);
    transform: translateY(-1px);
}

/* Select All Button - Special Style */
#select-all-btn {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    border-color: #667eea;
    font-weight: 600;
}

#select-all-btn.active {
    background: linear-gradient(135deg, #764ba2, #667eea);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.5);
}

.main-action {
    width: 100%;
    margin-bottom: 8px;
}

.button-group {
    display: flex;
    gap: 6px;
    flex-direction: row;
    width: 100%;
}

.btn-large {
    flex: 1;
    padding: 16px 12px;
    font-size: 16px;
    border-radius: 12px;
    font-weight: 600;
    border: none;
    color: #fff;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 0 rgba(0, 0, 0, 0.2);
}

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

#btn-random {
    background: linear-gradient(135deg, #FF6B6B, #FF4757);
    box-shadow: 0 4px 0 #c0392b;
}

#btn-random:hover {
    background: linear-gradient(135deg, #ff7979, #ff5565);
}

#btn-direct-search {
    background: linear-gradient(135deg, #3498db, #2980b9);
    box-shadow: 0 4px 0 #1c5a85;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1.2;
    padding: 8px 12px;
}

.btn-main-text {
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.btn-helper-text {
    font-size: 11px;
    font-weight: normal;
    opacity: 0.9;
    margin-top: 2px;
}

#btn-direct-search:hover {
    background: linear-gradient(135deg, #5dade2, #3498db);
}

.btn-large:active {
    transform: translateY(4px);
    box-shadow: none;
}

.social-proof {
    font-size: 11px;
    text-align: center;
    color: #aaa;
    background: none;
    padding: 0;
}

/* Header Button */
.header-btn {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: 16px;
}

/* Jump Animation */
@keyframes jump {

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

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

#btn-random {
    animation: jump 0.5s ease-in-out 6;
    /* 0.5s * 6 = 3s */
}

/* Ensure animation doesn't conflict with hover transform if needed, 
   but keyframes usually override unless !important or specific. 
   Actually, transform in keyframes will override the hover transform during animation.
   After animation ends, it returns to normal state.
*/
/* Modal Styles */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.modal.hidden {
    display: none !important;
}

.modal-content {
    background-color: #fff;
    width: 90%;
    max-width: 400px;
    border-radius: 20px;
    padding: 24px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.3s ease;
}

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

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-header h3 {
    font-size: 20px;
    color: var(--text-color);
}

.close-btn {
    background: none;
    border: none;
    font-size: 28px;
    color: #999;
    cursor: pointer;
}

.input-group {
    margin-bottom: 20px;
}

.input-group input {
    width: 100%;
    padding: 12px;
    font-size: 16px;
    border: 2px solid #eee;
    border-radius: 12px;
    text-align: center;
    letter-spacing: 2px;
}

.input-group input:focus {
    border-color: var(--primary-color);
    outline: none;
}

.modal-actions {
    display: flex;
    gap: 12px;
}

.room-info {
    display: flex;
    justify-content: space-between;
    margin-bottom: 16px;
}

.room-badge,
.status-badge {
    background-color: #f0f2f5;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: bold;
    color: #555;
}

.status-badge {
    background-color: #e8f5e9;
    color: #2e7d32;
}

.instruction {
    text-align: center;
    color: #777;
    margin-bottom: 20px;
}

.vote-stats {
    display: flex;
    justify-content: center;
    margin-bottom: 24px;
}

.stat-item {
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 12px;
    color: #999;
}

.stat-value {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-color);
}

/* Vote Badge on Cards */
.vote-badge {
    position: absolute;
    top: 8px;
    background-color: var(--primary-color);
    color: #fff;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
    transform: scale(0);
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.vote-badge.show {
    transform: scale(1);
}

/* Leader Settings Styles */
.settings-panel {
    width: 100%;
    max-width: 500px;
    margin: 0 auto;
}

.setting-section {
    background: #ffffff;
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
    border: 1px solid #e8e8e8;
    transition: all 0.3s ease;
}

.setting-title {
    font-size: 16px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.slider-container {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: #555;
}

.slider-value {
    font-size: 24px;
    font-weight: bold;
    color: var(--primary-color);
    min-width: 40px;
    text-align: center;
}

#btn-confirm-settings {
    width: 100%;
    margin-top: 24px;
}

/* Subtitle Text */
.subtitle-text {
    font-size: 14px;
    color: #7f8c8d;
    font-weight: normal;
    margin-left: 8px;
    vertical-align: middle;
}

@media (max-width: 480px) {
    .subtitle-text {
        display: block;
        margin-left: 0;
        margin-top: 4px;
        font-size: 12px;
    }

    /* Compact Game Type Selection for Mobile */
    #game-type-selection .mode-container {
        padding: 16px 20px;
        max-width: 100%;
        border-radius: 20px;
    }

    #game-type-selection .mode-title {
        font-size: 24px;
        margin-bottom: 4px;
    }

    #game-type-selection .mode-subtitle {
        font-size: 14px;
        margin-bottom: 16px;
    }

    #game-type-selection .setting-section {
        padding: 12px;
        margin-bottom: 12px;
    }

    #game-type-selection .setting-title {
        font-size: 14px;
        margin-bottom: 8px;
    }

    #game-type-selection .slider-container {
        font-size: 12px;
    }

    #game-type-selection .slider-value {
        font-size: 20px;
    }

    #game-type-selection .price-btn {
        padding: 8px 4px;
        font-size: 12px;
        min-width: unset;
        flex: 1;
    }

    #game-type-selection .mode-options {
        flex-direction: row;
        gap: 10px;
    }

    #game-type-selection .mode-btn {
        padding: 16px 8px;
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
    }

    #game-type-selection .mode-icon {
        font-size: 32px;
        margin-bottom: 8px;
    }

    #game-type-selection .mode-name {
        font-size: 16px;
        margin-bottom: 4px;
    }

    #game-type-selection .mode-desc {
        font-size: 11px;
        line-height: 1.2;
    }
}

/* ===== Mode Selection Screen Styles ===== */

/* Animated gradient background */
@keyframes gradientShift {
    0% {
        background-position: 0% 50%;
    }

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

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

.mode-selection-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    padding: 20px;
}

.mode-container {
    width: 100%;
    max-width: 440px;
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    border-radius: 24px;
    padding: 32px 24px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: fadeInUp 0.6s ease-out;
    position: relative;
}

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

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

.mode-title {
    font-size: 32px;
    font-weight: 700;
    text-align: center;
    color: #2c3e50;
    margin-bottom: 8px;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.mode-subtitle {
    font-size: 16px;
    text-align: center;
    color: #7f8c8d;
    margin-bottom: 32px;
    font-weight: 500;
}

.mode-options {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.mode-btn {
    background: linear-gradient(135deg, #ffffff 0%, #f8f9fa 100%);
    border: 2px solid #e0e0e0;
    border-radius: 16px;
    padding: 24px 20px;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    position: relative;
    overflow: hidden;
}

.mode-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

.mode-btn:hover::before {
    left: 100%;
}

.mode-btn:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.mode-btn:active {
    transform: translateY(-1px);
}

.mode-btn-personal {
    border-color: #3498db;
}

.mode-btn-personal:hover {
    background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
    border-color: #2980b9;
}

.mode-btn-personal:hover .mode-icon,
.mode-btn-personal:hover .mode-name,
.mode-btn-personal:hover .mode-desc {
    color: #ffffff;
}

.mode-btn-group {
    border-color: #9b59b6;
}

.mode-btn-group:hover {
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
    border-color: #8e44ad;
}

.mode-btn-group:hover .mode-icon,
.mode-btn-group:hover .mode-name,
.mode-btn-group:hover .mode-desc {
    color: #ffffff;
}

.mode-btn-leader {
    border-color: #f39c12;
}

.mode-btn-leader:hover {
    background: linear-gradient(135deg, #f39c12 0%, #e67e22 100%);
    border-color: #e67e22;
}

.mode-btn-leader:hover .mode-icon,
.mode-btn-leader:hover .mode-name,
.mode-btn-leader:hover .mode-desc {
    color: #ffffff;
}

.mode-btn-member {
    border-color: #1abc9c;
}

.mode-btn-member:hover {
    background: linear-gradient(135deg, #1abc9c 0%, #16a085 100%);
    border-color: #16a085;
}

.mode-btn-member:hover .mode-icon,
.mode-btn-member:hover .mode-name,
.mode-btn-member:hover .mode-desc {
    color: #ffffff;
}

.mode-icon {
    font-size: 48px;
    text-align: center;
    margin-bottom: 12px;
    transition: all 0.3s;
}

.mode-name {
    font-size: 20px;
    font-weight: 700;
    text-align: center;
    color: #2c3e50;
    margin-bottom: 8px;
    transition: all 0.3s;
}

.mode-desc {
    font-size: 14px;
    text-align: center;
    color: #7f8c8d;
    transition: all 0.3s;
}

.back-btn {
    position: absolute;
    top: 16px;
    left: 16px;
    background: rgba(255, 255, 255, 0.9);
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    padding: 8px 16px;
    font-size: 14px;
    font-weight: 600;
    color: #7f8c8d;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.back-btn:hover {
    background: #ffffff;
    color: #2c3e50;
    transform: translateX(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Tablet responsive styles */
@media (min-width: 768px) {
    .mode-container {
        max-width: 600px;
        padding: 48px 40px;
    }

    .mode-title {
        font-size: 40px;
    }

    .mode-subtitle {
        font-size: 18px;
        margin-bottom: 40px;
    }

    .mode-options {
        flex-direction: row;
        gap: 20px;
    }

    .mode-btn {
        flex: 1;
        padding: 32px 24px;
    }

    .mode-icon {
        font-size: 64px;
        margin-bottom: 16px;
    }

    .mode-name {
        font-size: 22px;
        margin-bottom: 10px;
    }

    .mode-desc {
        font-size: 15px;
    }
}

/* PC responsive styles */
@media (min-width: 1024px) {
    .mode-container {
        max-width: 800px;
        padding: 56px 48px;
    }

    .mode-title {
        font-size: 48px;
        margin-bottom: 12px;
    }

    .mode-subtitle {
        font-size: 20px;
        margin-bottom: 48px;
    }

    .mode-options {
        gap: 24px;
    }

    .mode-btn {
        padding: 40px 28px;
    }

    .mode-icon {
        font-size: 72px;
        margin-bottom: 20px;
    }

    .mode-name {
        font-size: 24px;
        margin-bottom: 12px;
    }

    .mode-desc {
        font-size: 16px;
    }

    .back-btn {
        top: 24px;
        left: 24px;
        padding: 10px 20px;
        font-size: 15px;
    }
}

/* ===== Group Info Bar Styles ===== */
.group-info-bar {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 12px 16px;
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.room-info {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.room-label {
    color: rgba(255, 255, 255, 0.9);
    font-size: 14px;
    font-weight: 500;
}

.room-code {
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    padding: 6px 14px;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 2px;
    font-family: 'Courier New', monospace;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.copy-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 14px;
}

.copy-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.copy-btn:active {
    transform: translateY(0);
}

.online-count {
    display: flex;
    align-items: center;
    gap: 6px;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    background: rgba(255, 255, 255, 0.2);
    padding: 6px 12px;
    border-radius: 8px;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.online-count i {
    font-size: 16px;
}

/* ===== Game Mode Selector Styles ===== */
.game-mode-selector {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 20px;
    padding: 8px;
    background: rgba(255, 255, 255, 0.5);
    border-radius: 12px;
}

.game-mode-btn {
    flex: 1;
    max-width: 180px;
    padding: 12px 20px;
    border: 2px solid #e0e0e0;
    border-radius: 12px;
    background: #ffffff;
    color: #666;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.game-mode-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.game-mode-btn.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* ===== Pachinko Game Styles ===== */
.pachinko-container {
    background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 16px;
    padding: 16px;
    box-shadow:
        inset 0 0 30px rgba(0, 0, 0, 0.8),
        0 0 20px rgba(241, 196, 15, 0.5);
    border: 4px solid #f1c40f;
    position: relative;
}

/* Ball Count Selector */
.ball-count-selector {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 12px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    border: 1px solid rgba(241, 196, 15, 0.3);
}

.ball-count-label {
    color: #f1c40f;
    font-size: 14px;
    font-weight: 600;
}

.ball-count-buttons {
    display: flex;
    gap: 6px;
}

.ball-count-btn {
    width: 36px;
    height: 36px;
    border: 2px solid rgba(241, 196, 15, 0.5);
    border-radius: 50%;
    background: rgba(26, 26, 46, 0.8);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
}

.ball-count-btn:hover {
    background: rgba(241, 196, 15, 0.2);
    border-color: #f1c40f;
    transform: scale(1.1);
}

.ball-count-btn.active {
    background: linear-gradient(135deg, #f1c40f 0%, #e67e22 100%);
    border-color: #f39c12;
    color: #1a1a2e;
    box-shadow: 0 0 12px rgba(241, 196, 15, 0.6);
}

/* Modal Ball Selector Styles - Unified Light Theme */
.modal-ball-selector {
    background: #ffffff;
    /* Unified with modal body */
    padding: 15px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
    border-bottom: 1px solid #e2e8f0;
    /* Subtle separator */
    margin-bottom: 0;
    width: 100%;
    animation: fadeIn 0.3s ease-out;
}

.modal-ball-selector.hidden {
    display: none !important;
}

.modal-ball-selector .ball-count-label {
    color: #4a5568;
    /* Dark gray text */
    font-size: 15px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Button overrides for light background */
.modal-ball-selector .ball-count-btn {
    border: 2px solid #cbd5e0;
    background: #fff;
    color: #718096;
    width: 36px;
    height: 36px;
    font-size: 16px;
    font-weight: 600;
}

.modal-ball-selector .ball-count-btn:hover {
    border-color: #f1c40f;
    color: #f1c40f;
    background: #fff;
    transform: translateY(-2px);
}

.modal-ball-selector .ball-count-btn.active {
    background: linear-gradient(135deg, #f1c40f 0%, #e67e22 100%);
    border-color: #f39c12;
    color: #fff;
    box-shadow: 0 4px 10px rgba(241, 196, 15, 0.4);
    transform: scale(1.1);
}

#pachinko-canvas {
    width: 100%;
    height: 500px;
    background: linear-gradient(180deg, #2c3e50 0%, #34495e 100%);
    border-radius: 12px;
    border: 2px solid #34495e;
    display: block;
    margin-bottom: 12px;
}

.pachinko-slots {
    display: flex;
    flex-wrap: nowrap;
    gap: 2px;
    margin-bottom: 12px;
    position: relative;
    z-index: 10;
    width: 100%;
    overflow: hidden;
    /* Hide overflow to ensure it fits exactly */
    padding: 4px 0;
}

.pachinko-slot {
    flex: 1;
    min-width: 0;
    /* Allow shrinking below content size */
    background: rgba(255, 255, 255, 0.15);
    border: 2px solid #f39c12;
    border-radius: 6px;
    padding: 4px 2px;
    text-align: center;
    color: #fff;
    font-size: 10px;
    font-weight: 600;
    min-height: 50px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    transition: all 0.3s;
    position: relative;
    overflow: visible;
    /* Allow badge to pop out */
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) backwards;
}

@keyframes popIn {
    0% {
        opacity: 0;
        transform: scale(0.5) translateY(20px);
    }

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

.slot-hit-badge {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
    border: 2px solid #fff;
    z-index: 20;
    transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.pachinko-slot-icon {
    font-size: 18px;
}

.pachinko-slot-label {
    font-size: 10px;
    line-height: 1.2;
}

.pachinko-slot.active,
.pachinko-slot.selected {
    background: rgba(231, 76, 60, 0.4);
    border-color: #e74c3c;
    box-shadow:
        0 0 20px rgba(231, 76, 60, 0.8),
        inset 0 0 20px rgba(231, 76, 60, 0.4);
}

.pachinko-slot.active {
    animation: slotGlow 0.5s ease-in-out;
}

.pachinko-slot:hover {
    background: rgba(255, 255, 255, 0.2);
    cursor: pointer;
}

@keyframes slotGlow {

    0%,
    100% {
        box-shadow:
            0 0 20px rgba(231, 76, 60, 0.8),
            inset 0 0 20px rgba(231, 76, 60, 0.4);
    }

    50% {
        box-shadow:
            0 0 40px rgba(231, 76, 60, 1),
            inset 0 0 30px rgba(231, 76, 60, 0.6);
    }
}

@keyframes hitAnimation {

    0%,
    100% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(231, 76, 60, 0.8);
    }

    50% {
        transform: scale(1.15);
        box-shadow: 0 0 40px rgba(231, 76, 60, 1),
            0 0 60px rgba(241, 196, 15, 0.8);
    }
}

.pachinko-slot.hit-animation {
    animation: hitAnimation 0.6s ease-in-out 3;
    background: rgba(241, 196, 15, 0.4);
    border-color: #f1c40f;
}

.pachinko-slot.winner {
    background: linear-gradient(135deg, rgba(241, 196, 15, 0.6) 0%, rgba(230, 126, 34, 0.6) 100%);
    border-color: #f1c40f;
    box-shadow: 0 0 20px rgba(241, 196, 15, 0.8), inset 0 0 20px rgba(255, 255, 255, 0.4);
    transform: scale(1.05);
    z-index: 5;
    animation: winnerPulse 1.5s infinite;
}

@keyframes winnerPulse {
    0% {
        transform: scale(1.05);
        box-shadow: 0 0 20px rgba(241, 196, 15, 0.8);
    }

    50% {
        transform: scale(1.1);
        box-shadow: 0 0 40px rgba(241, 196, 15, 1);
    }

    100% {
        transform: scale(1.05);
        box-shadow: 0 0 20px rgba(241, 196, 15, 0.8);
    }
}

/* History Styles */
.pachinko-history {
    display: flex;
    gap: 6px;
    padding: 8px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 8px;
    margin-bottom: 12px;
    overflow-x: auto;
    max-width: 100%;
    min-height: 50px;
}

/* History styles removed */

/* Pachinko Buttons Container */
.pachinko-buttons {
    display: flex;
    gap: 12px;
    width: 100%;
}

.pachinko-buttons .drop-ball-btn {
    flex: 1;
}

.pachinko-search-btn {
    flex: 1;
    padding: 12px 16px;
    background: linear-gradient(135deg, #4fa3d7 0%, #3b8dc5 100%);
    border: none;
    border-radius: 50px;
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 6px 0 #2980b9, 0 10px 20px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    position: relative;
    overflow: hidden;
}

.pachinko-search-btn::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0));
    transform: rotate(45deg);
    pointer-events: none;
}

.pachinko-search-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 0 #2980b9, 0 15px 25px rgba(0, 0, 0, 0.3);
    filter: brightness(1.1);
}

.pachinko-search-btn:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #2980b9, 0 5px 10px rgba(0, 0, 0, 0.2);
}

.pachinko-search-btn .btn-main-text {
    font-size: 18px;
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 8px;
}

.pachinko-search-btn .btn-helper-text {
    font-size: 11px;
    font-weight: 500;
    opacity: 0.9;
}

/* Mobile responsive for pachinko buttons */
@media (max-width: 480px) {
    .pachinko-buttons {
        flex-direction: column;
        gap: 8px;
    }

    .pachinko-search-btn .btn-main-text {
        font-size: 16px;
    }

    .pachinko-search-btn .btn-helper-text {
        font-size: 10px;
    }
}

.drop-ball-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, #ff9966 0%, #ff5e62 100%);
    /* Orange-Red Gradient */
    border: none;
    border-radius: 50px;
    /* Pill shape */
    color: #fff;
    font-size: 20px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 6px 0 #d35400, 0 10px 20px rgba(0, 0, 0, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    text-transform: uppercase;
    letter-spacing: 1px;
    position: relative;
    overflow: hidden;
}

.drop-ball-btn::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: linear-gradient(rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0));
    transform: rotate(45deg);
    pointer-events: none;
}

.drop-ball-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 0 #d35400, 0 15px 25px rgba(0, 0, 0, 0.3);
    filter: brightness(1.1);
}

.drop-ball-btn:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 #d35400, 0 5px 10px rgba(0, 0, 0, 0.2);
}

.drop-ball-btn:disabled {
    background: #95a5a6;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
    filter: grayscale(1);
}

.drop-ball-btn i {
    font-size: 24px;
    animation: none;
    /* Removed bounce to look cleaner */
}

@keyframes ballBounce {

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

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

/* Responsive adjustments for Pachinko */
@media (min-width: 768px) {
    #pachinko-canvas {
        height: 600px;
    }

    .pachinko-slot {
        min-height: 60px;
        padding: 10px 6px;
    }

    .pachinko-slot-icon {
        font-size: 22px;
    }

    .pachinko-slot-label {
        font-size: 11px;
    }
}

@media (min-width: 1024px) {
    #pachinko-canvas {
        height: 700px;
    }

    .pachinko-slot {
        min-height: 70px;
        padding: 12px 8px;
    }

    .pachinko-slot-icon {
        font-size: 26px;
    }

    .pachinko-slot-label {
        font-size: 12px;
    }
}

/* ===== Group Mode Controls ===== */
.group-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    padding: 16px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.mode-toggle-container {
    display: flex;
    background: #f0f2f5;
    padding: 4px;
    border-radius: 12px;
    gap: 4px;
}

.mode-toggle-btn {
    padding: 8px 16px;
    border: none;
    background: transparent;
    border-radius: 8px;
    color: #666;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 8px;
}

.mode-toggle-btn.active {
    background: #fff;
    color: #667eea;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.battle-timer {
    font-size: 48px;
    font-weight: 800;
    color: #ff4757;
    text-shadow: 2px 2px 0px rgba(0, 0, 0, 0.1);
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.1);
    }

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

.group-actions {
    display: flex;
    gap: 12px;
    width: 100%;
    justify-content: center;
}

.action-btn {
    flex: 1;
    max-width: 200px;
    padding: 12px;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    transition: all 0.2s;
}

.primary-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.primary-btn:active {
    transform: translateY(0);
}

/* ===== Group Mode Specifics ===== */
body.group-mode .action-footer {
    display: none !important;
}

body.group-mode .app-container {
    padding-bottom: 20px;
    /* Reset padding since footer is gone */
}

/* Instruction Modal */
.instruction-body {
    text-align: left;
    margin: 20px 0;
    padding: 16px;
    background: #f8f9fa;
    border-radius: 12px;
}

.instr-section h4 {
    color: #667eea;
    margin-bottom: 12px;
    font-size: 18px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.instr-section p {
    margin-bottom: 8px;
    color: #555;
    line-height: 1.5;
}

.full-width {
    width: 100%;
}

/* Combo Display */
.combo-display {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 48px;
    font-weight: 900;
    color: #ffd700;
    text-shadow: 3px 3px 0px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    pointer-events: none;
}

.combo-display.pulse {
    animation: comboPulse 0.2s ease-out;
}

@keyframes comboPulse {
    0% {
        transform: translate(-50%, -50%) scale(1);
    }

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

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

.combo-num {
    font-size: 72px;
    color: #ff6b6b;
}

/* Floating Number */
.floating-number {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 24px;
    font-weight: 700;
    color: #4ecdc4;
    animation: floatUp 0.8s ease-out forwards;
    pointer-events: none;
    z-index: 100;
}

@keyframes floatUp {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) translateY(0);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50%) translateY(-50px);
    }
}

/* Clicked Card Effect */
.category-card.clicked {
    transform: scale(0.95);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.8);
}

/* ===== Mobile RWD Improvements ===== */
@media (max-width: 768px) {

    /* Larger touch targets for mobile */
    .mode-btn {
        min-height: 140px;
        padding: 24px;
    }

    .mode-icon {
        font-size: 56px;
        margin-bottom: 12px;
    }

    .mode-name {
        font-size: 20px;
        margin-bottom: 6px;
    }

    .mode-desc {
        font-size: 14px;
    }

    /* Larger price buttons on mobile */
    .price-btn {
        min-width: 80px;
        padding: 16px 18px;
        font-size: 18px;
        min-height: 52px;
    }

    /* Larger slider */
    .game-slider {
        height: 8px;
    }

    .slider-value {
        font-size: 28px;
    }

    /* Settings sections spacing */
    .setting-section {
        margin-bottom: 24px;
    }

    .setting-title {
        font-size: 18px;
        margin-bottom: 12px;
    }

    /* Back button larger */
    .back-btn {
        padding: 12px 20px;
        font-size: 16px;
    }

    /* Category toggles larger */
    .toggle-btn {
        padding: 12px 18px;
        font-size: 15px;
        min-height: 48px;
    }
}

/* ===== Group Mode UI Improvements ===== */

/* Prevent text selection on fast clicks */
.category-card,
.mode-btn,
.price-btn,
.toggle-btn,
.action-btn {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

/* Room Info Button (replaces group-btn) */
.room-info-btn {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s;
}

.room-info-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: translateY(-50%) scale(1.05);
}

/* Start Battle Button (in header) */
.start-battle-btn {
    position: absolute;
    right: 60px;
    top: 50%;
    transform: translateY(-50%);
    padding: 10px 20px;
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    border: none;
    border-radius: 25px;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s;
    box-shadow: 0 4px 12px rgba(245, 87, 108, 0.4);
    display: flex;
    align-items: center;
    gap: 6px;
}

.start-battle-btn:hover {
    transform: translateY(-50%) scale(1.05);
    box-shadow: 0 6px 16px rgba(245, 87, 108, 0.5);
}

.start-battle-btn:active {
    transform: translateY(-50%) scale(0.98);
}

/* Room Info Modal */
.room-info-body {
    padding: 20px 0;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 0;
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.info-row:last-child {
    border-bottom: none;
}

.info-label {
    font-size: 16px;
    color: #666;
    font-weight: 600;
}

.info-value {
    font-size: 18px;
    color: #333;
    font-weight: 700;
}

.modal-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
}

.modal-actions .primary-btn {
    flex: 1;
    padding: 12px 16px;
    font-size: 14px;
}

/* Battle Timer Overlay */
.battle-timer-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    pointer-events: none;
}

.battle-timer-display {
    background: linear-gradient(135deg, #ff6b6b 0%, #ff4757 100%);
    border-radius: 50%;
    width: 150px;
    height: 150px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px rgba(255, 71, 87, 0.5);
    animation: timerPulse 1s infinite;
}

.battle-timer-display span {
    font-size: 72px;
    font-weight: 900;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.2);
}

@keyframes timerPulse {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

/* Submit Vote Button (floating) */
.submit-vote-btn {
    position: fixed;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    padding: 16px 32px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 30px;
    color: #fff;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    z-index: 1000;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.3s;
}

.submit-vote-btn:hover {
    transform: translateX(-50%) scale(1.05);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.5);
}

.submit-vote-btn:active {
    transform: translateX(-50%) scale(0.98);
}

/* Hide footer buttons in group mode */
body.group-mode .main-action {
    display: none !important;
}

/* === Modal Filter Styles === */
.category-filter-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: none;
    align-items: flex-end;
    justify-content: center;
}

.category-filter-modal.show {
    display: flex !important;
}

.modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    animation: fadeIn 0.2s ease-out;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

.modal-panel {
    position: relative;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    border-radius: 24px 24px 0 0;
    max-width: 480px;
    width: 100%;
    max-height: 75vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.2);
    animation: slideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
        opacity: 0;
    }

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

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 20px 16px 20px;
    border-bottom: 2px solid #e9ecef;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 24px 24px 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header h3 i {
    font-size: 22px;
}

.modal-close {
    background: rgba(255, 255, 255, 0.25);
    border: none;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    color: #fff;
    font-size: 18px;
}

.modal-close:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: scale(1.1) rotate(90deg);
}

.modal-close:active {
    transform: scale(0.95) rotate(90deg);
}

.modal-body {
    padding: 24px 16px;
    overflow-y: auto;
    flex: 1;
}

/* Scrollbar styling */
.modal-body::-webkit-scrollbar {
    width: 6px;
}

.modal-body::-webkit-scrollbar-track {
    background: #f1f3f5;
    border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb {
    background: #adb5bd;
    border-radius: 3px;
}

.modal-body::-webkit-scrollbar-thumb:hover {
    background: #868e96;
}

/* Category Filter Toggle Button */
.category-filter-toggle {
    width: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    border-radius: 16px;
    padding: 16px 20px;
    color: #fff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.35);
    transition: all 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    margin-bottom: 12px;
    position: relative;
    overflow: hidden;
}

.category-filter-toggle::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 100%);
    opacity: 0;
    transition: opacity 0.3s;
}

.category-filter-toggle:hover::before {
    opacity: 1;
}

.category-filter-toggle:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(102, 126, 234, 0.45);
}

.category-filter-toggle:active {
    transform: translateY(0);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.35);
}

.category-filter-toggle i:first-child {
    margin-right: 10px;
    font-size: 16px;
}

.category-filter-toggle .toggle-icon {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
    font-size: 14px;
}

.category-filter-toggle:hover .toggle-icon {
    transform: translateY(2px);
}

.btn-helper {
    display: block;
    font-size: 11px;
    font-weight: 400;
    opacity: 0.8;
    margin-top: 2px;
}

.content-area {
    padding-bottom: 220px;
}

/* Game Rules Modal Styles - Enhanced Design */
#game-rules-modal {
    z-index: 10000;
}

#game-rules-modal::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

#game-rules-modal .modal-content {
    max-width: 420px;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    max-height: 85vh;
    border-radius: 24px;
    box-shadow:
        0 25px 50px -12px rgba(0, 0, 0, 0.5),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    position: relative;
    animation: modalSlideIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes modalSlideIn {
    0% {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }

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

#game-rules-modal .modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 24px 28px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: white;
    position: relative;
    overflow: hidden;
}

#game-rules-modal .modal-header::before {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.1) 0%, transparent 70%);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {

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

    50% {
        transform: translateX(30%) translateY(30%);
    }
}

#game-rules-modal .modal-title {
    margin: 0;
    font-size: 22px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    z-index: 1;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

#game-rules-modal .close-btn {
    background: rgba(255, 255, 255, 0.2);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    font-size: 22px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    z-index: 1;
}

#game-rules-modal .close-btn:hover {
    background: rgba(255, 255, 255, 0.35);
    transform: rotate(90deg) scale(1.1);
}

#game-rules-modal .instruction-body {
    padding: 28px;
    overflow-y: auto;
    flex: 1;
    background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
}

#game-rules-modal .instr-section {
    margin-bottom: 20px;
    background: #ffffff;
    padding: 20px;
    border-radius: 16px;
    border-left: 5px solid #667eea;
    box-shadow:
        0 4px 6px -1px rgba(0, 0, 0, 0.1),
        0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
}

#game-rules-modal .instr-section::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 50%, #667eea 100%);
    opacity: 0;
    transition: opacity 0.3s;
}

#game-rules-modal .instr-section:hover {
    transform: translateY(-2px);
    box-shadow:
        0 10px 15px -3px rgba(0, 0, 0, 0.1),
        0 4px 6px -2px rgba(0, 0, 0, 0.05);
}

#game-rules-modal .instr-section:hover::before {
    opacity: 1;
}

#game-rules-modal .instr-section:last-child {
    margin-bottom: 0;
}

#game-rules-modal .instr-section h4 {
    margin: 0 0 14px 0;
    color: #2c3e50;
    font-size: 17px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
}

#game-rules-modal .instr-section h4 i {
    color: #667eea;
    font-size: 20px;
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15) 0%, rgba(118, 75, 162, 0.15) 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

#game-rules-modal .instr-section p {
    margin: 0 0 10px 0;
    color: #4a5568;
    font-size: 15px;
    line-height: 1.6;
    padding-left: 42px;
}

#game-rules-modal .instr-section p:last-child {
    margin-bottom: 0;
}

#game-rules-modal .instr-section p strong {
    color: #667eea;
    font-weight: 600;
}

#game-rules-modal #btn-close-rules {
    margin: 0 28px 28px 28px;
    width: calc(100% - 56px);
    padding: 16px 24px;
    font-size: 16px;
    font-weight: 700;
    border-radius: 14px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    color: white;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    position: relative;
    overflow: hidden;
}

#game-rules-modal #btn-close-rules::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transition: left 0.5s;
}

#game-rules-modal #btn-close-rules:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
}

#game-rules-modal #btn-close-rules:hover::before {
    left: 100%;
}

#game-rules-modal #btn-close-rules:active {
    transform: translateY(0);
    box-shadow: 0 2px 10px rgba(102, 126, 234, 0.4);
}

/* View Rules Button in Header */
.icon-btn {
    background: transparent;
    border: none;
    color: #667eea;
    font-size: 24px;
    cursor: pointer;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.icon-btn:hover {
    background: rgba(102, 126, 234, 0.1);
    transform: scale(1.1);
}

.icon-btn:active {
    transform: scale(0.95);
}