:root {
	--bg: #0a0e16;
	--bg2: #10161f;
	--panel: #141b28;
	--panel-border: #263042;
	--text: #e9edf5;
	--muted: #8a93a8;
	--hope: #5ecbf5;
	--hope-glow: rgba(94, 203, 245, 0.55);
	--fear: #ff3b5c;
	--fear-glow: rgba(255, 59, 92, 0.55);
	--accent: #f5c542;
}

* { box-sizing: border-box; }

html, body {
	margin: 0;
	padding: 0;
	min-height: 100vh;
	background: radial-gradient(ellipse at 50% 0%, #131c2c 0%, var(--bg) 55%, #05070c 100%);
	color: var(--text);
	font-family: "Inter", -apple-system, "Segoe UI", sans-serif;
	overflow-x: hidden;
}

body {
	position: relative;
	min-height: 100vh;
}

/* film-grain + scanline overlay, purely decorative, fixed to viewport */
body::before,
body::after {
	content: "";
	position: fixed;
	inset: 0;
	pointer-events: none;
	z-index: 50;
}

body::before {
	background: repeating-linear-gradient(
		to bottom,
		rgba(255, 255, 255, 0.025) 0px,
		rgba(255, 255, 255, 0.025) 1px,
		transparent 1px,
		transparent 3px
	);
	mix-blend-mode: overlay;
	opacity: 0.5;
}

body::after {
	background: radial-gradient(ellipse at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.55) 100%);
}

#app {
	position: relative;
	z-index: 1;
	min-height: 100vh;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 2rem 1rem;
}

.screen {
	width: 100%;
	max-width: 780px;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 1.25rem;
	animation: fade-in 0.5s ease both;
}

@keyframes fade-in {
	from { opacity: 0; transform: translateY(6px); }
	to { opacity: 1; transform: translateY(0); }
}

h1, h2, h3 {
	font-family: "Special Elite", "Courier New", monospace;
	letter-spacing: 0.02em;
	margin: 0;
}

p { line-height: 1.6; margin: 0 0 0.75rem; }
.muted { color: var(--muted); }

/* ---------------------------------------------------------------- buttons */
.btn {
	font-family: "Inter", sans-serif;
	font-size: 0.95rem;
	color: var(--text);
	background: var(--panel);
	border: 1px solid var(--panel-border);
	border-radius: 8px;
	padding: 0.75rem 1.4rem;
	cursor: pointer;
	transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
}

.btn:hover:not(:disabled) {
	border-color: var(--hope);
	box-shadow: 0 0 14px var(--hope-glow);
	transform: translateY(-1px);
}

.btn:active:not(:disabled) { transform: translateY(0); }

.btn:disabled, .btn.disabled {
	opacity: 0.35;
	cursor: not-allowed;
}

.btn-primary {
	background: linear-gradient(160deg, #1c3a52, #14202f);
	border-color: var(--hope);
	box-shadow: 0 0 18px var(--hope-glow);
}

.btn-ghost { background: transparent; }

.btn-choice { width: 100%; text-align: left; }

/* ----------------------------------------------------------------- title */
.screen-title { text-align: center; position: relative; padding-top: 4rem; }

.title-fog {
	position: absolute;
	inset: -4rem -2rem auto -2rem;
	height: 16rem;
	background: radial-gradient(ellipse at 50% 30%, rgba(94, 203, 245, 0.12), transparent 70%);
	filter: blur(4px);
	z-index: -1;
}

.title-logo {
	font-size: clamp(3rem, 10vw, 5.5rem);
	color: var(--text);
	text-shadow: 0 0 12px var(--hope-glow), 0 0 40px rgba(94, 203, 245, 0.25), 0 0 2px #fff;
	letter-spacing: 0.08em;
}

.title-sub {
	color: var(--muted);
	font-family: "Special Elite", monospace;
	letter-spacing: 0.15em;
	text-transform: uppercase;
	font-size: 0.85rem;
}

.title-menu { display: flex; flex-direction: column; gap: 0.75rem; margin-top: 1.5rem; width: 220px; }

.title-note { color: var(--muted); font-size: 0.8rem; margin-top: 2rem; }

/* ------------------------------------------------------------ class select */
.class-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
	gap: 0.75rem;
	width: 100%;
}

.class-card {
	background: var(--panel);
	border: 1px solid var(--panel-border);
	border-radius: 10px;
	padding: 1rem 0.75rem;
	color: var(--text);
	text-align: center;
	cursor: pointer;
	transition: border-color 0.15s, box-shadow 0.15s;
}

.class-card:hover, .class-card.active {
	border-color: var(--accent, var(--hope));
	box-shadow: 0 0 16px color-mix(in srgb, var(--accent) 40%, transparent);
}

.class-card h3 { font-size: 1rem; margin: 0.5rem 0 0.25rem; }
.class-tagline { font-size: 0.78rem; color: var(--muted); min-height: 2.2em; }
.class-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.4rem; font-size: 0.7rem; color: var(--muted); }

.class-detail {
	background: var(--panel);
	border: 1px solid var(--panel-border);
	border-radius: 10px;
	padding: 1rem 1.25rem;
	width: 100%;
	min-height: 4rem;
}

.ability-line { color: var(--hope); font-size: 0.9rem; }

/* --------------------------------------------------------------- hope/fear */
.hopefear { display: flex; align-items: center; gap: 0.5rem; width: 100%; max-width: 340px; }
.hf-label { font-size: 0.65rem; letter-spacing: 0.1em; font-family: "Special Elite", monospace; }
.hf-hope { color: var(--hope); }
.hf-fear { color: var(--fear); }
.hf-bar {
	flex: 1;
	height: 6px;
	border-radius: 3px;
	background: var(--fear);
	box-shadow: inset 0 0 4px rgba(0,0,0,0.4);
	overflow: hidden;
}
.hf-fill {
	height: 100%;
	background: var(--hope);
	box-shadow: 0 0 8px var(--hope-glow);
	transition: width 0.4s ease;
}

/* ------------------------------------------------------------------ story */
.story-box {
	background: var(--panel);
	border: 1px solid var(--panel-border);
	border-radius: 12px;
	padding: 1.5rem;
	width: 100%;
	box-shadow: 0 0 24px rgba(0,0,0,0.4);
}

.story-box.narration { font-style: italic; color: #cdd4e2; border-left: 3px solid var(--hope); }
.story-box.dialogue { border-left: 3px solid var(--accent); }

.story-portrait { float: left; margin: 0 1rem 0.5rem 0; }
.speaker {
	font-family: "Special Elite", monospace;
	color: var(--accent);
	text-transform: uppercase;
	letter-spacing: 0.08em;
	font-size: 0.85rem;
	margin-bottom: 0.4rem;
}

.choice-list { display: flex; flex-direction: column; gap: 0.5rem; margin-top: 1rem; }

/* -------------------------------------------------------------------- hub */
.hub-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	gap: 1rem;
	flex-wrap: wrap;
}

.hub-player { display: flex; align-items: center; gap: 0.6rem; }
.hub-player-name { font-family: "Special Elite", monospace; font-size: 0.85rem; }
.hub-player-hp { color: var(--muted); font-size: 0.75rem; }

.hub-grid { display: grid; gap: 0.75rem; width: 100%; }

.hub-node {
	background: var(--panel);
	border: 1px solid var(--panel-border);
	border-radius: 10px;
	padding: 1rem 1.25rem;
	text-align: left;
	color: var(--text);
	cursor: pointer;
	transition: border-color 0.15s, box-shadow 0.15s;
}

.hub-node:hover:not(:disabled) { border-color: var(--hope); box-shadow: 0 0 14px var(--hope-glow); }
.hub-node h3 { font-size: 1rem; margin-bottom: 0.25rem; }
.hub-node p { font-size: 0.85rem; color: var(--muted); margin-bottom: 0.5rem; }
.hub-node .hub-status { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--hope); }
.hub-node.done .hub-status { color: var(--muted); }
.hub-node.locked { opacity: 0.4; cursor: not-allowed; }
.hub-node.locked .hub-status { color: var(--fear); }

/* --------------------------------------------------------------- combat */
.combat-arena {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 1.25rem;
	width: 100%;
	flex-wrap: wrap;
}

.combat-vs {
	font-family: "Special Elite", monospace;
	color: var(--muted);
	font-size: 1.2rem;
}

.combat-card {
	background: var(--panel);
	border: 1px solid var(--panel-border);
	border-radius: 14px;
	padding: 1.25rem 1rem;
	width: 15rem;
	text-align: center;
	position: relative;
	box-shadow: inset 0 0 12px rgba(0,0,0,0.3), 0 0 0 rgba(0,0,0,0);
}

.combat-card.player { border-color: color-mix(in srgb, var(--accent) 60%, var(--panel-border)); }
.combat-card.enemy { border-color: color-mix(in srgb, var(--fear) 50%, var(--panel-border)); }
.combat-card.boss { box-shadow: 0 0 26px var(--fear-glow), inset 0 0 12px rgba(0,0,0,0.4); }

.boss-tag {
	position: absolute;
	top: -0.6rem;
	left: 50%;
	transform: translateX(-50%);
	background: var(--fear);
	color: #1a0508;
	font-size: 0.65rem;
	font-weight: 700;
	letter-spacing: 0.08em;
	padding: 0.15rem 0.6rem;
	border-radius: 999px;
	text-transform: uppercase;
}

.combat-card h3 { margin: 0.5rem 0; font-size: 1rem; }
.stat-row { font-size: 0.75rem; color: var(--muted); margin-bottom: 0.2rem; }
.stat-row.energy { color: var(--hope); }

.status-tags { display: flex; flex-wrap: wrap; gap: 0.3rem; justify-content: center; margin-top: 0.5rem; }
.status-tags span {
	font-size: 0.65rem;
	background: rgba(255,255,255,0.06);
	border: 1px solid var(--panel-border);
	border-radius: 999px;
	padding: 0.1rem 0.5rem;
}

.health-bar-outer {
	background: #0c0f16;
	height: 8px;
	border-radius: 4px;
	overflow: hidden;
	margin: 0.3rem 0 0.5rem;
	border: 1px solid rgba(0,0,0,0.5);
}
.health-bar-inner { height: 100%; background: #4a9b5e; transition: width 0.4s ease; }
.health-bar-inner.danger { background: var(--fear); box-shadow: 0 0 8px var(--fear-glow); }

.combat-log {
	background: rgba(0,0,0,0.3);
	border: 1px solid var(--panel-border);
	border-radius: 8px;
	padding: 0.75rem 1rem;
	width: 100%;
	font-size: 0.85rem;
	color: #cdd4e2;
	min-height: 3.5rem;
}
.combat-log p { margin: 0.1rem 0; }
.combat-log p:first-child { color: var(--text); font-weight: 600; }

.combat-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; width: 100%; }

/* --------------------------------------------------------- result / end */
.screen-result, .screen-end { text-align: center; }

.screen-end.end-hope .story-box { border-left: 3px solid var(--hope); }
.screen-end.end-fear .story-box { border-left: 3px solid var(--fear); }

.end-stats { color: var(--muted); font-size: 0.85rem; }

/* --------------------------------------------------------------- sigils */
.sigil { display: block; margin: 0 auto; }

@media (max-width: 480px) {
	.title-menu { width: 100%; }
	.story-portrait { float: none; margin: 0 auto 0.75rem; text-align: center; }
}
