@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@500;600;700&family=Nunito:wght@400;600;800;900&family=VT323&display=swap');

:root {
    --bg-dark: #1b1130; 
    --bg-surface: #2b1b4d;
    --bg-surface-elevated: #3d2671;
    
    --text-main: #ffffff;
    --text-muted: #a5b4fc;
    --text-dark: #1e1b4b;

    --accent-yellow: #ffeaa7;
    --accent-pink: #fd79a8;
    --accent-cyan: #00cec9;

    --tile-purple: #6c5ce7;
    --tile-purple-shadow: #4834d4;
    --tile-coral: #ff7675;
    --tile-coral-shadow: #d63031;
    --tile-green: #55efc4;
    --tile-green-shadow: #00b894;

    --border-radius-lg: 24px;
    --border-radius-md: 16px;
    --border-radius-sm: 8px;
    
    /* Windows 95 Retro Style Borders */
    --win-border-light: #ffffff;
    --win-border-dark: #000000;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: 'Nunito', sans-serif;
    background-color: var(--bg-dark);
    background-image: 
        linear-gradient(45deg, #1b1130 25%, #2b1b4d 25%, #2b1b4d 50%, #1b1130 50%, #1b1130 75%, #2b1b4d 75%, #2b1b4d 100%);
    background-size: 40px 40px;
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

h1, h2, h3, h4, .game-logo, .btn-tile, .code-letters, .card-eyebrow, .modal-title {
    font-family: 'Fredoka', cursive;
    letter-spacing: 0.5px;
}

.retro-font {
    font-family: 'VT323', monospace !important;
}

.hidden { display: none !important; }

.screen {
    display: none;
    width: 100%;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.screen.active {
    display: flex;
    flex-direction: column;
    align-items: center;
}

@keyframes popIn {
    0% { transform: scale(0.95); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

/* RETRO WINDOW / CARDS */
.card-tile {
    background: var(--bg-surface);
    border-radius: var(--border-radius-md);
    border: 4px solid var(--win-border-light);
    box-shadow: 8px 8px 0px rgba(0,0,0,0.7);
    padding: 24px;
    transition: all 0.2s ease;
}

.window-header {
    background: linear-gradient(90deg, #000080, #1084d0);
    color: white;
    padding: 6px 12px;
    font-family: 'VT323', monospace;
    font-size: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 3px solid white;
    margin: -24px -24px 20px -24px;
    border-top-left-radius: 12px;
    border-top-right-radius: 12px;
}

.window-close {
    background: #c0c0c0;
    color: black;
    border: 2px solid white;
    border-bottom-color: #444;
    border-right-color: #444;
    font-size: 1rem;
    padding: 0 6px;
    cursor: default;
}

.tile-primary { background: linear-gradient(135deg, #4834d4 0%, #6c5ce7 100%); }
.tile-surface { background: #c0c0c0; color: black; border-color: white; border-bottom-color: #444; border-right-color: #444; }
.tile-purple { background: var(--tile-purple); box-shadow: 0 8px 0 var(--tile-purple-shadow); color: white; border-color: rgba(255,255,255,0.3); }
.tile-coral { background: var(--tile-coral); box-shadow: 0 8px 0 var(--tile-coral-shadow); color: white; border-color: rgba(255,255,255,0.3); }

/* BUTTONS */
.btn-tile {
    border: 3px solid white;
    border-radius: var(--border-radius-sm);
    padding: 14px 20px;
    font-size: 1.25rem;
    cursor: pointer;
    text-align: center;
    transition: transform 0.1s ease, box-shadow 0.1s ease, filter 0.2s ease;
    user-select: none;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    font-family: 'Fredoka', cursive;
    font-weight: 700;
}

.btn-tile:hover:not(:disabled) { filter: brightness(1.1); }
.btn-tile:active:not(:disabled) {
    transform: translateY(6px);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.5) !important;
}
.btn-tile:disabled { opacity: 0.5; cursor: not-allowed; filter: grayscale(0.8); transform: none !important; }
.btn-full { width: 100%; }

.btn-primary {
    background: var(--accent-pink);
    box-shadow: 4px 4px 0 #000;
    color: white;
    font-family: 'Fredoka', cursive;
    font-size: 1.4rem;
    border-radius: 0;
    padding: 14px 30px;
    border: 3px solid #000;
    cursor: pointer;
}
.btn-primary:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 #000; }

.error-text { color: #ff0000; font-weight: bold; background: black; padding: 4px; display: inline-block; }

/* HOST STYLES */
.host-body { padding: 20px 40px; max-width: 1400px; margin: 0 auto; width: 100%; align-items: center; }
.host-header {
    width: 100%; display: flex; align-items: center; justify-content: space-between;
    background: #c0c0c0; border: 4px solid white; border-bottom-color: #444; border-right-color: #444;
    padding: 10px 20px; margin-bottom: 24px; color: black;
}
.header-room { display: flex; align-items: center; gap: 12px; }
.header-room .label { font-family: 'VT323', monospace; font-size: 1.8rem; font-weight: bold; }
.code-badge {
    background: var(--accent-yellow); color: black;
    font-family: 'Fredoka', cursive; font-size: 1.8rem; font-weight: 900;
    padding: 4px 16px; border: 2px solid black; box-shadow: 2px 2px 0 black;
}
.header-round-info { font-family: 'VT323', monospace; font-size: 1.8rem; font-weight: bold; }
.header-timer { display: flex; align-items: center; gap: 16px; flex: 1; max-width: 400px; margin: 0 20px; }
.timer-circle {
    background: black; border: 3px solid #444; color: #00ff00;
    font-family: 'VT323', monospace; font-size: 1.8rem; width: 50px; height: 50px; border-radius: 0;
    display: flex; align-items: center; justify-content: center;
}
.timer-circle.urgent { color: red; animation: blinkAlert 0.5s infinite; }
@keyframes blinkAlert { 0% { opacity: 1; } 50% { opacity: 0; } }

.timer-bar-wrap { flex: 1; height: 20px; background: black; border: 2px solid #888; border-right-color: white; border-bottom-color: white; padding: 2px; }
.timer-bar { height: 100%; width: 100%; background: #000080; transition: width 1s linear; }

.lobby-banner { text-align: center; margin: 20px 0 40px 0; }
.game-logo {
    font-size: 5rem;
    color: var(--accent-cyan);
    text-shadow: 4px 4px 0 #000, -2px -2px 0 var(--accent-pink); 
    margin-bottom: 8px;
    text-transform: uppercase;
}
.tagline { font-family: 'VT323', monospace; font-size: 2rem; color: var(--accent-yellow); background: black; padding: 4px 12px; display: inline-block; }

.lobby-center-grid { display: grid; grid-template-columns: 1fr 1.3fr; gap: 36px; width: 100%; max-width: 1100px; }
.join-instructions-tile { display: flex; flex-direction: column; align-items: center; text-align: center; position: relative; background: var(--bg-surface-elevated); color: white; border-color: var(--accent-pink); }
.join-lead { font-size: 1.25rem; font-weight: 700; margin-bottom: 6px; }
.join-url-display { font-size: 1.6rem; font-weight: 900; color: var(--accent-yellow); text-decoration: none; }
.qr-wrapper { background: white; padding: 16px; border: 4px solid black; margin: 24px 0; box-shadow: 4px 4px 0 black; display: inline-block; }
.code-letters { display: flex; gap: 12px; justify-content: center; }
.code-letters .letter {
    background: white; border: 3px solid black; color: black;
    font-size: 3.5rem; width: 70px; height: 85px; display: flex; align-items: center; justify-content: center;
    box-shadow: 4px 4px 0 var(--accent-pink);
}

.players-overview-tile { display: flex; flex-direction: column; justify-content: space-between; }
.players-title-bar { display: flex; justify-content: space-between; align-items: center; border-bottom: 2px solid #888; padding-bottom: 12px; margin-bottom: 20px; }
.hint-min { font-size: 0.95rem; font-style: italic; }

.players-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; min-height: 180px; align-content: start; margin-bottom: 24px; }
.empty-lobby-hint { grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; color: #444; font-size: 1.2rem; min-height: 150px; font-family: 'VT323', monospace; font-size: 1.8rem; }
.player-card {
    background: white; border: 3px solid black; box-shadow: 3px 3px 0 black;
    padding: 10px; display: flex; align-items: center; gap: 12px; cursor: pointer; user-select: none;
    color: black;
}
.player-card:hover { background: var(--accent-yellow); transform: translate(-2px, -2px); box-shadow: 5px 5px 0 black; }
.player-avatar { font-size: 2rem; }
.player-info { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.player-name { font-weight: 900; font-size: 1.15rem; word-break: break-word; white-space: normal; line-height: 1.2; }
.player-score { font-size: 1rem; color: #666; font-weight: 800; font-family: 'VT323', monospace; }

.lobby-settings {
    margin-bottom: 20px; background: rgba(255,255,255,0.5); padding: 16px; border: 2px solid black;
    display: flex; align-items: center; justify-content: space-between;
}
.lobby-settings label { font-family: 'VT323', monospace; font-size: 1.5rem; font-weight: bold; }
.select-rounds { padding: 6px; font-size: 1.2rem; font-family: 'VT323', monospace; border: 2px solid black; }

.host-controls { display: grid; grid-template-columns: 1fr; gap: 20px; }

/* MODALS */
.modal-backdrop {
    position: fixed; inset: 0; background: rgba(0,0,0,0.8);
    display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.modal-box {
    background: #c0c0c0; border: 4px solid white; border-bottom-color: #444; border-right-color: #444;
    color: black; max-width: 440px; width: 90%; padding: 24px; box-shadow: 10px 10px 0 black;
}

/* GAME PHASES */
.game-phase-badge {
    background: black; color: #00ff00; font-family: 'VT323', monospace; font-size: 1.8rem;
    padding: 6px 20px; border: 2px solid #00ff00; margin-bottom: 20px; text-transform: uppercase;
}

.prompt-banner { width: 100%; max-width: 900px; text-align: center; margin-bottom: 30px; background: white; color: black; border: 4px solid black; box-shadow: 8px 8px 0 var(--accent-pink); }
.prompt-text { font-size: 2.2rem; line-height: 1.3; font-weight: 900; }
.prompt-text.compact { font-size: 1.8rem; margin-bottom: 24px; }

.waiting-card { background: transparent; text-align: center; }
.pulse-icon { font-size: 5rem; margin-bottom: 12px; }
.submission-tracker { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; margin-top: 24px; }
.tracker-item {
    background: white; border: 2px solid black; padding: 8px 16px; box-shadow: 2px 2px 0 black;
    font-weight: 800; color: black; transition: all 0.2s;
}
.tracker-item.ready { background: var(--accent-yellow); }

/* PRESENTATION FEED (PHASE 3) */
.feed-container {
    width: 100%; max-width: 800px; display: flex; flex-direction: column; gap: 20px;
}
.social-post {
    background: white; border: 4px solid black; box-shadow: 8px 8px 0 rgba(0,0,0,0.8);
    border-radius: 8px; overflow: hidden; color: black;
}
.post-header {
    background: #f0f2f5; padding: 12px 16px; border-bottom: 2px solid #ddd;
    display: flex; align-items: center; gap: 12px;
}
.post-avatar { font-size: 2.5rem; }
.post-author { font-size: 1.3rem; font-weight: 900; }
.post-context { font-size: 1rem; color: #666; font-style: italic; }
.post-headline {
    padding: 24px; font-size: 2.4rem; font-weight: 900; line-height: 1.2;
    text-align: center; background: var(--accent-yellow); border-bottom: 2px dashed black;
}
.post-quote {
    padding: 24px; display: flex; gap: 16px; align-items: flex-start;
    background: #fafafa;
}
.quote-mark { font-size: 3rem; color: var(--accent-pink); font-family: Georgia, serif; line-height: 1; }
.quote-text { font-size: 1.8rem; font-weight: 700; color: #333; font-style: italic; }
.quote-victim { margin-top: 10px; font-size: 1.1rem; color: #888; font-weight: bold; }

/* VOTING RESULT */
.results-grid {
    display: grid; grid-template-columns: 1fr; gap: 24px; width: 100%; max-width: 900px; margin-top: 20px;
}
.result-card {
    background: white; border: 4px solid black; box-shadow: 6px 6px 0 black;
    padding: 16px; display: flex; align-items: center; justify-content: space-between;
    color: black;
}
.result-card.winner { background: var(--accent-yellow); border-color: var(--accent-pink); box-shadow: 8px 8px 0 var(--accent-pink); transform: scale(1.02); }
.result-details { display: flex; flex-direction: column; flex: 1; padding-right: 20px; }
.res-headline { font-size: 1.6rem; font-weight: 900; margin-bottom: 4px; }
.res-authors { font-size: 1rem; color: #555; }
.res-votes {
    font-size: 2.5rem; font-weight: 900; color: var(--accent-pink);
    display: flex; align-items: center; gap: 8px;
}

/* SCOREBOARD */
.podium-container { width: 100%; max-width: 750px; margin: 24px 0; display: flex; flex-direction: column; gap: 16px; }
.podium-row {
    background: white; border: 4px solid black; padding: 16px 24px;
    box-shadow: 6px 6px 0 black; display: flex; align-items: center; justify-content: space-between;
    color: black;
}
.podium-row.first-place { background: var(--accent-yellow); border-color: var(--accent-pink); box-shadow: 8px 8px 0 var(--accent-pink); transform: scale(1.05); z-index: 2; }
.podium-rank { font-size: 2.2rem; font-weight: 900; width: 70px; }
.podium-name { font-size: 1.8rem; font-weight: 800; flex: 1; text-align: left; }
.podium-score { font-family: 'VT323', monospace; font-size: 2.5rem; color: var(--accent-pink); font-weight: bold; }

/* ==========================================================================
   PLAYER MOBILE STYLES
   ========================================================================== */
.player-body { padding: 0; background: var(--bg-dark); }
.player-header {
    width: 100%; background: #c0c0c0; border-bottom: 3px solid black; color: black;
    padding: 10px 16px; display: flex; align-items: center; justify-content: space-between; position: sticky; top: 0; z-index: 100;
}
.player-badge { display: flex; align-items: center; gap: 8px; }
.player-avatar-mini { font-size: 1.6rem; }
.player-name-mini { font-weight: 900; font-size: 1.2rem; }
.header-room-mini { font-family: 'VT323', monospace; font-size: 1.2rem; font-weight: bold; }
.player-score-badge { background: black; color: #00ff00; font-family: 'VT323', monospace; font-size: 1.4rem; padding: 2px 12px; border: 2px solid #444; }

.player-toast {
    position: fixed; top: 70px; left: 50%; transform: translateX(-50%) translateY(-20px);
    background: var(--accent-pink); color: white; font-weight: 900; font-size: 1.15rem;
    padding: 12px 24px; border: 3px solid black; box-shadow: 4px 4px 0 black;
    z-index: 1000; opacity: 0; transition: all 0.3s ease; pointer-events: none; text-align: center; width: 90%;
}
.player-toast.visible { opacity: 1; transform: translateX(-50%) translateY(0); }

.player-main { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; width: 100%; max-width: 500px; margin: 0 auto; }
.join-box { width: 100%; text-align: center; padding: 24px 16px; }
.player-title { font-size: 3rem; color: var(--accent-cyan); text-shadow: 3px 3px 0 black; margin-bottom: 20px; line-height: 1; }

.input-group { text-align: left; margin-bottom: 20px; }
.input-group label { display: block; font-size: 1rem; font-weight: 900; color: black; margin-bottom: 8px; }
.input-chunky {
    width: 100%; background: white; border: 4px solid black; color: black; padding: 16px;
    font-size: 1.4rem; font-family: 'Nunito', sans-serif; font-weight: 900; text-align: center;
    box-shadow: inset 4px 4px 0 rgba(0,0,0,0.1); outline: none;
}
.input-chunky:focus { background: var(--accent-yellow); }
.input-textarea {
    width: 100%; background: white; border: 4px solid black; color: black; padding: 16px;
    font-size: 1.3rem; font-family: 'Nunito', sans-serif; font-weight: 700; resize: none;
    box-shadow: inset 4px 4px 0 rgba(0,0,0,0.1); outline: none; margin: 16px 0;
}
.input-textarea:focus { background: var(--accent-yellow); }

.wait-card { width: 100%; text-align: center; padding: 40px 20px; }
.spinner-pulse { font-size: 4rem; margin-bottom: 20px; animation: spinIcon 2s infinite linear; }
@keyframes spinIcon { 100% { transform: rotate(360deg); } }
.wait-subtext { font-size: 1.25rem; margin-top: 12px; font-weight: 800; }

.player-card-inner { width: 100%; text-align: center; }
.player-prompt-display { font-size: 1.6rem; margin: 12px 0; line-height: 1.3; font-weight: 900; }
.instruction-note { font-size: 1.15rem; margin: 10px 0 20px 0; font-weight: 700; color: #444; }

.voting-options-stack { display: flex; flex-direction: column; gap: 16px; width: 100%; }
.btn-vote-option { font-size: 1.3rem; padding: 16px; font-weight: 800; background: white; color: black; border: 3px solid black; box-shadow: 4px 4px 0 black; text-align: left; border-radius: 0; }
.btn-vote-option:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 black; }
.btn-vote-option:hover { background: var(--accent-yellow); }

@media (max-width: 900px) {
    .lobby-center-grid { grid-template-columns: 1fr; }
    .host-body { padding: 10px; }
    .game-logo { font-size: 3.5rem; }
    .prompt-text { font-size: 1.8rem; }
}
