@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);
	--accent: #38bdf8;
	--danger: #f43f5e;
	--warn: #f97316;
	--ok: #22c55e;
	--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;
	font-size: 20px;
	line-height: 1.45;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	gap: 1rem;
	padding: 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;
}
.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;
}

.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;
}
.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;
}
#formula-box b {
	display:block;
	margin-bottom:.35rem;
}
#formula-box ul {
	margin:.2rem 0 .4rem;
	padding-left:1.3rem;
}
#formula-box li {
	margin-bottom:.25rem;
}
.avatar-frame{
	width:58px;
	height:58px;
	border-radius:50%;
	overflow:hidden;
	border:2px solid rgba(255,255,255,.15);
	position:relative;
	flex-shrink:0;
}
.avatar-frame img{
	position:absolute;
	width:348px;
	height:232px;
	left:0;
	top:0;
	user-select:none;
	pointer-events:none;
}
@media (max-width: 720px) {
	body {
		font-size: 18px;
	}
	.chars {
		grid-template-columns: 1fr;
	}
	.want-name {
		flex-basis: 55%;
	}
	header {
		gap: .6rem;
	}
	.legend {
		border-radius: 1rem;
	}
	.panel {
		order: -1;
	}
}