:root {
    --bg: #0e100d;
    --surface: #171a15;
    --raised: #1f241d;
    --inset: #0c0d0c;
    --line: #2a3027;
    --line2: #3b4337;
    --text: #e8e7e1;
    --muted: #8e918a;
    --faint: #5e625a;
    --accent: #7bc043;
    --accent-dk: #4f8a2c;
    --accent-hi: #96d85a;
    --oak: #c9a66b;
    --on-accent: #0d1707;
    --ok: #6cc16b;
    --warn: #e0a53a;
    --bad: #e5675d;
    --info: #6fb9c6;
    --sans: "Geist", system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: "Geist Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
    --pixel: "Pixelify Sans", "Geist Mono", ui-monospace, monospace;
    --r: 4px;
    color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; color: var(--text); background: var(--bg); font: 14px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
body { min-height: 100vh; position: relative; overflow-x: hidden; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
h1, h2, h3, h4, p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
::selection { background: var(--accent); color: var(--on-accent); }

/* ---------- form & tombol ---------- */
input, select {
    background: var(--inset); border: 1px solid var(--line2); border-radius: var(--r);
    padding: 7px 10px; width: 100%; min-width: 0; transition: border-color .12s, box-shadow .12s;
}
select { width: auto; max-width: 100%; padding: 4px 8px; }
input::placeholder { color: var(--faint); }
input:hover, select:hover { border-color: #4a4f46; }
input:focus-visible, select:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(123, 192, 67, .2); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    background: var(--raised); border: 1px solid var(--line2); border-bottom-width: 3px; border-radius: var(--r);
    padding: 5px 13px 4px; cursor: pointer; white-space: nowrap; font-weight: 500; line-height: 1.3;
    transition: background .12s, border-color .12s, transform .06s;
}
.btn:hover:not(:disabled) { background: #252922; border-color: #4a4f46; }
.btn:active:not(:disabled) { transform: translateY(2px); border-bottom-width: 1px; margin-bottom: 2px; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent-hi) var(--accent) var(--accent-dk); color: var(--on-accent); font-weight: 600; }
.btn.primary:hover:not(:disabled) { background: var(--accent-hi); border-color: #b4ea7d #96d85a var(--accent-dk); }
.btn.danger { background: transparent; border-color: #5a2f2b; color: #f0928a; }
.btn.danger:hover:not(:disabled) { background: #2a1a18; border-color: #7a3d37; }
.btn.ghost { background: transparent; border-color: transparent; border-bottom-width: 1px; padding: 6px 13px; color: var(--muted); }
.btn.ghost:hover:not(:disabled) { background: var(--raised); border-color: transparent; color: var(--text); }
.btn.sm { padding: 2px 10px 1px; font-size: 13px; }
.btn.block { width: 100%; padding: 9px 14px 8px; }

.field { display: block; margin-bottom: 12px; }
.field > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }

.group { display: flex; }
.group > input { border-radius: var(--r) 0 0 var(--r); }
.group > input + input { border-radius: 0; margin-left: -1px; }
.group > .btn { border-radius: 0; margin-left: -1px; }
.group > .btn:last-child { border-radius: 0 var(--r) var(--r) 0; }
.group > input:focus-visible { position: relative; z-index: 1; }

/* ---------- panel ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; box-shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 6px 18px rgba(0,0,0,.25); overflow: hidden; }
.panel-h {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--raised); font-family: var(--pixel); font-size: 15px; font-weight: 500; color: var(--text); letter-spacing: .02em;
}
.panel-h::before { content: ""; width: 8px; height: 8px; background: var(--accent); box-shadow: 0 0 0 2px rgba(123,192,67,.25); flex: none; }
.panel-h { justify-content: flex-start; }
.panel-h small { margin-left: auto; }
.panel-h small { font-size: 12px; color: var(--faint); }
.panel-b { padding: 16px; }

/* ---------- logo ---------- */
.logo { display: flex; align-items: center; gap: 10px; font-family: var(--pixel); font-weight: 600; font-size: 19px; letter-spacing: .01em; }
.logo i { position: relative; width: 20px; height: 20px; background: var(--accent); border-radius: 2px; flex: none; box-shadow: inset 0 -4px 0 var(--accent-dk), inset 0 3px 0 var(--accent-hi); }
.logo i::before { content: ""; position: absolute; left: 4px; top: 6px; width: 4px; height: 4px; background: var(--bg); box-shadow: 8px 0 0 var(--bg); }

/* ---------- masuk / daftar ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(320px, 1.15fr) minmax(340px, 1fr); }
.auth-side { position: relative; overflow: hidden; background: radial-gradient(120% 80% at 80% 100%, rgba(123,192,67,.12), transparent 60%), var(--surface); padding: 40px 56px; display: flex; flex-direction: column; justify-content: space-between; gap: 40px; border-right: 1px solid var(--line); }
.auth-copy { max-width: 34rem; position: relative; z-index: 1; }
.block-art { position: absolute; right: -40px; top: 90px; width: 340px; height: 340px; filter: drop-shadow(0 18px 24px rgba(0,0,0,.5)); animation: bob 5s ease-in-out infinite; pointer-events: none; }
@keyframes bob { 50% { transform: translateY(-8px); } }
.auth-side .sample, .auth-side .logo { position: relative; z-index: 1; }
.hero-title em { font-style: normal; color: var(--accent); }
.hero-title { font-family: var(--pixel); font-weight: 500; font-size: clamp(30px, 3.6vw, 46px); line-height: 1.12; text-wrap: balance; }
.hero-sub { color: var(--muted); margin-top: 16px; font-size: 15px; max-width: 30rem; }
.sample { margin: 0; padding: 14px 16px; background: var(--inset); border: 1px solid var(--line); border-radius: 8px; font: 12.5px/1.75 var(--mono); color: #b4b7ae; overflow-x: auto; max-width: 34rem; }
.sample span { color: var(--faint); }

.auth-main { padding: 40px 56px; display: flex; flex-direction: column; justify-content: center; }
.auth-box { width: 100%; max-width: 380px; margin: 0 auto; }
.auth-head { margin-bottom: 22px; }
.auth-head h2 { font-size: 22px; font-weight: 600; line-height: 1.25; }
.auth-head p { color: var(--muted); margin-top: 4px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; margin-bottom: 20px; padding: 3px; background: var(--inset); border: 1px solid var(--line); border-radius: 8px; }
.seg button { background: none; border: 0; border-radius: 5px; padding: 7px; cursor: pointer; color: var(--muted); font-weight: 500; transition: background .12s, color .12s; }
.seg button:hover { color: var(--text); }
.seg button.active { background: var(--accent); color: var(--on-accent); font-weight: 600; }
.auth-box input { padding: 10px 12px; font-size: 15px; }
.auth-box .field { margin-bottom: 14px; }
.auth-box .btn.block { margin-top: 8px; font-size: 15px; }
.pw { position: relative; }
.pw input { padding-right: 78px; }
.pw-toggle { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); background: none; border: 0; padding: 4px 8px; cursor: pointer; color: var(--muted); font-size: 12px; font-family: var(--mono); border-radius: 4px; }
.pw-toggle:hover { color: var(--text); background: var(--raised); }
.auth-foot { margin-top: 18px; color: var(--muted); font-size: 13px; }
.auth-foot b { color: var(--text); font-weight: 500; }

@media (max-width: 800px) {
    .auth { grid-template-columns: 1fr; }
    .auth-side { padding: 24px 20px; gap: 26px; border-right: 0; border-bottom: 1px solid var(--line); }
    .sample { display: none; }
    .auth-main { padding: 28px 20px 40px; }
}

/* ---------- top bar ---------- */
.top { display: flex; align-items: center; gap: 24px; padding: 0 24px; min-height: 54px; background: rgba(14,16,13,.92); backdrop-filter: blur(6px); box-shadow: 0 2px 0 rgba(123,192,67,.12); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.top .logo { font-size: 17px; }
.nav { display: flex; align-self: stretch; gap: 2px; }
.nav button { position: relative; background: none; border: 0; padding: 0 14px; cursor: pointer; color: var(--muted); font-weight: 500; transition: color .12s; }
.nav button:hover { color: var(--text); }
.nav button.active { color: var(--text); }
.nav button.active::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: -1px; height: 3px; background: var(--accent); }
.spacer { flex: 1; }
.me { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.who { display: flex; align-items: center; gap: 8px; }
.who-av { width: 24px; height: 24px; display: grid; place-items: center; background: var(--raised); border: 1px solid var(--line2); color: var(--text); font-weight: 600; font-size: 12px; border-radius: 4px; }
.me .name { font-weight: 500; }
.pill { font-family: var(--mono); font-size: 12px; padding: 1px 8px; border: 1px solid var(--line2); border-radius: 999px; color: var(--muted); white-space: nowrap; }
.pill.ok { color: var(--accent-hi); border-color: #2f4a2e; }
.pill.warn { color: var(--warn); border-color: #5a4619; }
.pill.err { color: #f0928a; border-color: #5a2f2b; }
@media (max-width: 640px) {
    .top { gap: 10px; padding: 6px 12px; flex-wrap: wrap; }
    .me { gap: 8px; font-size: 12px; }
    .me .name { display: none; }
    .nav { order: 3; width: 100%; min-height: 38px; }
    .nav button { flex: 1; }
    .nav button.active::after { left: 0; right: 0; }
}

/* ---------- workspace ---------- */
.workspace { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 28px; padding: 24px 24px 56px; max-width: 1520px; margin: 0 auto; align-items: start; }
@media (max-width: 860px) { .workspace { grid-template-columns: 1fr; gap: 20px; padding: 16px 12px 40px; } }

.rail-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.rail-head h3 { font-size: 13px; font-weight: 500; color: var(--muted); }
.rail-head b { font-family: var(--mono); font-size: 12px; font-weight: 400; color: var(--faint); margin-left: 6px; }
.cards { display: grid; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); overflow: hidden; }
.cards:empty { display: none; }
@media (max-width: 860px) { .cards { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); } }

.bcard {
    position: relative; display: grid; grid-template-columns: 40px 1fr; gap: 12px; align-items: center; text-align: left; width: 100%;
    padding: 11px 14px; background: transparent; border: 0; border-bottom: 1px solid var(--line); cursor: pointer;
    transition: background .12s;
}
.bcard:last-child { border-bottom: 0; }
.bcard:hover { background: var(--raised); }
.bcard.sel { background: linear-gradient(90deg, rgba(123,192,67,.12), transparent 70%), var(--raised); }
.bcard.sel::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--accent); }
.bcard > span:last-child { min-width: 0; }
.bcard .top1 { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bcard .nm { font-weight: 500; font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bcard .st { font: 12px var(--mono); color: var(--muted); margin-top: 1px; }
.bcard .mini { display: flex; gap: 6px; margin-top: 7px; }
.mini .bar { flex: 1; height: 5px; background: var(--line); border-radius: 2px; overflow: hidden; }
.mini .bar i { display: block; height: 100%; transition: width .3s; }
.mini .hp i { background: var(--bad); }
.mini .fd i { background: #cf8a42; }

.av { position: relative; width: 40px; height: 40px; background: var(--raised); border: 1px solid var(--line2); border-radius: 4px; display: grid; place-items: center; font-family: var(--pixel); font-size: 17px; color: var(--muted); flex: none; }
.av img { position: absolute; inset: 0; width: 100%; height: 100%; border-radius: 3px; image-rendering: pixelated; }
.av.lg { width: 64px; height: 64px; border-radius: 6px; }
.av .sd { position: absolute; right: -4px; bottom: -4px; width: 11px; height: 11px; border: 2px solid var(--surface); border-radius: 50%; background: var(--faint); z-index: 2; }
.bcard:hover .av .sd, .bcard.sel .av .sd { border-color: var(--raised); }
.sd.online { background: var(--ok); }
.sd.connecting, .sd.login, .sd.joining, .sd.queued, .sd.reconnecting { background: var(--warn); }

.empty { padding: 56px 20px; text-align: center; color: var(--muted); }
.empty b { display: block; font-size: 15px; color: var(--text); margin-bottom: 4px; font-weight: 500; }

/* ---------- detail ---------- */
.hero { display: flex; align-items: center; gap: 18px; padding: 28px 22px 18px; margin-bottom: 20px; flex-wrap: wrap; position: relative; }
.hero::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 8px; background: repeating-linear-gradient(90deg, #6fb63f 0 8px, #5f9d35 8px 16px, #78c244 16px 24px, #68ab3a 24px 32px); border-bottom: 2px solid #4f8a2c; }
.hero::after { content: ""; position: absolute; left: 0; right: 0; top: 10px; height: 5px; background: repeating-linear-gradient(90deg, #8a5a35 0 8px, #7d5030 8px 16px, #6f4628 16px 24px, #93603a 24px 32px); opacity: .55; }
.hero .who { flex: 1; min-width: 200px; display: block; }
.hero h2 { font-family: var(--pixel); font-size: 32px; font-weight: 600; line-height: 1.15; }
.hero .meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.tag { font: 12px var(--mono); padding: 2px 9px; border-radius: 999px; border: 1px solid var(--line2); color: var(--muted); }
.tag.on { color: var(--accent-hi); border-color: #3b5a26; background: rgba(123,192,67,.1); }
.tag.warn { color: var(--warn); border-color: #5a4619; }
.tag.off { color: var(--muted); }
.hero .btns { display: flex; gap: 8px; }
.errline { font-size: 12.5px; color: #f0928a; margin-top: 6px; }
.errline:empty { display: none; }

.grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 20px; align-items: start; }
.stack { display: grid; gap: 20px; }
.col-log { position: sticky; top: 72px; }
@media (max-width: 1100px) { .grid { grid-template-columns: 1fr; } .col-log { position: static; } }

/* vitals */
.vital { display: grid; grid-template-columns: 56px 1fr auto; align-items: center; gap: 10px; padding: 5px 0; }
.vital .k { font-size: 12.5px; color: var(--muted); }
.vital .n { font: 12px var(--mono); color: var(--muted); }
.icons { display: flex; flex-wrap: wrap; gap: 2px; }
.icons svg { width: 19px; height: 19px; shape-rendering: crispEdges; display: block; }
.kv { display: grid; grid-template-columns: 80px 1fr; gap: 6px 12px; margin: 10px 0 0; padding-top: 12px; border-top: 1px solid var(--line); font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font: 12.5px var(--mono); word-break: break-word; }

/* scoreboard (meniru tampilan Minecraft) */
.sb { background: rgba(0, 0, 0, .55); border: 1px solid var(--line); border-radius: 2px; box-shadow: inset 0 0 0 2px rgba(0,0,0,.35); padding: 6px 10px 8px; font: 13px var(--mono); }
.sb-t { text-align: center; padding: 3px 0 6px; color: var(--warn); font-weight: 500; }
.sb-r { display: flex; justify-content: space-between; gap: 14px; padding: 1px 0; }
.sb-r span:first-child { color: #dfe2da; }
.sb-r span:last-child { color: #ff5555; }
.sb-e { color: var(--muted); padding: 6px 2px; text-align: center; }

/* tab & kontrol */
.tabs { display: flex; gap: 4px; padding: 0 12px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { position: relative; background: none; border: 0; padding: 11px 12px; cursor: pointer; color: var(--muted); font-weight: 500; white-space: nowrap; transition: color .12s; }
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--text); }
.tabs button.active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 3px; background: var(--accent); }
.tabs { background: var(--raised); }
.tabpane { padding: 16px; display: grid; gap: 18px; }
.blk { display: grid; gap: 8px; }
.blk > label, .blk > .lbl { font-size: 12.5px; font-weight: 500; color: var(--muted); }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.hint { font-size: 12.5px; color: var(--muted); }
.reply { padding: 10px 12px; background: var(--inset); border: 1px solid var(--line); border-left: 2px solid var(--info); border-radius: 0 var(--r) var(--r) 0; font: 12.5px/1.55 var(--mono); white-space: pre-wrap; word-break: break-word; }

.opt { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; background: var(--inset); border: 1px solid var(--line); border-radius: var(--r); }
.opt:hover { border-color: var(--line2); }
.opt .t { font-weight: 500; }
.opt .d { font-size: 12.5px; color: var(--muted); }
.sw { position: relative; width: 40px; height: 22px; border: 1px solid var(--line2); background: var(--surface); border-radius: 999px; cursor: pointer; flex: none; padding: 0; transition: background .15s, border-color .15s; }
.sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 14px; height: 14px; border-radius: 50%; background: var(--muted); transition: transform .15s, background .15s; }
.sw.on { background: #27431a; border-color: var(--accent-dk); }
.sw.on::after { transform: translateX(18px); background: var(--accent-hi); }
.sw.unk::after { background: var(--warn); transform: translateX(9px); }
.sw:disabled { opacity: .45; cursor: wait; }
.state-txt { font: 12px var(--mono); color: var(--muted); }

/* log */
.log { height: min(62vh, 580px); min-height: 280px; overflow-y: auto; padding: 10px 14px; font: 12.5px/1.65 var(--mono); background: var(--inset); }
.log > div { word-break: break-word; display: grid; grid-template-columns: 68px 1fr; }
.log .t { color: var(--faint); }
.log .system { color: var(--warn); }
.log .server { color: #a3a79d; }
.log .joinleave { color: var(--faint); font-style: italic; }
.log .tpa { color: var(--info); font-weight: 500; }
.log .chat { color: var(--text); }
.log > .log-empty { display: block; color: var(--muted); padding: 6px 0; }
.sayform { border-top: 1px solid var(--line); padding: 10px; }

/* admin */
.admin { max-width: 980px; margin: 0 auto; padding: 24px 24px 60px; display: grid; gap: 20px; }
.genrow { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.genrow .field { margin: 0; }
.genrow input { width: 120px; }
.genrow .btn { padding-top: 8px; padding-bottom: 7px; }
.newkeys { margin-top: 14px; border: 1px dashed var(--line2); background: var(--inset); border-radius: var(--r); padding: 10px 12px; font: 13px/1.9 var(--mono); }
.newkeys .r { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.tablewrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 9px 14px 9px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
th { color: var(--muted); font-weight: 500; font-size: 12px; }
td.mono { font: 12.5px var(--mono); }
td.right, th.right { text-align: right; padding-right: 0; }
@media (max-width: 640px) { .admin { padding: 14px 12px 40px; } }

/* modal & toast */
.modal-bg { position: fixed; inset: 0; background: rgba(6, 7, 6, .72); display: grid; place-items: center; padding: 16px; z-index: 20; }
.modal { background: var(--surface); border: 1px solid var(--line2); border-radius: 10px; padding: 20px; width: 100%; max-width: 430px; max-height: 86vh; overflow-y: auto; }
.modal h3 { font-size: 17px; font-weight: 600; margin-bottom: 4px; }
.modal .hint { margin-bottom: 14px; }
.modal .foot { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 18px; }
.chk { display: flex; align-items: center; gap: 10px; padding: 8px 2px; border-bottom: 1px solid var(--line); cursor: pointer; }
.chk input { width: auto; accent-color: var(--accent); }
.chk .cnt { margin-left: auto; font: 12.5px var(--mono); color: var(--muted); }

.toast {
    position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 30; max-width: min(92vw, 520px);
    background: var(--raised); color: var(--text); padding: 10px 16px; border: 1px solid var(--line2); border-left: 4px solid var(--accent);
    border-radius: var(--r); box-shadow: 0 8px 28px rgba(0, 0, 0, .5); font-size: 13px; white-space: pre-wrap;
}
.toast.err { border-left-color: var(--bad); }
@media (max-width: 800px) { .block-art { width: 190px; height: 190px; right: -20px; top: 14px; opacity: .55; } }


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