@font-face {
	font-family: "Bricolage Grotesque";
	src: url("/fonts/bricolage-grotesque-latin-wght-normal.woff2") format("woff2");
	font-weight: 200 800;
	font-display: swap;
}
@font-face {
	font-family: "Instrument Sans";
	src: url("/fonts/instrument-sans-latin-wght-normal.woff2") format("woff2");
	font-weight: 400 700;
	font-display: swap;
}

:root {
	color-scheme: dark;
	--bg: #15112a;
	--surface: #1f1a3a;
	--raised: #2c2552;
	--line: #3f3670;
	--text: #f2eeff;
	--muted: #b3aad6;
	--sticker: #ffd23f;
	--ok: #62e3a4;
	--bad: #ff7a7a;
	--display: "Bricolage Grotesque", system-ui, sans-serif;
	--body: "Instrument Sans", system-ui, sans-serif;
}

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

body {
	margin: 0;
	min-height: 100vh;
	background: var(--bg);
	color: var(--text);
	font: 400 1rem/1.6 var(--body);
}

[hidden] {
	display: none !important;
}

:focus-visible {
	outline: 3px solid var(--sticker);
	outline-offset: 3px;
}

h1,
h2 {
	margin: 0;
	font-family: var(--display);
	font-weight: 700;
	letter-spacing: -0.02em;
	text-wrap: balance;
}

p {
	margin: 0;
}

code,
kbd {
	font: 600 0.95em var(--body);
	padding: 0.1em 0.45em;
	border-radius: 6px;
	background: var(--raised);
	color: var(--text);
}

/* ----------------------------------------------------------- cabeçalho */
.top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	max-width: 1120px;
	margin: 0 auto;
	padding: 20px 24px;
}

.brand {
	display: inline-flex;
	align-items: center;
	gap: 12px;
	color: var(--text);
	text-decoration: none;
	font: 700 1.35rem var(--display);
	letter-spacing: -0.02em;
}

.top-end {
	display: flex;
	align-items: center;
	gap: 12px;
}

.chip {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 8px 14px;
	border: 1px solid var(--line);
	border-radius: 999px;
	font-size: 0.9rem;
	color: var(--text);
}

.chip .dot {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	background: var(--muted);
}
.chip[data-state="open"] .dot {
	background: var(--ok);
}
.chip[data-state="qr"] .dot {
	background: var(--sticker);
}
.chip[data-state="close"] .dot {
	background: var(--bad);
}

/* -------------------------------------------------------------- botões */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 48px;
	padding: 0 22px;
	border: 2px solid var(--sticker);
	border-radius: 12px;
	background: var(--sticker);
	color: var(--bg);
	font: 600 1rem var(--body);
	text-decoration: none;
	cursor: pointer;
	transition: transform 120ms ease, background-color 120ms ease;
}
.btn:hover {
	transform: translateY(-1px);
}
.btn:active {
	transform: translateY(1px);
}
.btn[disabled] {
	opacity: 0.55;
	cursor: not-allowed;
	transform: none;
}
.btn.ghost {
	background: transparent;
	color: var(--text);
	border-color: var(--line);
}
.btn.ghost:hover {
	border-color: var(--muted);
}
.btn.small {
	min-height: 38px;
	padding: 0 16px;
	font-size: 0.9rem;
}
.btn.danger {
	color: var(--bad);
	border-color: var(--bad);
}

/* ------------------------------------------------------------- layout */
main {
	max-width: 1120px;
	margin: 0 auto;
	padding: 0 24px 80px;
	overflow-x: clip;
}

.lede {
	margin-top: 18px;
	max-width: 52ch;
	color: var(--muted);
	font-size: 1.125rem;
}

.hero {
	display: grid;
	grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
	gap: clamp(32px, 6vw, 80px);
	align-items: center;
	padding: clamp(24px, 5vw, 64px) 0 clamp(40px, 7vw, 88px);
}

.hero h1 {
	font-size: clamp(2.5rem, 6.4vw, 4.5rem);
	line-height: 1.02;
	max-width: 13ch;
}

.actions {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	margin-top: 32px;
}

.send {
	margin-top: 28px;
	max-width: 460px;
}
.send label,
.login label {
	display: block;
	margin-bottom: 8px;
	font-weight: 600;
}
.send-row {
	display: flex;
	gap: 10px;
}
.send-row input {
	flex: 1;
	min-width: 0;
}

input[type="tel"],
input[type="password"] {
	width: 100%;
	min-height: 48px;
	padding: 0 14px;
	border: 2px solid var(--line);
	border-radius: 12px;
	background: var(--surface);
	color: var(--text);
	font: 400 1rem var(--body);
}
input::placeholder {
	color: #8379ad;
}

.hint,
.fine {
	margin-top: 10px;
	color: var(--muted);
	font-size: 0.9rem;
}
.fine {
	margin-top: 28px;
	max-width: 52ch;
}

/* ----------------------------------------------------------- figurinha */
.stage {
	display: grid;
	justify-items: center;
	gap: 16px;
}

.drop {
	display: grid;
	place-content: center;
	gap: 6px;
	width: min(100%, 440px);
	aspect-ratio: 1;
	padding: 24px;
	border: 3px dashed var(--line);
	border-radius: 44px;
	text-align: center;
	cursor: pointer;
	transition: border-color 120ms ease, background-color 120ms ease;
}
.stage[data-drag="true"] .drop,
.drop:hover {
	border-color: var(--sticker);
	background: var(--surface);
}
.drop-title {
	font: 700 1.5rem var(--display);
	letter-spacing: -0.01em;
}
.drop-sub {
	color: var(--muted);
}
.stage:not([data-state="idle"]) .drop {
	display: none;
}

.loading {
	display: grid;
	place-content: center;
	width: min(100%, 440px);
	aspect-ratio: 1;
	border: 3px solid var(--line);
	border-radius: 44px;
	color: var(--muted);
	font-size: 1.1rem;
}

.sticker {
	position: relative;
	width: min(100%, 400px);
	transform: rotate(-3deg);
	animation: peel 320ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.sticker img {
	display: block;
	width: 100%;
	height: auto;
	border: 8px solid #fff;
	border-radius: 36px;
	background: var(--surface);
	box-shadow: 10px 10px 0 var(--raised);
}
.badge {
	position: absolute;
	right: -14px;
	bottom: -14px;
	display: grid;
	place-items: center;
	width: 64px;
	height: 64px;
	border: 4px solid var(--bg);
	border-radius: 50%;
	background: var(--sticker);
	color: var(--bg);
	cursor: pointer;
	transition: transform 120ms ease;
}
.badge:hover {
	transform: scale(1.06);
}
.badge:active {
	transform: scale(0.96);
}
.meta {
	color: var(--muted);
	font-size: 0.9rem;
}

@keyframes peel {
	from {
		opacity: 0;
		transform: rotate(-9deg) scale(0.92);
	}
	to {
		opacity: 1;
		transform: rotate(-3deg) scale(1);
	}
}

/* ------------------------------------------------- conexão e atividade */
.lower {
	display: grid;
	grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
	gap: clamp(28px, 5vw, 64px);
	align-items: start;
}

h2 {
	font-size: 1.5rem;
	margin-bottom: 18px;
}

.panel {
	padding: 28px;
	border: 1px solid var(--line);
	border-radius: 20px;
	background: var(--surface);
}
.panel p + p,
.panel p + .btn,
.panel ol + p {
	margin-top: 14px;
}
.panel .btn {
	margin-top: 18px;
}

.qr {
	display: block;
	width: 240px;
	height: 240px;
	margin-bottom: 18px;
	border-radius: 12px;
	background: #fff;
}
.steps {
	margin: 0 0 4px;
	padding-left: 1.2em;
	color: var(--muted);
}
.pair {
	margin-top: 22px;
	padding-top: 22px;
	border-top: 1px solid var(--line);
}
.pair form {
	display: flex;
	gap: 10px;
	margin-top: 12px;
}
.pair input {
	flex: 1;
	min-width: 0;
}
.code {
	margin-top: 16px;
	font: 700 2rem var(--display);
	letter-spacing: 0.08em;
}

.stats {
	display: grid;
	grid-template-columns: repeat(3, auto);
	justify-content: start;
	gap: 8px 40px;
	margin: 0 0 24px;
}
.stats div {
	display: flex;
	flex-direction: column-reverse;
}
.stats dt {
	color: var(--muted);
	font-size: 0.9rem;
}
.stats dd {
	margin: 0;
	font: 700 1.75rem var(--display);
	letter-spacing: -0.01em;
}

.log {
	margin: 0;
	padding: 0;
	list-style: none;
}
.log li {
	display: grid;
	grid-template-columns: 5.2em 1fr;
	gap: 12px;
	padding: 12px 0;
	border-top: 1px solid var(--line);
}
.log time {
	color: var(--muted);
	font-variant-numeric: tabular-nums;
}
.log li[data-level="error"] span {
	color: var(--bad);
}
.log li[data-level="warn"] span {
	color: var(--sticker);
}
.empty {
	padding-top: 12px;
	border-top: 1px solid var(--line);
	color: var(--muted);
}

/* ---------------------------------------------------------------- login */
.login {
	max-width: 440px;
	padding: clamp(32px, 8vw, 96px) 0;
}
.login h1 {
	font-size: clamp(2rem, 5vw, 2.75rem);
}
.login form {
	margin-top: 28px;
}
.login .btn {
	margin-top: 16px;
}
.error {
	margin-top: 10px;
	color: var(--bad);
}

/* ---------------------------------------------------------------- toast */
.toast {
	position: fixed;
	left: 50%;
	bottom: 24px;
	max-width: min(92vw, 460px);
	padding: 14px 20px;
	border: 1px solid var(--line);
	border-radius: 14px;
	background: var(--raised);
	color: var(--text);
	transform: translateX(-50%);
	z-index: 10;
}
.toast[data-kind="error"] {
	border-color: var(--bad);
}

/* ------------------------------------------------------------ responsivo */
@media (max-width: 860px) {
	.hero,
	.lower {
		grid-template-columns: minmax(0, 1fr);
	}
	.stage {
		order: -1;
		padding: 0 20px 14px 8px;
	}
	.top {
		padding: 16px;
	}
	main {
		padding: 0 16px 64px;
	}
	.send-row,
	.pair form {
		flex-direction: column;
	}
	.stats {
		gap: 8px 24px;
	}
}

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