/* Reset and Base Styles */
/* Reset and Base Styles */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* ===== UNIFIED RESPONSIVE SYSTEM ===== */

/* Base responsive container */
.responsive-container {
    width: 100%;
    max-width: 100vw;
    overflow-x: auto;
    overflow-y: auto;
    scroll-behavior: smooth;
}

/* User-controllable zoom and scroll */
.user-scalable {
    transform-origin: top left;
    transition: transform 0.3s ease;
}

/* Tablet Layout (1025px - 768px) */
@media (max-width: 1024px) and (min-width: 769px) {
    .game-layout {
        display: flex !important;
        flex-direction: column;
        gap: 15px;
        padding: 10px;
        overflow-y: auto;
        max-height: 100vh;
    }
    
    .game-layout > .right-panel { order: 1 !important; }
    .game-layout > .board-container { order: 2 !important; }
    .game-layout > .player-hand { order: 3 !important; }
    
    .sequence-board {
        width: min(80vw, 600px);
        height: min(80vw, 600px);
    }
    
    .hand-card {
        width: 60px;
        height: 84px;
    }
}

.no-scroll { overflow: hidden; }

/* Gameplay screen */
#gameplayScreen {
    overflow-y: auto;
    min-height: 100vh;
}

/* Mobile layout rules are now consolidated below in the main mobile section */

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #0a4d2a, #1e7e34, #28a745);
    min-height: 100vh;
    overflow-x: auto; /* Allow horizontal scroll for user control */
    overflow-y: auto; /* Allow vertical scroll for user control */
    color: #fff;
    scroll-behavior: smooth;
    /* Enable user zoom control */
    touch-action: manipulation;
    -webkit-text-size-adjust: none;
    -moz-text-size-adjust: none;
    -ms-text-size-adjust: none;
    text-size-adjust: none;
}

/* Animations */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0.3; }
}

/* Screen Management */
.screen {
    display: none;
    min-height: 100vh;
    padding: 20px;
    animation: fadeIn 0.5s ease-in-out;
}

.screen.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Container Styles */
.container {
    text-align: center;
    max-width: 800px;
    width: 100%;
    padding: 40px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    backdrop-filter: blur(15px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

/* Typography */
h1 {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

h3, h4 {
    margin-bottom: 15px;
}

/* Form Elements */
input[type="text"], 
input[type="email"], 
input[type="password"], 
select {
    width: 100%;
    padding: 15px;
    margin: 10px 0;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.9);
    color: #333;
    font-size: 16px;
    box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.1);
}

input[type="text"]:focus, 
input[type="email"]:focus, 
input[type="password"]:focus, 
select:focus {
    outline: none;
    background: rgba(255, 255, 255, 1);
    box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.3);
}

/* Buttons */
.btn {
    padding: 15px 30px;
    margin: 10px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn.primary {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
}

.btn.secondary {
    background: linear-gradient(135deg, #6c757d, #5a6268);
    color: white;
}

.btn.danger {
    background: linear-gradient(135deg, #dc3545, #c82333);
    color: white;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* Room Management */
.room-options {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 30px;
}

.join-room {
    display: flex;
    gap: 10px;
    padding: 30px;
    border-radius: 15px;
    margin: 20px 0;
}

.room-info {
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.room-details {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

/* Teams Container */
.teams {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.team {
    background: rgba(255, 255, 255, 0.08);
    padding: 20px;
    border-radius: 12px;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.team h4 {
    margin-bottom: 15px;
    text-align: center;
    font-size: 1.2em;
}

.team-red h4 { color: #dc3545; }
.team-blue h4 { color: #007bff; }
.team-green h4 { color: #198754; }

.team-players {
    min-height: 80px;
    margin-bottom: 15px;
    padding: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 8px;
}

.team-controls {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Admin Controls */
.admin-controls {
    background: rgba(255, 255, 255, 0.08);
    padding: 20px;
    border-radius: 12px;
    margin: 20px 0;
}

.admin-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.player-management {
    background: rgba(0, 0, 0, 0.2);
    padding: 15px;
    border-radius: 8px;
}

.player-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.room-controls {
    display: flex;
    gap: 15px;
    justify-content: center;
    flex-wrap: wrap;
    margin-top: 20px;
}

.room-settings-inline {
    background: rgba(255, 255, 255, 0.08);
    padding: 20px;
    border-radius: 12px;
    margin: 20px 0;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.room-settings-inline h4 {
    margin-bottom: 15px;
    color: #fff;
    font-size: 1.1em;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
}

.setting {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin: 15px 0;
}

.settings-grid .setting {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    margin: 0;
}

.setting label {
    font-weight: 600;
    margin-right: 15px;
    font-size: 0.9em;
    color: rgba(255, 255, 255, 0.9);
}

.settings-grid .setting label {
    margin-right: 0;
}

/* Teams */
.teams {
    display: flex;
    gap: 20px;
    margin: 30px 0;
    flex-wrap: wrap;
}

.team {
    flex: 1;
    min-width: 200px;
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 15px;
    text-align: center;
}

.team-red { border: 3px solid #dc3545; }
.team-blue { border: 3px solid #007bff; }
.team-green { border: 3px solid #28a745; }

.team-players {
    min-height: 60px;
    margin: 15px 0;
}

.player-tag {
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 15px;
    margin: 5px;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    font-size: 14px;
}

.remove-player-btn {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 18px;
    height: 18px;
    font-size: 12px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    flex-shrink: 0;
    margin-left: 5px;
}

.remove-player-btn:hover {
    background: #c82333;
    transform: scale(1.1);
}

.btn.team-btn {
    width: 100%;
    margin-top: 10px;
}

.btn.red { background: #dc3545; }
.btn.blue { background: #007bff; }

/* Game Layout - Desktop */
.game-container {
    max-width: 1600px;
    width: 100%;
    padding: 20px;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 15px;
}

.game-info {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    flex: 1;
}

.brightness-control {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 15px;
    border-radius: 8px;
}

.brightness-control label {
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 5px;
    white-space: nowrap;
}

#brightnessSlider {
    width: 120px;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: linear-gradient(to right, #333 0%, #fff 100%);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

#brightnessSlider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: #28a745;
    border: 2px solid white;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    transition: transform 0.2s;
}

#brightnessSlider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #28a745;
    border: 2px solid white;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
    transition: transform 0.2s;
}

#brightnessSlider:hover::-webkit-slider-thumb {
    transform: scale(1.2);
}

#brightnessSlider:hover::-moz-range-thumb {
    transform: scale(1.2);
}

.game-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

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

.room-info-item span {
    font-weight: 700;
    color: #28a745;
    margin-left: 5px;
    font-size: 16px;
}

/* 1x3 Vertical Grid Layout: Details -> Board -> Cards */
.game-layout {
    display: flex;
    flex-direction: column;
    gap: 20px;
    align-items: center;
    width: 100%;
    position: relative;
    min-height: 100vh;
}

/* Game area wrapper for board and cards */
.game-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    width: 100%;
}

/* Top Panel - All game details */
.right-panel {
    width: 100%;
    max-width: 1200px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.game-stats {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 15px;
    width: 100%;
}

.game-stats h4 {
    font-size: 14px;
    margin-bottom: 10px;
}

.team-sequences {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.red-sequences,
.blue-sequences,
.green-sequences {
    padding: 8px;
    border-radius: 6px;
    font-weight: 600;
}

.last-move {
    margin-top: 15px;
    padding: 10px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    font-size: 13px;
}

.players-table {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 15px;
    width: 100%;
    grid-column: 1 / -1;
}

.players-table h4 {
    font-size: 14px;
    margin-bottom: 10px;
}

/* Compact Players List - RichUp.io Style */
.players-compact {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 15px;
    width: 100%;
}

.players-compact h4 {
    margin-bottom: 10px;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.8);
}

.players-list-compact {
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-height: 200px;
    overflow-y: auto;
}

.player-compact {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    font-size: 12px;
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.player-compact.current-turn {
    background: rgba(255, 193, 7, 0.2);
    border-left-color: #ffc107;
    box-shadow: 0 0 10px rgba(255, 193, 7, 0.3);
}

.player-chip {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
    flex-shrink: 0;
}

.player-chip.red { background: #dc3545; }
.player-chip.blue { background: #007bff; }
.player-chip.green { background: #28a745; }
.player-chip.yellow { background: #ffc107; }

.player-name-compact {
    font-weight: 500;
    color: white;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-status-compact {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 600;
}

.player-compact.current-turn .player-status-compact {
    color: #ffc107;
}

/* Player Hand - Horizontal Row */
.player-hand {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 20px;
    width: 100%;
    max-width: 1200px;
}

.player-hand h3 {
    font-size: 16px;
    margin-bottom: 15px;
    text-align: center;
}

.player-cards {
    display: flex;
    flex-direction: row;
    gap: 15px;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
}

.hand-card {
    width: 70px;
    height: 98px;
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
    background: white;
    cursor: pointer;
    transition: all 0.2s ease;
}

.hand-card:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.4);
    border-color: #28a745;
}

.hand-card.selected {
    border-color: #ffc107;
    box-shadow: 0 0 0 2px rgba(255, 193, 7, 0.5);
    transform: scale(1.08);
}

/* Board Container - Centered */
.board-container {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
}

.sequence-board {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 2px;
    background: #2d5a3d;
    padding: 10px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    width: min(90vh, 85vw, 700px);
    height: min(90vh, 85vw, 700px);
    aspect-ratio: 1;
}

.board-cell {
    aspect-ratio: 5/7;
    border: 1px solid #2c5530;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
    border-radius: 4px;
    position: relative;
    font-size: clamp(8px, 1vw, 12px);
    font-weight: 600;
    box-shadow: 0 1px 2px rgba(0,0,0,0.1);
    overflow: hidden;
}

.card-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
    /* Reduce brightness to prevent eye strain */
    filter: brightness(0.7) contrast(0.9) saturate(0.85);
    transition: filter 0.2s;
}

.board-cell:hover .card-image,
.hand-card:hover .hand-card-image {
    filter: brightness(0.85) contrast(1) saturate(1);
}

.card-content {
    width: 100%;
    height: 100%;
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

/* Modern Card Layout Styles */
.card-corner {
    position: absolute;
    font-size: clamp(8px, 0.8em, 12px);
    font-weight: bold;
    line-height: 1;
}

.card-corner.top-left {
    top: 2px;
    left: 2px;
}

.card-corner.bottom-right {
    bottom: 2px;
    right: 2px;
    transform: rotate(180deg);
}

.corner-rank {
    font-size: clamp(7px, 0.7em, 11px);
    font-weight: bold;
}

.corner-suit {
    font-size: clamp(6px, 0.6em, 10px);
    margin-top: 1px;
}

/* Face Card Styles */
.face-card .card-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
}

.face-symbol {
    font-size: clamp(12px, 1.1em, 16px);
    font-weight: bold;
}

.face-suit {
    font-size: clamp(10px, 0.95em, 14px);
    margin-top: 1px;
}

/* Number Card Styles */
.number-card .card-symbols {
    position: relative;
    flex: 1;
    width: 100%;
    height: 100%;
}

.suit-symbol {
    position: absolute;
    font-weight: normal;
}

/* Dynamic sizing based on symbol count */
.suit-symbol.size-large {
    font-size: 8px;  /* 2-3 symbols: largest and most visible */
}

.suit-symbol.size-medium {
    font-size: 6px;  /* 4-5 symbols: medium size */
}

.suit-symbol.size-small {
    font-size: 4px;  /* 6-7 symbols: smaller to fit more */
}

.suit-symbol.size-tiny {
    font-size: 3px;  /* 8-10 symbols: smallest to fit all */
}

/* Position classes for suit symbols */
.pos-top { top: 15%; left: 50%; transform: translateX(-50%); }
.pos-center { top: 50%; left: 50%; transform: translate(-50%, -50%); }
.pos-bottom { bottom: 15%; left: 50%; transform: translateX(-50%) rotate(180deg); }

.pos-top-left { top: 15%; left: 25%; }
.pos-top-right { top: 15%; right: 25%; }
.pos-top-center { top: 15%; left: 50%; transform: translateX(-50%); }

.pos-mid-left { top: 50%; left: 25%; transform: translateY(-50%); }
.pos-mid-right { top: 50%; right: 25%; transform: translateY(-50%); }

.pos-bottom-left { bottom: 15%; left: 25%; transform: rotate(180deg); }
.pos-bottom-right { bottom: 15%; right: 25%; transform: rotate(180deg); }
.pos-bottom-center { bottom: 15%; left: 50%; transform: translateX(-50%) rotate(180deg); }

.pos-upper-left { top: 30%; left: 25%; }
.pos-upper-right { top: 30%; right: 25%; }
.pos-lower-left { bottom: 30%; left: 25%; transform: rotate(180deg); }
.pos-lower-right { bottom: 30%; right: 25%; transform: rotate(180deg); }

.card-rank {
    font-size: 14px;
    font-weight: bold;
    z-index: 2;
}

.card-suit-large {
    font-size: 20px;
    margin-top: 2px;
    z-index: 2;
}

.card-suit-small {
    position: absolute;
    font-size: 8px;
    z-index: 1;
}

.card-suit-small.top-left {
    top: 2px;
    left: 2px;
}

.card-suit-small.bottom-right {
    bottom: 2px;
    right: 2px;
    transform: rotate(180deg);
}

.board-cell:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.board-cell.free {
    background: linear-gradient(135deg, #ffd700, #ffed4e);
    color: #333;
    font-weight: bold;
}

.board-cell.red {
    color: #dc3545;
}

.board-cell.black {
    color: #333;
}

.board-cell.highlighted {
    box-shadow: 0 0 0 3px #28a745;
    background: rgba(40, 167, 69, 0.2);
}

.board-cell.remove-highlight {
    box-shadow: 0 0 0 3px #dc3545;
    background: rgba(220, 53, 69, 0.2);
}

.board-cell.place-highlight {
    box-shadow: 0 0 0 3px #007bff;
    background: rgba(0, 123, 255, 0.2);
}

.board-cell.occupied::after {
    content: '';
    position: absolute;
    width: 80%;
    height: 80%;
    border-radius: 50%;
    top: 10%;
    left: 10%;
}

.board-cell.red-chip::after {
    background: radial-gradient(circle, #dc3545, #a71e2a);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.board-cell.blue-chip::after {
    background: radial-gradient(circle, #007bff, #0056b3);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.board-cell.green-chip::after {
    background: radial-gradient(circle, #28a745, #1e7e34);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

.card-rank {
    font-size: 14px;
    font-weight: bold;
    line-height: 1;
}

.card-suit {
    font-size: 16px;
    line-height: 1;
}

/* Right Panel */
.right-panel {
    display: flex;
    flex-direction: column;
    gap: 20px;
    height: 100%;
    overflow-y: auto;
}

.player-hand {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 15px;
    flex-shrink: 0;
}

.player-cards {
    display: flex;
    flex-direction: row;
    gap: 8px;
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
    padding: 8px;
    align-items: center;
}

.hand-card {
    background: white;
    border-radius: 8px;
    padding: 2px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
    aspect-ratio: 5/7;
    overflow: hidden;
    width: 70px;
    height: 98px;
    flex-shrink: 0;
}

.hand-card-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 6px;
    /* Reduce brightness to prevent eye strain */
    filter: brightness(0.7) contrast(0.9) saturate(0.85);
    transition: filter 0.2s;
}

.card-fallback {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 12px;
    font-weight: bold;
    color: #333;
    background: #f8f9fa;
    border-radius: 4px;
}

.hand-card:hover {
    transform: translateX(5px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.hand-card.selected {
    background: #28a745;
    color: white;
    transform: translateX(10px);
}

.hand-card.red {
    color: #dc3545;
}

.hand-card.black {
    color: #333;
}

.hand-card .card-rank {
    font-size: 22px;
    font-weight: bold;
}

.hand-card .card-suit {
    font-size: 24px;
}

/* Game Stats */
.game-stats {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 15px;
}

.sequences-count {
    text-align: center;
}

.team-sequences {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

.red-sequences, .blue-sequences {
    padding: 10px;
    border-radius: 8px;
    font-weight: bold;
}

.red-sequences {
    background: rgba(220, 53, 69, 0.2);
    color: #dc3545;
}

.blue-sequences {
    background: rgba(0, 123, 255, 0.2);
    color: #007bff;
}

.board-cell.highlighted.remove-highlight {
    background: rgba(220, 53, 69, 0.3);
    border: 2px solid #dc3545;
    animation: pulse 1s infinite;
}

.board-cell.highlighted.place-highlight {
    background: rgba(40, 167, 69, 0.3);
    border: 2px solid #28a745;
    animation: pulse 1s infinite;
}

/* Sequence highlighting */
.sequence-highlight {
    box-shadow: 0 0 15px #ffd700 !important;
    border: 2px solid #ffd700 !important;
    animation: sequenceGlow 2s ease-in-out infinite alternate;
}

@keyframes sequenceGlow {
    from {
        box-shadow: 0 0 10px #ffd700;
    }
    to {
        box-shadow: 0 0 20px #ffed4e, 0 0 30px #ffd700;
    }
}

/* Team-specific sequence highlighting */
.sequence-red {
    box-shadow: 0 0 12px #dc3545 !important;
    border: 2px solid #dc3545 !important;
    animation: redSequenceGlow 2s ease-in-out infinite alternate;
}

.sequence-blue {
    box-shadow: 0 0 12px #007bff !important;
    border: 2px solid #007bff !important;
    animation: blueSequenceGlow 2s ease-in-out infinite alternate;
}

.sequence-green {
    box-shadow: 0 0 12px #28a745 !important;
    border: 2px solid #28a745 !important;
    animation: greenSequenceGlow 2s ease-in-out infinite alternate;
}

@keyframes redSequenceGlow {
    from { box-shadow: 0 0 8px #dc3545; }
    to { box-shadow: 0 0 16px #dc3545, 0 0 24px #ff6b7a; }
}

@keyframes blueSequenceGlow {
    from { box-shadow: 0 0 8px #007bff; }
    to { box-shadow: 0 0 16px #007bff, 0 0 24px #4dabf7; }
}

@keyframes greenSequenceGlow {
    from { box-shadow: 0 0 8px #28a745; }
    to { box-shadow: 0 0 16px #28a745, 0 0 24px #51cf66; }
}

/* Notifications - Bottom Right Corner */
.notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: rgba(0, 0, 0, 0.9);
    color: white;
    padding: 12px 20px;
    border-radius: 8px;
    z-index: 1000;
    max-width: 300px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    border-left: 4px solid #4CAF50;
    animation: slideInFromBottom 0.3s ease-out;
}

.notification.success { background-color: #28a745; }
.notification.error { background-color: #dc3545; }
.notification.warning { background-color: #ffc107; color: #212529; }
.notification.info { background-color: #17a2b8; }

/* Winner Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    animation: fadeIn 0.3s ease-out;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: scaleIn 0.4s ease-out;
    max-width: 500px;
    width: 90%;
}

.winner-announcement h2 {
    font-size: 2.5em;
    margin: 0 0 20px 0;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    animation: bounce 1s ease-in-out infinite alternate;
}

.winner-team {
    font-size: 3em;
    font-weight: bold;
    margin: 20px 0;
    text-transform: uppercase;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
    animation: glow 2s ease-in-out infinite alternate;
}

.winner-team.red-sequences { color: #ff4757; }
.winner-team.blue-sequences { color: #3742fa; }
.winner-team.green-sequences { color: #2ed573; }
.winner-team.green { color: #2ed573; }

.winner-message {
    font-size: 1.3em;
    color: #fff;
    margin: 15px 0;
    opacity: 0.9;
}

.winner-stats {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 10px;
    margin: 20px 0;
}

.sequences-achieved {
    font-size: 1.2em;
    color: #fff;
    font-weight: bold;
}

.winner-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

.template-actions {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
    margin-top: 20px;
}

.template-edit-actions {
    display: flex;
    gap: 10px;
}

.winner-actions .btn, .template-actions .btn {
    padding: 12px 25px;
    font-size: 1.1em;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.winner-actions .btn.primary {
    background: #28a745;
    color: white;
}

.winner-actions .btn.secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 2px solid rgba(255, 255, 255, 0.3);
}

.winner-actions .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideIn {
    from {
        transform: translateX(100%);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideInFromBottom {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@keyframes scaleIn {
    from { transform: scale(0.7); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

@keyframes bounce {
    from { transform: translateY(0); }
    to { transform: translateY(-10px); }
}

@keyframes glow {
    from { text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5), 0 0 20px currentColor; }
    to { text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5), 0 0 30px currentColor, 0 0 40px currentColor; }
}

/* Top Header Bar - Clean and Minimal */
.top-header-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 70px;
    background: linear-gradient(135deg, #0a4d2a 0%, #1e7e34 100%);
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 30px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    z-index: 1000;
    border-bottom: 3px solid rgba(40, 167, 69, 0.5);
}

.header-left {
    display: flex;
    align-items: center;
    gap: 15px;
}

.app-title {
    color: #fff;
    font-size: 2em;
    margin: 0;
    font-weight: 700;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
    letter-spacing: 1px;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 20px;
}

.username-display {
    color: rgba(255,255,255,0.95);
    font-size: 1.1em;
    font-weight: 600;
    background: rgba(255,255,255,0.1);
    padding: 8px 20px;
    border-radius: 20px;
    border: 2px solid rgba(255,255,255,0.2);
}

.home-btn,
.settings-btn {
    background: rgba(255,255,255,0.15);
    border: 2px solid rgba(255,255,255,0.3);
    color: #fff;
    font-size: 1.5em;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.home-btn:hover,
.settings-btn:hover {
    background: rgba(255,255,255,0.25);
    border-color: #28a745;
    transform: scale(1.1);
}

.home-btn:active,
.settings-btn:active {
    transform: scale(0.95);
}

/* Main Content - Full Width (No Sidebar) */
.main-content-full {
    margin-top: 70px;
    min-height: calc(100vh - 70px);
    padding: 40px;
    background: linear-gradient(135deg, #0a4d2a, #1e7e34, #28a745);
    width: 100%;
}

.content-page {
    display: none;
    animation: fadeIn 0.4s ease-in-out;
    max-width: 1400px;
    margin: 0 auto;
}

.content-page.active {
    display: block;
}

.content-page h1 {
    color: #fff;
    margin-bottom: 30px;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

/* Home Page */
.play-options {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    margin-bottom: 40px;
    max-width: 800px;
}

.btn.large {
    padding: 30px;
    font-size: 1.3em;
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.join-section {
    background: rgba(255,255,255,0.1);
    padding: 30px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.join-section h3 {
    color: #fff;
    margin-bottom: 20px;
}

/* Card Grid Layout for Home Page */
.game-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 25px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px 0;
}

/* Maintain consistent order on all screens */
.game-card:nth-child(1) { order: 1; } /* Create Game */
.game-card:nth-child(2) { order: 2; } /* Quick Match */
.game-card:nth-child(3) { order: 3; } /* Join Room */
.game-card:nth-child(4) { order: 4; } /* Profile */
.game-card:nth-child(5) { order: 5; } /* Friends */
.game-card:nth-child(6) { order: 6; } /* Statistics */

.game-card {
    background: linear-gradient(135deg, rgba(255,255,255,0.15), rgba(255,255,255,0.05));
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 20px;
    padding: 40px 30px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    position: relative;
    overflow: hidden;
}

.game-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(40, 167, 69, 0.1), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.game-card:hover {
    transform: translateY(-10px);
    border-color: #28a745;
    box-shadow: 0 15px 40px rgba(40, 167, 69, 0.3);
}

.game-card:hover::before {
    opacity: 1;
}

.game-card .card-icon {
    font-size: 4em;
    margin-bottom: 20px;
    filter: drop-shadow(0 4px 8px rgba(0,0,0,0.3));
}

.game-card h3 {
    color: #fff;
    margin: 15px 0 10px 0;
    font-size: 1.5em;
    font-weight: 600;
}

.game-card p {
    color: rgba(255,255,255,0.8);
    font-size: 1em;
    margin: 0;
}

/* Page Header with Back Button */
.page-header {
    display: flex;
    align-items: center;
    gap: 20px;
    margin-bottom: 30px;
}

.back-btn {
    background: rgba(255,255,255,0.1);
    border: 2px solid rgba(255,255,255,0.3);
    color: #fff;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 1em;
    cursor: pointer;
    transition: all 0.3s ease;
}

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

/* Create Game Page */
.create-game-content,
.quick-match-content,
.join-room-content {
    max-width: 800px;
    margin: 0 auto;
}

.game-settings-section,
.match-settings-section,
.join-form-section {
    background: rgba(255,255,255,0.1);
    padding: 30px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255,255,255,0.1);
}

.game-settings-section h3,
.match-settings-section h3,
.join-form-section h3 {
    color: #fff;
    margin-bottom: 25px;
    font-size: 1.4em;
    border-bottom: 2px solid rgba(255,255,255,0.2);
    padding-bottom: 15px;
}

.settings-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 30px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    color: rgba(255,255,255,0.9);
    font-weight: 600;
    font-size: 1em;
}

.form-group select,
.form-group input[type="number"] {
    padding: 12px;
    border-radius: 8px;
    border: 2px solid rgba(255,255,255,0.2);
    background: rgba(0,0,0,0.3);
    color: #fff;
    font-size: 1em;
    transition: all 0.3s ease;
}

.form-group select:focus,
.form-group input[type="number"]:focus {
    outline: none;
    border-color: #28a745;
    background: rgba(0,0,0,0.4);
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    cursor: pointer;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* Quick Match - NEW DESIGN */
.quick-match-config {
    max-width: 500px;
    margin: 40px auto;
    background: rgba(255,255,255,0.1);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
}

.quick-match-config h2 {
    color: #fff;
    margin-bottom: 30px;
}

.config-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin-bottom: 30px;
}

.config-select,
.prep-select {
    width: 100%;
    padding: 15px;
    font-size: 1.1em;
    border-radius: 10px;
    border: 2px solid rgba(255,255,255,0.3);
    background: rgba(0,0,0,0.4);
    color: #fff;
    cursor: pointer;
}

.config-select:focus,
.prep-select:focus {
    border-color: #28a745;
    outline: none;
}

/* Searching Animation */
.quick-match-searching {
    text-align: center;
    padding: 80px 40px;
}

.spinner-large {
    width: 80px;
    height: 80px;
    border: 6px solid rgba(255,255,255,0.2);
    border-top-color: #28a745;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 30px;
}

.quick-match-searching h2 {
    color: #fff;
    margin: 20px 0;
}

.search-details {
    color: rgba(255,255,255,0.7);
    font-size: 1.1em;
    margin: 10px 0 30px;
}

.dots {
    display: flex;
    justify-content: center;
    gap: 8px;
    margin: 20px 0;
}

.dots span {
    width: 12px;
    height: 12px;
    background: #28a745;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.dots span:nth-child(1) { animation-delay: -0.32s; }
.dots span:nth-child(2) { animation-delay: -0.16s; }

/* Preparation Screen */
.quick-match-prep {
    max-width: 700px;
    margin: 20px auto;
    padding: 30px;
    background: rgba(255,255,255,0.1);
    border-radius: 20px;
}

.prep-header {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
}

.prep-header h2 {
    color: #28a745;
    font-size: 2.5em;
    margin: 0;
}

.countdown-timer {
    position: absolute;
    top: 0;
    right: 0;
    background: #ffc107;
    color: #000;
    font-size: 2em;
    font-weight: bold;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.players-prep {
    display: flex;
    justify-content: space-around;
    align-items: center;
    margin: 40px 0;
    gap: 20px;
}

.player-prep-card {
    text-align: center;
    flex: 1;
}

.player-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, #007bff, #0056b3);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2em;
    font-weight: bold;
    margin: 0 auto 15px;
    border: 4px solid #fff;
}

.player-name {
    color: #fff;
    font-size: 1.3em;
    font-weight: 600;
    margin-bottom: 10px;
}

.ready-status {
    color: rgba(255,255,255,0.7);
    font-size: 1em;
}

.ready-status.ready {
    color: #28a745;
    font-weight: bold;
}

.vs-text {
    font-size: 3em;
    font-weight: bold;
    color: #ffc107;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

.prep-options {
    background: rgba(0,0,0,0.3);
    padding: 25px;
    border-radius: 15px;
    margin: 30px 0;
}

.prep-options h3 {
    color: #fff;
    margin-bottom: 20px;
    text-align: center;
}

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

.option-row label {
    color: rgba(255,255,255,0.9);
    font-weight: 600;
    font-size: 1.1em;
}

.color-picker {
    display: flex;
    gap: 15px;
}

.color-choice {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid rgba(255,255,255,0.3);
    background: transparent;
    font-size: 2em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.color-choice:hover,
.color-choice.selected {
    border-color: #fff;
    transform: scale(1.15);
    border-width: 4px;
}

.prep-hint {
    text-align: center;
    color: rgba(255,255,255,0.7);
    margin-top: 20px;
    font-size: 1.1em;
}

/* Custom Matches */
.custom-actions {
    display: flex;
    gap: 15px;
    margin-bottom: 30px;
    justify-content: center;
    flex-wrap: wrap;
}

.custom-matches-section {
    margin-top: 20px;
}

.custom-matches-section h2 {
    color: #fff;
    margin-bottom: 20px;
    font-size: 1.5em;
}

.custom-matches-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    max-height: 500px;
    overflow-y: auto;
}

.match-card {
    background: rgba(0,0,0,0.3);
    border: 2px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    cursor: pointer;
}

.match-card:hover {
    border-color: #28a745;
    background: rgba(40,167,69,0.1);
    transform: translateX(5px);
}

.match-info h3 {
    color: #fff;
    margin: 0 0 10px 0;
    font-size: 1.3em;
}

.match-details {
    color: rgba(255,255,255,0.7);
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    font-size: 0.95em;
}

.match-join-btn {
    background: #28a745;
    color: white;
    border: none;
    padding: 12px 30px;
    border-radius: 8px;
    font-size: 1em;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.match-join-btn:hover {
    background: #218838;
    transform: scale(1.05);
}

.no-matches {
    text-align: center;
    color: rgba(255,255,255,0.6);
    padding: 60px 20px;
    font-size: 1.2em;
}

/* Create Custom Form */
.create-custom-form {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: linear-gradient(135deg, #0a4d2a 0%, #1e7e34 100%);
    border: 3px solid #28a745;
    border-radius: 20px;
    padding: 40px;
    max-width: 600px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    z-index: 2000;
    box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

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

.form-header h2 {
    color: #fff;
    margin: 0;
}

.close-form-btn {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 2em;
    cursor: pointer;
    padding: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-form-btn:hover {
    color: #dc3545;
}

.highlight {
    background: rgba(255,193,7,0.2);
    padding: 15px;
    border-radius: 10px;
    border: 2px dashed #ffc107;
}

/* Mobile Responsive */
@media (max-width: 768px) {
    .players-prep {
        flex-direction: column;
        gap: 30px;
    }
    
    .vs-text {
        font-size: 2em;
        transform: rotate(90deg);
    }
    
    .countdown-timer {
        position: static;
        margin: 20px auto;
    }
    
    .create-custom-form {
        padding: 20px;
        width: 95%;
    }
}

/* Join Room Page */
.join-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 400px;
    margin: 0 auto;
}

.join-form input {
    padding: 15px;
    border-radius: 10px;
    border: 2px solid rgba(255,255,255,0.2);
    background: rgba(0,0,0,0.3);
    color: #fff;
    font-size: 1.2em;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 3px;
}

.join-form input::placeholder {
    color: rgba(255,255,255,0.5);
    text-transform: none;
    letter-spacing: normal;
}

/* Profile Page */
.profile-content,
.friends-content,
.stats-content,
.settings-content {
    display: flex;
    flex-direction: column;
    gap: 30px;
    max-width: 1200px;
}

.profile-section {
    background: rgba(255,255,255,0.1);
    padding: 30px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.profile-section h3 {
    color: #fff;
    margin-bottom: 20px;
    border-bottom: 2px solid rgba(255,255,255,0.2);
    padding-bottom: 10px;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    max-width: 800px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.info-item label {
    color: rgba(255,255,255,0.7);
    font-size: 0.9em;
}

.info-item span {
    color: #fff;
    font-size: 1.1em;
    font-weight: 600;
}

.username-editor {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.username-editor input {
    flex: 1;
    min-width: 200px;
}

.status-text {
    color: #fff;
    font-size: 0.9em;
}

/* Friends Page */
.friends-content {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.search-section,
.friends-lists {
    background: rgba(255,255,255,0.1);
    padding: 30px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.search-section h3 {
    color: #fff;
    margin-bottom: 15px;
}

.friend-search {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.friend-search input {
    flex: 1;
}

.search-results {
    min-height: 50px;
    padding: 15px;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
}

.friends-lists {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
}

.list-section h3 {
    color: #fff;
    margin-bottom: 15px;
    border-bottom: 2px solid rgba(255,255,255,0.2);
    padding-bottom: 10px;
}

.requests-list,
.friends-list {
    background: rgba(0,0,0,0.2);
    padding: 15px;
    border-radius: 8px;
    min-height: 150px;
    max-height: 400px;
    overflow-y: auto;
}

/* Stats Page */
.stats-overview {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.stat-card {
    background: linear-gradient(135deg, rgba(255,255,255,0.15), rgba(255,255,255,0.05));
    padding: 30px;
    border-radius: 15px;
    text-align: center;
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255,255,255,0.1);
    transition: transform 0.3s;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-value {
    font-size: 3em;
    font-weight: bold;
    color: #fff;
    margin-bottom: 10px;
}

.stat-label {
    color: rgba(255,255,255,0.8);
    font-size: 1.1em;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.history-section {
    background: rgba(255,255,255,0.1);
    padding: 30px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.history-section h3 {
    color: #fff;
    margin-bottom: 20px;
    border-bottom: 2px solid rgba(255,255,255,0.2);
    padding-bottom: 10px;
}

.history-table {
    max-height: 500px;
    overflow-y: auto;
}

/* Settings Page */
.settings-content {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.setting-section {
    background: rgba(255,255,255,0.1);
    padding: 30px;
    border-radius: 15px;
    backdrop-filter: blur(10px);
}

.setting-section h3 {
    color: #fff;
    margin-bottom: 20px;
    border-bottom: 2px solid rgba(255,255,255,0.2);
    padding-bottom: 10px;
}

.setting-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 15px;
    margin-bottom: 10px;
    background: rgba(0,0,0,0.2);
    border-radius: 8px;
    color: #fff;
    cursor: pointer;
    transition: background 0.3s;
}

.setting-toggle:hover {
    background: rgba(0,0,0,0.3);
}

.setting-toggle input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

/* Mobile Responsive - Professional Grid System */
@media (max-width: 1200px) {
    .info-grid {
        grid-template-columns: 1fr;
    }
    
    .stats-overview {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    /* Top Header Mobile */
    .top-header-bar {
        height: 60px;
        padding: 0 15px;
    }
    
    .app-title {
        font-size: 1.4em;
    }
    
    .username-display {
        font-size: 0.9em;
        padding: 6px 12px;
    }
    
    .home-btn,
    .settings-btn {
        width: 40px;
        height: 40px;
        font-size: 1.2em;
    }
    
    .main-content-full {
        margin-top: 60px;
        padding: 15px;
        min-height: calc(100vh - 60px);
    }
    
    .content-page h1 {
        font-size: 1.6em;
        margin-bottom: 20px;
    }
    
    /* Home page mobile */
    .play-options {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .btn.large {
        padding: 20px;
        font-size: 1.1em;
        min-height: 80px;
    }
    
    .join-section {
        padding: 20px;
    }
    
    .join-room {
        flex-direction: column;
    }
    
    .join-room input {
        width: 100%;
    }
    
    /* Card Grid Mobile - Single column for consistent order */
    .game-cards-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 10px 0;
    }
    
    .game-card {
        padding: 30px 20px;
        min-height: 120px;
    }
    
    .game-card .card-icon {
        font-size: 3em;
    }
    
    .game-card h3 {
        font-size: 1.3em;
    }
    
    /* Page Headers Mobile */
    .page-header {
        flex-direction: row;
        gap: 15px;
    }
    
    .page-header h1 {
        font-size: 1.4em;
    }
    
    .back-btn {
        padding: 8px 15px;
        font-size: 0.9em;
    }
    
    /* Settings Forms Mobile */
    .game-settings-section,
    .match-settings-section,
    .join-form-section {
        padding: 20px;
    }
    
    .settings-form {
        gap: 15px;
    }
    
    /* Profile page mobile */
    .profile-section {
        padding: 20px;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .username-editor {
        flex-direction: column;
        align-items: stretch;
    }
    
    .username-editor input {
        width: 100%;
    }
    
    /* Friends page mobile */
    .friends-lists {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .friend-search {
        flex-direction: column;
    }
    
    .friend-search input {
        width: 100%;
    }
    
    /* Stats page mobile */
    .stats-overview {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }
    
    .stat-card {
        padding: 20px;
    }
    
    .stat-value {
        font-size: 2em;
    }
    
    .stat-label {
        font-size: 0.85em;
    }
    
    .history-section {
        padding: 20px;
    }
    
    /* Settings page mobile */
    .setting-section {
        padding: 20px;
    }
    
    /* Table responsive */
    table {
        font-size: 0.85em;
    }
    
    table td,
    table th {
        padding: 8px;
    }
}

@media (max-width: 480px) {
    .app-title {
        font-size: 1.2em;
    }
    
    .username-display {
        display: none; /* Hide on very small screens */
    }
    
    .home-btn,
    .settings-btn {
        width: 36px;
        height: 36px;
        font-size: 1.1em;
    }
    
    .main-content-full {
        padding: 10px;
    }
    
    .content-page h1 {
        font-size: 1.4em;
    }
    
    /* Stats cards stack on very small screens */
    .stats-overview {
        grid-template-columns: 1fr;
    }
    
    .stat-value {
        font-size: 2.5em;
    }
    
    /* Make buttons full width on small screens */
    .btn {
        width: 100%;
    }
    
    .play-options .btn.large {
        width: 100%;
    }
    
    /* Table scroll on very small screens */
    .history-table {
        overflow-x: auto;
    }
    
    table {
        min-width: 500px;
        font-size: 0.8em;
    }
}

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

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

/* Account & History Modal Styles */
.account-info {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 15px;
}

.account-info p {
    margin: 8px 0;
    text-align: left;
}

.username-section {
    background: rgba(255, 255, 255, 0.08);
    padding: 15px;
    border-radius: 8px;
}

.username-section label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
}

#usernameStatus {
    display: inline-block;
    margin-left: 10px;
    font-size: 0.9em;
}

.stats-section {
    background: rgba(255, 255, 255, 0.08);
    padding: 15px;
    border-radius: 8px;
}

.privacy-section {
    background: rgba(255, 255, 255, 0.08);
    padding: 15px;
    border-radius: 8px;
}

.privacy-section label {
    display: block;
    margin: 8px 0;
    cursor: pointer;
}

.friends-section {
    background: rgba(255, 255, 255, 0.08);
    padding: 15px;
    border-radius: 8px;
}

#searchResultsDiv {
    padding: 10px;
    min-height: 40px;
}

#incomingRequestsList,
#friendsList {
    background: rgba(0, 0, 0, 0.2);
    padding: 10px;
    border-radius: 6px;
    min-height: 80px;
}

.auth-options {
    display: flex;
    gap: 10px;
    justify-content: center;
    flex-wrap: wrap;
}

.auth-form {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 10px;
    margin: 0 auto;
}

/* Table styles for history */
table {
    border-collapse: collapse;
    width: 100%;
}

table th {
    background: rgba(255, 255, 255, 0.15);
    font-weight: 600;
}

table td,
table th {
    text-align: left;
    padding: 10px;
}

table tbody tr:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* Players Table Styles */
.players-table {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 10px;
    margin: 15px 0;
}

.players-table h4 {
    margin: 0 0 10px 0;
    color: #fff;
    text-align: center;
}

.players-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 10px;
}

.player-row {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr 1fr;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.05);
    align-items: center;
    font-size: 14px;
}

.player-row.current-turn {
    background: rgba(255, 215, 0, 0.2);
    border: 2px solid #ffd700;
    animation: currentTurnGlow 2s ease-in-out infinite alternate;
}

.player-row.red {
    border-left: 4px solid #dc3545;
}

.player-row.blue {
    border-left: 4px solid #007bff;
}

.player-row.green {
    border-left: 4px solid #28a745;
}

.player-name {
    font-weight: bold;
}

.player-team {
    font-size: 12px;
    opacity: 0.8;
}

.player-sequences {
    font-size: 12px;
    text-align: center;
}

.player-status {
    text-align: center;
    font-size: 12px;
}

@keyframes currentTurnGlow {
    from {
        box-shadow: 0 0 5px rgba(255, 215, 0, 0.5);
    }
    to {
        box-shadow: 0 0 15px rgba(255, 215, 0, 0.8);
    }
}

/* Last Move Styles */
.last-move {
    margin-top: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    border-left: 4px solid #17a2b8;
}

.last-move h4 {
    margin: 0 0 10px 0;
    color: #17a2b8;
    font-size: 16px;
}

#lastMoveInfo {
    font-size: 14px;
    color: #fff;
    opacity: 0.9;
}

/* Player Management Styles */
.team-controls {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.add-ai-btn {
    background: #6c757d;
    color: white;
    border: none;
    padding: 8px 12px;
    border-radius: 5px;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.add-ai-btn:hover {
    background: #5a6268;
    transform: translateY(-1px);
}

.player-tag {
    display: inline-flex;
    align-items: center;
    background: rgba(255, 255, 255, 0.1);
    padding: 4px 8px;
    border-radius: 12px;
    margin: 2px;
    font-size: 0.9em;
}

.player-tag.disconnected {
    background: rgba(255, 255, 255, 0.05);
    opacity: 0.6;
    border: 1px dashed rgba(255, 255, 255, 0.3);
}

.player-tag.disconnected span {
    color: #888;
}

.remove-player-btn {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    cursor: pointer;
    margin-left: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.remove-player-btn:hover {
    background: #c82333;
    transform: scale(1.1);
}

.player-tag span {
    flex: 1;
}

/* Enhanced Chip Visibility - Default Light Theme */
.chip {
    border: 2px solid #000 !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6) !important;
}

.chip.red {
    background: linear-gradient(135deg, #ff4757, #c44569) !important;
    border-color: #2c2c2c !important;
}

.chip.blue {
    background: linear-gradient(135deg, #3742fa, #2f3542) !important;
    border-color: #2c2c2c !important;
}

.chip.green {
    background: linear-gradient(135deg, #2ed573, #1e824c) !important;
    border-color: #2c2c2c !important;
}

/* Mobile zoom controls - always available but hidden by default */
.mobile-zoom-controls {
    display: none;
    position: fixed;
    top: 10px;
    right: 10px;
    z-index: 1001;
    gap: 5px;
    background: rgba(0,0,0,0.8);
    padding: 8px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

.zoom-btn {
    width: 35px;
    height: 35px;
    background: rgba(255,255,255,0.2);
    border: 1px solid rgba(255,255,255,0.3);
    color: white;
    border-radius: 6px;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.zoom-btn:hover {
    background: rgba(255,255,255,0.4);
    transform: scale(1.1);
}

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

.zoom-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* Mobile Layout - Comprehensive responsive with user controls */
@media (max-width: 768px) {
    body {
        overflow-x: hidden; /* Prevent horizontal scroll */
        overflow-y: auto; /* Allow vertical scroll */
        min-width: 320px; /* Minimum supported width */
        width: 100vw;
        max-width: 100vw;
    }
    
    /* Ensure game screen fits viewport */
    #gameplayScreen {
        width: 100vw;
        max-width: 100vw;
        overflow-x: hidden;
        padding: 0;
        margin: 0;
    }
    
    /* Show zoom controls for mobile */
    .mobile-zoom-controls {
        display: flex !important;
        top: 5px;
        right: 5px;
        padding: 4px;
    }
    
    .zoom-btn {
        width: 28px;
        height: 28px;
        font-size: 14px;
    }
    
    /* Convert three-column layout to mobile stack */
    .three-column-layout {
        display: flex !important;
        flex-direction: column !important;
        gap: 8px;
        padding: 8px;
        min-height: 100vh;
        overflow-y: auto;
        width: 100%;
        min-width: 300px;
    }
    
    /* Mobile order: Info -> Cards -> Board */
    .left-info-column {
        order: 1;
        width: 100%;
        display: flex;
        flex-direction: row;
        gap: 8px;
        overflow-x: auto;
        padding: 8px;
        background: rgba(255,255,255,0.1);
        border-radius: 6px;
        flex-shrink: 0;
    }
    
    .left-info-column > div {
        flex-shrink: 0;
        min-width: 120px;
    }
    
    .middle-cards-column {
        order: 2;
        width: 100%;
        padding: 8px;
        flex-shrink: 0;
    }
    
    .right-board-column {
        order: 3;
        width: 100%;
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 8px;
        flex-shrink: 0;
        overflow: auto;
        position: relative;
    }
    
    .board-container-full {
        position: relative;
        display: flex;
        justify-content: center;
        align-items: center;
        width: 100%;
        overflow: auto;
        touch-action: pan-x pan-y;
    }
    
    /* Board zoom controls */
    .board-zoom-controls {
        position: absolute;
        top: 5px;
        right: 5px;
        display: flex;
        gap: 3px;
        z-index: 100;
        background: rgba(0,0,0,0.7);
        padding: 3px;
        border-radius: 4px;
    }
    
    .board-zoom-btn {
        width: 24px;
        height: 24px;
        background: rgba(255,255,255,0.2);
        border: 1px solid rgba(255,255,255,0.3);
        color: white;
        border-radius: 3px;
        font-size: 12px;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    /* Board sizing for mobile - much smaller */
    .sequence-board-large,
    .sequence-board {
        width: min(200px, 50vw) !important;
        height: min(200px, 50vw) !important;
        max-width: 220px !important;
        max-height: 220px !important;
        aspect-ratio: 1;
        padding: 2px;
        gap: 0.5px;
        overflow: visible;
        flex-shrink: 0;
        margin: 0 auto;
        transform-origin: center;
    }
    
    .board-cell {
        font-size: clamp(4px, 1.2vw, 7px) !important;
        border-radius: 1px;
        min-width: 8px;
        min-height: 12px;
        padding: 0.5px;
        line-height: 1;
    }
    
    /* Hand cards mobile styling - ensure visibility */
    .hand-cards-section {
        background: rgba(255,255,255,0.1);
        border-radius: 6px;
        padding: 8px;
        margin-bottom: 8px;
    }
    
    .cards-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        margin-bottom: 8px;
    }
    
    .cards-header h3 {
        font-size: 14px;
        margin: 0;
        color: #fff;
    }
    
    .player-cards-middle {
        display: flex;
        gap: 8px;
        overflow-x: auto;
        overflow-y: visible;
        padding: 8px 0;
        min-width: max-content;
        background: rgba(0,0,0,0.2);
        border-radius: 4px;
        padding: 8px;
    }
    
    .hand-card {
        width: 50px !important;
        height: 70px !important;
        flex-shrink: 0;
        min-width: 50px;
        position: relative;
        border-radius: 6px;
        overflow: hidden;
        cursor: pointer;
        transition: transform 0.2s ease;
    }
    
    .hand-card:hover {
        transform: translateY(-5px);
    }
    
    .hand-card-canvas {
        width: 100%;
        height: 100%;
        border-radius: 6px;
    }
    
    .card-fallback {
        position: absolute;
        top: 0;
        left: 0;
        width: 100%;
        height: 100%;
        display: flex;
        align-items: center;
        justify-content: center;
        background: white;
        border: 2px solid #333;
        border-radius: 6px;
        font-weight: bold;
        color: #333;
        font-size: 10px;
    }
    
    
    /* Info sections mobile styling */
    .players-section,
    .sequences-section,
    .last-turn-section {
        padding: 8px;
        font-size: 12px;
        background: rgba(255,255,255,0.05);
        border-radius: 6px;
        min-width: 120px;
    }
    
    .players-section h4,
    .sequences-section h4,
    .last-turn-section h4 {
        font-size: 13px;
        margin-bottom: 6px;
        color: #fff;
    }
    
    .players-grid-compact {
        display: flex;
        flex-direction: column;
        gap: 4px;
    }
    
    .sequences-grid {
        display: flex;
        flex-direction: column;
        gap: 4px;
    }
    
    .sequence-item {
        display: flex;
        align-items: center;
        gap: 6px;
        font-size: 11px;
    }
    
    .team-color {
        width: 12px;
        height: 12px;
        border-radius: 50%;
    }
    
    .red-dot { background: #dc3545; }
    .blue-dot { background: #007bff; }
    .green-dot { background: #28a745; }
    
    /* Controls header mobile */
    .controls-header {
        display: flex;
        flex-direction: column;
        gap: 6px;
        margin-bottom: 8px;
        padding: 8px;
        background: rgba(255,255,255,0.1);
        border-radius: 6px;
        flex-shrink: 0;
    }
    
    .game-info-compact {
        display: flex;
        justify-content: space-between;
        font-size: 11px;
        flex-wrap: wrap;
        gap: 4px;
    }
    
    .timer-section {
        text-align: center;
        font-size: 16px;
        font-weight: bold;
        color: #fff;
        background: rgba(0,0,0,0.3);
        padding: 4px 8px;
        border-radius: 4px;
    }
    
    .header-buttons {
        display: flex;
        gap: 6px;
        justify-content: center;
        flex-wrap: wrap;
    }
    
    .header-btn {
        padding: 6px 10px;
        border-radius: 4px;
        border: none;
        font-size: 11px;
        cursor: pointer;
        min-width: 60px;
        text-align: center;
    }
    
    .menu-btn {
        background: #007bff;
        color: white;
    }
    
    .developer-btn {
        background: #ffc107;
        color: black;
    }
}

/* Small Mobile - Enhanced with user controls */
@media (max-width: 480px) {
    .mobile-zoom-controls {
        top: 5px;
        right: 5px;
        padding: 3px;
    }
    
    .zoom-btn {
        width: 25px;
        height: 25px;
        font-size: 14px;
    }
    
    .three-column-layout {
        padding: 5px;
        gap: 8px;
        min-width: 280px;
    }
    
    .sequence-board-large,
    .sequence-board {
        width: min(180px, 45vw) !important;
        height: min(180px, 45vw) !important;
        max-width: 200px !important;
        max-height: 200px !important;
        padding: 2px;
        gap: 0.5px;
    }
    
    .board-cell {
        font-size: clamp(3px, 1vw, 6px) !important;
        border-radius: 1px;
        min-width: 6px;
        min-height: 10px;
        padding: 0.2px;
        line-height: 0.9;
    }
    
    .hand-card {
        width: 45px !important;
        height: 63px !important;
        min-width: 45px;
    }
    
    .player-cards-middle {
        gap: 8px;
        padding: 6px 0;
    }
    
    .left-info-column {
        padding: 8px;
        gap: 8px;
    }
    
    .left-info-column > div {
        min-width: 100px;
        padding: 6px;
        font-size: 10px;
    }
    
    .controls-header {
        padding: 8px;
        gap: 6px;
    }
    
    .header-btn {
        padding: 6px 10px;
        font-size: 11px;
    }
    
    /* Ensure all text remains readable */
    .app-title {
        font-size: 1.2em;
    }
    
    .btn {
        padding: 10px 15px;
        font-size: 14px;
    }
    
    /* Horizontal scroll indicators */
    .scroll-indicator {
        position: relative;
    }
    
    .scroll-indicator::after {
        content: '↔';
        position: absolute;
        right: 5px;
        top: 50%;
        transform: translateY(-50%);
        color: rgba(255,255,255,0.5);
        font-size: 12px;
        pointer-events: none;
    }
}

/* Desktop Overrides */
@media (min-width: 769px) {
    .game-layout {
        gap: 30px;
    }
    
    .right-panel {
        padding: 0 20px;
    }
    
    .sequence-board {
        width: min(65vw, 600px) !important;
        height: min(65vw, 600px) !important;
        max-width: 600px !important;
        max-height: 600px !important;
        padding: 20px !important;
    }
    
    .board-cell {
        width: 100%;
        height: 100%;
        aspect-ratio: 5/7;
        font-size: 16px;   /* Increased from 12px */
        padding: 4px;      /* Increased padding */
        min-width: 0;
        min-height: 0;
    }
    
    /* Desktop symbol sizes - much larger for visibility */
    .suit-symbol.size-large {
        font-size: 14px;   /* Increased from 8px */
    }
    
    .suit-symbol.size-medium {
        font-size: 12px;   /* Increased from 6px */
    }
    
    .suit-symbol.size-small {
        font-size: 10px;   /* Increased from 4px */
    }
    
    .suit-symbol.size-tiny {
        font-size: 8px;    /* Increased from 3px */
    }
    
    /* Desktop corner elements */
    .corner-rank {
        font-size: 10px;   /* Increased from 6px */
    }
    
    .corner-suit {
        font-size: 8px;    /* Increased from 5px */
    }
    
    .face-symbol {
        font-size: 18px;   /* Increased from 10px */
    }
    
    .face-suit {
        font-size: 14px;   /* Increased from 8px */
    }
    
    .players-grid {
        grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    }
    
    .player-row {
        font-size: 14px;
        padding: 8px 12px;
    }
    
    .player-cards {
        flex-wrap: wrap;
    }
    
    .hand-card {
        width: 100px !important;
        height: 140px !important;
    }
    
    .game-header {
        flex-direction: row;
        justify-content: space-between;
        align-items: center;
    }
    
    .game-info {
        flex-direction: row;
        gap: 20px;
        font-size: 16px;
    }
}

/* Admin Controls Styles */
.admin-controls {
    margin-top: 30px;
    padding: 20px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.admin-controls h4 {
    color: #ffd700;
    margin-bottom: 15px;
    font-size: 1.2em;
}

.admin-controls h5 {
    color: #fff;
    margin-bottom: 10px;
    font-size: 1em;
}

.player-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.player-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.player-info {
    display: flex;
    align-items: center;
    gap: 10px;
}

.player-name {
    font-weight: bold;
    color: #fff;
}

.player-team-badge {
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: bold;
    text-transform: uppercase;
}

.player-team-badge.red {
    background: #dc3545;
    color: white;
}

.player-team-badge.blue {
    background: #007bff;
    color: white;
}

.player-team-badge.green {
    background: #28a745;
    color: white;
}

.player-actions {
    display: flex;
    gap: 5px;
}

.admin-btn {
    padding: 5px 10px;
    border: none;
    border-radius: 5px;
    font-size: 0.8em;
    cursor: pointer;
    transition: all 0.3s ease;
}

.admin-btn.remove {
    background: #dc3545;
    color: white;
}

.admin-btn.remove:hover {
    background: #c82333;
}

.admin-btn.change-team {
    background: #6c757d;
    color: white;
}

.admin-btn.change-team:hover {
    background: #5a6268;
}

.team-select {
    padding: 4px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: white;
    color: black;
    font-size: 0.8em;
}

/* AI Management Styles */
.ai-management {
    margin-top: 20px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.ai-management h5 {
    color: #ffd700;
    margin-bottom: 10px;
    font-size: 0.9em;
}

.ai-controls {
    display: flex;
    gap: 10px;
    align-items: center;
}

#aiTeamSelect {
    padding: 5px 8px;
    border: 1px solid #ccc;
    border-radius: 4px;
    background: white;
    color: black;
    font-size: 0.8em;
}

#addAIBtn {
    background: #28a745;
    color: white;
}

#addAIBtn:hover {
    background: #218838;
}

/* Compact Winner Notification (keeps board visible) */
.winner-notification {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 0; /* no backdrop */
    z-index: 1000; /* above board UI */
}

.winner-notification.hidden { display: none; }

.winner-popup {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(255,255,255,0.2);
    border-radius: 14px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.35);
    padding: 16px 18px;
    min-width: 280px;
    max-width: 90vw;
    color: #fff;
    animation: fadeIn 0.25s ease-out;
}

.winner-content {
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
    text-align: center;
}

.winner-content h3 {
    margin: 0;
    font-size: 1.25rem;
}

.winner-team-name {
    font-weight: 700;
    font-size: 1.1rem;
    letter-spacing: 0.5px;
}
.winner-team-name.red { color: #ff4d4f; }
.winner-team-name.blue { color: #3ea0ff; }
.winner-team-name.green { color: #2ed573; }

.winner-text {
    font-size: 0.95rem;
    opacity: 0.95;
}

.winner-stats {
    font-size: 0.9rem;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.12);
    padding: 6px 10px;
    border-radius: 8px;
}

.winner-buttons {
    margin-top: 8px;
    display: flex;
    gap: 8px;
}

.winner-buttons .btn {
    padding: 8px 12px;
    font-size: 0.9rem;
    border-radius: 8px;
}

.btn-primary { background: #28a745; color: #fff; }
.btn-primary:hover { background: #218838; }
.btn-secondary { background: rgba(255,255,255,0.15); color: #fff; border: 1px solid rgba(255,255,255,0.25); }
.btn-secondary:hover { background: rgba(255,255,255,0.25); }

@media (max-width: 600px) {
    .winner-popup {
        top: 12px;
        padding: 12px 14px;
        min-width: unset;
    }
    .winner-content h3 { font-size: 1.05rem; }
    .winner-team-name { font-size: 1rem; }
}

/* Developer Tools */
.dev-tools {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 10px 0 16px 0;
    padding: 10px 12px;
    background: rgba(255,255,255,0.08);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 10px;
    opacity: 1;
    pointer-events: auto;
    transition: all 0.3s ease;
}
.dev-tools label { display: flex; align-items: center; gap: 6px; }
.dev-tools select { padding: 6px 8px; border-radius: 6px; border: none; }
.dev-tools .dev-hint { opacity: 0.8; font-size: 0.9em; }

/* Developer Mode Active State */
.developer-mode-active .dev-tools {
    opacity: 1;
    pointer-events: auto;
    background: rgba(255, 193, 7, 0.15);
    border-color: rgba(255, 193, 7, 0.4);
    box-shadow: 0 0 10px rgba(255, 193, 7, 0.2);
}

.developer-mode-active .game-board {
    box-shadow: 0 0 20px rgba(255, 193, 7, 0.3);
}

.developer-mode-active .board-cell:hover {
    box-shadow: inset 0 0 0 2px rgba(255, 193, 7, 0.6);
}

/* Customization Mode Styles */
.game-layout {
    position: relative;
}

.customization-mode {
    /* Only prevent touch actions on panels, not the whole page */
    -webkit-user-select: none;
    user-select: none;
    /* Enable scrolling in customization mode */
    overflow-y: auto !important;
}

.customization-mode #gameplayScreen {
    /* Ensure gameplay screen can scroll in customization mode */
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
}

.customization-mode .customizable-panel {
    position: relative;
    border: 3px solid rgba(40, 167, 69, 0.4) !important;
    background: rgba(40, 167, 69, 0.02) !important;
    transition: all 0.2s ease;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
    touch-action: none;
}

.customization-mode .customizable-panel:hover {
    border-color: rgba(40, 167, 69, 0.7) !important;
    background: rgba(40, 167, 69, 0.05) !important;
    box-shadow: 0 4px 16px rgba(40, 167, 69, 0.3);
}

/* Customize Overlay */
.customize-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.05);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    z-index: 1000;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.2s;
}

.customizable-panel:hover .customize-overlay,
.customizable-panel:active .customize-overlay {
    opacity: 1;
}

.customize-label {
    background: rgba(40, 167, 69, 0.95);
    color: white;
    padding: 10px 18px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    pointer-events: none;
}

.customize-actions {
    display: flex;
    gap: 10px;
    pointer-events: auto;
}

.customize-btn {
    background: white;
    border: 2px solid #28a745;
    color: #28a745;
    padding: 12px 20px;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
    touch-action: manipulation;
    min-width: 100px;
    min-height: 44px;
}

.customize-btn:hover,
.customize-btn:active {
    background: #28a745;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(40, 167, 69, 0.4);
}

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

/* Active states */
.resizing-active {
    outline: 3px solid #ffc107 !important;
    outline-offset: 2px;
}

.moving-active {
    outline: 3px solid #17a2b8 !important;
    outline-offset: 2px;
}

/* Resize Handle Styles */
.resize-handle {
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    touch-action: none;
}

.resize-handle:active {
    background: #ffc107 !important;
    transform: scale(1.5) !important;
}

/* Layout Controls Panel - Fixed position, always visible */
.layout-controls {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 10000;
    background: linear-gradient(135deg, #0a4d2a, #1e7e34);
    padding: 20px;
    border-radius: 15px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    min-width: 200px;
    border: 3px solid #28a745;
}

/* Hide layout controls when not in customization mode */
.game-container:not(.customization-mode) .layout-controls {
    display: none !important;
    visibility: hidden !important;
}

.layout-controls h4 {
    color: #fff;
    margin: 0 0 15px 0;
    font-size: 16px;
    border-bottom: 2px solid rgba(255,255,255,0.3);
    padding-bottom: 10px;
}

.layout-controls button {
    width: 100%;
    margin: 8px 0;
    padding: 12px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.layout-controls button:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.layout-controls .btn.primary {
    background: #28a745;
    color: white;
}

.layout-controls .btn.secondary {
    background: rgba(255,255,255,0.1);
    color: white;
    border: 2px solid rgba(255,255,255,0.3);
}

.layout-controls .btn.danger {
    background: #dc3545;
    color: white;
}

/* Exit button styling */
.layout-controls #exitCustomizeBtn {
    background: #dc3545 !important;
    color: white !important;
    font-weight: 600 !important;
    border: 2px solid #fff !important;
    font-size: 14px !important;
    padding: 12px !important;
    margin-top: 8px !important;
}

.layout-controls #exitCustomizeBtn:hover {
    background: #c82333 !important;
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(220, 53, 69, 0.4);
}

/* Block interactions during customization */
.customization-mode .hand-card {
    pointer-events: none !important;
    opacity: 0.4 !important;
    filter: grayscale(0.5);
}

.customization-mode .board-cell {
    pointer-events: none !important;
    opacity: 0.4 !important;
    filter: grayscale(0.5);
}

.customization-mode .btn:not(#customizeLayoutBtn):not(#leaveGameBtn):not(.layout-controls .btn):not(.customize-btn):not(.mobile-layout-controls .btn) {
    pointer-events: none !important;
    opacity: 0.3 !important;
}

/* Smooth transition feedback */
.customizable-panel[style*="opacity"] {
    box-shadow: 0 8px 24px rgba(40, 167, 69, 0.5) !important;
}

/* Mobile customization adjustments */
@media (max-width: 768px) {
    .layout-controls {
        top: 10px !important;
        right: 10px !important;
        left: 10px !important;
        width: auto !important;
        padding: 15px !important;
        background: rgba(0, 0, 0, 0.95) !important;
        border: 2px solid #28a745 !important;
        border-radius: 15px !important;
        z-index: 10000 !important;
    }

    .layout-controls h4 {
        display: none !important;
    }

    .layout-controls {
        display: flex !important;
        flex-direction: row !important;
        gap: 10px !important;
        justify-content: center !important;
        align-items: center !important;
    }

    .layout-controls button {
        padding: 12px 16px !important;
        font-size: 14px !important;
        min-height: 48px !important;
        flex: 1 !important;
        max-width: 120px !important;
        border-radius: 10px !important;
    }

    /* Hide all other UI elements during mobile layout editing */
    .customization-mode .game-header,
    .customization-mode .right-panel,
    .customization-mode .player-hand {
        opacity: 0.3 !important;
        pointer-events: none !important;
    }

    .customization-mode .board-container {
        opacity: 0.7 !important;
    }

    /* Mobile Layout Controls */
    .mobile-layout-controls {
        position: fixed;
        top: 20px;
        left: 50%;
        transform: translateX(-50%);
        display: flex;
        gap: 15px;
        z-index: 10001;
        background: rgba(0, 0, 0, 0.9);
        padding: 15px 20px;
        border-radius: 25px;
        border: 2px solid #28a745;
        box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6);
    }

    .mobile-layout-controls button {
        padding: 12px 20px;
        font-size: 16px;
        font-weight: 600;
        border: none;
        border-radius: 15px;
        cursor: pointer;
        transition: all 0.2s ease;
        min-width: 80px;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 5px;
        pointer-events: auto !important;
        opacity: 1 !important;
    }

    .mobile-layout-controls .btn.danger {
        background: #dc3545;
        color: white;
    }

    .mobile-layout-controls .btn.success {
        background: #28a745;
        color: white;
    }

    .mobile-layout-controls button:hover {
        transform: translateY(-2px);
        box-shadow: 0 4px 15px rgba(0, 0, 0, 0.4);
    }

    .customize-label {
        font-size: 13px !important;
        padding: 8px 14px !important;
    }

    .resize-handle {
        width: 24px !important;
        height: 24px !important;
        border-width: 4px !important;
    }

    .customization-mode .customizable-panel {
        border-width: 3px !important;
    }
    
    /* CRITICAL: Enable scrolling in customize mode on mobile */
    .customization-mode {
        overflow: auto !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
    
    .customization-mode #gameplayScreen {
        overflow: auto !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        height: auto !important;
        min-height: 100vh !important;
    }
    
    body.customization-active {
        overflow: auto !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
    }
}

/* Rejoin Modal Styles */
.rejoin-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.rejoin-modal.hidden {
    display: none;
}

.rejoin-popup {
    background: linear-gradient(135deg, #1e7e34, #28a745);
    border-radius: 20px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    animation: scaleIn 0.4s ease;
}

.rejoin-content {
    text-align: center;
}

.rejoin-content h3 {
    font-size: 2em;
    margin: 0 0 20px 0;
    color: white;
}

.rejoin-content p {
    font-size: 1.2em;
    color: rgba(255,255,255,0.9);
    margin: 10px 0;
}

.rejoin-warning {
    background: rgba(255, 193, 7, 0.2);
    border: 2px solid #ffc107;
    border-radius: 10px;
    padding: 15px;
    margin: 20px 0;
    font-weight: 600;
    color: #ffc107 !important;
}

#rejoinCountdown {
    font-size: 1.5em;
    color: #ff4d4f;
    font-weight: 700;
}

.rejoin-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
    margin-top: 30px;
}

.rejoin-buttons .btn {
    padding: 15px 30px;
    font-size: 1.1em;
    border-radius: 10px;
    transition: all 0.3s ease;
}

.rejoin-buttons .btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(0,0,0,0.3);
}

/* Yellow Team Styles */
.team-yellow h4 {
    color: #ffc107;
}

.team-yellow {
    border: 3px solid #ffc107;
}

.yellow-chip::after {
    background: radial-gradient(circle, #ffc107, #ff9800);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

/* Simple Feedback Modal */
.feedback-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
}

.feedback-content {
    background: white;
    border-radius: 10px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.feedback-header {
    background: #28a745;
    color: white;
    padding: 15px 20px;
    border-radius: 10px 10px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.feedback-header h3 {
    margin: 0;
    font-size: 1.2em;
}

.close-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.5em;
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.feedback-body {
    padding: 20px;
}

.feedback-body textarea {
    width: 100%;
    border: 2px solid #ddd;
    border-radius: 5px;
    padding: 10px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    min-height: 100px;
}

.feedback-body textarea:focus {
    outline: none;
    border-color: #28a745;
}

.char-counter {
    text-align: right;
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

.feedback-footer {
    padding: 15px 20px;
    border-top: 1px solid #eee;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.feedback-footer .btn {
    padding: 8px 16px;
    border-radius: 5px;
    font-size: 14px;
}

/* Mobile responsive */
@media (max-width: 480px) {
    .feedback-content {
        width: 95%;
        margin: 10px;
    }
    
    .feedback-footer {
        flex-direction: column;
    }
    
    .feedback-footer .btn {
        width: 100%;
    }
}

/* Sound Settings Styles */
.setting-item {
    margin-bottom: 20px;
}

.setting-item label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: #fff;
}

.volume-control {
    display: flex;
    align-items: center;
    gap: 12px;
}

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

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

.volume-control input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #4CAF50;
    border-radius: 50%;
    cursor: pointer;
    border: none;
    box-shadow: 0 2px 4px rgba(0,0,0,0.3);
}

.volume-control span {
    min-width: 40px;
    text-align: right;
    font-weight: 600;
    color: #4CAF50;
}

/* In-Game Menu Modal */
#gameMenuModal .modal-content {
    max-width: 600px;
    width: 90%;
}

.menu-tabs {
    display: flex;
    border-bottom: 2px solid rgba(255, 255, 255, 0.2);
    margin-bottom: 20px;
}

.tab-btn {
    flex: 1;
    padding: 12px 20px;
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.7);
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 3px solid transparent;
}

.tab-btn:hover {
    color: #fff;
    background: rgba(255, 255, 255, 0.1);
}

.tab-btn.active {
    color: #4CAF50;
    border-bottom-color: #4CAF50;
    background: rgba(76, 175, 80, 0.1);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
}

.layout-controls {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.layout-controls .btn {
    flex: 1;
    min-width: 120px;
}

.layout-info {
    background: rgba(255, 255, 255, 0.1);
    padding: 15px;
    border-radius: 8px;
    border-left: 4px solid #4CAF50;
}

.layout-info p {
    margin: 8px 0;
    color: rgba(255, 255, 255, 0.9);
}

.game-actions {
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

/* Card Customization Styles - Template System */

/* Template Selection Page */
.template-selection-container {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.cards-preview-section {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 12px;
}

.cards-preview-section h3 {
    color: #fff;
    margin-bottom: 20px;
    text-align: center;
}

.cards-preview-grid {
    display: grid;
    grid-template-columns: repeat(13, 1fr);
    gap: 4px;
    justify-items: center;
    max-height: 400px;
    overflow-y: auto;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
}

.preview-card {
    width: 30px;
    height: 42px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 8px;
    font-weight: bold;
}

.preview-card:hover {
    transform: scale(1.05);
}

.template-selection-section {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 12px;
}

.template-filters {
    margin-bottom: 20px;
}

.search-row {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.template-search-input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.filter-row {
    display: flex;
    align-items: center;
    gap: 15px;
}

.filter-row label {
    color: #fff;
    font-weight: bold;
}

.filter-buttons {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.filter-btn {
    padding: 6px 12px;
    border: 1px solid #ddd;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    font-size: 12px;
}

.filter-btn:hover {
    background: rgba(255, 255, 255, 0.2);
}

.filter-btn.active {
    background: #4CAF50;
    border-color: #4CAF50;
    color: white;
}

.template-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
    max-height: 400px;
    overflow-y: auto;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
}

.template-item {
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid transparent;
    border-radius: 8px;
    padding: 10px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.template-item:hover {
    border-color: #007bff;
    transform: scale(1.05);
}

.template-item.selected {
    border-color: #4CAF50;
    background: rgba(76, 175, 80, 0.2);
    transform: scale(1.05);
}

.template-preview {
    width: 60px;
    height: 84px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    margin: 0 auto 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: bold;
}

.template-name {
    color: #fff;
    font-size: 12px;
    font-weight: bold;
    margin-bottom: 4px;
}

.template-type {
    color: rgba(255, 255, 255, 0.7);
    font-size: 10px;
}

.template-actions {
    text-align: center;
}

/* Template Editor Page */
.template-editor-container {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

.template-cards-section {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 12px;
}

.template-cards-section h3 {
    color: #fff;
    margin-bottom: 20px;
    text-align: center;
}

.template-cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 8px;
    max-height: 600px;
    overflow-y: auto;
    padding: 10px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 8px;
}

.template-card {
    width: 50px;
    height: 70px;
    background: white;
    border: 2px solid #ddd;
    border-radius: 6px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 10px;
    font-weight: bold;
}

.card-corner {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1;
}

.card-corner.top-left {
    top: 2px;
    left: 2px;
}

.card-corner.bottom-right {
    bottom: 2px;
    right: 2px;
}

.card-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    width: 30px;
    height: 40px;
}

.template-card:hover {
    transform: scale(1.1);
    border-color: #007bff;
    box-shadow: 0 2px 8px rgba(0, 123, 255, 0.3);
}

.template-card.edited {
    border-color: #4CAF50;
    box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.3);
}

.template-editor-section {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 12px;
}

.template-editor-section h3 {
    color: #fff;
    margin-bottom: 20px;
}

.editor-group {
    background: rgba(255, 255, 255, 0.05);
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    border-left: 4px solid #4CAF50;
}

.editor-group h4 {
    color: #4CAF50;
    margin-bottom: 15px;
    font-size: 16px;
}

.control-row {
    display: flex;
    align-items: center;
    margin-bottom: 12px;
    gap: 15px;
}

.control-row label {
    min-width: 120px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.9);
}

.control-row input[type="text"],
.control-row textarea {
    flex: 1;
    padding: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.control-row textarea {
    resize: vertical;
    font-family: inherit;
}

.control-row input[type="color"] {
    width: 50px;
    height: 35px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.control-row input[type="range"] {
    flex: 1;
    margin-right: 10px;
}

.control-row span {
    min-width: 50px;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
}

.control-row select {
    flex: 1;
    padding: 6px;
    border-radius: 4px;
    border: 1px solid #ddd;
    background: white;
}

.file-input {
    flex: 1;
    padding: 6px;
    border: 1px solid #ddd;
    border-radius: 4px;
    background: white;
    font-size: 12px;
}

.btn.small {
    padding: 6px 12px;
    font-size: 12px;
    min-width: auto;
}

.symbol-options, .face-options {
    display: flex;
    gap: 10px;
    margin: 10px 0;
}

.symbol-btn, .face-btn {
    width: 40px;
    height: 40px;
    border: 2px solid #ddd;
    background: white;
    border-radius: 6px;
    font-size: 20px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
}

.symbol-btn:hover, .face-btn:hover {
    border-color: #007bff;
    transform: scale(1.1);
}

.symbol-btn.selected, .face-btn.selected {
    border-color: #28a745;
    background: #e8f5e8;
    transform: scale(1.1);
}

.symbol-btn[data-suit="♥"], .symbol-btn[data-suit="♦"] {
    color: #dc3545;
}

.symbol-btn[data-suit="♠"], .symbol-btn[data-suit="♣"] {
    color: #000;
}

.editor-note {
    color: rgba(255, 255, 255, 0.8);
    font-style: italic;
    margin: 0;
    font-size: 14px;
}

.editor-actions {
    display: flex;
    gap: 10px;
    margin-top: 25px;
    padding-top: 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
    flex-wrap: wrap;
}

.editor-actions .btn {
    flex: 1;
    min-width: 120px;
}

/* Individual Card Editor Modal */
.modal-content.large {
    max-width: 900px;
    width: 90%;
}

.card-editor-modal-container {
    display: grid;
    grid-template-columns: 1fr 2fr;
    gap: 30px;
}

.card-preview-section {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 12px;
    text-align: center;
}

.card-preview-wrapper {
    background: #fff;
    padding: 20px;
    border-radius: 8px;
    margin: 15px 0;
    display: inline-block;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

#modalCardPreviewCanvas {
    border: 2px solid #ddd;
    border-radius: 8px;
    background: white;
}

.card-editor-section {
    background: rgba(255, 255, 255, 0.1);
    padding: 20px;
    border-radius: 12px;
    max-height: 500px;
    overflow-y: auto;
}

/* Template Card Consistency Fixes */
.preview-card,
.template-card {
    position: relative;
    aspect-ratio: 5/7;
    border-radius: 6px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.2);
    transition: all 0.2s ease;
}

.preview-card:hover,
.template-card:hover {
    transform: scale(1.05);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.preview-card .card-corner,
.template-card .card-corner {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    line-height: 1;
}

.preview-card .card-corner.top-left,
.template-card .card-corner.top-left {
    top: 3px;
    left: 3px;
}

.preview-card .card-corner.bottom-right,
.template-card .card-corner.bottom-right {
    bottom: 3px;
    right: 3px;
}

.preview-card .card-center,
.template-card .card-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 60%;
    height: 60%;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Template Item Styling */
.template-item {
    background: rgba(255,255,255,0.1);
    border: 2px solid rgba(255,255,255,0.2);
    border-radius: 12px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.template-item:hover {
    border-color: #28a745;
    background: rgba(255,255,255,0.15);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(40, 167, 69, 0.3);
}

.template-item.selected {
    border-color: #28a745;
    background: rgba(40, 167, 69, 0.2);
    box-shadow: 0 0 0 2px rgba(40, 167, 69, 0.5);
}

.template-item .template-preview {
    width: 60px;
    height: 84px;
    background: white;
    border-radius: 6px;
    margin: 0 auto 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #ddd;
    position: relative;
    overflow: hidden;
}

.template-item .template-name {
    font-weight: 600;
    color: #fff;
    margin-bottom: 5px;
    font-size: 14px;
}

.template-item .template-type {
    font-size: 12px;
    color: rgba(255,255,255,0.7);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Template Editor Enhancements */
.template-card.edited {
    border: 2px solid #ffc107;
    box-shadow: 0 0 8px rgba(255, 193, 7, 0.4);
}

.template-card.edited::after {
    content: '✏️';
    position: absolute;
    top: 2px;
    right: 2px;
    background: #ffc107;
    color: #000;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 8px;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .template-selection-container {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 10px;
    }
    
    .cards-preview-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
    
    .template-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    
    .template-editor-container {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 10px;
    }
    
    .template-cards-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 4px;
    }
    
    .template-item {
        padding: 10px;
    }
    
    .template-item .template-preview {
        width: 40px;
        height: 56px;
    }
    
    .preview-card,
    .template-card {
        min-height: 40px;
    }
}

@media (max-width: 480px) {
    .cards-preview-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .template-grid {
        grid-template-columns: 1fr;
    }
    
    .template-cards-grid {
        grid-template-columns: repeat(4, 1fr);
        gap: 2px;
    }
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .template-selection-container {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 15px;
    }
    
    .cards-preview-grid {
        grid-template-columns: repeat(8, 1fr);
        gap: 2px;
    }
    
    .preview-card {
        width: 25px;
        height: 35px;
    }
    
    .template-grid {
        grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
        gap: 10px;
    }
    
    .template-editor-container {
        grid-template-columns: 1fr;
        gap: 20px;
        padding: 15px;
    }
    
    .template-cards-grid {
        grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
        gap: 6px;
    }
    
    .template-card {
        width: 50px;
        height: 70px;
        font-size: 8px;
    }
    
    .card-editor-modal-container {
        grid-template-columns: 1fr;
        gap: 20px;
    }
    
    .control-row {
        flex-direction: column;
        align-items: stretch;
        gap: 8px;
    }
    
    .control-row label {
        min-width: auto;
    }
    
    .editor-actions {
        flex-direction: column;
    }
    
    .editor-actions .btn {
        width: 100%;
    }
    
    .filter-buttons {
        justify-content: center;
    }
}

/* Floating Circular Buttons */
.floating-buttons {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.floating-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 3px solid rgba(255, 255, 255, 0.3);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
}

.floating-btn:hover {
    transform: scale(1.1);
    border-color: rgba(255, 255, 255, 0.6);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}

.floating-btn.menu-btn {
    background: rgba(40, 167, 69, 0.9);
}

.floating-btn.developer-btn {
    background: rgba(255, 193, 7, 0.9);
}

.floating-btn.menu-btn:hover {
    background: rgba(40, 167, 69, 1);
}

.floating-btn.developer-btn:hover {
    background: rgba(255, 193, 7, 1);
}

/* Hide floating buttons on non-gameplay screens */
.screen:not(#gameplayScreen) .floating-buttons {
    display: none;
}

/* Hide redundant elements when floating buttons are present */
#gameplayScreen #gameMenuBtn {
    display: none;
}

#gameplayScreen .dev-tools {
    display: none;
}

/* Developer Mode Popup */
.developer-popup {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.95);
    border: 2px solid #ffc107;
    border-radius: 12px;
    padding: 0;
    z-index: 2000;
    min-width: 300px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(10px);
}

.developer-popup.hidden {
    display: none;
}

.popup-header {
    background: #ffc107;
    color: #000;
    padding: 12px 20px;
    border-radius: 10px 10px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.popup-header h3 {
    margin: 0;
    font-size: 16px;
}

.close-popup {
    background: none;
    border: none;
    font-size: 18px;
    cursor: pointer;
    color: #000;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.popup-content {
    padding: 20px;
    color: white;
}

.dev-control {
    margin-bottom: 15px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.dev-control label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
}

.dev-control select {
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #ccc;
    background: white;
    color: #000;
}

.dev-hint {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.7);
    margin-top: 10px;
    padding-top: 10px;
    border-top: 1px solid rgba(255, 255, 255, 0.2);
}

/* New 3-Column Layout - Optimized for maximum board space */
.three-column-layout {
    display: grid;
    grid-template-columns: 180px 280px 1fr;
    height: 100vh;
    width: 100vw;
    gap: 12px;
    padding: 8px;
    box-sizing: border-box;
    overflow: hidden;
}

/* Left Column: Info Sections (Narrow) */
.left-info-column {
    display: flex;
    flex-direction: column;
    gap: 12px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 12px;
    backdrop-filter: blur(10px);
    overflow-y: auto;
}

/* Middle Column: Hand Cards + Controls */
.middle-cards-column {
    display: flex;
    flex-direction: column;
    gap: 10px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 12px;
    backdrop-filter: blur(10px);
}

/* Right Column: Board Only (Maximum Space) */
.right-board-column {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 15px;
    backdrop-filter: blur(10px);
}

/* === NEW 3-COLUMN LAYOUT SECTIONS === */

/* Controls Header (Timer + Buttons above cards) */
.controls-header {
    display: flex;
    flex-direction: column;
    gap: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 12px;
}

.game-info-compact {
    display: flex;
    gap: 15px;
    font-size: 12px;
    color: #e0e0e0;
}

.game-info-compact .room-info,
.game-info-compact .turn-info {
    font-size: 12px;
}

.game-info-compact span span {
    color: #28a745;
    font-weight: bold;
}

/* Hand Cards Section */
.hand-cards-section {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 12px;
}

/* Middle Column Card Layout - Better spacing */
.player-cards-middle {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(65px, 1fr));
    gap: 10px;
    max-height: calc(100vh - 200px);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 8px;
}

.player-cards-middle .hand-card {
    width: 100%;
    height: 90px;
    border-radius: 8px;
    background: #fff;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 12px;
    color: #333;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

.player-cards-middle .hand-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.player-cards-middle .hand-card.selected {
    border-color: #ffc107 !important;
    background: #fff3cd !important;
    transform: translateY(-2px) scale(1.05) !important;
    box-shadow: 0 6px 20px rgba(255, 193, 7, 0.4) !important;
    z-index: 10;
}

/* Card images and canvas for middle layout */
.player-cards-middle .hand-card-image,
.player-cards-middle .hand-card-canvas {
    width: 100%;
    height: 100%;
    object-fit: contain !important;
    border-radius: 6px;
}

/* Large Board Container */
.board-container-full {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sequence-board-large {
    width: min(calc(100vw - 500px), calc((100vh - 50px) * 0.85));
    height: min(calc(100vw - 500px), calc(100vh - 50px));
    max-width: none;
    max-height: none;
    min-width: 600px;
    min-height: 700px;
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    grid-template-rows: repeat(10, 1fr);
    gap: 4px;
    background: #2d5a3d;
    border-radius: 12px;
    padding: 15px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Large Board cells - More vertical like real cards */
.sequence-board-large .board-cell {
    aspect-ratio: 0.7;
    border-radius: 6px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    overflow: hidden;
    position: relative;
    min-width: 0;
    min-height: 0;
    padding: 2px;
}

.sequence-board-large .board-cell:hover {
    transform: scale(1.05);
    z-index: 2;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.sequence-board-large .board-cell.free {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    font-weight: bold;
    font-size: clamp(10px, 1.5vw, 14px);
}

.sequence-board-large .board-cell.occupied {
    border: 3px solid;
}

.sequence-board-large .board-cell.red-chip {
    border-color: #dc3545;
    background: rgba(220, 53, 69, 0.2);
}

.sequence-board-large .board-cell.blue-chip {
    border-color: #007bff;
    background: rgba(0, 123, 255, 0.2);
}

.sequence-board-large .board-cell.green-chip {
    border-color: #28a745;
    background: rgba(40, 167, 69, 0.2);
}

/* Card images in large board cells - Fill more space */
.sequence-board-large .card-image {
    width: 100%;
    height: 100%;
    object-fit: cover !important;
    border-radius: 4px;
    max-width: 100%;
    max-height: 100%;
}

/* Highlighted/Selected cards on board - Much more visible glow */
.sequence-board-large .board-cell.highlighted {
    box-shadow: 0 0 25px #ffc107, 0 0 35px #ffc107, inset 0 0 15px rgba(255, 193, 7, 0.4);
    border: 3px solid #ffc107;
    transform: scale(1.08);
    z-index: 10;
    animation: cardGlow 1.5s ease-in-out infinite alternate;
}

@keyframes cardGlow {
    0% { 
        box-shadow: 0 0 25px #ffc107, 0 0 35px #ffc107, inset 0 0 15px rgba(255, 193, 7, 0.4);
        border-color: #ffc107;
    }
    100% { 
        box-shadow: 0 0 35px #ffc107, 0 0 50px #ffc107, inset 0 0 25px rgba(255, 193, 7, 0.6);
        border-color: #ffed4e;
    }
}

/* Sequence highlighting for large board */
.sequence-board-large .board-cell.sequence-red {
    box-shadow: 0 0 15px #dc3545, inset 0 0 15px rgba(220, 53, 69, 0.3);
    animation: sequenceGlow 2s ease-in-out infinite alternate;
}

.sequence-board-large .board-cell.sequence-blue {
    box-shadow: 0 0 15px #007bff, inset 0 0 15px rgba(0, 123, 255, 0.3);
    animation: sequenceGlow 2s ease-in-out infinite alternate;
}

.sequence-board-large .board-cell.sequence-green {
    box-shadow: 0 0 15px #28a745, inset 0 0 15px rgba(40, 167, 69, 0.3);
    animation: sequenceGlow 2s ease-in-out infinite alternate;
}

/* === LEFT SIDEBAR SECTIONS === */

/* 1. Cards Section */
.cards-section {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 15px;
    min-height: 200px;
}

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

.cards-header h3 {
    font-size: 16px;
    margin: 0;
    color: #fff;
}

.blur-hands-btn {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    border-radius: 6px;
    padding: 6px 10px;
    color: #fff;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s;
}

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

/* Stretched card layout - Full width, more vertical */
.player-cards-stretched {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(65px, 1fr));
    gap: 8px;
    max-height: calc(100vh - 280px);
    overflow-y: auto;
    overflow-x: hidden;
    padding: 5px;
}

.player-cards-stretched .hand-card {
    width: 100%;
    height: 90px;
    border-radius: 8px;
    background: #fff;
    border: 2px solid transparent;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 12px;
    color: #333;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    position: relative;
    overflow: hidden;
}

/* Card images in hand */
.player-cards-vertical .hand-card-image {
    width: 100%;
    height: 100%;
    object-fit: contain !important;
    border-radius: 6px;
}

/* Custom template canvas cards */
.player-cards-stretched .hand-card-canvas,
.player-cards-vertical .hand-card-canvas {
    width: 100%;
    height: 100%;
    border-radius: 6px;
    object-fit: contain;
}

/* Card images in stretched layout */
.player-cards-stretched .hand-card-image {
    width: 100%;
    height: 100%;
    object-fit: contain !important;
    border-radius: 6px;
}

.player-cards-stretched .hand-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.player-cards-stretched .hand-card.selected {
    border-color: #28a745;
    background: #e8f5e8;
    transform: scale(1.05);
}

/* Keep old vertical layout for compatibility */
.player-cards-vertical .hand-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.player-cards-vertical .hand-card.selected {
    border-color: #28a745;
    background: #e8f5e8;
    transform: scale(1.05);
}

/* 2. Players Section */
.players-section {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 15px;
}

.players-section h4 {
    font-size: 16px;
    margin: 0 0 12px 0;
    color: #fff;
}

.players-grid-compact {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.player-item-compact {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    font-size: 14px;
}

.player-item-compact.current-turn {
    background: rgba(40, 167, 69, 0.3);
    border: 1px solid #28a745;
}

.player-team-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    flex-shrink: 0;
}

.player-team-dot.red { background: #dc3545; }
.player-team-dot.blue { background: #007bff; }
.player-team-dot.green { background: #28a745; }

.player-name-compact {
    flex: 1;
    font-weight: 500;
    color: #fff;
}

/* 3. Sequences Section */
.sequences-section {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 15px;
}

.sequences-section h4 {
    font-size: 16px;
    margin: 0 0 12px 0;
    color: #fff;
}

.sequences-grid {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sequence-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    font-size: 14px;
}

.team-color {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    flex-shrink: 0;
}

.red-dot { background: #dc3545; }
.blue-dot { background: #007bff; }
.green-dot { background: #28a745; }

.team-name {
    flex: 1;
    font-weight: 500;
    color: #fff;
}

.sequence-count {
    font-weight: bold;
    color: #28a745;
    background: rgba(40, 167, 69, 0.2);
    padding: 4px 8px;
    border-radius: 6px;
    font-size: 13px;
}

/* 4. Last Turn Section */
.last-turn-section {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 15px;
}

.last-turn-section h4 {
    font-size: 16px;
    margin: 0 0 12px 0;
    color: #fff;
}

.last-move-info {
    font-size: 13px;
    color: #e0e0e0;
    line-height: 1.4;
    background: rgba(0, 0, 0, 0.2);
    padding: 10px;
    border-radius: 6px;
}

/* === RIGHT MAIN AREA === */

/* 5. Board Header */
.board-header-new {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 12px;
    padding: 15px 20px;
    backdrop-filter: blur(10px);
    flex-wrap: wrap;
    gap: 15px;
}

.header-left-info {
    display: flex;
    gap: 20px;
    align-items: center;
    flex: 1;
    min-width: 0;
}

.room-info, .turn-info {
    font-size: 14px;
    color: #e0e0e0;
}

.room-info span, .turn-info span {
    color: #28a745;
    font-weight: bold;
}

.timer-section {
    display: flex;
    align-items: center;
    gap: 5px;
    background: rgba(40, 167, 69, 0.2);
    padding: 8px 15px;
    border-radius: 8px;
    border: 1px solid #28a745;
}

.timer-label {
    font-size: 14px;
    color: #e0e0e0;
}

.timer-value {
    font-size: 20px;
    font-weight: bold;
    color: #28a745;
    min-width: 30px;
    text-align: center;
}

.timer-unit {
    font-size: 14px;
    color: #e0e0e0;
}

.header-buttons {
    display: flex;
    gap: 10px;
}

.header-btn {
    padding: 8px 16px;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
}

.header-btn.menu-btn {
    background: #007bff;
    color: white;
}

.header-btn.developer-btn {
    background: #ffc107;
    color: #000;
}

.header-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

/* 6. Board Container - Full vertical space */
.board-container-efficient {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 12px;
    padding: 12px;
    min-height: 0;
    overflow: hidden;
}

.sequence-board-new {
    width: min(calc(100vw - 420px), calc(100vh - 120px));
    height: min(calc(100vw - 420px), calc(100vh - 120px));
    max-width: none;
    max-height: none;
    min-width: 500px;
    min-height: 500px;
    aspect-ratio: 1;
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 3px;
    background: #2d5a3d;
    border-radius: 12px;
    padding: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

/* Board cells - Fixed sizing to prevent compression */
.sequence-board-new .board-cell {
    aspect-ratio: 1;
    border-radius: 4px;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    overflow: hidden;
    position: relative;
    min-width: 0;
    min-height: 0;
}

.sequence-board-new .board-cell:hover {
    transform: scale(1.05);
    z-index: 2;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.sequence-board-new .board-cell.free {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: white;
    font-weight: bold;
    font-size: clamp(8px, 1.2vw, 12px);
}

.sequence-board-new .board-cell.occupied {
    border: 3px solid;
}

.sequence-board-new .board-cell.red-chip {
    border-color: #dc3545;
    background: rgba(220, 53, 69, 0.2);
}

.sequence-board-new .board-cell.blue-chip {
    border-color: #007bff;
    background: rgba(0, 123, 255, 0.2);
}

.sequence-board-new .board-cell.green-chip {
    border-color: #28a745;
    background: rgba(40, 167, 69, 0.2);
}

/* Card images in board cells - NEVER compress */
.sequence-board-new .card-image {
    width: 100%;
    height: 100%;
    object-fit: contain !important; /* Changed from cover to contain */
    border-radius: 2px;
    max-width: 100%;
    max-height: 100%;
}

/* Fallback for missing card images */
.sequence-board-new .card-fallback {
    font-size: clamp(10px, 1.5vw, 14px);
    font-weight: bold;
    color: #333;
    text-align: center;
    padding: 2px;
}

/* Sequence highlighting */
.sequence-board-new .board-cell.sequence-red {
    box-shadow: 0 0 15px #dc3545, inset 0 0 15px rgba(220, 53, 69, 0.3);
    animation: sequenceGlow 2s ease-in-out infinite alternate;
}

.sequence-board-new .board-cell.sequence-blue {
    box-shadow: 0 0 15px #007bff, inset 0 0 15px rgba(0, 123, 255, 0.3);
    animation: sequenceGlow 2s ease-in-out infinite alternate;
}

.sequence-board-new .board-cell.sequence-green {
    box-shadow: 0 0 15px #28a745, inset 0 0 15px rgba(40, 167, 69, 0.3);
    animation: sequenceGlow 2s ease-in-out infinite alternate;
}

@keyframes sequenceGlow {
    0% { box-shadow: 0 0 10px currentColor, inset 0 0 10px rgba(255, 255, 255, 0.1); }
    100% { box-shadow: 0 0 20px currentColor, inset 0 0 20px rgba(255, 255, 255, 0.2); }
}

/* === RESPONSIVE DESIGN === */

/* Tablet Layout - 3-Column Responsive */
@media (max-width: 1200px) {
    .three-column-layout {
        grid-template-columns: 160px 240px 1fr;
        gap: 10px;
        padding: 6px;
    }
    
    .left-info-column {
        padding: 10px;
        gap: 10px;
    }
    
    .middle-cards-column {
        padding: 10px;
        gap: 8px;
    }
    
    .right-board-column {
        padding: 10px;
    }
    
    .sequence-board-large {
        width: min(calc(100vw - 430px), calc(100vh - 40px));
        height: min(calc(100vw - 430px), calc(100vh - 40px));
        min-width: 500px;
        min-height: 500px;
        padding: 12px;
    }
    
    .player-cards-middle {
        grid-template-columns: repeat(auto-fit, minmax(50px, 1fr));
        max-height: calc(100vh - 180px);
    }
    
    .player-cards-middle .hand-card {
        height: 70px;
        font-size: 11px;
    }
}

/* Mobile Layout - Stacked for small screens */
@media (max-width: 768px) {
    .three-column-layout {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto 1fr;
        gap: 8px;
        padding: 6px;
    }
    
    .left-info-column {
        display: grid;
        grid-template-columns: 1fr 1fr 1fr;
        gap: 8px;
        padding: 8px;
    }
    
    .middle-cards-column {
        padding: 8px;
        gap: 6px;
    }
    
    .right-board-column {
        padding: 8px;
    }
    
    .sequence-board-large {
        width: min(calc(100vw - 30px), calc(100vh - 300px));
        height: min(calc(100vw - 30px), calc(100vh - 300px));
        min-width: 350px;
        min-height: 350px;
        padding: 8px;
        gap: 2px;
    }
    
    .player-cards-middle {
        grid-template-columns: repeat(auto-fit, minmax(45px, 1fr));
        max-height: 120px;
        gap: 4px;
    }
    
    .player-cards-middle .hand-card {
        height: 60px;
        font-size: 9px;
    }
    
    .controls-header {
        padding: 8px;
        gap: 6px;
    }
    
    .game-info-compact {
        flex-direction: column;
        gap: 4px;
        font-size: 11px;
    }
    
    .board-header-new {
        flex-direction: column;
        gap: 8px;
        padding: 8px;
    }
    
    .header-left-info {
        flex-direction: row;
        gap: 15px;
        justify-content: center;
        font-size: 12px;
    }
    
    .timer-section {
        padding: 6px 12px;
    }
    
    .sequence-board-new {
        width: min(calc(100vw - 20px), calc(100vh - 220px));
        height: min(calc(100vw - 20px), calc(100vh - 220px));
        min-width: 320px;
        min-height: 320px;
        gap: 2px;
        padding: 8px;
    }
    
    .sequence-board-new .board-cell {
        border-radius: 3px;
    }
    
    .sequence-board-new .board-cell.free {
        font-size: clamp(6px, 2vw, 10px);
    }
}

/* Small Mobile - Optimized for 100% zoom */
@media (max-width: 480px) {
    .efficient-game-layout {
        padding: 4px;
        gap: 6px;
    }
    
    .left-sidebar {
        height: 160px;
        padding: 8px;
        gap: 8px;
    }
    
    .cards-column, .info-column {
        min-width: 160px;
    }
    
    .player-cards-vertical {
        grid-template-columns: 1fr;
        max-height: 120px;
        gap: 3px;
    }
    
    .player-cards-vertical .hand-card {
        height: 45px;
        font-size: 9px;
    }
    
    .board-header-new {
        padding: 6px;
    }
    
    .header-left-info {
        font-size: 11px;
        gap: 10px;
    }
    
    .sequence-board-new {
        width: min(calc(100vw - 16px), calc(100vh - 200px));
        height: min(calc(100vw - 16px), calc(100vh - 200px));
        min-width: 280px;
        min-height: 280px;
        padding: 6px;
        gap: 1px;
    }
    
    .sequence-board-new .board-cell.free {
        font-size: clamp(5px, 1.8vw, 8px);
    }
}
