/*
 * Science Fiction Quiz Game V2: front-end styles.
 * Phase 1 scaffold: app shell, boot state and prompt banner.
 * The full game presentation layer arrives in Phase 4.
 */

.sfqg-app {
	--sfqg-bg: #101318;
	--sfqg-surface: #1a1f27;
	--sfqg-text: #e8e6df;
	--sfqg-muted: #9aa0a8;
	--sfqg-metal: #c8ccd2;
	--sfqg-brass: #c9a05a;
	--sfqg-accent: #4fa8ff;
	--sfqg-glow: rgba(79, 168, 255, 0.55);
	position: relative;
	box-sizing: border-box;
	width: 100%;
	min-height: 420px;
	margin: 1.5em 0;
	border-radius: 14px;
	background: radial-gradient(1200px 600px at 50% -10%, #1c2230 0%, var(--sfqg-bg) 60%);
	color: var(--sfqg-text);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", Arial, sans-serif;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 24px 16px 48px;
}

.sfqg-app * { box-sizing: border-box; }

.sfqg-noscript { padding: 2em; text-align: center; color: var(--sfqg-muted); }

/* Boot spinner shown until the engine takes over */
.sfqg-boot { display: flex; align-items: center; justify-content: center; padding: 40px 0; }
.sfqg-boot-ring {
	width: 64px; height: 64px; border-radius: 50%;
	border: 2px solid rgba(200, 204, 210, 0.25);
	border-top-color: var(--sfqg-brass);
	animation: sfqg-spin 1.1s linear infinite;
	box-shadow: 0 0 18px rgba(201, 160, 90, 0.25);
}
@keyframes sfqg-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
	.sfqg-boot-ring { animation: none; }
}

/* Phase 1 placeholder card rendered by the engine stub */
.sfqg-scaffold-card {
	max-width: 560px; text-align: center;
	background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01));
	border: 1px solid rgba(200, 204, 210, 0.18);
	border-radius: 12px;
	padding: 28px 26px;
	box-shadow: 0 10px 40px rgba(0,0,0,0.45);
}
.sfqg-scaffold-card h2 {
	margin: 0 0 8px; font-size: 1.35em; letter-spacing: 0.04em;
	color: var(--sfqg-metal);
}
.sfqg-scaffold-card p { margin: 0.5em 0; color: var(--sfqg-muted); line-height: 1.55; }
.sfqg-scaffold-status { margin-top: 14px; font-size: 0.85em; color: var(--sfqg-brass); }

/* Fixed footer title */
.sfqg-footer-title {
	/* Normal flow, after the game content. Never absolutely position this:
	   in fullscreen the app box is pinned to one screen height while its
	   content scrolls, so an absolute "bottom" lands one screen down,
	   mid-content, between question choices on small screens. */
	margin-top: 22px;
	text-align: center; font-size: 12px; letter-spacing: 0.12em;
	color: var(--sfqg-muted); text-transform: none;
	pointer-events: none;
}

/* [sfqg_prompt] chapter teaser banner */
.sfqg-prompt {
	display: flex; align-items: center; justify-content: space-between; gap: 16px;
	margin: 1.5em 0; padding: 16px 20px;
	border-radius: 12px;
	background: linear-gradient(120deg, #14181f 0%, #1d232e 100%);
	border: 1px solid rgba(201, 160, 90, 0.35);
	color: #e8e6df;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Ubuntu, "Helvetica Neue", Arial, sans-serif;
}
.sfqg-prompt-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.sfqg-prompt-kicker { font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: #c9a05a; }
.sfqg-prompt-title { font-weight: 600; }
.sfqg-prompt-sub { font-size: 0.9em; color: #9aa0a8; }
.sfqg-prompt-cta {
	flex: 0 0 auto;
	padding: 10px 22px; border-radius: 999px;
	background: #c9a05a; color: #14181f !important;
	text-decoration: none; font-weight: 600; letter-spacing: 0.04em;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.sfqg-prompt-cta:hover, .sfqg-prompt-cta:focus-visible {
	transform: translateY(-1px);
	box-shadow: 0 6px 18px rgba(201, 160, 90, 0.35);
}
.sfqg-prompt-ch1 { border-color: rgba(79, 168, 255, 0.4); }
.sfqg-prompt-ch2 { border-color: rgba(255, 180, 84, 0.4); }
.sfqg-prompt-ch3 { border-color: rgba(180, 140, 255, 0.4); }
.sfqg-prompt-ch4 { border-color: rgba(95, 214, 138, 0.4); }

@media (max-width: 520px) {
	.sfqg-prompt { flex-direction: column; align-items: flex-start; }
}

/* ---------------------------------------------------------------
 * Phase 2: functional interface styles (refined visually in Phase 4)
 * --------------------------------------------------------------- */

.sfqg-stage { width: 100%; max-width: 640px; }
.sfqg-screen { animation: sfqg-fade 0.35s ease; }
@keyframes sfqg-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .sfqg-screen { animation: none; } }

.sfqg-live {
	position: absolute; width: 1px; height: 1px; overflow: hidden;
	clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap;
}

.sfqg-title { margin: 0 0 10px; font-size: 1.5em; letter-spacing: 0.04em; color: var(--sfqg-metal); text-align: center; }
.sfqg-sub { color: var(--sfqg-muted); text-align: center; line-height: 1.6; }
.sfqg-bands { font-size: 0.85em; color: var(--sfqg-brass); text-align: center; margin: 14px 0 22px; }
.sfqg-note { color: var(--sfqg-muted); font-size: 0.92em; line-height: 1.55; }

.sfqg-btn {
	display: block; width: 100%; margin: 10px 0; padding: 13px 18px;
	border-radius: 10px; border: 1px solid rgba(200, 204, 210, 0.22);
	background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.015));
	color: var(--sfqg-text); font-size: 1em; line-height: 1.4; text-align: left;
	cursor: pointer; transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.1s ease;
}
.sfqg-btn:hover, .sfqg-btn:focus-visible {
	border-color: var(--sfqg-accent);
	box-shadow: 0 0 0 1px var(--sfqg-accent), 0 6px 20px rgba(0,0,0,0.35);
	outline: none;
}
.sfqg-btn:active { transform: translateY(1px); }
.sfqg-btn-primary {
	background: linear-gradient(180deg, var(--sfqg-brass), #a8813f);
	border-color: transparent; color: #14181f; font-weight: 600; text-align: center;
}
.sfqg-btn-primary:hover, .sfqg-btn-primary:focus-visible { box-shadow: 0 0 0 2px rgba(201,160,90,0.5), 0 6px 20px rgba(0,0,0,0.35); }
.sfqg-btn-ghost { background: transparent; text-align: center; color: var(--sfqg-muted); }
.sfqg-btn-danger:hover, .sfqg-btn-danger:focus-visible { border-color: #d9645a; box-shadow: 0 0 0 1px #d9645a; }
.sfqg-btn-chapter.sfqg-done { opacity: 0.75; }
.sfqg-btn-chapter.sfqg-done::after { content: " \2713"; color: var(--sfqg-brass); }

.sfqg-head {
	display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: space-between;
	font-size: 0.82em; color: var(--sfqg-muted); letter-spacing: 0.06em;
	margin-bottom: 14px; border-bottom: 1px solid rgba(200,204,210,0.14); padding-bottom: 10px;
}
.sfqg-insight { color: var(--sfqg-brass); }

.sfqg-scene-title { margin: 0 0 8px; font-size: 1.2em; color: var(--sfqg-metal); }
.sfqg-scene { line-height: 1.65; }

.sfqg-choices { margin-top: 18px; }

.sfqg-feedback-good { color: #7ed9a0; margin: 0 0 6px; }
.sfqg-feedback-miss { color: #e0a25e; margin: 0 0 6px; }
.sfqg-feedback-neutral { color: var(--sfqg-metal); margin: 0 0 6px; }
.sfqg-unlocked { color: var(--sfqg-accent); font-weight: 600; }

.sfqg-inspired {
	margin: 16px 0; padding: 12px 16px; border-radius: 10px;
	border: 1px solid rgba(201,160,90,0.35); background: rgba(201,160,90,0.06);
}
.sfqg-inspired h4 { margin: 0 0 4px; font-size: 0.78em; letter-spacing: 0.16em; text-transform: uppercase; color: var(--sfqg-brass); }
.sfqg-inspired-meta { margin: 0 0 4px; font-weight: 600; }

.sfqg-go-deeper { display: inline-block; margin: 6px 0 12px; color: var(--sfqg-accent); }

.sfqg-puzzle-fallback { margin-top: 16px; }
.sfqg-hint-line { min-height: 1.4em; color: var(--sfqg-brass); font-size: 0.9em; }

.sfqg-rating { text-align: center; font-size: 1.1em; color: var(--sfqg-metal); }
.sfqg-tone { text-align: center; color: var(--sfqg-brass); letter-spacing: 0.06em; }
.sfqg-ending { line-height: 1.65; }

.sfqg-axes { margin: 18px 0; }
.sfqg-axis { display: grid; grid-template-columns: 74px 1fr; gap: 4px 12px; align-items: center; margin: 10px 0; }
.sfqg-axis-label { font-size: 0.85em; color: var(--sfqg-metal); letter-spacing: 0.06em; }
.sfqg-axis-bar { position: relative; height: 8px; border-radius: 4px; background: rgba(200,204,210,0.15); overflow: hidden; }
.sfqg-axis-fill { position: absolute; top: 0; bottom: 0; background: var(--sfqg-accent); border-radius: 4px; }
.sfqg-axis-ends { grid-column: 2; font-size: 0.75em; color: var(--sfqg-muted); }

.sfqg-archetype { text-align: center; margin: 18px 0; }
.sfqg-archetype h3 { margin: 0 0 4px; font-size: 1.35em; color: var(--sfqg-brass); letter-spacing: 0.05em; }

.sfqg-email { margin: 20px 0; padding: 16px; border-radius: 10px; border: 1px solid rgba(200,204,210,0.2); }
.sfqg-email h4 { margin: 0 0 6px; color: var(--sfqg-metal); }
.sfqg-email-input {
	width: 100%; padding: 11px 14px; margin: 8px 0; border-radius: 8px;
	border: 1px solid rgba(200,204,210,0.3); background: rgba(0,0,0,0.25); color: var(--sfqg-text);
}
.sfqg-email-input:focus-visible { outline: none; border-color: var(--sfqg-accent); }
.sfqg-hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.sfqg-email-status { min-height: 1.3em; font-size: 0.9em; color: var(--sfqg-brass); }

/* Phase 3: codex, archetype detail, signal checks */
.sfqg-codex-entry {
	margin: 12px 0; padding: 12px 16px; border-radius: 10px;
	border: 1px solid rgba(200,204,210,0.18); background: rgba(255,255,255,0.02);
}
.sfqg-codex-entry h4 { margin: 0 0 4px; color: var(--sfqg-brass); }
.sfqg-arch-desc { line-height: 1.6; text-align: left; }
.sfqg-arch-links { margin-top: 10px; }
.sfqg-arch-links h4 { margin: 0 0 4px; font-size: 0.78em; letter-spacing: 0.14em; text-transform: uppercase; color: var(--sfqg-brass); }
.sfqg-arch-links a { display: block; margin: 4px 0; }
.sfqg-screen-scenario .sfqg-scene-title { text-transform: none; }

/* ---------------------------------------------------------------
 * Phase 4: presentation layer
 * --------------------------------------------------------------- */

/* Controls */
.sfqg-controls {
	display: flex; justify-content: space-between; align-items: center;
	width: 100%; max-width: 640px; margin-bottom: 6px; gap: 8px;
}
.sfqg-controls-left, .sfqg-controls-right { display: flex; gap: 8px; }
.sfqg-ctl {
	padding: 6px 12px; font-size: 0.78em; letter-spacing: 0.06em;
	border-radius: 999px; border: 1px solid rgba(200,204,210,0.25);
	background: rgba(255,255,255,0.03); color: var(--sfqg-muted); cursor: pointer;
}
.sfqg-ctl:hover, .sfqg-ctl:focus-visible { border-color: var(--sfqg-accent); color: var(--sfqg-text); outline: none; }

/* Fullscreen (real and iOS faux) */
.sfqg-app:fullscreen { width: 100vw; height: 100vh; overflow-y: auto; padding: 24px; }
.sfqg-faux-full {
	position: fixed !important; inset: 0; z-index: 99999;
	overflow-y: auto; padding: 24px; margin: 0 !important; border-radius: 0 !important;
}

/* Title emblem */
.sfqg-emblem { display: flex; justify-content: center; margin: 4px 0 14px; }
.sfqg-emblem-svg { width: 130px; height: 130px; }
.sfqg-emblem-ring { fill: none; stroke: var(--sfqg-metal); stroke-width: 2; opacity: 0.8; }
.sfqg-emblem-r2 { stroke: var(--sfqg-brass); stroke-width: 3; }
.sfqg-emblem-crystal { fill: var(--sfqg-accent); }
.sfqg-emblem-beam { stroke: var(--sfqg-accent); stroke-width: 2; opacity: 0.7; }
.sfqg-app:not(.sfqg-reduced) .sfqg-emblem-ring {
	stroke-dasharray: 560; stroke-dashoffset: 560;
	animation: sfqg-draw 1.4s ease forwards;
}
.sfqg-app:not(.sfqg-reduced) .sfqg-emblem-r2 { animation-delay: 0.2s; }
.sfqg-app:not(.sfqg-reduced) .sfqg-emblem-r3 { animation-delay: 0.4s; }
.sfqg-app:not(.sfqg-reduced) .sfqg-emblem-crystal { animation: sfqg-bloom 0.8s ease 1s backwards; }
@keyframes sfqg-draw { to { stroke-dashoffset: 0; } }
@keyframes sfqg-bloom { from { opacity: 0; transform: scale(0.4); transform-origin: center; } }

/* Map art */
.sfqg-map-art { margin: 0 0 14px; }
.sfqg-map-svg { width: 100%; height: auto; display: block; }
.sfqg-map-path { fill: none; stroke: rgba(200,204,210,0.35); stroke-width: 1.5; stroke-dasharray: 5 6; }
.sfqg-map-crystal { opacity: 0.45; stroke: rgba(255,255,255,0.35); stroke-width: 1; }
.sfqg-map-done .sfqg-map-crystal { opacity: 1; }
.sfqg-app:not(.sfqg-reduced) .sfqg-map-done .sfqg-map-crystal { animation: sfqg-crystal-glow 2.6s ease-in-out infinite; }
@keyframes sfqg-crystal-glow { 0%, 100% { opacity: 0.85; } 50% { opacity: 1; } }

/* Puzzle artifacts */
.sfqg-puzzle-stage { display: flex; justify-content: center; margin: 12px 0; }
.sfqg-pz { width: 100%; max-width: 340px; height: auto; }
.sfqg-pz-frame { fill: rgba(255,255,255,0.02); stroke: rgba(200,204,210,0.3); stroke-width: 2; }
.sfqg-pz-etch { fill: none; stroke: var(--sfqg-metal); stroke-width: 3; stroke-linecap: round; opacity: 0.75; }
.sfqg-pz-tick { stroke: var(--sfqg-brass); stroke-width: 3; stroke-linecap: round; }
.sfqg-pz-plate { fill: rgba(201,160,90,0.08); stroke: rgba(201,160,90,0.5); stroke-width: 1.5; }
.sfqg-pz-crystal { fill: var(--sfqg-accent); opacity: 0.5; }
.sfqg-pz-crystal-lit, .sfqg-pz-solved .sfqg-pz-crystal { opacity: 1; }
.sfqg-pz-lensring { fill: rgba(180,140,255,0.04); stroke: rgba(200,204,210,0.4); stroke-width: 2; }
.sfqg-pz-gearbody { fill: rgba(255,255,255,0.03); stroke: var(--sfqg-metal); stroke-width: 2; }
.sfqg-pz-tooth { stroke: var(--sfqg-metal); stroke-width: 4; }
.sfqg-pz-needle { stroke: var(--sfqg-brass); stroke-width: 3; stroke-linecap: round; }
.sfqg-pz-glyph { fill: var(--sfqg-accent); opacity: 0; }
.sfqg-pz-glyph-on { opacity: 1; }
.sfqg-pz-beam { stroke: var(--sfqg-accent); stroke-width: 3; opacity: 0; stroke-linecap: round; }
.sfqg-pz-beam-on { opacity: 1; }

.sfqg-pz-el { cursor: pointer; outline: none; }
.sfqg-pz-el:focus-visible .sfqg-pz-etch,
.sfqg-pz-el:focus-visible .sfqg-pz-gearbody,
.sfqg-pz-el:focus-visible .sfqg-pz-lensring,
.sfqg-pz-el:focus-visible .sfqg-pz-plate { stroke: var(--sfqg-accent); }
.sfqg-pz-el.sfqg-pz-aligned .sfqg-pz-etch { stroke: var(--sfqg-accent); opacity: 1; }
.sfqg-pz-el.sfqg-pz-aligned .sfqg-pz-tick { stroke: var(--sfqg-accent); }
/* NOTE: never attach CSS transitions to the puzzle transform attributes.
   Rotation is animated in JavaScript via SVG attribute writes; a CSS
   transition on transform makes some browsers rotate the elements around
   the canvas origin and throw them off-screen. Opacity transitions below
   are safe. */
.sfqg-app:not(.sfqg-reduced) .sfqg-pz-glyph,
.sfqg-app:not(.sfqg-reduced) .sfqg-pz-beam { transition: opacity 0.7s ease; }
.sfqg-pz-hint { animation: sfqg-hint-pulse 1.2s ease; }
.sfqg-reduced .sfqg-pz-hint { animation: none; }
.sfqg-reduced .sfqg-pz-hint .sfqg-pz-etch { stroke: var(--sfqg-brass); opacity: 1; }
@keyframes sfqg-hint-pulse { 0%, 100% { opacity: 1; } 30%, 70% { opacity: 0.35; } }
.sfqg-app:not(.sfqg-reduced) .sfqg-pz-solved { animation: sfqg-solved-glow 0.9s ease; }
@keyframes sfqg-solved-glow { 30% { filter: drop-shadow(0 0 14px var(--sfqg-accent)); } 100% { filter: none; } }

/* Ending tone washes */
.sfqg-tone-dawn { background: linear-gradient(180deg, rgba(95,214,138,0.07), transparent 42%); border-radius: 12px; }
.sfqg-tone-longshadow { background: linear-gradient(180deg, rgba(217,100,90,0.07), transparent 42%); border-radius: 12px; }
.sfqg-tone-crossroads { background: linear-gradient(180deg, rgba(201,160,90,0.06), transparent 42%); border-radius: 12px; }

/* Share */
.sfqg-share { margin: 14px 0; }

/* Motion discipline: the admin/OS setting silences every animation. */
.sfqg-reduced *, .sfqg-reduced *::before, .sfqg-reduced *::after {
	animation-duration: 0.001s !important;
	animation-iteration-count: 1 !important;
	transition-duration: 0.001s !important;
}

/* Seven Braziers (transform-free Prometheus Ring) */
.sfqg-pz-railring { fill: none; stroke: rgba(200,204,210,0.18); stroke-width: 1.5; }
.sfqg-pz-spoke { stroke: rgba(200,204,210,0.35); stroke-width: 1.5; }
.sfqg-pz-brazier-arc { opacity: 0.5; }
.sfqg-pz-bowl { fill: rgba(255,255,255,0.03); stroke: var(--sfqg-metal); stroke-width: 2; }
.sfqg-pz-flame { fill: rgba(200,204,210,0.25); }
.sfqg-pz-brazier.sfqg-pz-lit .sfqg-pz-flame { fill: var(--sfqg-accent); }
.sfqg-pz-brazier.sfqg-pz-lit .sfqg-pz-bowl { stroke: var(--sfqg-brass); }
.sfqg-pz-brazier.sfqg-pz-lit .sfqg-pz-brazier-arc { stroke: var(--sfqg-accent); opacity: 1; }
.sfqg-pz-brazier.sfqg-pz-lit .sfqg-pz-spoke { stroke: var(--sfqg-brass); }

/* Armour: block ANY externally-imposed transition or transform (e.g. a
   theme's global "transition: all" rule) from touching puzzle moving
   parts. This is what re-broke rotation after 2.3.2 on some themes. */
.sfqg-pz g, .sfqg-pz path, .sfqg-pz line, .sfqg-pz circle, .sfqg-pz rect {
	transition: none !important;
}
/* Opacity fades cannot displace geometry, so they are safe to restore. */
.sfqg-app:not(.sfqg-reduced) .sfqg-pz .sfqg-pz-glyph,
.sfqg-app:not(.sfqg-reduced) .sfqg-pz .sfqg-pz-beam { transition: opacity 0.7s ease !important; }
