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

:root {
    --bg-dark: #0a0a0f;
    --bg-card: #12121a;
    --bg-card-hover: #1a1a25;
    --accent-orange: #ff6b35;
    --accent-pink: #ff1493;
    --accent-cyan: #00ffd5;
    --accent-yellow: #ffd700;
    --text-primary: #ffffff;
    --text-muted: #6b6b7b;
    --danger: #ff3333;
    --success: #33ff88;
}

body {
    font-family: 'JetBrains Mono', monospace;
    background: var(--bg-dark);
    color: var(--text-primary);
    min-height: 100vh;
    overflow-x: hidden;
}

/* Animated background */
.bg-pattern {
    position: fixed;
    inset: 0;
    background: 
        radial-gradient(circle at 20% 80%, rgba(255, 107, 53, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 20, 147, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(0, 255, 213, 0.03) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

.container {
    position: relative;
    z-index: 1;
    max-width: 1400px;
    margin: 0 auto;
    padding: 1.5rem;
}

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

h1 {
    font-family: 'Dela Gothic One', cursive;
    font-size: clamp(2rem, 5vw, 3.5rem);
    background: linear-gradient(135deg, var(--accent-orange), var(--accent-pink), var(--accent-cyan));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: -0.02em;
    margin-bottom: 0.25rem;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Screens */
.screen {
    display: none;
}

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

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

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 16px;
    padding: 1.5rem;
}

.card h2 {
    font-family: 'Dela Gothic One', cursive;
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--accent-cyan);
}

.card-desc {
    color: var(--text-muted);
    font-size: 0.85rem;
    margin-bottom: 1rem;
}

/* Inputs */
.text-input {
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 0.85rem 1rem;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    transition: all 0.2s;
    margin-bottom: 0.75rem;
}

.text-input:focus {
    outline: none;
    border-color: var(--accent-cyan);
    background: rgba(0, 255, 213, 0.05);
}

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

/* Buttons */
.btn-primary {
    width: 100%;
    padding: 1rem;
    font-family: 'Dela Gothic One', cursive;
    font-size: 1rem;
    background: linear-gradient(135deg, var(--accent-orange), var(--accent-pink));
    border: none;
    border-radius: 10px;
    color: white;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(255, 107, 53, 0.3);
}

.btn-secondary {
    width: 100%;
    padding: 1rem;
    font-family: 'Dela Gothic One', cursive;
    font-size: 1rem;
    background: transparent;
    border: 2px solid var(--accent-cyan);
    border-radius: 10px;
    color: var(--accent-cyan);
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.btn-secondary:hover {
    background: rgba(0, 255, 213, 0.1);
    transform: translateY(-2px);
}

/* Landing Screen */
.landing-content {
    max-width: 700px;
    margin: 0 auto;
}

.name-card {
    margin-bottom: 1.5rem;
}

.name-card .text-input {
    margin-bottom: 0;
    font-size: 1.1rem;
    text-align: center;
}

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

/* Lobby Screen */
.lobby-container {
    max-width: 900px;
    margin: 0 auto;
}

.lobby-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    padding: 1rem 1.5rem;
    background: var(--bg-card);
    border-radius: 12px;
    flex-wrap: wrap;
    gap: 1rem;
}

.room-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.room-code-label {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.room-code {
    font-family: 'Dela Gothic One', cursive;
    font-size: 1.5rem;
    color: var(--accent-cyan);
    letter-spacing: 0.1em;
}

.btn-copy {
    background: rgba(255,255,255,0.1);
    border: none;
    border-radius: 6px;
    padding: 0.5rem;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-copy:hover {
    background: rgba(255,255,255,0.2);
}

.btn-leave {
    background: rgba(255, 51, 51, 0.2);
    border: 1px solid rgba(255, 51, 51, 0.3);
    border-radius: 8px;
    padding: 0.6rem 1.2rem;
    color: var(--danger);
    font-family: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-leave:hover {
    background: rgba(255, 51, 51, 0.3);
}

.lobby-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
    .lobby-grid {
        grid-template-columns: 1fr;
    }
}

.players-card h2 span {
    color: var(--text-muted);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.9rem;
}

.lobby-players {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.lobby-player {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.75rem;
    background: rgba(255,255,255,0.03);
    border-radius: 8px;
}

.lobby-player.is-host {
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.2);
}

.lobby-player-avatar {
    width: 36px;
    height: 36px;
    border-radius: 8px;
}

.lobby-player-name {
    flex: 1;
    font-weight: 600;
}

.lobby-player-badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
    background: rgba(255, 215, 0, 0.2);
    color: var(--accent-yellow);
    border-radius: 4px;
}

.lobby-player-you {
    font-size: 0.75rem;
    color: var(--accent-cyan);
}

/* Settings */
.setting-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.setting-row:last-child {
    border-bottom: none;
}

.setting-label {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.setting-label span:first-child {
    font-weight: 700;
    font-size: 0.9rem;
}

.setting-label span:last-child {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.setting-input {
    width: 70px;
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    padding: 0.5rem;
    color: var(--text-primary);
    font-family: inherit;
    text-align: center;
}

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

.setting-input:disabled {
    opacity: 0.5;
}

.btn-start {
    width: 100%;
    padding: 1.25rem 2rem;
    font-family: 'Dela Gothic One', cursive;
    font-size: 1.2rem;
    background: linear-gradient(135deg, var(--accent-orange), var(--accent-pink));
    border: none;
    border-radius: 12px;
    color: white;
    cursor: pointer;
    transition: all 0.3s;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.btn-start:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 10px 40px rgba(255, 107, 53, 0.3);
}

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

.waiting-text {
    text-align: center;
    color: var(--text-muted);
    margin-top: 1rem;
    display: none;
}

/* Game Screen */
.game-area {
    display: grid;
    grid-template-columns: 220px 1fr 280px;
    gap: 1.5rem;
    min-height: 75vh;
}

@media (max-width: 1100px) {
    .game-area {
        grid-template-columns: 1fr;
    }
    
    .players-sidebar {
        display: flex;
        flex-wrap: wrap;
        gap: 0.75rem;
    }
    
    .player-card {
        flex: 1;
        min-width: 150px;
    }
}

/* Players sidebar */
.players-sidebar {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

/* Game sidebar (right) */
.game-sidebar {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.prediction-status {
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    min-height: 60px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.prediction-status.locked {
    background: rgba(255, 20, 147, 0.15);
    border-color: rgba(255, 20, 147, 0.3);
    color: var(--accent-pink);
}

.prediction-status .locked-word {
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.player-card {
    background: var(--bg-card);
    border: 2px solid transparent;
    border-radius: 12px;
    padding: 1rem;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}

.player-card.active {
    border-color: var(--accent-orange);
    box-shadow: 0 0 30px rgba(255, 107, 53, 0.2);
}

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

.player-card-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.5rem;
}

.player-avatar {
    width: 28px;
    height: 28px;
    border-radius: 6px;
}

.player-name {
    font-weight: 700;
    font-size: 0.9rem;
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-hearts {
    display: flex;
    gap: 0.2rem;
    flex-wrap: wrap;
}

.heart {
    font-size: 0.9rem;
    transition: all 0.3s;
}

.heart.lost {
    filter: grayscale(1);
    opacity: 0.3;
}

.player-status {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.4rem;
}

/* Center game area */
.game-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 1.5rem;
}

.active-player-display {
    font-size: 1.1rem;
    color: var(--text-muted);
}

.active-player-display span {
    color: var(--accent-orange);
    font-weight: 700;
}

/* Bomb */
.bomb-container {
    position: relative;
    width: 180px;
    height: 180px;
}

.bomb {
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at 30% 30%, #3a3a4a, #1a1a2a);
    border-radius: 50%;
    position: relative;
    box-shadow: 
        0 20px 60px rgba(0,0,0,0.5),
        inset 0 -10px 30px rgba(0,0,0,0.3),
        inset 0 10px 30px rgba(255,255,255,0.05);
}

.bomb::before {
    content: '';
    position: absolute;
    top: -18px;
    left: 50%;
    transform: translateX(-50%);
    width: 18px;
    height: 28px;
    background: linear-gradient(to bottom, #666, #333);
    border-radius: 4px 4px 0 0;
}

.fuse {
    position: absolute;
    top: -38px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: 22px;
    background: #8b4513;
}

.spark {
    position: absolute;
    top: -48px;
    left: 50%;
    transform: translateX(-50%);
    width: 18px;
    height: 18px;
    background: radial-gradient(circle, var(--accent-yellow), var(--accent-orange), transparent);
    border-radius: 50%;
    animation: sparkle 0.3s ease-in-out infinite;
    display: none;
}

.spark.active {
    display: block;
}

@keyframes sparkle {
    0%, 100% { transform: translateX(-50%) scale(1); opacity: 1; }
    50% { transform: translateX(-50%) scale(1.3); opacity: 0.8; }
}

.timer-display {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-family: 'Dela Gothic One', cursive;
    font-size: 2.8rem;
    color: var(--text-primary);
}

.timer-display.danger {
    color: var(--danger);
    animation: pulse 0.5s ease-in-out infinite;
}

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

/* Prompt display */
.prompt-display {
    text-align: center;
}

.prompt-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
}

.prompt-text {
    font-family: 'Dela Gothic One', cursive;
    font-size: clamp(2rem, 7vw, 3.5rem);
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-pink));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 0.1em;
}

.prompt-hidden {
    color: var(--text-muted);
    font-size: 1.2rem;
    font-style: italic;
}

/* Input area */
.input-area {
    width: 100%;
    max-width: 380px;
}

.word-input {
    width: 100%;
    background: rgba(255,255,255,0.05);
    border: 2px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 1rem 1.25rem;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 1.4rem;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    transition: all 0.2s;
}

.word-input:focus {
    outline: none;
    border-color: var(--accent-cyan);
    box-shadow: 0 0 30px rgba(0, 255, 213, 0.2);
}

.word-input:disabled {
    opacity: 0.5;
}

.word-input.error {
    border-color: var(--danger);
    animation: shake 0.3s ease;
}

.word-input.success {
    border-color: var(--success);
}

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

.input-hint {
    text-align: center;
    margin-top: 0.5rem;
    font-size: 0.8rem;
    color: var(--text-muted);
}

/* Phase indicators */
.phase-indicator {
    text-align: center;
    padding: 0.6rem 1.25rem;
    border-radius: 30px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-size: 0.8rem;
}

.phase-indicator.prediction {
    background: rgba(255, 20, 147, 0.2);
    color: var(--accent-pink);
    border: 1px solid rgba(255, 20, 147, 0.3);
}

.phase-indicator.typing {
    background: rgba(0, 255, 213, 0.2);
    color: var(--accent-cyan);
    border: 1px solid rgba(0, 255, 213, 0.3);
}

.phase-indicator.waiting {
    background: rgba(255,255,255,0.1);
    color: var(--text-muted);
    border: 1px solid rgba(255,255,255,0.1);
}

/* Chat / Game Log */
.chat-card {
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 12px;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    height: 280px;
}

.chat-card h3 {
    font-family: 'Dela Gothic One', cursive;
    font-size: 0.9rem;
    color: var(--accent-cyan);
    margin-bottom: 0.6rem;
    flex-shrink: 0;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.chat-message {
    font-size: 0.8rem;
    padding: 0.3rem 0;
}

.chat-message .author {
    font-weight: 700;
    color: var(--accent-cyan);
}

.chat-message.system {
    color: var(--text-muted);
    font-style: italic;
}

.chat-message.success {
    color: var(--success);
}

.chat-message.fail {
    color: var(--danger);
}

.chat-message.prediction-match {
    color: var(--accent-pink);
    font-weight: 600;
}

/* Game Over */
.game-over {
    text-align: center;
    padding: 3rem;
}

.trophy {
    font-size: 5rem;
    margin-bottom: 1rem;
}

.game-over h2 {
    font-size: 1.5rem;
    color: var(--text-muted);
    margin-bottom: 0.5rem;
}

.winner-name {
    font-family: 'Dela Gothic One', cursive;
    font-size: 2.5rem;
    background: linear-gradient(135deg, var(--accent-yellow), var(--accent-orange));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 1.5rem;
}

.final-stats {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.btn-restart {
    padding: 1rem 3rem;
    background: linear-gradient(135deg, var(--accent-orange), var(--accent-pink));
    border: none;
    border-radius: 12px;
    color: white;
    font-family: 'Dela Gothic One', cursive;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-restart:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 40px rgba(255, 107, 53, 0.3);
}

/* Toast notifications */
.toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 12px;
    padding: 1rem 1.5rem;
    z-index: 200;
    opacity: 0;
    transition: all 0.3s ease;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.toast.success {
    border-color: var(--success);
}

.toast.error {
    border-color: var(--danger);
}

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

::-webkit-scrollbar-track {
    background: rgba(255,255,255,0.05);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.2);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255,255,255,0.3);
}
