* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
    --bg: #f7f9ff;
    --panel: rgba(255, 255, 255, 0.92);
    --panel-strong: rgba(255, 255, 255, 0.98);
    --muted: #5b6475;
    --primary: #2563eb;
    --primary-strong: #1d4ed8;
    --accent: #16a34a;
    --danger: #dc2626;
    --warning: #ca8a04;
    --border: rgba(15, 23, 42, 0.08);
    --card-shadow: 0 15px 40px rgba(15, 23, 42, 0.12);
    --radius: 16px;
}
body { font-family: 'Space Grotesk', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: radial-gradient(circle at 30% 20%, rgba(37,99,235,0.16), transparent 25%), radial-gradient(circle at 70% 80%, rgba(22,163,74,0.12), transparent 30%), var(--bg); color: #0f172a; overflow: hidden; height: 100vh; min-height: 100vh; }
#app { width: 100%; height: 100%; display: flex; flex-direction: column; position: relative; }
#map { width: 100%; height: 100%; background: #e2e8f0; z-index: 1; }

@supports (height: 100svh) {
    body { height: 100svh; }
    #app { height: 100svh; }
    #map { height: 100svh; }
}

.screen { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 400; padding: 24px; background: linear-gradient(135deg, rgba(255,255,255,0.9), rgba(226,232,240,0.8)); backdrop-filter: blur(10px); overflow-y: auto; }
.stack { width: min(960px, 100%); display: grid; gap: 20px; }
.hero { text-align: center; margin-bottom: 6px; }
.hero h1 { font-size: clamp(28px, 5vw, 42px); letter-spacing: 0.6px; margin-bottom: 6px; }
.hero p { color: var(--muted); }

.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--card-shadow); display: grid; gap: 12px; }
.card-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.label { text-transform: uppercase; letter-spacing: 1px; color: var(--muted); font-size: 12px; }
.input { width: 100%; background: #f1f5f9; border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; color: #0f172a; font-size: 16px; outline: none; transition: border 0.15s ease, box-shadow 0.15s ease; }
.input:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(37,99,235,0.2); }

.primary-btn, .ghost-btn { border: none; border-radius: 12px; cursor: pointer; padding: 14px 18px; font-weight: 700; font-size: 16px; transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease; }
.primary-btn { background: linear-gradient(135deg, var(--primary), #1d4ed8); color: white; box-shadow: var(--card-shadow); }
.primary-btn:disabled { opacity: 0.6; cursor: not-allowed; }
.ghost-btn { background: rgba(15,23,42,0.04); color: #0f172a; border: 1px solid var(--border); }
.primary-btn:active, .ghost-btn:active { transform: translateY(1px); }

.option-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.option { background: rgba(15,23,42,0.02); border: 1px solid var(--border); border-radius: 12px; padding: 14px; cursor: pointer; transition: border 0.15s ease, transform 0.15s ease, background 0.15s ease; display: grid; gap: 6px; }
.option:hover { border-color: rgba(15,23,42,0.16); }
.option:active { transform: translateY(1px); }
.option.selected { border-color: var(--primary); background: rgba(37,99,235,0.12); box-shadow: 0 10px 30px rgba(37,99,235,0.18); }
.option h3 { font-size: 18px; }
.option p { color: var(--muted); font-size: 14px; line-height: 1.4; }

.section { display: grid; gap: 10px; }
.section h2 { font-size: 20px; }

.game-ui { position: absolute; inset: 0; z-index: 350; pointer-events: none; display: flex; flex-direction: column; justify-content: flex-start; align-items: flex-start; padding: 10px; }
.hud { display: flex; gap: 6px; align-items: flex-start; flex-wrap: wrap; }
.panel { background: var(--panel-strong); border: 1px solid var(--border); border-radius: 12px; padding: 6px 10px; min-width: 140px; max-width: 180px; box-shadow: var(--card-shadow); pointer-events: auto; }
.timer { display: inline-flex; align-items: baseline; gap: 6px; font-weight: 700; font-size: 13px; }
.timer .big { font-size: 18px; }
.progress-mini { background: rgba(15,23,42,0.05); border: 1px solid var(--border); border-radius: 10px; padding: 6px 10px; font-weight: 700; font-size: 13px; }
.players-mini { display: grid; gap: 4px; }
.player-mini { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #0f172a; }
.player-mini .dot { width: 10px; height: 10px; border: 1px solid white; }
.player-mini .name { font-weight: 700; }
.player-mini .offline { font-size: 12px; color: var(--warning); font-weight: 800; }
.score-mini { font-size: 11px; color: var(--muted); font-weight: 700; margin-left: 2px; }

.lobby-card { margin-top: 6px; display: grid; gap: 12px; }
.link-box { background: rgba(15,23,42,0.02); border: 1px dashed var(--border); border-radius: 12px; padding: 12px; font-family: monospace; word-break: break-all; }
.room-share { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.qr-canvas { width: var(--qr-size, 140px); height: var(--qr-size, 140px); background: white; border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--card-shadow); }
.share-actions { display: grid; gap: 8px; align-items: flex-start; min-width: 200px; }
.share-note { color: var(--muted); font-size: 12px; }

.quiz-overlay { position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: center; z-index: 500; background: transparent; padding: 0 10px calc(12px + env(safe-area-inset-bottom, 0px)); pointer-events: none; }
.overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 500; background: rgba(255,255,255,0.82); backdrop-filter: blur(6px); padding: 16px; }
.quiz-box { background: rgba(255,255,255,0.9); border: 1px solid var(--border); border-radius: 18px 18px 14px 14px; padding: 16px; width: min(760px, 100%); box-shadow: var(--card-shadow); position: relative; pointer-events: auto; backdrop-filter: blur(10px); display: grid; gap: 12px; text-align: center; }
.overlay-box { background: var(--panel-strong); border: 1px solid var(--border); border-radius: 18px; padding: 20px; width: min(420px, 100%); box-shadow: var(--card-shadow); text-align: center; }
.quiz-box h2 { font-size: 20px; }
.flags-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 0; }
.flag-opt { font-size: 24px; border: 1px solid var(--border); border-radius: 12px; cursor: pointer; padding: 12px; display:flex; align-items:center; justify-content:center; min-height:70px; background: rgba(15,23,42,0.04); transition: border 0.15s ease, transform 0.15s ease, background 0.15s ease; }
.flag-opt:active { transform: translateY(1px); }
.find-prompt { font-size: 28px; font-weight: 700; text-align: center; }
.find-prompt.flag-large { font-size: 36px; }
.hot-inline { font-size: 16px; font-weight: 800; color: var(--danger); margin-left: 6px; }
.find-hint { color: var(--muted); font-size: 14px; }

.countdown { font-size: 46px; font-weight: 700; letter-spacing: 1px; }
.status-msg { color: var(--warning); font-weight: 700; min-height: 28px; }
.countdown-overlay { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.35); backdrop-filter: blur(4px); z-index: 600; pointer-events: none; }
.countdown-bubble { background: var(--panel-strong); border: 1px solid var(--border); padding: 24px 28px; border-radius: 16px; box-shadow: var(--card-shadow); text-align: center; }
.countdown-bubble h3 { color: var(--muted); margin-bottom: 6px; letter-spacing: 0.5px; text-transform: uppercase; font-size: 13px; }
.countdown-big { font-size: 62px; font-weight: 800; color: var(--primary); }
.quiz-timer { width: 52px; height: 52px; border-radius: 50%; border: 1px solid var(--border); display: grid; place-items: center; margin-left: auto; position: absolute; top: 12px; right: 12px; }
.quiz-timer-ring { width: 100%; height: 100%; border-radius: 50%; background: conic-gradient(var(--primary) calc(var(--progress, 1) * 360deg), #e2e8f0 0deg); display: grid; place-items: center; }
.quiz-timer-inner { width: 36px; height: 36px; border-radius: 50%; background: var(--panel); display: grid; place-items: center; font-weight: 800; color: #0f172a; }
.hot-marker { width: 28px; height: 28px; border-radius: 50%; background: rgba(15,23,42,0.85); color: #ffffff; display: grid; place-items: center; font-weight: 800; font-size: 12px; border: 2px solid #ffffff; box-shadow: 0 6px 16px rgba(15,23,42,0.25); }
.hot-marker span { transform: translateY(-1px); display: inline-block; }

@media (max-width: 720px) {
    .hud { flex-direction: column; }
    .panel { width: 100%; }
    .option-grid { grid-template-columns: 1fr; }
    .card-row { grid-template-columns: 1fr; }
    .screen { align-items: flex-start; padding: 16px; }
}
