:root {
    --bg-dark: #0f172a;
    --text-light: #f8fafc;
    --text-muted: #94a3b8;
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --secondary: #ec4899;
    --secondary-hover: #db2777;
    --danger: #ef4444;
    --warning: #f59e0b;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-light);
    min-height: 100vh;
    overflow-x: hidden;
    position: relative;
}

.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    overflow: hidden;
    background: radial-gradient(circle at center, #1e1b4b 0%, #0f172a 100%);
}

.blob {
    position: absolute;
    filter: blur(80px);
    border-radius: 50%;
    opacity: 0.6;
    animation: float 20s infinite ease-in-out alternate;
}

.blob1 {
    top: -10%;
    left: -10%;
    width: 60vw;
    height: 60vw;
    background: rgba(99, 102, 241, 0.4);
}

.blob2 {
    bottom: -10%;
    right: -10%;
    width: 50vw;
    height: 50vw;
    background: rgba(236, 72, 153, 0.3);
    animation-delay: -5s;
}

@keyframes float {
    0% { transform: translate(0, 0) scale(1); }
    100% { transform: translate(10%, 15%) scale(1.1); }
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.screen {
    display: none;
    width: 100%;
    animation: fadeIn 0.4s ease-out;
}

.screen.view-active {
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.hidden {
    display: none !important;
}

.glass-panel {
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2.5rem;
    box-shadow: var(--glass-shadow);
}

h1 {
    font-size: 3.5rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #a5b4fc 0%, #c084fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-align: center;
}

h2 { font-size: 2rem; font-weight: 600; }
h3 { font-size: 1.5rem; font-weight: 500; margin-bottom: 1.5rem; color: var(--text-light); }
p { color: var(--text-muted); font-size: 1.1rem; text-align: center; margin-bottom: 2rem; }

.actions {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    max-width: 400px;
    margin: 0 auto;
}

.btn {
    font-family: inherit;
    font-size: 1.1rem;
    font-weight: 600;
    padding: 1rem 1.5rem;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.primary { background: var(--primary); color: white; box-shadow: 0 4px 14px rgba(99, 102, 241, 0.4); }
.btn.primary:hover:not(:disabled) { background: var(--primary-hover); transform: translateY(-2px); }
.btn.secondary { background: var(--secondary); color: white; box-shadow: 0 4px 14px rgba(236, 72, 153, 0.4); }
.btn.secondary:hover:not(:disabled) { background: var(--secondary-hover); transform: translateY(-2px); }
.btn.warning { background: var(--warning); color: white; }
.btn.danger { background: var(--danger); color: white; }
.btn.outline { background: transparent; border: 2px solid var(--primary); color: var(--text-light); }
.btn.outline:hover:not(:disabled) { background: rgba(99, 102, 241, 0.1); }

.divider {
    display: flex; align-items: center; color: var(--text-muted); text-align: center;
}
.divider::before, .divider::after { content: ''; flex: 1; border-bottom: 1px solid var(--glass-border); }
.divider span { padding: 0 10px; font-size: 0.9rem; }

.join-container { display: flex; flex-direction: column; gap: 1rem; }
.name-container {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
}
.name-container label {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
    margin-left: 0.5rem;
}
input[type="text"] {
    width: 100%; padding: 1rem 1.5rem; font-size: 1.1rem; font-family: inherit;
    background: rgba(15, 23, 42, 0.6); border: 1px solid var(--glass-border);
    border-radius: 12px; color: white; outline: none; transition: border-color 0.2s;
}
input[type="text"]:focus { border-color: var(--primary); }

.header { display: flex; justify-content: space-between; align-items: center; padding: 1.5rem 2rem; }
.room-id-badge {
    display: inline-flex; align-items: center; gap: 1rem;
    background: rgba(0, 0, 0, 0.2); padding: 0.5rem 1rem; border-radius: 8px;
    margin-top: 0.5rem; font-family: monospace; font-size: 1.2rem; border: 1px solid var(--glass-border);
}
.room-id-badge strong { color: var(--secondary); letter-spacing: 2px; }
.icon-btn { background: transparent; border: 1px solid var(--glass-border); color: var(--text-muted); padding: 0.25rem 0.5rem; border-radius: 4px; cursor: pointer; }
.icon-btn:hover { color: white; border-color: var(--primary); }
.controls { display: flex; gap: 1rem; }

.participant-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 1.5rem; min-height: 300px; align-content: start;
}

.participant-card {
    background: rgba(255, 255, 255, 0.03); border: 1px solid var(--glass-border);
    border-radius: 16px; padding: 1.5rem; display: flex; flex-direction: column;
    align-items: center; gap: 1rem; transition: all 0.3s ease;
}

.participant-card.has-voted {
    border-color: rgba(99, 102, 241, 0.5); background: rgba(99, 102, 241, 0.1);
}

.participant-card.disconnected {
    opacity: 0.5;
    filter: grayscale(80%);
}

.participant-card.disconnected .participant-name::after {
    content: " (offline)";
    font-size: 0.8em;
    font-style: italic;
    color: var(--warning);
}

.participant-card .vote-display {
    width: 60px; height: 90px; border-radius: 8px; background: rgba(0, 0, 0, 0.3);
    border: 2px dashed rgba(255, 255, 255, 0.1); display: flex; align-items: center;
    justify-content: center; font-size: 2rem; font-weight: 700; color: transparent;
    transition: all 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.participant-card.has-voted .vote-display {
    border-style: solid; border-color: var(--primary);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(236, 72, 153, 0.2));
}

.participant-card.revealed .vote-display {
    color: white; background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-color: transparent; transform: rotateY(360deg);
}

.participant-name { font-weight: 500; }

.stats-panel { margin-top: 2rem; padding: 1.5rem 2.5rem; }
.stats-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 2rem; }
.stat-box {
    display: flex; flex-direction: column; align-items: center; padding: 1.5rem;
    background: rgba(0, 0, 0, 0.2); border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.05);
}
.stat-label { color: var(--text-muted); font-size: 0.9rem; text-transform: uppercase; margin-bottom: 0.5rem; }
.stat-value { font-size: 2.5rem; font-weight: 700; color: var(--secondary); }

.deck-container { text-align: center; }
.cards-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 1rem; }

.poker-card {
    width: 80px; height: 120px; background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border); border-radius: 12px; display: flex;
    align-items: center; justify-content: center; font-size: 2rem; font-weight: 700;
    cursor: pointer; transition: all 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    user-select: none;
}

.poker-card:hover {
    transform: translateY(-10px); background: rgba(255, 255, 255, 0.1); border-color: var(--primary);
}

.poker-card.selected {
    background: linear-gradient(135deg, var(--primary) 0%, #a5b4fc 100%);
    border-color: transparent; color: var(--bg-dark);
    transform: translateY(-15px) scale(1.05); box-shadow: 0 15px 30px rgba(99, 102, 241, 0.4);
}

.vote-status { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 1.5rem; }
.selected-card-preview {
    width: 100px; height: 150px; background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 16px; display: flex; align-items: center; justify-content: center;
    font-size: 3rem; font-weight: 700; box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
    animation: dropIn 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes dropIn { from { opacity: 0; transform: translateY(-50px) scale(0.8); } to { opacity: 1; transform: translateY(0) scale(1); } }

.overlay {
    position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; display: flex;
    flex-direction: column; align-items: center; justify-content: center; z-index: 1000;
    background: rgba(15, 23, 42, 0.8); backdrop-filter: blur(8px);
    border-radius: 0; border: none;
}

.loader {
    width: 50px; height: 50px; border: 4px solid rgba(255, 255, 255, 0.1);
    border-left-color: var(--primary); border-radius: 50%;
    animation: spin 1s linear infinite; margin-bottom: 1.5rem;
}

@keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

.error-msg {
    color: var(--danger); background: rgba(239, 68, 68, 0.1); padding: 1rem;
    border-radius: 8px; border: 1px solid rgba(239, 68, 68, 0.2); margin-top: 1rem; text-align: center;
}
