:root {
	--bg: #07121d;
	--panel: #0b1b2b;
	--card: #0f2438;
	--muted: #9db3c7;
	--text: #e8f2fb;
	--border: rgba(255, 255, 255, 0.08);
	--primary: #4cc3ff;
	--danger: #ff5c7a;
	--ok: #55ffa2;

	--radius: 16px;
	--shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
	--mono:
		ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono",
		"Courier New", monospace;
}

* {
	box-sizing: border-box;
}
html,
body {
	height: 100%;
}
body {
	margin: 0;
	font-family:
		system-ui,
		-apple-system,
		Segoe UI,
		Roboto,
		Arial,
		sans-serif;
	background-color: var(--bg);
	background-image:
		radial-gradient(
			1200px 640px at 15% 10%,
			rgba(76, 195, 255, 0.16) 0%,
			rgba(76, 195, 255, 0.08) 35%,
			rgba(76, 195, 255, 0.03) 55%,
			rgba(76, 195, 255, 0) 76%
		),
		radial-gradient(
			980px 560px at 85% 20%,
			rgba(85, 255, 162, 0.14) 0%,
			rgba(85, 255, 162, 0.07) 38%,
			rgba(85, 255, 162, 0.02) 58%,
			rgba(85, 255, 162, 0) 80%
		);
	background-repeat: no-repeat;
	background-attachment: fixed;
	color: var(--text);
	overflow-x: hidden;
}

.topbar {
	position: sticky;
	top: 0;
	z-index: 50;
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 12px 16px;
	background: rgba(11, 27, 43, 0.92);
	backdrop-filter: blur(10px);
	border-bottom: 1px solid var(--border);
}

.brand {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 260px;
}
.logo {
	font-size: 24px;
}
.title {
	font-weight: 800;
	letter-spacing: 0.2px;
}
.subtitle {
	font-size: 12px;
	color: var(--muted);
}

.tabs {
	display: flex;
	gap: 8px;
	flex: 1;
	min-width: 0;
	justify-content: center;
}
.tab {
	border: 1px solid var(--border);
	background: transparent;
	color: var(--text);
	padding: 8px 12px;
	border-radius: 999px;
	cursor: pointer;
	transition: 0.15s ease;
}
.tab:hover {
	transform: translateY(-1px);
}
.tab.active {
	background: rgba(76, 195, 255, 0.14);
	border-color: rgba(76, 195, 255, 0.35);
}

.actions {
	display: flex;
	gap: 8px;
	min-width: 210px;
	justify-content: flex-end;
}

.container {
	max-width: 1200px;
	margin: 18px auto;
	padding: 0 16px 40px;
}

.panel {
	background: rgba(11, 27, 43, 0.6);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 14px;
	box-shadow: var(--shadow);
}

.panel-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}
.panel-head h2 {
	margin: 6px 0 10px;
	font-size: 18px;
}
.panel-head-actions {
	display: flex;
	gap: 8px;
}

.cards {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
	gap: 12px;
	margin-top: 12px;
}

.card {
	background: rgba(15, 36, 56, 0.75);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 12px;
}

h3 {
	margin: 0 0 10px;
	font-size: 14px;
}

.hint {
	font-size: 13px;
	color: var(--muted);
	line-height: 1.4;
}

.grid2 {
	display: grid;
	grid-template-columns: 1.15fr 0.85fr;
	gap: 12px;
}
@media (max-width: 980px) {
	.grid2 {
		grid-template-columns: 1fr;
	}
	.topbar {
		flex-wrap: wrap;
		align-items: flex-start;
		gap: 10px;
	}
	.brand {
		order: 1;
		flex: 1 1 auto;
		min-width: auto;
	}
	.subtitle {
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}
	.actions {
		order: 2;
		flex: 0 0 auto;
		min-width: auto;
	}
	.tabs {
		order: 3;
		flex: 1 0 100%;
		width: 100%;
		justify-content: flex-start;
		overflow-x: auto;
		overflow-y: hidden;
		-webkit-overflow-scrolling: touch;
		padding-bottom: 2px;
	}
	.tab {
		flex: 0 0 auto;
	}
	.panel-head {
		flex-wrap: wrap;
	}
	.panel-head-actions {
		width: 100%;
	}
	.cards {
		grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	}
	.modal-head {
		flex-direction: column;
		align-items: flex-start;
	}
	.modal-actions {
		width: 100%;
	}
	.modal-body {
		max-height: calc(100vh - 24px);
		overflow: auto;
	}
}

@media (max-width: 700px) {
	.container {
		padding: 0 10px 26px;
	}
	.panel {
		padding: 10px;
	}
	.cards {
		grid-template-columns: 1fr;
	}
	.compact-grid {
		grid-template-columns: 1fr;
	}
	#view-match .rot-stepper {
		grid-template-columns: 42px minmax(66px, 86px) 42px;
		justify-content: start;
	}
	#btnResetMatchStats,
	#btnLockMatch,
	#btnUnlockMatch {
		flex: 1 1 100%;
	}
	.player-head {
		flex-direction: column;
		align-items: flex-start;
	}
	.badges {
		justify-content: flex-start;
	}
	.actions {
		width: 100%;
	}
	.actions .btn,
	.actions .file {
		padding: 8px 10px;
	}
	.tabs {
		padding-bottom: 4px;
	}
}

@media (max-width: 520px) {
	.subtitle {
		display: none;
	}
	.topbar {
		padding: 10px 10px;
	}
	.update-banner {
		left: 8px;
		right: 8px;
		bottom: 8px;
	}
}

.btn {
	border: 1px solid var(--border);
	background: rgba(255, 255, 255, 0.06);
	color: var(--text);
	padding: 9px 12px;
	border-radius: 12px;
	cursor: pointer;
	transition: 0.15s ease;
	font-weight: 650;
}
.btn:hover {
	transform: translateY(-1px);
}
.btn.primary {
	background: rgba(76, 195, 255, 0.2);
	border-color: rgba(76, 195, 255, 0.45);
}
.btn.ghost {
	background: transparent;
}
.btn.danger {
	background: rgba(255, 92, 122, 0.12);
	border-color: rgba(255, 92, 122, 0.35);
}
.file input {
	display: none;
}
.update-banner {
	position: fixed;
	left: 12px;
	right: 12px;
	bottom: 12px;
	z-index: 200;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	padding: 10px 12px;
	border-radius: 12px;
	border: 1px solid rgba(76, 195, 255, 0.35);
	background: rgba(11, 27, 43, 0.97);
	box-shadow: var(--shadow);
}
.update-banner .text {
	font-size: 13px;
	color: var(--text);
}
.update-banner .row {
	margin-top: 0;
}

.divider {
	height: 1px;
	background: var(--border);
	margin: 12px 0;
}

.view.hidden {
	display: none;
}
.hidden {
	display: none !important;
}

.field {
	display: flex;
	flex-direction: column;
	gap: 6px;
	margin-bottom: 10px;
}
.field span {
	color: var(--muted);
	font-size: 12px;
}
.field input,
.field select,
select {
	background: rgba(255, 255, 255, 0.05);
	color: var(--text);
	border: 1px solid var(--border);
	border-radius: 12px;
	padding: 10px 10px;
	width: 100%;
	max-width: 100%;
	min-width: 0;
}
select option,
select optgroup {
	background: #ffffff;
	color: #0b1b2b;
}

.row {
	display: flex;
	gap: 8px;
	align-items: center;
	margin-top: 8px;
	flex-wrap: wrap;
}

.radioRow {
	display: flex;
	flex-direction: column;
	gap: 10px;
}
.radio {
	display: flex;
	gap: 10px;
	align-items: flex-start;
	cursor: pointer;
	line-height: 1.35;
}
.radio input {
	transform: translateY(3px);
}

.toggles {
	display: flex;
	flex-direction: column;
	gap: 10px;
}
.toggle {
	display: flex;
	gap: 10px;
	align-items: center;
	justify-content: space-between;
}
.toggle input[type="checkbox"] {
	transform: scale(1.05);
}

.sliders {
	display: flex;
	flex-direction: column;
	gap: 10px;
}
.slider {
	display: grid;
	grid-template-columns: 90px 1fr 34px;
	gap: 10px;
	align-items: center;
}
.slider span {
	color: var(--muted);
	font-size: 12px;
}
.slider input[type="range"] {
	width: 100%;
}
.val {
	font-family: var(--mono);
	font-size: 12px;
	color: var(--text);
	opacity: 0.9;
}

.player-head {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 10px;
}
.player-name {
	font-weight: 800;
}
.badges {
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
	justify-content: flex-end;
}
.badge {
	font-size: 11px;
	padding: 3px 8px;
	border-radius: 999px;
	border: 1px solid var(--border);
	color: var(--muted);
}
.badge.ok {
	border-color: rgba(85, 255, 162, 0.35);
	color: rgba(85, 255, 162, 0.9);
}
.badge.warn {
	border-color: rgba(255, 196, 76, 0.35);
	color: rgba(255, 196, 76, 0.9);
}
.badge.bad {
	border-color: rgba(255, 92, 122, 0.35);
	color: rgba(255, 92, 122, 0.9);
}
.start-hints {
	justify-content: flex-start;
	margin-top: 8px;
}

.skill {
	display: grid;
	grid-template-columns: 92px 1fr 30px;
	gap: 10px;
	align-items: center;
	margin: 8px 0;
}
.skill label {
	color: var(--muted);
	font-size: 12px;
}
.skill input[type="range"] {
	width: 100%;
}
.skill .n {
	font-family: var(--mono);
	font-size: 12px;
	text-align: right;
}

.modal {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.55);
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 12px;
	z-index: 100;
}
.modal.hidden {
	display: none;
}
.modal-body {
	width: min(1200px, 100%);
	background: rgba(11, 27, 43, 0.96);
	border: 1px solid var(--border);
	border-radius: 18px;
	box-shadow: var(--shadow);
	padding: 12px;
}

.modal-head {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
	padding: 6px 6px 12px;
}
.modal-title {
	font-weight: 900;
}
.modal-subtitle {
	font-size: 12px;
	color: var(--muted);
	margin-top: 2px;
}
.modal-actions {
	display: flex;
	gap: 8px;
	align-items: center;
	flex-wrap: wrap;
}
.modal-actions select {
	padding: 9px 10px;
	border-radius: 12px;
}

.rotWrap {
	display: grid;
	grid-template-columns: 1.2fr 0.8fr;
	gap: 12px;
}
@media (max-width: 980px) {
	.rotWrap {
		grid-template-columns: 1fr;
	}
}
.rotSvgWrap {
	background: rgba(15, 36, 56, 0.55);
	border: 1px solid var(--border);
	border-radius: 16px;
	padding: 10px;
	min-height: 460px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.meta-grid input,
.meta-grid select {
	min-width: 0;
}
.meta-grid .grow {
	flex: 1;
}

.role-picks {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 10px 0;
}
.role-picks label {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 12px;
	color: var(--muted);
	border: 1px solid var(--border);
	padding: 5px 8px;
	border-radius: 10px;
}

.skill-block {
	margin-top: 6px;
}

.lvl-awful {
	color: rgba(255, 92, 122, 0.95) !important;
}
.lvl-bad {
	color: rgba(255, 143, 102, 0.95) !important;
}
.lvl-mid {
	color: rgba(157, 179, 199, 0.95) !important;
}
.lvl-good {
	color: rgba(76, 195, 255, 0.95) !important;
}
.lvl-great {
	color: rgba(85, 255, 162, 0.95) !important;
}

.badge.role {
	border-color: rgba(76, 195, 255, 0.3);
	color: rgba(76, 195, 255, 0.95);
}

.icon-btn {
	border: 1px solid var(--border);
	background: rgba(255, 255, 255, 0.04);
	color: var(--muted);
	width: 24px;
	height: 24px;
	border-radius: 999px;
	cursor: pointer;
	font-size: 12px;
	padding: 0;
	line-height: 1;
}

.mini-tip {
	font-size: 12px;
	color: var(--muted);
	background: rgba(255, 255, 255, 0.03);
	border: 1px solid var(--border);
	padding: 8px 10px;
	border-radius: 10px;
}

.toggleLine {
	display: flex;
	align-items: center;
	gap: 8px;
}
.toggleLine.align-start {
	align-items: flex-start;
}

.multi-row {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}
.multi-row label {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	font-size: 12px;
	color: var(--muted);
}

.slider {
	grid-template-columns: 90px 1fr 34px 24px;
}

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

.rot-stepper {
	display: grid;
	grid-template-columns: auto 1fr auto;
	gap: 8px;
	align-items: center;
}
.rot-stepper input {
	text-align: center;
}

#view-match #matchCurrentRotation {
	max-width: 86px;
	justify-self: center;
}
#view-match #matchId {
	max-width: 130px;
}

#btnResetMatchStats,
#btnLockMatch,
#btnUnlockMatch {
	flex: 1 1 220px;
}

.btn.success {
	background: rgba(85, 255, 162, 0.16);
	border-color: rgba(85, 255, 162, 0.35);
}

.match-actions {
	display: grid;
	gap: 8px;
}
.match-subs-grid {
	display: grid;
	gap: 8px;
}
.match-sub-row {
	display: grid;
	grid-template-columns: auto minmax(140px, 1fr) auto minmax(140px, 1fr) auto auto auto auto;
	gap: 8px;
	align-items: center;
}
.match-sub-num,
.match-sub-on {
	font-size: 12px;
	color: var(--muted);
	white-space: nowrap;
}
.match-sub-select {
	min-width: 0;
}
.match-action-row {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 8px;
}
.match-action-controls {
	margin-left: auto;
	gap: 12px;
}
.match-action-controls .btn {
	min-width: 56px;
	padding-left: 14px;
	padding-right: 14px;
}
.match-action-name {
	font-size: 13px;
	color: var(--muted);
}

.match-total-grid {
	display: grid;
	gap: 8px;
}
.match-total-row {
	display: grid;
	grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
	gap: 12px;
	align-items: center;
}
.match-total-pair {
	display: grid;
	align-items: center;
	gap: 8px;
}
.match-total-pair.is-plus {
	grid-template-columns: 92px 76px;
	justify-content: start;
}
.match-total-pair.is-minus {
	grid-template-columns: 104px 76px;
	justify-content: end;
}
.match-total-label {
	font-size: 12px;
	color: var(--muted);
	white-space: nowrap;
}
.match-total-pair.is-minus .match-total-label {
	text-align: right;
}
.match-total-row input {
	background: rgba(255, 255, 255, 0.05);
	color: var(--text);
	border: 1px solid var(--border);
	border-radius: 10px;
	padding: 7px 8px;
	width: 76px;
	min-width: 0;
	text-align: center;
	font-variant-numeric: tabular-nums;
}
@media (max-width: 860px) {
	.match-sub-row {
		grid-template-columns: 1fr;
	}
	.match-total-row {
		grid-template-columns: 1fr;
		gap: 6px;
	}
	.match-total-pair.is-plus,
	.match-total-pair.is-minus {
		grid-template-columns: minmax(0, 1fr) 76px;
		justify-content: stretch;
	}
	.match-total-pair.is-minus .match-total-label {
		text-align: left;
	}
}

.rotWrapSingle {
	display: block;
}
.rotAllWrap {
	max-height: 70vh;
	overflow: auto;
	display: grid;
	gap: 10px;
}
.rotation-card .rot-svg-frame {
	background: rgba(255, 255, 255, 0.03);
	border: 1px solid var(--border);
	border-radius: 12px;
	padding: 8px;
	margin: 8px 0;
}
