/* Weapon Paints — interface */

:root {
	--bg: #0f1318;
	--panel: #161c24;
	--panel-2: #1d2631;
	--line: #2a3441;
	--line-strong: #3a4757;
	--text: #e8edf3;
	--muted: #93a0b0;
	--accent: #ffb454;
	--accent-ink: #1c1304;
	--danger: #ff7a6b;

	--fn: #3fa0ff;
	--mw: #3fcf9d;
	--ft: #d9cc45;
	--ww: #f19a3d;
	--bs: #e4574d;

	--radius: 6px;
	--font-display: "Barlow Condensed", "Arial Narrow", Arial, sans-serif;
	--font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	color-scheme: dark;
}

[data-theme="light"] {
	--bg: #eef1f5;
	--panel: #ffffff;
	--panel-2: #f1f4f8;
	--line: #d9e0e8;
	--line-strong: #bcc7d4;
	--text: #16202b;
	--muted: #566475;
	--accent: #e58f0b;
	--danger: #c8382a;
	color-scheme: light;
}

*,
*::before,
*::after {
	box-sizing: border-box;
}

[hidden] {
	display: none !important;
}

html {
	-webkit-text-size-adjust: 100%;
}

html.lock {
	overflow: hidden;
}

body {
	margin: 0;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	background: var(--bg);
	color: var(--text);
	font: 400 15px/1.5 var(--font-body);
}

img {
	max-width: 100%;
}

img.is-broken {
	visibility: hidden;
}

button,
input {
	font: inherit;
	color: inherit;
}

:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

a {
	color: inherit;
}

/* ---------- barra de topo ---------- */

.top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 14px max(clamp(16px, 4vw, 40px), calc((100% - 1240px) / 2));
	border-bottom: 1px solid var(--line);
}

.brand {
	display: flex;
	align-items: center;
	gap: 12px;
	font: 700 26px/1 var(--font-display);
	letter-spacing: 0.02em;
	text-decoration: none;
}

.brand-logo {
	display: block;
	width: 44px;
	height: auto;
	flex: none;
}

.user {
	display: flex;
	align-items: center;
	gap: 10px;
	min-width: 0;
}

.user img {
	width: 30px;
	height: 30px;
	border-radius: 50%;
	flex: none;
}

.user-name {
	font-weight: 500;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	max-width: 22ch;
}

/* ---------- botões ---------- */

.btn {
	appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 8px 14px;
	border: 1px solid var(--line-strong);
	border-radius: var(--radius);
	background: transparent;
	font-weight: 500;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.12s, border-color 0.12s;
}

.btn:hover {
	background: var(--panel-2);
}

.btn-primary {
	background: var(--accent);
	border-color: var(--accent);
	color: var(--accent-ink);
	font-weight: 600;
}

.btn-primary:hover {
	background: var(--accent);
	filter: brightness(1.07);
}

.btn-quiet {
	border-color: transparent;
	color: var(--muted);
}

.btn-quiet:hover {
	color: var(--text);
}

.btn:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* ---------- entrada (sem sessão) ---------- */

.hero {
	flex: 1;
	display: grid;
	grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
	gap: clamp(28px, 6vw, 80px);
	align-items: center;
	width: 100%;
	max-width: 1180px;
	margin: 0 auto;
	padding: clamp(32px, 8vw, 96px) clamp(16px, 4vw, 40px);
}

.hero h1 {
	margin: 0 0 16px;
	font: 700 clamp(48px, 8vw, 92px) / 0.92 var(--font-display);
	letter-spacing: 0.005em;
}

.hero-copy > p {
	margin: 0 0 28px;
	max-width: 44ch;
	font-size: 17px;
	color: var(--muted);
}

.steam-btn {
	margin-bottom: 32px;
}

.steam-btn img {
	display: block;
}

.steps {
	margin: 0;
	padding: 0;
	list-style: none;
	counter-reset: step;
	display: grid;
	gap: 8px;
	color: var(--muted);
}

.steps li {
	counter-increment: step;
	display: flex;
	align-items: baseline;
	gap: 12px;
}

.steps li > span {
	min-width: 0;
}

.steps li::before {
	content: counter(step);
	flex: none;
	width: 22px;
	height: 22px;
	display: grid;
	place-items: center;
	border: 1px solid var(--line-strong);
	border-radius: 50%;
	font-size: 12px;
	font-weight: 600;
	color: var(--text);
}

.steps code,
.toast code {
	padding: 1px 6px;
	border-radius: 4px;
	background: var(--panel-2);
	color: var(--accent);
	font: inherit;
	font-weight: 600;
}

.hero-art {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 12px;
}

.hero-fig {
	position: relative;
	margin: 0;
	display: grid;
	place-items: center;
	padding: 20px 16px 38px;
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: var(--radius);
}

.hero-fig-0 {
	grid-column: 1 / -1;
	padding-block: 28px 44px;
}

.hero-fig img {
	max-height: 110px;
	object-fit: contain;
}

.hero-fig-0 img {
	max-height: 130px;
}

.hero-fig figcaption {
	position: absolute;
	left: 14px;
	bottom: 10px;
	font: 700 20px/1 var(--font-display);
	color: var(--muted);
}

.gauge-static {
	grid-column: 1 / -1;
	margin-top: 6px;
}

/* ---------- barra de filtros ---------- */

.toolbar {
	position: sticky;
	top: 0;
	z-index: 20;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px 18px;
	padding: 12px max(clamp(16px, 4vw, 40px), calc((100% - 1240px) / 2));
	background: var(--bg);
	border-bottom: 1px solid var(--line);
}

.search {
	position: relative;
	flex: 1 1 220px;
	max-width: 340px;
}

.search svg {
	position: absolute;
	left: 11px;
	top: 50%;
	width: 16px;
	height: 16px;
	transform: translateY(-50%);
	color: var(--muted);
	pointer-events: none;
}

.search input,
.ed-search {
	width: 100%;
	padding: 9px 12px;
	border: 1px solid var(--line-strong);
	border-radius: var(--radius);
	background: var(--panel);
}

.search input {
	padding-left: 36px;
}

.search input::placeholder,
.ed-search::placeholder {
	color: var(--muted);
}

.chips {
	display: flex;
	flex-wrap: wrap;
	gap: 6px;
}

.chip {
	padding: 6px 14px;
	border: 1px solid var(--line);
	border-radius: 999px;
	background: transparent;
	color: var(--muted);
	font-weight: 500;
	cursor: pointer;
	transition: background-color 0.12s, color 0.12s;
}

.chip:hover {
	color: var(--text);
	border-color: var(--line-strong);
}

.chip[aria-pressed="true"] {
	background: var(--text);
	border-color: var(--text);
	color: var(--bg);
}

.toggle {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-left: auto;
	color: var(--muted);
	cursor: pointer;
	user-select: none;
}

.toggle input {
	width: 16px;
	height: 16px;
	accent-color: var(--accent);
}

/* ---------- lista de armas ---------- */

.wrap {
	flex: 1;
	width: 100%;
	max-width: 1320px;
	margin: 0 auto;
	padding: 28px clamp(16px, 4vw, 40px) 56px;
}

.group {
	margin-bottom: 40px;
}

.group-head {
	display: flex;
	align-items: baseline;
	gap: 14px;
	margin-bottom: 14px;
}

.group-head h2 {
	margin: 0;
	font: 700 30px/1.1 var(--font-display);
	letter-spacing: 0.01em;
}

.group-meta {
	margin: 0;
	font-size: 13px;
	color: var(--muted);
}

.grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
	gap: 12px;
}

.card {
	position: relative;
	display: flex;
	flex-direction: column;
	padding: 0;
	overflow: hidden;
	text-align: left;
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	cursor: pointer;
	transition: border-color 0.12s;
}

.card:hover {
	border-color: var(--line-strong);
}

.card.is-set {
	border-color: var(--line-strong);
}

.card.is-set::before {
	content: "";
	position: absolute;
	inset: 0 0 auto 0;
	z-index: 1;
	height: 2px;
	background: var(--accent);
}

.card-art {
	display: grid;
	place-items: center;
	aspect-ratio: 4 / 3;
	padding: 14px;
	background: var(--panel-2);
	border-bottom: 1px solid var(--line);
}

.card-art img {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
}

.card-name {
	padding: 10px 12px 0;
	font: 700 21px/1.1 var(--font-display);
	letter-spacing: 0.01em;
}

.card-skin {
	padding: 2px 12px 0;
	font-size: 13px;
	color: var(--muted);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.card.is-set .card-skin {
	color: var(--text);
}

.card-wear {
	display: flex;
	align-items: center;
	gap: 7px;
	padding: 6px 12px 0;
	font-size: 12px;
	color: var(--muted);
}

.card-wear::before,
.preset::before,
.gauge-grade::before {
	content: "";
	flex: none;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--dot, var(--muted));
}

[data-g="fn"] { --dot: var(--fn); }
[data-g="mw"] { --dot: var(--mw); }
[data-g="ft"] { --dot: var(--ft); }
[data-g="ww"] { --dot: var(--ww); }
[data-g="bs"] { --dot: var(--bs); }

.card::after {
	content: "";
	display: block;
	height: 12px;
}

.card-badge {
	position: absolute;
	top: 8px;
	right: 8px;
	z-index: 2;
	padding: 2px 9px;
	border-radius: 999px;
	background: var(--accent);
	color: var(--accent-ink);
	font-size: 12px;
	font-weight: 600;
}

.knife-type {
	display: grid;
	grid-template-columns: auto 1fr auto;
	align-items: center;
	gap: 18px;
	width: 100%;
	max-width: 560px;
	margin-bottom: 30px;
	padding: 10px 18px 10px 10px;
	text-align: left;
	background: var(--panel);
	border: 1px solid var(--line-strong);
	border-radius: var(--radius);
	cursor: pointer;
}

.knife-type:hover {
	background: var(--panel-2);
}

.knife-type img {
	width: 120px;
	height: 70px;
	padding: 6px;
	object-fit: contain;
	background: var(--panel-2);
	border-radius: 4px;
}

.knife-type > span {
	display: grid;
}

.kt-label {
	font-size: 13px;
	color: var(--muted);
}

.kt-name {
	font: 700 26px/1.1 var(--font-display);
}

.kt-action {
	font-weight: 600;
	color: var(--accent);
}

.empty {
	padding: 56px 0;
	text-align: center;
	color: var(--muted);
}

/* ---------- editor ---------- */

dialog {
	width: min(1060px, calc(100vw - 32px));
	height: min(740px, calc(100dvh - 32px));
	max-width: none;
	max-height: none;
	padding: 0;
	overflow: hidden;
	color: var(--text);
	background: var(--panel);
	border: 1px solid var(--line-strong);
	border-radius: 10px;
}

dialog[open] {
	display: block;
	animation: open 0.14s ease-out;
}

dialog::backdrop {
	background: rgba(5, 8, 12, 0.72);
}

@keyframes open {
	from { opacity: 0; transform: translateY(6px); }
	to { opacity: 1; transform: none; }
}

.ed {
	display: grid;
	grid-template-columns: 340px minmax(0, 1fr);
	height: 100%;
}

.ed-side {
	display: flex;
	flex-direction: column;
	gap: 16px;
	padding: 20px;
	overflow-y: auto;
	background: var(--panel);
	border-right: 1px solid var(--line);
}

.ed-preview {
	display: grid;
	place-items: center;
	flex: none;
	aspect-ratio: 4 / 3;
	padding: 16px;
	background: var(--panel-2);
	border: 1px solid var(--line);
	border-radius: var(--radius);
}

.ed-preview img {
	max-width: 100%;
	max-height: 100%;
	object-fit: contain;
}

.ed-title {
	margin: 0;
	font: 700 32px/1.05 var(--font-display);
	outline: none;
}

.ed-sub {
	margin: 2px 0 0;
	color: var(--muted);
}

.gauge-field,
.field {
	display: grid;
	gap: 8px;
}

.gauge-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
}

.gauge-head label,
.field label {
	font-weight: 600;
}

.num {
	width: 92px;
	padding: 6px 10px;
	text-align: right;
	font-variant-numeric: tabular-nums;
	background: var(--bg);
	border: 1px solid var(--line-strong);
	border-radius: var(--radius);
}

.num-wide {
	width: 100%;
	text-align: left;
}

/* O calibre: as larguras são os intervalos reais de desgaste (0–0.07–0.15–0.38–0.45–1) */
.gauge {
	position: relative;
	display: flex;
	height: 12px;
	margin: 8px 0 0;
}

.gauge > i {
	display: block;
	height: 100%;
	border-right: 2px solid var(--panel);
}

.gauge > i:nth-of-type(1) { flex: 0 0 7%; background: var(--fn); border-radius: 3px 0 0 3px; }
.gauge > i:nth-of-type(2) { flex: 0 0 8%; background: var(--mw); }
.gauge > i:nth-of-type(3) { flex: 0 0 23%; background: var(--ft); }
.gauge > i:nth-of-type(4) { flex: 0 0 7%; background: var(--ww); }
.gauge > i:nth-of-type(5) { flex: 1 1 auto; background: var(--bs); border-right: 0; border-radius: 0 3px 3px 0; }

.gauge-static {
	height: 10px;
}

.gauge-static > i {
	border-right-color: var(--bg);
}

.gauge input[type="range"] {
	position: absolute;
	left: 0;
	top: -9px;
	width: 100%;
	height: 30px;
	margin: 0;
	background: transparent;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

.gauge input[type="range"]::-webkit-slider-runnable-track {
	height: 30px;
	background: transparent;
}

.gauge input[type="range"]::-moz-range-track {
	height: 30px;
	background: transparent;
}

.gauge input[type="range"]::-webkit-slider-thumb {
	-webkit-appearance: none;
	width: 6px;
	height: 30px;
	background: var(--text);
	border: 2px solid var(--panel);
	border-radius: 3px;
	box-shadow: 0 0 0 1px var(--line-strong);
}

.gauge input[type="range"]::-moz-range-thumb {
	width: 6px;
	height: 30px;
	box-sizing: border-box;
	background: var(--text);
	border: 2px solid var(--panel);
	border-radius: 3px;
	box-shadow: 0 0 0 1px var(--line-strong);
}

.gauge-grade {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 2px 0 0;
	font-weight: 600;
}

.gauge-grade::before {
	width: 10px;
	height: 10px;
}

.presets {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
}

.preset {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 4px 9px;
	font-size: 13px;
	font-weight: 500;
	color: var(--muted);
	background: transparent;
	border: 1px solid var(--line-strong);
	border-radius: 999px;
	cursor: pointer;
}

.preset:hover {
	color: var(--text);
}

.preset[aria-pressed="true"] {
	color: var(--text);
	border-color: var(--text);
}

.ed-msg {
	min-height: 20px;
	margin: 0;
	font-size: 13px;
	color: var(--danger);
}

.ed-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: auto;
}

.ed-actions .btn-primary {
	flex: 1 1 140px;
}

.ed-main {
	display: flex;
	flex-direction: column;
	min-width: 0;
	min-height: 0;
	background: var(--bg);
}

.ed-bar {
	display: flex;
	gap: 10px;
	padding: 14px 16px;
	border-bottom: 1px solid var(--line);
}

.skin-grid {
	position: relative;
	flex: 1;
	min-height: 0;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(132px, 1fr));
	align-content: start;
	gap: 10px;
	padding: 16px;
	overflow-y: auto;
}

.skin {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 8px;
	text-align: left;
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	cursor: pointer;
}

.skin:hover {
	border-color: var(--line-strong);
}

.skin img {
	width: 100%;
	aspect-ratio: 4 / 3;
	padding: 6px;
	object-fit: contain;
	background: var(--panel-2);
	border-radius: 4px;
}

.skin span {
	display: -webkit-box;
	overflow: hidden;
	font-size: 13px;
	line-height: 1.25;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	line-clamp: 2;
}

.skin[aria-pressed="true"] {
	border-color: var(--accent);
	box-shadow: 0 0 0 1px var(--accent);
}

.grid-msg {
	grid-column: 1 / -1;
	margin: 32px 0;
	text-align: center;
	color: var(--muted);
}

/* ---------- aviso ---------- */

.toast {
	position: fixed;
	left: 50%;
	bottom: 24px;
	z-index: 100;
	max-width: min(92vw, 520px);
	padding: 10px 16px;
	background: var(--text);
	color: var(--bg);
	font-weight: 500;
	border-radius: var(--radius);
	opacity: 0;
	transform: translate(-50%, 16px);
	pointer-events: none;
	transition: opacity 0.18s, transform 0.18s;
}

.toast.show {
	opacity: 1;
	transform: translate(-50%, 0);
}

/* ---------- rodapé ---------- */

.foot {
	padding: 20px max(clamp(16px, 4vw, 40px), calc((100% - 1240px) / 2));
	border-top: 1px solid var(--line);
	font-size: 13px;
	color: var(--muted);
}

/* ---------- telemóvel ---------- */

@media (max-width: 820px) {
	.hero {
		grid-template-columns: 1fr;
	}

	.toggle {
		margin-left: 0;
	}

	.search {
		max-width: none;
	}

	dialog {
		width: 100vw;
		height: 100dvh;
		border: 0;
		border-radius: 0;
	}

	.ed {
		grid-template-columns: 1fr;
		grid-template-rows: auto minmax(0, 1fr);
	}

	.ed-side {
		display: grid;
		grid-template-columns: 124px minmax(0, 1fr);
		align-items: center;
		gap: 12px 14px;
		max-height: 56dvh;
		padding: 14px;
		border-right: 0;
		border-bottom: 1px solid var(--line);
	}

	.ed-side > * {
		grid-column: 1 / -1;
	}

	.ed-side > .ed-preview {
		grid-column: 1;
		aspect-ratio: auto;
		height: 84px;
		padding: 6px;
	}

	.ed-side > .ed-head {
		grid-column: 2;
	}

	.ed-preview img {
		max-height: 70px;
	}

	.ed-title {
		font-size: 26px;
	}

	.field {
		grid-template-columns: 1fr 130px;
		align-items: center;
	}

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

	.ed-actions {
		position: sticky;
		bottom: -14px;
		margin: 0 -14px -14px;
		padding: 10px 14px;
		background: var(--panel);
		border-top: 1px solid var(--line);
	}

	.knife-type {
		grid-template-columns: auto 1fr;
	}

	.kt-action {
		display: none;
	}

	.user-name {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	*,
	*::before,
	*::after {
		animation: none !important;
		transition: none !important;
	}
}
