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

#endTurn {
    margin-top: 20px;
    align-self: center;
}

:root {
    --primary-color: #3b82f6;
    --primary-dark: #2563eb;
    --secondary-color: #94a3b8;
    --success-color: #22c55e;
    --warning-color: #f59e0b;
    --error-color: #ef4444;
    --info-color: #0ea5e9;
    --dark-color: #0f172a;
    --light-color: #f8fafc;
    --text-color: #0f172a;
    --text-light: #64748b;
    --border-radius: 14px;
    --border-radius-lg: 18px;
    --shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.12);
    --glow: 0 0 0 rgba(0,0,0,0);
    --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: 'Poppins', sans-serif;
    background: var(--app-bg, #0f172a);
    color: var(--text-color);
    min-height: 100vh;
    line-height: 1.6;
    overflow-x: hidden;
    background-image: url('../images/wall-light.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

/* Minimal theme tokens */
:root {
    --surface: #ffffff;
    --surface-2: #f3f4f6;
    --text-strong: #0f172a;
    --text-muted: #64748b;
    --ring: #e5e7eb;
}

[data-theme="dark"] {
    --surface: #0b1220;
    --surface-2: #0f172a;
    --text-strong: #e5e7eb;
    --text-muted: #94a3b8;
    --ring: #1f2937;
    --app-bg: linear-gradient(135deg, #0b1220 0%, #0f172a 100%);
}

body[data-theme="dark"] {
    background-image: url('../images/wall-dark.webp');
}

/* Minimal Topbar */
:root { --topbar-height: 60px; }
.topbar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    margin-bottom: 0; /* remove extra scroll space */
    background: var(--surface);
    border-bottom: 1px solid var(--ring);
    min-height: var(--topbar-height, 60px);
}

/* Chat Window Styles */
.chat-container {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 400px;
    height: 300px;
    background: rgba(15, 23, 42, 0.6); /* --surface-2 at 60% opacity */
    backdrop-filter: blur(12px);
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    z-index: 100;
    color: var(--text-strong);
    border: 1px solid var(--ring);
    transition: transform 0.3s ease, opacity 0.3s ease;
}

.chat-container.collapsed {
    transform: translateY(calc(100% - 60px));
    opacity: 0.8;
}

.chat-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--ring);
    cursor: pointer;
}

.chat-header h3 {
    font-size: 1.1em;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-messages {
    flex-grow: 1;
    padding: 16px;
    overflow-y: auto;
}

.chat-input {
    display: flex;
    padding: 12px;
    border-top: 1px solid var(--ring);
}

.chat-input input {
    flex-grow: 1;
    border: none;
    background: transparent;
    padding: 10px;
    color: var(--text-strong);
    font-size: 1em;
}

.chat-input input:focus {
    outline: none;
}

.chat-input .btn {
    padding: 10px 16px;
    border-radius: 8px;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 0;
}

.brand {
    font-weight: 700;
    letter-spacing: 0.5px;
    color: var(--text-strong);
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--ring);
    background: transparent;
    color: var(--text-strong);
    cursor: pointer;
    transition: background .2s ease, transform .1s ease;
}

.icon-btn:hover { background: var(--surface-2); }
.icon-btn:active { transform: scale(0.98); }

.topbar-right {
    display: flex;
    align-items: center;
    gap: 8px;
}

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

.info-item.top {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text-muted);
}

.info-item.top .value {
    font-weight: 600;
    color: var(--text-strong);
}

.separator {
    margin: 0 8px;
    color: var(--text-muted);
}

#player-turn-list {
    display: flex !important;
    align-items: center;
}

#player-turn-list .separator {
    margin: 0 10px;
    color: var(--text-muted);
}

#player-turn-list span.current-turn {
    font-weight: 700;
    color: var(--primary-color);
    background: rgba(59, 130, 246, 0.1);
    padding: 4px 8px;
    border-radius: 6px;
    border: 1px solid rgba(59, 130, 246, 0.3);
}

#player-turn-list span.current-turn .value {
    font-weight: 700;
    color: var(--primary-color);
}

/* Minimal message bar */
.game-message {
    border: 1px solid var(--ring);
    border-radius: 12px;
    padding: 12px 14px;
    background: var(--surface);
    color: var(--text-strong);
    box-shadow: var(--shadow);
}

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

.game-message.success { border-color: rgba(34,197,94,.4); }
.game-message.error { border-color: rgba(239,68,68,.4); }
.game-message.warning { border-color: rgba(245,158,11,.5); }
.game-message.info { border-color: rgba(2,132,199,.4); }

/* Tone down glass and hover effects for minimalism */
.glass { background: rgba(255,255,255,0.15); backdrop-filter: blur(12px); }
[data-theme="dark"] .glass { background: rgba(15,23,42,0.35); }

.card:hover { transform: translateY(-3px); }
.btn:not(:disabled):hover { transform: translateY(-2px); }

/* Background Elements */
.background-elements {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.floating-card {
    position: absolute;
    width: 120px;
    height: 180px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    animation: float 6s ease-in-out infinite;
}

.floating-card.card-1 {
    top: 10%;
    left: 5%;
    animation-delay: 0s;
}

.floating-card.card-2 {
    top: 20%;
    right: 8%;
    animation-delay: 2s;
}

.floating-card.card-3 {
    bottom: 15%;
    left: 10%;
    animation-delay: 4s;
}

.floating-card.card-4 {
    bottom: 25%;
    right: 5%;
    animation-delay: 1s;
}

/* When floating cards have images, show them properly */
.floating-card-image {
    /* do not override background so the image stays visible */
    border: 2px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

@keyframes float {
    0%, 100% { transform: translateY(0px) rotate(0deg); }
    50% { transform: translateY(-20px) rotate(5deg); }
}

/* Glass Morphism */
.glass {
    background: rgba(255, 255, 255, 0.25);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.18);
    box-shadow: var(--shadow);
}

/* Screens */
.screen {
    display: none;
    min-height: calc(100dvh - var(--topbar-height, 60px));
    padding: 20px;
    position: relative;
}

.screen.active {
    display: block;
}

/* Cards */
.card {
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    transition: var(--transition);
}

.card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
}

/* Buttons */
.btn {
    padding: 14px 28px;
    border: none;
    border-radius: 12px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
    font-family: 'Poppins', sans-serif;
    position: relative;
    overflow: hidden;
}

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

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

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

.btn:not(:disabled):hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-lg);
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.9);
    color: var(--text-color);
    border: 2px solid var(--primary-color);
}

.btn-success {
    background: var(--success-color);
    color: white;
}

.btn-warning {
    background: var(--warning-color);
    color: white;
}

.btn-error {
    background: var(--error-color);
    color: white;
}

.btn-uno {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: white;
    font-weight: bold;
    font-size: 18px;
}

.glow {
    box-shadow: var(--glow);
    animation: pulse-glow 2s infinite;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: var(--glow); }
    50% { box-shadow: 0 0 30px rgba(102, 126, 234, 0.6); }
}

/* Lobby Styles */
.lobby-container {
    max-width: 1400px;
    margin: 0 auto;
}

.header {
    text-align: center;
    margin-bottom: 50px;
}

.logo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 15px;
}

.logo-icon {
    font-size: 4em;
    animation: bounce 2s infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.game-title {
    font-size: 4em;
    font-weight: 800;
    background: linear-gradient(135deg, #fff, #e2e8f0);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.game-subtitle {
    font-size: 1.3em;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 300;
    letter-spacing: 1px;
}

.lobby-content {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 40px;
    margin-top: 30px;
}

@media (max-width: 968px) {
    .lobby-content {
        grid-template-columns: 1fr;
    }
}

.player-setup {
    padding: 40px;
}

.player-setup h2 {
    margin-bottom: 30px;
    color: var(--text-color);
    font-size: 2em;
    display: flex;
    align-items: center;
    gap: 12px;
}

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

.input-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 8px;
}

.input-group input {
    width: 100%;
    padding: 18px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-radius: 12px;
    font-size: 16px;
    transition: var(--transition);
    background: rgba(255, 255, 255, 0.9);
    font-family: 'Poppins', sans-serif;
}

.input-group input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.1);
    background: white;
}

.button-group {
    display: flex;
    flex-direction: column;
    gap: 20px;
    margin: 30px 0;
}

.game-info {
    margin-top: 40px;
    padding-top: 25px;
    border-top: 2px solid rgba(255, 255, 255, 0.3);
}

.game-info h3 {
    margin-bottom: 20px;
    color: var(--text-color);
    display: flex;
    align-items: center;
    gap: 10px;
}

.rules-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
}

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

.rule-icon {
    font-size: 1.2em;
}

.players-list {
    padding: 40px;
}

.players-list h2 {
    margin-bottom: 30px;
    color: var(--text-color);
    font-size: 2em;
    display: flex;
    align-items: center;
    gap: 12px;
}

.lobby-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
    padding: 20px;
    background: rgba(102, 126, 234, 0.1);
    border-radius: 12px;
    border: 2px solid rgba(102, 126, 234, 0.2);
}

.room-info, .player-count {
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 600;
}

.room-info {
    color: var(--primary-color);
}

.player-count {
    color: var(--text-light);
}

.players-container {
    min-height: 300px;
    max-height: 500px;
    overflow-y: auto;
}

.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-light);
}

.empty-icon {
    font-size: 4em;
    margin-bottom: 20px;
    opacity: 0.7;
}

.empty-state .hint {
    font-size: 0.95em;
    margin-top: 10px;
    opacity: 0.7;
}

.player-item {
    padding: 20px;
    margin: 10px 0;
    background: rgba(255, 255, 255, 0.8);
    border-radius: 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 6px solid var(--primary-color);
    transition: var(--transition);
}

.player-item:hover {
    transform: translateX(5px);
    background: rgba(255, 255, 255, 0.9);
}

.player-item.host {
    border-left-color: var(--warning-color);
    background: rgba(255, 152, 0, 0.1);
}

/* Game Screen Styles */
.game-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: 30px;
    margin-bottom: 40px;
    padding: 25px;
    border-radius: var(--border-radius-lg);
}

@media (max-width: 1200px) {
    .game-header {
        grid-template-columns: 1fr;
        gap: 20px;
        text-align: center;
    }
}

.game-info {
    display: flex;
    gap: 25px;
    flex-wrap: wrap;
    justify-content: center;
}

.info-item {
    display: inline-flex;
    flex-direction: row;
    gap: 8px;
    padding: 0;
    background: none;
    border: none;
    border-radius: 0;
}

.label {
    font-size: 0.9em;
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 6px;
}

.value {
    font-size: 1.2em;
    font-weight: 700;
    color: white;
}

.side-light {
    color: #ffd700;
    text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.side-dark {
    color: #a855f7;
    text-shadow: 0 0 10px rgba(168, 85, 247, 0.5);
}

.current-card-display {
    text-align: center;
}

.current-card-label {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
    margin-bottom: 10px;
    font-size: 1.1em;
}

.current-card {
    width: 140px;
    height: 200px;
    margin: 0 auto;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.1);
    border: 3px solid rgba(255, 255, 255, 0.3);
}

.card-placeholder {
    text-align: center;
    color: rgba(255, 255, 255, 0.7);
}

.card-placeholder i {
    font-size: 2em;
    margin-bottom: 10px;
    display: block;
}

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

.current-turn {
    background: rgba(255, 255, 255, 0.2);
    padding: 20px 30px;
    border-radius: 50px;
    color: white;
    font-weight: 700;
    font-size: 1.3em;
    border: 3px solid rgba(255, 255, 255, 0.3);
    display: flex;
    align-items: center;
    gap: 12px;
    justify-content: center;
}

.pulse {
    animation: pulse 2s infinite;
}

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

.player-area {
    position: relative;
}

#sayUno {
    position: absolute;
    bottom: 20px;
    right: 20px;
    opacity: 0.8;
}

/* Game Board */
.game-board {
    display: flex;
    flex-direction: column;
    gap: 30px;
    max-width: 1600px;
    margin: 0 auto;
}

/* UNO Card Styles */
.uno-card {
    width: 140px;
    height: 200px;
    border-radius: 12px;
    position: relative;
    transition: var(--transition);
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border: 3px solid rgba(255, 255, 255, 0.3);
}
/* UNO Card Color Styles - FIXED VERSION */
.uno-card.red, .hand-card.red { 
    background: linear-gradient(135deg, #ff6b6b, #c23616) !important; 
    color: white; 
}
.uno-card.blue, .hand-card.blue { 
    background: linear-gradient(135deg, #4834d4, #0652DD) !important; 
    color: white; 
}
.uno-card.green, .hand-card.green { 
    background: linear-gradient(135deg, #00d2d3, #009432) !important; 
    color: white; 
}
.uno-card.yellow, .hand-card.yellow { 
    background: linear-gradient(135deg, #fbc531, #e1b12c) !important; 
    color: #2d3748; 
}
.uno-card.wild, .hand-card.wild { 
    background: linear-gradient(135deg, #2f3640, #7f8fa6) !important; 
    color: white; 
}
.uno-card.teal, .hand-card.teal { 
    background: linear-gradient(135deg, #00b894, #0984e3) !important; 
    color: white; 
}
.uno-card.orange, .hand-card.orange { 
    background: linear-gradient(135deg, #e17055, #d35400) !important; 
    color: white; 
}
.uno-card.pink, .hand-card.pink { 
    background: linear-gradient(135deg, #fd79a8, #e84393) !important; 
    color: white; 
}
.uno-card.purple, .hand-card.purple { 
    background: linear-gradient(135deg, #a55eea, #6c5ce7) !important; 
    color: white; 
}

.deck-card {
    background: linear-gradient(135deg, #2d3748, #4a5568);
}

.deck-card:hover:not(:disabled) {
    transform: translateY(-10px) scale(1.05);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3);
}

.card-back {
    width: 100%;
    height: 100%;
    background-image: url('../images/card_back.webp');
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 9px;
    position: relative;
}

.card-count {
    position: absolute;
    bottom: 10px;
    right: 10px;
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 4px 10px;
    border-radius: 15px;
    font-size: 0.9em;
    font-weight: 600;
}

.discard-card {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-start {
    font-size: 2em;
    text-align: center;
}

.card-start i {
    display: block;
    margin-bottom: 10px;
}

/* Card Colors with UNO-style Design */
.hand-card {
    width: 120px;
    height: 170px;
    border-radius: 10px;
    position: relative;
    transition: var(--transition);
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    border: 3px solid rgba(255, 255, 255, 0.4);
}

.hand-card.playable:hover {
    transform: translateY(-12px);
    box-shadow: 0 14px 30px rgba(0, 0, 0, 0.35);
}

/* When we use actual image backgrounds, hide the overlay content and any gradient/backdrop so only the image shows */
.image-card {
    /* keep the card frame (border/shadow) but make background transparent so the image shows through */
    background-color: transparent !important;
    /* keep border and shadow to maintain card outline */
    border: 3px solid rgba(255, 255, 255, 0.3) !important;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15) !important;
    border-radius: 12px !important;
    overflow: hidden;
}

.image-card .card-content,
.image-card .card-value,
.image-card .card-symbol,
.image-card .card-side {
    display: none !important;
}

/* Ensure the image fills the card without overlays */
.image-card {
    background-color: transparent !important;
}

/* UNO Card Color Styles */
.hand-card.red { background: linear-gradient(135deg, #ff6b6b, #c23616); color: white; }
.hand-card.blue { background: linear-gradient(135deg, #4834d4, #0652DD); color: white; }
.hand-card.green { background: linear-gradient(135deg, #00d2d3, #009432); color: white; }
.hand-card.yellow { background: linear-gradient(135deg, #fbc531, #e1b12c); color: #2d3748; }
.hand-card.wild { background: linear-gradient(135deg, #2f3640, #7f8fa6); color: white; }
.hand-card.teal { background: linear-gradient(135deg, #00b894, #0984e3); color: white; }
.hand-card.orange { background: linear-gradient(135deg, #e17055, #d35400); color: white; }
.hand-card.pink { background: linear-gradient(135deg, #fd79a8, #e84393); color: white; }
.hand-card.purple { background: linear-gradient(135deg, #a55eea, #6c5ce7); color: white; }

/* Card Content */
.hand-card .card-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px;
    text-align: center;
}

.card-value {
    font-size: 2em;
    font-weight: 800;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
    margin-bottom: 8px;
}

.card-symbol {
    font-size: 1.2em;
    opacity: 0.9;
    margin-bottom: 5px;
}

.card-side {
    font-size: 0.8em;
    opacity: 0.8;
    background: rgba(0, 0, 0, 0.2);
    padding: 3px 8px;
    border-radius: 5px;
    margin-top: 5px;
}

/* Opponents Area */
.opponents-area {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.opponents-placeholder {
    text-align: center;
    padding: 60px 40px;
    color: rgba(255, 255, 255, 0.6);
    grid-column: 1 / -1;
}

.placeholder-icon {
    font-size: 4em;
    margin-bottom: 20px;
    opacity: 0.5;
}

.opponent {
    padding: 25px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: var(--border-radius);
    text-align: center;
    backdrop-filter: blur(10px);
    transition: var(--transition);
    border: 2px solid transparent;
    position: relative;
    overflow: hidden;
}

/* Hide the large current turn indicator on opponents */
.opponent.current-turn {
    background: rgba(255, 255, 255, 0.1) !important;
    padding: 25px !important;
    border-radius: var(--border-radius) !important;
    border: 2px solid transparent !important;
}

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

.opponent:hover::before {
    left: 100%;
}


.opponent-name {
    font-weight: 700;
    color: white;
    margin-bottom: 12px;
    font-size: 1.2em;
}

.opponent-cards {
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 10px;
    font-size: 1.1em;
}

.uno-indicator {
    color: #ffd700;
    font-weight: bold;
    animation: blink 1s infinite;
    font-size: 1em;
    margin-top: 8px;
}

.host-indicator {
    color: #ffd700;
    font-size: 1.1em;
    margin-top: 8px;
}

/* Play Area */
.play-area {
    text-align: center;
    margin: 30px 0;
}

.play-area { position: relative; }

.play-area-content {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 80px;
    margin-bottom: 30px;
}

@media (max-width: 768px) {
    .play-area-content { flex-direction: column; gap: 20px; }
}

/* Side message panel next to deck/discard */
.message-panel {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 240px;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

@media (max-width: 768px) {
    .message-panel {
        position: static;
        transform: none;
        width: 100%;
        pointer-events: auto;
        margin-bottom: 10px;
    }
}

.deck-section, .discard-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

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

/* Player Area */
.player-area {
    margin-top: 40px;
    padding: 30px;
    border-radius: var(--border-radius-lg);
    border: 3px solid transparent;
    transition: var(--transition);
}

.my-turn .player-area {
    border-color: var(--success-color);
    background: rgba(76, 175, 80, 0.15);
    box-shadow: 0 0 40px rgba(76, 175, 80, 0.4);
}

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

.player-header h3 {
    color: white;
    font-size: 1.8em;
    display: flex;
    align-items: center;
    gap: 12px;
}

.player-stats {
    display: flex;
    gap: 20px;
    align-items: center;
    color: rgba(255, 255, 255, 0.9);
    font-size: 1.1em;
}

.card-count {
    background: rgba(255, 255, 255, 0.2);
    padding: 8px 16px;
    border-radius: 25px;
    font-weight: 700;
    font-size: 1.1em;
}

.uno-status {
    color: #ffd700;
    font-weight: bold;
    font-size: 1.1em;
}

/* Hand Styles */
.hand {
    display: flex;
    gap: 20px;
    flex-wrap: wrap;
    justify-content: center;
    margin: 25px 0;
    min-height: 220px;
    align-items: center;
    padding: 20px;
}

/* Hand controls (toggle) */
.hand-controls {
    margin-left: auto;
    display: flex;
    align-items: center;
}

/* Fan (poker) layout */
.hand.fan {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: flex-end;
    height: 240px;
    padding: 0;
    gap: 0;
    perspective: 1000px;
}

.hand.fan .hand-card {
    position: relative;
    bottom: 0;
    transform-origin: bottom center;
    margin: 0 calc(-1 * var(--overlap, 40px));
    transform: rotate(var(--rot, 0deg));
    transition: transform .2s ease;
}

/* Softer hover for fan layout */
.hand.fan .hand-card.playable:hover {
    transform: translateY(-14px) scale(1.05) rotate(var(--rot, 0deg));
}

/* Reduce aggressive hover scale in fan layout */
.hand.fan .hand-card.playable:hover {
    box-shadow: 0 14px 30px rgba(0,0,0,.35);
}

.empty-hand {
    text-align: center;
    color: rgba(255, 255, 255, 0.6);
    padding: 50px;
}

.empty-hand .empty-icon {
    font-size: 4em;
    margin-bottom: 20px;
    opacity: 0.5;
}

/* Turn Instruction */
.turn-instruction {
    padding: 20px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    color: white;
    font-weight: 600;
    text-align: center;
    margin-top: 20px;
    border-left: 4px solid var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1.1em;
}

/* Game Over Screen */
.game-over-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
}

.game-over-content {
    padding: 50px;
    text-align: center;
    max-width: 600px;
    width: 100%;
}

.winner-header {
    margin-bottom: 30px;
}

.game-over-content h1 {
    font-size: 3.5em;
    margin-bottom: 20px;
    color: white;
    text-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.winner-message {
    font-size: 1.8em;
    font-weight: 700;
    color: #ffd700;
    margin-bottom: 30px;
    padding: 25px;
    background: rgba(255, 215, 0, 0.1);
    border-radius: var(--border-radius);
    border: 2px solid rgba(255, 215, 0, 0.3);
}

.winner-celebration {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin: 40px 0;
    flex-wrap: wrap;
}

.confetti {
    font-size: 2.5em;
    animation: bounce 2s infinite;
}

.confetti:nth-child(2) { animation-delay: 0.2s; }
.confetti:nth-child(3) { animation-delay: 0.4s; }
.confetti:nth-child(4) { animation-delay: 0.6s; }
.confetti:nth-child(5) { animation-delay: 0.8s; }

.game-over-actions {
    display: flex;
    gap: 20px;
    justify-content: center;
    margin: 40px 0;
    flex-wrap: wrap;
}

.game-stats {
    margin-top: 40px;
    padding-top: 30px;
    border-top: 2px solid rgba(255, 255, 255, 0.3);
}

.game-stats h3 {
    margin-bottom: 25px;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    font-size: 1.5em;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.stat-item {
    text-align: center;
    padding: 25px 20px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    transition: var(--transition);
}

.stat-item:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.15);
}

.stat-icon {
    font-size: 2em;
    margin-bottom: 10px;
    color: var(--primary-color);
}

.stat-label {
    display: block;
    font-size: 0.95em;
    color: rgba(255, 255, 255, 0.8);
    margin-bottom: 8px;
}

.stat-value {
    display: block;
    font-size: 1.4em;
    font-weight: 700;
    color: white;
}

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

.modal.active {
    display: flex;
}

.modal-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
}

.modal-content {
    background: rgba(255, 255, 255, 0.25);
    padding: 40px;
    border-radius: var(--border-radius-lg);
    box-shadow: var(--shadow-lg);
    max-width: 500px;
    width: 90%;
    text-align: center;
    position: relative;
    z-index: 1001;
}

.modal-content h3 {
    margin-bottom: 30px;
    color: white;
    font-size: 1.8em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.color-options {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
    margin: 30px 0;
}

@media (max-width: 480px) {
    .color-options {
        grid-template-columns: repeat(2, 1fr);
    }
}

.color-option {
    padding: 25px 15px;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    background: rgba(255, 255, 255, 0.9);
    border: 3px solid transparent;
}

.color-option:hover {
    transform: translateY(-5px) scale(1.05);
    box-shadow: var(--shadow);
}

.color-option.red { border-color: #ff6b6b; color: #c23616; }
.color-option.blue { border-color: #4834d4; color: #0652DD; }
.color-option.green { border-color: #00d2d3; color: #009432; }
.color-option.yellow { border-color: #fbc531; color: #e1b12c; }
.color-option.teal { border-color: #00b894; color: #00a085; }
.color-option.orange { border-color: #e17055; color: #d35400; }
.color-option.pink { border-color: #fd79a8; color: #e84393; }
.color-option.purple { border-color: #a55eea; color: #6c5ce7; }

.color-swatch {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 4px solid currentColor;
}

.color-option.red .color-swatch { background: #ff6b6b; }
.color-option.blue .color-swatch { background: #4834d4; }
.color-option.green .color-swatch { background: #00d2d3; }
.color-option.yellow .color-swatch { background: #fbc531; }
.color-option.teal .color-swatch { background: #00b894; }
.color-option.orange .color-swatch { background: #e17055; }
.color-option.pink .color-swatch { background: #fd79a8; }
.color-option.purple .color-swatch { background: #a55eea; }

.modal-actions {
    margin-top: 25px;
}

/* Notification System */
#notificationContainer {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    max-width: 350px;
}

.notification {
    padding: 20px 25px;
    margin: 12px 0;
    border-radius: 12px;
    color: white;
    font-weight: 600;
    animation: slideInRight 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: var(--shadow);
    border-left: 6px solid transparent;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    gap: 12px;
}

.notification.success {
    background: rgba(76, 175, 80, 0.9);
    border-left-color: #388E3C;
}

.notification.error {
    background: rgba(244, 67, 54, 0.9);
    border-left-color: #D32F2F;
}

.notification.warning {
    background: rgba(255, 152, 0, 0.9);
    border-left-color: #F57C00;
}

.notification.info {
    background: rgba(33, 150, 243, 0.9);
    border-left-color: #1976D2;
}

.notification i {
    font-size: 1.2em;
}

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

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

/* Scrollbar Styling */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

/* Responsive Design */
@media (max-width: 768px) {
    .topbar {
        flex-wrap: wrap;
        padding: 8px 12px;
    }
    
    .topbar-left {
        display: flex;
        flex-wrap: wrap;
        align-items: center;
        gap: 8px;
    }
    
    .game-info-top {
        flex-wrap: wrap;
        gap: 10px;
    }
    
    .game-title {
        font-size: 2.8em;
    }
    
    .hand-card, .uno-card {
        width: 100px;
        height: 150px;
    }
    
    .card-value {
        font-size: 1.6em;
    }
    
    .play-area-content {
        gap: 30px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .rules-grid {
        grid-template-columns: 1fr;
    }
    
    #notificationContainer {
        top: 10px;
        right: 10px;
        left: 10px;
        max-width: none;
    }
}

@media (max-width: 480px) {
    .screen {
        padding: 10px;
    }
    
    .player-setup, .players-list {
        padding: 25px;
    }
    
    .game-header {
        padding: 20px;
    }
    
    .hand {
        gap: 10px;
    }
    
    .hand-card, .uno-card {
        width: 85px;
        height: 130px;
    }
    
    .card-value {
        font-size: 1.4em;
    }
}

/* Utility Classes */
.text-center { text-align: center; }
.mt-20 { margin-top: 20px; }
.mb-20 { margin-bottom: 20px; }
.hidden { display: none; }

/* UNO Card Styles with Images */
.uno-card {
    width: 140px;
    height: 200px;
    border-radius: 12px;
    position: relative;
    transition: var(--transition);
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border: 3px solid rgba(255, 255, 255, 0.3);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.hand-card {
    width: 120px;
    height: 170px;
    border-radius: 10px;
    position: relative;
    transition: var(--transition);
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    border: 3px solid rgba(255, 255, 255, 0.4);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Remove the old gradient backgrounds since we'll use images */
/* Only remove gradient if NOT using image-card class */
.uno-card.red:not(.image-card), .hand-card.red:not(.image-card),
.uno-card.blue:not(.image-card), .hand-card.blue:not(.image-card),
.uno-card.green:not(.image-card), .hand-card.green:not(.image-card),
.uno-card.yellow:not(.image-card), .hand-card.yellow:not(.image-card),
.uno-card.wild:not(.image-card), .hand-card.wild:not(.image-card),
.uno-card.teal:not(.image-card), .hand-card.teal:not(.image-card),
.uno-card.orange:not(.image-card), .hand-card.orange:not(.image-card),
.uno-card.pink:not(.image-card), .hand-card.pink:not(.image-card),
.uno-card.purple:not(.image-card), .hand-card.purple:not(.image-card) {
    background: none !important;
}

/* Card back styling for deck */
.deck-card {
    background-image: url('../images/card_back.webp') !important;
}

/* Card content overlay for text/symbols */
.card-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px;
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: inherit;
    backdrop-filter: blur(5px);
}

/* Ensure text is readable on images */
.card-value, .card-symbol, .card-side {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    color: white;
    font-weight: bold;
}

/* For yellow cards, use dark text for better contrast */
.uno-card.yellow .card-content *,
.hand-card.yellow .card-content * {
    color: #2d3748;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
}

/* Additional UNO card image styles provided by user */
.uno-card {
    width: 140px;
    height: 200px;
    border-radius: 12px;
    position: relative;
    transition: var(--transition);
    cursor: pointer;
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
    border: 3px solid rgba(255, 255, 255, 0.3);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

.hand-card {
    width: 120px;
    height: 170px;
    border-radius: 10px;
    position: relative;
    transition: var(--transition);
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    border: 3px solid rgba(255, 255, 255, 0.4);
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
}

/* Remove the old gradient backgrounds since we'll use images */
/* Only remove gradient if NOT using image-card class */
.uno-card.red:not(.image-card), .hand-card.red:not(.image-card),
.uno-card.blue:not(.image-card), .hand-card.blue:not(.image-card),
.uno-card.green:not(.image-card), .hand-card.green:not(.image-card),
.uno-card.yellow:not(.image-card), .hand-card.yellow:not(.image-card),
.uno-card.wild:not(.image-card), .hand-card.wild:not(.image-card),
.uno-card.teal:not(.image-card), .hand-card.teal:not(.image-card),
.uno-card.orange:not(.image-card), .hand-card.orange:not(.image-card),
.uno-card.pink:not(.image-card), .hand-card.pink:not(.image-card),
.uno-card.purple:not(.image-card), .hand-card.purple:not(.image-card) {
    background: none !important;
}

/* Card back styling for deck */
.deck-card {
    background-image: url('../images/card_back.webp') !important;
}

/* Card content overlay for text/symbols */
.card-content {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 15px;
    text-align: center;
    background: rgba(255, 255, 255, 0.1);
    border-radius: inherit;
    backdrop-filter: blur(5px);
}

/* Ensure text is readable on images */
.card-value, .card-symbol, .card-side {
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.8);
    color: white;
    font-weight: bold;
}

/* For yellow cards, use dark text for better contrast */
.uno-card.yellow .card-content *,
.hand-card.yellow .card-content * {
    color: #2d3748;
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
}
