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

:root {
    --bg-dark: #1a1a2e;
    --bg-card: #16213e;
    --accent: #e94560;
    --accent-hover: #ff6b6b;
    --text: #eaeaea;
    --text-dim: #a0a0a0;
    --success: #4ecca3;
    --warning: #ffc107;
    
    /* Player Colors */
    --player1: #e94560;
    --player2: #4ecca3;
    --player3: #7b68ee;
    --player4: #ffc107;
    --player5: #00bcd4;
    --player6: #ff9800;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, var(--bg-dark) 0%, #0f0f23 100%);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

#app {
    width: 100%;
    max-width: 600px;
    padding: 20px;
}

.screen {
    display: none;
    animation: fadeIn 0.3s ease;
}

.screen.active {
    display: block;
}

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

/* LOBBY */
.logo {
    text-align: center;
    margin-bottom: 40px;
}

.logo h1 {
    font-size: 3rem;
    font-weight: 300;
    letter-spacing: 0.5rem;
    color: var(--accent);
    text-shadow: 0 0 30px rgba(233, 69, 96, 0.5);
}

.logo h2 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: 0.8rem;
    margin-top: -10px;
}

.settings {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
}

.setting {
    margin-bottom: 20px;
}

.setting:last-child {
    margin-bottom: 0;
}

.setting label {
    display: block;
    margin-bottom: 10px;
    color: var(--text-dim);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.1rem;
}

.button-group {
    display: flex;
    gap: 10px;
}

.button-group button {
    flex: 1;
    padding: 12px;
    border: 2px solid var(--bg-dark);
    background: var(--bg-dark);
    color: var(--text);
    border-radius: 8px;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.button-group button:hover {
    border-color: var(--accent);
}

.button-group button.active {
    background: var(--accent);
    border-color: var(--accent);
    color: white;
}

.players-setup {
    background: var(--bg-card);
    border-radius: 16px;
    padding: 24px;
    margin-bottom: 24px;
}

.player-input {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.player-input:last-child {
    margin-bottom: 0;
}

.player-color-preview {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    flex-shrink: 0;
}

.player-input input {
    flex: 1;
    padding: 12px 16px;
    border: 2px solid var(--bg-dark);
    background: var(--bg-dark);
    color: var(--text);
    border-radius: 8px;
    font-size: 1rem;
}

.player-input input:focus {
    outline: none;
    border-color: var(--accent);
}

.primary-btn {
    width: 100%;
    padding: 16px;
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-hover) 100%);
    border: none;
    border-radius: 12px;
    color: white;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.primary-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(233, 69, 96, 0.4);
}

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

.secondary-btn {
    width: 100%;
    padding: 16px;
    background: var(--bg-card);
    border: 2px solid var(--accent);
    border-radius: 12px;
    color: var(--accent);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 10px;
}

/* GAME */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.scores {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
}

.score-badge {
    display: flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-card);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
}

.score-badge .color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}

.round-info {
    text-align: right;
    color: var(--text-dim);
    font-size: 0.9rem;
}

.round-info span {
    display: block;
}

.current-player-info {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.player-turn {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.1rem;
}

.player-color {
    width: 24px;
    height: 24px;
    border-radius: 50%;
}

.stones-left {
    color: var(--text-dim);
}

.timer {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--accent);
    min-width: 50px;
    text-align: center;
}

.timer.warning {
    color: var(--warning);
    animation: pulse 0.5s infinite;
}

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

.board-container {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.board {
    display: grid;
    gap: 8px;
    padding: 16px;
    background: var(--bg-card);
    border-radius: 16px;
}

.field {
    width: 60px;
    height: 60px;
    background: var(--bg-dark);
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.2s;
    position: relative;
}

.field:hover {
    background: #2a2a4e;
    transform: scale(1.05);
}

.field.selected {
    box-shadow: 0 0 0 3px var(--accent);
}

.field .stone {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

.field .stone-count {
    position: absolute;
    bottom: 4px;
    right: 4px;
    background: rgba(0,0,0,0.7);
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
}

.field.collision {
    animation: shake 0.5s;
    background: rgba(233, 69, 96, 0.3);
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-5px); }
    75% { transform: translateX(5px); }
}

.field .hidden-stone {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, #444 0%, #222 100%);
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
}

/* REVEAL */
#reveal h2, #set-end h2, #game-end h2 {
    text-align: center;
    margin-bottom: 24px;
    font-size: 2rem;
}

.collision-info {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 20px;
    text-align: center;
}

.collision-info .collision-item {
    margin: 8px 0;
}

/* SET END */
.set-results {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 20px;
}

.set-result-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--bg-dark);
}

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

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

.set-result-item .points-gained {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--success);
}

/* GAME END */
.winner-announcement {
    text-align: center;
}

.winner-name {
    font-size: 2.5rem;
    font-weight: bold;
    color: var(--accent);
    margin: 20px 0;
    text-shadow: 0 0 30px rgba(233, 69, 96, 0.5);
}

.final-scores {
    background: var(--bg-card);
    border-radius: 12px;
    padding: 24px;
    margin: 24px 0;
}

.final-score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
}

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

.final-score-item .total-points {
    font-size: 1.5rem;
    font-weight: bold;
}

/* Responsive */
@media (max-width: 480px) {
    .logo h1 {
        font-size: 2rem;
    }
    
    .logo h2 {
        font-size: 1.5rem;
    }
    
    .field {
        width: 50px;
        height: 50px;
    }
    
    .field .stone, .field .hidden-stone {
        width: 32px;
        height: 32px;
    }
}
