:root {
	font-family: Inter, "Noto Sans KR", "Segoe UI", sans-serif;
	color: #f7f4ff;
	background: #090b12;
	font-synthesis: none;
	--ink: #f7f4ff;
	--muted: #aca8ba;
	--panel: rgba(12, 14, 28, 0.78);
	--panel-strong: rgba(8, 10, 20, 0.94);
	--line: rgba(255, 255, 255, 0.16);
	--pink: #ffabd3;
	--violet: #b6a8ff;
	--cyan: #a7ecff;
}

* {
	box-sizing: border-box;
}

html,
body {
	margin: 0;
	min-width: 320px;
	min-height: 100%;
	background: radial-gradient(circle at 50% -20%, #252a50 0, #0c0f1b 46%, #070910 100%);
}

button,
input {
	font: inherit;
}

button {
	min-height: 42px;
	padding: 0 14px;
	border: 1px solid var(--line);
	border-radius: 999px;
	color: var(--ink);
	background: rgba(255, 255, 255, 0.07);
	cursor: pointer;
}

button:hover {
	background: rgba(255, 255, 255, 0.13);
}

button:focus-visible,
input:focus-visible {
	outline: 3px solid rgba(167, 236, 255, 0.7);
	outline-offset: 3px;
}

button.primary {
	border-color: rgba(255, 171, 211, 0.48);
	background: linear-gradient(135deg, rgba(255, 171, 211, 0.28), rgba(182, 168, 255, 0.24));
	font-weight: 800;
}

.hidden {
	display: none !important;
}

.novel-shell {
	width: min(1500px, calc(100% - 24px));
	margin: 12px auto;
	display: grid;
	grid-template-columns: minmax(0, 1fr) 0;
	gap: 12px;
	transition: grid-template-columns 180ms ease;
}

.novel-shell.panel-open {
	grid-template-columns: minmax(0, 1fr) 360px;
}

.stage {
	position: relative;
	min-width: 0;
	aspect-ratio: 16 / 9;
	min-height: 620px;
	overflow: hidden;
	border: 1px solid var(--line);
	border-radius: 24px;
	background: #090b14;
	box-shadow: 0 30px 90px rgba(0, 0, 0, 0.44);
}

.background {
	position: absolute;
	inset: 0;
	background-position: center;
	background-size: cover;
	transition: background-image 320ms ease, filter 320ms ease;
}

.stage[data-theme="night-room"] .background {
	filter: brightness(0.8) saturate(0.85);
}

.vignette {
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, rgba(5, 7, 15, 0.12), rgba(5, 7, 15, 0.04) 45%, rgba(5, 7, 15, 0.68));
	pointer-events: none;
	z-index: 2;
}

.character {
	position: absolute;
	z-index: 3;
	bottom: 150px;
	height: min(73%, 700px);
	width: auto;
	filter: drop-shadow(0 22px 24px rgba(0, 0, 0, 0.34));
	transition: opacity 220ms ease, transform 220ms ease, filter 220ms ease;
}

.character-left {
	left: 2%;
}

.character-right {
	right: 2%;
}

.character.dimmed {
	opacity: 0.58;
	filter: saturate(0.72) brightness(0.78) drop-shadow(0 22px 24px rgba(0, 0, 0, 0.3));
}

.top-ui {
	position: absolute;
	z-index: 7;
	top: 0;
	left: 0;
	right: 0;
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	padding: 16px 18px 42px;
	background: linear-gradient(180deg, rgba(6, 8, 17, 0.72), transparent);
}

.title-block strong,
.title-block span {
	display: block;
}

.title-block strong {
	font-size: 0.92rem;
	letter-spacing: 0.12em;
}

.title-block span {
	margin-top: 4px;
	font-size: 0.68rem;
	letter-spacing: 0.08em;
	color: var(--cyan);
}

.toolbar {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 7px;
}

.toolbar button {
	min-height: 36px;
	padding: 0 11px;
	font-size: 0.7rem;
	font-weight: 800;
	letter-spacing: 0.05em;
	background: rgba(7, 10, 20, 0.55);
	backdrop-filter: blur(8px);
}

.toolbar button.active {
	border-color: rgba(255, 171, 211, 0.52);
	color: #ffd5e8;
}

.scene-card {
	position: absolute;
	z-index: 5;
	top: 88px;
	left: 18px;
	max-width: 48%;
	padding: 10px 13px;
	border: 1px solid rgba(255, 255, 255, 0.1);
	border-radius: 14px;
	background: rgba(8, 10, 20, 0.5);
	backdrop-filter: blur(9px);
}

.scene-card span,
.scene-card strong {
	display: block;
}

.scene-card span {
	margin-bottom: 3px;
	font-size: 0.62rem;
	font-weight: 800;
	letter-spacing: 0.1em;
	color: var(--pink);
}

.scene-card strong {
	font-size: 0.82rem;
	line-height: 1.4;
}

.textbox {
	position: absolute;
	z-index: 8;
	left: 16px;
	right: 16px;
	bottom: 16px;
	min-height: 166px;
	padding: 16px 18px 13px;
	border: 1px solid rgba(255, 255, 255, 0.17);
	border-radius: 22px;
	background: var(--panel);
	backdrop-filter: blur(13px);
	cursor: pointer;
}

.speaker-row,
.textbox-footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.speaker {
	padding: 7px 11px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.08);
	font-size: 0.82rem;
	font-weight: 800;
	color: var(--pink);
}

.progress-label,
.textbox-footer {
	font-size: 0.7rem;
	color: var(--muted);
}

.story-text {
	min-height: 76px;
	margin: 12px 0 9px;
	font-size: clamp(1rem, 1.55vw, 1.24rem);
	line-height: 1.75;
	white-space: pre-wrap;
	text-wrap: pretty;
}

.textbox.direction .story-text,
.textbox.cg .story-text {
	font-style: italic;
	color: #d8d3e3;
}

.choice-panel {
	position: absolute;
	z-index: 9;
	top: 50%;
	left: 50%;
	width: min(760px, calc(100% - 40px));
	transform: translate(-50%, -50%);
	display: grid;
	gap: 10px;
}

.choice-option {
	min-height: 64px;
	padding: 14px 18px;
	border-radius: 16px;
	background: rgba(10, 12, 25, 0.92);
	backdrop-filter: blur(14px);
	text-align: left;
	font-size: 0.96rem;
	line-height: 1.5;
}

.choice-option:hover {
	border-color: rgba(255, 171, 211, 0.55);
	background: rgba(42, 30, 56, 0.94);
}

.overlay {
	position: absolute;
	z-index: 20;
	inset: 0;
	display: grid;
	place-items: center;
	padding: 28px;
	background: rgba(5, 7, 15, 0.72);
	backdrop-filter: blur(10px);
}

.start-card,
.ending-card {
	width: min(720px, 100%);
	padding: clamp(24px, 4vw, 40px);
	border: 1px solid rgba(255, 255, 255, 0.16);
	border-radius: 24px;
	background: rgba(10, 12, 25, 0.94);
	box-shadow: 0 28px 100px rgba(0, 0, 0, 0.5);
}

.kicker {
	font-size: 0.68rem;
	font-weight: 900;
	letter-spacing: 0.16em;
	color: var(--cyan);
}

.start-card h1,
.ending-card h2 {
	margin: 6px 0 12px;
	font-size: clamp(2.6rem, 6vw, 5rem);
	line-height: 0.92;
	letter-spacing: -0.065em;
}

.start-card .intro,
.ending-card p {
	line-height: 1.65;
	color: #bbb6c9;
}

.start-stats {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 8px;
	margin: 22px 0;
}

.start-stats div {
	padding: 12px;
	border-radius: 13px;
	background: rgba(255, 255, 255, 0.05);
}

.start-stats span,
.start-stats strong {
	display: block;
}

.start-stats span {
	font-size: 0.66rem;
	color: var(--muted);
}

.start-stats strong {
	margin-top: 4px;
	font-size: 1.05rem;
}

.start-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 9px;
}

.side-panel {
	min-width: 0;
	max-height: calc(100vh - 24px);
	overflow: auto;
	padding: 17px;
	border: 1px solid var(--line);
	border-radius: 22px;
	background: var(--panel-strong);
}

.side-panel-header {
	display: flex;
	justify-content: space-between;
	gap: 12px;
	align-items: center;
	margin-bottom: 16px;
}

.side-panel-header span,
.side-panel-header strong {
	display: block;
}

.side-panel-header strong {
	margin-top: 4px;
}

.backlog {
	display: grid;
	gap: 8px;
}

.log-entry {
	padding: 10px 11px;
	border-left: 2px solid rgba(255, 171, 211, 0.36);
	background: rgba(255, 255, 255, 0.035);
}

.log-entry strong {
	display: block;
	margin-bottom: 4px;
	font-size: 0.72rem;
	color: var(--pink);
}

.log-entry p {
	margin: 0;
	font-size: 0.78rem;
	line-height: 1.55;
	color: #cbc6d5;
	white-space: pre-wrap;
}

.settings {
	display: grid;
	gap: 9px;
	margin-top: 20px;
	padding-top: 16px;
	border-top: 1px solid var(--line);
}

.settings label {
	display: flex;
	justify-content: space-between;
	gap: 10px;
	font-size: 0.75rem;
	color: var(--muted);
}

.settings input {
	width: 100%;
}

@media (max-width: 1100px) {
	.novel-shell.panel-open {
		grid-template-columns: 1fr;
	}
	.side-panel {
		max-height: none;
	}
	.stage {
		min-height: 600px;
	}
}

@media (max-width: 700px) {
	.novel-shell {
		width: min(100% - 12px, 1500px);
		margin: 6px auto;
	}
	.stage {
		min-height: 680px;
		aspect-ratio: auto;
	}
	.top-ui {
		flex-direction: column;
	}
	.toolbar {
		justify-content: flex-start;
	}
	.scene-card {
		top: 136px;
		max-width: calc(100% - 36px);
	}
	.character {
		bottom: 196px;
		height: 52%;
	}
	.textbox {
		min-height: 190px;
	}
	.start-stats {
		grid-template-columns: 1fr;
	}
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		transition-duration: 0.01ms !important;
		scroll-behavior: auto !important;
	}
}
