:root {
    --bg-primary: #000000;
    --bg-secondary: #0a0f0a;
    --bg-card: #0d120d;
    --bg-hover: #141f14;
    --text-primary: #00ff41;
    --text-secondary: #00cc33;
    --text-muted: #006622;
    --accent-primary: #00ff41;
    --accent-secondary: #33ff66;
    --accent-glow: rgba(0, 255, 65, 0.3);
    --success: #00ff41;
    --danger: #ff3333;
    --warning: #ffcc00;
    --info: #00ccff;
    --border: #003311;
    --border-light: #004422;
    --radius: 4px;
    --radius-sm: 2px;
    --shadow: 0 0 20px rgba(0, 255, 65, 0.2);
    --transition: 0.15s ease;
}

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

body {
    font-family: 'Courier Prime', 'Courier New', monospace;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    line-height: 1.6;
    position: relative;
    overflow-x: hidden;
}

/* Matrix Rain Background */
.matrix-bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
    opacity: 0.15;
}

.container {
    max-width: 900px;
    margin: 0 auto;
    padding: 2rem;
    min-height: 100vh;
    position: relative;
    z-index: 1;
}

/* Header */
header {
    text-align: center;
    margin-bottom: 3rem;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    color: var(--accent-primary);
    text-shadow: 0 0 20px var(--accent-glow), 0 0 40px var(--accent-glow);
    letter-spacing: 0.1em;
    margin-bottom: 0.5rem;
}

.tagline {
    color: var(--text-muted);
    font-size: 0.9rem;
    letter-spacing: 0.05em;
}

/* Screens */
.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); }
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem;
    margin-bottom: 1.5rem;
    box-shadow: var(--shadow);
    position: relative;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, var(--accent-primary), transparent);
}

.card h2 {
    font-size: 1.3rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.card h3 {
    font-size: 0.9rem;
    margin-bottom: 1rem;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Buttons */
.btn {
    font-family: 'Courier Prime', 'Courier New', monospace;
    font-size: 0.85rem;
    font-weight: 700;
    padding: 0.75rem 1.5rem;
    border: 1px solid var(--accent-primary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
}

.btn-primary {
    background: transparent;
    color: var(--accent-primary);
    border: 1px solid var(--accent-primary);
    text-shadow: 0 0 10px var(--accent-glow);
    box-shadow: 0 0 10px var(--accent-glow), inset 0 0 10px rgba(0, 255, 65, 0.1);
}

.btn-primary:hover:not(:disabled) {
    background: var(--accent-primary);
    color: var(--bg-primary);
    text-shadow: none;
    box-shadow: 0 0 20px var(--accent-glow);
}

.btn-secondary {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-light);
}

.btn-secondary:hover:not(:disabled) {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.btn-ghost {
    background: transparent;
    color: var(--text-secondary);
}

.btn-ghost:hover {
    color: var(--text-primary);
}

.btn-small {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-accent {
    background: var(--success);
    color: var(--bg-primary);
}

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

.button-group {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
    justify-content: center;
}

/* Forms */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.form-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--accent-primary);
    font-family: 'Courier Prime', 'Courier New', monospace;
    font-size: 0.9rem;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.form-group input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 10px var(--accent-glow);
}

.form-group input::placeholder {
    color: var(--text-muted);
}

.form-group small {
    display: block;
    margin-top: 0.5rem;
    color: var(--text-muted);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* Rules */
/* Hero Card */
.hero-card {
    text-align: center;
    padding: 3rem 2rem;
}

.hero-content h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
    color: var(--text-primary);
}

.hero-description {
    color: var(--text-secondary);
    font-size: 1.1rem;
    max-width: 500px;
    margin: 0 auto 2rem;
    line-height: 1.7;
}

.btn-large {
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
}

/* Rules */
.rules {
    margin-top: 1.5rem;
}

.rules h3 {
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
}

.rules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}

.rule-item {
    display: flex;
    gap: 1rem;
    align-items: flex-start;
}

.rule-number {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    min-width: 32px;
    background: transparent;
    border: 1px solid var(--accent-primary);
    color: var(--accent-primary);
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.8rem;
    text-shadow: 0 0 10px var(--accent-glow);
}

.rule-item strong {
    display: block;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-size: 0.85rem;
    color: var(--text-primary);
    margin-bottom: 0.25rem;
}

.rule-item p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin: 0;
}

.leaderboard-link {
    text-align: center;
    margin-top: 1.5rem;
}

/* Legacy rules (for backwards compat) */
.rules ul {
    list-style: none;
    padding-left: 0;
}

.rules li {
    padding: 0.5rem 0;
    padding-left: 1.5rem;
    position: relative;
    color: var(--text-secondary);
}

.rules li::before {
    content: '→';
    position: absolute;
    left: 0;
    color: var(--accent-primary);
}

/* Lobby */
.game-code-display {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    margin-bottom: 1.5rem;
}

.game-code-display .code {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--accent-primary);
    letter-spacing: 0.1em;
}

.players-list {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.player-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.player-item.host::after {
    content: 'HOST';
    font-size: 0.7rem;
    font-weight: 700;
    padding: 0.25rem 0.5rem;
    background: var(--accent-primary);
    color: white;
    border-radius: 4px;
    margin-left: auto;
}

.player-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 1.1rem;
}

.lobby-info {
    text-align: center;
    margin-bottom: 1.5rem;
    color: var(--text-secondary);
}

.lobby-info .min-players {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Game Screen */
.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 2rem;
    padding: 1rem 1.5rem;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.your-word {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    color: var(--text-secondary);
}

.your-word .secret {
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--accent-primary);
    padding: 0.5rem 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.change-word-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border: 2px solid var(--accent-primary);
    border-radius: var(--radius);
    margin-top: 1rem;
}

.change-word-container.hidden {
    display: none;
}

.change-word-label {
    font-weight: 600;
    color: var(--accent-primary);
    margin: 0;
}

.word-pool-options {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    max-height: 150px;
    overflow-y: auto;
}

.word-pool-option {
    padding: 0.375rem 0.625rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: 'Courier Prime', monospace;
    font-size: 0.8rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.word-pool-option:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.word-pool-option.selected {
    background: var(--accent-primary);
    color: var(--bg-primary);
    border-color: var(--accent-primary);
}

.change-word-input-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.change-word-input-row .selected-word-display {
    flex: 1;
    padding: 0.5rem 0.75rem;
    font-size: 0.9rem;
}

/* Waiting Notice */
.waiting-notice {
    padding: 1rem;
    background: var(--bg-secondary);
    border: 2px dashed var(--accent-secondary);
    border-radius: var(--radius);
    text-align: center;
    color: var(--text-secondary);
    animation: pulse 2s infinite;
}

.waiting-notice #waiting-player-name {
    font-weight: 700;
    color: var(--accent-primary);
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.waiting-notice.hidden {
    display: none;
}

.change-word-container input {
    padding: 0.5rem 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--success);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    width: 150px;
}

/* Game Layout with Sidebar */
.game-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 1.5rem;
    max-width: 1400px;
    margin: 0 auto;
    height: calc(100vh - 4rem);
}

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

/* Game Sidebar */
.game-sidebar {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.sidebar-header {
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid var(--border);
}

.sidebar-header h3 {
    margin: 0;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.sidebar-header h3 span {
    color: var(--accent-primary);
    font-weight: 700;
}

.sidebar-legend {
    display: flex;
    gap: 1rem;
    margin-bottom: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 0.375rem;
}

.legend-item .dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
}

.legend-item .dot.guessed {
    background: var(--accent-secondary);
}

.legend-item .dot.eliminated {
    background: var(--danger);
}

.game-wordlist-sidebar {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
    align-content: flex-start;
}

.game-wordlist-sidebar .word-item {
    padding: 0.25rem 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.7rem;
    color: var(--text-muted);
    transition: all 0.15s ease;
}

.game-wordlist-sidebar .word-item.guessed {
    background: rgba(139, 92, 246, 0.2);
    border-color: var(--accent-secondary);
    color: var(--accent-secondary);
}

.game-wordlist-sidebar .word-item.eliminated {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--danger);
    color: var(--danger);
    text-decoration: line-through;
}

.game-wordlist-sidebar .word-item.your-word {
    background: rgba(16, 185, 129, 0.2);
    border-color: var(--success);
    color: var(--success);
    font-weight: 700;
}

/* Game Main Area */
.game-main {
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    overflow-y: auto;
    padding-right: 0.5rem;
}

/* Players Grid */
.players-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1rem;
    margin-bottom: 2rem;
}

.player-card {
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
    text-align: center;
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
}

/* Danger indicator - colored bar at top of card */
.danger-indicator {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    transition: background-color 0.3s ease;
}

.danger-safe {
    background: var(--success);
}

.danger-low {
    background: linear-gradient(90deg, var(--success), var(--warning));
}

.danger-medium {
    background: var(--warning);
}

.danger-high {
    background: linear-gradient(90deg, var(--warning), var(--danger));
}

.danger-critical {
    background: var(--danger);
    animation: pulse-danger 1s infinite;
}

@keyframes pulse-danger {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

.player-card.current-turn {
    border-color: var(--accent-primary);
    box-shadow: 0 0 20px var(--accent-glow);
}

.player-card.eliminated {
    opacity: 0.4;
    filter: grayscale(1);
}

.player-card.is-you {
    background: linear-gradient(135deg, rgba(255, 107, 74, 0.1), rgba(255, 143, 115, 0.05));
}

.player-card .name {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.player-card .status {
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.player-card .status.alive {
    color: var(--success);
}

.player-card .status.eliminated {
    color: var(--danger);
}

.player-card .similarity {
    margin-top: 0.75rem;
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.5rem;
    font-weight: 700;
}

.player-card .top-guesses {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.375rem;
}

.player-card .top-guess {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.375rem 0.5rem;
    background: var(--bg-secondary);
    border-radius: 4px;
    font-size: 0.8rem;
}

.player-card .guess-word {
    font-family: 'JetBrains Mono', monospace;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 70%;
}

.player-card .guess-sim {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
}

.similarity.low, .guess-sim.low { color: var(--info); }
.similarity.medium, .guess-sim.medium { color: var(--warning); }
.similarity.high, .guess-sim.high { color: var(--accent-primary); }
.similarity.danger, .guess-sim.danger { color: var(--danger); }

/* Turn Indicator */
.turn-indicator {
    text-align: center;
    padding: 1rem;
    margin-bottom: 1.5rem;
    background: var(--bg-card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
}

.turn-indicator #turn-text {
    font-size: 1.1rem;
    font-weight: 500;
}

.turn-indicator.your-turn {
    border-color: var(--accent-primary);
    background: linear-gradient(135deg, rgba(0, 255, 65, 0.15), rgba(0, 255, 65, 0.1));
}

.turn-indicator.your-turn #turn-text {
    color: var(--accent-primary);
    font-weight: 700;
}

.waiting-for-words {
    color: var(--text-secondary);
    animation: pulse 2s ease-in-out infinite;
}

.waiting-for-words small {
    color: var(--text-muted);
    font-size: 0.8rem;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.6; }
}

/* Guess Section */
.guess-section {
    margin-bottom: 2rem;
}

#guess-form {
    display: flex;
    gap: 1rem;
}

#guess-input {
    flex: 1;
    padding: 1rem 1.25rem;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-family: 'JetBrains Mono', monospace;
    font-size: 1.1rem;
    transition: border-color var(--transition);
}

#guess-input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

#guess-input:disabled {
    opacity: 0.5;
}

/* History */
.history-section h3 {
    margin-bottom: 1rem;
    color: var(--text-secondary);
}

.history-log {
    max-height: 400px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.history-entry {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 1rem;
}

.history-entry.word-change-entry {
    background: var(--bg-secondary);
    border-color: var(--accent-primary);
    border-style: dashed;
}

.word-change-notice {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
}

.word-change-notice .change-icon {
    font-size: 1.2rem;
}

.word-changed-note {
    margin-top: 0.5rem;
    padding: 0.25rem 0.5rem;
    background: var(--bg-secondary);
    border: 1px dashed var(--accent-primary);
    border-radius: 4px;
    font-size: 0.75rem;
    color: var(--accent-primary);
    text-align: center;
}

.history-entry .header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.history-entry .guesser {
    font-weight: 600;
}

.history-entry .word {
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent-primary);
    font-weight: 600;
}

.history-entry .similarities {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.history-entry .sim-badge {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    background: var(--bg-secondary);
    border-radius: 4px;
    font-size: 0.875rem;
}

.history-entry .sim-badge .score {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 600;
}

.history-entry .elimination {
    margin-top: 0.75rem;
    padding: 0.5rem 0.75rem;
    background: rgba(239, 68, 68, 0.2);
    border: 1px solid var(--danger);
    border-radius: 4px;
    color: var(--danger);
    font-weight: 600;
    font-size: 0.875rem;
}

/* Game Over */
.gameover-card {
    text-align: center;
}

.gameover-card h2 {
    font-size: 2rem;
    margin-bottom: 1rem;
}

.gameover-card #gameover-message {
    font-size: 1.25rem;
    margin-bottom: 2rem;
    color: var(--text-secondary);
}

.revealed-words {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 2rem;
    text-align: left;
}

.revealed-word {
    display: flex;
    justify-content: space-between;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
}

.revealed-word .player-name {
    font-weight: 500;
}

.revealed-word .word {
    font-family: 'JetBrains Mono', monospace;
    color: var(--accent-primary);
}

/* Utilities */
.hidden {
    display: none !important;
}

/* Leaderboard */
.leaderboard-link {
    margin-top: 1rem;
    text-align: center;
}

.leaderboard-table-container {
    overflow-x: auto;
    margin-bottom: 1.5rem;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.95rem;
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 0.875rem 0.75rem;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.leaderboard-table th {
    font-weight: 600;
    color: var(--text-secondary);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.leaderboard-table tbody tr:hover {
    background: var(--bg-hover);
}

.leaderboard-table .rank {
    font-weight: 700;
    color: var(--accent-primary);
}

.leaderboard-table .rank-1 { color: #ffd700; }
.leaderboard-table .rank-2 { color: #c0c0c0; }
.leaderboard-table .rank-3 { color: #cd7f32; }

.leaderboard-table .player-name {
    font-weight: 600;
}

.leaderboard-table .stat {
    font-family: 'JetBrains Mono', monospace;
}

.leaderboard-table .win-rate {
    color: var(--success);
}

.leaderboard-table .closeness {
    color: var(--info);
}

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

/* Revealed Words (Game Over) */
.revealed-words {
    margin: 1.5rem 0;
}

.revealed-words h3 {
    margin-bottom: 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.revealed-word-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
}

.revealed-word-item.winner {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1), rgba(255, 215, 0, 0.05));
    border-color: #ffd700;
}

.revealed-word-item.eliminated {
    opacity: 0.6;
}

.revealed-word-item .player-name {
    font-weight: 600;
    color: var(--text-primary);
}

.revealed-word-item .player-word {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    color: var(--accent-primary);
    font-size: 1.1rem;
}

/* Theme Selection */
.theme-select-card {
    text-align: center;
}

.theme-select-subtitle {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.theme-select-subtitle strong {
    color: var(--accent-primary);
    font-family: 'JetBrains Mono', monospace;
}

.theme-options-container {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.btn-theme-option {
    padding: 1rem 1.5rem;
    font-size: 1.1rem;
    background: var(--bg-secondary);
    border: 2px solid var(--border);
    color: var(--text-primary);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-theme-option:hover:not(:disabled) {
    border-color: var(--accent-primary);
    background: var(--bg-hover);
    transform: translateY(-2px);
}

.btn-theme-option:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Theme Display */
.theme-display {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.theme-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    color: var(--text-secondary);
}

.theme-name {
    font-weight: 700;
    color: var(--accent-primary);
    font-size: 1.1rem;
}

.theme-words-label {
    font-size: 0.875rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.theme-words {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    max-height: 150px;
    overflow-y: auto;
}

.theme-word {
    padding: 0.25rem 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
}

.theme-word:hover {
    background: var(--bg-hover);
    border-color: var(--accent-primary);
    color: var(--text-primary);
}

.lobby-theme {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1rem;
    padding: 0.75rem 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
}

/* Game Theme Info */
.game-theme-info {
    margin-bottom: 1.5rem;
    padding: 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.game-theme-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    color: var(--text-secondary);
}

.game-theme-header strong {
    color: var(--accent-primary);
}

.game-wordlist {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
    max-height: 200px;
    overflow-y: auto;
}

.game-wordlist .theme-word {
    padding: 0.25rem 0.5rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.75rem;
    color: var(--text-muted);
}

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

::-webkit-scrollbar-track {
    background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
    background: var(--border-light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 1rem;
    }
    
    header h1 {
        font-size: 2rem;
    }
    
    .card {
        padding: 1.5rem;
    }
    
    .game-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    #guess-form {
        flex-direction: column;
    }
    
    .players-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* Open Lobbies */
.lobbies-card {
    margin-top: 1.5rem;
}

.lobbies-card h3 {
    margin-bottom: 1rem;
}

.open-lobbies {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
    max-height: 300px;
    overflow-y: auto;
}

.lobby-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.lobby-info-row {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.lobby-code {
    font-family: 'JetBrains Mono', monospace;
    font-weight: 700;
    color: var(--accent-primary);
}

.lobby-players {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.no-lobbies, .loading-lobbies {
    text-align: center;
    color: var(--text-muted);
    padding: 2rem;
}

/* Theme Voting */
.theme-voting-section {
    margin: 1.5rem 0;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius);
}

.theme-voting-section h3 {
    margin-bottom: 1rem;
    font-size: 1rem;
    color: var(--text-secondary);
}

.theme-vote-options {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.theme-vote-btn {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    cursor: pointer;
    transition: all var(--transition);
}

.theme-vote-btn:hover {
    border-color: var(--accent-primary);
    background: var(--bg-hover);
}

.theme-vote-btn.voted {
    border-color: var(--accent-primary);
    background: rgba(255, 107, 74, 0.1);
}

.theme-vote-btn .vote-count {
    font-size: 0.85rem;
    color: var(--text-secondary);
    background: var(--bg-secondary);
    padding: 0.25rem 0.5rem;
    border-radius: 4px;
}

.theme-vote-btn.voted .vote-count {
    background: var(--accent-primary);
    color: white;
}

/* Host Controls */
.host-controls {
    margin-top: 1rem;
}

/* Lobby Player Styles */
.lobby-player {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
}

.lobby-player.host {
    border: 1px solid var(--accent-primary);
}

.lobby-player.ready {
    background: rgba(0, 255, 65, 0.1);
}

.lobby-player .player-status {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-left: auto;
}

.lobby-player.ready .player-status {
    color: var(--accent-primary);
}

.host-badge {
    font-size: 0.75rem;
    background: var(--accent-primary);
    color: var(--bg-primary);
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
}

/* Ready button */
.lobby-actions {
    margin: 1rem 0;
    text-align: center;
}

#ready-btn.ready {
    background: var(--accent-primary);
    color: var(--bg-primary);
    border-color: var(--accent-primary);
}

/* Voter names in theme voting */
.theme-vote-btn {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
}

.voter-names {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-style: italic;
}

/* Word Selection Screen */
.word-select-card {
    max-width: 700px;
    margin: 0 auto;
}

.theme-label {
    color: var(--accent-primary);
    margin-bottom: 1rem;
}

.word-select-status {
    background: var(--bg-secondary);
    padding: 1rem;
    border-radius: var(--radius);
    margin-bottom: 1.5rem;
}

.word-select-status > p {
    margin-bottom: 0.5rem;
    color: var(--accent-primary);
}

.player-status-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.player-status-item {
    display: flex;
    justify-content: space-between;
    padding: 0.5rem;
    background: var(--bg-card);
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
}

.player-status-item.locked {
    color: var(--accent-primary);
}

.word-select-pool {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
    max-height: 300px;
    overflow-y: auto;
    padding: 1rem;
    background: var(--bg-secondary);
    border-radius: var(--radius);
}

.word-option {
    padding: 0.5rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all var(--transition);
    font-size: 0.9rem;
}

.word-option:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.word-option.selected {
    background: var(--accent-primary);
    color: var(--bg-primary);
    border-color: var(--accent-primary);
}

.word-select-controls {
    display: flex;
    gap: 1rem;
    margin-bottom: 1rem;
    align-items: center;
}

.selected-word-display {
    flex: 1;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    color: var(--accent-primary);
    padding: 0.75rem 1rem;
    font-family: 'Courier Prime', monospace;
    font-size: 1rem;
    border-radius: var(--radius-sm);
}

.word-locked-notice {
    text-align: center;
    padding: 1.5rem;
    background: rgba(0, 255, 65, 0.1);
    border: 1px solid var(--accent-primary);
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.word-locked-notice p:first-child {
    color: var(--accent-primary);
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
}

.word-locked-notice .waiting-text {
    color: var(--text-muted);
    animation: pulse 2s ease-in-out infinite;
}

.host-begin-controls {
    text-align: center;
    margin-top: 1rem;
}

/* Confetti */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 1000;
    overflow: hidden;
}

.confetti {
    position: absolute;
    top: -20px;
    font-family: 'Courier Prime', 'Courier New', monospace;
    font-size: 16px;
    animation: confetti-fall linear forwards;
}

@keyframes confetti-fall {
    0% {
        transform: translateY(0);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh);
        opacity: 0;
    }
}

/* Game Over Enhancements */
.gameover-card {
    text-align: center;
}

.trophy-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    animation: bounce 0.5s ease infinite alternate;
}

@keyframes bounce {
    from { transform: translateY(0); }
    to { transform: translateY(-10px); }
}

.gameover-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1.5rem;
}

/* Login Box */
.login-box, .logged-in-box {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 100;
}

.login-box input {
    background: var(--bg-primary);
    border: 1px solid var(--border);
    color: var(--accent-primary);
    font-family: 'Courier Prime', monospace;
    font-size: 0.85rem;
    padding: 0.5rem 1rem;
    width: 200px;
    transition: border-color var(--transition), box-shadow var(--transition);
}

.login-box input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 10px var(--accent-glow);
}

.login-box input::placeholder {
    color: var(--text-muted);
}

.logged-in-box {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 0.5rem 1rem;
}

.logged-in-box #logged-in-name {
    color: var(--accent-primary);
    font-size: 0.85rem;
    text-shadow: 0 0 10px var(--accent-glow);
}

.logged-in-box.hidden {
    display: none;
}

.btn-tiny {
    padding: 0.2rem 0.5rem;
    font-size: 1rem;
    line-height: 1;
    border: none;
}

