@import url('https://font-cdn.com/css?family=Pricedown:400');

:root {
    --primary-color: #6a11cb;
    --secondary-color: #2575fc;
    --accent-color: #FFDE00;
    --text-color: #ffffff;
    --bg-color: #1a1a2e;
    --dark-bg: #16213e;
    --header-bg: #261497;
    --correct-color: #4CAF50;
    --wrong-color: #F44336;
}

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

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: #000;
    color: var(--text-color);
    display: flex;
    justify-content: center;
    align-items: center;
}

#app-container {
    width: 100%;
    max-width: 450px;
    height: 100dvh; /* The most reliable modern unit for mobile height */
    background-color: var(--bg-color);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

#main-content { flex-grow: 1; overflow-y: auto; position: relative; }
.screen { display: none; flex-direction: column; height: 100%; animation: fadeIn 0.5s ease; }
.screen.active { display: flex; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* CENTER PLAY SCREEN CONTENT */
#play-screen .screen-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    flex-grow: 1;
}

.screen-header {
    background-color: var(--header-bg);
    padding: 10px 15px;
    box-shadow: 0 4px 10px rgba(0,0,0,0.3);
    min-height: 80px;
    height: 80px;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-shrink: 0;
}
.screen-header h1 {
    font-family: 'Pricedown', sans-serif;
    margin: 0;
    font-size: 28px;
    color: var(--accent-color);
    text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
    line-height: 1;
}
.screen-content { padding: 20px; }

/* --- Navigation & Footer Balance --- */
#bottom-nav { display: flex; background-color: var(--header-bg); border-top: 1px solid var(--primary-color); flex-shrink: 0; align-items: center; }
.nav-btn { flex-grow: 1; flex-basis: 0; padding: 20px 5px; background: none; border: none; color: #a0a0a0; cursor: pointer; font-size: 14px; transition: all 0.3s ease; border-top: 3px solid transparent; font-weight: bold; }
.nav-btn.active { color: var(--accent-color); border-top-color: var(--accent-color); }
#footer-balance { font-size: 16px; font-weight: bold; color: var(--accent-color); padding: 0 20px; }
#game-screen.active ~ #bottom-nav { display: none; }

/* --- Tournaments Lobby --- */
.tournament-card {
    padding: 25px; /* Bigger padding */
    border-radius: 15px;
    font-weight: bold;
    background: linear-gradient(45deg, #e52e71, #ff8a00);
    width: 100%;
    max-width: 350px; /* Control max width */
    text-align: center;
}
.tournament-card h3 { margin-bottom: 8px; font-size: 24px; }
.tournament-card p { margin-bottom: 12px; color: #eee; font-size: 16px; text-shadow: 1px 1px 2px #000; }
.tournament-footer {
    display: flex;
    flex-direction: column; /* Stack items vertically */
    align-items: center;
    font-size: 16px;
    margin-bottom: 25px;
    gap: 8px; /* Space between rows */
}
.tournament-card .btn-primary { width: 100%; padding: 15px; font-size: 20px; }


/* --- Bank Screen --- */
.bank-section { background-color: var(--dark-bg); padding: 20px; border-radius: 10px; margin-bottom: 20px; }
.bank-section h2 { color: var(--accent-color); margin-bottom: 15px; }
.bank-section p { color: #ccc; margin-bottom: 15px; font-size: 14px; }
.bank-input { width: 100%; padding: 12px; border-radius: 5px; border: 1px solid var(--primary-color); background-color: var(--bg-color); color: white; font-size: 16px; margin-bottom: 15px; }
.bank-section .btn { width: 100%; }

/* --- Game Screen --- */
.game-screen-layout { justify-content: space-between; padding: 15px; background-image: linear-gradient(to bottom, var(--primary-color), #0f0c29); }
#game-header { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; width: 100%; color: #ddd; font-weight: bold; }
#question-counter { text-align: left; }
#player-count { text-align: right; }
#leave-tournament-btn { padding: 6px 12px; font-size: 12px; }
#question-area { text-align: center; }
#question-area h2 { font-size: 22px; margin-bottom: 5px; }
#question-area #sub-prompt { color: var(--accent-color); font-size: 18px; font-weight: bold; min-height: 50px; display: flex; flex-direction: column; justify-content: center; align-items: center; }
#status-update-area { text-align: center; font-weight: bold; color: var(--text-color); background: rgba(0,0,0,0.3); padding: 5px; border-radius: 5px; min-height: 28px; margin: 5px 0; visibility: hidden; }
#timer-circle { width: 90px; height: 90px; border-radius: 50%; background: var(--dark-bg); display: flex; justify-content: center; align-items: center; margin: 0 auto; border: 5px solid var(--accent-color); box-shadow: 0 0 20px var(--accent-color); }
#timer-text { font-size: 42px; font-weight: bold; }
#answer-options { display: grid; grid-template-columns: 1fr; gap: 12px; width: 100%; }
.answer-btn { padding: 18px; font-size: 16px; background-image: linear-gradient(to right, var(--secondary-color), var(--primary-color)); color: var(--text-color); border: 2px solid transparent; border-radius: 10px; cursor: pointer; transition: all 0.3s ease; position: relative; }
.answer-voter-count { position: absolute; top: 5px; right: 10px; font-size: 12px; font-weight: bold; background-color: rgba(0,0,0,0.4); padding: 2px 5px; border-radius: 5px; }
.answer-btn.selected { border-color: var(--accent-color); box-shadow: 0 0 15px var(--accent-color); }
.answer-btn.correct { background: var(--correct-color); border-color: var(--text-color); transform: scale(1.05); }
.answer-btn.incorrect { filter: grayscale(80%); opacity: 0.6; }
.answer-btn.disabled { pointer-events: none; }

/* --- Overlays --- */
.overlay { position: absolute; top: 0; left: 0; right: 0; bottom: 0; display: none; justify-content: center; align-items: center; z-index: 1000; background: rgba(0,0,0,0.9); }
.overlay-content { background: var(--dark-bg); padding: 30px; border-radius: 15px; width: 90%; text-align: center; animation: zoomIn 0.3s ease; }
#buy-in-options { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 15px; margin: 20px 0; }
.buy-in-info { font-size: 12px; color: #ccc; margin-top: 15px; }
#welcome-overlay .overlay-content { background: radial-gradient(circle, #e52e71, #ff8a00); }
#presenter-icon { font-size: 80px; margin-bottom: 20px; animation: bounceIn 1s; }
ul { list-style: none; padding: 0; margin-top: 15px; margin-bottom: 25px; }
li { display: flex; justify-content: space-between; padding: 10px; border-bottom: 1px solid #444; }
li.player-highlight { background-color: var(--primary-color); font-weight: bold; border-radius: 5px; }
li.opponent-highlight { background-color: var(--duel-color); font-weight: bold; border-radius: 5px; }

@keyframes zoomIn { from { transform: scale(0.5); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes bounceIn { 0%, 20%, 50%, 80%, 100% {transform: translateY(0);} 40% {transform: translateY(-30px);} 60% {transform: translateY(-15px);} }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }

/* --- Utility Classes --- */
.btn { padding: 10px 20px; border-radius: 20px; border: none; cursor: pointer; font-weight: bold; transition: transform 0.2s ease; font-size: 14px; }
.btn:hover { transform: scale(1.05); }
.btn-primary { background-color: var(--accent-color); color: #000; }
.btn-danger { background-color: var(--wrong-color); color: var(--text-color); }