:root{
	--bg:#f6f8fc;
	--panel:#ffffff;
	--panel-soft:#f1f4fa;
	--border:#d8dfeb;
	--text:#1f2937;
	--muted:#6b7280;
	--primary:#2f6df6;
	--primary-soft:#e9f0ff;
	--shadow:0 10px 28px rgba(31,41,55,.08);
	--radius:20px;
	--danger:#d9534f;
	--actor:#b71c1c;
	--actor-soft:#ffebee;
	--adversary:#1a237e;
	--adversary-soft:#e8eaf6;
	--objective:#2e7d32;
	--objective-soft:#e8f5e9;
}

*{box-sizing:border-box}
html,body{margin:0;padding:0;height:100%}
body{
	font-family:Arial,Helvetica,sans-serif;
	background:var(--bg);
	color:var(--text);
}

button,input,select,textarea{font:inherit}
.hidden{display:none !important}

.app-shell{
	display:grid;
	grid-template-columns:280px 1fr;
	min-height:100vh;
}

.system-column{
	background:#fff;
	border-right:1px solid var(--border);
	padding:16px 14px;
	display:flex;
	flex-direction:column;
	gap:14px;
	min-height:100vh;
}

.brand-box{
	display:flex;
	align-items:center;
	gap:12px;
	flex:0 0 auto;
}

.brand-mark{
	width:46px;
	height:46px;
	border-radius:14px;
	background:var(--primary);
	color:#fff;
	display:flex;
	align-items:center;
	justify-content:center;
	font-weight:700;
	font-size:18px;
}

.brand-title{font-weight:700}
.brand-subtitle{
	color:var(--muted);
	font-size:12px;
	margin-top:2px;
}

.main-action,
.menu-action,
.soft-btn{
	border-radius:14px;
	padding:11px 14px;
	cursor:pointer;
	border:1px solid var(--border);
	background:#fff;
	color:var(--text);
}

.main-action{
	background:var(--primary);
	border-color:var(--primary);
	color:#fff;
	font-weight:700;
}

.main-action:disabled{
	opacity:.55;
	cursor:not-allowed;
}

.side-middle{
	flex:1 1 auto;
	min-height:0;
	display:flex;
	flex-direction:column;
	gap:12px;
}

.accordion{
	border:1px solid var(--border);
	border-radius:18px;
	background:var(--panel-soft);
	display:flex;
	flex-direction:column;
	min-height:0;
	overflow:hidden;
}

.accordion-head{
	display:flex;
	justify-content:space-between;
	align-items:center;
	gap:10px;
	padding:12px 14px;
	border-bottom:1px solid var(--border);
	background:#eef1f5;
	cursor:pointer;
	user-select:none;
	flex:0 0 auto;
}

.accordion-title{
	font-size:15px;
	letter-spacing:.02em;
	text-transform:uppercase;
	color:#111827;
	font-weight:800;
}

.accordion-toggle{
	font-size:20px;
	color:#111827;
	line-height:1;
}

.accordion-body{
	flex:1 1 auto;
	min-height:0;
	overflow:auto;
	padding:10px;
}

.game-list{
	display:grid;
	gap:8px;
}

.game-item{
	width:100%;
	text-align:left;
	border:1px solid var(--border);
	background:#fff;
	border-radius:14px;
	padding:10px 12px;
	cursor:pointer;
	display:grid;
	gap:4px;
	overflow:hidden;
}

.game-item.active{
	background:var(--primary-soft);
	border-color:#c8d9ff;
}

.game-item-title{
	font-weight:400;
	font-size:12px;
	line-height:1.3;
	color:var(--text);
	word-break:break-word;
}

.game-item-sub{
	font-size:11px;
	color:var(--muted);
	line-height:1.3;
	word-break:break-word;
}

.system-footer{
	margin-top:auto;
	flex:0 0 auto;
}

.account-btn{
	width:100%;
	border:1px solid var(--border);
	background:#fff;
	border-radius:16px;
	padding:12px 10px;
	cursor:pointer;
	display:grid;
	justify-items:center;
	gap:6px;
}

.account-icon{
	font-size:22px;
	line-height:1;
}

.account-label{
	font-size:13px;
	font-weight:700;
}

.workspace{
	padding:20px 22px 28px;
	display:flex;
	flex-direction:column;
	gap:18px;
	min-width:0;
	position:relative;
	height:100vh;
	overflow:hidden;
}

.workspace-header{
	display:flex;
	justify-content:space-between;
	align-items:flex-start;
	gap:18px;
	flex:0 0 auto;
}

.compact-game-header{
	padding-bottom:0;
}

.workspace-header-main{
	min-width:0;
	flex:1 1 auto;
}

.workspace-title-line{
	display:flex;
	align-items:baseline;
	gap:14px;
	min-width:0;
	flex-wrap:wrap;
}

.workspace-header h1{
	margin:0;
	font-size:30px;
	flex:0 0 auto;
}

.workspace-match-title{
	min-width:0;
	flex:1 1 auto;
	display:flex;
	align-items:center;
}

#match-current-title{
	font-size:28px;
	font-weight:700;
	line-height:1.2;
	word-break:break-word;
}

.header-right{
	display:flex;
	align-items:center;
	gap:12px;
	flex-wrap:wrap;
	justify-content:flex-end;
	flex:0 0 auto;
}

.user-chip{
	border:1px solid var(--border);
	background:#fff;
	border-radius:999px;
	padding:10px 14px;
	font-weight:700;
}

.lang-switch{
	display:flex;
	gap:8px;
	align-items:center;
}

.lang-btn,
.help-btn{
	width:38px;
	height:38px;
	border-radius:999px;
	border:1px solid var(--border);
	background:#fff;
	cursor:pointer;
	font-weight:700;
}

.lang-btn.active{
	background:var(--primary-soft);
	border-color:#c8d9ff;
	color:var(--primary);
}

.workspace-body{
	position:relative;
	min-height:0;
	height:100%;
	flex:1 1 auto;
	overflow:hidden;
	padding-bottom:8px;
}

.empty-state-panel,
.game-space-card{
	background:#fff;
	border:1px solid var(--border);
	border-radius:20px;
	box-shadow:var(--shadow);
}

.empty-state-panel{
	padding:34px 28px;
}

.empty-state-title{
	font-size:22px;
	font-weight:700;
	margin-bottom:10px;
}

.empty-state-text{
	color:var(--muted);
	line-height:1.6;
	max-width:780px;
}

.game-play-area{
	display:none;
	height:100%;
	min-height:0;
}

.game-play-area.visible{
	display:block;
}

.game-space-card{
	padding:26px;
}

.card-title{
	font-size:22px;
	font-weight:700;
	margin-bottom:10px;
}

.card-text{
	color:var(--muted);
	line-height:1.6;
}

.workspace-overlay{
	position:absolute;
	inset:0;
	background:rgba(246,248,252,.96);
	border:1px solid var(--border);
	border-radius:24px;
	box-shadow:var(--shadow);
	padding:24px;
	z-index:3;
	height:100%;
	min-height:100%;
	overflow:hidden;
	display:none;
	flex-direction:column;
}

.workspace-overlay.visible{
	display:flex;
}

.overlay-head{
	display:flex;
	justify-content:space-between;
	align-items:flex-start;
	gap:20px;
	margin-bottom:18px;
}

.overlay-head h3{
	margin:0 0 6px;
	font-size:28px;
}

.overlay-head p{
	margin:0;
	color:var(--muted);
	line-height:1.5;
}

.close-btn{
	border:1px solid var(--border);
	background:#fff;
	color:var(--text);
	border-radius:999px;
	width:40px;
	height:40px;
	font-size:24px;
	line-height:1;
	cursor:pointer;
}

.instruction-grid{
	display:grid;
	grid-template-columns:repeat(3,minmax(0,1fr));
	gap:18px;
}

.instruction-card,
.setup-card{
	background:#fff;
	border:1px solid var(--border);
	border-radius:20px;
	padding:18px;
	box-shadow:var(--shadow);
}

.instruction-card h4,
.setup-card h4{
	margin:0 0 10px;
	font-size:18px;
}

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

.new-game-layout{
	display:grid;
	grid-template-columns:minmax(340px,420px) minmax(0,1fr);
	grid-template-rows:minmax(0,1fr);
	grid-template-areas:"setup browser";
	gap:20px;
	align-items:stretch;
	flex:1 1 auto;
	min-height:0;
	height:100%;
	overflow:hidden;
}

.new-game-layout > .browser-column{
	grid-area:browser;
	min-width:0;
	min-height:0;
	height:100%;
	display:flex;
	flex-direction:column;
}

.new-game-layout > .setup-column-right{
	grid-area:setup;
	min-width:0;
	min-height:0;
	height:100%;
	display:flex;
	flex-direction:column;
	gap:20px;
	align-self:stretch;
}

.setup-card{
	display:flex;
	flex-direction:column;
	min-height:0;
}

.browser-column > .setup-card{
	flex:1 1 auto;
	min-height:0;
	height:100%;
	overflow:hidden;
}

.setup-column-right > .setup-card:first-child{
	flex:0 0 auto;
	height:auto;
	overflow:visible;
}

.setup-column-right > .setup-card:last-child{
	flex:1 1 auto;
	min-height:0;
	height:100%;
	overflow:hidden;
}

.browser-head{
	flex:0 0 auto;
}

.scenario-columns{
	flex:1 1 auto;
	min-height:0;
	height:100%;
	overflow:auto;
	padding-right:4px;
}

.new-game-layout .scenario-column{
	align-content:start;
}

.new-game-layout .browser-column .setup-card{
	padding-bottom:26px;
}

.radio-group{
	display:grid;
	gap:12px;
	margin-bottom:20px;
}

.radio-option{
	display:flex;
	align-items:center;
	gap:8px;
	background:var(--panel-soft);
	border:1px solid var(--border);
	border-radius:14px;
	padding:10px 12px;
	font-size:14px;
	font-weight:600;
	line-height:1.3;
}

.radio-option input[type="radio"]{
	margin:0;
	flex:0 0 auto;
}

.compact-radio-group{
	display:flex;
	flex-wrap:wrap;
	gap:10px;
	margin-bottom:0;
}

.compact-radio-group .radio-option{
	flex:0 0 auto;
	white-space:nowrap;
}

#actorChoiceOptions{
	display:grid;
	gap:10px;
	margin-bottom:0;
}

#actorChoiceOptions .radio-option{
	width:100%;
	white-space:normal;
}

.form-block{
	display:grid;
	gap:8px;
	margin-bottom:16px;
	min-width:0;
}

.form-block label{
	font-size:14px;
	color:var(--muted);
	font-weight:700;
	line-height:1.35;
}

.form-block select{
	width:100%;
	min-height:44px;
	border:1px solid var(--border);
	border-radius:14px;
	padding:10px 12px;
	background:#fff;
	color:var(--text);
}

.setup-card .button-row{
	margin-top:6px;
	flex-wrap:wrap;
}

.setup-card .button-row .main-action{
	min-height:46px;
	padding:12px 16px;
}

#selectedScenarioPresentation{
	flex:1 1 auto;
	min-height:0;
	height:100%;
	overflow:auto;
	white-space:pre-line;
	line-height:1.65;
	align-content:start;
}

#scenarioPresentationField{
	flex:1 1 auto;
	min-height:0;
	display:flex;
	flex-direction:column;
}

#scenarioPresentation{
	flex:1 1 auto;
	min-height:0;
	height:100%;
	resize:none;
}

.choice-actions{
	margin-bottom:18px;
}

.browser-head{
	display:flex;
	justify-content:space-between;
	align-items:flex-start;
	gap:16px;
	margin-bottom:16px;
}

.browser-note{
	color:var(--muted);
	font-size:13px;
	text-align:right;
}

.scenario-columns{
	display:grid;
	grid-template-columns:repeat(3,minmax(0,1fr));
	gap:16px;
	align-items:start;
}

.scenario-column{
	display:grid;
	gap:16px;
	align-content:start;
}

.scenario-group{
	border:1px solid var(--border);
	background:var(--panel-soft);
	border-radius:18px;
	overflow:hidden;
}

.scenario-group-head{
	padding:12px 14px;
	background:#fff;
	border-bottom:1px solid var(--border);
	font-weight:700;
	text-transform:capitalize;
}

.scenario-group-body{
	padding:10px;
	display:grid;
	gap:10px;
}

.scenario-option{
	width:100%;
	text-align:left;
	border:1px solid var(--border);
	background:#fff;
	border-radius:14px;
	padding:12px;
	cursor:pointer;
	display:grid;
	gap:6px;
}

.scenario-option strong{
	font-size:14px;
	line-height:1.35;
}

.scenario-option span{
	color:var(--muted);
	font-size:13px;
	line-height:1.4;
}

.scenario-option.selected{
	background:var(--primary-soft);
	border-color:#c8d9ff;
}

.modal-overlay{
	position:fixed;
	inset:0;
	background:rgba(15,23,42,.36);
	display:none;
	align-items:center;
	justify-content:center;
	padding:20px;
	z-index:20;
}

.modal-overlay.visible{
	display:flex;
}

.modal{
	width:min(760px,100%);
	background:#fff;
	border:1px solid var(--border);
	border-radius:22px;
	box-shadow:var(--shadow);
	overflow:hidden;
}

.modal-head{
	padding:18px 20px;
	border-bottom:1px solid var(--border);
	display:flex;
	justify-content:space-between;
	gap:16px;
}

.modal-head h3{
	margin:0 0 6px;
	font-size:24px;
}

.modal-head p{
	margin:0;
	color:var(--muted);
}

.modal-body{
	padding:18px 20px;
	display:grid;
	gap:12px;
	max-height:65vh;
	overflow:auto;
}

#lobbyModal .modal{
	width:min(80vw, 1600px);
	height:80vh;
	display:flex;
	flex-direction:column;
}

#lobbyModal .modal-body{
	flex:1 1 auto;
	min-height:0;
	max-height:none;
	overflow:auto;
	display:flex;
	flex-direction:column;
	gap:10px;
	align-items:stretch;
}

#lobbyModal .context-card{
	padding:14px 16px;
}

#lobbyModal .context-card .mini-label,
#lobbyModal .context-card h4{
	margin:0 0 8px 0;
}

#lobbyModal .simple-list{
	gap:8px;
}

@media (max-width: 960px){
	#lobbyModal .modal{
		width:min(96vw, 100%);
		height:90vh;
	}
}

#lobbyModal .modal-body > .button-row.compact{
	display:flex;
	flex-wrap:wrap;
	gap:8px;
	align-items:flex-start;
	align-content:flex-start;
	padding:0;
	margin:0;
	min-height:0;
	height:auto;
}

#lobbyModal .modal-body > .button-row.compact > .main-action,
#lobbyModal .modal-body > .button-row.compact > .soft-btn{
	align-self:flex-start;
}

#lobbyModal .modal-body{
	gap:10px;
}

#lobbyModal .button-row.compact{
	align-items:center;
}

#lobbyModal .button-row.compact > .main-action,
#lobbyModal .button-row.compact > .soft-btn{
	min-height:36px;
	padding:8px 12px;
	font-size:18px;
	line-height:1.2;
	border-width:1px;
	font-weight:700;
}

#set-available-btn{
	background:#e8f5e9;
	border-color:#a5d6a7;
	color:#1b5e20;
}

#set-unavailable-btn{
	background:#ffebee;
	border-color:#ef9a9a;
	color:#b71c1c;
}

#refresh-lobby-btn{
	background:#e9f0ff;
	border-color:#c8d9ff;
	color:#2f6df6;
}

#set-available-btn:hover{
	background:#dff1e3;
}

#set-unavailable-btn:hover{
	background:#fde3e6;
}

#refresh-lobby-btn:hover{
	background:#dfe9ff;
}

.modal-row{
	display:flex;
	justify-content:space-between;
	align-items:center;
	gap:16px;
	border:1px solid var(--border);
	border-radius:16px;
	padding:14px 16px;
}

.modal-row-main{
	display:grid;
	gap:4px;
}

.modal-row-title{
	font-weight:700;
}

.modal-row-sub{
	color:var(--muted);
	font-size:13px;
}

@media (max-width: 1180px){
	.new-game-layout{
		grid-template-columns:1fr;
		grid-template-rows:auto auto auto;
		grid-template-areas:
			"setup"
			"browser"
			"presentation";
		overflow:auto;
	}

	.setup-column,
	.browser-column,
	.setup-card{
		height:auto;
	}

	.new-game-layout > .setup-column:last-child > .setup-card{
		overflow:auto;
	}

	.scenario-columns{
		overflow:visible;
		height:auto;
	}
}

@media (max-width: 960px){
	.app-shell{
		grid-template-columns:1fr;
	}

	.system-column{
		min-height:auto;
		border-right:0;
		border-bottom:1px solid var(--border);
	}

	.instruction-grid{
		grid-template-columns:1fr;
	}

	.scenario-columns{
		grid-template-columns:1fr;
	}

	.workspace-header{
		flex-direction:column;
		align-items:flex-start;
	}

	.workspace-title-line{
		align-items:flex-start;
		flex-direction:column;
		gap:6px;
	}
}

.match-area{
	display:flex;
	flex-direction:column;
	gap:14px;
	height:100%;
	min-height:0;
}

.game-space-toolbar{
	display:flex;
	justify-content:space-between;
	align-items:center;
	gap:16px;
	flex:0 0 auto;
	min-height:44px;
}

.match-log-head,
.board-head,
.section-title-row{
	display:flex;
	justify-content:space-between;
	align-items:center;
	gap:16px;
}

.game-space-grid{
	display:grid;
	grid-template-columns:1.05fr 1fr 1fr;
	gap:18px;
	align-items:start;
}

.game-space-section{
	display:grid;
	gap:14px;
	min-width:0;
}

.game-space-section h3{
	margin:0;
	font-size:20px;
}

.mini-label{
	color:var(--muted);
	font-size:13px;
	margin-bottom:8px;
}

.strong-value,
.effect-value{
	font-size:22px;
	font-weight:700;
}

.face-value{
	font-size:34px;
}

.button-row,
.field-row{
	display:flex;
	gap:12px;
	flex-wrap:wrap;
}

.button-row.compact{
	gap:8px;
}

.field-block{
	display:grid;
	gap:8px;
	margin-bottom:14px;
	min-width:140px;
	flex:1 1 0;
}

.field-block label{
	font-size:14px;
	color:var(--muted);
}

.field-block select,
.field-block input{
	width:100%;
	padding:11px 12px;
	border:1px solid var(--border);
	border-radius:12px;
	background:#fff;
	color:var(--text);
}

.context-grid{
	display:grid;
	grid-template-columns:1fr 1fr;
	gap:14px;
}

.context-card,
.effect-card,
.board-card,
.move-card,
.match-log-card,
.lobby-panel{
	background:var(--panel);
	border:1px solid var(--border);
	border-radius:var(--radius);
	box-shadow:var(--shadow);
	padding:18px;
}

.placeholder-box{
	height:180px;
	border:1px dashed #c6d3ea;
	border-radius:18px;
	background:linear-gradient(180deg,#ffffff,#f5f8ff);
	display:flex;
	align-items:center;
	justify-content:center;
	color:var(--muted);
	text-align:center;
	padding:12px;
}

.trend-box{
	display:grid;
	gap:10px;
}

.trend-line{
	height:18px;
	border-radius:999px;
	background:#ebeff7;
	overflow:hidden;
	border:1px solid #d9e1ef;
}

.trend-fill{
	width:100%;
	height:100%;
	background:linear-gradient(90deg,var(--actor) 0%,var(--actor) 50%,var(--adversary) 50%,var(--adversary) 100%);
}

.trend-scale{
	display:flex;
	justify-content:space-between;
	align-items:center;
	gap:12px;
	font-size:13px;
	color:var(--muted);
}

#results-balance-actor-label,
#results-balance-opponent-label{
	font-weight:700;
	word-break:break-word;
}

#results-balance-center-label{
	font-weight:700;
	text-align:center;
	white-space:nowrap;
}

.duel-balance-unified{
	position:relative;
	display:flex;
	align-items:stretch;
	min-height:132px;
	border:1px solid var(--border);
	border-radius:24px;
	overflow:hidden;
	background:#f4f6fb;
	margin-top:12px;
	box-shadow:inset 0 1px 0 rgba(255,255,255,.7);
}

.duel-balance-side{
	display:flex;
	flex-direction:column;
	justify-content:space-between;
	gap:18px;
	padding:18px 22px;
	min-width:0;
	transition:flex-basis .25s ease;
}

.duel-balance-side.actor{
	background:#f4c9c9;
	color:var(--actor);
	text-align:left;
}

.duel-balance-side.opponent{
	background:#cfd7ff;
	color:var(--adversary);
	text-align:right;
}

.duel-balance-side-head{
	display:flex;
	align-items:center;
	gap:10px;
	font-weight:700;
	font-size:22px;
	line-height:1.25;
	min-width:0;
}

.duel-balance-side.opponent .duel-balance-side-head{
	justify-content:flex-end;
}

.duel-balance-name{
	display:block;
	min-width:0;
	overflow:hidden;
	text-overflow:ellipsis;
	white-space:nowrap;
}

.duel-balance-emoji{
	flex:0 0 auto;
	font-size:48px;
	line-height:1;
	filter:drop-shadow(0 1px 1px rgba(0,0,0,.08));
}

.duel-balance-side-foot{
	display:flex;
	align-items:flex-end;
}

.duel-balance-side.opponent .duel-balance-side-foot{
	justify-content:flex-end;
}

.duel-balance-score{
	font-size:34px;
	font-weight:800;
	line-height:1;
	letter-spacing:-.02em;
}

.duel-balance-center-pill{
	position:absolute;
	left:50%;
	top:50%;
	transform:translate(-50%, -50%);
	z-index:2;
	padding:10px 16px;
	border-radius:999px;
	background:rgba(255,255,255,.90);
	border:1px solid rgba(31,41,55,.12);
	box-shadow:0 8px 18px rgba(31,41,55,.10);
	font-weight:800;
	font-size:15px;
	color:#475569;
	white-space:nowrap;
	pointer-events:none;
}

#results-balance-actor-label,
#results-balance-opponent-label,
#results-balance-center-label,
#results-actor-average-box,
#results-opponent-average-box{
	word-break:normal;
}

@media (max-width: 960px){
	.duel-balance-unified{
		min-height:118px;
	}

	.duel-balance-side{
		padding:16px 14px;
		gap:14px;
	}

	.duel-balance-side-head{
		font-size:16px;
	}

	.duel-balance-score{
		font-size:26px;
	}

	.duel-balance-emoji{
		font-size:48px;
	}

	.duel-balance-center-pill{
		font-size:13px;
		padding:8px 12px;
	}
}

@media (max-width: 640px){
	.duel-balance-unified{
		flex-direction:column;
		min-height:unset;
	}

	.duel-balance-side.actor,
	.duel-balance-side.opponent{
		text-align:left;
	}

	.duel-balance-side.opponent .duel-balance-side-head,
	.duel-balance-side.opponent .duel-balance-side-foot{
		justify-content:flex-start;
	}

	.duel-balance-center-pill{
		position:static;
		transform:none;
		align-self:center;
		margin:10px 0;
		order:2;
	}

	#results-balance-actor-side{
		order:1;
	}

	#results-balance-opponent-side{
		order:3;
	}
}

.effects-grid{
	display:grid;
	grid-template-columns:repeat(3,minmax(0,1fr));
	gap:14px;
}

.board-head h4,
.match-log-head h4{
	margin:0;
}

.board-head p{
	color:var(--muted);
	margin:0;
	line-height:1.5;
}

.plain-box{
	background:var(--panel-soft);
	border:1px solid #e0e6f0;
	border-radius:14px;
	padding:14px 16px;
	line-height:1.6;
	white-space:pre-wrap;
}

.simple-list{
	display:grid;
	gap:10px;
}

.simple-row{
	display:flex;
	justify-content:space-between;
	align-items:center;
	gap:14px;
	background:#fff;
	border:1px solid var(--border);
	border-radius:14px;
	padding:12px 14px;
	flex-wrap:wrap;
}

.simple-row-main{
	display:grid;
	gap:4px;
	min-width:0;
	flex:1 1 260px;
}

.simple-row-title{
	font-weight:700;
}

.simple-row-sub{
	color:var(--muted);
	font-size:13px;
	line-height:1.4;
}

.lobby-config-row{
	background:var(--panel-soft);
}

.soft-select{
	min-width:170px;
	padding:10px 12px;
	border:1px solid var(--border);
	border-radius:12px;
	background:#fff;
	color:var(--text);
}

.lobby-panel .button-row.compact{
	justify-content:flex-end;
	align-items:center;
}

.lobby-panel .main-action,
.lobby-panel .soft-btn{
	white-space:nowrap;
}

@media (max-width: 960px){
	.lobby-panel .button-row.compact{
		justify-content:flex-start;
	}

	.soft-select{
		min-width:0;
		width:100%;
	}
}

.modal-large{
	width:min(1100px,100%);
}

.lobby-actions{
	display:flex;
	gap:12px;
	flex-wrap:wrap;
}

.lobby-columns{
	display:grid;
	grid-template-columns:1fr 1fr;
	gap:16px;
}

@media (max-width: 1280px){
	.game-space-grid{
		grid-template-columns:1fr;
	}
}

@media (max-width: 960px){
	.context-grid,
	.effects-grid,
	.lobby-columns{
		grid-template-columns:1fr;
	}
}

.game-space-tabs{
	display:flex;
	gap:10px;
	align-items:center;
	flex-wrap:wrap;
}

.game-tab{
	border:1px solid var(--border);
	background:#fff;
	color:var(--text);
	border-radius:999px;
	padding:10px 16px;
	cursor:pointer;
	font-weight:700;
}

.game-tab.active{
	background:var(--primary-soft);
	color:var(--primary);
	border-color:#c8d9ff;
}

.game-space-tab-panels{
	min-width:0;
	min-height:0;
	flex:1 1 auto;
	overflow:hidden;
	padding-bottom:8px;
}

.tab-panel{
	display:none;
	height:100%;
	min-height:0;
	overflow:auto;
	padding-bottom:8px;
}

.tab-panel.active{
	display:block;
}

.scenario-layout,
.move-layout,
.results-layout{
	display:grid;
	gap:18px;
	padding-bottom:8px;
}

.scenario-layout{
	grid-template-columns:1fr;
}

.move-layout{
	grid-template-columns:minmax(0,1.25fr) minmax(340px,.75fr);
	align-items:start;
}

.move-board-card{
	min-width:0;
}

.move-detail-card{
	min-width:0;
	position:sticky;
	top:0;
}

.move-detail-head{
	display:flex;
	justify-content:space-between;
	align-items:flex-start;
	gap:12px;
	margin-bottom:6px;
}

.move-detail-head .mini-label{
	margin-bottom:0;
}

.selected-strategy-code{
	font-size:32px;
	font-weight:700;
	line-height:1;
	margin-bottom:8px;
}

.selected-strategy-title{
	font-size:18px;
	font-weight:700;
	margin-bottom:12px;
	line-height:1.35;
}

.strategy-summary-box{
	min-height:160px;
	padding-bottom:22px;
}

.strategy-example-box{
	min-height:120px;
	white-space:pre-line;
	line-height:1.6;
}

.strategy-example-separator{
	height:1px;
	margin:16px 0 14px;
	background:var(--border);
}

#selected-strategy-example-title{
	font-size:15px;
	font-weight:800;
	letter-spacing:.01em;
	margin-bottom:8px;
}

.strategy-summary-sint{
	display:block;
	font-size:15px;
	font-weight:800;
	line-height:1.5;
	margin-bottom:10px;
}

.strategy-summary-comm{
	display:block;
	white-space:pre-line;
	line-height:1.6;
}

.results-layout{
	grid-template-columns:1fr;
}

@media (max-width: 1180px){
	.move-layout{
		grid-template-columns:1fr;
	}

	.move-detail-card{
		position:static;
	}
}

.scenario-split-layout{
	display:grid;
	grid-template-columns:minmax(320px,600px) minmax(0,1fr);
	gap:18px;
	align-items:start;
	padding-bottom:8px;
}

.scenario-description-column,
.scenario-charts-column{
	min-width:0;
}

.scenario-description-card,
.scenario-history-card{
	min-width:0;
}

.scenario-meta-box{
	display:grid;
	gap:10px;
	margin-bottom:12px;
	padding:14px 16px;
	border:1px solid var(--border);
	border-radius:14px;
	background:#fbfcff;
}

.scenario-meta-row{
	display:grid;
	grid-template-columns:120px 1fr;
	gap:12px;
	align-items:start;
}

.scenario-meta-key{
	font-size:13px;
	font-weight:700;
	color:var(--muted);
	line-height:1.4;
}

.scenario-meta-value{
	font-size:14px;
	font-weight:700;
	line-height:1.45;
	word-break:break-word;
}

.scenario-description-box{
	min-height:420px;
	max-height:none;
	line-height:1.7;
	font-size:15px;
	padding-bottom:22px;
}

.scenario-card-head{
	display:flex;
	justify-content:space-between;
	align-items:flex-start;
	gap:12px;
	flex-wrap:wrap;
	margin-bottom:12px;
}

.scenario-card-head .mini-label{
	margin-bottom:0;
}

.scenario-radar-legend{
	display:flex;
	gap:10px;
	flex-wrap:wrap;
	align-items:center;
}

.radar-legend-item{
	display:inline-flex;
	align-items:center;
	border-radius:999px;
	padding:8px 12px;
	font-size:12px;
	font-weight:700;
	color:#fff;
}

.radar-legend-actor{
	background:var(--actor);
}

.radar-legend-adversary{
	background:var(--adversary);
}

.radar-legend-objective{
	background:var(--objective);
}

.scenario-radars-grid{
	display:grid;
	grid-template-columns:repeat(auto-fit,minmax(520px,1fr));
	gap:18px;
	align-items:start;
	padding-bottom:8px;
}

.scenario-radar-card{
	border:1px solid var(--border);
	border-radius:18px;
	background:#fff;
	padding:14px;
	min-width:0;
}

.scenario-radar-head{
	display:flex;
	flex-direction:column;
	gap:4px;
	margin-bottom:10px;
}

.scenario-radar-step{
	font-size:18px;
	font-weight:700;
	line-height:1.2;
}

.scenario-radar-sub{
	font-size:13px;
	color:var(--muted);
	line-height:1.4;
}

.scenario-radar-canvas{
	min-height:560px;
	display:flex;
	align-items:center;
	justify-content:center;
	overflow:hidden;
}

.scenario-radar-canvas svg{
	max-width:100%;
	height:auto;
	display:block;
}

.scenario-radar-empty{
	border:1px dashed #c6d3ea;
	border-radius:18px;
	padding:28px;
	color:var(--muted);
	background:linear-gradient(180deg,#ffffff,#f5f8ff);
}

.scenario-legend-bar{
	display:grid;
	grid-template-columns:1fr 1fr 1fr;
	overflow:hidden;
	border-radius:10px;
	margin-bottom:12px;
}

.scenario-legend-player,
.scenario-legend-enemy,
.scenario-legend-objective{
	padding:8px 12px;
	color:#fff;
	font-size:13px;
	font-weight:700;
	text-align:center;
}

.scenario-legend-player{
	background:var(--actor);
}

.scenario-legend-enemy{
	background:var(--adversary);
}

.scenario-legend-objective{
	background:var(--objective);
}

@media (max-width: 1200px){
	.scenario-split-layout{
		grid-template-columns:1fr;
	}

	.scenario-radars-grid{
		grid-template-columns:1fr;
	}

	.scenario-radar-canvas{
		min-height:460px;
	}
}

@media (max-width: 720px){
	.scenario-meta-row{
		grid-template-columns:1fr;
		gap:4px;
	}
}

/* MOVE: masonry clusters */

.strategy-clusters-board{
	column-gap:16px;
	column-count:3;
	margin-top:14px;
}

.strategy-cluster-card{
	break-inside:avoid;
	-webkit-column-break-inside:avoid;
	page-break-inside:avoid;
	border:1px solid var(--border);
	border-radius:18px;
	overflow:hidden;
	margin-bottom:16px;
	box-shadow:var(--shadow);
}

.strategy-cluster-title{
	width:100%;
	border:0;
	padding:14px 16px;
	text-align:left;
	font-weight:700;
	color:#fff;
	cursor:pointer;
	line-height:1.35;
	border-radius:0;
}

.strategy-cluster-body{
	padding:14px;
	display:flex;
	flex-wrap:wrap;
	gap:10px;
}

.strategy-chip{
	display:inline-flex;
	align-items:flex-start;
	gap:8px;
	border:1px solid rgba(31,41,55,.10);
	background:rgba(255,255,255,.92);
	color:var(--text);
	border-radius:14px;
	padding:9px 10px;
	cursor:pointer;
	text-align:left;
	line-height:1.35;
	max-width:100%;
}

.strategy-chip:hover{
	transform:translateY(-1px);
	box-shadow:0 6px 14px rgba(31,41,55,.08);
}

.strategy-chip.selected{
	border-color:rgba(47,109,246,.45);
	background:#eef4ff;
	box-shadow:0 0 0 2px rgba(47,109,246,.10) inset;
}

.strategy-chip-code{
	font-weight:700;
	min-width:24px;
	flex:0 0 auto;
}

.strategy-chip-text{
	font-size:13px;
	color:var(--text);
	word-break:break-word;
}

.strategy-clusters-empty{
	border:1px dashed #c6d3ea;
	border-radius:18px;
	padding:28px;
	color:var(--muted);
	background:linear-gradient(180deg,#ffffff,#f5f8ff);
	break-inside:avoid;
}

.cluster-color-1{
	background:#f8efc7;
}
.cluster-color-1 .strategy-cluster-title{
	background:#b89522;
}

.cluster-color-2{
	background:#e7f2d8;
}
.cluster-color-2 .strategy-cluster-title{
	background:#6d9850;
}

.cluster-color-3{
	background:#f4e1dc;
}
.cluster-color-3 .strategy-cluster-title{
	background:#a86d5f;
}

.cluster-color-4{
	background:#e5edf8;
}
.cluster-color-4 .strategy-cluster-title{
	background:#5d7fa8;
}

.cluster-color-5{
	background:#eef0cf;
}
.cluster-color-5 .strategy-cluster-title{
	background:#8d9750;
}

.cluster-color-6{
	background:#f7dfd7;
}
.cluster-color-6 .strategy-cluster-title{
	background:#b16e5f;
}

.cluster-color-7{
	background:#ecefc8;
}
.cluster-color-7 .strategy-cluster-title{
	background:#7b8f4f;
}

@media (min-width: 1500px){
	.strategy-clusters-board{
		column-count:4;
	}
}

@media (max-width: 1200px){
	.strategy-clusters-board{
		column-count:2;
	}
}

@media (max-width: 720px){
	.strategy-clusters-board{
		column-count:1;
	}
}

/* RESULTS */

.results-balance-averages{
	display:grid;
	grid-template-columns:1fr auto 1fr;
	gap:12px;
	align-items:center;
	margin-top:12px;
}

.results-balance-average{
	text-align:center;
	font-size:15px;
	font-weight:700;
}

.results-balance-average.actor{
	color:var(--actor);
}

.results-balance-average.opponent{
	color:var(--adversary);
}

.results-balance-average strong{
	display:block;
	margin-bottom:4px;
	line-height:1.35;
	word-break:break-word;
}

.results-balance-vs{
	font-weight:700;
	color:var(--muted);
	text-align:center;
}

.results-moves-head{
	display:flex;
	align-items:center;
	justify-content:space-between;
	gap:12px;
	margin-bottom:12px;
}

.icon-only-btn{
	min-width:42px;
	width:42px;
	height:42px;
	padding:0;
	display:inline-flex;
	align-items:center;
	justify-content:center;
	font-size:18px;
	font-weight:700;
	border-radius:12px;
}

.results-moves-host{
	display:grid;
	gap:14px;
	min-height:220px;
}

.results-moves-host.results-view-rows{
	grid-template-columns:1fr;
}

.results-moves-host.results-view-rows .results-move-detail-panel{
	display:none;
}

.results-moves-host.results-view-split{
	grid-template-columns:minmax(280px,380px) minmax(0,1fr);
	align-items:start;
}

.results-moves-list{
	display:grid;
	gap:10px;
	padding-bottom:8px;
	min-width:0;
}

.results-move-detail-panel{
	min-width:0;
}

.results-move-detail-empty{
	min-height:140px;
	display:flex;
	align-items:center;
	justify-content:center;
	text-align:center;
	color:var(--muted);
}

.results-move-detail-content{
	display:grid;
	gap:14px;
}

.results-move-wrap{
	display:grid;
	gap:0;
	border-radius:16px;
	overflow:hidden;
	border:1px solid rgba(31,41,55,.10);
	background:#fff;
	transition:border-color .2s ease, box-shadow .2s ease, transform .2s ease;
}

.results-move-wrap.actor-side{
	background:var(--actor-soft);
}

.results-move-wrap.opponent-side{
	background:var(--adversary-soft);
}

.results-move-wrap.is-selected{
	border-color:rgba(59,130,246,.38);
	box-shadow:0 0 0 3px rgba(59,130,246,.10);
}

.results-move-row{
	display:grid;
	grid-template-columns:minmax(120px,300px) minmax(240px,1.7fr) repeat(2,minmax(92px,110px)) minmax(110px,130px) auto;
	gap:10px;
	align-items:center;
	background:transparent;
	border:0;
	border-bottom:1px solid rgba(31,41,55,.10);
	border-radius:0;
	padding:12px 14px;
	box-shadow:none;
}

.results-explore-wrap{
	background:transparent;
	border:0;
	border-radius:0;
	padding:14px;
	box-shadow:none;
	margin-top:0;
}

.results-move-col{
	min-width:0;
}

.results-move-col.action{
	text-align:right;
}

.results-move-label{
	font-size:11px;
	color:var(--muted);
	text-transform:uppercase;
	letter-spacing:.04em;
	margin-bottom:4px;
}

.results-move-executor{
	font-weight:700;
}

.results-move-strategy{
	font-weight:700;
	line-height:1.4;
	word-break:break-word;
}

.results-move-value{
	font-weight:700;
}

.results-judgment-pill{
	display:inline-flex;
	align-items:center;
	justify-content:center;
	min-width:68px;
	padding:8px 10px;
	border-radius:999px;
	color:#fff;
	font-size:18px;
	font-weight:700;
	box-shadow:inset 0 0 0 1px rgba(255,255,255,.18);
}

/* split/cards mode */

.results-moves-host.results-view-split .results-moves-list{
	gap:12px;
	padding-bottom:0;
}

.results-moves-host.results-view-split .results-move-wrap{
	border-radius:18px;
	border:1px solid rgba(31,41,55,.12);
	overflow:hidden;
}

.results-moves-host.results-view-split .results-move-row{
	grid-template-columns:1fr;
	gap:8px;
	padding:14px 16px;
	border-bottom:0;
	align-items:start;
}

.results-moves-host.results-view-split .results-explore-wrap{
	display:none !important;
}

.results-moves-host.results-view-split .results-move-col.action{
	text-align:left;
	padding-top:4px;
}

.results-moves-host.results-view-split .results-move-col.metric,
.results-moves-host.results-view-split .results-move-col.judgment{
	display:inline-block;
	width:auto;
}

.results-moves-host.results-view-split .results-move-row .results-move-col.metric + .results-move-col.metric{
	margin-top:2px;
}

.results-moves-host.results-view-split .results-move-executor,
.results-moves-host.results-view-split .results-move-strategy,
.results-moves-host.results-view-split .results-move-value{
	font-size:14px;
}

.results-moves-host.results-view-split .results-judgment-pill{
	min-width:60px;
	font-size:20px;
}

.results-moves-host.results-view-split .results-move-detail-panel{
	display:block;
}

.results-moves-host.results-view-split .results-move-detail-content .results-explore-panel-grid{
	background:transparent;
}

.results-moves-host.results-view-split .results-move-detail-content .plain-box,
.results-moves-host.results-view-split .results-move-detail-content .results-dot-table,
.results-moves-host.results-view-split .results-move-detail-content .results-bubble-svg{
	background:#fff;
}

.results-moves-host.results-view-split .results-move-detail-panel{
	border-radius:18px;
	min-height:220px;
}

.results-moves-host.results-view-split .results-move-detail-content{
	border:1px solid var(--border);
	border-radius:18px;
	padding:14px;
	min-height:220px;
}

.results-moves-host.results-view-split .results-move-detail-content.actor-side{
	background:var(--actor-soft);
}

.results-moves-host.results-view-split .results-move-detail-content.opponent-side{
	background:var(--adversary-soft);
}

.results-move-detail-panel{
	background:transparent;
}

.results-moves-host.results-view-split .results-move-detail-panel,
.results-moves-host.results-view-split .results-move-detail-empty{
	background:transparent;
}

.results-move-card-title{
	padding:12px 16px 0 16px;
	font-size:15px;
	font-weight:800;
	letter-spacing:.01em;
}

.results-move-detail-title{
	margin-bottom:12px;
	font-size:18px;
	font-weight:800;
}


.results-explore-panel-grid{
	display:grid;
	grid-template-columns:1fr;
	gap:16px;
}

.results-explore-block{
	display:grid;
	gap:12px;
}

.results-explore-title{
	font-size:16px;
	font-weight:700;
}

.results-dot-table-wrap{
	overflow:auto;
}

.results-dot-table{
	width:100%;
	border-collapse:collapse;
	background:#fff;
	border:1px solid var(--border);
	border-radius:14px;
	overflow:hidden;
}

.results-dot-header{
	padding:8px 10px;
	border:1px solid var(--border);
	background:#f8fafc;
	font-size:12px;
	text-align:center;
	white-space:nowrap;
}

.results-dot-rowlabel{
	padding:8px 10px;
	border:1px solid var(--border);
	background:#f8fafc;
	font-weight:700;
	font-size:12px;
	white-space:nowrap;
}

.results-dot-cell{
	padding:8px;
	border:1px solid var(--border);
	text-align:center;
}

.results-dot{
	width:18px;
	height:18px;
	border-radius:999px;
	margin:auto;
	border:1px solid rgba(0,0,0,.16);
	box-shadow:inset 0 0 0 1px rgba(255,255,255,.3);
}

.results-bubble-selects{
	display:grid;
	grid-template-columns:repeat(4,minmax(0,1fr));
	gap:10px;
}

.results-bubble-select{
	width:100%;
	padding:9px 10px;
	border:1px solid var(--border);
	border-radius:12px;
	background:#fff;
	color:var(--text);
}

.results-bubble-svg{
	width:100%;
	height:auto;
	border:1px solid var(--border);
	border-radius:16px;
	background:#fff;
	display:block;
}

.results-ai-row{
	display:flex;
	gap:10px;
	flex-wrap:wrap;
	align-items:center;
}

.results-ai-comment-box{
	min-height:84px;
	padding:14px 16px;
	border:1px solid var(--border);
	border-radius:16px;
	background:#fff;
	color:var(--text);
	line-height:1.55;
}

.results-ai-comment-box.empty{
	color:var(--muted);
	font-style:italic;
}

.results-ai-comment-box.loading{
	color:var(--muted);
}

.results-ai-comment-box.hidden{
	display:none;
}

.results-ai-comment-button{
	display:inline-flex;
	align-items:center;
	justify-content:center;
	min-height:42px;
	padding:10px 16px;
	border:1px solid rgba(31,41,55,.18);
	border-radius:12px;
	background:#fff;
	color:var(--text);
	font-weight:800;
	cursor:pointer;
	box-shadow:0 8px 18px rgba(15,23,42,.08);
	transition:transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}

.results-ai-comment-button:hover{
	transform:translateY(-1px);
	box-shadow:0 12px 24px rgba(15,23,42,.12);
	border-color:rgba(31,41,55,.28);
}

.results-ai-comment-button:disabled{
	opacity:.55;
	cursor:not-allowed;
	transform:none;
	box-shadow:none;
}

.results-ai-status{
	display:inline-flex;
	align-items:center;
	min-height:42px;
	padding:10px 14px;
	border:1px solid var(--border);
	border-radius:12px;
	background:#fff;
	line-height:1.4;
	font-weight:700;
}

.results-ai-status.loading{
	color:var(--muted);
}

.results-ai-status.error{
	background:#fef2f2;
	border-color:#fecaca;
	color:#991b1b;
	font-weight:700;
}

.results-ai-comment{
	min-height:84px;
}

@media (max-width: 1180px){
	.results-move-row{
		grid-template-columns:1fr 1.3fr repeat(2,minmax(80px,110px)) minmax(100px,120px) auto;
	}

	.results-moves-host.results-view-split{
		grid-template-columns:320px minmax(0,1fr);
	}
}

@media (max-width: 960px){
	.results-move-row{
		grid-template-columns:1fr;
		align-items:start;
	}

	.results-move-col.action{
		text-align:left;
	}

	.results-bubble-selects{
		grid-template-columns:repeat(2,minmax(0,1fr));
	}

	.results-moves-host.results-view-split{
		grid-template-columns:1fr;
	}

	.results-moves-host.results-view-split .results-move-detail-panel{
		order:2;
	}

	.results-moves-host.results-view-split .results-moves-list{
		order:1;
	}
}

@media (max-width: 640px){
	.results-bubble-selects{
		grid-template-columns:1fr;
	}
}

.strategy-chip.disabled,
.strategy-chip:disabled{
	opacity:.42;
	cursor:not-allowed;
	transform:none;
	box-shadow:none;
}
