/* owns: game field and HUD presentation
   edit for: drawer, player columns, score, quests and control styles */

html, body { margin: 0; height: 100%; overflow: hidden; background: #12151b; }
#app { position: fixed; inset: 0; }
.game-status { padding: 12px; color: #c9d1e0; font: 12px/1.4 system-ui, sans-serif; }
.game-status p { margin: 0; }
.game-status-controls { display: grid; gap: 7px; margin-top: 8px; }
.game-status strong { color: #edf0f6; }
/* the field is the screen: no frame, no gutter, and the divider is the only drawn boundary */
canvas { display: block; width: 100%; height: 100%; touch-action: none; }
.draw-options {
	position: fixed;
	top: 12px;
	left: 12px;
	z-index: 4;
	width: min(280px, calc(100vw - 24px));
	color: #edf0f6;
	font: 13px/1.35 system-ui, sans-serif;
}
.draw-options summary {
	width: fit-content;
	padding: 9px 12px;
	border: 1px solid #495263;
	border-radius: 7px;
	background: #12151b;
	font-weight: 600;
	list-style: none;
	cursor: pointer;
}
.draw-options summary::-webkit-details-marker { display: none; }
.draw-options summary::before { content: '☰'; margin-right: 7px; color: #9ba6ba; }
.draw-options[open] summary::before { content: '×'; }
.draw-options summary:focus-visible { outline: 2px solid #83b8ff; outline-offset: 2px; }
.drawer-content {
	max-height: calc(100dvh - 76px);
	overflow-y: auto;
	overscroll-behavior: contain;
	margin-top: 6px;
	border: 1px solid #495263;
	border-radius: 8px;
	background: #12151b;
	box-shadow: 0 3px 12px rgba(0, 0, 0, 0.25);
}
.drawer-backdrop { position: fixed; inset: 0; z-index: 3; background: rgba(0, 0, 0, 0.4); }
.drawer-backdrop[hidden] { display: none; }
.draw-options fieldset { min-width: 0; margin: 0; padding: 8px 12px 12px; border: 0; }
.draw-options legend { padding: 0 4px; color: #c9d1e0; }
.draw-options-group { display: grid; gap: 6px; }
.draw-options-group + .draw-options-group {
	margin-top: 9px;
	padding-top: 8px;
	border-top: 1px solid rgba(73, 82, 99, 0.75);
}
.draw-options-heading {
	color: #9ba6ba;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.05em;
	text-transform: uppercase;
}
.draw-options label { display: flex; align-items: center; gap: 7px; cursor: pointer; }
.draw-options input { margin: 0; accent-color: #83b8ff; }
.preview-mode { margin-top: 9px; }
.preview-mode label {
	grid-template-columns: 16px 1fr 34px;
	align-items: center;
}
/* one target, three shapes: an option must look like what it draws, not like a styled swatch */
.target {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 1px;
	box-sizing: border-box;
	overflow: hidden;
	flex: none;
}
.target i {
	display: block;
	flex: none;
	border-radius: 50%;
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.28);
}
.target-smooth i { width: 100%; height: 100%; border-radius: 0; box-shadow: none; }
.target-empty { background: transparent; }
.preview-mode .preview-sample {
	width: 34px;
	height: 22px;
	border-radius: 4px;
	border: 1px solid rgba(237, 240, 246, 0.25);
}
.preview-mode .target-mean i { width: 16px; height: 16px; }
.preview-mode .target-range i { width: 5px; height: 5px; }
.player-hud {
	position: fixed;
	top: 12px;
	right: 12px;
	z-index: 1;
	width: 230px;
	color: #edf0f6;
	font: 13px/1.35 system-ui, sans-serif;
}
.score-panel {
	padding: 9px 11px 8px;
	border: 1px solid #495263;
	border-radius: 8px;
	background: rgba(18, 21, 27, 0.94);
	box-shadow: 0 3px 12px rgba(0, 0, 0, 0.25);
}
.score-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.score-header h2 { margin: 0; color: #c9d1e0; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; }
.score-restart {
	padding: 3px 7px;
	border: 1px solid #495263;
	border-radius: 5px;
	background: #202936;
	color: #c9d1e0;
	font: 10px/1.3 system-ui, sans-serif;
	cursor: pointer;
}
.score-restart:hover { border-color: #83b8ff; color: #edf0f6; }
.score-restart:focus-visible, .score-bot:focus-visible { outline: 2px solid #83b8ff; outline-offset: 2px; }
.score-table { width: 100%; margin-top: 5px; border-collapse: collapse; font-size: 12px; }
.score-table thead th { padding: 2px 0 4px; color: #9ba6ba; font-size: 10px; font-weight: 500; }
.score-table th:first-child { text-align: left; }
.score-table th:nth-child(2), .score-table td:nth-child(2) { width: 38px; text-align: center; }
.score-table th:last-child, .score-table td:last-child { width: 44px; text-align: right; }
.score-row th { padding: 5px 0; font-weight: 600; }
.score-row + .score-row { border-top: 1px solid rgba(73, 82, 99, 0.45); }
.score-row[data-active="false"] th, .score-row[data-active="false"] .score-value { color: #778397; }
.score-bot { width: 16px; height: 16px; margin: 0; vertical-align: middle; accent-color: #83b8ff; cursor: pointer; }
.score-value { color: #a8d3ff; font-size: 16px; font-weight: 700; font-variant-numeric: tabular-nums; }
.score-mode { margin-top: 5px; color: #9ba6ba; font-size: 10px; }
/* a bot's character sits beside the name in both places that name a player, so the icon and its tint
   are the same badge in the score table and the force column */
.char-badge {
	display: inline-flex;
	align-items: center;
	gap: 3px;
	padding: 0 6px;
	border: 1px solid currentColor;
	border-radius: 999px;
	color: #9ba6ba;
	font-size: 10px;
	font-weight: 600;
	line-height: 1.6;
	letter-spacing: 0.02em;
	white-space: nowrap;
}
.char-badge[hidden] { display: none; }
.char-badge[data-char="profit"] { color: #f0c05a; }
.char-badge[data-char="denier"] { color: #ef8074; }
.score-row .char-badge { margin-left: 5px; padding: 0 4px; vertical-align: middle; }
.quest-list {
	margin: 8px 0 0;
	padding: 0;
	list-style: none;
}
/* cards live in their player's column; this list is only the mount point before that column exists */
.quest-list:empty { display: none; }
.quest {
	display: grid;
	gap: 5px;
	box-sizing: border-box;
	padding: 7px 9px 6px;
	border: 1px solid #495263;
	border-radius: 8px;
	background: rgba(18, 21, 27, 0.92);
	box-shadow: 0 3px 12px rgba(0, 0, 0, 0.25);
	cursor: pointer;
	touch-action: none;
	user-select: none;
}
.quest-head { display: grid; grid-template-columns: 22px 20px minmax(0, 1fr); gap: 6px; align-items: center; }
.quest-arrow { color: #a8d3ff; font: 700 24px/1 system-ui, sans-serif; text-align: center; }
.quest + .quest { margin-top: 6px; }
.quest:focus-visible { outline: 2px solid #83b8ff; outline-offset: 2px; }
.quest[hidden] { display: none; }
.quest:active { border-color: #83b8ff; }
.quest-swatch {
	width: 22px;
	height: 22px;
	border-radius: 5px;
	border: 1px solid rgba(237, 240, 246, 0.25);
}
.quest-swatch.target-mean i { width: 16px; height: 16px; }
.quest-swatch.target-range i { width: 4px; height: 4px; }
.quest-text { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.quest-bar {
	position: relative;
	display: block;
	height: 11px;
	overflow: hidden;
	border-radius: 3px;
	background: #0b1119;
	box-shadow: inset 0 0 0 1px #37424f;
}
.quest-bar-fill {
	display: block;
	box-sizing: border-box;
	width: 0;
	height: 100%;
	background: linear-gradient(90deg, #4f8fce, #83b8ff);
	color: #0b1119;
	font: 700 8px/11px system-ui, sans-serif;
	font-style: normal;
	text-align: right;
	padding-right: 3px;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
	overflow: hidden;
	transition: width 0.18s linear;
}
.quest[data-done="true"] .quest-bar-fill { background: linear-gradient(90deg, #4faf7f, #75d9a6); }
.quest-meta { color: #9ba6ba; font-size: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quest-panel {
	position: fixed;
	left: 50%;
	bottom: 64px;
	transform: translateX(-50%);
	z-index: 2;
	box-sizing: border-box;
	width: min(236px, calc(100vw - 24px));
	max-height: calc(100dvh - 140px);
	overflow-y: auto;
	padding: 10px 12px 12px;
	border: 1px solid #495263;
	border-radius: 8px;
	background: rgba(18, 21, 27, 0.96);
	color: #edf0f6;
	font: 13px/1.35 system-ui, sans-serif;
}
.quest-panel[hidden] { display: none; }
.quest-panel-swatch {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 2px;
	height: 54px;
	border-radius: 6px;
	border: 1px solid rgba(237, 240, 246, 0.25);
	overflow: hidden;
}
.quest-panel-swatch.target-mean i { width: 34px; height: 34px; }
.quest-panel-swatch.target-range i { width: 10px; height: 10px; }
.quest-panel-swatch.target-smooth i { width: 100%; height: 100%; border-radius: 0; box-shadow: none; }
.quest-goal {
	position: fixed;
	left: 50%;
	bottom: 12px;
	transform: translateX(-50%);
	z-index: 2;
	box-sizing: border-box;
	width: max-content;
	max-width: min(480px, calc(100vw - 24px));
	padding: 6px 10px;
	border: 1px solid #495263;
	border-radius: 8px;
	background: rgba(18, 21, 27, 0.92);
	box-shadow: 0 3px 12px rgba(0, 0, 0, 0.25);
	color: #edf0f6;
	font: 12px/1.35 system-ui, sans-serif;
}
.quest-goal[hidden] { display: none; }
.quest-panel-title { margin-top: 8px; font-weight: 600; }
.quest-panel-detail { margin-top: 3px; color: #9ba6ba; font-size: 11px; }
.quest-panel-dots { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 7px; }
.quest-panel-dots i {
	width: 9px;
	height: 9px;
	border-radius: 50%;
	border: 1px solid rgba(237, 240, 246, 0.35);
}
.quest-panel-dots i.on { background: #83b8ff; border-color: #83b8ff; }
.force-panels {
	position: fixed;
	inset: 0;
	z-index: 1;
	pointer-events: none;
	color: #edf0f6;
	font: 12px/1.35 system-ui, sans-serif;
}
.force-pair {
	position: absolute;
	bottom: 12px;
	display: grid;
	gap: 6px;
	width: min(268px, calc((100vw - 64px) / 2));
	max-height: calc(100dvh - 190px);
	overflow-y: auto;
	overscroll-behavior: contain;
	pointer-events: auto;
}
.force-pair[data-player="0"] { left: 12px; }
.force-pair[data-player="1"] { right: 12px; }
.force-pair .quest { width: 100%; box-shadow: none; }
.force-pair .quest + .quest { margin-top: 0; }
.force-panel {
	box-sizing: border-box;
	flex: 0 0 auto;
	width: 100%;
	min-width: 0;
	padding: 10px 11px 9px;
	border: 1px solid #445263;
	border-radius: 10px;
	background: rgba(20, 26, 35, 0.96);
	box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}
.force-panel-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; }
.force-meta { display: inline-flex; align-items: center; gap: 6px; }
.force-player { color: #eef3f8; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
.force-player::before {
	content: '';
	display: inline-block;
	width: 6px;
	height: 6px;
	margin: 0 6px 2px 0;
	border-radius: 50%;
	background: #75d9a6;
}
/* the marker carries the control channel, so two players read as two colours, not two identical cards */
.force-panel[data-channel="keys"] .force-player::before { background: #f3c567; }
.force-kind { color: #9caabd; font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; }
.force-status { margin-top: 5px; color: #93a3b7; font-size: 11px; font-variant-numeric: tabular-nums; }
.force-status[data-active="true"] { color: #a8d3ff; }
.force-panel-body { display: grid; grid-template-columns: minmax(76px, 1fr) minmax(57px, 0.8fr); gap: 9px; margin-top: 12px; }
.force-column-title { margin-bottom: 6px; color: #91a0b2; font-size: 9px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.force-scale { display: flex; align-items: stretch; gap: 2px; height: 146px; }
.force-scale-labels {
	display: flex;
	flex: 0 0 35px;
	flex-direction: column;
	justify-content: space-between;
	box-sizing: border-box;
	padding: 4px 0;
	color: #91a0b2;
	font-size: 9px;
	font-weight: 700;
	white-space: nowrap;
}
.force-zero-label { color: #75d9a6; }
.force-slider-shell { position: relative; flex: 1; min-width: 32px; height: 100%; border-radius: 6px; }
.force-slider-shell:focus-within { outline: 2px solid #83b8ff; outline-offset: 2px; }
.force-slider-rail { position: absolute; inset: 10px 0; pointer-events: none; }
.force-slider-rail::before {
	content: '';
	position: absolute;
	top: 0;
	bottom: 0;
	left: 50%;
	width: 5px;
	transform: translateX(-50%);
	border-radius: 4px;
	background: #3c4a5a;
}
.force-slider-rail::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 3px;
	right: 3px;
	height: 2px;
	transform: translateY(-50%);
	border-radius: 2px;
	background: #75d9a6;
	box-shadow: 0 0 7px rgba(117, 217, 166, 0.3);
}
.force-slider-thumb {
	position: absolute;
	left: 50%;
	z-index: 1;
	box-sizing: border-box;
	width: 24px;
	height: 14px;
	transform: translate(-50%, -50%);
	border: 2px solid #9acaff;
	border-radius: 5px;
	background: #e1f0ff;
	box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
}
.force-slider {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	writing-mode: vertical-lr;
	direction: ltr;
	touch-action: none;
	cursor: ns-resize;
}
.force-slider:disabled { cursor: default; }
/* a keyboard-owned slider still takes focus so its keys reach the window, but the pointer is player 1's */
.force-slider-keys { cursor: default; pointer-events: none; }
.force-selected { margin-top: 5px; color: #aab9c9; font-size: 10px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.force-energy-body { display: flex; align-items: stretch; gap: 7px; height: 146px; }
.force-meter {
	position: relative;
	box-sizing: border-box;
	flex: 0 0 16px;
	height: 100%;
	overflow: hidden;
	border: 1px solid #445263;
	border-radius: 5px;
	background: #0b1119;
}
.force-meter-fill, .force-meter-use { position: absolute; right: 0; bottom: 0; left: 0; display: block; }
.force-meter-fill { background: linear-gradient(#a3d5ff, #599fd6); }
.force-meter-use { background: #e28083; box-shadow: inset 0 1px rgba(255, 222, 216, 0.8); }
.force-energy-numbers { display: flex; min-width: 0; flex-direction: column; align-items: flex-start; font-variant-numeric: tabular-nums; }
.force-energy-number { color: #e2f2ff; font-size: 15px; font-weight: 700; line-height: 1.1; }
.force-energy-capacity { color: #8697aa; font-size: 10px; }
.force-cost-label { margin-top: auto; color: #9eacbc; font-size: 9px; white-space: nowrap; }
.force-cost { color: #f0a1a1; font-size: 12px; font-weight: 700; }
.force-help { margin-top: 9px; padding-top: 7px; border-top: 1px solid #34404d; color: #93a3b7; font-size: 10px; line-height: 1.35; }
.settings-note { margin: -1px 0 0 20px; color: #9ba6ba; font-size: 11px; }
.settings-intro { margin: 0 0 8px; color: #9ba6ba; font-size: 11px; line-height: 1.35; }
.settings-range-label { justify-content: space-between; gap: 10px; }
.settings-range-label output { color: #a8d3ff; font-variant-numeric: tabular-nums; white-space: nowrap; }
.draw-options input[type="range"] { width: 100%; min-height: 20px; cursor: pointer; }
.settings-url { display: grid; gap: 4px; color: #9ba6ba; font-size: 11px; }
.settings-url[hidden] { display: none; }
.settings-url input { box-sizing: border-box; width: 100%; color: #edf0f6; background: #202936; border: 1px solid #495263; border-radius: 3px; }
.preview-overlays { display: contents; }
@media (min-width: 1400px) and (min-height: 650px) {
	body:has(#settings-panel[open]) .force-pair[data-player="0"] { left: 304px; }
}
@media (max-width: 700px) {
	.draw-options { top: 8px; left: 8px; font-size: 12px; }
	.draw-options summary { padding: 7px 9px; font-size: 11px; }
	.player-hud { top: 8px; right: 8px; width: 170px; font-size: 11px; }
	.score-panel { padding: 6px 9px; }
	.score-mode { font-size: 9px; }
	.force-pair { bottom: 8px; max-height: calc(100dvh - 182px); gap: 4px; }
	.force-pair[data-player="0"] { left: 8px; }
	.force-pair[data-player="1"] { right: 8px; }
	.force-panel { padding: 7px; font-size: 11px; }
	.force-panel-body { grid-template-columns: minmax(28px, 1fr) minmax(45px, 1fr); gap: 5px; }
	.force-scale-labels { display: none; }
	.force-slider-shell { min-width: 28px; }
	.force-energy-body { gap: 4px; }
	.force-meter { flex-basis: 13px; }
	.force-energy-number { font-size: 15px; }
	.force-selected { font-size: 9px; white-space: normal; }
	.force-player { font-size: 10px; letter-spacing: 0; }
	.force-kind { font-size: 9px; }
	.char-badge { padding: 0 4px; font-size: 9px; }
	.force-help { display: none; }
	.quest { padding: 6px; }
	.quest-text { white-space: normal; overflow-wrap: anywhere; }
	.quest-head { grid-template-columns: 18px 18px minmax(0, 1fr); gap: 4px; }
	.quest-swatch { width: 18px; height: 18px; }
	.quest-meta { font-size: 9px; }
}
@media (max-height: 600px) {
	.quest-meta { display: none; }
	.quest { padding: 5px 8px; gap: 3px; }
	.quest-swatch { width: 20px; height: 20px; }
	.quest-head { grid-template-columns: 20px 18px minmax(0, 1fr); }
	.quest-arrow { font-size: 21px; }
	.score-panel { padding: 6px 9px; }
	.score-table { margin-top: 2px; }
	.score-row th { padding: 3px 0; }
	.score-mode { margin-top: 3px; }
	.force-panel { padding-top: 7px; padding-bottom: 7px; }
	.force-status { margin-top: 2px; }
	.force-panel-body { margin-top: 5px; }
	.force-column-title { margin-bottom: 3px; }
	.force-scale, .force-energy-body { height: 72px; }
	.force-selected { margin-top: 3px; }
	.force-help {
		position: absolute;
		width: 1px;
		height: 1px;
		margin: -1px;
		padding: 0;
		overflow: hidden;
		border: 0;
		clip-path: inset(50%);
		white-space: nowrap;
	}
	.force-panel::after { content: attr(data-hint); display: block; margin-top: 3px; color: #93a3b7; font-size: 9px; }
}
@media (max-height: 450px) {
	.quest-bar { height: 9px; }
	.quest-head { grid-template-columns: 18px 16px minmax(0, 1fr); }
	.quest-arrow { font-size: 19px; }
}
