/* Neobrutalism: border tebal, bayangan keras tanpa blur, warna flat */
:root {
	--paper: #F6F1E7;
	--ink: #111111;
	--white: #FFFFFF;
	--yellow: #FFD93D;
	--pink: #FF8FB1;
	--blue: #8EC5FF;
	--green: #7BE495;
	--red: #FF6B6B;
	--gray: #E4DED2;
	--border: 3px solid var(--ink);
	--shadow: 6px 6px 0 var(--ink);
	--shadow-sm: 4px 4px 0 var(--ink);
	--mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
	margin: 0;
	font-family: "Space Grotesk", "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	font-weight: 500;
	font-size: 15px;
	line-height: 1.5;
	color: var(--ink);
	background-color: var(--paper);
	background-image: radial-gradient(rgba(17, 17, 17, .16) 1px, transparent 1px);
	background-size: 20px 20px;
	min-height: 100vh;
}

a { color: var(--ink); font-weight: 800; text-decoration: underline; text-decoration-thickness: 3px; text-underline-offset: 3px; text-decoration-color: var(--pink); }
a:hover { background: var(--pink); }

h1 { font-size: clamp(26px, 7vw, 36px); line-height: 1.05; margin: 14px 0 8px; font-weight: 900; letter-spacing: -.5px; }
h2 { font-size: 15px; margin: 0; font-weight: 900; text-transform: uppercase; letter-spacing: .6px; }
p { margin: 0 0 12px; }

/* ---------- layout ---------- */
.wrap { max-width: 460px; margin: 28px auto 48px; padding: 0 16px; }
.wrap-wide { max-width: 980px; margin: 24px auto 56px; padding: 0 16px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid2 { display: grid; grid-template-columns: 1fr 2fr; gap: 16px; }

.topbar {
	display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap;
	padding: 12px 16px; background: var(--yellow); border-bottom: var(--border);
}
.topbar .who { font-weight: 700; font-size: 14px; }
a.brand { text-decoration: none; }
a.brand:hover { background: var(--ink); }
.brand {
	display: inline-block; background: var(--ink); color: var(--yellow);
	padding: 3px 10px; font-weight: 900; letter-spacing: 1px; text-transform: uppercase; font-size: 14px;
	box-shadow: 3px 3px 0 var(--pink);
}

/* ---------- card ---------- */
.card { background: var(--white); border: var(--border); box-shadow: var(--shadow); padding: 20px; }
.card-title {
	display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap;
	margin: -20px -20px 18px; padding: 10px 16px; border-bottom: var(--border); background: var(--blue);
}
.card-title.pink { background: var(--pink); }
.card-title.green { background: var(--green); }
.card-title.yellow { background: var(--yellow); }
.subtitle { font-weight: 500; margin: 0 0 16px; }
.hint { font-size: 13px; font-weight: 600; color: #3a3a3a; margin-top: 6px; }

/* ---------- form ---------- */
label { display: block; font-weight: 800; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; margin: 16px 0 6px; }
form > label:first-child, .card-title + label, .grid2 label { margin-top: 0; }

input, select {
	width: 100%; font: inherit; font-weight: 600; color: var(--ink);
	padding: 11px 12px; background: var(--white); border: var(--border); border-radius: 0;
	box-shadow: 3px 3px 0 var(--ink); appearance: none; -webkit-appearance: none;
}
input:focus, select:focus { outline: none; background: #FFFBE0; box-shadow: 5px 5px 0 var(--blue); }
select {
	padding-right: 36px;
	background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'><path d='M0 0l5 6 5-6z' fill='%23111'/></svg>");
	background-repeat: no-repeat; background-position: right 12px center; background-size: 12px;
}

button {
	font: inherit; font-weight: 900; font-size: 13px; text-transform: uppercase; letter-spacing: .4px;
	color: var(--ink); background: var(--white); border: var(--border); border-radius: 0;
	padding: 10px 16px; cursor: pointer; box-shadow: var(--shadow-sm);
	transition: transform .06s, box-shadow .06s;
}
button:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--ink); }
button:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }
button:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: var(--shadow-sm); }
.btn-primary { background: var(--yellow); width: 100%; margin-top: 18px; padding: 13px 16px; }
.btn-danger { background: var(--red); }
.btn-secondary { background: var(--white); }
.btn-small { padding: 6px 10px; font-size: 12px; box-shadow: 3px 3px 0 var(--ink); }

.error { font-weight: 800; }
.error:not(:empty) { background: var(--red); border: var(--border); box-shadow: var(--shadow-sm); padding: 8px 12px; margin-top: 14px; }

/* ---------- status & info ---------- */
.badge {
	display: inline-block; padding: 2px 10px; border: 2px solid var(--ink); background: var(--gray);
	font-weight: 900; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; box-shadow: 2px 2px 0 var(--ink);
}
.badge-online { background: var(--green); }
.badge-connecting { background: var(--yellow); }
.badge-error { background: var(--red); }
.badge-offline { background: var(--gray); }

.kv { display: grid; grid-template-columns: 120px 1fr; border: var(--border); }
.kv > * { padding: 9px 12px; border-bottom: 2px solid var(--ink); overflow-wrap: anywhere; }
.kv > :nth-last-child(-n+2) { border-bottom: 0; }
.kv .k { background: var(--gray); font-weight: 900; font-size: 12px; text-transform: uppercase; letter-spacing: .4px; border-right: 2px solid var(--ink); }

.steps { margin: 22px 0 0; padding-left: 0; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; display: flex; gap: 12px; align-items: flex-start; margin-bottom: 10px; font-weight: 600; }
.steps li::before {
	content: counter(s); flex: none; width: 28px; height: 28px; display: grid; place-items: center;
	background: var(--pink); border: 2px solid var(--ink); font-weight: 900; box-shadow: 2px 2px 0 var(--ink);
}

.pairing-code {
	font-family: var(--mono); font-weight: 900; font-size: clamp(26px, 9vw, 40px); letter-spacing: 4px; text-align: center;
	padding: 16px 8px; margin: 14px 0; background: var(--yellow); border: var(--border); box-shadow: var(--shadow);
}

.console {
	background: #0D0D0D; color: var(--green); border: var(--border); box-shadow: var(--shadow-sm);
	padding: 12px; height: 240px; overflow-y: auto; font-family: var(--mono); font-size: 12px; line-height: 1.45;
	white-space: pre-wrap; overflow-wrap: anywhere;
}
.console .line { padding: 1px 0; }
.console .err { color: #FF9A9A; }
.console .sys { color: var(--yellow); }

.sep { border: 0; border-top: 3px dashed var(--ink); margin: 22px 0 14px; }
.note { background: var(--yellow); border: var(--border); box-shadow: var(--shadow-sm); padding: 10px 12px; font-weight: 700; margin-bottom: 18px; }

/* ---------- tabel ---------- */
.table-wrap { overflow-x: auto; border: var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { background: var(--ink); color: var(--white); text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; padding: 10px 12px; }
td { padding: 10px 12px; border-top: 2px solid var(--ink); vertical-align: middle; overflow-wrap: anywhere; }
tbody tr:nth-child(even) { background: #FFF9E0; }
td.actions { display: table-cell; white-space: nowrap; }
td.actions button + button { margin-left: 8px; }

/* ---------- modal ---------- */
.modal-bg { position: fixed; inset: 0; background: rgba(17, 17, 17, .6); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 10; }
.modal { width: 100%; max-width: 420px; max-height: 92vh; overflow-y: auto; }
.modal.wide { max-width: 720px; }


/* ---------- landing ---------- */
.hero { padding: 18px 0 26px; }
.hero h1 { font-size: clamp(32px, 9vw, 54px); margin-top: 0; }
.hero .subtitle { max-width: 560px; font-size: 16px; }
a.nav-link, a.btn-link {
	display: inline-block; text-decoration: none; color: var(--ink); background: var(--white);
	border: var(--border); font-weight: 900; text-transform: uppercase; letter-spacing: .4px;
	box-shadow: var(--shadow-sm); transition: transform .06s, box-shadow .06s;
}
a.nav-link { padding: 6px 12px; font-size: 12px; box-shadow: 3px 3px 0 var(--ink); }
a.btn-link { padding: 13px 20px; font-size: 14px; }
a.nav-cta, a.btn-yellow { background: var(--pink); }
a.btn-yellow { background: var(--yellow); }
a.nav-link:hover, a.btn-link:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--ink); background: var(--green); }
a.nav-link:active, a.btn-link:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.stat { border: var(--border); box-shadow: var(--shadow-sm); padding: 14px 14px 16px; min-width: 0; }
.stat .label { font-weight: 900; font-size: 11px; text-transform: uppercase; letter-spacing: .5px; }
.stat .num { font-family: var(--mono); font-weight: 900; font-size: clamp(22px, 5.5vw, 30px); line-height: 1.1; margin-top: 8px; overflow-wrap: anywhere; }
.stat .sub { font-size: 12px; font-weight: 700; margin-top: 4px; }
.bg-blue { background: var(--blue); } .bg-pink { background: var(--pink); }
.bg-green { background: var(--green); } .bg-yellow { background: var(--yellow); }

.rank { list-style: none; margin: 0; padding: 0; }
.rank li { display: grid; grid-template-columns: 38px minmax(0, 1fr) 92px; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 2px solid var(--ink); }
.rank li:last-child { border-bottom: 0; }
.rank .pos { width: 38px; height: 38px; display: grid; place-items: center; background: var(--yellow); border: 2px solid var(--ink); font-weight: 900; box-shadow: 2px 2px 0 var(--ink); }
.rank li:nth-child(1) .pos { background: var(--pink); }
.rank .cmd { font-family: var(--mono); font-weight: 800; overflow-wrap: anywhere; }
.rank .bar { height: 10px; border: 2px solid var(--ink); background: var(--white); margin-top: 5px; }
.rank .bar i { display: block; height: 100%; background: var(--blue); }
.rank .times { font-family: var(--mono); font-weight: 900; white-space: nowrap; text-align: right; }
.rank li.rank-empty { display: block; font-weight: 600; border: 0; }

@media (max-width: 900px) {
	.stats { grid-template-columns: repeat(2, 1fr); gap: 14px; }
}

/* ---------- mobile ---------- */
@media (max-width: 680px) {
	.grid2 { grid-template-columns: 1fr; }
	.kv { grid-template-columns: 100px 1fr; }
	.table-wrap { border: 0; overflow: visible; }
	table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; }
	table.stack thead { display: none; }
	table.stack tr { border: var(--border); box-shadow: var(--shadow-sm); margin-bottom: 18px; background: var(--white); }
	table.stack tbody tr:nth-child(even) { background: var(--white); }
	table.stack td { display: flex; justify-content: space-between; align-items: center; gap: 12px; text-align: right; border-top: 0; border-bottom: 2px solid var(--ink); }
	table.stack td::before { content: attr(data-label); font-weight: 900; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; text-align: left; flex: none; }
	table.stack td:last-child { border-bottom: 0; justify-content: flex-end; flex-wrap: wrap; }
	table.stack td.actions::before { display: none; }
}
