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

:root {
    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --secondary: #6b7280;
    --secondary-hover: #4b5563;
    --success: #10b981;
    --warning: #f59e0b;
    --danger: #ef4444;
    --bg: #f1f5f9;
    --bg-card: #ffffff;
    --table-bg: #dbeafe;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #cbd5e1;
    --card-border: #3b82f6;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 4px 6px rgba(0, 0, 0, 0.1);
    --radius: 8px;
    --radius-lg: 16px;
    --radius-xl: 24px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
}

.screen {
    min-height: 100vh;
}

.hidden {
    display: none !important;
}

/* Lobby Screen */
.lobby-container {
    max-width: 400px;
    margin: 0 auto;
    padding: 60px 20px;
    text-align: center;
}

.lobby-container h1 {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 8px;
}

.subtitle {
    color: var(--text-muted);
    margin-bottom: 40px;
}

.lobby-form {
    background: var(--bg-card);
    padding: 32px;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
}

.form-group {
    margin-bottom: 24px;
    text-align: left;
}

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

input[type="text"] {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input[type="text"]:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.lobby-actions {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.divider {
    display: flex;
    align-items: center;
    gap: 16px;
    color: var(--text-muted);
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.create-section,
.join-section {
    display: flex;
    gap: 8px;
}

.create-section input,
.join-section input {
    flex: 1;
}

.connection-status {
    margin-top: 20px;
    padding: 12px;
    border-radius: var(--radius);
    font-size: 0.875rem;
}

.connection-status.error {
    background: #fef2f2;
    color: var(--danger);
}

.connection-status.success {
    background: #ecfdf5;
    color: var(--success);
}

.connection-status.loading {
    background: #fef3c7;
    color: var(--warning);
}

/* Buttons */
.btn {
    padding: 12px 24px;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
}

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

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

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

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

.btn-primary:hover:not(:disabled) {
    background: var(--primary-hover);
}

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

.btn-secondary:hover:not(:disabled) {
    background: var(--secondary-hover);
}

.btn-small {
    padding: 6px 12px;
    font-size: 0.875rem;
}

.btn-large {
    padding: 16px 32px;
    font-size: 1.125rem;
}

.btn-spectator {
    background: var(--bg);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-spectator:hover:not(:disabled) {
    background: var(--border);
}

.btn-spectator.active {
    background: #fef3c7;
    border-color: #f59e0b;
    color: #92400e;
}

/* Room Header */
.room-header {
    background: var(--bg-card);
    padding: 16px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    gap: 12px;
}

.header-left h1 {
    font-size: 1.25rem;
    color: var(--primary);
}

.room-info {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 4px;
}

.room-id {
    font-size: 0.875rem;
    color: var(--text-muted);
}

.room-id code {
    background: var(--bg);
    padding: 2px 8px;
    border-radius: 4px;
    font-family: monospace;
}

.player-badge {
    background: var(--primary);
    color: white;
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.875rem;
    font-weight: 500;
}

/* Main Content */
.room-main {
    max-width: 800px;
    margin: 0 auto;
    padding: 32px 24px;
}

/* Poker Table Section */
.poker-table-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    margin-bottom: 48px;
}

/* Participants Row */
.participants-row {
    display: flex;
    justify-content: center;
    gap: 32px;
    flex-wrap: wrap;
}

/* Participant Card */
.participant {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.participant-card {
    width: 48px;
    height: 64px;
    background: #e2e8f0;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--primary);
    transition: all 0.3s ease;
}

.participant.voted .participant-card {
    background: #cbd5e1;
}

.participant.revealed .participant-card {
    background: var(--bg-card);
    border: 2px solid var(--primary);
}

.participant.spectator .participant-card {
    background: #fef3c7;
    font-size: 1.5rem;
}

.participant-name {
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--text);
}

/* Poker Table */
.poker-table {
    background: var(--table-bg);
    border-radius: var(--radius-xl);
    padding: 48px 80px;
    min-width: 300px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.table-message {
    color: var(--text-muted);
    font-size: 1.125rem;
    font-weight: 500;
    text-align: center;
}

.average-label {
    font-size: 0.875rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.average-value {
    font-size: 3rem;
    font-weight: 700;
    color: var(--primary);
    line-height: 1;
}

/* Voting Section */
.voting-section {
    margin-bottom: 32px;
    text-align: center;
}

.voting-prompt {
    font-size: 1rem;
    color: var(--text);
    margin-bottom: 16px;
}

.pointing {
    display: inline-block;
}

.card-deck {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: center;
}

.card {
    width: 64px;
    height: 88px;
    border: 2px solid var(--card-border);
    border-radius: var(--radius);
    background: var(--bg-card);
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary);
    cursor: pointer;
    transition: all 0.2s;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.card.selected {
    background: var(--primary);
    color: white;
    transform: translateY(-4px);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.card:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* Actions Section */
.actions-section {
    display: flex;
    justify-content: center;
    gap: 16px;
}

/* Toast Notifications */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 1000;
}

.toast {
    background: var(--bg-card);
    padding: 12px 20px;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    animation: toastIn 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.toast.info {
    border-left: 4px solid var(--primary);
}

.toast.success {
    border-left: 4px solid var(--success);
}

.toast.warning {
    border-left: 4px solid var(--warning);
}

.toast.error {
    border-left: 4px solid var(--danger);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
        transform: translateX(0);
    }
    to {
        opacity: 0;
        transform: translateX(20px);
    }
}

/* Responsive */
@media (max-width: 600px) {
    .room-header {
        padding: 12px 16px;
    }

    .header-left h1 {
        font-size: 1rem;
    }

    .room-main {
        padding: 24px 16px;
    }

    .poker-table {
        padding: 32px 40px;
        min-width: auto;
        width: 100%;
    }

    .participants-row {
        gap: 20px;
    }

    .card {
        width: 52px;
        height: 72px;
        font-size: 1.25rem;
    }

    .actions-section {
        flex-direction: column;
    }

    .actions-section .btn {
        width: 100%;
    }
}
