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

/* Mobile-specific improvements */
@media (max-width: 768px) {
    /* Prevent zoom on input focus for iOS */
    input[type="text"], input[type="email"], input[type="password"], textarea {
        font-size: 16px !important;
    }
    
    /* Improve touch scrolling */
    body {
        -webkit-overflow-scrolling: touch;
    }
    
    /* Prevent horizontal scroll */
    html, body {
        overflow-x: hidden;
        width: 100%;
    }
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: black;
    min-height: 100vh;
    color: #333;
    position: relative;
    overflow-x: hidden;
}

/* Fallback background when video fails to load */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, #070707 0%, #000000 25%, #000000 50%, #000000 75%, #000000 100%);
    background-size: 40px 40px;
    animation: medievalPattern 20s linear infinite;
    z-index: -2;
    opacity: 0.8;
}

@keyframes medievalPattern {
    0% { background-position: 0 0; }
    100% { background-position: 40px 40px; }
}

/* Video Background */
#background-video {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    z-index: -1;
    opacity: 0.7;
}

.container, .host-container, .player-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}



/* Header Styles */
.header {
    text-align: center;
    margin-bottom: 30px;
    color: white;
}

.header h1 {
    font-size: 2.5rem;
    margin-bottom: 10px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.header p {
    font-size: 1.2rem;
    opacity: 0.9;
}

/* Layout Card Styles */
.card {
    background: white;
    border-radius: 15px;
    padding: 30px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    margin-bottom: 20px;
}

/* Join Room Styles */
.join-room {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 60vh;
    padding: 20px;
}

.join-room .card {
    width: 100%;
    max-width: 450px;
    margin: 0 auto;
    background: linear-gradient(145deg, #ffffff 0%, #f8f9fa 100%);
    border: 3px solid #667eea;
    box-shadow: 0 15px 35px rgba(102, 126, 234, 0.2), 0 5px 15px rgba(0,0,0,0.1);
    position: relative;
    overflow: hidden;
}

.join-room .card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 50%, #667eea 100%);
    background-size: 200% 100%;
    animation: shimmer 3s ease-in-out infinite;
}

@keyframes shimmer {
    0%, 100% { background-position: 200% 0; }
    50% { background-position: -200% 0; }
}

.join-room h2 {
    text-align: center;
    color: #333;
    font-size: 1.8rem;
    margin-bottom: 30px;
    font-weight: 700;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

.join-room h2::before {
    content: '⚔️';
    margin-right: 10px;
}

.join-room h2::after {
    content: '⚔️';
    margin-left: 10px;
}

/* Button Styles */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    text-align: center;
}

.btn-primary {
    background: #667eea;
    color: white;
}

.btn-primary:hover {
    background: #5a6fd8;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-secondary:hover {
    background: #5a6268;
}

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

.btn-success:hover {
    background: #218838;
}

.btn-warning {
    background: #ffc107;
    color: #212529;
}

.btn-warning:hover {
    background: #e0a800;
}

.btn-outline {
    background: transparent;
    color: #6c757d;
    border: 2px solid #6c757d;
}

.btn-outline:hover {
    background: #6c757d;
    color: white;
}

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

.btn-voice {
    background: #28a745;
    color: white;
    padding: 8px 12px;
    font-size: 1.2rem;
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 15px;
}

.btn-voice:hover {
    background: #218838;
    transform: scale(1.1);
}

.btn-voice.disabled {
    background: #6c757d;
    opacity: 0.7;
}

.btn-voice.disabled:hover {
    background: #6c757d;
    transform: none;
}

/* Main Menu Styles */
.main-menu {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    margin-bottom: 40px;
}

.option-card {
    background: white;
    border-radius: 15px;
    padding: 40px;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    transition: transform 0.3s ease;
}

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

.option-card .icon {
    font-size: 4rem;
    margin-bottom: 20px;
}

.option-card h2 {
    margin-bottom: 15px;
    color: #333;
}

.option-card p {
    margin-bottom: 25px;
    color: #666;
    line-height: 1.6;
}

/* Player Activity Display */
.player-activity {
    background: rgba(255,255,255,0.95);
    border-radius: 10px;
    padding: 15px;
    margin: 20px 0;
    text-align: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
}

.player-activity h4 {
    margin-bottom: 10px;
    color: #333;
    font-size: 1.1rem;
}



/* Room Code Toggle Button */
.btn-secondary {
    background: #6c757d;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 8px 12px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 0 5px;
}

.btn-secondary:hover {
    background: #5a6268;
    transform: scale(1.05);
}

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

/* Button Labels */
.btn-label {
    font-size: 0.8rem;
    margin-left: 5px;
    font-weight: 500;
}

/* Volume Control */
.volume-control {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-left: 15px;
}

.volume-label {
    font-size: 0.9rem;
    margin: 0;
}

.volume-slider {
    width: 80px;
    height: 4px;
    background: #ddd;
    outline: none;
    border-radius: 2px;
    cursor: pointer;
}

.volume-slider::-webkit-slider-thumb {
    appearance: none;
    width: 16px;
    height: 16px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
}

.volume-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    background: #667eea;
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

.volume-display {
    font-size: 0.8rem;
    font-weight: 500;
    min-width: 30px;
    color: #666;
}

/* Kick Button Styles */
.btn-kick, .btn-kick-game {
    background: #dc3545;
    color: white;
    border: none;
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-left: 10px;
}

.btn-kick:hover, .btn-kick-game:hover {
    background: #c82333;
    transform: scale(1.1);
}

.btn-kick:active, .btn-kick-game:active {
    transform: scale(0.95);
}

/* Player List Item Styles */
.player-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.player-item:last-child {
    border-bottom: none;
}

.player-name {
    font-weight: 500;
    flex-grow: 1;
}

.player-cards {
    color: #666;
    margin-right: 10px;
    font-size: 0.9rem;
}

/* Game Board Player Card Styles */
.player-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.player-info {
    text-align: center;
    flex-grow: 1;
}

.btn-kick-game {
    position: absolute;
    top: 5px;
    right: 5px;
    padding: 2px 6px;
    font-size: 0.7rem;
    min-width: auto;
}

/* Kick Info Text */
.kick-info {
    font-size: 0.85rem;
    color: #666;
    font-style: italic;
    margin-top: 10px;
    text-align: center;
}

/* Features Section */
.features {
    background: rgba(255,255,255,0.1);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    color: white;
}

.features h3 {
    text-align: center;
    margin-bottom: 25px;
    font-size: 1.5rem;
}

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

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

.feature .emoji {
    font-size: 1.5rem;
}

/* How to Play */
.how-to-play {
    background: rgba(255,255,255,0.1);
    border-radius: 15px;
    padding: 30px;
    margin-bottom: 30px;
    color: white;
}

.how-to-play h3 {
    margin-bottom: 20px;
    text-align: center;
}

.how-to-play ol {
    list-style: none;
    counter-reset: step-counter;
}

.how-to-play li {
    counter-increment: step-counter;
    margin-bottom: 15px;
    padding-left: 40px;
    position: relative;
    line-height: 1.6;
}

.how-to-play li::before {
    content: counter(step-counter);
    position: absolute;
    left: 0;
    top: 0;
    background: #667eea;
    color: white;
    width: 25px;
    height: 25px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.9rem;
}

/* Host Specific Styles */
.room-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255,255,255,0.2);
    padding: 15px;
    border-radius: 10px;
    margin-top: 15px;
}

.room-code-display {
    font-size: 3rem;
    font-weight: bold;
    color: #667eea;
    text-align: center;
    margin: 20px 0;
    padding: 20px;
    background: #f8f9fa;
    border-radius: 10px;
    letter-spacing: 5px;
}

.website-info {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    margin: 15px 0;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.website-info p {
    margin: 0;
    font-size: 1.1rem;
    letter-spacing: 1px;
}

.website-info strong {
    font-weight: 700;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2);
}



.players-list {
    margin: 20px 0;
}

.players-list ul {
    list-style: none;
}

.players-list li {
    padding: 10px;
    margin: 5px 0;
    background: #f8f9fa;
    border-radius: 5px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

/* Game Board Styles */
.game-board {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    backdrop-filter: blur(10px);
    min-height: 600px;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0,0,0,0.3);
    padding: 15px;
    border-radius: 8px;
    color: white;
}

.current-player {
    font-size: 1.2rem;
    font-weight: bold;
}

.direction {
    font-size: 1.5rem;
    font-weight: bold;
}

.center-area {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    padding: 20px;
    background: rgba(0,0,0,0.2);
    border-radius: 10px;
    min-height: 150px;
}

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

.deck-area h3 {
    margin: 0;
    color: white;
    font-size: 1rem;
}

#top-card {
    margin: 0 auto;
    animation: wiggle 3s ease-in-out infinite;
}



@keyframes wiggle {
    0%, 100% { transform: rotate(0deg); }
    25% { transform: rotate(1deg); }
    75% { transform: rotate(-1deg); }
}

.deck-pile, .discard-pile {
    text-align: center;
}

.deck-pile span, .discard-pile span {
    display: block;
    margin-top: 10px;
    font-weight: bold;
    color: white;
}

/* Game Card Styles */
.game-card {
    width: 80px;
    height: 120px;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 1.2rem;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
    cursor: pointer;
    transition: transform 0.2s ease;
    position: relative;
    background-image: url('data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iODAiIGhlaWdodD0iMTIwIiB2aWV3Qm94PSIwIDAgODAgMTIwIiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPjxkZWZzPjxsaW5lYXJHcmFkaWVudCBpZD0iY2FyZEJnIiB4MT0iMCUiIHkxPSIwJSIgeDI9IjEwMCUiIHkyPSIxMDAlIj48c3RvcCBvZmZzZXQ9IjAlIiBzdHlsZT0ic3RvcC1jb2xvcjojZmZmZmZmO3N0b3Atb3BhY2l0eTowLjEiLz48c3RvcCBvZmZzZXQ9IjEwMCUiIHN0eWxlPSJzdG9wLWNvbG9yOiMwMDAwMDA7c3RvcC1vcGFjaXR5OjAuMSIvPjwvbGluZWFyR3JhZGllbnQ+PC9kZWZzPjxyZWN0IHdpZHRoPSI4MCIgaGVpZ2h0PSIxMjAiIHJ4PSIxMCIgZmlsbD0idXJsKCNjYXJkQmcpIi8+PC9zdmc+');
    background-size: cover;
    overflow: hidden;
}

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

.card-back {
    background: #333;
    color: white;
    width: 80px;
    height: 120px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.game-card.fire { 
    background: linear-gradient(135deg, #dc3545 0%, #8b0000 100%);
    color: white;
    border: 2px solid #8b0000;
}
.game-card.water { 
    background: linear-gradient(135deg, #007bff 0%, #000080 100%);
    color: white;
    border: 2px solid #000080;
}
.game-card.earth { 
    background: linear-gradient(135deg, #28a745 0%, #006400 100%);
    color: white;
    border: 2px solid #006400;
}
.game-card.air { 
    background: linear-gradient(135deg, #ffc107 0%, #b8860b 100%);
    color: #333;
    border: 2px solid #b8860b;
}
.game-card.black { 
    background: linear-gradient(135deg, #333 0%, #000 100%);
    color: #ffd700;
    border: 2px solid #ffd700;
}

/* Medieval/Wizard themed decorations */
.game-card::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    bottom: 5px;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 8px;
    pointer-events: none;
}

.game-card::after {
    content: '⚔️';
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 0.6rem;
    opacity: 0.7;
}

.game-card.fire::after { content: '🔥'; }
.game-card.water::after { content: '❄️'; }
.game-card.earth::after { content: '🌿'; }
.game-card.air::after { content: '⚡'; }
.game-card.black::after { content: '🔮'; }

/* Card kingdom name styling */
.game-card .card-kingdom {
    position: absolute;
    top: 2px;
    left: 2px;
    right: 2px;
    font-size: 0.6rem;
    font-weight: bold;
    text-align: center;
    text-transform: uppercase;
    background: rgba(0,0,0,0.3);
    color: white;
    padding: 1px 2px;
    border-radius: 3px;
    z-index: 3;
    letter-spacing: 0.5px;
}

/* Card value styling */
.game-card .card-value {
    font-size: 1.4rem;
    font-weight: bold;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    z-index: 2;
    position: relative;
    margin-top: 8px;
}

.game-card .card-symbol {
    font-size: 0.8rem;
    opacity: 0.8;
    margin-top: 2px;
}

.game-card.playable {
    border: 3px solid #28a745;
    animation: pulse 1s infinite;
}

@keyframes pulse {
    0% { box-shadow: 0 4px 8px rgba(0,0,0,0.2); }
    50% { box-shadow: 0 4px 20px rgba(40, 167, 69, 0.5); }
    100% { box-shadow: 0 4px 8px rgba(0,0,0,0.2); }
}

/* Player Hand */
.player-hand {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 20px;
    padding: 20px;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
}

.hand-container {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
}

.hand-container h3 {
    text-align: center;
    margin-bottom: 15px;
}

/* Royal Table Layout */
.royal-table {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 500px;
    margin: 20px 0;
}

.table-surface {
    position: relative;
    width: 600px;
    height: 500px;
    background: radial-gradient(circle, rgba(139, 69, 19, 0.3) 0%, rgba(101, 67, 33, 0.5) 50%, rgba(62, 39, 35, 0.7) 100%);
    border-radius: 50%;
    border: 8px solid #8B4513;
    box-shadow: 
        0 0 30px rgba(139, 69, 19, 0.5),
        inset 0 0 50px rgba(0, 0, 0, 0.3);
    display: flex;
    justify-content: center;
    align-items: center;
}

.center-card-area {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    z-index: 10;
}

.center-card-area h3 {
    margin: 0;
    color: white;
    font-size: 1rem;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
    background: rgba(0, 0, 0, 0.5);
    padding: 5px 10px;
    border-radius: 15px;
    white-space: nowrap;
}

.players-circle {
    position: relative;
    width: 100%;
    height: 100%;
}

/* Players Grid - Fallback for old layout */
.players-grid {
    margin-bottom: 30px;
}

#players-display {
    /* Remove old grid styles when using circle layout */
}

.player-display {
    position: absolute;
    background: rgba(255,255,255,0.9);
    padding: 12px;
    border-radius: 10px;
    text-align: center;
    border: 3px solid #8B4513;
    transition: all 0.3s ease;
    min-height: 90px;
    min-width: 120px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
    transform-origin: center;
    z-index: 5;
}

.player-display.current {
    border-color: #ffd700;
    background: rgba(255,215,0,0.95);
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(255, 215, 0, 0.6), 0 4px 12px rgba(0, 0, 0, 0.3);
    animation: currentPlayerGlow 2s ease-in-out infinite alternate;
}

@keyframes currentPlayerGlow {
    from {
        box-shadow: 0 0 20px rgba(255, 215, 0, 0.6), 0 4px 12px rgba(0, 0, 0, 0.3);
    }
    to {
        box-shadow: 0 0 30px rgba(255, 215, 0, 0.8), 0 4px 12px rgba(0, 0, 0, 0.3);
    }
}

.player-display h4 {
    margin: 0 0 4px 0;
    color: #333;
    font-size: 0.9rem;
    font-weight: bold;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-display.current h4 {
    color: #8B4513;
}

.player-display .hand-count {
    font-size: 1.6rem;
    font-weight: bold;
    color: #8B4513;
    margin: 2px 0;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

.player-display.current .hand-count {
    color: #654321;
}

.player-display small {
    color: #666;
    font-size: 0.7rem;
    margin: 0;
}

.player-display.current small {
    color: #8B4513;
    font-weight: 500;
}

/* Twitch Rules */
.medieval-rule, .medieval-rule-player {
    background: linear-gradient(45deg, #9146ff, #772ce8);
    color: white;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    margin-bottom: 20px;
    animation: slideIn 0.5s ease;
}

.rule-notification {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-weight: bold;
}

.rule-icon {
    font-size: 1.5rem;
}

@keyframes slideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Game Log */
.game-log {
    background: white;
    border-radius: 10px;
    padding: 20px;
    max-height: 200px;
    overflow-y: auto;
}

.game-log h3 {
    margin-bottom: 15px;
}

.game-log ul {
    list-style: none;
}

.game-log li {
    padding: 5px 0;
    border-bottom: 1px solid #eee;
}

/* Player Interface Styles */
.game-status {
    background: white;
    border-radius: 15px;
    padding: 20px;
    margin-bottom: 20px;
    text-align: center;
}

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

.turn-indicator {
    font-weight: bold;
    padding: 8px 16px;
    border-radius: 20px;
    background: #f8f9fa;
}

.turn-indicator.your-turn {
    background: #28a745;
    color: white;
    animation: pulse 1s infinite;
}



/* Form Styles */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.form-group input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    font-size: 1rem;
    transition: border-color 0.3s ease;
}

.form-group input:focus {
    outline: none;
    border-color: #667eea;
}

/* Special Action Container */
.special-action {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.special-action .card {
    background: rgba(255, 255, 255, 0.95);
    border-radius: 15px;
    padding: 25px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    min-width: 300px;
    max-width: 90vw;
    width: auto;
    height: auto;
    overflow: visible;
}

.special-action h3 {
    text-align: center;
    margin-bottom: 20px;
    color: #333;
    font-size: 1.5rem;
}

/* Color Picker */
.kingdom-picker {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 15px;
}

.kingdom-btn {
    padding: 15px;
    border: none;
    border-radius: 8px;
    font-weight: bold;
    cursor: pointer;
    transition: transform 0.2s ease;
}

.kingdom-btn:hover {
    transform: scale(1.05);
}

.kingdom-btn.fire { background: #dc3545; color: white; }
.kingdom-btn.water { background: #007bff; color: white; }
.kingdom-btn.earth { background: #28a745; color: white; }
.kingdom-btn.air { background: #ffc107; color: #333; }

/* Game Actions */
.game-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
}

/* Chat Spam */
.chat-spam {
    margin-bottom: 20px;
}

.chat-spam input {
    width: 100%;
    padding: 12px;
    border: 2px solid #ddd;
    border-radius: 8px;
    margin-bottom: 10px;
    font-size: 1rem;
}

/* Error Messages */
.error-message {
    background: #dc3545;
    color: white;
    padding: 15px;
    border-radius: 8px;
    margin-bottom: 20px;
    text-align: center;
    font-weight: bold;
}

/* Notifications */
.notification {
    position: fixed;
    top: 20px;
    right: 20px;
    background: #28a745;
    color: white;
    padding: 15px 20px;
    border-radius: 8px;
    box-shadow: 0 5px 15px rgba(0,0,0,0.2);
    z-index: 1000;
    animation: slideInRight 0.3s ease;
}

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

/* Loading Spinner */
.loading-spinner {
    font-size: 2rem;
    text-align: center;
    animation: spin 2s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Footer */
footer {
    text-align: center;
    color: rgba(255,255,255,0.8);
    margin-top: 40px;
    padding: 20px;
}

/* QR Code Container Styles */
.qr-code-container {
    margin: 20px 0;
    padding: 20px;
    background: linear-gradient(135deg, #2c1810 0%, #1a0f08 100%);
    border: 2px solid #8b4513;
    border-radius: 10px;
    text-align: center;
}

.qr-code-container h3 {
    color: #d4af37;
    margin-bottom: 15px;
    font-size: 1.2rem;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
}

#qr-code {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    background: white;
    border-radius: 8px;
    margin: 0 auto;
    max-width: 200px;
    padding: 10px;
}

#qr-code canvas {
    border-radius: 4px;
}

/* Game Footer */
.game-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    color: rgba(255, 255, 255, 0.9);
    text-align: center;
    padding: 10px 20px;
    font-size: 0.9rem;
    z-index: 1000;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.game-footer p {
    margin: 0;
    font-weight: 500;
}

.game-footer a {
    color: #667eea;
    text-decoration: none;
    font-weight: 600;
    transition: all 0.3s ease;
}

.game-footer a:hover {
    color: #764ba2;
    text-shadow: 0 0 8px rgba(102, 126, 234, 0.6);
    transform: scale(1.05);
    display: inline-block;
}

.game-footer a:active {
    transform: scale(0.98);
}

/* Responsive Design */
@media (max-width: 768px) {
    .container, .host-container, .player-container {
        padding: 20px;
        max-width: 100%;
    }
    
    .header h1 {
        font-size: 2rem;
    }
    
    /* Mobile Card Container Improvements */
    .card {
        padding: 25px 20px;
        margin-bottom: 25px;
        border-radius: 15px;
        box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    }
    
    /* Mobile Join Room Improvements */
    .join-room:not([style*="display: none"]) {
        min-height: 100vh;
        padding: 15px;
        display: flex !important;
        justify-content: center !important;
        align-items: flex-start !important;
        padding-top: 60px;
        overflow-y: auto;
    }
    
    .join-room .card {
        padding: 35px 25px;
        margin: 10px;
        max-width: none;
        width: calc(100% - 20px);
        display: block !important;
        position: relative !important;
        max-height: none;
        overflow: visible;
    }
    
    .join-room h2 {
        font-size: 1.6rem;
        margin-bottom: 25px;
        display: block !important;
        visibility: visible !important;
    }
    
    .join-room .form-group {
        margin-bottom: 25px;
        display: block !important;
        visibility: visible !important;
    }
    
    .join-room .form-group label {
        font-size: 1.1rem;
        display: flex !important;
        visibility: visible !important;
    }
    
    .join-room .form-group input {
        font-size: 1.1rem;
        padding: 18px 15px;
        display: block !important;
        visibility: visible !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    .join-room .btn {
        font-size: 1.2rem;
        padding: 16px 20px;
        display: block !important;
        visibility: visible !important;
        width: 100% !important;
    }
    
    /* Mobile Form Improvements */
    .form-group {
        margin-bottom: 25px;
    }
    
    .form-group label {
        font-size: 1.1rem;
        font-weight: 600;
        margin-bottom: 10px;
        display: block;
        color: #333;
    }
    
    .form-group input {
        font-size: 1.1rem;
        padding: 18px 15px;
        border-radius: 12px;
        border: 2px solid #ddd;
        width: 100%;
        box-sizing: border-box;
        -webkit-appearance: none;
        appearance: none;
        background: white;
        margin-bottom: 5px;
    }
    
    .form-group input:focus {
        border-color: #667eea;
        outline: none;
        box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
    }
    
    /* Enhanced Join Room Form Styles */
    .join-room .form-group {
        margin-bottom: 30px;
        position: relative;
    }
    
    .join-room .form-group label {
        font-size: 1.2rem;
        font-weight: 700;
        color: #4a5568;
        margin-bottom: 12px;
        display: flex;
        align-items: center;
        gap: 8px;
    }
    
    .join-room .form-group label::before {
        font-size: 1.1rem;
    }
    
    .join-room .form-group:first-of-type label::before {
        content: '👤';
    }
    
    .join-room .form-group:last-of-type label::before {
        content: '🔑';
    }
    
    .join-room .form-group input {
        font-size: 1.2rem;
        padding: 20px 18px;
        border-radius: 15px;
        border: 3px solid #e2e8f0;
        background: linear-gradient(145deg, #ffffff 0%, #f7fafc 100%);
        transition: all 0.3s ease;
        box-shadow: inset 0 2px 4px rgba(0,0,0,0.05);
    }
    
    .join-room .form-group input:focus {
        border-color: #667eea;
        background: white;
        box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15), inset 0 2px 4px rgba(0,0,0,0.05);
        transform: translateY(-2px);
    }
    
    .join-room .form-group input::placeholder {
        color: #a0aec0;
        font-style: italic;
    }
    
    .join-room .btn {
        width: 100%;
        padding: 18px 25px;
        font-size: 1.3rem;
        font-weight: 700;
        border-radius: 15px;
        background: linear-gradient(145deg, #667eea 0%, #764ba2 100%);
        border: none;
        color: white;
        text-transform: uppercase;
        letter-spacing: 1px;
        box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
        transition: all 0.3s ease;
        position: relative;
        overflow: hidden;
    }
    
    .join-room .btn::before {
        content: '⚡';
        margin-right: 10px;
        font-size: 1.2rem;
    }
    
    .join-room .btn:hover {
        transform: translateY(-3px);
        box-shadow: 0 12px 25px rgba(102, 126, 234, 0.4);
        background: linear-gradient(145deg, #5a6fd8 0%, #6a4c93 100%);
    }
    
    .join-room .btn:active {
        transform: translateY(-1px);
        box-shadow: 0 6px 15px rgba(102, 126, 234, 0.3);
    }
    
    /* Better Touch Targets */
    .btn {
        min-height: 52px;
        padding: 16px 25px;
        font-size: 1.1rem;
        border-radius: 12px;
        width: 100%;
        margin-bottom: 15px;
        box-sizing: border-box;
    }
    
    /* Player Interface Mobile */
    .game-status {
        margin-bottom: 20px;
    }
    
    .status-row {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .turn-indicator {
        font-size: 1.2rem;
        font-weight: 600;
        padding: 10px;
        background: rgba(255,255,255,0.9);
        border-radius: 8px;
        color: #333;
    }
    

    
    .game-card {
        width: 80px;
        height: 120px;
        margin: 0 auto 10px;
        font-size: 1.2rem;
    }
    
    /* Hand Container Mobile */
    .hand-container {
        margin-top: 20px;
    }
    
    .hand-container h3 {
        text-align: center;
        margin-bottom: 15px;
        color: white;
        font-size: 1.3rem;
    }
    
    .player-hand {
        gap: 8px;
        justify-content: center;
        flex-wrap: wrap;
        padding: 15px;
        background: rgba(255,255,255,0.1);
        border-radius: 15px;
        margin-bottom: 20px;
    }
    
    .game-actions {
        flex-direction: column;
        gap: 15px;
    }
    
    .game-actions .btn {
        width: 100%;
        margin-bottom: 0;
    }
    
    /* Special Action Mobile Adjustments */
    .special-action {
        padding: 20px;
    }
    
    .special-action .card {
        min-width: 280px;
        max-width: calc(100vw - 40px);
        padding: 25px 20px;
        width: auto;
        height: auto;
        overflow: visible;
    }
    
    .special-action h3 {
        font-size: 1.3rem;
        margin-bottom: 15px;
    }
    
    /* Kingdom Picker Mobile */
    .kingdom-picker {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .kingdom-btn {
        min-height: 60px;
        font-size: 1.2rem;
        border-radius: 12px;
        font-weight: bold;
        border: 2px solid transparent;
        transition: all 0.2s ease;
    }
    
    .kingdom-btn:active {
        transform: scale(0.95);
    }
    
    /* Medieval Rule Notification Mobile */
    .medieval-rule-player {
        margin: 20px 0;
    }
    
    .rule-notification {
        padding: 15px;
        font-size: 1.1rem;
        border-radius: 10px;
        text-align: center;
    }
    
    /* Waiting Game Mobile */
    .waiting-game:not([style*="display: none"]) {
        min-height: 100vh;
        padding: 10px;
        display: flex !important;
        justify-content: center !important;
        align-items: flex-start !important;
        padding-top: 60px;
        overflow-y: auto;
    }
    
    .waiting-game .card {
        text-align: center;
        padding: 40px 20px;
        max-height: none;
        overflow: visible;
        width: calc(100% - 10px);
        margin: 5px;
    }

    .waiting-game h2 {
        font-size: 1.5rem;
        margin-bottom: 15px;
    }
    
    .loading-spinner {
        font-size: 3rem;
        margin-top: 20px;
    }
    
    /* Game Over Player Mobile */
    .game-over-player:not([style*="display: none"]) {
        min-height: 100vh;
        padding: 15px;
        display: flex !important;
        justify-content: center !important;
        align-items: flex-start !important;
        padding-top: 60px;
        overflow-y: auto;
    }
    
    .game-over-player .card {
        padding: 35px 25px;
        margin: 10px;
        max-width: none;
        width: calc(100% - 20px);
        display: block !important;
        position: relative !important;
        max-height: none;
        overflow: visible;
        text-align: center;
    }
    
    .game-over-player h2 {
        font-size: 1.8rem;
        margin-bottom: 25px;
        display: block !important;
        visibility: visible !important;
    }
    
    .game-over-player p {
        font-size: 1.2rem;
        margin-bottom: 30px;
        display: block !important;
        visibility: visible !important;
        line-height: 1.5;
    }
    
    .game-over-player .btn {
        font-size: 1.2rem;
        padding: 18px 25px;
        display: block !important;
        visibility: visible !important;
        width: 100% !important;
        border-radius: 15px;
        background: linear-gradient(145deg, #667eea 0%, #764ba2 100%);
        border: none;
        color: white;
        text-transform: uppercase;
        letter-spacing: 1px;
        box-shadow: 0 8px 20px rgba(102, 126, 234, 0.3);
        transition: all 0.3s ease;
    }
    
    .game-over-player .btn::before {
        content: '🏠';
        margin-right: 10px;
        font-size: 1.2rem;
    }
    
    .game-over-player .btn:hover {
        transform: translateY(-3px);
        box-shadow: 0 12px 25px rgba(102, 126, 234, 0.4);
        background: linear-gradient(145deg, #5a6fd8 0%, #6a4c93 100%);
    }
    
    .game-over-player .btn:active {
        transform: translateY(-1px);
        box-shadow: 0 6px 15px rgba(102, 126, 234, 0.3);
    }
    
    /* Game Over Host Mobile */
    .game-over:not([style*="display: none"]) {
        min-height: 100vh;
        padding: 15px;
        display: flex !important;
        justify-content: center !important;
        align-items: flex-start !important;
        padding-top: 60px;
        overflow-y: auto;
    }
    
    .game-over .card {
        padding: 35px 25px;
        margin: 10px;
        max-width: none;
        width: calc(100% - 20px);
        display: block !important;
        position: relative !important;
        max-height: none;
        overflow: visible;
        text-align: center;
    }
    
    .game-over h2 {
        font-size: 1.8rem;
        margin-bottom: 25px;
        display: block !important;
        visibility: visible !important;
    }
    
    .game-over p {
        font-size: 1.2rem;
        margin-bottom: 30px;
        display: block !important;
        visibility: visible !important;
        line-height: 1.5;
    }
    
    .game-over .btn {
        font-size: 1.2rem;
        padding: 18px 25px;
        display: block !important;
        visibility: visible !important;
        width: 100% !important;
        border-radius: 15px;
        background: linear-gradient(145deg, #28a745 0%, #20c997 100%);
        border: none;
        color: white;
        text-transform: uppercase;
        letter-spacing: 1px;
        box-shadow: 0 8px 20px rgba(40, 167, 69, 0.3);
        transition: all 0.3s ease;
    }
    
    .game-over .btn::before {
        content: '🎮';
        margin-right: 10px;
        font-size: 1.2rem;
    }
    
    .game-over .btn:hover {
        transform: translateY(-3px);
        box-shadow: 0 12px 25px rgba(40, 167, 69, 0.4);
        background: linear-gradient(145deg, #218838 0%, #1e7e34 100%);
    }
    
    .game-over .btn:active {
        transform: translateY(-1px);
        box-shadow: 0 6px 15px rgba(40, 167, 69, 0.3);
    }
    
    /* Responsive Royal Table */
    .table-surface {
        width: 400px;
        height: 350px;
    }
    
    .royal-table {
        min-height: 400px;
    }
    
    .player-display {
        min-width: 90px;
        min-height: 70px;
        padding: 8px;
        font-size: 0.8rem;
    }
    
    .player-display .hand-count {
        font-size: 1.3rem;
    }
    
    .center-card-area h3 {
        font-size: 0.8rem;
        padding: 3px 6px;
    }
    
    .main-menu {
        grid-template-columns: 1fr;
    }
    
    .option-card {
        padding: 30px 20px;
    }
    
    .deck-area {
        gap: 30px;
    }
    
    .card {
        width: 60px;
        height: 90px;
        font-size: 1rem;
    }
    
    .card-back {
        width: 60px;
        height: 90px;
    }
    
    .room-code-display {
        font-size: 2rem;
        letter-spacing: 3px;
    }
    
    .website-info {
        margin: 15px 0;
        padding: 12px;
    }
    
    .website-info p {
        font-size: 0.85rem;
        letter-spacing: 0.5px;
    }
    
    .game-footer {
        padding: 8px 15px;
        font-size: 0.8rem;
    }
    
    .game-footer a {
        font-size: 0.8rem;
    }
    
    /* Mobile QR Code Styles */
    .qr-code-container {
        margin: 15px 0;
        padding: 15px;
    }
    
    .qr-code-container h3 {
        font-size: 1.1rem;
        margin-bottom: 12px;
    }
    
    #qr-code {
        max-width: 160px;
        min-height: 160px;
        padding: 8px;
    }
}
    
    .game-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    #players-display {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .player-display {
        padding: 6px;
        min-height: 70px;
    }
    
    .player-display h4 {
        font-size: 0.8rem;
    }
    
    .player-display .hand-count {
        font-size: 1.2rem;
    }
    
    .feature-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .container, .host-container, .player-container {
        padding: 15px;
        margin: 0 auto;
    }
    
    .header h1 {
        font-size: 1.5rem;
        margin-bottom: 10px;
    }
    
    .header p {
        font-size: 1rem;
        margin-bottom: 15px;
    }
    
    /* Extra Small Mobile Card */
    .card {
        padding: 20px 15px;
        margin-bottom: 20px;
    }
    
    /* Extra Small Mobile Join Room */
    .join-room:not([style*="display: none"]) {
        min-height: 100vh;
        padding: 10px;
        display: flex !important;
        justify-content: center !important;
        align-items: flex-start !important;
        padding-top: 40px;
        overflow-y: auto;
    }
    
    .join-room .card {
        padding: 30px 20px;
        margin: 5px;
        width: calc(100% - 10px);
        display: block !important;
        position: relative !important;
        max-height: none;
        overflow: visible;
    }
    
    .join-room h2 {
        font-size: 1.4rem;
        margin-bottom: 20px;
        display: block !important;
        visibility: visible !important;
    }
    
    /* Extra Small Mobile Special Action */
    .special-action {
        padding: 15px;
    }
    
    .special-action .card {
        min-width: 260px;
        max-width: calc(100vw - 30px);
        padding: 20px 15px;
    }
    
    .special-action h3 {
        font-size: 1.2rem;
        margin-bottom: 15px;
    }
    
    .kingdom-btn {
        min-height: 55px;
        font-size: 1.1rem;
        padding: 15px 10px;
    }
    
    .join-room .form-group {
        margin-bottom: 20px;
        display: block !important;
        visibility: visible !important;
    }
    
    .join-room .form-group label {
        font-size: 1rem;
        display: flex !important;
        visibility: visible !important;
    }
    
    .join-room .form-group input {
        font-size: 1rem;
        padding: 16px 12px;
        display: block !important;
        visibility: visible !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }
    
    .join-room .btn {
        font-size: 1.1rem;
        padding: 15px 18px;
        display: block !important;
        visibility: visible !important;
        width: 100% !important;
    }
    
    /* Extra Small Mobile Forms */
    .form-group {
        margin-bottom: 20px;
    }
    
    .form-group input {
        font-size: 1rem;
        padding: 15px 12px;
        border-radius: 10px;
        margin-bottom: 8px;
    }
    
    .btn {
        min-height: 48px;
        padding: 14px 20px;
        font-size: 1rem;
        border-radius: 10px;
        margin-bottom: 12px;
    }
    
    /* Compact Card Layout */
    .card {
        width: 50px;
        height: 75px;
        font-size: 0.8rem;
        margin: 2px;
    }
    
    .card-back {
        width: 50px;
        height: 75px;
    }
    
    .game-card {
        width: 70px;
        height: 105px;
        font-size: 1rem;
    }
    
    /* Compact Player Hand */
    .player-hand {
        gap: 4px;
        padding: 10px;
    }
    
    /* Smaller Room Code */
    .room-code-display {
        font-size: 1.5rem;
        letter-spacing: 2px;
        padding: 8px 12px;
    }
    
    /* Compact Status */
    .turn-indicator {
        font-size: 1rem;
        padding: 8px;
    }
    
    .hand-container h3 {
        font-size: 1.1rem;
    }
    
    /* Compact Kingdom Picker */
    .kingdom-btn {
        min-height: 44px;
        font-size: 1rem;
        padding: 10px;
    }
    
    /* Compact Waiting Screen */
    .waiting-game:not([style*="display: none"]) {
        min-height: 100vh;
        padding: 10px;
        display: flex !important;
        justify-content: center !important;
        align-items: flex-start !important;
        padding-top: 40px;
        overflow-y: auto;
    }
    
    .waiting-game .card {
        padding: 30px 15px;
        max-height: none;
        overflow: visible;
        width: calc(100% - 10px);
        margin: 5px;
    }

    .waiting-game h2 {
        font-size: 1.3rem;
    }
    
    .loading-spinner {
        font-size: 2.5rem;
    }
    
    /* Game Over Player Extra Small Mobile */
    .game-over-player:not([style*="display: none"]) {
        min-height: 100vh;
        padding: 10px;
        display: flex !important;
        justify-content: center !important;
        align-items: flex-start !important;
        padding-top: 40px;
        overflow-y: auto;
    }
    
    .game-over-player .card {
        padding: 30px 15px;
        max-height: none;
        overflow: visible;
        width: calc(100% - 10px);
        margin: 5px;
        text-align: center;
    }
    
    .game-over-player h2 {
        font-size: 1.5rem;
        margin-bottom: 20px;
    }
    
    .game-over-player p {
        font-size: 1.1rem;
        margin-bottom: 25px;
        line-height: 1.4;
    }
    
    .game-over-player .btn {
        font-size: 1.1rem;
        padding: 16px 20px;
        width: 100%;
        border-radius: 12px;
    }
    
    /* Game Over Host Extra Small Mobile */
    .game-over:not([style*="display: none"]) {
        min-height: 100vh;
        padding: 10px;
        display: flex !important;
        justify-content: center !important;
        align-items: flex-start !important;
        padding-top: 40px;
        overflow-y: auto;
    }
    
    .game-over .card {
        padding: 30px 15px;
        max-height: none;
        overflow: visible;
        width: calc(100% - 10px);
        margin: 5px;
        text-align: center;
    }
    
    .game-over h2 {
        font-size: 1.5rem;
        margin-bottom: 20px;
    }
    
    .game-over p {
        font-size: 1.1rem;
        margin-bottom: 25px;
        line-height: 1.4;
    }
    
    .game-over .btn {
        font-size: 1.1rem;
        padding: 16px 20px;
        width: 100%;
        border-radius: 12px;
    }
    
    /* Compact Rule Notification */
    .rule-notification {
        padding: 12px;
        font-size: 1rem;
    }
    
    /* Compact Main Menu */
    .option-card {
        padding: 25px 15px;
    }
    
    .option-card .icon {
        font-size: 3rem;
        margin-bottom: 15px;
    }
    
    .option-card h2 {
        font-size: 1.3rem;
        margin-bottom: 10px;
    }
    
    .option-card p {
        font-size: 0.9rem;
        margin-bottom: 20px;
    }
    
    .website-info {
        margin: 10px 0;
        padding: 10px;
    }
    
    .website-info p {
        font-size: 0.8rem;
        letter-spacing: 0.3px;
    }
    
    .game-footer {
        padding: 6px 10px;
        font-size: 0.75rem;
    }
    
    .game-footer a {
        font-size: 0.75rem;
    }
    
    /* Extra Small Mobile QR Code Styles */
    .qr-code-container {
        margin: 10px 0;
        padding: 12px;
    }
    
    .qr-code-container h3 {
        font-size: 1rem;
        margin-bottom: 10px;
    }
    
    #qr-code {
        max-width: 140px;
        min-height: 140px;
        padding: 6px;
    }
}