@charset "utf-8";
:root {
	--bg: #0f172a;
	--bg2: radial-gradient(circle at top, #1f2937 0%, #0f172a 50%, #020617 100%);
	--text: #e2e8f0;
	--sub: #94a3b8;
	--panel: rgba(15,23,42,.35);
	--radius: 18px;
}
* {
	box-sizing: border-box;
}
body {
	margin: 0;
	background: var(--bg2);
	color: var(--text);
	font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	min-height: 100vh;
}
#preloader {
	position: fixed;
	inset: 0;
	background: radial-gradient(circle at top, #318fa4 0%, #433987 100%);
	display: flex;
	flex-direction: column;
	gap: 1.1rem;
	align-items: center;
	justify-content: center;
	z-index: 9999;
	transition: opacity .6s ease;
	text-align: center;
	padding: 1rem;
}
#preloader h1 {
	margin: 0;
	font-size: clamp(1.8rem, 4vw, 2.4rem);
	letter-spacing: .04em;
}
#preloader p {
	margin: 0;
	color: rgba(226,232,240,.55);
	max-width: 460px;
	line-height: 1.5;
}
#preloader .mode-buttons {
	display: flex;
	gap: .9rem;
	flex-wrap: wrap;
	justify-content: center;
}
#preloader button {
	border: none;
	cursor: pointer;
	border-radius: 999px;
	padding: .6rem 1.4rem .7rem;
	font-size: 1.02rem;
	font-weight: 600;
	transition: transform .1s ease;
}
#preloader button:active { transform: translateY(1px); }
	#btn-white {
	background: linear-gradient(135deg,#38bdf8 0%,#0ea5e9 100%);
	color: #ecfeff;
	box-shadow: 0 8px 25px rgba(14,165,233,.35);
}
#btn-gray {
	background: linear-gradient(135deg,#94a3b8 0%,#cbd5f5 100%);
	color: #020617;
	box-shadow: 0 8px 25px rgba(148,163,184,.3);
}
#btn-dark {
	background: radial-gradient(circle at 50% 50%, #0f172a 0%, #020617 90%);
	border: 1px solid rgba(148,163,184,.25);
	color: #e2e8f0;
}
#btn-classic {
	background: linear-gradient(135deg, #f7d774 0%, #d48a00 100%);
	border: 1px solid rgba(148,163,184,.25);
	color: #fff;
}
#preloader img {
	width: 120px;
	height: 120px;
	border: 0;
	border-radius: 999px;
	background: rgba(15,23,42,.3);
	overflow: hidden;
}
#yin {
	font-size: .8rem;
	color: rgba(226,232,240,.4);
	max-width: 360px;
	line-height: 1.3;
}
body.ready #game-root {
	display: block;
}
#game-root {
	display: none;
	padding: 1rem;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	gap: 1rem;
}
header {
	display: flex;
	justify-content: space-between;
	gap: 1rem;
	flex-wrap: wrap;
	align-items: flex-start;
}
h1 {
	margin: 0;
	font-size: clamp(1.8rem, 3vw, 2.1rem);
}
.subtitle {
	color: var(--sub);
	font-size: 1rem;
	max-width: 540px;
	margin-bottom: 1rem;
}
.subtitle a {
	color: #bae6fd;
}
.legend {
	background: rgba(15,23,42,.7);
	border: 1px solid rgba(148,163,184,.12);
	border-radius: 999px;
	padding: .4rem .7rem;
	display: flex;
	gap: .6rem;
	flex-wrap: wrap;
	font-size: .9rem;
	box-shadow: 0 6px 20px rgba(15,23,42,.25);
}
.dot {
	width: 14px;
	height: 14px;
	border-radius: 999px;
	display: inline-block;
	margin-right: .3rem;
}
.layout {
	display: grid;
	grid-template-columns: 1.7fr .95fr;
	gap: 1rem;
	min-height: 0;
}
@media (max-width: 1150px) {
	.layout {
		grid-template-columns: 1fr;
	}
}
.chars {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
	gap: 1rem;
}
.char-card {
	background: radial-gradient(circle at 0 0, rgba(59,130,246,.12) 0%, rgba(15,23,42,.2) 36%, rgba(15,23,42,.1) 100%);
	border: 1px solid rgba(148,163,184,.12);
	border-radius: var(--radius);
	padding: .85rem .9rem .7rem;
	display: flex;
	flex-direction: column;
	gap: .7rem;
	transition: border .12s ease, box-shadow .12s ease, transform .12s ease;
}
.char-card.active {
	border: 1px solid rgba(56,189,248,.85);
	box-shadow: 0 0 15px rgba(56,189,248,.25);
	transform: translateY(-2px);
}
.char-head {
	display: flex; gap: .7rem;
	align-items: center;
}
.avatar {
	flex-shrink: 0;
	width: 58px;
	height: 58px;
	border-radius: 999px;
	display: grid;
	place-items: center;
	font-weight: 700;
	font-size: 1rem;
	color: #fff;
	border: 2px solid rgba(255,255,255,.15);
	box-shadow: 0 8px 18px rgba(0,0,0,.18);
}
.char-name {
	font-weight: 600;
	font-size: 1.05rem;
}
.char-role {
	color: var(--sub);
	font-size: .85rem;
}
.char-lvl {
	margin-left: auto;
	font-size: .9rem;
	color: #e2e8f0;
	background: rgba(15,23,42,.35);
	border: 1px solid rgba(148,163,184,.15);
	padding: .35rem .6rem .3rem;
	border-radius: .7rem;
}

.money-badge {
	background: rgba(15,23,42,.35);
	border: 1px solid rgba(248,250,252,.05);
	border-radius: 999px;
	padding: .15rem .55rem .2rem;
	font-size: .7rem;
	display: inline-flex;
	gap: .25rem;
	align-items: center;
}
.money-badge.negative {
	background: rgba(244,63,94,.18);
	border-color: rgba(248,113,113,.45);
	color: #fee2e2;
}
.want-row {display: flex;
	gap: .6rem;
	align-items: center;
	margin-bottom: .4rem;
}
.want-name {flex: 1 1 54%;
	font-size: .9rem;
	color: var(--sub);
	min-width: 0;
}
.badge-state {
	display: inline-block;
	padding: .15rem .6rem .2rem;
	border-radius: 999px;
	font-size: .7rem;
	margin-left: .25rem;
	white-space: nowrap;
}
.st-below {
	background: rgba(244,63,94,.16);
	color:#fecdd3;
	}
.st-4 {
	background: rgba(234,179,8,.25);
	color:#0f172a;
}
.st-5 {
	background: rgba(249,115,22,.22);
	color:#fff;
}
.st-6 {
	background: rgba(34,197,94,.23);
	color:#e2e8f0;
}
.st-7 {
	background: rgba(45,212,191,.28);
	color:#ecfeff;
}
.st-8 {
	background: rgba(59,130,246,.28);
	color:#eff6ff;
}
.st-9 {
	background: linear-gradient(90deg,#f97316,#f43f5e);
	color:#fff;
}
.spark {
	width: 110px;
	height: 36px;
	background: rgba(15,23,42,.25);
	border: 1px solid rgba(148,163,184,.05);
	border-radius: 6px;
	display: block;
}
.side {
	display: flex;
	flex-direction: column;
	gap: 1rem;
}
.panel {
	background: radial-gradient(circle at 100% 0, rgba(59,130,246,.12) 0%, rgba(15,23,42,.45) 40%, rgba(15,23,42,.45) 100%);
	border: 1px solid rgba(148,163,184,.15);
	border-radius: var(--radius);
	padding: .8rem .85rem .7rem;
	box-shadow: 0 10px 28px rgba(15,23,42,.3);
}
.panel-title {
	font-size: .95rem;
	text-transform: uppercase;
	letter-spacing: .08em;
	color: var(--sub);
	margin-bottom: .4rem;
}
.btn {
	width: 100%;
	border-radius: .6rem;
	padding: .55rem .6rem .65rem;
	text-align: left;
	font-size: 1.05rem;
	margin-bottom: .45rem;
	cursor: pointer;
	transition: transform .1s ease, box-shadow .1s ease, filter .1s ease;
	color: inherit;
	border: none;
	display: block;
}
.btn small {
	display: block;
	font-size: .8rem;
	color: rgba(226,232,240,.7);
}
.btn:hover {
	transform: translateY(-1px);
	filter: brightness(1.02);
	box-shadow: 0 4px 16px rgba(0,0,0,.15);
}
#btn-logic {
	background: linear-gradient(135deg,#38bdf8 0%,#0ea5e9 100%);
	color: #ecfeff;
}
#btn-field {
	background: linear-gradient(135deg,#22c55e 0%,#15803d 100%);
	color: #ecfdf3;
}
#btn-risk{
	background: linear-gradient(135deg,#f97316 0%,#f43f5e 100%);
	color: #fff7ed;
}
#btn-therapist {
	background: linear-gradient(135deg,#f43f5e 0%,#f97316 100%);
	color: #fff;
}
.log {
	background: rgba(2,6,23,.25);
	border: 1px solid rgba(148,163,184,.1);
	border-radius: 1rem;
	max-height: 210px;
	overflow-y: auto;
	padding: .5rem .6rem;
	font-size: 1.05rem;
}
.log p {
	margin: .15rem 0;
}
.log small {
	color: var(--sub);
	font-size: .75rem;
	margin-right: .3rem;
}
.chart-panel select {
	width: 100%;
	background: rgba(15,23,42,.25);
	border: 1px solid rgba(148,163,184,.25);
	border-radius: .5rem;
	color: var(--text);
	padding: .35rem .45rem;
	font-size: 1rem;
	margin-bottom: .45rem;
}
	canvas#chart {
	background: rgba(15,23,42,.15);
	border: 1px solid rgba(148,163,184,.1);
	border-radius: .7rem;
	width: 100%;
	height: 190px;
	display: block;
}
#formula-box {
	margin-top:.6rem;
	background:rgba(15,23,42,.3);
	border:1px solid rgba(148,163,184,.15);
	border-radius:12px;
	padding:.6rem .7rem .2rem;
	font-size:.9rem;
	line-height:1.35;
}
.wish-box {
	display:flex;
	gap:.35rem;
	margin-top:.4rem;
}
.wish-box input {
	flex:1;
	background:rgba(15,23,42,.25);
	border:1px solid rgba(148,163,184,.25);
	border-radius:.45rem;
	color:inherit;
	padding:.35rem .5rem;
	font-size:.85rem;
}
.wish-box button {
	background:rgba(59,130,246,.6);
	border:1px solid rgba(148,163,184,.25);
	border-radius:.45rem;
	color:#fff;
	padding:.35rem .6rem;
	font-size:.8rem;
	cursor:pointer;
}
#money-panel {
	display:none;
}
#money-panel.active {
	display:block;
}
@media (max-width: 720px) {
	#game-root {
		padding: .8rem;
	}
	header {
		gap: .6rem;
	}
	.chars {
		grid-template-columns: 1fr;
	}
	.panel {
		order: -1;
	}
	.wish-box {
		flex-direction:column;
	}
}