body { font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; margin: 0; background: #0b1020; color: #f0f3ff; }
.container { max-width: 900px; margin: 40px auto; padding: 0 16px; }
h1 { text-align: center; }
/* Page logo heading (replaces text H1 where appropriate) */
.page-logo { text-align: center; margin: 14px 0 6px; }
.page-logo img { display: inline-block; width: clamp(220px, 40vw, 380px); height: auto; aspect-ratio: 1024 / 333; }
/* ~30% smaller logo on game page */
body.game .page-logo img { width: clamp(154px, 28vw, 266px); }
.page-logo .subtitle { display: block; font-size: 0.95rem; color: #93c5fd; margin-top: 4px; letter-spacing: .2px; font-weight: 800; text-transform: uppercase; }
.topnav { position: sticky; top: 0; z-index: 10; background: rgba(10,15,30,0.85); backdrop-filter: saturate(1.2) blur(6px); border-bottom: 1px solid #172032;
	/* Preserve breathing room when stuck and respect iOS safe area */
	padding-top: 14px; /* fallback */
	padding-top: calc(14px + env(safe-area-inset-top));
	padding-bottom: 14px;
}
/* Remove vertical margins from generic .container when used inside topnav */
.topnav .container { margin: 0 auto; }
/* Inner nav gets horizontal padding incl. safe areas; vertical handled by .topnav */
.nav-inner { display: flex; align-items: center; justify-content: space-between; padding: 0 16px;
	/* Safe area support with fallbacks */
	padding-left: 16px; /* fallback */
	padding-left: calc(16px + env(safe-area-inset-left));
	padding-right: 16px; /* fallback */
	padding-right: calc(16px + env(safe-area-inset-right));
	flex-wrap: wrap; /* allow brand/links to wrap on small screens */
	row-gap: 6px;
}
.brand { color: #e2e8f0; text-decoration: none; font-weight: 800; letter-spacing: .2px; display: inline-flex; align-items: center; }
.brand-logo { display: block; height: 28px; width: auto; aspect-ratio: 1024 / 333; }
.links { display: flex; align-items: center; flex-wrap: wrap; }
.links a { color: #cbd5e1; text-decoration: none; margin-left: 16px; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }
.links a:hover { color: #ffffff; }
.links a.active { color: #ffffff; border-bottom: 2px solid #3b82f6; padding-bottom: 4px; }
/* Nav icons */
.links .nav-icon { width: 18px; height: 18px; display: inline-block; }
.hero { max-width: 900px; margin: 12px auto 6px; }
.lead { color: #cbd5e1; font-size: 1.05rem; line-height: 1.6; text-align: center; }
.actions { display: flex; gap: 12px; justify-content: center; margin-top: 24px; flex-wrap: wrap; }
button { background: #3b82f6; color: white; border: 0; padding: 10px 16px; border-radius: 8px; cursor: pointer; }
button:hover { background: #2563eb; }
/* Bigger primary actions on home */
.actions .action-btn { 
	display: inline-flex; align-items: center; gap: 10px;
	font-size: 1.125rem; /* 18px */
	font-weight: 700;
	padding: 14px 20px;
	border-radius: 12px;
	box-shadow: 0 6px 18px rgba(59,130,246,0.25);
	background: #3b82f6;
	color: #ffffff; /* readable on dark bg */
	text-decoration: none;
}
.actions .action-btn:visited { color: #ffffff; }
.actions .action-btn .icon { width: 24px; height: 24px; flex: 0 0 24px; }
.actions .action-btn:hover { transform: translateY(-1px); transition: transform .12s ease; background: #2563eb; }
.actions .action-btn:active { transform: translateY(0); }
/* Selection (pre-reveal) */
button.selected { background: #f59e0b; color: #111827; }
button.selected:hover { background: #d97706; }
/* Correct & wrong (during reveal) */
button.correct { background: #16a34a; color: #05290f; }
button.correct:hover { background: #15803d; }
button.wrong { background: #dc2626; }
button.wrong:hover { background: #b91c1c; }
.nickname { display: flex; gap: 8px; justify-content: center; margin: 20px 0; }
.nickname input { padding: 8px 12px; border-radius: 8px; border: 1px solid #334155; background: #111827; color: #e5e7eb; }
.players ul { list-style: none; padding: 0; }
.player-item { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 0; }
.player-left { display: inline-flex; align-items: center; gap: 8px; min-width: 0; }
.player-name { font-size: 1.05rem; font-weight: 600; }
.player-name.me { color: #ffffff; }
.host-badge { margin-left: 8px; font-size: 0.95rem; line-height: 1; color: #a5b4fc; font-style: italic; }
.nick-editor { display: inline-flex; gap: 8px; align-items: center; }
.nick-editor input { padding: 8px 10px; border-radius: 8px; border: 1px solid #334155; background: #111827; color: #e5e7eb; }
.room-code { font-size: 1.25rem; font-weight: 800; text-align: center; margin: 6px 0 10px; }
.room-title { text-align: center; color: #cbd5e1; margin-top: -8px; margin-bottom: 10px; font-weight: 700; font-size: 1.35rem; }
.answers { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 20px 0; }
@media (max-width: 520px) { .answers { grid-template-columns: 1fr; } }
.answers button { font-size: 1.08rem; font-weight: 700; line-height: 1.25; }
.sidebar { margin-top: 30px; }
.controls { display: flex; justify-content: center; margin: 16px 0; }

/* Topic title emphasis and spacing */
.topic { font-size: 1.35rem; font-weight: 700; margin: 16px 0 12px; }
.question { margin-top: 16px; }
#question { margin-top: 20px; }
/* Question text sizing (applies to both game and spectator) */
#question, .question { font-size: 1.08rem; font-weight: 400; line-height: 1.45; text-align: justify; }
.muted { color: #94a3b8; }

/* Note shown after reveal */
.note { background: #0f172a; border: 1px solid #334155; padding: 12px; border-radius: 8px; margin: 12px 0 16px; color: #cbd5e1; display: block; text-align: justify; }
.note .note-title { font-size: 0.95rem; font-weight: 800; color: #93c5fd; margin: 0 0 8px; letter-spacing: .2px; text-transform: uppercase; }

/* Marks in player lists */
.mark { margin-left: 6px; font-weight: 700; }
.mark.answered { color: #22c55e; }
.mark.pending { color: #f59e0b; }
.mark.correct { color: #22c55e; }
.mark.wrong { color: #ef4444; }

/* Home info sections */
.info { margin-top: 28px; }
.info-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.info-card { background: #0f172a; border: 1px solid #334155; border-radius: 12px; padding: 14px; }
.info-card h2 { margin: 0 0 8px; font-size: 1.1rem; }
.info-card p { margin: 0; color: #cbd5e1; line-height: 1.6; text-align: justify; }
.info-card a { color: #93c5fd; text-decoration: none; }
.info-card a:hover { text-decoration: underline; }
 .report-container { text-align: right; position: relative; }
 .report-btn { background: #1f2937; color: #cbd5e1; border: 1px solid #374151; border-radius: 6px; cursor: pointer; opacity: 0.7; }
 .report-btn:hover { background: #111827; opacity: 0.9; }
 .report-menu { position: absolute; right: 0; margin-top: 6px; background: #0f172a; border: 1px solid #334155; border-radius: 8px; padding: 8px; z-index: 1000; width: min(320px, 90vw); box-shadow: 0 10px 28px rgba(0,0,0,0.35); }
 .report-menu-label { font-size: 0.9rem; color: #a3bffa; margin-bottom: 6px; }
 .report-menu-list { display: grid; gap: 6px; }
 .report-reason-btn { background: #111827; color: #e5e7eb; border: 1px solid #334155; padding: 8px 10px; border-radius: 6px; text-align: left; cursor: pointer; font-size: 0.95rem; }
 .report-reason-btn:hover { background: #0b1020; }
@media (max-width: 640px) { .info-grid { grid-template-columns: 1fr; } }

/* FAQ */
.faq { max-width: 880px; margin: 20px auto 0; display: grid; gap: 14px; }
.qa { background: #0f172a; border: 1px solid #334155; border-radius: 12px; padding: 14px; }
.qa h2 { margin: 0 0 6px; font-size: 1.1rem; }
.qa p { margin: 0; color: #cbd5e1; line-height: 1.6; text-align: justify; }
.qa p + p { margin-top: 10px; }
.qa a { color: #93c5fd; text-decoration: none; }
.qa a:visited { color: #93c5fd; }
.qa a:hover { color: #bfdbfe; text-decoration: underline; }

/* Contact */
.contact { display: flex; justify-content: center; margin-top: 20px; }
.contact-card { max-width: 760px; background: #0f172a; border: 1px solid #334155; border-radius: 12px; padding: 18px; }
.contact-card a { color: #93c5fd; text-decoration: none; }
.contact-card a:hover { text-decoration: underline; }
/* Justify paragraphs on contact page */
.contact-card p { text-align: justify; }
.support { display: flex; justify-content: center; margin-top: 18px; }
.support-card { max-width: 760px; background: #0f172a; border: 1px solid #334155; border-radius: 12px; padding: 18px; }
.support-card h2 { margin-top: 0; font-size: 1.1rem; }
.support-card p { margin: 0; color: #cbd5e1; line-height: 1.6; text-align: justify; }
.support-card p + p { margin-top: 10px; }

/* Topic intro overlay */
.topic-intro { position: fixed; inset: 0; display: none; align-items: center; justify-content: center; z-index: 2147483646; /* ensure above */
	background: linear-gradient(to bottom, rgba(11,16,32,0.9), rgba(11,16,32,0.96))
							, radial-gradient(1200px 600px at 50% -10%, rgba(59,130,246,0.28), rgba(11,16,32,0.98));
	backdrop-filter: blur(2px) saturate(1.1);
	opacity: 0; transition: opacity .4s ease;
}
.topic-intro.fade-in { opacity: 1; }
.topic-intro.fade-out { opacity: 0; }
.topic-intro-inner { text-align: center; padding: 28px 24px; border-radius: 16px; border: 1px solid #334155; background: rgba(15,23,42,0.85);
	box-shadow: 0 20px 60px rgba(2,6,23,0.6), inset 0 0 0 1px rgba(148,163,184,0.12);
}
.topic-intro-label { font-size: 1.25rem; font-weight: 800; color: #93c5fd; letter-spacing: .3px; margin-bottom: 10px; text-transform: uppercase; }
.topic-intro-title { font-size: 2rem; font-weight: 900; color: #e5e7eb; }

/* Utility */
.hidden { display: none !important; }

/* Mobile nav wrapping and right alignment */
@media (max-width: 560px) {
	.nav-inner { row-gap: 10px; }
	.brand { flex: 1 1 100%; justify-content: center; text-align: center; }
	.links { flex: 1 1 100%; justify-content: center; gap: 12px; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; }
	.links a { margin-left: 0; flex: 0 0 auto; }
	.links .nav-icon { width: 16px; height: 16px; }
}

/* Spectator (TV/Projector) scaling */
body.spectator .container { max-width: 1280px; }
body.spectator h1 { font-size: clamp(1.8rem, 3.2vw, 3rem); }
/* ~30% smaller logo on spectator page */
body.spectator .page-logo img { width: clamp(238px, 26.6vw, 392px); }
body.spectator .page-logo .subtitle { font-size: clamp(1rem, 1.6vw, 1.25rem); }
body.spectator .room-title { font-size: clamp(1.4rem, 2.4vw, 2.1rem); }
body.spectator .topic { font-size: clamp(1.6rem, 2.6vw, 2.2rem); }
body.spectator #question, body.spectator .question { font-size: clamp(1.4rem, 2.2vw, 2rem); line-height: 1.5; font-weight: 400; }
body.spectator .answers { gap: 18px; }
body.spectator .answers button { font-size: clamp(1.25rem, 2.1vw, 1.7rem); padding: 16px 22px; border-radius: 12px; }
body.spectator #players { font-size: clamp(1.05rem, 1.6vw, 1.4rem); }
body.spectator .note { font-size: clamp(1rem, 1.6vw, 1.25rem); }
/* Scale topic intro overlay in spectator mode */
body.spectator .topic-intro-title { font-size: clamp(2.2rem, 4vw, 3.2rem); }
body.spectator .topic-intro-label { font-size: clamp(1.2rem, 2.2vw, 1.6rem); }

/* Admin tables */
.table-wrap { overflow-x: auto; border: 1px solid #1f2937; border-radius: 10px; }
.admin-table { width: 100%; border-collapse: collapse; background: #0f172a; color: #e5e7eb; }
.admin-table th, .admin-table td { border-bottom: 1px solid #1f2937; padding: 10px 12px; vertical-align: top; text-align: left; }
.admin-table thead th { background: #111827; position: sticky; top: 0; z-index: 1; }
.admin-table tr:hover td { background: rgba(255,255,255,0.02); }
.answers-list { margin: 0; padding-left: 18px; }
.reasons-list { margin: 0; padding-left: 18px; }

/* Admin top nav */
.admin-nav { position: sticky; top: 0; z-index: 20; background: rgba(10,15,30,0.9); border-bottom: 1px solid #1f2937; backdrop-filter: blur(6px) saturate(1.1); }
.admin-nav-inner { max-width: 980px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; padding: 10px 16px; }
.admin-brand-link { color: #e5e7eb; text-decoration: none; font-weight: 800; letter-spacing: .2px; }
.admin-links a { color: #cbd5e1; text-decoration: none; margin-left: 14px; font-weight: 700; }
.admin-links a:hover { color: #ffffff; }
