:root {
    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --secondary: #6b7280;
    --bg: #f9fafb;
    --surface: #ffffff;
    --text: #111827;
    --text-muted: #6b7280;
    --border: #e5e7eb;
    --success: #10b981;
    --danger: #ef4444;
    --radius: 8px;
}

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

body {
    font-family: system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 1rem 2rem;
}

nav {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary);
    text-decoration: none;
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    margin-left: 1.5rem;
    transition: color 0.2s;
}

.nav-links a:hover {
    color: var(--primary);
}

main {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    width: 100%;
}

footer {
    text-align: center;
    padding: 1rem;
    color: var(--text-muted);
    font-size: 0.875rem;
}

.btn {
    display: inline-block;
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.2s, transform 0.1s;
    text-decoration: none;
}

.btn:active {
    transform: scale(0.98);
}

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

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

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

.btn-secondary:hover {
    background: #4b5563;
}

.btn-accent {
    background: #10b981;
    color: white;
}

.btn-accent:hover {
    background: #059669;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
}

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

.hero {
    text-align: center;
    padding: 4rem 0;
}

.hero h1 {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.hero p {
    font-size: 1.25rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
}

.lobby h2 {
    margin-bottom: 1.5rem;
}

.lobby-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.lobby-actions form {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

input[type="text"] {
    padding: 0.625rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 1rem;
}

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

#room-list {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.empty-state {
    color: var(--text-muted);
    text-align: center;
    padding: 2rem;
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
}

.room-code {
    background: var(--primary);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: var(--radius);
    font-family: monospace;
    font-size: 1.25rem;
}

.game-layout {
    display: grid;
    grid-template-columns: 1fr 1fr 250px;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 900px) {
    .game-layout {
        grid-template-columns: 1fr;
    }
}

.dice-section, .scorecard-section, .players-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.dice-section h3, .scorecard-section h3, .players-section h3 {
    margin-bottom: 1rem;
}

.dice {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    justify-content: center;
}

.die {
    width: 60px;
    height: 60px;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    user-select: none;
}

.die:hover {
    border-color: var(--primary);
}

.die.kept {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

.rolls-left {
    text-align: center;
    margin-bottom: 1rem;
    color: var(--text-muted);
}

#roll-form {
    text-align: center;
}

.scorecard {
    width: 100%;
    border-collapse: collapse;
}

.scorecard th, .scorecard td {
    padding: 0.5rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.scorecard .section-header {
    background: var(--bg);
    font-weight: 600;
}

.score-value {
    font-weight: 600;
    text-align: center;
}

#players-list {
    list-style: none;
}

.player {
    padding: 0.5rem;
    border-radius: var(--radius);
    margin-bottom: 0.5rem;
}

.player.active {
    background: rgba(79, 70, 229, 0.1);
    border-left: 3px solid var(--primary);
}

.player.cpu {
    background: rgba(16, 185, 129, 0.1);
    border-left: 3px solid #10b981;
}

.player.cpu::after {
    content: "🤖";
    margin-left: 0.5rem;
    font-size: 0.875rem;
}

.game-log {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
}

.game-log h3 {
    margin-bottom: 1rem;
}

#log-entries {
    max-height: 200px;
    overflow-y: auto;
}

.log-entry {
    padding: 0.375rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
    color: var(--text-muted);
}

.dice-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    margin-top: 0.75rem;
}

.dice-actions form {
    margin: 0;
}
