/* === SPAWKA — Viral Multiplayer Word Game === */
:root {
    --lk-bg: #0a0e1a;
    --lk-surface: #131829;
    --lk-card: #1a2035;
    --lk-border: rgba(255,255,255,0.06);
    --lk-text: #e8eaf0;
    --lk-muted: #6b7394;
    --lk-accent: #6C5CE7;
    --lk-accent2: #a29bfe;
    --lk-green: #00b894;
    --lk-gold: #ffd32a;
    --lk-red: #ff6b6b;
    --lk-orange: #e17055;
    --lk-cyan: #00cec9;
    --lk-pink: #e84393;
    --lk-glow: 0 0 20px rgba(108,92,231,0.3);
    --lk-radius: 16px;
    --lk-radius-sm: 10px;
}
.spawka-page .main-content { padding: 0 !important; }
.spawka-container { min-height: 100vh; background: var(--lk-bg); font-family: 'Inter', sans-serif; color: var(--lk-text); position: relative; overflow-x: hidden; }

/* === JOIN SCREEN === */
.spawka-join { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; background: radial-gradient(ellipse at 30% 20%, rgba(108,92,231,0.15) 0%, transparent 60%), radial-gradient(ellipse at 70% 80%, rgba(0,206,201,0.1) 0%, transparent 60%), var(--lk-bg); }
.join-card { background: var(--lk-card); border: 1px solid var(--lk-border); border-radius: var(--lk-radius); padding: 40px 32px; max-width: 480px; width: 100%; text-align: center; box-shadow: var(--lk-glow); }

.join-logo { display: flex; justify-content: center; gap: 4px; margin-bottom: 12px; }
.logo-letter { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 52px; background: linear-gradient(135deg, var(--lk-accent), var(--lk-accent2)); color: #fff; font-weight: 900; font-size: 24px; border-radius: 8px; animation: logoFloat 2s ease-in-out infinite; animation-delay: calc(var(--d) * 0.12s); box-shadow: 0 4px 15px rgba(108,92,231,0.4); }
@keyframes logoFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-6px); } }

.join-subtitle { color: var(--lk-muted); font-size: 14px; margin-bottom: 24px; line-height: 1.5; }

.join-tiers-preview { display: flex; align-items: center; justify-content: center; gap: 4px; margin-bottom: 28px; flex-wrap: wrap; }
.tier-dot { width: 32px; height: 32px; border-radius: 50%; background: var(--lk-surface); border: 2px solid var(--lk-accent); color: var(--lk-accent2); font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.tier-arrow { width: 16px; height: 10px; color: var(--lk-muted); }

.join-input { width: 100%; padding: 14px 18px; background: var(--lk-surface); border: 1px solid var(--lk-border); border-radius: var(--lk-radius-sm); color: var(--lk-text); font-size: 15px; font-family: inherit; outline: none; transition: border-color 0.2s, box-shadow 0.2s; margin-bottom: 16px; box-sizing: border-box; }
.join-input:focus { border-color: var(--lk-accent); box-shadow: 0 0 0 3px rgba(108,92,231,0.15); }
.join-input.small { padding: 10px 14px; font-size: 13px; margin-bottom: 10px; }

.room-tabs { display: flex; gap: 4px; background: var(--lk-surface); border-radius: var(--lk-radius-sm); padding: 4px; margin-bottom: 20px; }
.room-tab { flex: 1; padding: 10px; border: none; background: transparent; color: var(--lk-muted); font-size: 13px; font-weight: 600; border-radius: 8px; cursor: pointer; transition: all 0.2s; font-family: inherit; }
.room-tab.active { background: var(--lk-accent); color: #fff; }
.room-tab:hover:not(.active) { color: var(--lk-text); }

.btn-join-main { width: 100%; padding: 16px; background: linear-gradient(135deg, var(--lk-accent), #8b5cf6); border: none; border-radius: var(--lk-radius-sm); color: #fff; font-size: 16px; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 10px; transition: transform 0.15s, box-shadow 0.2s; font-family: inherit; box-shadow: 0 4px 20px rgba(108,92,231,0.4); }
.btn-join-main:hover { transform: translateY(-2px); box-shadow: 0 6px 25px rgba(108,92,231,0.5); }
.btn-join-main:active { transform: scale(0.98); }
.btn-join-alt { width: 100%; padding: 12px; background: var(--lk-surface); border: 1px solid var(--lk-border); border-radius: 8px; color: var(--lk-text); font-size: 13px; font-weight: 600; cursor: pointer; transition: all 0.2s; font-family: inherit; margin-top: 6px; }
.btn-join-alt:hover { border-color: var(--lk-accent); color: var(--lk-accent2); }

.private-split { display: flex; gap: 16px; }
.private-section { flex: 1; }
.private-label { font-size: 12px; font-weight: 600; color: var(--lk-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 10px; }
.private-divider { display: flex; align-items: center; padding: 0 8px; color: var(--lk-muted); font-size: 12px; }

/* === GAME SCREEN === */
.spawka-game { min-height: 100vh; display: flex; flex-direction: column; background: var(--lk-bg); position: relative; }

.game-topbar { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; background: var(--lk-surface); border-bottom: 1px solid var(--lk-border); }
.topbar-left { display: flex; align-items: center; gap: 12px; }
.topbar-round { font-weight: 700; font-size: 15px; color: var(--lk-accent2); }
.topbar-room-code { background: var(--lk-accent); color: #fff; padding: 4px 10px; border-radius: 6px; font-size: 12px; font-weight: 700; letter-spacing: 1px; cursor: pointer; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar-players { display: flex; align-items: center; gap: 6px; color: var(--lk-muted); font-size: 14px; font-weight: 600; cursor: pointer; padding: 6px 10px; border-radius: 8px; transition: background 0.2s; }
.topbar-players:hover { background: rgba(255,255,255,0.05); }

.tier-progress { display: flex; justify-content: center; gap: 6px; padding: 16px 20px 8px; }
.tier-step { width: 36px; height: 36px; border-radius: 50%; background: var(--lk-surface); border: 2px solid var(--lk-border); color: var(--lk-muted); font-weight: 700; font-size: 14px; display: flex; align-items: center; justify-content: center; transition: all 0.4s cubic-bezier(0.175,0.885,0.32,1.275); }
.tier-step.done { background: var(--lk-green); border-color: var(--lk-green); color: #fff; transform: scale(0.9); }
.tier-step.active { background: linear-gradient(135deg, var(--lk-accent), #8b5cf6); border-color: var(--lk-accent); color: #fff; transform: scale(1.15); box-shadow: 0 0 20px rgba(108,92,231,0.5); animation: tierPulse 1.5s ease-in-out infinite; }
.tier-step.upcoming { opacity: 0.4; }
@keyframes tierPulse { 0%,100% { box-shadow: 0 0 15px rgba(108,92,231,0.4); } 50% { box-shadow: 0 0 30px rgba(108,92,231,0.7); } }

/* Prompt Board */
.prompt-board { display: flex; justify-content: center; padding: 24px 16px 16px; }
.prompt-text { font-size: 3.5rem; font-weight: 800; letter-spacing: 4px; color: #fff; text-transform: uppercase; text-shadow: 0 0 15px rgba(108, 92, 231, 0.4); transition: font-size 0.2s, letter-spacing 0.2s; }
.prompt-text.long-prompt { letter-spacing: 2px; }
.prompt-text.eight-letters { letter-spacing: 0px; font-size: 3rem; }
.prompt-text.new { animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); }
@keyframes popIn { 0% { transform: scale(0.5); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }

.timer-wrap { padding: 8px 20px; display: flex; align-items: center; gap: 12px; }
.timer-bar { flex: 1; height: 6px; background: var(--lk-surface); border-radius: 3px; overflow: hidden; }
.timer-fill { height: 100%; background: linear-gradient(90deg, var(--lk-green), var(--lk-accent)); border-radius: 3px; transition: width 0.3s linear; }
.timer-fill.danger { background: linear-gradient(90deg, var(--lk-red), var(--lk-orange)); }
.timer-text { font-size: 20px; font-weight: 800; color: var(--lk-accent2); min-width: 32px; text-align: center; font-variant-numeric: tabular-nums; }
.timer-text.danger { color: var(--lk-red); animation: timerShake 0.3s ease-in-out infinite; }
@keyframes timerShake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-2px); } 75% { transform: translateX(2px); } }

/* Word Input Area */
.word-input-area { padding: 12px 20px; display: flex; flex-direction: column; align-items: center; gap: 16px; width: 100%; box-sizing: border-box; }
.input-wrapper { width: 100%; max-width: 400px; display: flex; justify-content: center; }
.spawka-input { width: 100%; background: rgba(255,255,255,0.05); border: 2px solid rgba(255,255,255,0.15); border-radius: 16px; padding: 18px 20px; font-size: 1.6rem; color: #fff; text-align: center; text-transform: uppercase; outline: none; transition: all 0.25s; font-family: inherit; font-weight: 800; letter-spacing: 2px; box-shadow: inset 0 2px 10px rgba(0,0,0,0.2); box-sizing: border-box; }
.spawka-input::placeholder { color: rgba(255,255,255,0.2); font-weight: 600; letter-spacing: 1px; font-size: 1.2rem; }
.spawka-input:focus { background: rgba(255,255,255,0.08); border-color: var(--lk-accent); box-shadow: 0 0 0 4px rgba(108, 92, 231, 0.25), inset 0 2px 10px rgba(0,0,0,0.1); transform: translateY(-2px); }
.word-actions { display: flex; justify-content: center; width: 100%; max-width: 400px; }
.btn-submit { background: linear-gradient(135deg, var(--lk-green), #00a381); color: #fff; width: 100%; height: 56px; font-size: 20px; font-weight: 800; border: none; border-radius: 16px; cursor: pointer; box-shadow: 0 6px 20px rgba(0,184,148,0.3); transition: all 0.2s; letter-spacing: 2px; text-transform: uppercase; }
.btn-submit:hover { transform: translateY(-3px); box-shadow: 0 8px 25px rgba(0,184,148,0.4); }
.btn-submit:active { transform: translateY(1px); box-shadow: 0 2px 10px rgba(0,184,148,0.3); }
.word-feedback { font-size: 13px; margin-top: 4px; min-height: 20px; font-weight: 600; }
.word-feedback.success { color: var(--lk-green); }
.word-feedback.error { color: var(--lk-red); }

/* === LIVE SCOREBOARD === */
.live-scoreboard { margin: 8px 20px; background: var(--lk-card); border: 1px solid var(--lk-border); border-radius: var(--lk-radius-sm); overflow: hidden; }
.scoreboard-header { display: flex; align-items: center; gap: 6px; padding: 10px 14px; font-size: 11px; font-weight: 700; color: var(--lk-gold); text-transform: uppercase; letter-spacing: 1px; background: rgba(255,211,42,0.05); border-bottom: 1px solid var(--lk-border); }
.scoreboard-list { max-height: 240px; overflow-y: auto; }
.sb-row { display: flex; align-items: center; padding: 8px 14px; border-bottom: 1px solid var(--lk-border); transition: background 0.2s; gap: 10px; }
.sb-row:last-child { border-bottom: none; }
.sb-row.is-you { background: rgba(108,92,231,0.08); }
.sb-rank { width: 24px; font-size: 13px; font-weight: 800; color: var(--lk-muted); text-align: center; }
.sb-rank.gold { color: var(--lk-gold); font-size: 16px; }
.sb-rank.silver { color: #c0c0c0; }
.sb-rank.bronze { color: #cd7f32; }
.sb-avatar { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 12px; color: #fff; flex-shrink: 0; }
.sb-name { flex: 1; font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-score { font-size: 14px; font-weight: 800; color: var(--lk-accent2); font-variant-numeric: tabular-nums; }

.my-answers { margin: 8px 20px; }
.my-answers-header { font-size: 11px; font-weight: 700; color: var(--lk-muted); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6px; }
.my-answers-list { display: flex; gap: 6px; flex-wrap: wrap; }
.my-answer-chip { background: var(--lk-card); border: 1px solid var(--lk-border); border-radius: 8px; padding: 4px 10px; font-size: 12px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.my-answer-chip .chip-tier { color: var(--lk-accent2); font-size: 10px; }
.my-answer-chip .chip-word { color: var(--lk-text); }
.my-answer-chip .chip-score { color: var(--lk-green); font-size: 10px; }

/* === OVERLAYS === */
.game-overlay { position: absolute; inset: 0; background: rgba(10,14,26,0.92); backdrop-filter: blur(8px); display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 20; text-align: center; padding: 20px; }
.game-overlay h3 { font-size: 22px; margin-bottom: 16px; }
.overlay-pulse { width: 60px; height: 60px; border-radius: 50%; background: var(--lk-accent); margin-bottom: 20px; animation: pulse 2s ease-in-out infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); opacity: 0.6; } 50% { transform: scale(1.3); opacity: 0.2; } }

.results-overlay { gap: 12px; overflow-y: auto; }
.results-crown { font-size: 48px; animation: crownBounce 0.6s cubic-bezier(0.175,0.885,0.32,1.275); }
@keyframes crownBounce { 0% { transform: scale(0) rotate(-20deg); } 100% { transform: scale(1) rotate(0); } }
.results-title { font-size: 20px; color: var(--lk-gold); margin: 0; }
.results-winner { font-size: 16px; font-weight: 700; padding: 10px 20px; background: linear-gradient(135deg, rgba(255,211,42,0.15), rgba(108,92,231,0.1)); border: 1px solid rgba(255,211,42,0.2); border-radius: var(--lk-radius-sm); }
.results-winner .winner-name { color: var(--lk-gold); }
.results-winner .winner-score { color: var(--lk-accent2); }
.results-table { width: 100%; max-width: 400px; }
.rt-row { display: flex; align-items: center; padding: 6px 12px; border-radius: 6px; margin-bottom: 2px; gap: 8px; font-size: 13px; }
.rt-row.is-you { background: rgba(108,92,231,0.1); }
.rt-tier { background: var(--lk-surface); border-radius: 4px; padding: 2px 6px; font-size: 10px; font-weight: 700; color: var(--lk-accent2); min-width: 20px; text-align: center; }
.rt-word { flex: 1; font-weight: 700; }
.rt-player { color: var(--lk-muted); font-size: 11px; max-width: 80px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rt-score { font-weight: 800; color: var(--lk-green); }
.results-scoreboard { width: 100%; max-width: 400px; background: var(--lk-card); border-radius: var(--lk-radius-sm); border: 1px solid var(--lk-border); overflow: hidden; }
.results-countdown { color: var(--lk-muted); font-size: 14px; margin-top: 8px; }

.spawka-toast { position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%) translateY(150px); opacity: 0; visibility: hidden; background: var(--lk-card); border: 1px solid var(--lk-border); border-radius: var(--lk-radius-sm); padding: 12px 24px; font-size: 14px; font-weight: 600; z-index: 100; box-shadow: 0 8px 30px rgba(0,0,0,0.4); transition: transform 0.3s cubic-bezier(0.175,0.885,0.32,1.275), opacity 0.2s, visibility 0.2s; pointer-events: none; }
.spawka-toast.show { transform: translateX(-50%) translateY(0); opacity: 1; visibility: visible; }

.share-modal { position: fixed; inset: 0; background: rgba(10,14,26,0.8); backdrop-filter: blur(4px); z-index: 50; display: flex; align-items: center; justify-content: center; }
.share-card { background: var(--lk-card); border: 1px solid var(--lk-border); border-radius: var(--lk-radius); padding: 32px; max-width: 360px; width: 90%; text-align: center; position: relative; }
.share-close { position: absolute; top: 12px; right: 16px; background: none; border: none; color: var(--lk-muted); font-size: 24px; cursor: pointer; }
.share-code { font-size: 32px; font-weight: 900; letter-spacing: 4px; color: var(--lk-accent2); margin: 16px 0; padding: 16px; background: var(--lk-surface); border-radius: var(--lk-radius-sm); }

/* === MOBILE === */
@media (max-width: 600px) {
    .join-card { padding: 28px 20px; }
    .logo-letter { width: 36px; height: 44px; font-size: 20px; }
    .tier-step { width: 30px; height: 30px; font-size: 12px; }
    .private-split { flex-direction: column; }
    .private-divider { justify-content: center; padding: 8px 0; }
    .sb-row { padding: 6px 10px; }
    .prompt-text { font-size: 2.8rem; letter-spacing: 2px; }
    .prompt-text.long-prompt { letter-spacing: 1px; font-size: 2.3rem; }
    .prompt-text.eight-letters { letter-spacing: -1px; font-size: 2rem; }
    .spawka-input { font-size: 1.3rem; padding: 14px 16px; border-radius: 12px; }
    .btn-submit { height: 50px; font-size: 18px; }
    .join-tiers-preview { gap: 2px; flex-wrap: nowrap; justify-content: center; }
    .tier-dot { width: 24px; height: 24px; font-size: 11px; border-width: 1.5px; }
    .tier-arrow { width: 10px; height: 8px; }
}

/* === VIRTUAL KEYBOARD === */
.spawka-keyboard {
    display: none;
    flex-direction: column;
    gap: 6px;
    padding: 10px 8px;
    background: #131829;
    border-top: 2px solid rgba(255, 255, 255, 0.05);
    width: 100%;
    box-sizing: border-box;
    position: fixed;
    bottom: 0;
    left: 0;
    z-index: 10;
    box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.4);
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 5px;
    width: 100%;
}

.spawka-keyboard .key {
    flex: 1;
    height: 48px;
    border-radius: 8px;
    background: #1c233a;
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: #fff;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    user-select: none;
    touch-action: manipulation;
    transition: background 0.1s, transform 0.05s;
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}

.spawka-keyboard .key:active {
    background: var(--lk-accent);
    transform: scale(0.95);
}

.spawka-keyboard .key.btn-action {
    background: #2b3352;
    font-size: 14px;
    flex: 1.5;
}

.spawka-keyboard .key.btn-action[data-key="ENTER"] {
    background: var(--lk-green);
    color: #fff;
}

.keyboard-row.pl-diacritics .key {
    background: #151b2e;
    border-color: rgba(108, 92, 231, 0.15);
    color: var(--lk-accent2);
}

.use-virtual-keyboard .spawka-keyboard {
    display: flex;
}
.use-virtual-keyboard .spawka-game {
    padding-bottom: 230px;
}
.use-virtual-keyboard .word-actions {
    display: none;
}

@media (max-width: 768px) {
    .spawka-keyboard {
        display: flex;
    }
    .spawka-game {
        padding-bottom: 230px;
    }
    /* Hide the web submit button on mobile since we have OK/ENTER on the keyboard */
    .word-actions {
        display: none;
    }
}

