/*
 * Sistem desain bersama untuk semua game di Ruang Main.
 * - Token warna (terang/gelap otomatis) dan aksen per game lewat <body data-game="...">.
 * - Latar "suasana" tiap game digambar dengan CSS + SVG kecil (tanpa file gambar).
 * - Komponen: topbar, panel, tombol, kursi pemain, kartu (.pcard), timer, dock bertab, chat, toast.
 */

/* ---------- Token ---------- */

:root {
	--font: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	--ink: #1d1b19;
	--muted: #6f6a63;
	--line: rgba(40, 30, 20, 0.12);
	--surface: rgba(255, 253, 250, 0.9);
	--surface-solid: #fffdfa;
	--surface-2: rgba(245, 240, 232, 0.92);
	--shadow: 0 1px 2px rgba(30, 20, 10, 0.06), 0 6px 18px rgba(30, 20, 10, 0.08);
	--radius: 14px;
	--accent: #3b5bdb;
	--accent-ink: #ffffff;
	--accent-soft: rgba(59, 91, 219, 0.12);
	--good: #2f9e44;
	--warn: #e67700;
	--bad: #e03131;
	--card-w: 84px;
	color-scheme: light;
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) {
		--ink: #ece9e4;
		--muted: #a39d94;
		--line: rgba(255, 255, 255, 0.1);
		--surface: rgba(28, 27, 31, 0.86);
		--surface-solid: #1c1b1f;
		--surface-2: rgba(40, 38, 44, 0.9);
		--shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.35);
		--accent-soft: rgba(140, 160, 255, 0.16);
		color-scheme: dark;
	}
}

/* Aksen per game */
[data-game="hub"] { --accent: #3b5bdb; }
[data-game="werewolf"] { --accent: #6741d9; --accent-soft: rgba(103, 65, 217, 0.14); }
[data-game="unoflip"] { --accent: #e03131; --accent-soft: rgba(224, 49, 49, 0.12); }
[data-game="juragan"] { --accent: #2b8a3e; --accent-soft: rgba(43, 138, 62, 0.13); }
[data-game="meledak"] { --accent: #e8590c; --accent-soft: rgba(232, 89, 12, 0.13); }

/* ---------- Dasar ---------- */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0;
	min-height: 100vh;
	font-family: var(--font);
	font-size: 16px;
	line-height: 1.45;
	color: var(--ink);
	background: #efe9df;
}
a { color: var(--accent); }
h1, h2, h3, h4 { line-height: 1.2; margin: 0 0 0.5rem; }
h3 { font-size: 1.05rem; }
[hidden] { display: none !important; }
.muted { color: var(--muted); font-size: 0.9em; }
.small { font-size: 0.85em; }
.row { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack { display: flex; flex-direction: column; gap: 0.5rem; }
.grow { flex: 1; }

/* ---------- Latar suasana ---------- */

.scene { position: fixed; inset: 0; z-index: -1; pointer-events: none; overflow: hidden; }
.scene::before, .scene::after { content: ""; position: absolute; inset: 0; }

/* Hub: kertas hangat bertitik */
[data-game="hub"] .scene { background: radial-gradient(rgba(60, 40, 20, 0.07) 1px, transparent 1.5px) 0 0 / 22px 22px, #f3eee6; }

/* Werewolf: desa di malam hari (bulan, bintang, siluet rumah & pohon). Siang: langit pagi. */
[data-game="werewolf"] .scene {
	background:
		radial-gradient(circle at 82% 16%, #fff8dc 0 34px, rgba(255, 248, 220, 0.25) 36px, transparent 90px),
		radial-gradient(1.5px 1.5px at 12% 20%, #fff 50%, transparent),
		radial-gradient(1px 1px at 30% 8%, #fff 50%, transparent),
		radial-gradient(1.5px 1.5px at 48% 26%, #fff 50%, transparent),
		radial-gradient(1px 1px at 64% 12%, #fff 50%, transparent),
		radial-gradient(1px 1px at 92% 34%, #fff 50%, transparent),
		radial-gradient(1px 1px at 22% 40%, #fff 50%, transparent),
		linear-gradient(#0d1330 0%, #232454 55%, #3d3157 100%);
	transition: background 1.2s ease;
}
[data-game="werewolf"] .scene::after {
	top: auto;
	height: 34vh;
	min-height: 180px;
	background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 240' preserveAspectRatio='none'%3E%3Cpath fill='%230a0d22' d='M0 240V150l40-20 30 18 40-60 40 60 30-10V90l40-40 40 40v40l50 10 30-70 30 70h30l40-50 40 50 20-10V100l50-45 50 45v50l30 10 40-80 40 80 30-20 50 30 30-60 30 60h40l40-40 40 40v-50l50-40 50 40v50l40 10 30-70 30 70 40-20 60 30V240z'/%3E%3Cpath fill='%23ffd56b' d='M262 112h10v12h-10zM482 118h10v12h-10zM800 118h10v12h-10zM1032 124h10v12h-10z'/%3E%3C/svg%3E") bottom / 100% 100% no-repeat;
}
[data-game="werewolf"][data-phase="day"] .scene,
[data-game="werewolf"][data-phase="lobby"] .scene,
[data-game="werewolf"][data-phase="ended"] .scene {
	background:
		radial-gradient(circle at 18% 18%, #fff6c9 0 38px, rgba(255, 236, 160, 0.35) 40px, transparent 110px),
		linear-gradient(#8ec5f0 0%, #cfe6f2 55%, #f6e7c8 100%);
}
[data-game="werewolf"][data-phase="day"] .scene::after,
[data-game="werewolf"][data-phase="lobby"] .scene::after,
[data-game="werewolf"][data-phase="ended"] .scene::after {
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 1200 240' preserveAspectRatio='none'%3E%3Cpath fill='%2391b37a' fill-opacity='.55' d='M0 240V170q150-60 300-10t300-20 300 10 300-30V240z'/%3E%3Cpath fill='%235f7f4c' fill-opacity='.85' d='M0 240V150l40-20 30 18 40-60 40 60 30-10V90l40-40 40 40v40l50 10 30-70 30 70h30l40-50 40 50 20-10V100l50-45 50 45v50l30 10 40-80 40 80 30-20 50 30 30-60 30 60h40l40-40 40 40v-50l50-40 50 40v50l40 10 30-70 30 70 40-20 60 30V240z'/%3E%3C/svg%3E");
}

/* UNO Flip: meja kayu; area main beralas kain (lihat .felt). */
[data-game="unoflip"] .scene {
	background:
		repeating-linear-gradient(92deg, rgba(0, 0, 0, 0.04) 0 2px, transparent 2px 9px),
		repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 37px),
		linear-gradient(160deg, #a8713f, #7d4f2a 60%, #6a4124);
}
[data-game="unoflip"][data-side="dark"] .scene { filter: brightness(0.55) saturate(0.8); }

/* Juragan: papan kota (jalan & blok) */
[data-game="juragan"] .scene {
	background:
		url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cg fill='%23000' fill-opacity='.05'%3E%3Crect x='14' y='14' width='56' height='56' rx='6'/%3E%3Crect x='90' y='14' width='56' height='24' rx='5'/%3E%3Crect x='90' y='46' width='56' height='24' rx='5'/%3E%3Crect x='14' y='90' width='24' height='56' rx='5'/%3E%3Crect x='46' y='90' width='24' height='56' rx='5'/%3E%3Crect x='90' y='90' width='56' height='56' rx='6'/%3E%3C/g%3E%3C/svg%3E"),
		linear-gradient(160deg, #e3efd9, #d4e6c7);
}

/* Meledak: ruangan hangat dengan jejak kaki kucing */
[data-game="meledak"] .scene {
	background:
		url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cg fill='%23a0522d' fill-opacity='.08' transform='rotate(-20 60 60)'%3E%3Cellipse cx='30' cy='38' rx='9' ry='8'/%3E%3Ccircle cx='20' cy='26' r='4'/%3E%3Ccircle cx='28' cy='22' r='4'/%3E%3Ccircle cx='36' cy='23' r='4'/%3E%3Ccircle cx='42' cy='29' r='4'/%3E%3Cellipse cx='86' cy='92' rx='9' ry='8'/%3E%3Ccircle cx='76' cy='80' r='4'/%3E%3Ccircle cx='84' cy='76' r='4'/%3E%3Ccircle cx='92' cy='77' r='4'/%3E%3Ccircle cx='98' cy='83' r='4'/%3E%3C/g%3E%3C/svg%3E"),
		linear-gradient(170deg, #fdf0e1, #f6dfc6);
}

@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) [data-game="hub"] .scene { background: radial-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1.5px) 0 0 / 22px 22px, #141416; }
	:root:not([data-theme="light"]) [data-game="juragan"] .scene { filter: brightness(0.22) saturate(0.7); }
	:root:not([data-theme="light"]) [data-game="meledak"] .scene { filter: brightness(0.22) saturate(0.8); }
	:root:not([data-theme="light"]) [data-game="werewolf"][data-phase] .scene { filter: brightness(0.7); }
	:root:not([data-theme="light"]) [data-game="werewolf"][data-phase="night"] .scene,
	:root:not([data-theme="light"]) [data-game="werewolf"][data-phase="hunter"] .scene { filter: none; }
	:root:not([data-theme="light"]) [data-game="unoflip"] .scene { filter: brightness(0.5); }
}

/* ---------- Topbar ---------- */

.topbar {
	position: sticky;
	top: 0;
	z-index: 20;
	display: flex;
	align-items: center;
	gap: 0.6rem;
	padding: 0.55rem 16px;
	background: var(--surface);
	backdrop-filter: blur(10px);
	border-bottom: 1px solid var(--line);
}
.topbar .brand { font-weight: 700; color: var(--ink); text-decoration: none; white-space: nowrap; }
.topbar .crumb { font-weight: 700; color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .crumb::before { content: "›"; color: var(--muted); margin-right: 0.5rem; font-weight: 400; }
.topbar .spacer { flex: 1; }
.room-badge { font-size: 0.85rem; color: var(--muted); white-space: nowrap; }
.room-badge b { color: var(--ink); letter-spacing: 0.08em; font-size: 1rem; }
/* Layar sempit: cukup ikon untuk tombol topbar, nama "Ruang Main" diringkas jadi ikon. */
@media (max-width: 600px) {
	.topbar { gap: 0.4rem; }
	.topbar .label { display: none; }
	.topbar .brand .label { display: none; }
	.topbar .crumb::before { margin-right: 0.3rem; }
}

/* ---------- Tata letak ---------- */

.app { max-width: 1080px; margin: 0 auto; padding: 1rem 16px 3rem; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 1rem; align-items: start; }
.layout > .dock { position: sticky; top: 4.2rem; }
@media (max-width: 860px) {
	.layout { grid-template-columns: minmax(0, 1fr); }
	.layout > .dock { position: static; }
}

.panel {
	background: var(--surface);
	backdrop-filter: blur(6px);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	padding: 0.9rem 1rem;
	margin-bottom: 0.9rem;
}
.panel:empty { display: none; }
.panel.tint { background: var(--surface-2); }
.panel.accent { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }
.panel.alert { border-color: var(--warn); box-shadow: 0 0 0 3px rgba(230, 119, 0, 0.15), var(--shadow); }
.panel > h3:first-child { margin-top: 0; }

/* Kartu gabung (layar awal tiap game) */
.join { max-width: 440px; margin: 3vh auto 0; text-align: center; }
.join .hero { font-size: 3.2rem; line-height: 1; }
.join h1 { margin: 0.4rem 0 0.2rem; font-size: 1.7rem; }
.join .tagline { color: var(--muted); margin: 0 0 1rem; }
.join .panel { text-align: left; }
.join .or { text-align: center; color: var(--muted); font-size: 0.85rem; margin: 0.6rem 0; }
.join .facts { display: flex; justify-content: center; gap: 0.4rem; flex-wrap: wrap; margin-top: 0.8rem; }

/* ---------- Kontrol ---------- */

button, input, select, textarea { font: inherit; color: inherit; }
label { display: block; font-size: 0.9rem; color: var(--muted); }
label.inline { display: inline-flex; gap: 0.35rem; align-items: center; color: var(--ink); }
input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), select, textarea {
	width: 100%;
	padding: 0.55rem 0.75rem;
	margin: 0.25rem 0;
	border-radius: 10px;
	border: 1px solid var(--line);
	background: var(--surface-solid);
}
input[type="number"] { width: 5.5em !important; }
input:focus-visible, select:focus-visible, button:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 1px; border-color: var(--accent); }
input.code { text-transform: uppercase; letter-spacing: 0.15em; font-weight: 700; }

button, .btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.35rem;
	padding: 0.5rem 0.9rem;
	margin: 0.2rem 0;
	border-radius: 10px;
	border: 1px solid var(--line);
	background: var(--surface-solid);
	color: var(--ink);
	font-weight: 600;
	cursor: pointer;
	text-decoration: none;
	transition: transform 0.08s ease, background 0.15s, border-color 0.15s;
}
button:hover:not(:disabled) { border-color: var(--accent); }
button:active:not(:disabled) { transform: translateY(1px); }
button:disabled { opacity: 0.45; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.primary:hover:not(:disabled) { filter: brightness(1.08); }
button.ghost { background: transparent; }
button.danger { background: var(--bad); border-color: var(--bad); color: #fff; }
button.big { padding: 0.75rem 1.3rem; font-size: 1.05rem; }
button.sm { padding: 0.25rem 0.6rem; font-size: 0.85rem; border-radius: 8px; }
button.block { width: 100%; }
button.selected { background: var(--accent-soft); border-color: var(--accent); }
.icon-btn { padding: 0.35rem 0.55rem; }

.chips { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.chip { display: inline-flex; align-items: center; gap: 0.25rem; padding: 0.15rem 0.6rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); font-size: 0.85rem; white-space: nowrap; }
.chip.accent { background: var(--accent-soft); border-color: transparent; color: var(--accent); font-weight: 700; }
.chip.good { color: var(--good); }
.chip.bad { color: var(--bad); }

/* ---------- Status & timer ---------- */

.status { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; }
.status .phase { font-weight: 800; font-size: 1.1rem; }
.timer { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 700; padding: 0.15rem 0.6rem; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--line); }
.timer:empty { display: none; }
.timer.low { color: #fff; background: var(--bad); border-color: var(--bad); }

.banner { padding: 0.7rem 0.9rem; border-radius: 12px; background: var(--surface); backdrop-filter: blur(6px); border: 1px solid var(--line); box-shadow: var(--shadow); margin-bottom: 0.9rem; }
.banner.mine { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }
.banner .big { font-weight: 800; font-size: 1.1rem; }

/* ---------- Kursi pemain ---------- */

.seats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 0.5rem; }
.seat {
	display: flex;
	align-items: center;
	gap: 0.55rem;
	padding: 0.5rem 0.6rem;
	border-radius: 12px;
	background: var(--surface);
	border: 1px solid var(--line);
	min-width: 0;
}
.seat .avatar {
	flex: none;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	display: grid;
	place-items: center;
	font-weight: 800;
	color: #fff;
	background: hsl(var(--hue, 220) 45% 50%);
	position: relative;
}
.seat .avatar.bot { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); font-size: 1.1rem; }
.seat .who { min-width: 0; flex: 1; }
.seat .name { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seat .meta { font-size: 0.8rem; color: var(--muted); }
.seat.is-turn { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.seat.is-me .name::after { content: " (kamu)"; font-weight: 400; color: var(--muted); }
.seat.is-out { opacity: 0.5; }
.seat.is-out .name { text-decoration: line-through; }
.seat.is-offline .avatar::after { content: ""; position: absolute; right: -1px; bottom: -1px; width: 10px; height: 10px; border-radius: 50%; background: #adb5bd; border: 2px solid var(--surface-solid); }
.seat .actions { display: flex; gap: 0.25rem; flex-wrap: wrap; }

/* ---------- Kartu ---------- */

.hand, .cards { display: flex; flex-wrap: wrap; gap: 0.45rem; }
@media (max-width: 600px) {
	.hand { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 0.4rem; scroll-snap-type: x proximity; }
	.hand > * { scroll-snap-align: start; flex: none; }
}

.pcard {
	--card-color: #868e96;
	position: relative;
	width: var(--card-w);
	aspect-ratio: 5 / 7;
	flex: none;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0.15rem;
	padding: 0.4rem 0.3rem;
	margin: 0;
	border-radius: 10px;
	border: 1px solid rgba(0, 0, 0, 0.12);
	background: #fffdf8;
	color: #26221e;
	box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08), 0 3px 8px rgba(0, 0, 0, 0.12);
	font-size: 0.72rem;
	font-weight: 700;
	line-height: 1.15;
	text-align: center;
	overflow: hidden;
	transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.pcard::before { content: ""; position: absolute; inset: 0 0 auto; height: 6px; background: var(--card-color); }
.pcard .corner { position: absolute; top: 9px; left: 7px; font-size: 0.75rem; font-weight: 800; color: var(--card-color); }
.pcard .corner.br { top: auto; left: auto; bottom: 5px; right: 7px; transform: rotate(180deg); }
.pcard .art { font-size: 1.9rem; line-height: 1; }
.pcard .title { padding: 0 0.15rem; }
.pcard .sub { font-weight: 500; font-size: 0.65rem; color: #6f6a63; }
.pcard .value { position: absolute; top: 9px; right: 7px; min-width: 1.4em; padding: 0 0.25rem; border-radius: 6px; font-size: 0.7rem; background: var(--card-color); color: #fff; }

button.pcard { cursor: pointer; }
button.pcard:hover:not(:disabled) { transform: translateY(-4px); box-shadow: 0 2px 2px rgba(0, 0, 0, 0.08), 0 8px 18px rgba(0, 0, 0, 0.18); border-color: rgba(0, 0, 0, 0.12); }
.pcard.is-selected { transform: translateY(-6px); outline: 3px solid var(--accent); outline-offset: 1px; }
.pcard.is-playable { box-shadow: 0 0 0 3px var(--accent-soft), 0 3px 8px rgba(0, 0, 0, 0.12); }
.pcard.is-dim { opacity: 0.55; }
.pcard.sm { --card-w: 58px; font-size: 0.6rem; padding: 0.3rem 0.2rem; border-radius: 8px; }
.pcard.sm .art { font-size: 1.25rem; }
.pcard.sm::before { height: 4px; }
.pcard.sm .corner, .pcard.sm .value { top: 6px; font-size: 0.6rem; }
.pcard.lg { --card-w: 110px; font-size: 0.85rem; }
.pcard.lg .art { font-size: 2.6rem; }

/* Kartu berwarna penuh (UNO) */
.pcard.solid { background: var(--card-color); color: #fff; border-color: rgba(0, 0, 0, 0.15); }
.pcard.solid::before { display: none; }
.pcard.solid .corner { color: #fff; }
.pcard.solid .art {
	display: grid;
	place-items: center;
	width: 78%;
	aspect-ratio: 1 / 1.25;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.92);
	color: var(--card-color);
	font-size: 1.35rem;
	font-weight: 900;
	transform: rotate(-12deg);
}
.pcard.solid.sm .art { font-size: 0.9rem; }
.pcard.solid.lg .art { font-size: 2rem; }
.pcard.solid.wild { background: conic-gradient(#e03131 0 25%, #f59f00 0 50%, #2f9e44 0 75%, #1c7ed6 0); }
.pcard.solid.wild.dark-side { background: conic-gradient(#e64980 0 25%, #12b886 0 50%, #fd7e14 0 75%, #7048e8 0); }
.pcard.solid.wild .art { color: #222; }

/* Punggung kartu */
.pcard.back {
	background: repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.12) 0 6px, transparent 6px 12px), var(--accent);
	color: #fff;
}
.pcard.back::before { display: none; }

/* Meja beralas kain */
.felt {
	border-radius: 18px;
	padding: 1.1rem;
	background: radial-gradient(ellipse at 50% 40%, #2f8f5b, #1f6b44 70%, #18573a);
	box-shadow: inset 0 0 0 6px rgba(0, 0, 0, 0.12), inset 0 10px 30px rgba(0, 0, 0, 0.25), var(--shadow);
	color: #f1f5f2;
}
[data-side="dark"] .felt { background: radial-gradient(ellipse at 50% 40%, #4b2f86, #33205f 70%, #261848); }
.felt .muted { color: rgba(255, 255, 255, 0.72); }

/* ---------- Dock (Chat / Riwayat / Aturan) ---------- */

.dock { padding: 0; overflow: hidden; }
.dock .tabs { display: flex; border-bottom: 1px solid var(--line); }
.dock .tabs button { flex: 1; margin: 0; border: 0; border-radius: 0; background: transparent; padding: 0.65rem 0.4rem; font-size: 0.9rem; color: var(--muted); border-bottom: 2px solid transparent; }
.dock .tabs button.active { color: var(--accent); border-bottom-color: var(--accent); }
.dock .pane { display: none; padding: 0.8rem 0.9rem; }
.dock .pane.active { display: block; }
.dock .badge { display: inline-block; min-width: 1.2em; padding: 0 0.3rem; margin-left: 0.25rem; border-radius: 999px; background: var(--accent); color: #fff; font-size: 0.7rem; }

.chat { max-height: 320px; overflow-y: auto; display: flex; flex-direction: column; gap: 0.35rem; margin-bottom: 0.5rem; }
.chat .msg { padding: 0.35rem 0.6rem; border-radius: 10px; background: var(--surface-2); font-size: 0.92rem; overflow-wrap: anywhere; }
.chat .msg b { margin-right: 0.3rem; }
.chat .msg.mine { background: var(--accent-soft); }
.chat .msg.system { background: transparent; color: var(--muted); padding: 0 0.2rem; font-size: 0.85rem; }
.chat .empty { color: var(--muted); font-size: 0.9rem; }
.chat-form { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
.chat-form input:not([type="checkbox"]) { flex: 1; min-width: 8em; }

.log { list-style: none; margin: 0; padding: 0; max-height: 360px; overflow-y: auto; font-size: 0.9rem; }
.log li { padding: 0.35rem 0; border-bottom: 1px dashed var(--line); }
.log li:last-child { border-bottom: 0; }

.rules dt { font-weight: 700; margin-top: 0.6rem; }
.rules dd { margin: 0.1rem 0 0; color: var(--muted); font-size: 0.92rem; }
.rules ul { padding-left: 1.1rem; }

details > summary { cursor: pointer; font-weight: 600; }

/* ---------- Toast ---------- */

.toast {
	position: fixed;
	left: 50%;
	bottom: 1.2rem;
	transform: translateX(-50%) translateY(150%);
	max-width: min(92vw, 480px);
	padding: 0.65rem 1rem;
	border-radius: 12px;
	background: #2b2a2e;
	color: #fff;
	font-weight: 600;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
	transition: transform 0.2s ease;
	z-index: 50;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.error { background: #c92a2a; }

/* Dialog sederhana (mis. pilih warna Wild) */
.overlay { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; background: rgba(0, 0, 0, 0.45); padding: 16px; }
.overlay .panel { max-width: 380px; width: 100%; text-align: center; }

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