/* public/css/style.css */

/* ============================================
   RESET & BASE
   ============================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: #0a0a0a;
    color: #ffffff;
    font-family: 'Press Start 2P', monospace;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    cursor: default;
}

/* ============================================
   SCREENS
   ============================================ */
.screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: none;
    justify-content: center;
    align-items: center;
    z-index: 10;
    background: #0a0a0a;
}

.screen.active {
    display: flex;
}

/* ============================================
   DISCLAIMER
   ============================================ */
#disclaimer-screen {
    background: radial-gradient(ellipse at center, #1a0a2e 0%, #0a0a0a 70%);
}

.disclaimer-box {
    background: rgba(20, 10, 40, 0.95);
    border: 3px solid #ff4444;
    border-radius: 20px;
    padding: 40px;
    max-width: 700px;
    text-align: center;
    animation: fadeInUp 0.8s ease;
    box-shadow: 0 0 40px rgba(255, 68, 68, 0.3);
}

.disclaimer-icon {
    font-size: 60px;
    margin-bottom: 20px;
    animation: pulse 1.5s infinite;
}

.disclaimer-box h2 {
    font-family: 'Creepster', cursive;
    font-size: 36px;
    color: #ff4444;
    margin-bottom: 20px;
    letter-spacing: 5px;
}

.disclaimer-text {
    font-size: 10px;
    line-height: 2;
    color: #cccccc;
    margin-bottom: 30px;
}

.highlight {
    color: #ffcc00;
    font-weight: bold;
}

/* ============================================
   GAME LOGO / TITLE
   ============================================ */
.game-logo {
    text-align: center;
    margin-bottom: 30px;
}

.title-main {
    font-family: 'Creepster', cursive;
    font-size: 52px;
    color: #ff6600;
    text-shadow: 
        0 0 10px #ff6600,
        0 0 20px #ff4400,
        0 0 40px #ff2200,
        3px 3px 0 #330000;
    letter-spacing: 3px;
    animation: titleGlow 2s ease-in-out infinite alternate;
}

.title-sub {
    font-family: 'Creepster', cursive;
    font-size: 28px;
    color: #cc0000;
    text-shadow: 
        0 0 10px #cc0000,
        0 0 20px #880000;
    letter-spacing: 5px;
    margin-top: 10px;
    animation: titleGlow2 3s ease-in-out infinite alternate;
}

@keyframes titleGlow {
    from { text-shadow: 0 0 10px #ff6600, 0 0 20px #ff4400, 0 0 40px #ff2200, 3px 3px 0 #330000; }
    to { text-shadow: 0 0 20px #ff8800, 0 0 40px #ff6600, 0 0 60px #ff4400, 3px 3px 0 #330000; }
}

@keyframes titleGlow2 {
    from { text-shadow: 0 0 10px #cc0000, 0 0 20px #880000; }
    to { text-shadow: 0 0 20px #ff0000, 0 0 40px #cc0000; }
}

/* ============================================
   AUTH SCREEN
   ============================================ */
#auth-screen {
    background: radial-gradient(ellipse at center, #1a0a2e 0%, #0a0a0a 70%);
}

.auth-container {
    background: rgba(15, 10, 30, 0.95);
    border: 2px solid #6633cc;
    border-radius: 20px;
    padding: 40px;
    max-width: 500px;
    width: 90%;
    animation: fadeInUp 0.6s ease;
}

.auth-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 25px;
    border-bottom: 2px solid #333;
}

.tab-btn {
    flex: 1;
    padding: 12px;
    background: transparent;
    border: none;
    color: #666;
    font-family: 'Press Start 2P', monospace;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.3s;
    border-bottom: 3px solid transparent;
}

.tab-btn.active {
    color: #ffcc00;
    border-bottom-color: #ffcc00;
}

.tab-btn:hover {
    color: #ff9900;
}

.auth-form {
    display: none;
}

.auth-form.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.input-group {
    margin-bottom: 18px;
}

.input-group label {
    display: block;
    font-size: 9px;
    color: #aaa;
    margin-bottom: 8px;
    letter-spacing: 2px;
}

.input-group input[type="text"],
.input-group input[type="password"],
.input-group input[type="number"] {
    width: 100%;
    padding: 12px 15px;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid #333;
    border-radius: 10px;
    color: #fff;
    font-family: 'Press Start 2P', monospace;
    font-size: 11px;
    transition: border-color 0.3s;
    outline: none;
}

.input-group input:focus {
    border-color: #ffcc00;
    box-shadow: 0 0 10px rgba(255, 204, 0, 0.2);
}

.error-text {
    color: #ff4444;
    font-size: 8px;
    margin-top: 10px;
    min-height: 15px;
}

/* ============================================
   BUTTONS
   ============================================ */
.btn-main {
    width: 100%;
    padding: 15px 20px;
    background: linear-gradient(180deg, #ff6600 0%, #cc3300 100%);
    border: 3px solid #ff8800;
    border-radius: 12px;
    color: #fff;
    font-family: 'Creepster', cursive;
    font-size: 22px;
    letter-spacing: 3px;
    cursor: pointer;
    transition: all 0.2s;
    text-shadow: 2px 2px 0 #330000;
    box-shadow: 0 5px 15px rgba(255, 102, 0, 0.3);
}

.btn-main:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(255, 102, 0, 0.5);
    background: linear-gradient(180deg, #ff8800 0%, #dd4400 100%);
}

.btn-main:active {
    transform: translateY(0);
}

.btn-menu {
    width: 100%;
    padding: 18px 25px;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    border: 2px solid rgba(255, 255, 255, 0.15);
    border-radius: 15px;
    color: #fff;
    font-family: 'Creepster', cursive;
    font-size: 24px;
    letter-spacing: 4px;
    cursor: pointer;
    transition: all 0.3s;
    text-align: left;
    display: flex;
    align-items: center;
    gap: 15px;
}

.btn-menu:hover {
    background: linear-gradient(180deg, rgba(255, 102, 0, 0.3) 0%, rgba(255, 102, 0, 0.1) 100%);
    border-color: #ff6600;
    transform: translateX(10px);
    box-shadow: 0 0 20px rgba(255, 102, 0, 0.2);
}

.btn-menu.btn-logout {
    border-color: rgba(255, 68, 68, 0.3);
}

.btn-menu.btn-logout:hover {
    background: linear-gradient(180deg, rgba(255, 68, 68, 0.3) 0%, rgba(255, 68, 68, 0.1) 100%);
    border-color: #ff4444;
}

.btn-icon {
    font-size: 28px;
}

.btn-secondary {
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid #555;
    border-radius: 8px;
    color: #ccc;
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-secondary:hover {
    border-color: #ffcc00;
    color: #ffcc00;
}

.btn-small {
    padding: 8px 15px;
    background: rgba(255, 204, 0, 0.2);
    border: 1px solid #ffcc00;
    border-radius: 5px;
    color: #ffcc00;
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-small:hover {
    background: rgba(255, 204, 0, 0.4);
}

.btn-back {
    position: absolute;
    top: 20px;
    left: 20px;
    padding: 10px 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 2px solid #555;
    border-radius: 8px;
    color: #fff;
    font-family: 'Press Start 2P', monospace;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.3s;
    z-index: 20;
}

.btn-back:hover {
    border-color: #ffcc00;
    color: #ffcc00;
}

/* ============================================
   MENU
   ============================================ */
#menu-screen {
    background: radial-gradient(ellipse at center, #1a0a2e 0%, #0a0a0a 70%);
}

.menu-container {
    text-align: center;
    max-width: 500px;
    width: 90%;
}

.player-info-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 12px 20px;
    margin-bottom: 25px;
    font-size: 10px;
}

#menu-username {
    color: #ffcc00;
}

#menu-points {
    color: #66ff66;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 30px;
}

.menu-footer {
    font-size: 7px;
    color: #555;
    line-height: 2;
}

/* ============================================
   PANEL CONTAINER (for sub-screens)
   ============================================ */
.panel-container {
    position: relative;
    background: rgba(10, 10, 20, 0.98);
    width: 100%;
    height: 100%;
    padding: 80px 40px 40px;
    overflow-y: auto;
}

.panel-title {
    font-family: 'Creepster', cursive;
    font-size: 36px;
    color: #ff6600;
    text-align: center;
    margin-bottom: 30px;
    text-shadow: 0 0 10px rgba(255, 102, 0, 0.5);
}

/* ============================================
   PLAY SCREEN
   ============================================ */
.play-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    margin-bottom: 30px;
    max-width: 800px;
    margin-left: auto;
    margin-right: auto;
}

.play-option-card {
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid #333;
    border-radius: 15px;
    padding: 25px;
    text-align: center;
    transition: border-color 0.3s;
}

.play-option-card:hover {
    border-color: #ff6600;
}

.play-option-card h3 {
    font-family: 'Creepster', cursive;
    font-size: 22px;
    color: #ffcc00;
    margin-bottom: 20px;
}

.room-browser {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.room-browser h3 {
    font-family: 'Creepster', cursive;
    font-size: 20px;
    color: #ffcc00;
    margin-bottom: 15px;
}

.room-list {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid #333;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 15px;
    max-height: 250px;
    overflow-y: auto;
}

.room-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #333;
    border-radius: 8px;
    margin-bottom: 8px;
    font-size: 9px;
    transition: all 0.2s;
}

.room-item:hover {
    border-color: #ff6600;
    background: rgba(255, 102, 0, 0.1);
}

.room-item .room-info {
    display: flex;
    gap: 15px;
}

.room-item .room-code {
    color: #ffcc00;
    font-weight: bold;
}

.empty-text {
    color: #555;
    font-size: 9px;
    text-align: center;
}

/* ============================================
   SKINS SCREEN
   ============================================ */
.skins-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 15px;
    max-width: 900px;
    margin: 0 auto;
}

.skin-card {
    background: rgba(255, 255, 255, 0.05);
    border: 3px solid #333;
    border-radius: 15px;
    padding: 15px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s;
}

.skin-card:hover {
    border-color: #ff6600;
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(255, 102, 0, 0.2);
}

.skin-card.selected {
    border-color: #ffcc00;
    box-shadow: 0 0 20px rgba(255, 204, 0, 0.3);
    background: rgba(255, 204, 0, 0.1);
}

.skin-preview {
    width: 80px;
    height: 80px;
    margin: 0 auto 10px;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.skin-preview img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

.skin-name {
    font-size: 9px;
    color: #fff;
    letter-spacing: 1px;
}

.skin-selected-badge {
    font-size: 7px;
    color: #ffcc00;
    margin-top: 5px;
}

/* ============================================
   LEADERBOARD
   ============================================ */
.leaderboard-table {
    max-width: 700px;
    margin: 0 auto;
}

.lb-header {
    display: grid;
    grid-template-columns: 50px 1fr 100px 80px;
    padding: 12px 15px;
    background: rgba(255, 102, 0, 0.2);
    border: 1px solid #ff6600;
    border-radius: 10px 10px 0 0;
    font-size: 9px;
    color: #ffcc00;
}

#leaderboard-body {
    max-height: 500px;
    overflow-y: auto;
}

.lb-row {
    display: grid;
    grid-template-columns: 50px 1fr 100px 80px;
    padding: 10px 15px;
    border-bottom: 1px solid #222;
    font-size: 9px;
    transition: background 0.2s;
}

.lb-row:hover {
    background: rgba(255, 255, 255, 0.05);
}

.lb-row:nth-child(1) .lb-rank { color: #ffd700; }
.lb-row:nth-child(2) .lb-rank { color: #c0c0c0; }
.lb-row:nth-child(3) .lb-rank { color: #cd7f32; }

.lb-rank { color: #888; text-align: center; }
.lb-name { color: #fff; }
.lb-points { color: #66ff66; text-align: right; }
.lb-wins { color: #ffcc00; text-align: right; }

/* ============================================
   SETTINGS
   ============================================ */
.settings-list {
    max-width: 500px;
    margin: 0 auto;
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid #333;
    border-radius: 10px;
    margin-bottom: 10px;
    font-size: 9px;
}

.setting-item label {
    flex-shrink: 0;
    color: #ccc;
    letter-spacing: 1px;
}

.setting-item input[type="range"] {
    flex: 1;
    max-width: 200px;
    accent-color: #ff6600;
}

.setting-item input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: #ff6600;
}

/* ============================================
   LOBBY
   ============================================ */
.lobby-panel {
    display: flex;
    flex-direction: column;
    max-width: 800px;
    margin: 0 auto;
    padding-top: 40px;
}

.lobby-info {
    display: flex;
    align-items: center;
    gap: 15px;
    justify-content: center;
    margin-bottom: 20px;
    font-size: 10px;
}

.lobby-info strong {
    color: #ffcc00;
    letter-spacing: 3px;
    font-size: 14px;
}

.lobby-players {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 10px;
    margin-bottom: 20px;
}

.lobby-player-card {
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid #444;
    border-radius: 10px;
    padding: 12px;
    text-align: center;
    font-size: 9px;
}

.lobby-player-card.is-host {
    border-color: #ffcc00;
}

.lobby-player-card .player-icon {
    width: 50px;
    height: 50px;
    margin: 0 auto 8px;
    image-rendering: pixelated;
}

.lobby-player-card .player-icon img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    image-rendering: pixelated;
}

.lobby-player-card .player-name {
    color: #fff;
    margin-bottom: 4px;
}

.lobby-player-card .host-badge {
    color: #ffcc00;
    font-size: 7px;
}

.lobby-chat {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid #333;
    border-radius: 10px;
    padding: 10px;
    margin-bottom: 15px;
    flex: 1;
    min-height: 150px;
    display: flex;
    flex-direction: column;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    margin-bottom: 10px;
    font-size: 8px;
    max-height: 150px;
}

.chat-msg {
    padding: 4px 0;
    color: #ccc;
}

.chat-msg .chat-name {
    color: #ffcc00;
}

.chat-msg.system {
    color: #888;
    font-style: italic;
}

.chat-input-row {
    display: flex;
    gap: 8px;
}

.chat-input-row input {
    flex: 1;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid #444;
    border-radius: 5px;
    color: #fff;
    font-family: 'Press Start 2P', monospace;
    font-size: 8px;
    outline: none;
}

.lobby-actions {
    display: flex;
    gap: 15px;
    justify-content: center;
}

.btn-leave {
    border-color: #ff4444 !important;
    color: #ff4444 !important;
}

.btn-leave:hover {
    background: rgba(255, 68, 68, 0.2) !important;
}

/* ============================================
   GAME SCREEN
   ============================================ */
#game-screen {
    background: #111;
}

#game-canvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* HUD */
#game-hud {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    pointer-events: none;
    z-index: 20;
}

.hud-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    padding: 15px 20px;
}

.hud-timer {
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid #ff6600;
    border-radius: 10px;
    padding: 10px 20px;
    text-align: center;
}

#hud-timer-text {
    font-family: 'Creepster', cursive;
    font-size: 36px;
    color: #ff6600;
    display: block;
}

.hud-timer-label {
    font-size: 7px;
    color: #aaa;
    letter-spacing: 2px;
}

.hud-role {
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid #ffcc00;
    border-radius: 10px;
    padding: 10px 20px;
    font-family: 'Creepster', cursive;
    font-size: 20px;
    color: #ffcc00;
    letter-spacing: 3px;
}

.hud-role.monster {
    border-color: #ff0000;
    color: #ff0000;
    text-shadow: 0 0 10px #ff0000;
}

.hud-alive {
    background: rgba(0, 0, 0, 0.7);
    border: 2px solid #66ff66;
    border-radius: 10px;
    padding: 10px 15px;
    font-size: 9px;
    color: #66ff66;
}

.hud-fps {
    position: absolute;
    bottom: 10px;
    left: 10px;
    font-size: 8px;
    color: #66ff66;
    background: rgba(0, 0, 0, 0.5);
    padding: 5px 10px;
    border-radius: 5px;
}

/* ============================================
   OVERLAYS
   ============================================ */
.overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    background: rgba(0, 0, 0, 0.8);
}

/* Countdown */
#countdown-overlay {
    flex-direction: column;
    background: rgba(0, 0, 0, 0.9);
}

.countdown-number {
    font-family: 'Creepster', cursive;
    font-size: 150px;
    color: #ff6600;
    text-shadow: 
        0 0 20px #ff6600,
        0 0 40px #ff4400,
        0 0 80px #ff2200;
    animation: countdownPulse 1s ease-in-out infinite;
}

.countdown-text {
    font-family: 'Creepster', cursive;
    font-size: 30px;
    color: #ffcc00;
    letter-spacing: 10px;
    margin-top: 20px;
}

@keyframes countdownPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Jumpscare */
#jumpscare-overlay {
    background: #000;
    z-index: 200;
}

#jumpscare-overlay img {
    max-width: 100%;
    max-height: 100%;
    animation: jumpscareShake 0.3s infinite;
}

@keyframes jumpscareShake {
    0%, 100% { transform: translate(0, 0) scale(1); }
    25% { transform: translate(-10px, 5px) scale(1.05); }
    50% { transform: translate(10px, -5px) scale(1.1); }
    75% { transform: translate(-5px, -10px) scale(1.05); }
}

/* Game Over */
#gameover-overlay {
    background: rgba(0, 0, 0, 0.92);
}

.gameover-box {
    background: rgba(20, 10, 40, 0.95);
    border: 3px solid #ff6600;
    border-radius: 20px;
    padding: 40px;
    text-align: center;
    max-width: 600px;
    width: 90%;
    animation: fadeInUp 0.5s ease;
}

#gameover-title {
    font-family: 'Creepster', cursive;
    font-size: 48px;
    margin-bottom: 15px;
}

#gameover-title.win {
    color: #66ff66;
    text-shadow: 0 0 20px rgba(102, 255, 102, 0.5);
}

#gameover-title.lose {
    color: #ff4444;
    text-shadow: 0 0 20px rgba(255, 68, 68, 0.5);
}

#gameover-subtitle {
    font-size: 10px;
    color: #aaa;
    margin-bottom: 25px;
}

.gameover-results {
    margin-bottom: 25px;
}

.result-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 15px;
    font-size: 9px;
    border-bottom: 1px solid #222;
}

.result-row .result-name { color: #fff; }
.result-row .result-role { color: #aaa; }
.result-row .result-status.alive { color: #66ff66; }
.result-row .result-status.dead { color: #ff4444; }
.result-row .result-points { color: #ffcc00; }

/* ============================================
   ANIMATIONS
   ============================================ */
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* ============================================
   SCROLLBAR
   ============================================ */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.3);
}

::-webkit-scrollbar-thumb {
    background: #555;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #888;
}

/* ============================================
   RESPONSIVE
   ============================================ */
@media (max-width: 768px) {
    .title-main { font-size: 32px; }
    .title-sub { font-size: 18px; }
    .play-options { grid-template-columns: 1fr; }
    .btn-menu { font-size: 18px; padding: 14px 20px; }
    .panel-container { padding: 60px 20px 20px; }
    .hud-top { flex-direction: column; gap: 5px; align-items: center; }
}