/* ====================================================
   saper-calculator.css — styles for /saper-calculator only.
   All classes are prefixed calc- so main.css is untouched.
==================================================== */

.calc-grid {
	display: grid;
	grid-template-columns: minmax(0, 360px) minmax(0, 1fr);
	gap: 24px;
	align-items: start;
}

@media (max-width: 820px) {
	.calc-grid {
		grid-template-columns: minmax(0, 1fr);
	}
}

.calc-panel {
	background: #ffffff;
	border: 1px solid var(--line);
	border-radius: 24px;
	padding: 24px;
	display: flex;
	flex-direction: column;
	gap: 18px;
	min-width: 0;
	box-shadow: var(--shadow-soft);
}

.calc-stack {
	container: calc / inline-size;
	display: flex;
	flex-direction: column;
	gap: 20px;
	min-width: 0;
}

.calc-panel h2,
.calc-save h2 {
	font-family: var(--display-font);
	font-size: 1.25rem;
	font-weight: 700;
	line-height: 1.25;
	color: var(--paper);
}

.calc-group {
	font-family: var(--mono-font);
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--muted);
	border-top: 1px solid var(--line);
	padding-top: 14px;
}

.calc-group:first-child {
	border-top: 0;
	padding-top: 0;
}

.calc-field {
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.calc-field label,
.calc-field .calc-label {
	font-weight: 600;
	font-size: 0.95rem;
	color: var(--paper);
	display: flex;
	justify-content: space-between;
	gap: 8px;
}

.calc-field small,
.calc-note {
	color: var(--muted);
	font-size: 0.82rem;
	line-height: 1.5;
}

.calc-field output {
	font-variant-numeric: tabular-nums;
	color: #b45309;
	font-weight: 700;
	white-space: nowrap;
}

/* main.css styles every input globally; undo that for sliders */
.calc-panel input[type=range] {
	min-height: 0;
	height: 28px;
	padding: 0;
	border: 0;
	box-shadow: none;
	background: transparent;
	accent-color: var(--accent);
}

.calc-panel input[type=range]:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
	box-shadow: 0 0 0 4px rgba(47, 111, 78, 0.10);
}

.calc-currow {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 120px;
	gap: 10px;
	align-items: end;
}

.calc-currow > .calc-field:only-child {
	grid-column: 1 / -1;
}

.calc-duty {
	background: #fef3c7;
	color: var(--paper);
	border-radius: 10px;
	padding: 8px 10px;
	margin-top: 4px;
}

.calc-life {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
}

.calc-life button {
	font: inherit;
	font-weight: 600;
	font-size: 0.9rem;
	border: 1px solid var(--line);
	background: #ffffff;
	color: var(--paper);
	border-radius: 999px;
	padding: 8px 18px;
	min-height: 42px;
	cursor: pointer;
	transition: background 0.3s, color 0.3s, border-color 0.3s;
}

.calc-life button:hover {
	border-color: rgba(47, 111, 78, 0.5);
}

.calc-life button[aria-pressed=true] {
	background: var(--accent);
	border-color: var(--accent);
	color: #ffffff;
}

.calc-life button:focus-visible,
.calc-panel button:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
	box-shadow: 0 0 0 4px rgba(47, 111, 78, 0.10);
}

/* Result hero */
.calc-hero {
	background: var(--accent);
	color: #ffffff;
	border-radius: 24px;
	padding: 28px;
	display: flex;
	flex-direction: column;
	gap: 22px;
	box-shadow: var(--shadow-hover);
}

.calc-hero-stats {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0;
}

.calc-hero-cell {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 0 20px 16px;
	min-width: 0;
	border-left: 1px solid rgba(255, 255, 255, 0.22);
}

.calc-hero-cell:nth-child(odd) {
	padding-left: 0;
	border-left: 0;
}

.calc-hero-cell:nth-child(n + 3) {
	padding-top: 16px;
	border-top: 1px solid rgba(255, 255, 255, 0.22);
}

.calc-hero-cell:nth-last-child(-n + 2) {
	padding-bottom: 0;
}

.calc-hero-ico {
	flex: 0 0 52px;
	width: 52px;
	height: 52px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.16);
	border: 1px solid rgba(255, 255, 255, 0.28);
	color: #ffffff;
	display: flex;
	align-items: center;
	justify-content: center;
}

.calc-hero-cur {
	background: #f59e0b;
	border-color: #f59e0b;
	color: #1a1405;
	font-family: var(--display-font);
	font-size: 1.6rem;
	font-weight: 800;
	line-height: 1;
}

.calc-hero-cur.is-long {
	font-size: 0.8rem;
	letter-spacing: -0.02em;
}

.calc-hero-txt {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}

.calc-hero-num {
	font-family: var(--display-font);
	font-weight: 800;
	font-size: clamp(1.3rem, 3.6cqi, 1.8rem);
	line-height: 1;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.calc-hero-cell.is-cost .calc-hero-num {
	font-size: clamp(1.8rem, 4.4cqi, 2.6rem);
}

.calc-hero .calc-k {
	font-size: 0.82rem;
	line-height: 1.35;
	opacity: 0.9;
}

.calc-hero-foot {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 10px 16px;
	padding-top: 18px;
	border-top: 1px solid rgba(255, 255, 255, 0.22);
}

.calc-pill {
	display: inline-block;
	background: #f59e0b;
	color: #1a1405;
	font-weight: 800;
	border-radius: 999px;
	padding: 6px 16px;
	font-size: 1rem;
}

@container calc (max-width: 520px) {
	.calc-hero-stats {
		grid-template-columns: minmax(0, 1fr);
	}

	.calc-hero-cell,
	.calc-hero-cell:nth-child(odd) {
		padding: 16px 0 0;
		border-left: 0;
		border-top: 1px solid rgba(255, 255, 255, 0.22);
	}

	.calc-hero-cell:first-child {
		padding-top: 0;
		border-top: 0;
	}

	.calc-hero-num {
		font-size: clamp(1.5rem, 7cqi, 2rem);
	}
}

/* Cost bars */
.calc-bars {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.calc-barrow {
	display: grid;
	grid-template-columns: 76px minmax(0, 1fr) 78px;
	gap: 12px;
	align-items: center;
}

.calc-barrow .calc-lbl {
	font-weight: 600;
	font-size: 0.92rem;
}

.calc-barrow .calc-val {
	text-align: right;
	font-variant-numeric: tabular-nums;
	font-weight: 700;
	font-size: 0.92rem;
}

.calc-track {
	height: 30px;
	background: var(--soft-band);
	border-radius: 8px;
	display: flex;
	overflow: hidden;
	border: 1px solid var(--line);
}

.calc-seg {
	height: 100%;
}

.calc-legend {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 16px;
	font-size: 0.85rem;
	color: var(--muted);
}

.calc-legend i {
	display: inline-block;
	width: 12px;
	height: 12px;
	border-radius: 3px;
	margin-right: 6px;
	vertical-align: -1px;
}

/* Tiles */
.calc-tiles {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 12px;
}

@media (max-width: 560px) {
	.calc-tiles {
		grid-template-columns: minmax(0, 1fr);
	}
}

.calc-tile {
	background: linear-gradient(135deg, rgba(47, 111, 78, 0.09), rgba(47, 111, 78, 0.02));
	border: 1px solid rgba(47, 111, 78, 0.22);
	border-left: 4px solid var(--accent);
	border-radius: 16px;
	padding: 16px 16px 16px 18px;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.calc-tile-head {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 4px;
}

.calc-tile .calc-tile-ico {
	flex: 0 0 34px;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: var(--accent);
	color: #ffffff;
	display: flex;
	align-items: center;
	justify-content: center;
}

.calc-tile .calc-tile-label {
	font-family: var(--mono-font);
	font-size: 0.7rem;
	font-weight: 700;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--accent);
	line-height: 1.3;
}

.calc-tile b {
	font-family: var(--display-font);
	font-size: clamp(1.7rem, 2.6vw, 2.2rem);
	font-weight: 800;
	color: var(--accent);
	font-variant-numeric: tabular-nums;
	line-height: 1.1;
}

.calc-tile span {
	font-size: 0.85rem;
	color: var(--muted);
	line-height: 1.45;
}

/* Top-level tiles are a <div> (not a <section>) so main.css section padding/background does not apply */
.calc-tiles-top {
	padding: 0;
	background: transparent;
}

/* Table */
.calc-tablebox {
	overflow-x: auto;
}

.calc-table {
	width: 100%;
	border-collapse: collapse;
	font-variant-numeric: tabular-nums;
	font-size: 0.95rem;
}

.calc-table th,
.calc-table td {
	text-align: right;
	padding: 10px;
	border-bottom: 1px solid var(--line);
	white-space: nowrap;
}

.calc-table th:first-child,
.calc-table td:first-child {
	text-align: left;
}

.calc-table th {
	font-family: var(--mono-font);
	font-size: 0.7rem;
	color: var(--muted);
	text-transform: uppercase;
	letter-spacing: 0.08em;
}

.calc-table tr.on td {
	background: #fef3c7;
	font-weight: 700;
}

.calc-good {
	color: var(--accent);
	font-weight: 700;
}

/* Maths box */
.calc-math {
	font-family: var(--mono-font);
	font-size: 0.8rem;
	line-height: 1.7;
	background: var(--soft-band);
	border: 1px solid var(--line);
	border-radius: 12px;
	padding: 14px 16px;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
	color: var(--paper);
}

/* Save / contact band */
.calc-save {
	background: #ffffff;
	border: 1px solid var(--line);
	border-radius: 24px;
	padding: 28px;
	display: flex;
	flex-direction: column;
	gap: 16px;
	box-shadow: var(--shadow-soft);
}

.calc-btnrow {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
}

.calc-btnrow button,
.calc-btnrow a {
	min-height: 48px;
}

.calc-msg:empty {
	display: none;
}

.calc-msg.err {
	color: #b3261e;
}

@media (prefers-reduced-motion: no-preference) {
	.calc-seg {
		transition: width 0.25s ease;
	}
}

.calc-panel [hidden],
.calc-save [hidden] {
	display: none !important;
}

.calc-currow > .calc-field:first-child:has(+ [hidden]) {
	grid-column: 1 / -1;
}

.calc-fleet {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
}

.calc-fleet button {
	min-width: 0;
	padding: 8px 0;
}

