@import url('https://fonts.googleapis.com/css2?family=Titan+One&display=swap');

/* ===== MOBILE-FIRST RESPONSIVE CSS COMPLETE REDESIGN ===== */

/* CSS Custom Properties */
:root {
    /* OFFICIAL UNO Colors - authentic palette matching official cards */
    --card-blue: #1E5AA8;
    --card-green: #00A651;
    --card-red: #E31E25;
    --card-yellow: #FFE619;
    --card-black: #2C2C2C;
    --card-white: #FFFFFF;
    --bg-primary: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --bg-secondary: rgba(255, 255, 255, 0.1);
    --text-primary: #ffffff;
    --text-secondary: #e0e0e0;
    --shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    --radius: 12px;
    --transition: all 0.3s ease;
}

/* === RESET & BASE STYLES (MOBILE-FIRST) === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

*:focus {
    outline: 2px solid var(--card-yellow);
    outline-offset: 2px;
}

html {
    font-size: 14px; /* Mobile base font size */
    height: 100%;
}

body {
    font-family: 'Titan One', cursive;
    background: var(--bg-primary);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
    -webkit-text-size-adjust: 100%;
    -webkit-user-select: none;
    user-select: none;
}

/* === MOBILE-FIRST BUTTON STYLES === */
button {
    font-family: 'Titan One', cursive;
    border: none;
    border-radius: var(--radius);
    background: var(--card-green);
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
    font-size: 1rem;
    padding: 0.875rem 1.5rem;
    min-height: 48px;
    min-width: 100px;
    box-shadow: var(--shadow);
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

button:hover, button:focus {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

button:active {
    transform: translateY(0);
}

button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

input[type="text"] {
    font-family: 'Titan One', cursive;
    border: none;
    border-radius: var(--radius);
    padding: 1rem;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
    transition: var(--transition);
    min-height: 48px;
    width: 100%;
}

input[type="text"]:focus {
    background: rgba(255, 255, 255, 1);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1), 0 0 0 2px var(--card-yellow);
}

/* === MOBILE LAYOUT UTILITIES === */
.mobile-container {
    width: 100vw;
    height: 100vh;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    overscroll-behavior: contain;
}

.mobile-header {
    flex-shrink: 0;
    margin-bottom: 1rem;
}

.mobile-content {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    overscroll-behavior: contain;
}

.mobile-footer {
    flex-shrink: 0;
    margin-top: 1rem;
}

/* === MENU SCREEN === */
#menu-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.menu-container {
    text-align: center;
    padding: 2rem 1rem;
    width: 100%;
    max-width: 400px;
}

.title {
    font-size: 3rem;
    margin-bottom: 2rem;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
    color: var(--card-yellow);
}

#play {
    font-size: 1.5rem;
    padding: 1.25rem 2rem;
    margin: 1rem auto;
    width: 80%;
    max-width: 200px;
}

.menu-footer {
    margin-top: 2rem;
    font-size: 0.8rem;
    opacity: 0.8;
}

.menu-footer a {
    color: var(--card-yellow);
    text-decoration: none;
}

.loading-container {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.2rem;
    z-index: 1001;
}

/* === GAMES CONTAINER (MOBILE-FIRST) === */
#games-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: none;
    flex-direction: column;
    background: var(--bg-primary);
    z-index: 100;
}

.head {
    flex-shrink: 0;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.head > div {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.head > div:nth-child(2) {
    display: none; /* Hide separator line on mobile */
}

.create-room {
    flex: 1;
    background: var(--card-green);
}

.room-code {
    flex: 2;
}

.join-room {
    flex: 1;
    background: var(--card-blue);
}

/* === BOT MODE SECTION === */
.bot-mode-section {
    background: linear-gradient(135deg, rgba(138, 43, 226, 0.2) 0%, rgba(75, 0, 130, 0.2) 100%);
    border: 1px solid rgba(138, 43, 226, 0.3);
    border-radius: 12px;
    margin: 1rem;
    padding: 1rem;
}

.bot-mode-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.bot-mode-header i {
    font-size: 1.5rem;
    color: #9b59b6;
}

.bot-mode-header span {
    font-size: 1.1rem;
    font-weight: bold;
    color: white;
}

.bot-mode-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.bot-difficulty-select {
    display: flex;
    gap: 0.5rem;
}

.bot-difficulty-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    padding: 0.75rem 0.5rem;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid transparent;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.7);
    cursor: pointer;
    transition: all 0.2s ease;
}

.bot-difficulty-btn i {
    font-size: 1.5rem;
}

.bot-difficulty-btn span {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bot-difficulty-btn:hover {
    background: rgba(255, 255, 255, 0.12);
    color: white;
}

.bot-difficulty-btn.active,
.bot-difficulty-btn.selected {
    border-color: currentColor;
    background: rgba(255, 255, 255, 0.15);
    color: white;
}

.bot-difficulty-btn[data-difficulty="easy"] {
    --btn-color: var(--card-green);
}

.bot-difficulty-btn[data-difficulty="easy"].selected {
    border-color: var(--card-green);
    color: var(--card-green);
    background: rgba(0, 166, 81, 0.2);
}

.bot-difficulty-btn[data-difficulty="medium"] {
    --btn-color: var(--card-yellow);
}

.bot-difficulty-btn[data-difficulty="medium"].selected {
    border-color: var(--card-yellow);
    color: var(--card-yellow);
    background: rgba(255, 205, 0, 0.2);
}

.bot-difficulty-btn[data-difficulty="hard"] {
    --btn-color: var(--card-red);
}

.bot-difficulty-btn[data-difficulty="hard"].selected {
    border-color: var(--card-red);
    color: var(--card-red);
    background: rgba(237, 28, 36, 0.2);
}

.bot-count-select {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.5rem 0;
}

.bot-count-select label {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.8);
    white-space: nowrap;
    min-width: 70px;
}

.bot-count-select .bot-count-value {
    color: var(--card-yellow);
    font-weight: bold;
}

.bot-count-slider {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.15);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    cursor: pointer;
    outline: none;
    border: none;
}

.bot-count-slider::-webkit-slider-runnable-track {
    height: 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.15);
}

.bot-count-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    margin-top: -7px;
    border: 2px solid white;
    transition: transform 0.15s ease;
}

.bot-count-slider::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.bot-count-slider::-moz-range-track {
    height: 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.15);
    border: none;
}

.bot-count-slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: linear-gradient(135deg, #9b59b6, #8e44ad);
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    border: 2px solid white;
}

.bot-count-slider::-moz-range-thumb:hover {
    transform: scale(1.1);
}

.bot-timer-select {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.bot-timer-select label {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.bot-timer-select label i {
    color: #9b59b6;
}

.bot-turn-timer {
    flex: 1;
    padding: 0.5rem 0.75rem;
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.3);
    color: white;
    font-family: 'Titan One', cursive;
    font-size: 0.85rem;
}

.bot-rules-toggle {
    margin-top: 0.25rem;
}

.toggle-bot-rules {
    width: 100%;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    padding: 0.6rem 0.75rem;
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    color: rgba(255, 255, 255, 0.8);
}

.toggle-bot-rules i:first-child {
    margin-right: 0.5rem;
    color: #9b59b6;
}

.toggle-bot-rules .fa-chevron-down {
    transition: transform 0.2s ease;
}

.toggle-bot-rules.active .fa-chevron-down {
    transform: rotate(180deg);
}

.bot-house-rules {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 0 0 var(--radius) var(--radius);
    margin-top: -1px;
}

.bot-rule-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.8);
    cursor: pointer;
    padding: 0.4rem;
    border-radius: 6px;
    transition: background 0.2s ease;
}

.bot-rule-option:hover {
    background: rgba(255, 255, 255, 0.1);
}

.bot-rule-option input[type="checkbox"] {
    display: none;
}

.bot-rule-option .rule-mark {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.bot-rule-option input[type="checkbox"]:checked + .rule-mark {
    background: #9b59b6;
    border-color: #9b59b6;
}

.bot-rule-option input[type="checkbox"]:checked + .rule-mark::after {
    content: "\f00c";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    font-size: 0.65rem;
    color: white;
}

.start-bot-game {
    width: 100%;
    padding: 0.875rem;
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
    border: none;
    border-radius: 10px;
    color: white;
    font-family: 'Titan One', cursive;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
    box-shadow: 0 4px 15px rgba(155, 89, 182, 0.3);
}

.start-bot-game:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(155, 89, 182, 0.4);
}

.start-bot-game:active {
    transform: translateY(0);
}

.start-bot-game:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Bot Result Modal */
.bot-result-content {
    text-align: center;
    max-width: 380px;
    padding: 0;
    overflow: hidden;
}

.bot-result-content.win .bot-result-header {
    background: linear-gradient(135deg, #f1c40f 0%, #f39c12 100%);
}

.bot-result-content.lose .bot-result-header {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
}

.bot-result-header {
    padding: 2rem 1.5rem;
    color: white;
}

.bot-result-header i {
    font-size: 3rem;
    margin-bottom: 0.75rem;
    display: block;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
}

.bot-result-header h2 {
    margin: 0;
    font-size: 1.8rem;
    font-weight: 700;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.bot-result-body {
    padding: 1.5rem;
    background: #2c2c2c;
}

.bot-result-body .winner-text {
    font-size: 1.2rem;
    color: #fff;
    margin: 0 0 1.5rem 0;
}

.bot-result-stats {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
    padding: 1rem;
}

.bot-result-stats .stat-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
}

.bot-result-stats .stat-row:last-child {
    border-bottom: none;
}

.bot-result-stats .difficulty-easy {
    color: #2ecc71;
    font-weight: 600;
}

.bot-result-stats .difficulty-medium {
    color: #f39c12;
    font-weight: 600;
}

.bot-result-stats .difficulty-hard {
    color: #e74c3c;
    font-weight: 600;
}

.bot-result-actions {
    padding: 1.5rem;
    background: #252525;
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.bot-result-actions button {
    padding: 0.8rem 1.5rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-play-again {
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
    color: white;
}

.btn-play-again:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(155, 89, 182, 0.4);
}

.btn-back-menu {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.8);
}

.btn-back-menu:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Room List Header */
.room-list-header {
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.room-list-header span {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.room-list-header i {
    color: var(--card-blue);
}

/* Bot player indicator in game */
.player-info.bot-player .player-name::after {
    content: ' (Bot)';
    font-size: 0.7em;
    color: #9b59b6;
    margin-left: 0.25rem;
}

.player-info.bot-player {
    border-left: 3px solid #9b59b6;
}

.room-list {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    min-height: 0; /* Important for flex child to scroll */
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    overscroll-behavior: contain;
}

.room-item {
    background: var(--bg-secondary);
    backdrop-filter: blur(10px);
    border-radius: var(--radius);
    padding: 1rem;
    margin: 0.5rem 0;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    justify-content: space-between;
    align-items: center;
    min-height: 60px;
    border: 2px solid transparent;
}

.room-item:hover, .room-item:focus {
    background: rgba(255, 255, 255, 0.2);
    border-color: var(--card-yellow);
    transform: translateY(-1px);
}

.room-item-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.room-item-name {
    font-size: 1rem;
    font-weight: bold;
}

.room-item-details {
    font-size: 0.8rem;
    opacity: 0.8;
}

.footer {
    flex-shrink: 0;
    padding: 1rem;
}

.refresh {
    width: 100%;
    background: var(--card-blue);
}

/* === NICKNAME MODAL === */
#nickname {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-primary);
    backdrop-filter: blur(20px);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    z-index: 2000;
    width: 90vw;
    max-width: 400px;
    display: none;
}

#nickname > div {
    margin: 1rem 0;
}

.room-settings {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    cursor: pointer;
    font-size: 0.9rem;
}

.option input[type="checkbox"] {
    width: auto;
    min-height: auto;
}

.continue {
    width: 100%;
    background: var(--card-green);
    font-size: 1.1rem;
}

/* === CANCEL BUTTON === */
.cancel {
    position: fixed;
    top: 1rem;
    right: 1rem;
    width: 40px;
    height: 40px;
    background: var(--card-red);
    color: white;
    border: none;
    border-radius: 50%;
    font-size: 1.5rem;
    cursor: pointer;
    display: none;
    text-align: center;
    line-height: 36px;
    z-index: 2001;
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.cancel:hover {
    transform: scale(1.1);
}

/* === LIMBO SCREEN === */
#limbo {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-primary);
    backdrop-filter: blur(20px);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    z-index: 1500;
    width: 90vw;
    max-width: 500px;
    display: none;
}

.code {
    text-align: center;
    margin-bottom: 1rem;
    font-size: 1.2rem;
}

.code a {
    color: var(--card-yellow);
    text-decoration: none;
    font-weight: bold;
    font-size: 1.5rem;
}

.limbo-player-list {
    margin: 1rem 0;
    min-height: 100px;
    max-height: 40vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    overscroll-behavior: contain;
}

.limbo-player-item {
    background: var(--bg-secondary);
    padding: 0.75rem;
    margin: 0.5rem 0;
    border-radius: var(--radius);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    transition: var(--transition);
}

.limbo-player-item:hover {
    background: rgba(255, 255, 255, 0.2);
}

.limbo-admin {
    text-align: center;
    margin-top: 1rem;
}

.limbo-start {
    width: 100%;
    background: var(--card-green);
    font-size: 1.1rem;
}

/* === GAME OVERLAY === */
#overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    display: none;
    background: var(--bg-primary);
    z-index: 500;
}

/* === CIRCULAR PLAYER LAYOUT === */
/* Current player - always at bottom center */
.player.you {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 700px;
    z-index: 100;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    padding: 0.75rem;
    border-radius: var(--radius) var(--radius) 0 0;
    max-height: 180px;
    overflow-x: auto;
    overflow-y: hidden;
}

.player.you .my-cards {
    justify-content: center;
    min-height: auto;
    padding: 0.25rem;
}

.player.you .my-card {
    width: 55px;
    height: 85px;
    font-size: 42px;
    margin: 0 -10px;
}

.player.you .my-card:hover {
    transform: translateY(-12px) scale(1.08);
    margin: 0 2px;
}

/* Opponent base styles */
.player.opponent {
    position: fixed;
    z-index: 50;
}

.player.opponent .player-nickname {
    background: rgba(0, 0, 0, 0.6);
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.85rem;
    white-space: nowrap;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.player.opponent .player-nickname .card-count {
    background: var(--card-yellow);
    color: #1a1a2e;
    padding: 0.15rem 0.4rem;
    border-radius: 10px;
    font-size: 0.75rem;
    font-weight: bold;
}

.player.opponent .my-cards {
    display: flex;
    justify-content: center;
}

.player.opponent .my-card {
    width: 35px;
    height: 54px;
    font-size: 28px;
    margin: 0 -12px;
}

/* 2 Players: Opponent at top center */
.player.num-2-1 {
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
}

/* 3 Players: Opponents at top-left and top-right */
.player.num-3-1 {
    top: 15%;
    left: 10%;
    text-align: left;
}

.player.num-3-2 {
    top: 15%;
    right: 10%;
    text-align: right;
}

/* 4 Players: Top center, left, right */
.player.num-4-1 {
    top: 5%;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
}

.player.num-4-2 {
    top: 40%;
    left: 5%;
    transform: translateY(-50%);
    text-align: left;
}

.player.num-4-3 {
    top: 40%;
    right: 5%;
    transform: translateY(-50%);
    text-align: right;
}

/* 5+ Players positioning */
.player.num-5-1,
.player.num-6-1,
.player.num-7-1,
.player.num-8-1 {
    top: 5%;
    left: 30%;
    text-align: center;
}

.player.num-5-2,
.player.num-6-2,
.player.num-7-2,
.player.num-8-2 {
    top: 5%;
    right: 30%;
    text-align: center;
}

.player.num-5-3,
.player.num-6-3,
.player.num-7-3,
.player.num-8-3 {
    top: 35%;
    left: 3%;
    text-align: left;
}

.player.num-5-4,
.player.num-6-4,
.player.num-7-4,
.player.num-8-4 {
    top: 35%;
    right: 3%;
    text-align: right;
}

.player.num-6-5,
.player.num-7-5,
.player.num-8-5 {
    top: 55%;
    left: 3%;
    text-align: left;
}

.player.num-7-6,
.player.num-8-6 {
    top: 55%;
    right: 3%;
    text-align: right;
}

.player.num-8-7 {
    top: 5%;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
}

/* === TURN INDICATORS === */
/* Current player's turn - glow effect on their area */
.player.you.has-turn {
    box-shadow: 0 0 30px rgba(76, 175, 80, 0.6), inset 0 0 20px rgba(76, 175, 80, 0.1);
    border: 2px solid rgba(76, 175, 80, 0.6);
    animation: myTurnPulse 2s ease-in-out infinite;
}

.player.you.has-turn::before {
    content: "YOUR TURN";
    position: fixed;
    top: -35px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #4caf50, #43a047);
    color: white;
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: bold;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
    animation: turnBadgePulse 1.5s ease-in-out infinite;
    z-index: 200;
}

@keyframes myTurnPulse {
    0%, 100% { box-shadow: 0 0 30px rgba(76, 175, 80, 0.6), inset 0 0 20px rgba(76, 175, 80, 0.1); }
    50% { box-shadow: 0 0 50px rgba(76, 175, 80, 0.8), inset 0 0 30px rgba(76, 175, 80, 0.15); }
}

@keyframes turnBadgePulse {
    0%, 100% { transform: translateX(-50%) scale(1); }
    50% { transform: translateX(-50%) scale(1.05); }
}

/* Turn indicator on nickname (legacy support) */
.player-nickname a.turn {
    color: #4caf50 !important;
    text-shadow: 0 0 10px rgba(76, 175, 80, 0.8);
}

/* Opponent's turn indicator */
.player.opponent.has-turn .player-nickname {
    background: linear-gradient(135deg, rgba(76, 175, 80, 0.9), rgba(67, 160, 71, 0.9));
    box-shadow: 0 0 20px rgba(76, 175, 80, 0.6);
    animation: opponentTurnPulse 1.5s ease-in-out infinite;
    color: #fff !important;
}

.player.opponent.has-turn .player-nickname a {
    color: #fff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.player.opponent.has-turn .player-nickname .card-count {
    background: #fff;
    color: #2e7d32;
}

.player.opponent.has-turn .player-nickname::before {
    content: "\f04b";
    font-family: "Font Awesome 6 Free";
    font-weight: 900;
    margin-right: 0.4rem;
    font-size: 0.7rem;
    color: #fff;
}

.player.opponent.has-turn .my-cards .my-card {
    box-shadow: 0 0 15px rgba(76, 175, 80, 0.8), 0 4px 8px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(76, 175, 80, 0.6);
}

/* Waiting state for players not in turn */
.player.opponent:not(.has-turn) .player-nickname {
    opacity: 0.7;
}

@keyframes opponentTurnPulse {
    0%, 100% {
        box-shadow: 0 0 20px rgba(76, 175, 80, 0.6);
        transform: scale(1);
    }
    50% {
        box-shadow: 0 0 35px rgba(76, 175, 80, 0.8);
        transform: scale(1.02);
    }
}

/* Mobile adjustments for player layout */
@media screen and (max-width: 600px) {
    .player.opponent .my-card {
        width: 28px;
        height: 43px;
        font-size: 22px;
        margin: 0 -10px;
    }

    .player.opponent .player-nickname {
        font-size: 0.75rem;
        padding: 0.3rem 0.6rem;
    }

    .player.num-4-2,
    .player.num-4-3 {
        top: 30%;
    }

    .player.num-5-3,
    .player.num-6-3,
    .player.num-7-3,
    .player.num-8-3,
    .player.num-5-4,
    .player.num-6-4,
    .player.num-7-4,
    .player.num-8-4 {
        top: 25%;
    }

    .player.num-6-5,
    .player.num-7-5,
    .player.num-8-5,
    .player.num-7-6,
    .player.num-8-6 {
        top: 45%;
    }
}

/* Game Control Buttons */
.leave-game-container,
.end-turn-container {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 600;
}

.end-turn-container {
    bottom: 1rem;
    top: auto;
}

.leave-game-btn,
.end-turn-btn {
    padding: 0.75rem 1rem;
    font-size: 0.9rem;
    min-height: 44px;
}

.leave-game-btn {
    background: var(--card-red);
}

.end-turn-btn {
    background: var(--card-green);
}

/* Game Center Area */
.center {
    position: fixed;
    top: 45%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
    padding: 1rem;
    z-index: 10;
}

.center .my-card {
    width: 70px;
    height: 108px;
    font-size: 55px;
}

.deck,
.center-card {
    flex-shrink: 0;
}

/* Player Area - additional styling (positioning is above) */

.player-nickname {
    text-align: center;
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
    color: var(--card-yellow);
}

.my-cards {
    display: flex;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    overflow-x: auto;
    padding: 0.5rem;
    min-height: 100px; /* Ensure enough space for cards */
    text-align: center; /* Center the inline-table cards */
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
    overscroll-behavior: contain;
}

/* === AUTHENTIC UNO CARD STYLES (MOBILE-OPTIMIZED) === */
.my-card * {
    user-select: none;
}

.my-card {
    width: 60px;
    height: 92px;
    display: inline-table;
    background: #fff;
    border-radius: 5px;
    box-sizing: border-box;
    padding: 3px;
    margin: 0 -8px; /* Mobile optimized overlap */
    font-family: 'Source Sans Pro', sans-serif;
    font-size: 48px; /* Scaled down for mobile */
    text-shadow:
        0.5px 0.5px 0 #000000,
        -0.5px -0.5px 0 #000000,
        -0.5px 0.5px 0 #000000,
        0.5px -0.5px 0 #000000,
        0.5px 0 0 #000000,
        -0.5px 0 0 #000000,
        0 -0.5px 0 #000000,
        0 0.5px 0 #000000,
        2px 2px 0 #000000;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    text-align: center;
    position: relative;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
    vertical-align: top;
}

.my-card:hover,
.my-card:focus {
    transform: translateY(-8px) scale(1.05);
    z-index: 10;
    margin: 0 4px; /* Remove overlap on hover */
}

.my-card.touch-active {
    transform: translateY(-4px) scale(1.02);
    z-index: 10;
    margin: 0 2px;
}

.my-card .inner {
    display: table-cell;
    vertical-align: middle;
    border-radius: 5px;
    overflow: hidden;
}

.my-card .mark {
    display: inline-block;
    vertical-align: middle;
    background: #ffffff;
    margin: auto;
    padding: 0 12px; /* Scaled for mobile */
    border-radius: 50px 30px / 60px 30px; /* Scaled for mobile */
    line-height: 1.2;
}

.my-card .mark.default {
    padding: 18px 0; /* Scaled for mobile */
    background: #c62437;
}

.my-card .mark.default .uno-default {
    transform: rotate(336deg);
    font-size: 25%; /* Scaled for mobile */
    color: #ebce2c;
}

.num-plus4 .inner .mark,
.num-plus2 .inner .mark {
    padding: 0 4px; /* Scaled for mobile */
}

.num-block .inner .mark {
    font-size: 70%;
    padding: 10px 2px; /* Scaled for mobile */
}

.num-reverse .inner .mark {
    padding: 0 5px; /* Scaled for mobile */
}

.my-card .change {
    width: 43px; /* Scaled for mobile */
    height: 65px; /* Scaled for mobile */
    border-radius: 50%;
    transform: skewX(345deg);
    overflow: hidden;
    font-size: 0px;
    border: 1px solid white; /* Scaled for mobile */
}

.my-card .change .segment {
    width: 21px; /* Scaled for mobile */
    height: 32px; /* Scaled for mobile */
    display: inline-block;
}

.num-change .mark {
    padding: 4px 2px; /* Scaled for mobile */
}

.my-card:before,
.my-card:after {
    display: inline-block;
    position: fixed;
    line-height: 0;
    font-size: 10px;
    color: #ffffff;
    text-shadow: 1px 1px 0 #000000;
}
.my-card:before {
    top: 8px;
    left: 5px;
}

.my-card:after {
    bottom: 8px;
    right: 5px;
    transform: rotate(180deg);
}

/* Card Colors */
.my-card.blue {
    color: var(--card-blue);
}

.my-card.blue .inner,
.segment.blue {
    background: var(--card-blue);
}

.my-card.green {
    color: var(--card-green);
}

.my-card.green .inner,
.segment.green {
    background: var(--card-green);
}

.my-card.red {
    color: var(--card-red);
}

.my-card.red .inner,
.segment.red {
    background: var(--card-red);
}

.my-card.yellow {
    color: var(--card-yellow);
}

.my-card.yellow .inner,
.segment.yellow {
    background: var(--card-yellow);
}

.my-card.black {
    color: #000;
}

.my-card.black .inner {
    background-color: #000;
}

/* Card Numbers and Symbols */

.my-card.num-6 .mark:after,
.my-card.num-9 .mark:after {
    display: block;
    content: "";
    position: relative;
    top: -12px; /* Scaled for mobile */
    left: 2px; /* Scaled for mobile */
    width: 80%;
    border: 0.5px solid #000000; /* Scaled for mobile */
    height: 2px; /* Scaled for mobile */
    box-shadow: 0.5px 0.5px 0 #000000; /* Scaled for mobile */
}

.my-card.num-6.blue .mark:after,
.my-card.num-9.blue .mark:after {
    background: var(--card-blue);
}

.my-card.num-6.green .mark:after,
.my-card.num-9.green .mark:after {
    background: var(--card-green);
}

.my-card.num-6.red .mark:after,
.my-card.num-9.red .mark:after {
    background: var(--card-red);
}

.my-card.num-6.yellow .mark:after,
.my-card.num-9.yellow .mark:after {
    background: var(--card-yellow);
}

/* === OFFICIAL UNO CARD DESIGNS === */

/* WILD DRAW FOUR - Official multi-colored design (in hand) */
.my-card.num-plus4 {
    background: conic-gradient(
        from 0deg at center center,
        var(--card-red) 0deg 90deg,
        var(--card-yellow) 90deg 180deg,
        var(--card-green) 180deg 270deg,
        var(--card-blue) 270deg 360deg
    );
    background-position: center center;
    background-size: 100% 100%;
    border: 3px solid var(--card-black);
}

.my-card.num-plus4 .inner {
    background: var(--card-black);
    margin: 3px;
    border-radius: 8px;
    position: relative;
}

.my-card.num-plus4 .mark {
    background: var(--card-white);
    color: var(--card-black);
    font-weight: bold;
    font-size: 24px;
    padding: 8px 12px;
    border-radius: 8px;
    text-shadow: none;
    border: 2px solid var(--card-black);
}

/* WILD +4 WHEN PLAYED WITH CHOSEN COLOR - Shows the chosen color prominently */
.center .center-card .my-card.num-plus4.red,
.my-card.num-plus4.red {
    background: var(--card-red) !important;
    border: 3px solid var(--card-black) !important;
}

.center .center-card .my-card.num-plus4.blue,
.my-card.num-plus4.blue {
    background: var(--card-blue) !important;
    border: 3px solid var(--card-black) !important;
}

.center .center-card .my-card.num-plus4.green,
.my-card.num-plus4.green {
    background: var(--card-green) !important;
    border: 3px solid var(--card-black) !important;
}

.center .center-card .my-card.num-plus4.yellow,
.my-card.num-plus4.yellow {
    background: var(--card-yellow) !important;
    border: 3px solid var(--card-black) !important;
}

.center .center-card .my-card.num-plus4.red .inner,
.center .center-card .my-card.num-plus4.blue .inner,
.center .center-card .my-card.num-plus4.green .inner,
.center .center-card .my-card.num-plus4.yellow .inner,
.my-card.num-plus4.red .inner,
.my-card.num-plus4.blue .inner,
.my-card.num-plus4.green .inner,
.my-card.num-plus4.yellow .inner {
    background: rgba(0,0,0,0.8) !important;
    margin: 3px !important;
    border-radius: 8px !important;
}

.center .center-card .my-card.num-plus4.red .mark,
.center .center-card .my-card.num-plus4.blue .mark,
.center .center-card .my-card.num-plus4.green .mark,
.center .center-card .my-card.num-plus4.yellow .mark,
.my-card.num-plus4.red .mark,
.my-card.num-plus4.blue .mark,
.my-card.num-plus4.green .mark,
.my-card.num-plus4.yellow .mark {
    background: var(--card-white) !important;
    color: var(--card-black) !important;
    font-weight: bold !important;
    font-size: 20px !important;
    padding: 6px 10px !important;
    border-radius: 8px !important;
    text-shadow: none !important;
    border: 2px solid var(--card-white) !important;
    position: relative !important;
}

/* Add visual indicator that this was a wild card */
.my-card.num-plus4.red .mark:after,
.my-card.num-plus4.blue .mark:after,
.my-card.num-plus4.green .mark:after,
.my-card.num-plus4.yellow .mark:after {
    content: "WILD";
    position: fixed;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 8px;
    color: var(--card-white);
    font-weight: bold;
    text-shadow: 1px 1px 0 var(--card-black);
}

/* WILD CHANGE COLOR - Official multi-colored design (in hand) */
.my-card.num-change {
    background: conic-gradient(
        from 0deg at center center,
        var(--card-red) 0deg 90deg,
        var(--card-yellow) 90deg 180deg,
        var(--card-green) 180deg 270deg,
        var(--card-blue) 270deg 360deg
    );
    background-position: center center;
    background-size: 100% 100%;
    border: 3px solid var(--card-black);
}

.my-card.num-change .inner {
    background: var(--card-black);
    margin: 3px;
    border-radius: 8px;
}

.my-card.num-change .change {
    border: 2px solid var(--card-white);
    background: transparent;
}

/* WILD CHANGE COLOR WHEN PLAYED WITH CHOSEN COLOR - Shows the chosen color */
.center .center-card .my-card.num-change.red,
.my-card.num-change.red {
    background: var(--card-red) !important;
    border: 3px solid var(--card-black) !important;
}

.center .center-card .my-card.num-change.blue,
.my-card.num-change.blue {
    background: var(--card-blue) !important;
    border: 3px solid var(--card-black) !important;
}

.center .center-card .my-card.num-change.green,
.my-card.num-change.green {
    background: var(--card-green) !important;
    border: 3px solid var(--card-black) !important;
}

.center .center-card .my-card.num-change.yellow,
.my-card.num-change.yellow {
    background: var(--card-yellow) !important;
    border: 3px solid var(--card-black) !important;
}

.center .center-card .my-card.num-change.red .inner,
.center .center-card .my-card.num-change.blue .inner,
.center .center-card .my-card.num-change.green .inner,
.center .center-card .my-card.num-change.yellow .inner,
.my-card.num-change.red .inner,
.my-card.num-change.blue .inner,
.my-card.num-change.green .inner,
.my-card.num-change.yellow .inner {
    background: rgba(0,0,0,0.8) !important;
    margin: 3px !important;
    border-radius: 8px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

.center .center-card .my-card.num-change.red .change,
.center .center-card .my-card.num-change.blue .change,
.center .center-card .my-card.num-change.green .change,
.center .center-card .my-card.num-change.yellow .change,
.my-card.num-change.red .change,
.my-card.num-change.blue .change,
.my-card.num-change.green .change,
.my-card.num-change.yellow .change {
    border: 2px solid var(--card-white) !important;
    background: var(--card-white) !important;
    width: 40px !important;
    height: 40px !important;
    border-radius: 50% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 14px !important;
    font-weight: bold !important;
    color: var(--card-black) !important;
    transform: none !important;
    position: relative !important;
}

.my-card.num-change.red .change:after,
.my-card.num-change.blue .change:after,
.my-card.num-change.green .change:after,
.my-card.num-change.yellow .change:after {
    content: "WILD";
    font-size: 8px;
    position: fixed;
    bottom: -12px;
    color: var(--card-white);
    font-weight: bold;
    text-shadow: 1px 1px 0 var(--card-black);
}

/* ACTION CARDS - Enhanced official styling */
.my-card.num-plus2 .inner {
    position: relative;
    /* Draw Two cards have colored backgrounds, not white */
}

.my-card.num-plus2 .mark {
    background: var(--card-white);
    border: 2px solid var(--card-black);
    font-weight: bold;
    text-shadow: none;
    color: var(--card-black);
    border-radius: 50%;
    padding: 8px 10px;
}

.my-card.num-reverse .mark {
    background: var(--card-white);
    border: 2px solid var(--card-black);
    font-weight: bold;
    text-shadow: none;
    color: var(--card-black);
    font-size: 28px;
    border-radius: 50%;
    padding: 8px 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    line-height: 1;
}

.my-card.num-block .mark {
    background: var(--card-white);
    border: 2px solid var(--card-black);
    font-weight: bold;
    text-shadow: none;
    color: var(--card-black);
    font-size: 20px;
    border-radius: 50%;
    width: 35px;
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    position: relative;
}

/* Official Skip/Block symbol - circle with diagonal line */
.my-card.num-block .mark:after {
    content: "";
    position: fixed;
    top: 0;
    left: 50%;
    width: 2px;
    height: 100%;
    background: var(--card-black);
    transform: translateX(-50%) rotate(45deg);
    border-radius: 1px;
}

/* NUMBER CARDS - Enhanced official styling */
.my-card .mark {
    background: var(--card-white);
    color: var(--card-black);
    border: 2px solid var(--card-black);
    font-weight: bold;
    text-shadow: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
}

/* OFFICIAL UNO CORNER NUMBERS - Clean text only */
.my-card:before,
.my-card:after {
    /* background: var(--card-white); */
    /* border: 1px solid var(--card-black); */
    border-radius: 3px;
    padding: 1px 3px;
    font-weight: bold;
    color: var(--card-black);
    text-shadow: none;
    font-size: 8px;
}

.my-card:before {
    top: 2px;
    left: 2px;
}

.my-card:after {
    bottom: 2px;
    right: 2px;
    transform: rotate(180deg);
}

/* ENHANCED CARD SHAPES AND PROPORTIONS */
.my-card {
    border: 2px solid var(--card-black);
    border-radius: 8px;
    box-shadow: 0 3px 8px rgba(0,0,0,0.4);
}

/* OFFICIAL UNO RULE: Action cards have colored backgrounds */
/* Only number cards (0-9) get white backgrounds with colored centers */
.my-card.num-0, .my-card.num-1, .my-card.num-2, .my-card.num-3, .my-card.num-4,
.my-card.num-5, .my-card.num-6, .my-card.num-7, .my-card.num-8, .my-card.num-9 {
    background: var(--card-white);
}

/* Action cards (+2, Reverse, Skip) have colored backgrounds like official UNO */
.my-card.num-plus2, .my-card.num-reverse, .my-card.num-block {
    /* Background color will be set by the color classes (red, blue, green, yellow) */
}

/* CORNER NUMBERS - Only show for specific card types (display set above) */

/* CORNER NUMBER CONTENT - Simple approach */
.my-card.num-0:before,
.my-card.num-0:after {
    content: "0";
}

.my-card.num-1:before,
.my-card.num-1:after {
    content: "1";
}

.my-card.num-2:before,
.my-card.num-2:after {
    content: "2";
}

.my-card.num-3:before,
.my-card.num-3:after {
    content: "3";
}

.my-card.num-4:before,
.my-card.num-4:after {
    content: "4";
}

.my-card.num-5:before,
.my-card.num-5:after {
    content: "5";
}

.my-card.num-6:before,
.my-card.num-6:after {
    content: "6";
}

.my-card.num-7:before,
.my-card.num-7:after {
    content: "7";
}

.my-card.num-8:before,
.my-card.num-8:after {
    content: "8";
}

.my-card.num-9:before,
.my-card.num-9:after {
    content: "9";
}

.my-card.num-plus2:before,
.my-card.num-plus2:after {
    content: "+2";
}

.my-card.num-plus4:before,
.my-card.num-plus4:after {
    content: "+4";
}

.my-card.num-reverse:before,
.my-card.num-reverse:after {
    content: "↩";
}

.my-card.num-block:before,
.my-card.num-block:after {
    content: "🚫";
}

.my-card.num-change:before,
.my-card.num-change:after {
    content: "W";
}

/* COLOR-SPECIFIC OVERRIDES FOR CORNER NUMBERS - White text for visibility */
.my-card.red:before,
.my-card.red:after,
.my-card.blue:before,
.my-card.blue:after,
.my-card.green:before,
.my-card.green:after,
.my-card.yellow:before,
.my-card.yellow:after {
    color: #fff !important;
    /* background: rgba(0, 0, 0, 0.7) !important; */
    /* border: 1px solid #fff !important; */
}


/* WILD CARDS CORNER STYLING */
.my-card.num-plus4:before,
.my-card.num-plus4:after,
.my-card.num-change:before,
.my-card.num-change:after {
    /* background: var(--card-white); */
    color: var(--card-white);
    /* border: 1px solid var(--card-white); */
}

/* ACTION CARDS CORNER STYLING - Clean text for visibility on colored backgrounds */
.my-card.num-plus2:before,
.my-card.num-plus2:after,
.my-card.num-reverse:before,
.my-card.num-reverse:after,
.my-card.num-block:before,
.my-card.num-block:after {
    /* background: var(--card-white); */
    color: var(--card-white);
    /* border: 1px solid var(--card-black); */
}

/* EMERGENCY OVERRIDE - Extremely high specificity for center deck wild cards */
.center .center-card div.my-card.num-plus4.yellow,
.center .center-card div.my-card.num-plus4.red,
.center .center-card div.my-card.num-plus4.blue,
.center .center-card div.my-card.num-plus4.green {
    background-image: none !important;
}

.center .center-card div.my-card.num-plus4.yellow {
    background: var(--card-yellow) !important;
}

.center .center-card div.my-card.num-plus4.red {
    background: var(--card-red) !important;
}

.center .center-card div.my-card.num-plus4.blue {
    background: var(--card-blue) !important;
}

.center .center-card div.my-card.num-plus4.green {
    background: var(--card-green) !important;
}

/* Same for wild change color */
.center .center-card div.my-card.num-change.yellow,
.center .center-card div.my-card.num-change.red,
.center .center-card div.my-card.num-change.blue,
.center .center-card div.my-card.num-change.green {
    background-image: none !important;
}

.center .center-card div.my-card.num-change.yellow {
    background: var(--card-yellow) !important;
}

.center .center-card div.my-card.num-change.red {
    background: var(--card-red) !important;
}

.center .center-card div.my-card.num-change.blue {
    background: var(--card-blue) !important;
}

.center .center-card div.my-card.num-change.green {
    background: var(--card-green) !important;
}

/* === UNO BUTTON === */
.uno {
    position: fixed;
    bottom: 115px;
    left: calc(50% - 340px);
    width: 36px;
    height: 36px;
    background: var(--card-red);
    border: none;
    border-radius: 50%;
    color: white;
    font-family: 'Titan One', cursive;
    font-size: 0.55rem;
    cursor: pointer;
    box-shadow: var(--shadow);
    transition: var(--transition);
    z-index: 650;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    line-height: 1;
}

.uno:hover {
    transform: scale(1.1);
}

/* === COLOR SELECTOR === */
.color-selector-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.select-color {
    background: white;
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
}

.color-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.segment {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.segment:hover {
    transform: scale(1.1);
}

.segment.yellow { background: var(--card-yellow); }
.segment.green { background: var(--card-green); }
.segment.blue { background: var(--card-blue); }
.segment.red { background: var(--card-red); }

/* === CHAT SYSTEM === */
#chat-room {
    position: fixed;
    bottom: 1rem;
    left: 1rem;
    width: 280px;
    max-height: 50vh;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    border-radius: var(--radius);
    z-index: 700;
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.chat-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.1);
    cursor: pointer;
}

.chat-head h1 {
    font-size: 1rem;
}

.chat {
    display: flex;
    flex-direction: column;
    max-height: 40vh;
    overflow: hidden;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 0.75rem;
    min-height: 120px;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    overscroll-behavior: contain;
}

.chat-item {
    margin: 0.25rem 0;
    font-size: 0.8rem;
}

.sender {
    font-weight: bold;
    margin-right: 0.5rem;
}

.chat-input {
    display: flex;
    padding: 0.75rem;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
}

.chat-input input {
    flex: 1;
    font-size: 0.8rem;
    padding: 0.5rem;
    min-height: 36px;
}

.chat-send {
    background: var(--card-blue);
    border: none;
    border-radius: var(--radius);
    padding: 0.5rem;
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
}

/* === SCORES MODAL === */
#scores {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--bg-primary);
    backdrop-filter: blur(20px);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    z-index: 1500;
    width: 90vw;
    max-width: 500px;
    display: none;
}

.scores-title {
    text-align: center;
    font-size: 1.5rem;
    margin-bottom: 1.5rem;
    color: var(--card-yellow);
}

.scores-list {
    margin-bottom: 1.5rem;
}

.score-item {
    background: var(--bg-secondary);
    padding: 0.75rem;
    margin: 0.5rem 0;
    border-radius: var(--radius);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.scores-admin {
    text-align: center;
}

.scores-start {
    width: 100%;
    background: var(--card-green);
}

/* === UTILITY ELEMENTS === */
.timeout {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    background: rgba(0, 0, 0, 0.8);
    color: var(--card-yellow);
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: bold;
    z-index: 600;
    display: none;
}

.center-plus {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: var(--card-red);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 50%;
    font-size: 1.2rem;
    font-weight: bold;
    z-index: 550;
    display: none;
}

.uno-message {
    position: fixed;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    background: var(--card-yellow);
    color: black;
    padding: 1rem 2rem;
    border-radius: var(--radius);
    font-size: 1.2rem;
    font-weight: bold;
    z-index: 800;
    display: none;
    transition: all 0.3s ease;
}

/* UNO message type variations */
.uno-message.success {
    background: var(--card-green);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 255, 0, 0.3);
}

.uno-message.error {
    background: var(--card-red);
    color: white;
    box-shadow: 0 4px 12px rgba(255, 0, 0, 0.3);
}

.uno-message.info {
    background: var(--card-blue);
    color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 255, 0.3);
}

.uno-message.penalty {
    background: #ff4444;
    color: white;
    box-shadow: 0 4px 12px rgba(255, 68, 68, 0.4);
}

.round-container {
    position: fixed;
    top: 50%;
    left: 1rem;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    z-index: 550;
}

.round {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--bg-secondary);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

/* === ERROR MODAL === */
#error-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    min-height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    padding: 2rem 0;
}

.error-head {
    background: var(--bg-primary);
    backdrop-filter: blur(20px);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    text-align: center;
    width: 90vw;
    max-width: 400px;
}

.error-title {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.error-desc {
    margin: 1rem 0;
    font-size: 1rem;
    opacity: 0.9;
}

.error-close {
    width: 100%;
    background: var(--card-blue);
    margin-top: 1rem;
}

/* === PLAYER MANAGEMENT === */
#player-management-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    min-height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2500;
    padding: 2rem 0;
}

.kick-head {
    background: var(--bg-primary);
    backdrop-filter: blur(20px);
    border-radius: var(--radius);
    padding: 2rem;
    box-shadow: var(--shadow);
    text-align: center;
    width: 90vw;
    max-width: 350px;
}

.kick-desc {
    margin-bottom: 1.5rem;
    font-size: 1rem;
}

.kick-accept,
.kick-decline {
    width: 48%;
    margin: 0.25rem;
}

.kick-accept {
    background: var(--card-red);
}

.kick-decline {
    background: var(--card-blue);
}

/* === RESPONSIVE BREAKPOINTS === */

/* Landscape phones and small tablets */
@media screen and (min-width: 480px) {
    html {
        font-size: 15px;
    }

    .my-card {
        width: 70px;
        height: 108px;
        margin: 0 -6px;
        font-size: 56px; /* Scaled up */
        padding: 4px;
    }

    .my-card .mark {
        padding: 0 14px; /* Scaled up */
        border-radius: 60px 36px / 72px 36px; /* Scaled up */
    }

    .my-card .mark.default {
        padding: 21px 0; /* Scaled up */
    }

    .my-card .mark.default .uno-default {
        font-size: 30%; /* Scaled up */
    }

    .my-card:before {
        font-size: 12px; /* Scaled up */
        top: 9px;
        left: 6px;
    }

    .my-card:after {
        font-size: 12px; /* Scaled up */
        bottom: 9px;
        right: 6px;
    }

    .title {
        font-size: 4rem;
    }

    .head {
        flex-direction: row;
        align-items: center;
    }

    .head > div:nth-child(2) {
        display: block;
        width: 1px;
        height: 30px;
        background: rgba(255, 255, 255, 0.3);
        margin: 0 1rem;
    }

    #chat-room {
        width: 320px;
    }

    .uno {
        width: 32px;
        height: 32px;
        font-size: 0.5rem;
        left: 1rem;
        bottom: 100px;
    }
}

/* Tablets */
@media screen and (min-width: 768px) {
    html {
        font-size: 16px;
    }

    .mobile-container {
        padding: 1.5rem;
    }

    .my-card {
        width: 87px;
        height: 134px;
        margin: 0 -4px;
        font-size: 72px; /* Scaled up */
        padding: 4px;
    }

    .my-card .mark {
        padding: 0 18px; /* Scaled up */
        border-radius: 75px 45px / 90px 45px; /* Scaled up */
    }

    .my-card .mark.default {
        padding: 28px 0; /* Scaled up */
    }

    .my-card .mark.default .uno-default {
        font-size: 35%; /* Scaled up */
    }

    .my-card:before {
        font-size: 15px; /* Scaled up */
        top: 11px;
        left: 7px;
    }

    .my-card:after {
        font-size: 15px; /* Scaled up */
        bottom: 11px;
        right: 7px;
    }

    .center {
        gap: 3rem;
    }

    .segment {
        width: 100px;
        height: 100px;
    }

    .uno {
        width: 38px;
        height: 38px;
        font-size: 0.55rem;
        left: calc(50% - 300px);
        bottom: 120px;
    }
}

/* Desktop */
@media screen and (min-width: 1024px) {
    html {
        font-size: 18px;
    }

    .my-card {
        width: 116px;
        height: 178px;
        margin: 0 -20px; /* Original desktop spacing */
        font-size: 100px; /* Original desktop size */
        padding: 5px; /* Original desktop padding */
    }

    .my-card .mark {
        padding: 0 26px; /* Original desktop size */
        border-radius: 100px 60px / 120px 60px; /* Original desktop size */
    }

    .my-card .mark.default {
        padding: 38px 0; /* Original desktop size */
    }

    .my-card .mark.default .uno-default {
        font-size: 50%; /* Original desktop size */
    }

    .my-card:before {
        font-size: 20px; /* Original desktop size */
        top: 15px;
        left: 10px;
    }

    .my-card:after {
        font-size: 20px; /* Original desktop size */
        bottom: 15px;
        right: 10px;
    }

    .my-card .change {
        width: 86px; /* Original desktop size */
        height: 130px; /* Original desktop size */
        border: 2px solid white; /* Original desktop size */
    }

    .my-card .change .segment {
        width: 42px; /* Original desktop size */
        height: 65px; /* Original desktop size */
    }

    .center {
        gap: 4rem;
    }

    #chat-room {
        width: 350px;
    }

    .leave-game-container {
        top: 2rem;
        right: 2rem;
    }

    .end-turn-container {
        bottom: 2rem;
        right: 2rem;
    }

    .uno {
        width: 42px;
        height: 42px;
        font-size: 0.6rem;
        left: calc(50% - 340px);
        bottom: 145px;
    }
}

/* === TOUCH OPTIMIZATIONS === */
@media (pointer: coarse) {
    button, .room-item, .my-card, .segment {
        min-height: 48px;
        touch-action: manipulation;
    }

    button:hover {
        transform: none; /* Disable hover effects on touch devices */
    }

    button:active {
        transform: scale(0.98);
    }
}

/* === ACCESSIBILITY === */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* === PRINT STYLES === */
@media print {
    body {
        background: white !important;
        color: black !important;
    }

    #overlay, #games-container {
        position: static !important;
        width: auto !important;
        height: auto !important;
    }
}

/* ========================================
   NEW FEATURES STYLES (v2.0)
   ======================================== */

/* === UTILITY CLASSES === */
.hidden {
    display: none !important;
}

/* === NOTIFICATION CONTAINER === */
#notification-container {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 5000;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    pointer-events: none;
}

.notification {
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    animation: slideDown 0.3s ease, fadeOut 0.3s ease 2.7s forwards;
    pointer-events: auto;
}

.notification.success {
    background: var(--card-green);
}

.notification.error {
    background: var(--card-red);
}

.notification.info {
    background: var(--card-blue);
}

@keyframes slideDown {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes fadeOut {
    to {
        opacity: 0;
        transform: translateY(-10px);
    }
}

/* === ACHIEVEMENT POPUP === */
#achievement-popup {
    position: fixed;
    top: 20%;
    left: 50%;
    transform: translateX(-50%);
    z-index: 4000;
    animation: achievementPop 0.5s ease;
}

#achievement-popup .achievement-content {
    background: linear-gradient(135deg, #ffd700 0%, #ffb300 100%);
    border-radius: var(--radius);
    padding: 1.5rem 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
    box-shadow: 0 8px 32px rgba(255, 215, 0, 0.4);
    color: #333;
}

.achievement-icon {
    font-size: 2.5rem;
    color: #333;
}

.achievement-title {
    font-size: 0.8rem;
    text-transform: uppercase;
    opacity: 0.8;
}

.achievement-name {
    font-size: 1.2rem;
    font-weight: bold;
}

.achievement-xp {
    font-size: 0.9rem;
    color: var(--card-green);
}

@keyframes achievementPop {
    0% {
        transform: translateX(-50%) scale(0.5);
        opacity: 0;
    }
    50% {
        transform: translateX(-50%) scale(1.1);
    }
    100% {
        transform: translateX(-50%) scale(1);
        opacity: 1;
    }
}

/* === MENU BUTTONS === */
.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin: 1.5rem 0;
}

.menu-buttons button {
    width: 100%;
    max-width: 250px;
    margin: 0 auto;
}

#quick-match-btn {
    background: var(--card-blue);
}

#tournaments-btn {
    background: linear-gradient(135deg, #ffd700 0%, #ffb300 100%);
    color: #333;
}

.menu-secondary {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin: 1.5rem 0;
}

.menu-secondary button {
    width: 50px;
    height: 50px;
    min-width: 50px;
    padding: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
}

.menu-secondary button:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* === GAMES CONTAINER UPDATES === */
.spectate-room {
    background: rgba(255, 255, 255, 0.2);
}

.back-to-menu {
    background: rgba(255, 255, 255, 0.2);
    margin-left: 1rem;
}

.footer {
    display: flex;
    gap: 0.5rem;
}

.footer .refresh {
    flex: 1;
}

.footer .back-to-menu {
    flex-shrink: 0;
}

/* === QUICK MATCH CONTAINER === */
#quick-match-container {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    min-height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 2rem 0;
}

.quick-match-content {
    background: var(--bg-primary);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    width: 90vw;
    max-width: 400px;
}

.quick-match-header h2 {
    color: var(--card-yellow);
    margin-bottom: 1.5rem;
}

.quick-match-status {
    margin: 2rem 0;
}

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid rgba(255, 255, 255, 0.2);
    border-top-color: var(--card-yellow);
    border-radius: 50%;
    margin: 0 auto 1rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.queue-message {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}

.queue-count {
    opacity: 0.8;
    font-size: 0.9rem;
}

.quick-match-timer {
    margin: 1rem 0;
    opacity: 0.7;
}

.cancel-quick-match {
    background: var(--card-red);
    width: 100%;
}

/* === QUICK MATCH QUEUE OVERLAY === */
.queue-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    min-height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    animation: fadeIn 0.3s ease;
    padding: 2rem 0;
}

.queue-modal {
    background: linear-gradient(145deg, #2d1b4e 0%, #1a1030 100%);
    border-radius: 20px;
    padding: 0;
    width: 90vw;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(155, 89, 182, 0.2);
    border: 1px solid rgba(155, 89, 182, 0.3);
    overflow: hidden;
    animation: slideUp 0.4s ease;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.queue-header {
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.queue-header i {
    font-size: 1.5rem;
    color: #f1c40f;
}

.queue-header h2 {
    margin: 0;
    font-size: 1.4rem;
    color: white;
    font-weight: 600;
}

.queue-body {
    padding: 2rem 1.5rem;
    text-align: center;
}

.queue-animation {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 0 auto 1.5rem;
}

.search-ring {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    animation: rotateRing 3s linear infinite;
}

.ring-segment {
    position: fixed;
    top: 0;
    left: 50%;
    width: 50%;
    height: 100%;
    transform-origin: left center;
    overflow: hidden;
}

.ring-segment::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 200%;
    height: 100%;
    border: 4px solid transparent;
    border-top-color: #f1c40f;
    border-radius: 50%;
    animation: pulse 1.5s ease-in-out infinite;
}

.ring-segment:nth-child(1) { transform: rotate(0deg); }
.ring-segment:nth-child(2) { transform: rotate(120deg); }
.ring-segment:nth-child(3) { transform: rotate(240deg); }

.ring-segment:nth-child(1)::before { animation-delay: 0s; }
.ring-segment:nth-child(2)::before { animation-delay: 0.5s; }
.ring-segment:nth-child(3)::before { animation-delay: 1s; }

@keyframes rotateRing {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes pulse {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

.search-icon {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #9b59b6 0%, #8e44ad 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(155, 89, 182, 0.4);
}

.search-icon i {
    font-size: 1.5rem;
    color: white;
    animation: searchPulse 2s ease-in-out infinite;
}

@keyframes searchPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.queue-status {
    font-size: 1.25rem;
    color: white;
    margin: 0 0 1.5rem 0;
    font-weight: 500;
}

.queue-info {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 1.5rem;
}

.queue-stat {
    background: rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    flex: 1;
    max-width: 140px;
}

.queue-stat .stat-label {
    display: block;
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 0.25rem;
}

.queue-stat .stat-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    color: #f1c40f;
}

.queue-tips {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    justify-content: center;
    padding: 0.75rem 1rem;
    background: rgba(241, 196, 15, 0.1);
    border-radius: 8px;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
}

.queue-tips i {
    color: #f1c40f;
    font-size: 0.9rem;
}

.queue-footer {
    padding: 1rem 1.5rem 1.5rem;
}

.queue-cancel-btn {
    width: 100%;
    padding: 0.9rem 1.5rem;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.queue-cancel-btn:hover {
    background: linear-gradient(135deg, #c0392b 0%, #a93226 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.4);
}

.queue-cancel-btn:active {
    transform: translateY(0);
}

/* === TOURNAMENT MODAL === */
#tournament-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    min-height: 100%;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 2rem 0;
    animation: fadeIn 0.2s ease;
}

.tournament-content {
    background: linear-gradient(145deg, var(--bg-primary), rgba(30, 30, 50, 0.98));
    border-radius: var(--radius);
    padding: 0;
    width: 95vw;
    max-width: 500px;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 40px rgba(255, 193, 7, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    animation: slideUp 0.3s ease;
}

.tournament-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.15), rgba(255, 152, 0, 0.1));
    border-bottom: 1px solid rgba(255, 193, 7, 0.2);
}

.tournament-header h2 {
    color: var(--card-yellow);
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin: 0;
    text-shadow: 0 2px 10px rgba(255, 193, 7, 0.3);
}

.tournament-header h2 i {
    font-size: 1.2rem;
}

.close-tournament {
    background: rgba(255, 255, 255, 0.1);
    font-size: 1.25rem;
    min-width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.close-tournament:hover {
    background: rgba(255, 82, 82, 0.3);
    transform: rotate(90deg);
}

.tournament-tabs {
    display: flex;
    background: rgba(0, 0, 0, 0.3);
    padding: 0.5rem;
    gap: 0.5rem;
}

.tournament-tab {
    flex: 1;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.6);
    padding: 0.75rem 0.5rem;
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    font-family: 'Titan One', cursive;
    min-width: auto;
}

.tournament-tab i {
    font-size: 1.1rem;
}

.tournament-tab span {
    font-size: 0.75rem;
}

.tournament-tab:hover {
    background: rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.9);
}

.tournament-tab.active {
    background: linear-gradient(135deg, var(--card-yellow), var(--card-yellow-dark, #f59e0b));
    color: #1a1a2e;
    box-shadow: 0 4px 15px rgba(255, 193, 7, 0.3);
}

.tournament-body {
    padding: 1.25rem;
    max-height: calc(85vh - 160px);
    overflow-y: auto;
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.2s ease;
}

/* Tournament List */
.tournament-list,
.my-tournament-list {
    min-height: 200px;
}

.tournament-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: rgba(255, 255, 255, 0.5);
}

.tournament-empty i {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.3;
}

.tournament-empty p {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
    color: rgba(255, 255, 255, 0.7);
}

.tournament-empty span {
    font-size: 0.85rem;
}

.tournament-item {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03));
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.tournament-item:hover {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.15), rgba(255, 152, 0, 0.1));
    border-color: rgba(255, 193, 7, 0.3);
    transform: translateX(4px);
}

.tournament-item-info h4 {
    margin: 0 0 0.25rem 0;
    font-size: 1rem;
}

.tournament-item-info span {
    font-size: 0.8rem;
    opacity: 0.7;
}

.tournament-item-status {
    background: rgba(76, 175, 80, 0.2);
    color: #81c784;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
}

.tournament-item-status.full {
    background: rgba(255, 82, 82, 0.2);
    color: #ff8a80;
}

.tournament-item-status.in-progress {
    background: rgba(255, 193, 7, 0.2);
    color: #ffd54f;
}

/* Create Tournament Form */
.create-tournament-form {
    padding: 0.5rem 0;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
}

.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
}

.form-group label i {
    color: var(--card-yellow);
    font-size: 0.9rem;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 0.875rem 1rem;
    border-radius: var(--radius);
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: rgba(0, 0, 0, 0.3);
    color: white;
    font-family: 'Titan One', cursive;
    font-size: 0.95rem;
    transition: all 0.2s ease;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--card-yellow);
    box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.15);
}

.form-group input::placeholder {
    color: rgba(255, 255, 255, 0.4);
}

.tournament-preview {
    background: rgba(255, 193, 7, 0.08);
    border: 1px solid rgba(255, 193, 7, 0.2);
    border-radius: var(--radius);
    padding: 1rem;
    margin-bottom: 1.25rem;
}

.tournament-preview h4 {
    margin: 0 0 0.75rem 0;
    font-size: 0.9rem;
    color: var(--card-yellow);
}

.preview-info {
    display: flex;
    justify-content: space-around;
    gap: 0.5rem;
}

.preview-info span {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
}

.preview-info i {
    color: var(--card-yellow);
}

.create-tournament-btn {
    width: 100%;
    background: linear-gradient(135deg, var(--card-green), #43a047);
    padding: 1rem;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    border: none;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.3);
    transition: all 0.2s ease;
}

.create-tournament-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.4);
}

.create-tournament-btn:active {
    transform: translateY(0);
}

/* === SPECTATOR VIEW === */
#spectator-view {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    min-height: 100%;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
}

.spectator-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 2rem;
    background: rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.spectator-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: linear-gradient(135deg, #e94560, #ff6b6b);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.85rem;
    animation: pulse-badge 2s ease-in-out infinite;
}

@keyframes pulse-badge {
    0%, 100% { box-shadow: 0 0 0 0 rgba(233, 69, 96, 0.4); }
    50% { box-shadow: 0 0 0 10px rgba(233, 69, 96, 0); }
}

.spectator-badge i {
    font-size: 1rem;
}

.spectator-room-code {
    font-size: 1.1rem;
    color: rgba(255, 255, 255, 0.8);
    font-family: 'Titan One', cursive;
}

.spectator-leave-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

.spectator-leave-btn:hover {
    background: rgba(233, 69, 96, 0.3);
    border-color: #e94560;
}

.spectator-game-area {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: 2rem;
}

.spectator-players-ring {
    position: fixed;
    width: 100%;
    height: 100%;
    max-width: 600px;
    max-height: 600px;
}

.spectator-player {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: rotate(var(--angle)) translateY(-200px) rotate(calc(-1 * var(--angle)));
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    transition: all 0.3s ease;
}

.spectator-player .player-avatar {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    border: 3px solid rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
}

.spectator-player.has-turn .player-avatar {
    border-color: var(--card-yellow);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
    animation: turn-glow 1s ease-in-out infinite alternate;
}

@keyframes turn-glow {
    from { box-shadow: 0 0 10px rgba(255, 215, 0, 0.3); }
    to { box-shadow: 0 0 25px rgba(255, 215, 0, 0.6); }
}

.spectator-player .player-info {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    background: rgba(0, 0, 0, 0.5);
    padding: 0.4rem 0.8rem;
    border-radius: 8px;
    min-width: 80px;
}

.spectator-player .player-name {
    font-size: 0.85rem;
    font-weight: bold;
    color: white;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.spectator-player .player-team {
    font-size: 0.7rem;
    padding: 0.1rem 0.4rem;
    border-radius: 4px;
    font-weight: bold;
}

.spectator-player .player-team.team-1 {
    background: var(--card-blue);
}

.spectator-player .player-team.team-2 {
    background: var(--card-red);
}

.spectator-player .player-cards {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.spectator-player .turn-indicator {
    position: fixed;
    top: -10px;
    right: -10px;
    width: 24px;
    height: 24px;
    background: var(--card-green);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    animation: bounce 0.5s ease-in-out infinite alternate;
}

@keyframes bounce {
    from { transform: translateY(0); }
    to { transform: translateY(-5px); }
}

.spectator-player .uno-badge {
    position: fixed;
    bottom: -25px;
    background: linear-gradient(135deg, #e94560, #ff6b6b);
    padding: 0.2rem 0.6rem;
    border-radius: 10px;
    font-size: 0.7rem;
    font-weight: bold;
    animation: uno-pulse 0.5s ease-in-out infinite alternate;
}

@keyframes uno-pulse {
    from { transform: scale(1); }
    to { transform: scale(1.1); }
}

.spectator-player.called-uno .player-avatar {
    border-color: #e94560;
}

.spectator-center {
    display: flex;
    align-items: center;
    gap: 2rem;
    z-index: 10;
}

.spectator-deck,
.spectator-pile {
    position: relative;
}

.spectator-card {
    width: 80px;
    height: 120px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    color: white;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.3);
    transition: all 0.3s ease;
}

.spectator-card.back {
    background: linear-gradient(135deg, #1a1a2e 0%, #2d2d44 100%);
    border: 3px solid rgba(255, 255, 255, 0.2);
}

.spectator-card.back::before {
    content: 'UNO';
    font-size: 1rem;
    letter-spacing: 2px;
    color: rgba(255, 255, 255, 0.5);
}

.spectator-card.waiting {
    background: rgba(255, 255, 255, 0.1);
    border: 2px dashed rgba(255, 255, 255, 0.3);
}

.spectator-card.waiting span {
    font-size: 0.8rem;
    color: rgba(255, 255, 255, 0.5);
}

.spectator-card.red {
    background: linear-gradient(135deg, var(--card-red), #c0392b);
}

.spectator-card.blue {
    background: linear-gradient(135deg, var(--card-blue), #2980b9);
}

.spectator-card.green {
    background: linear-gradient(135deg, var(--card-green), #27ae60);
}

.spectator-card.yellow {
    background: linear-gradient(135deg, var(--card-yellow), #f39c12);
    color: #333;
    text-shadow: none;
}

.spectator-card.black {
    background: linear-gradient(135deg, #2c3e50, #1a1a2e);
}

.spectator-direction {
    position: fixed;
    bottom: -40px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 1.5rem;
    color: rgba(255, 255, 255, 0.5);
    animation: direction-pulse 1s ease-in-out infinite;
}

@keyframes direction-pulse {
    0%, 100% { opacity: 0.5; }
    50% { opacity: 1; }
}

.spectator-info {
    position: fixed;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
}

.spectator-stacked-cards {
    background: rgba(0, 0, 0, 0.5);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    opacity: 0.5;
    transition: all 0.3s ease;
}

.spectator-stacked-cards.active {
    opacity: 1;
    background: rgba(233, 69, 96, 0.3);
    border: 1px solid rgba(233, 69, 96, 0.5);
}

.spectator-stacked-cards .stacked-label {
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.7);
}

.spectator-stacked-cards .stacked-value {
    font-size: 1.1rem;
    font-weight: bold;
    color: white;
}

.spectator-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.3);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.7);
    font-size: 0.9rem;
}

.spectator-status i {
    animation: spin 2s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Spectator Mobile Responsive */
@media (max-width: 768px) {
    .spectator-header {
        padding: 0.75rem 1rem;
        flex-wrap: wrap;
        gap: 0.5rem;
    }

    .spectator-badge {
        font-size: 0.75rem;
        padding: 0.4rem 0.8rem;
    }

    .spectator-room-code {
        font-size: 0.9rem;
    }

    .spectator-player {
        transform: rotate(var(--angle)) translateY(-130px) rotate(calc(-1 * var(--angle)));
    }

    .spectator-player .player-avatar {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }

    .spectator-player .player-info {
        padding: 0.3rem 0.5rem;
        min-width: 60px;
    }

    .spectator-player .player-name {
        font-size: 0.75rem;
        max-width: 70px;
    }

    .spectator-card {
        width: 60px;
        height: 90px;
        font-size: 1.5rem;
    }

    .spectator-center {
        gap: 1rem;
    }
}

/* === TOURNAMENT LOBBY === */
.tournament-lobby-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    min-height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2500;
    animation: fadeIn 0.3s ease;
    padding: 2rem 0;
}

.tournament-lobby-modal {
    background: linear-gradient(145deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 20px;
    width: 95vw;
    max-width: 500px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 25px 80px rgba(0, 0, 0, 0.6), 0 0 50px rgba(255, 193, 7, 0.15);
    border: 1px solid rgba(255, 193, 7, 0.2);
    animation: slideUp 0.4s ease;
}

.lobby-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.2), rgba(255, 152, 0, 0.1));
    border-bottom: 1px solid rgba(255, 193, 7, 0.2);
}

.lobby-title {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.lobby-title i {
    font-size: 2rem;
    color: #ffc107;
}

.lobby-title h2 {
    margin: 0;
    font-size: 1.3rem;
    color: white;
}

.lobby-status {
    display: inline-block;
    font-size: 0.75rem;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    margin-top: 0.25rem;
}

.lobby-status.status-registration {
    background: rgba(76, 175, 80, 0.2);
    color: #4caf50;
}

.lobby-status.status-in_progress {
    background: rgba(255, 152, 0, 0.2);
    color: #ff9800;
}

.lobby-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    font-size: 1.5rem;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
}

.lobby-close:hover {
    background: rgba(255, 255, 255, 0.2);
}

.lobby-body {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: calc(90vh - 180px);
}

.lobby-info-cards {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.lobby-info-card {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.lobby-info-card i {
    font-size: 1.25rem;
    color: #ffc107;
    margin-bottom: 0.5rem;
}

.lobby-info-card .info-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: white;
    margin-bottom: 0.25rem;
}

.lobby-info-card .info-label {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.countdown-card .info-value {
    color: #4caf50;
}

.lobby-players-section h3 {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.7);
    margin: 0 0 1rem 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.lobby-players-section h3 i {
    color: #ffc107;
}

.lobby-players-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.lobby-player {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.lobby-player.empty {
    opacity: 0.5;
    border-style: dashed;
}

.lobby-player.eliminated {
    opacity: 0.4;
}

.lobby-player .player-rank {
    font-size: 0.8rem;
    color: #ffc107;
    font-weight: 600;
    min-width: 30px;
}

.lobby-player .player-name {
    flex: 1;
    font-size: 0.95rem;
    color: white;
}

.lobby-player.empty .player-name {
    color: rgba(255, 255, 255, 0.4);
    font-style: italic;
}

.lobby-player .player-status {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
}

.lobby-player .player-status.ready {
    background: rgba(76, 175, 80, 0.2);
    color: #4caf50;
}

.lobby-player .player-status.waiting {
    background: rgba(255, 152, 0, 0.2);
    color: #ff9800;
}

.lobby-player .player-status.eliminated {
    background: rgba(244, 67, 54, 0.2);
    color: #f44336;
}

.lobby-waiting {
    text-align: center;
    padding: 1.5rem;
    margin-top: 1rem;
    background: rgba(255, 193, 7, 0.05);
    border-radius: 12px;
    border: 1px solid rgba(255, 193, 7, 0.1);
}

.waiting-animation {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.waiting-dot {
    width: 10px;
    height: 10px;
    background: #ffc107;
    border-radius: 50%;
    animation: waitingBounce 1.4s ease-in-out infinite;
}

.waiting-dot:nth-child(1) { animation-delay: 0s; }
.waiting-dot:nth-child(2) { animation-delay: 0.2s; }
.waiting-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes waitingBounce {
    0%, 80%, 100% {
        transform: scale(0.6);
        opacity: 0.5;
    }
    40% {
        transform: scale(1);
        opacity: 1;
    }
}

.lobby-waiting p {
    color: white;
    font-size: 1rem;
    margin: 0 0 0.5rem 0;
}

.lobby-waiting span {
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.85rem;
}

.lobby-footer {
    padding: 1rem 1.5rem 1.5rem;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.leave-tournament-btn {
    width: 100%;
    padding: 0.9rem 1.5rem;
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    border: none;
    border-radius: 10px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    transition: all 0.2s ease;
}

.leave-tournament-btn:hover {
    background: linear-gradient(135deg, #c0392b 0%, #a93226 100%);
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(231, 76, 60, 0.4);
}

.leave-tournament-btn:active {
    transform: translateY(0);
}

/* === TOURNAMENT BRACKET === */
#tournament-bracket {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    min-height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 2rem 0;
}

.bracket-content {
    background: var(--bg-primary);
    border-radius: var(--radius);
    padding: 1.5rem;
    width: 95vw;
    max-width: 800px;
    max-height: 90vh;
    overflow: auto;
}

.bracket-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.bracket-title {
    color: var(--card-yellow);
}

.close-bracket {
    background: transparent;
    font-size: 1.5rem;
    min-width: 40px;
    padding: 0;
}

.bracket-info {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
}

.bracket-status {
    background: var(--card-blue);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
}

.bracket-players {
    opacity: 0.8;
}

.bracket-rounds {
    display: flex;
    gap: 2rem;
    overflow-x: auto;
    padding: 1rem 0;
}

.bracket-round {
    flex-shrink: 0;
    min-width: 150px;
}

.bracket-round-title {
    text-align: center;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    opacity: 0.8;
}

.bracket-match {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 0.5rem;
    margin: 0.5rem 0;
}

.bracket-player {
    padding: 0.5rem;
    font-size: 0.85rem;
}

.bracket-player.winner {
    color: var(--card-green);
    font-weight: bold;
}

.bracket-player.loser {
    opacity: 0.5;
}

.bracket-actions {
    text-align: center;
    margin-top: 1rem;
}

.leave-tournament-btn {
    background: var(--card-red);
}

/* === NICKNAME/ROOM CREATION UPDATES === */
.nickname-section {
    margin-bottom: 1rem;
}

.mode-settings,
.players-settings,
.timer-settings,
.house-rules-settings {
    margin: 1rem 0;
}

.mode-settings label,
.players-settings label,
.timer-settings label,
.house-rules-settings label {
    display: block;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.mode-buttons {
    display: flex;
    gap: 0.5rem;
}

.mode-btn {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    min-width: auto;
    padding: 0.5rem;
}

.mode-btn.active {
    background: var(--card-green);
}

.max-players-slider {
    width: 100%;
    height: 8px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.2);
    appearance: none;
    cursor: pointer;
}

.max-players-slider::-webkit-slider-thumb {
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--card-green);
    cursor: pointer;
}

.turn-timer-select {
    width: 100%;
    padding: 0.75rem;
    border-radius: var(--radius);
    border: none;
    font-family: 'Titan One', cursive;
    font-size: 1rem;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
}

.house-rules-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
}

.house-rule-option {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--transition);
}

.house-rule-option:hover {
    background: rgba(255, 255, 255, 0.2);
}

.house-rule-option input {
    width: auto;
    min-height: auto;
}

.rule-mark {
    width: 18px;
    height: 18px;
    border: 2px solid white;
    border-radius: 4px;
    display: inline-block;
}

.house-rule-option input:checked + .rule-mark {
    background: var(--card-green);
}

.nickname-actions {
    margin-top: 1.5rem;
}

/* === LIMBO UPDATES === */
.copy-code {
    background: transparent;
    min-width: auto;
    padding: 0.25rem 0.5rem;
    font-size: 0.9rem;
    box-shadow: none;
}

.room-info {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin: 0.5rem 0;
    flex-wrap: wrap;
}

.game-mode-display {
    background: var(--card-blue);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
}

.house-rules-display {
    font-size: 0.8rem;
    opacity: 0.8;
}

.spectator-info {
    text-align: center;
    opacity: 0.7;
    font-size: 0.9rem;
    margin: 0.5rem 0;
}

/* === TOP CONTROLS === */
.top-controls {
    position: fixed;
    top: 1rem;
    left: 0;
    right: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 1rem;
    z-index: 600;
    pointer-events: none;
}

.top-controls > * {
    pointer-events: auto;
}

.top-controls .leave-game-container {
    position: static;
}

.spectator-badge {
    background: rgba(0, 0, 0, 0.7);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
}

.team-indicator {
    background: var(--card-blue);
    padding: 0.5rem 1rem;
    border-radius: 20px;
    font-size: 0.9rem;
}

.team-indicator.team-b {
    background: var(--card-red);
}

/* === DECK COUNT === */
.deck-count {
    position: fixed;
    bottom: -10px;
    right: -10px;
    background: var(--card-black);
    color: white;
    padding: 0.25rem 0.5rem;
    border-radius: 20px;
    font-size: 0.75rem;
}

/* === PLAY DIRECTION === */
.play-direction {
    position: fixed;
    top: 50%;
    right: -50px;
    transform: translateY(-50%);
    font-size: 1.5rem;
    opacity: 0.5;
    animation: pulse 2s infinite;
}

.play-direction.reversed {
    transform: translateY(-50%) scaleX(-1);
}

/* === CHALLENGE MODAL === */
#challenge-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    min-height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2500;
    padding: 2rem 0;
}

.challenge-content {
    background: var(--bg-primary);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    width: 90vw;
    max-width: 400px;
}

.challenge-content h3 {
    color: var(--card-yellow);
    margin-bottom: 1rem;
}

.challenger-name {
    font-weight: bold;
    color: var(--card-red);
}

.challenge-hint {
    font-size: 0.85rem;
    opacity: 0.8;
    margin: 1rem 0;
}

.challenge-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1.5rem;
}

.challenge-accept {
    flex: 1;
    background: var(--card-red);
}

.challenge-decline {
    flex: 1;
    background: var(--card-blue);
}

/* === SEVEN SWAP MODAL === */
#seven-swap-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    min-height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2500;
    padding: 2rem 0;
}

.seven-swap-content {
    background: var(--bg-primary);
    border-radius: var(--radius);
    padding: 2rem;
    width: 90vw;
    max-width: 400px;
}

.seven-swap-content h3 {
    color: var(--card-yellow);
    text-align: center;
    margin-bottom: 1rem;
}

.swap-player-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.swap-player-btn {
    width: 100%;
    background: var(--bg-secondary);
    justify-content: space-between;
}

.swap-player-btn:hover {
    background: var(--card-blue);
}

/* === DRAWN CARD MODAL === */
#drawn-card-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    min-height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2500;
    padding: 2rem 0;
}

.drawn-card-content {
    background: var(--bg-primary);
    border-radius: var(--radius);
    padding: 2rem;
    text-align: center;
    width: 90vw;
    max-width: 400px;
}

.drawn-card-content h3 {
    color: var(--card-yellow);
    margin-bottom: 1rem;
}

.drawn-card-preview {
    display: flex;
    justify-content: center;
    margin: 1.5rem 0;
}

.drawn-card-buttons {
    display: flex;
    gap: 1rem;
}

.play-drawn-card {
    flex: 1;
    background: var(--card-green);
}

.keep-drawn-card {
    flex: 1;
    background: var(--card-blue);
}

/* === TEAM SCORES === */
.team-scores {
    display: flex;
    justify-content: center;
    gap: 2rem;
    margin: 1rem 0;
}

.team-score {
    text-align: center;
    padding: 1rem 2rem;
    border-radius: var(--radius);
    background: var(--bg-secondary);
}

.team-score.team-a {
    border-left: 4px solid var(--card-blue);
}

.team-score.team-b {
    border-left: 4px solid var(--card-red);
}

.team-label {
    display: block;
    font-size: 0.85rem;
    opacity: 0.8;
    margin-bottom: 0.25rem;
}

.team-points {
    font-size: 1.5rem;
    font-weight: bold;
}

/* === REMATCH BUTTON === */
.admin-buttons {
    display: flex;
    gap: 0.5rem;
}

.rematch-btn {
    flex: 1;
    background: var(--card-blue);
}

/* === EMOTE BAR === */
#emote-bar {
    position: fixed;
    bottom: 5rem;
    right: 1rem;
    z-index: 700;
}

.emote-toggle {
    width: 50px;
    height: 50px;
    min-width: 50px;
    padding: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.7);
}

.emote-list {
    position: fixed;
    bottom: 60px;
    right: 0;
    background: rgba(0, 0, 0, 0.9);
    border-radius: var(--radius);
    padding: 0.5rem;
    display: flex;
    flex-wrap: wrap;
    width: 160px;
    gap: 0.25rem;
}

.emote-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    padding: 0;
    background: transparent;
    font-size: 1.2rem;
    box-shadow: none;
}

.emote-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: scale(1.2);
}

/* === EMOTE DISPLAY === */
#emote-display {
    position: fixed;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 1000;
}

.emote-bubble {
    position: fixed;
    top: 35%;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    background: rgba(0, 0, 0, 0.9);
    padding: 1.5rem 2rem;
    border-radius: var(--radius);
    z-index: 9999;
    pointer-events: none;
    animation: emotePop 2s ease forwards;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.emote-bubble .emote-icon {
    font-size: 4rem;
    line-height: 1;
}

.emote-bubble .emote-sender {
    font-size: 1rem;
    color: var(--card-yellow);
    font-weight: bold;
}

@keyframes emotePop {
    0% {
        transform: translateX(-50%) scale(0);
        opacity: 0;
    }
    10% {
        transform: translateX(-50%) scale(1.2);
        opacity: 1;
    }
    20% {
        transform: translateX(-50%) scale(1);
        opacity: 1;
    }
    80% {
        transform: translateX(-50%) scale(1);
        opacity: 1;
    }
    100% {
        transform: translateX(-50%) scale(0.5) translateY(-50px);
        opacity: 0;
    }
}

/* === STATS MODAL === */
#stats-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    min-height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 2rem 0;
}

.stats-content {
    background: var(--bg-primary);
    border-radius: var(--radius);
    padding: 1.5rem;
    width: 95vw;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.stats-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.stats-header h2 {
    color: var(--card-yellow);
}

.close-stats {
    background: transparent;
    font-size: 1.5rem;
    min-width: 40px;
    padding: 0;
}

.stats-overview {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-card {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    padding: 1rem;
    text-align: center;
}

.stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--card-yellow);
}

.stat-label {
    font-size: 0.8rem;
    opacity: 0.8;
    margin-top: 0.25rem;
}

.stats-details h3 {
    margin-bottom: 0.75rem;
    font-size: 1rem;
}

.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.stats-achievements {
    margin-top: 1.5rem;
}

.stats-achievements h3 {
    margin-bottom: 0.75rem;
}

.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 0.5rem;
}

.achievement-badge {
    width: 60px;
    height: 60px;
    background: var(--bg-secondary);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    opacity: 0.3;
}

.achievement-badge.unlocked {
    opacity: 1;
    background: linear-gradient(135deg, #ffd700 0%, #ffb300 100%);
}

/* === LEADERBOARD MODAL === */
#leaderboard-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    min-height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    padding: 2rem 0;
}

.leaderboard-content {
    background: var(--bg-primary);
    border-radius: var(--radius);
    padding: 1.5rem;
    width: 95vw;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
}

.leaderboard-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.leaderboard-header h2 {
    color: var(--card-yellow);
}

.close-leaderboard {
    background: transparent;
    font-size: 1.5rem;
    min-width: 40px;
    padding: 0;
}

.leaderboard-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.lb-tab {
    flex: 1;
    background: transparent;
    opacity: 0.7;
    min-width: auto;
    padding: 0.5rem;
}

.lb-tab.active {
    opacity: 1;
    background: rgba(255, 255, 255, 0.1);
}

.leaderboard-list {
    background: var(--bg-secondary);
    border-radius: var(--radius);
    overflow: hidden;
}

.lb-row {
    display: grid;
    grid-template-columns: 40px 1fr 60px 60px;
    padding: 0.75rem 1rem;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.lb-row.header {
    background: rgba(0, 0, 0, 0.3);
    font-size: 0.85rem;
    opacity: 0.8;
}

.lb-rank {
    text-align: center;
    font-weight: bold;
}

.lb-row:nth-child(2) .lb-rank {
    color: gold;
}

.lb-row:nth-child(3) .lb-rank {
    color: silver;
}

.lb-row:nth-child(4) .lb-rank {
    color: #cd7f32;
}

.lb-wins,
.lb-elo {
    text-align: center;
}

/* === PLATFORM INTEGRATION STYLES === */

/* Platform tab in leaderboard */
.lb-tab[data-type="platform"] {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.2), rgba(118, 75, 162, 0.2));
    border: 1px solid rgba(102, 126, 234, 0.3);
}

.lb-tab[data-type="platform"].active {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.4), rgba(118, 75, 162, 0.4));
    border-color: rgba(102, 126, 234, 0.6);
}

.lb-tab[data-type="platform"] i {
    color: #667eea;
}

/* Platform leaderboard entries */
.lb-entry.platform-entry {
    border-left: 3px solid #667eea;
}

.lb-entry .lb-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    margin-right: 0.5rem;
    object-fit: cover;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.lb-loading {
    padding: 2rem;
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
}

.lb-loading i {
    margin-right: 0.5rem;
}

/* Platform rank section in Stats modal */
.platform-rank-section {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15), rgba(118, 75, 162, 0.15));
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 12px;
    padding: 1rem;
    margin-bottom: 1rem;
}

.platform-rank-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    color: #667eea;
    font-weight: bold;
    font-size: 0.9rem;
}

.platform-rank-header i {
    font-size: 1rem;
}

.platform-rank-loading {
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    padding: 0.5rem;
}

.platform-rank-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}

.platform-stat {
    text-align: center;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.75rem 0.5rem;
    border-radius: 8px;
}

.platform-stat-value {
    display: block;
    font-size: 1.25rem;
    font-weight: bold;
    color: #fff;
    margin-bottom: 0.25rem;
}

.platform-stat-label {
    display: block;
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.platform-rank-empty {
    text-align: center;
    padding: 0.5rem;
    color: rgba(255, 255, 255, 0.5);
    font-size: 0.85rem;
}

/* Platform notification styling */
.notification.platform {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-left: 4px solid #fff;
}

/* Mobile responsive for platform elements */
@media (max-width: 480px) {
    .platform-rank-stats {
        grid-template-columns: repeat(3, 1fr);
        gap: 0.5rem;
    }

    .platform-stat {
        padding: 0.5rem 0.25rem;
    }

    .platform-stat-value {
        font-size: 1rem;
    }

    .platform-stat-label {
        font-size: 0.6rem;
    }

    .lb-entry .lb-avatar {
        width: 24px;
        height: 24px;
    }
}

/* === GENERIC MODAL STYLES === */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    min-height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    backdrop-filter: blur(5px);
    padding: 2rem 0;
}

.modal-content {
    background: linear-gradient(145deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 16px;
    padding: 0;
    width: 90vw;
    max-width: 420px;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.modal-header {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    padding: 1.25rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h2 {
    color: var(--card-yellow);
    font-size: 1.3rem;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.modal-header h2 i {
    font-size: 1.1rem;
}

.modal-close {
    background: rgba(255, 255, 255, 0.1);
    border: none;
    color: white;
    width: 36px;
    height: 36px;
    min-width: 36px;
    min-height: 36px;
    border-radius: 50%;
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-shadow: none;
}

.modal-close:hover {
    background: var(--card-red);
    transform: rotate(90deg);
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    max-height: calc(85vh - 140px);
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    overscroll-behavior: contain;
}

.modal-footer {
    padding: 1rem 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

/* === SETTINGS MODAL === */
#settings-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    min-height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 3000;
    backdrop-filter: blur(5px);
    padding: 2rem 0;
}

.settings-content {
    background: linear-gradient(145deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 16px;
    padding: 0;
    width: 90vw;
    max-width: 420px;
    max-height: 85vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.1);
}

.settings-group {
    margin-bottom: 1.25rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.settings-group:last-child {
    margin-bottom: 0;
    padding-bottom: 0;
    border-bottom: none;
}

.settings-group > label {
    display: block;
    color: #fff;
    font-size: 0.95rem;
    padding: 0.5rem 0;
}

.settings-group > label:first-child:not(:last-child) {
    margin-bottom: 0.75rem;
    font-size: 0.85rem;
    color: var(--card-yellow);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: default;
}

/* Checkbox group - horizontal layout */
.settings-group.checkbox-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.settings-group.checkbox-group > label {
    margin-bottom: 0;
    padding: 0;
}

/* Volume group - vertical layout with full width slider */
.settings-group.volume-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.settings-group.volume-group > label {
    margin-bottom: 0;
    padding: 0;
}

.settings-group.volume-group input[type="range"] {
    width: 100%;
}

/* Custom Checkbox */
.settings-group input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 48px;
    height: 26px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 13px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.settings-group input[type="checkbox"]::before {
    content: '';
    position: fixed;
    width: 20px;
    height: 20px;
    background: white;
    border-radius: 50%;
    top: 3px;
    left: 3px;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.settings-group input[type="checkbox"]:checked {
    background: var(--card-green);
}

.settings-group input[type="checkbox"]:checked::before {
    left: 25px;
}

/* Custom Select */
.settings-group select {
    width: 100%;
    padding: 0.75rem 1rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    color: white;
    font-family: 'Titan One', cursive;
    font-size: 0.95rem;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23ffffff' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 1rem center;
    transition: all 0.2s ease;
}

.settings-group select:hover,
.settings-group select:focus {
    background-color: rgba(255, 255, 255, 0.15);
    border-color: var(--card-yellow);
    outline: none;
}

.settings-group select option {
    background: #1a1a2e;
    color: white;
}

/* Volume Slider */
.settings-group .volume-row {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.settings-group .volume-row span {
    min-width: 45px;
    text-align: right;
    font-size: 0.9rem;
    color: var(--card-yellow);
}

.settings-group input[type="range"] {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.15);
    appearance: none;
    cursor: pointer;
}

.settings-group input[type="range"]::-webkit-slider-thumb {
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--card-green);
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    transition: transform 0.2s ease;
}

.settings-group input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

/* Save Button */
#save-settings {
    width: 100%;
    padding: 1rem;
    background: linear-gradient(135deg, var(--card-green) 0%, #00875a 100%);
    border: none;
    border-radius: 10px;
    color: white;
    font-family: 'Titan One', cursive;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 166, 81, 0.3);
}

#save-settings:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0, 166, 81, 0.4);
}

#save-settings:active {
    transform: translateY(0);
}

/* Legacy settings classes */
.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.settings-header h2 {
    color: var(--card-yellow);
}

.close-settings {
    background: transparent;
    font-size: 1.5rem;
    min-width: 40px;
    padding: 0;
}

.settings-section {
    margin-bottom: 1.5rem;
}

.settings-section h3 {
    margin-bottom: 1rem;
    font-size: 1rem;
    opacity: 0.9;
}

.setting-option {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    cursor: pointer;
}

.setting-option input[type="checkbox"] {
    display: none;
}

.toggle-mark {
    width: 50px;
    height: 26px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 13px;
    position: relative;
    transition: var(--transition);
}

.toggle-mark:before {
    content: '';
    position: fixed;
    width: 22px;
    height: 22px;
    background: white;
    border-radius: 50%;
    top: 2px;
    left: 2px;
    transition: var(--transition);
}

.setting-option input:checked + .toggle-mark {
    background: var(--card-green);
}

.setting-option input:checked + .toggle-mark:before {
    left: 26px;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 0;
}

.volume-control label {
    flex-shrink: 0;
}

.volume-control input[type="range"] {
    flex: 1;
    height: 6px;
    border-radius: 3px;
    background: rgba(255, 255, 255, 0.2);
    appearance: none;
}

.volume-control input::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--card-green);
    cursor: pointer;
}

.volume-value {
    width: 40px;
    text-align: right;
    font-size: 0.9rem;
}

.theme-select {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 0;
}

.theme-select select {
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    border: none;
    font-family: 'Titan One', cursive;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
}

.settings-footer {
    margin-top: 1rem;
}

.save-settings {
    width: 100%;
    background: var(--card-green);
}

/* === STATS MODAL === */
.stats-content {
    max-width: 480px;
}

.stats-player-info {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    margin-bottom: 1.5rem;
}

.stats-level-badge {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 70px;
    height: 70px;
    background: linear-gradient(135deg, var(--card-yellow) 0%, #e6a700 100%);
    border-radius: 50%;
    flex-shrink: 0;
}

.stats-level-badge .level-number {
    font-size: 1.5rem;
    font-weight: bold;
    color: #1a1a2e;
    line-height: 1;
}

.stats-level-badge .level-label {
    font-size: 0.65rem;
    color: #1a1a2e;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stats-xp-bar {
    flex: 1;
    position: relative;
    height: 24px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    overflow: hidden;
}

.stats-xp-bar .xp-progress {
    height: 100%;
    background: linear-gradient(90deg, var(--card-blue) 0%, var(--card-green) 100%);
    border-radius: 12px;
    transition: width 0.5s ease;
}

.stats-xp-bar .xp-text {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.75rem;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    text-align: center;
    transition: transform 0.2s ease, background 0.2s ease;
}

.stat-item:hover {
    transform: translateY(-2px);
    background: rgba(255, 255, 255, 0.08);
}

.stat-item i {
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: rgba(255, 255, 255, 0.6);
}

.stat-item .stat-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    line-height: 1.2;
}

.stat-item .stat-label {
    font-size: 0.75rem;
    color: rgba(255, 255, 255, 0.6);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-item.highlight-green i { color: var(--card-green); }
.stat-item.highlight-yellow i { color: var(--card-yellow); }
.stat-item.highlight-red i { color: var(--card-red); }
.stat-item.highlight-blue i { color: var(--card-blue); }

.stats-section {
    margin-bottom: 1.5rem;
}

.stats-section:last-child {
    margin-bottom: 0;
}

.stats-section h3 {
    font-size: 0.9rem;
    color: var(--card-yellow);
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.stats-section h3 i {
    font-size: 0.85rem;
}

.stats-section h3 .badge {
    background: rgba(255, 255, 255, 0.1);
    padding: 0.2rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    color: white;
}

.achievements-preview {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.achievement-mini {
    width: 40px;
    height: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.no-achievements {
    color: rgba(255, 255, 255, 0.5);
    font-style: italic;
    font-size: 0.9rem;
}

.more-achievements {
    color: var(--card-yellow);
    font-size: 0.85rem;
}

.daily-challenges {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.challenge {
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    padding: 0.875rem;
    transition: all 0.2s ease;
}

.challenge:hover {
    background: rgba(255, 255, 255, 0.08);
}

.challenge.completed {
    border-left: 3px solid var(--card-green);
}

.challenge-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.challenge-name {
    font-size: 0.9rem;
    color: white;
}

.challenge-reward {
    font-size: 0.8rem;
    color: var(--card-yellow);
    font-weight: bold;
}

.challenge-progress-bar {
    position: relative;
    height: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 10px;
    overflow: hidden;
}

.challenge-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--card-blue) 0%, var(--card-green) 100%);
    border-radius: 10px;
    transition: width 0.3s ease;
}

.challenge.completed .challenge-fill {
    background: var(--card-green);
}

.challenge-text {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.7rem;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* === LEADERBOARD MODAL === */
.leaderboard-content {
    max-width: 450px;
}

.leaderboard-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.lb-tab {
    flex: 1;
    padding: 0.75rem 0.5rem;
    background: rgba(255, 255, 255, 0.08);
    border: none;
    border-radius: 10px;
    color: rgba(255, 255, 255, 0.7);
    font-family: 'Titan One', cursive;
    font-size: 0.75rem;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

.lb-tab i {
    font-size: 0.7rem;
}

.lb-tab:hover {
    background: rgba(255, 255, 255, 0.12);
    color: white;
}

.lb-tab.active {
    background: linear-gradient(135deg, var(--card-yellow) 0%, #e6a700 100%);
    color: #1a1a2e;
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 350px;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
    overscroll-behavior: contain;
}

.lb-entry {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1rem;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    transition: all 0.2s ease;
}

.lb-entry:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateX(4px);
}

.lb-entry.top-1 {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.2) 0%, rgba(255, 215, 0, 0.1) 100%);
    border: 1px solid rgba(255, 215, 0, 0.3);
}

.lb-entry.top-2 {
    background: linear-gradient(135deg, rgba(192, 192, 192, 0.2) 0%, rgba(192, 192, 192, 0.1) 100%);
    border: 1px solid rgba(192, 192, 192, 0.3);
}

.lb-entry.top-3 {
    background: linear-gradient(135deg, rgba(205, 127, 50, 0.2) 0%, rgba(205, 127, 50, 0.1) 100%);
    border: 1px solid rgba(205, 127, 50, 0.3);
}

.lb-rank {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.lb-rank i {
    font-size: 1.25rem;
}

.lb-rank .rank-num {
    font-size: 0.9rem;
    color: rgba(255, 255, 255, 0.5);
    font-weight: bold;
}

.lb-player {
    flex: 1;
    min-width: 0;
}

.lb-name {
    display: block;
    font-size: 0.95rem;
    color: white;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.lb-level {
    font-size: 0.7rem;
    color: rgba(255, 255, 255, 0.5);
}

.lb-score {
    text-align: right;
}

.lb-points {
    display: block;
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--card-yellow);
}

.lb-points-label {
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
}

.lb-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: rgba(255, 255, 255, 0.5);
}

.lb-empty i {
    font-size: 3rem;
    margin-bottom: 1rem;
    display: block;
}

.lb-empty p {
    font-size: 1rem;
}

/* === DAILY CHALLENGE BANNER === */
#daily-challenge-banner {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(90deg, var(--card-blue) 0%, var(--card-green) 100%);
    padding: 0.5rem 1rem;
    z-index: 900;
}

.challenge-banner-content {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}

.challenge-text {
    font-size: 0.9rem;
}

.challenge-desc {
    font-weight: bold;
}

.challenge-progress {
    background: rgba(0, 0, 0, 0.3);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.85rem;
}

.close-challenge-banner {
    background: transparent;
    min-width: auto;
    padding: 0.25rem;
    font-size: 1rem;
    box-shadow: none;
}

/* === COLOR BLIND MODE === */
body.colorblind-mode .my-card.red:after,
body.colorblind-mode .segment.red:after {
    content: 'R';
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.6em;
    font-weight: bold;
    color: white;
}

body.colorblind-mode .my-card.blue:after,
body.colorblind-mode .segment.blue:after {
    content: 'B';
}

body.colorblind-mode .my-card.green:after,
body.colorblind-mode .segment.green:after {
    content: 'G';
}

body.colorblind-mode .my-card.yellow:after,
body.colorblind-mode .segment.yellow:after {
    content: 'Y';
}

/* Color blind patterns */
body.colorblind-mode .my-card.red .inner,
body.colorblind-mode .segment.red {
    background-image: repeating-linear-gradient(
        45deg,
        transparent,
        transparent 5px,
        rgba(0,0,0,0.1) 5px,
        rgba(0,0,0,0.1) 10px
    );
}

body.colorblind-mode .my-card.blue .inner,
body.colorblind-mode .segment.blue {
    background-image: repeating-linear-gradient(
        90deg,
        transparent,
        transparent 5px,
        rgba(255,255,255,0.1) 5px,
        rgba(255,255,255,0.1) 10px
    );
}

body.colorblind-mode .my-card.green .inner,
body.colorblind-mode .segment.green {
    background-image: repeating-linear-gradient(
        0deg,
        transparent,
        transparent 5px,
        rgba(0,0,0,0.1) 5px,
        rgba(0,0,0,0.1) 10px
    );
}

body.colorblind-mode .my-card.yellow .inner,
body.colorblind-mode .segment.yellow {
    background-image: repeating-linear-gradient(
        -45deg,
        transparent,
        transparent 5px,
        rgba(0,0,0,0.1) 5px,
        rgba(0,0,0,0.1) 10px
    );
}

/* === CARD THEMES === */
body[data-theme="dark"] {
    --bg-primary: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
}

body[data-theme="neon"] {
    --bg-primary: linear-gradient(135deg, #0f0c29 0%, #302b63 50%, #24243e 100%);
    --card-blue: #00d4ff;
    --card-green: #00ff88;
    --card-red: #ff0055;
    --card-yellow: #ffff00;
}

body[data-theme="neon"] .my-card {
    box-shadow: 0 0 20px currentColor;
}

body[data-theme="minimal"] {
    --bg-primary: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
    --text-primary: #333;
}

body[data-theme="minimal"] .my-card {
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

/* === MOBILE RESPONSIVE UPDATES === */
@media screen and (max-width: 480px) {
    .menu-buttons button {
        font-size: 1rem;
        padding: 1rem;
    }

    .house-rules-grid {
        grid-template-columns: 1fr;
    }

    .stats-overview {
        grid-template-columns: 1fr;
    }

    .challenge-buttons {
        flex-direction: column;
    }

    .drawn-card-buttons {
        flex-direction: column;
    }

    .admin-buttons {
        flex-direction: column;
    }

    #emote-bar {
        bottom: 4rem;
    }

    .emote-list {
        width: 120px;
    }

    .lb-row {
        grid-template-columns: 30px 1fr 50px 50px;
        font-size: 0.85rem;
        padding: 0.5rem;
    }
}

/* === FULLSCREEN SCROLLING SUPPORT === */
/* Ensure scrollable elements work properly in fullscreen/iframe mode */
:fullscreen,
::backdrop,
*:-webkit-full-screen,
*:-moz-full-screen,
*:-ms-fullscreen {
    overflow: visible !important;
}

/* Global touch scrolling for all scrollable elements */
[style*="overflow-y: auto"],
[style*="overflow: auto"],
.scrollable,
.room-list,
.chat-messages,
.modal-body,
.leaderboard-list,
.lobby-list,
.player-list,
.settings-content,
.stats-body,
.tournament-list {
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-y !important;
    overscroll-behavior: contain !important;
}

/* Ensure iframe allows scrolling within game elements */
html:fullscreen,
body:fullscreen {
    overflow: hidden;
}

html:fullscreen .room-list,
html:fullscreen .chat-messages,
html:fullscreen .modal-body,
html:fullscreen .mobile-container,
html:fullscreen .mobile-content,
body:fullscreen .room-list,
body:fullscreen .chat-messages,
body:fullscreen .modal-body,
body:fullscreen .mobile-container,
body:fullscreen .mobile-content {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    touch-action: pan-y !important;
}