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

:root {
    --primary: #ff9c41;
    --secondary: #0f151c;
    --accent: #ff9c41;
    --good: #2ecc71;
    --bad: #ff5c7c;
}

body {
    font-family: 'Segoe UI', 'Rubik', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
    background: linear-gradient(135deg, #0f151c 0%, #1b2530 100%);
    color: #fff;
    min-height: 100vh;
    line-height: 1.6;
}

.container { max-width: 900px; margin: 0 auto; padding: 0 1.5rem; }
.container.narrow { max-width: 480px; }

nav {
    position: sticky; top: 0; width: 100%;
    background: rgba(0,0,0,0.4); backdrop-filter: blur(15px);
    padding: 1rem 0; z-index: 1000; border-bottom: 1px solid rgba(255,255,255,0.1);
}
nav .container { display: flex; justify-content: space-between; align-items: center; max-width: 1100px; }
.logo-text { font-size: 1.3rem; font-weight: 700; color: #fff; text-decoration: none; }
nav ul { list-style: none; display: flex; gap: 1rem; }
nav a { color: #fff; text-decoration: none; font-weight: 500; padding: 0.4rem 0.9rem; border-radius: 8px; transition: all .2s; }
nav a:hover { background: rgba(255,255,255,0.2); }

main.container { padding: 2.5rem 1.5rem 4rem; }

h1 { font-size: 2rem; margin-bottom: .6rem; }
h2 { font-size: 1.4rem; margin-bottom: .6rem; }
p.lead { opacity: .9; margin-bottom: 1.5rem; }

.card {
    background: rgba(255,255,255,0.1); backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.2); border-radius: 18px;
    padding: 1.75rem; margin-bottom: 1.25rem;
}

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.25rem; }

label { display: block; font-size: .9rem; margin-bottom: .35rem; opacity: .9; }
input[type=text], input[type=email], input[type=number], textarea {
    width: 100%; padding: .7rem .9rem; border-radius: 10px; border: 1px solid rgba(255,255,255,0.3);
    background: rgba(0,0,0,0.2); color: #fff; font-size: 1rem; font-family: inherit;
}
input::placeholder, textarea::placeholder { color: rgba(255,255,255,0.6); }
.field { margin-bottom: 1rem; }

button, .btn {
    display: inline-block; cursor: pointer; border: none; border-radius: 12px;
    padding: .75rem 1.5rem; font-size: 1rem; font-weight: 700; font-family: inherit;
    background: #fff; color: var(--secondary); transition: transform .15s, opacity .15s;
    text-decoration: none;
}
button:hover, .btn:hover { transform: translateY(-2px); }
button:disabled { opacity: .5; cursor: not-allowed; transform: none; }
button.secondary, .btn.secondary { background: rgba(255,255,255,0.15); color: #fff; border: 1px solid rgba(255,255,255,0.35); }
button.danger { background: var(--bad); color: #fff; }
.actions { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1rem; }

.msg { padding: .8rem 1rem; border-radius: 10px; margin-bottom: 1rem; font-size: .95rem; }
.msg.error { background: rgba(255, 92, 124, 0.25); border: 1px solid var(--bad); }
.msg.ok { background: rgba(46, 204, 113, 0.25); border: 1px solid var(--good); }
.msg.info { background: rgba(255,255,255,0.15); border: 1px solid rgba(255,255,255,0.3); }

.code-display {
    font-size: 3rem; font-weight: 800; letter-spacing: .25em; text-align: center;
    padding: 1rem; background: rgba(0,0,0,0.25); border-radius: 16px; margin: 1rem 0;
}

.option-list { display: grid; gap: .75rem; margin: 1rem 0; }
.option-btn {
    display: flex; align-items: center; gap: .75rem; width: 100%;
    padding: 1rem 1.2rem; border-radius: 14px; border: 2px solid rgba(255,255,255,0.3);
    background: rgba(255,255,255,0.1); color: #fff; font-size: 1.05rem; font-weight: 600;
    text-align: right; cursor: pointer; transition: all .15s;
}
.option-btn:hover:not(:disabled) { background: rgba(255,255,255,0.22); }
.option-btn:disabled { cursor: default; }
.option-btn .letter {
    display: inline-flex; align-items: center; justify-content: center;
    width: 2rem; height: 2rem; border-radius: 50%; background: rgba(255,255,255,0.2); flex-shrink: 0;
}
.option-btn.selected { border-color: #fff; background: rgba(255,255,255,0.3); }
.option-btn.correct { border-color: var(--good); background: rgba(46, 204, 113, 0.35); }
.option-btn.wrong { border-color: var(--bad); background: rgba(255, 92, 124, 0.35); }

/* Fixed per-position colors, Kahoot-style, so an option is recognizable by
   color alone across the screen/host/player views without configuration. */
.option-btn.color-0 { background: rgba(231, 76, 60, 0.55); border-color: #e74c3c; }
.option-btn.color-1 { background: rgba(47, 123, 222, 0.55); border-color: #2f7bde; }
.option-btn.color-2 { background: rgba(224, 167, 16, 0.55); border-color: #e0a710; }
.option-btn.color-3 { background: rgba(40, 168, 98, 0.55); border-color: #28a862; }
.option-btn.color-4 { background: rgba(155, 89, 182, 0.55); border-color: #9b59b6; }
.option-btn.color-5 { background: rgba(26, 188, 156, 0.55); border-color: #1abc9c; }
.option-btn.color-0 .letter, .option-btn.color-1 .letter, .option-btn.color-2 .letter,
.option-btn.color-3 .letter, .option-btn.color-4 .letter, .option-btn.color-5 .letter,
.letter.color-0, .letter.color-1, .letter.color-2,
.letter.color-3, .letter.color-4, .letter.color-5 { background: rgba(0,0,0,0.2); }
.letter.color-0 { outline: 2px solid #e74c3c; }
.letter.color-1 { outline: 2px solid #2f7bde; }
.letter.color-2 { outline: 2px solid #e0a710; }
.letter.color-3 { outline: 2px solid #28a862; }
.letter.color-4 { outline: 2px solid #9b59b6; }
.letter.color-5 { outline: 2px solid #1abc9c; }
.option-btn.correct.color-0, .option-btn.correct.color-1, .option-btn.correct.color-2,
.option-btn.correct.color-3, .option-btn.correct.color-4, .option-btn.correct.color-5 {
    border-color: var(--good); box-shadow: 0 0 0 3px rgba(46, 204, 113, 0.5) inset;
}
.option-btn.wrong.color-0, .option-btn.wrong.color-1, .option-btn.wrong.color-2,
.option-btn.wrong.color-3, .option-btn.wrong.color-4, .option-btn.wrong.color-5 {
    opacity: .55;
}

.question-image { width: 100%; max-height: 260px; object-fit: cover; border-radius: 14px; margin-bottom: 1rem; }

.sound-toggle {
    position: fixed; top: .9rem; left: .9rem; z-index: 50;
    width: 2.6rem; height: 2.6rem; border-radius: 50%; padding: 0; font-size: 1.2rem;
    background: rgba(0,0,0,0.35); border: 1px solid rgba(255,255,255,0.3); color: #fff;
}

.countdown-overlay {
    position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.45); z-index: 100; pointer-events: none;
}
.countdown-overlay .digit {
    font-size: 9rem; font-weight: 900; color: #fff; text-shadow: 0 8px 30px rgba(0,0,0,0.5);
    animation: countdown-pop .5s ease-out;
}
@keyframes countdown-pop {
    0% { transform: scale(0.4); opacity: 0; }
    40% { transform: scale(1.15); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

.blessing {
    white-space: pre-wrap; line-height: 1.9; font-size: 1.05rem;
    background: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.25);
    border-radius: 16px; padding: 1.5rem; margin: 1.5rem 0; max-width: 62ch; margin-inline: auto;
}

.timer-bar { height: 10px; border-radius: 999px; background: rgba(0,0,0,0.25); overflow: hidden; margin: 1rem 0; }
.timer-bar > div { height: 100%; background: #fff; transition: width .2s linear; }

.tally-list { display: grid; gap: .6rem; margin: 1rem 0; }
.tally-row { display: grid; grid-template-columns: 1.5rem 1fr auto; gap: .75rem; align-items: center; }
.tally-bar { height: 1.6rem; border-radius: 8px; background: rgba(255,255,255,0.15); overflow: hidden; }
.tally-bar > div { height: 100%; background: rgba(255,255,255,0.5); }
.tally-row.correct .tally-bar > div { background: var(--good); }

.leaderboard { list-style: none; display: grid; gap: .5rem; margin: 1rem 0; }
.leaderboard li { display: flex; justify-content: space-between; padding: .6rem 1rem; border-radius: 10px; background: rgba(255,255,255,0.1); }
.leaderboard li:nth-child(1) { background: rgba(255, 215, 0, 0.25); font-weight: 800; }
.leaderboard li:nth-child(2) { background: rgba(192, 192, 192, 0.2); }
.leaderboard li:nth-child(3) { background: rgba(205, 127, 50, 0.2); }

table.qlist { width: 100%; border-collapse: collapse; margin-top: 1rem; }
table.qlist td, table.qlist th { padding: .6rem; text-align: right; border-bottom: 1px solid rgba(255,255,255,0.15); }

.question-editor { border: 1px solid rgba(255,255,255,0.25); border-radius: 14px; padding: 1.25rem; margin-bottom: 1rem; }
.option-row { display: flex; align-items: center; gap: .6rem; margin-bottom: .5rem; }
.option-row input[type=text] { flex: 1; }

.muted { opacity: .75; font-size: .9rem; }
.center { text-align: center; }
.stack { display: grid; gap: .5rem; }

footer { text-align: center; padding: 2rem; opacity: .8; }
