:root {
  --bg: #0b0d11;
  --panel: #12151b;
  --panel-2: #171b22;
  --panel-3: #0e1015;
  --line: #232833;
  --line-soft: #1b1f27;
  --text: #e8ebf0;
  --muted: #8a93a3;
  --faint: #5a6372;
  --accent: #6366f1;
  --accent-soft: color-mix(in srgb, var(--accent) 16%, transparent);
  --accent-line: color-mix(in srgb, var(--accent) 45%, transparent);
  --green: #3ecf8e;
  --amber: #f5b942;
  --red: #f26b6b;
  --radius: 12px;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 14px/1.45 var(--sans); background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: var(--mono); }
.error { color: var(--red); min-height: 1.2em; font-size: 13px; text-align: center; margin: 0; }
a { color: inherit; }
.link { color: var(--muted); text-decoration: none; font-size: 13px; }
.link:hover { color: var(--text); }

/* ---- controls ---- */
.btn {
  font: 600 13.5px var(--sans); border-radius: 9px; border: 1px solid transparent; cursor: pointer;
  padding: 8px 14px; color: var(--text); background: var(--panel-2); transition: background .15s, border-color .15s, color .15s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--muted); }
.btn.ghost:hover { color: var(--text); border-color: #343b48; }
.btn.sm { padding: 6px 11px; font-size: 12.5px; }
.btn.icon { background: transparent; border: 1px solid var(--line); color: var(--muted); padding: 5px 9px; font-size: 14px; line-height: 1; }
.btn.icon:hover { color: var(--text); }
.btn.danger { color: var(--red); border-color: color-mix(in srgb, var(--red) 35%, transparent); background: transparent; }
input[type=text], input[type=password], input[type=search], input[type=number] {
  font: 14px var(--sans); color: var(--text); background: var(--panel-3); border: 1px solid var(--line);
  border-radius: 9px; padding: 9px 12px; outline: none; transition: border-color .15s, box-shadow .15s; min-width: 0;
}
input::placeholder { color: var(--faint); }
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type=color] { width: 42px; height: 36px; padding: 2px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-3); cursor: pointer; }

.logo { width: 26px; height: 26px; border-radius: 8px; flex: none; background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 40%, #ec4899)); box-shadow: inset 0 1px 0 rgba(255,255,255,.25); }
.logo-lg { width: 46px; height: 46px; border-radius: 13px; margin: 0 auto 4px; }

/* ---- login ---- */
.login { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.login-card { width: min(360px, 100%); display: flex; flex-direction: column; gap: 12px; padding: 32px 28px; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 30px 80px rgba(0,0,0,.45); }
.login-card h1 { font-size: 19px; margin: 0; text-align: center; }
.login-card .sub { margin: 0 0 6px; text-align: center; color: var(--muted); font-size: 13px; }

/* ---- shell ---- */
.app { display: grid; grid-template-columns: 240px minmax(0, 1fr); height: 100vh; }
.sidebar { display: flex; flex-direction: column; gap: 6px; padding: 18px 14px; background: var(--panel-3); border-right: 1px solid var(--line-soft); min-height: 0; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 650; padding: 2px 6px 14px; }
.brand-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-label { font-size: 11px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--faint); padding: 8px 8px 4px; }
.server-list { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.server-item { display: flex; align-items: center; gap: 9px; padding: 8px 9px; border-radius: 9px; cursor: pointer; color: var(--muted); }
.server-item:hover { background: var(--panel-2); color: var(--text); }
.server-item.active { background: var(--panel-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }
.server-item .sdot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); flex: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 18%, transparent); }
.server-item.off .sdot { background: var(--faint); box-shadow: none; }
.server-item .sname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.server-item .stag { font-size: 11px; color: var(--faint); font-family: var(--mono); }
.server-item .upd { color: var(--amber); font-size: 12px; }
.server-empty { color: var(--faint); font-size: 13px; padding: 6px 9px; }
.nav { display: flex; flex-direction: column; gap: 2px; border-top: 1px solid var(--line-soft); padding-top: 10px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 10px; border-radius: 9px; text-decoration: none; color: var(--muted); font-weight: 550; }
.nav a svg { width: 18px; height: 18px; fill: currentColor; flex: none; }
.nav a:hover { color: var(--text); background: var(--panel-2); }
.nav a.active { color: var(--text); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-line); }
.logout { margin-top: auto; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.header { padding: 20px 28px 8px; }
.header-title { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.header h1 { margin: 0; font-size: 22px; letter-spacing: -.01em; }
.server-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pill { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 600; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); }
.pill .dot { width: 7px; height: 7px; border-radius: 50%; }
.pill.online { color: var(--green); border-color: color-mix(in srgb, var(--green) 35%, transparent); background: color-mix(in srgb, var(--green) 8%, transparent); }
.pill.online .dot { background: var(--green); }
.pill.offline { color: var(--red); border-color: color-mix(in srgb, var(--red) 30%, transparent); }
.pill.offline .dot { background: var(--red); }
.chip { font: 12px var(--sans); color: var(--muted); background: var(--panel-2); border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; }
button.chip { cursor: pointer; }
button.chip:hover { color: var(--text); }
.chip.mono { font-family: var(--mono); }

.page { display: none; padding: 12px 28px 28px; overflow-y: auto; min-height: 0; }
.page.active { display: block; }
.page-fill.active { display: flex; flex-direction: column; flex: 1; }

.card { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 16px; min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h2 { margin: 0; font-size: 15px; font-weight: 650; }
.toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

/* ---- overview ---- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { background: var(--panel); border: 1px solid var(--line-soft); border-radius: var(--radius); padding: 14px 16px; min-height: 104px; display: flex; flex-direction: column; gap: 4px; position: relative; overflow: hidden; }
.kpi-label { font-size: 12px; color: var(--muted); font-weight: 600; }
.kpi-value { font-size: 26px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.kpi-sub { font-size: 12px; color: var(--faint); }
.good { color: var(--green); } .warn { color: var(--amber); } .bad { color: var(--red); }
.spark { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 36px; color: var(--accent); opacity: .9; }
.bar { height: 6px; background: var(--panel-3); border-radius: 99px; overflow: hidden; margin-top: auto; }
.bar > div { height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .4s; }
.overview-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: 14px; }
.online-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.online-list li { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; cursor: pointer; }
.online-list li:hover { background: var(--panel-2); }
.online-list .pname { flex: 1; font-weight: 550; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.gm { font: 600 10.5px var(--mono); padding: 2px 6px; border-radius: 5px; background: var(--panel-2); color: var(--muted); }
.gm-c { color: #c4a6ff; } .gm-a { color: var(--amber); } .gm-x { color: #7dd3fc; }
.ping { font: 12px var(--mono); min-width: 52px; text-align: right; }
.empty { color: var(--faint); font-size: 13px; padding: 8px; }

/* ---- console ---- */
.log { font: 12.5px/1.55 var(--mono); overflow-y: auto; white-space: pre-wrap; word-break: break-word; color: #c9ced8; }
.log.mini { height: 240px; background: var(--panel-3); border-radius: 9px; padding: 10px 12px; }
.console-card { flex: 1; display: flex; flex-direction: column; gap: 10px; min-height: 0; padding: 0; overflow: hidden; }
.console-card .log { flex: 1; padding: 16px 18px 6px; min-height: 0; }
.line.warn { color: var(--amber); } .line.error { color: var(--red); } .line.join { color: var(--green); } .line.sys { color: var(--accent); }
.quickbar { display: flex; gap: 6px; flex-wrap: wrap; }
.quickbar:empty { display: none; }
.console-card .quickbar { padding: 0 16px; }
.quickcmd { font: 600 12px var(--sans); padding: 5px 10px; border-radius: 999px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); cursor: pointer; }
.quickcmd:hover { color: var(--text); border-color: var(--accent-line); }
.prompt { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-top: 1px solid var(--line-soft); background: var(--panel-3); }
.prompt .caret { color: var(--accent); font: 700 15px var(--mono); }
.prompt input { flex: 1; font-family: var(--mono); font-size: 13px; background: transparent; border-color: transparent; box-shadow: none; padding: 8px 4px; }
.prompt input:focus { border-color: transparent; box-shadow: none; }

/* ---- players + creative view ---- */
.players-layout { flex: 1; display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 14px; min-height: 0; }
.players-panel { display: flex; flex-direction: column; gap: 8px; min-height: 0; padding: 12px; }
.players-tools { display: flex; gap: 6px; }
.players-tools input { flex: 1; }
.players-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.player-row { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 9px; cursor: pointer; }
.player-row:hover { background: var(--panel-2); }
.player-row.active { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-line); }
.player-row .face { width: 28px; height: 28px; border-radius: 6px; image-rendering: pixelated; background: var(--panel-3); flex: none; }
.player-row .pinfo { flex: 1; min-width: 0; }
.player-row .pname { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-row .psub { font-size: 11.5px; color: var(--faint); }
.player-row .odot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); flex: none; }
.player-view { display: flex; flex-direction: column; min-height: 0; min-width: 0; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line-soft); }
.player-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 14px; background: var(--panel); border-bottom: 1px solid var(--line-soft); }
.player-who { display: flex; align-items: center; gap: 12px; min-width: 0; flex: 1 1 300px; }
.player-who > div { min-width: 0; }
#pv-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pv-face { width: 36px; height: 36px; border-radius: 8px; image-rendering: pixelated; }
.pv-name { font-weight: 650; font-size: 15px; }
.player-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.save-state { font-size: 12.5px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.save-state::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.save-state.saved::before { background: var(--green); }
.save-state.saving::before, .save-state.unsaved::before { background: var(--amber); }
.save-state.error { color: var(--red); } .save-state.error::before { background: var(--red); }
.mc-stage { position: relative; flex: 1; min-height: 420px; background: #0d1117; overflow: hidden; }
/* the in-game "inventory over the world" backdrop (0xC0101010 → 0xD0101010) over the live map */
.mc-overlay { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(16,16,16,.75), rgba(16,16,16,.82)); }
.mc-canvas { position: absolute; inset: 0; display: block; outline: none; image-rendering: pixelated; }

/* ---- live map ---- */
.map { position: absolute; inset: 0; }
.map-canvas { position: absolute; inset: 0; display: block; cursor: grab; touch-action: none; }
.map-hud { position: absolute; inset: 0; pointer-events: none; }
.map-hud > * { pointer-events: auto; }
.map-dims { position: absolute; top: 12px; left: 12px; display: flex; gap: 2px; padding: 3px; background: rgba(13,15,20,.78); border: 1px solid var(--line); border-radius: 10px; backdrop-filter: blur(6px); }
.map-dims button, .map-zoom button { font: 600 12.5px var(--sans); color: var(--muted); background: transparent; border: 0; border-radius: 7px; padding: 6px 10px; cursor: pointer; }
.map-dims button:hover, .map-zoom button:hover { color: var(--text); }
.map-dims button.active { color: var(--text); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-line); }
.map-zoom { position: absolute; top: 12px; right: 12px; display: flex; flex-direction: column; gap: 2px; padding: 3px; background: rgba(13,15,20,.78); border: 1px solid var(--line); border-radius: 10px; }
.map-zoom button { font-size: 16px; width: 32px; padding: 4px 0; }
.map-coords { position: absolute; left: 12px; bottom: 12px; font: 12px var(--mono); color: var(--muted); background: rgba(13,15,20,.78); border-radius: 8px; padding: 4px 9px; }
.map-coords:empty { display: none; }
.map-status { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); color: var(--muted); font-size: 13.5px; background: rgba(13,15,20,.85); border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.mc-search-input { position: absolute; opacity: 0; border: 0; padding: 0; margin: 0; background: transparent; color: transparent; caret-color: transparent; pointer-events: none; }
.mc-message { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 20px; color: #bdbdbd; font-size: 14px; }

/* ---- files ---- */
.files-card { flex: 1; display: flex; flex-direction: column; gap: 10px; min-height: 0; }
.files-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.files-body { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; min-height: 0; }
.files-body:has(.editor:not(.hidden)) { grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr); }
.crumbs { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; font-size: 13.5px; }
.crumb { cursor: pointer; padding: 3px 7px; border-radius: 6px; color: var(--muted); }
.crumb:hover { color: var(--text); background: var(--panel-2); }
.crumb:last-child { color: var(--text); font-weight: 600; }
.crumb-sep { color: var(--faint); }
.entries { list-style: none; margin: 0; padding: 0; overflow-y: auto; min-height: 0; }
.entries li { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; cursor: pointer; }
.entries li:hover { background: var(--panel-2); }
.entries .ico { width: 17px; height: 17px; color: var(--faint); flex: none; }
.entries li.dir .ico { color: var(--accent); }
.entries .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entries .meta { display: flex; gap: 14px; flex: none; color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }
.entries .meta span:first-child { width: 128px; }
.entries .meta span:last-child { width: 64px; text-align: right; }
.entries .actions { display: none; gap: 4px; flex: none; }
.entries li:hover .actions { display: flex; }
.entries li:hover .meta { display: none; }
.act { font: 12px var(--sans); background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 3px 7px; cursor: pointer; }
.act:hover { color: var(--text); }
.act-danger:hover { color: var(--red); }
.editor { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.editor-bar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.editing { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.editor-actions { display: flex; gap: 6px; }
.editor textarea { flex: 1; min-height: 240px; resize: none; font: 12.5px/1.55 var(--mono); color: var(--text); background: var(--panel-3); border: 1px solid var(--line); border-radius: 9px; padding: 12px; outline: none; }

/* ---- activity ---- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13px; }
.table th { text-align: left; font-weight: 600; color: var(--faint); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 8px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.table td.mono { font-size: 12px; color: var(--muted); }
.kind-tag { font: 600 11px var(--mono); padding: 2px 7px; border-radius: 5px; background: var(--panel-2); color: var(--muted); white-space: nowrap; }
.check { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; }

/* ---- settings ---- */
.settings { display: flex; flex-direction: column; gap: 14px; max-width: 820px; }
.field-row { display: flex; gap: 14px; flex-wrap: wrap; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--muted); font-weight: 600; flex: 1; min-width: 200px; }
.field-color { flex: 0 0 auto; min-width: 0; }
.set-list { display: flex; flex-direction: column; gap: 8px; }
.set-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.set-row .set-id { font: 12px var(--mono); color: var(--faint); min-width: 110px; }
.set-row input[type=text] { flex: 1; min-width: 120px; }
.settings-foot { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }

/* ---- modal + NBT ---- */
.modal { position: fixed; inset: 0; background: rgba(5,6,9,.7); backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; z-index: 20; }
.modal-card { width: min(880px, 100%); max-height: 88vh; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 30px 90px rgba(0,0,0,.55); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line-soft); }
.modal-head h2 { margin: 0; font-size: 15px; display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.modal-actions { display: flex; align-items: center; gap: 8px; }
.modal-body { padding: 14px 16px; overflow: auto; }
.nbt-tree { font: 12.5px var(--mono); }
.nbt-row { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.nbt-tog { width: 14px; color: var(--faint); cursor: pointer; }
.nbt-key { cursor: pointer; }
.nbt-type { color: var(--faint); font-size: 11px; }
.nbt-val { font: 12px var(--mono) !important; padding: 3px 7px !important; border-radius: 6px !important; }
.nbt-ro { color: var(--muted); }

.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--panel-2); border: 1px solid var(--line); color: var(--text); padding: 9px 14px; border-radius: 10px; font-size: 13px; box-shadow: 0 12px 40px rgba(0,0,0,.4); z-index: 30; }

/* ---- responsive ---- */
@media (max-width: 1100px) {
  .overview-grid { grid-template-columns: minmax(0, 1fr); }
  .players-layout { grid-template-columns: 210px minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); height: auto; min-height: 100vh; }
  .sidebar { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px; padding: 10px 16px; border-right: 0; border-bottom: 1px solid var(--line-soft); overflow: visible; }
  .brand { padding: 0; flex: 1; }
  .side-label { display: none; }
  .server-list { order: 3; flex-direction: row; flex-wrap: wrap; width: 100%; margin: 0; }
  .nav { order: 4; flex-direction: row; overflow-x: auto; width: 100%; border-top: 0; padding-top: 0; }
  .nav a { padding: 7px 10px; white-space: nowrap; }
  .logout { margin-top: 0; }
  .header { padding: 14px 16px 4px; }
  .page { padding: 10px 16px 20px; }
  .players-layout { grid-template-columns: minmax(0, 1fr); }
  .players-panel { max-height: 260px; }
  .files-body:has(.editor:not(.hidden)) { grid-template-columns: minmax(0, 1fr); }
  .entries .meta { display: none; }
  .entries .actions { display: flex; }
  .mc-stage { min-height: 520px; }
}

/* ---- shared: segmented control, menus, dialog, notices ---- */
.seg { display: inline-flex; gap: 2px; padding: 3px; background: var(--panel-3); border: 1px solid var(--line); border-radius: 10px; }
.seg button { font: 600 12.5px var(--sans); color: var(--muted); background: transparent; border: 0; border-radius: 7px; padding: 6px 11px; cursor: pointer; }
.seg button:hover { color: var(--text); }
.seg button.active { color: var(--text); background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-line); }
.page-tabs { margin-bottom: 14px; }
.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; min-width: 220px; padding: 6px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 18px 50px rgba(0,0,0,.45); }
.menu.at-point { position: fixed; top: auto; right: auto; }
.menu button { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; text-align: left; font: 550 13px var(--sans); color: var(--text); background: transparent; border: 0; border-radius: 7px; padding: 7px 10px; cursor: pointer; }
.menu button:hover:not(:disabled) { background: var(--accent-soft); }
.menu button:disabled { color: var(--faint); cursor: default; }
.menu button.danger { color: var(--red); }
.menu .menu-label { font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); padding: 8px 10px 4px; }
.menu hr { border: 0; border-top: 1px solid var(--line-soft); margin: 5px 4px; }
.menu .current { color: var(--accent); font-size: 12px; }
.dialog-card { width: min(420px, 100%); }
.dialog-card .modal-body { display: flex; flex-direction: column; gap: 12px; }
.dialog-card .field input { width: 100%; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line-soft); }
.notice { margin-bottom: 14px; padding: 10px 14px; border-radius: 10px; font-size: 13px; color: var(--amber); background: color-mix(in srgb, var(--amber) 10%, transparent); border: 1px solid color-mix(in srgb, var(--amber) 30%, transparent); }
.hint { margin: -4px 0 12px; }
.badge { font: 650 10.5px var(--sans); letter-spacing: .03em; padding: 2px 6px; border-radius: 5px; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); }
.badge.op { color: #c4a6ff; border-color: #5b4a8a; }
.badge.banned { color: var(--red); border-color: color-mix(in srgb, var(--red) 40%, transparent); }
.badge.wl { color: var(--green); border-color: color-mix(in srgb, var(--green) 35%, transparent); }
.player-row .badges { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 3px; }
.pv-stats { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 3px; font-size: 12px; color: var(--muted); }
.pv-stats b { color: var(--text); font-weight: 600; }

/* ---- toasts (live alerts) ---- */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 40; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 32px)); }
.toast-alert { display: flex; gap: 10px; padding: 11px 13px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); box-shadow: 0 16px 44px rgba(0,0,0,.45); font-size: 13px; cursor: pointer; animation: toast-in .2s ease-out; }
.toast-alert .lvl { width: 4px; border-radius: 4px; flex: none; }
.toast-alert .t { font-weight: 650; }
.toast-alert .m { color: var(--muted); font-size: 12.5px; margin-top: 2px; word-break: break-word; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }
.lvl-critical { background: var(--red); } .lvl-warning { background: var(--amber); } .lvl-info { background: var(--green); }
.nav-badge { margin-left: auto; min-width: 18px; padding: 1px 6px; border-radius: 999px; background: var(--red); color: #fff; font: 700 11px var(--sans); text-align: center; }

/* ---- console tools ---- */
.console-tools { display: flex; align-items: center; gap: 10px; padding: 0 16px; flex-wrap: wrap; }
.console-tools .quickbar { padding: 0; }
.mode-toggle { font: 700 14px var(--mono); color: var(--accent); background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; min-width: 52px; padding: 5px 8px; cursor: pointer; }
.mode-toggle.say { font: 650 12px var(--sans); color: var(--green); }
.log.f-chat .line:not(.chat), .log.f-joins .line:not(.join), .log.f-errors .line:not(.warn):not(.error) { display: none; }
.line.chat { color: #e8ebf0; }

/* ---- content ---- */
.content-pane { display: flex; flex-direction: column; gap: 14px; max-width: 980px; }
.mods-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.mod { display: flex; align-items: center; gap: 12px; padding: 9px 8px; border-radius: 10px; }
.mod:hover { background: var(--panel-2); }
.mod.off { opacity: .55; }
.mod-icon { width: 36px; height: 36px; border-radius: 8px; background: var(--panel-3); flex: none; object-fit: cover; }
.mod-info { flex: 1; min-width: 0; }
.mod-title { font-weight: 650; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mod-sub { font-size: 12px; color: var(--faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mod-actions { display: flex; gap: 6px; flex: none; flex-wrap: wrap; justify-content: flex-end; }
.badge.update { color: var(--accent); border-color: var(--accent-line); }
.search-row { display: flex; gap: 8px; margin-bottom: 10px; }
.search-row input { flex: 1; }
.rules-list, .props-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 6px 14px; }
.rule, .prop { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border-radius: 9px; background: var(--panel-3); min-width: 0; }
.rule-name, .prop-key { font-size: 13px; font-weight: 550; min-width: 0; }
.rule-name small { display: block; color: var(--faint); font-weight: 400; font-size: 11.5px; margin-top: 1px; }
.rule.changed, .prop.changed { box-shadow: inset 0 0 0 1px var(--accent-line); }
.rule input[type=number], .prop input[type=text], .prop input[type=number], .prop select { width: 120px; padding: 5px 8px; font-size: 12.5px; }
.prop .prop-key { font-family: var(--mono); font-size: 12px; overflow: hidden; text-overflow: ellipsis; }
.cat-head { grid-column: 1 / -1; font-size: 11px; font-weight: 650; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); padding: 8px 2px 0; }
.switch { position: relative; width: 36px; height: 20px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; position: absolute; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: background .15s; cursor: pointer; }
.switch span::after { content: ""; position: absolute; left: 3px; top: 3px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(16px); }
.switch input:focus-visible + span { box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---- alerts ---- */
.alerts-layout { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.alerts-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; max-height: 70vh; overflow-y: auto; }
.alert-row { display: flex; gap: 10px; padding: 9px 8px; border-radius: 9px; }
.alert-row:hover { background: var(--panel-2); }
.alert-row .lvl { width: 4px; border-radius: 4px; flex: none; }
.alert-row .t { font-weight: 600; font-size: 13.5px; }
.alert-row .m { color: var(--muted); font-size: 12.5px; margin-top: 2px; word-break: break-word; white-space: pre-wrap; }
.alert-row .when { margin-left: auto; color: var(--faint); font-size: 12px; white-space: nowrap; flex: none; }
.alert-rules { display: flex; flex-direction: column; gap: 8px; }
.alert-rule { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 9px; background: var(--panel-3); flex-wrap: wrap; }
.alert-rule .rname { flex: 1; min-width: 160px; font-size: 13.5px; font-weight: 600; }
.alert-rule .rname small { display: block; color: var(--faint); font-weight: 400; font-size: 12px; }
.alert-rule .rparams { display: flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--muted); flex-wrap: wrap; }
.alert-rule input[type=number] { width: 76px; padding: 5px 7px; font-size: 12.5px; }
.alert-rule input[type=text] { min-width: 200px; padding: 5px 8px; font-size: 12.5px; }
.hook-row select { padding: 8px; border-radius: 9px; background: var(--panel-3); color: var(--text); border: 1px solid var(--line); }

/* ---- map context menu ---- */
.map-menu { position: absolute; z-index: 5; }

@media (max-width: 1100px) { .alerts-layout { grid-template-columns: minmax(0, 1fr); } }

/* ---- NBT editor ---- */
.nbt-card { width: min(1000px, 100%); height: min(86vh, 900px); }
.nbt-card .modal-body { flex: 1; min-height: 0; }
.nbt-tools { display: flex; gap: 8px; padding: 10px 16px; border-bottom: 1px solid var(--line-soft); }
.nbt-tools input { flex: 1; }
.nbt-row { border-radius: 6px; padding: 3px 6px; min-height: 30px; }
.nbt-row:hover { background: var(--panel-2); }
.nbt-tog { width: 14px; flex: none; }
.nbt-key { font-weight: 600; color: var(--text); }
.nbt-key.hit { background: color-mix(in srgb, var(--amber) 25%, transparent); border-radius: 3px; }
.nbt-type { color: var(--faint); font-size: 11px; }
.nbt-count { color: var(--faint); font-size: 11.5px; }
.nbt-val { min-width: 140px; max-width: 420px; flex: 0 1 320px; }
.nbt-val.bad { border-color: var(--red) !important; }
.nbt-actions { margin-left: auto; display: flex; gap: 4px; opacity: 0; transition: opacity .1s; }
.nbt-row:hover .nbt-actions, .nbt-row:focus-within .nbt-actions { opacity: 1; }
.nbt-act { font: 11.5px var(--sans); color: var(--muted); background: var(--panel-3); border: 1px solid var(--line); border-radius: 6px; padding: 3px 7px; cursor: pointer; }
.nbt-act:hover { color: var(--text); }
.nbt-act.danger:hover { color: var(--red); }
@media (hover: none) { .nbt-actions { opacity: 1; } }
.btn { white-space: nowrap; }
.menu button.danger:disabled { color: var(--faint); }

.set-help { margin: -4px 0 12px; line-height: 1.5; }
.tok-state { flex: 1; font-size: 13px; color: var(--muted); }

/* Item attribute editor */
.attrs-card { width: min(860px, 100%); }
.attrs-card .modal-body { display: flex; flex-direction: column; gap: 10px; }
.attrs-icon { display: inline-flex; width: 24px; height: 24px; align-self: center; }
.attrs-icon canvas { width: 24px; height: 24px; image-rendering: pixelated; }
.attrs-head, .attrs-row { display: grid; grid-template-columns: minmax(0, 2.2fr) 90px minmax(0, 1.2fr) minmax(0, 1.2fr) 32px 32px; gap: 6px; align-items: center; }
.attrs-row { grid-template-areas: "type amt op slot eye del" "id id hint hint hint hint"; padding: 8px; border: 1px solid var(--line-soft); border-radius: 10px; background: var(--panel-2); }
.attrs-head { font-weight: 600; padding: 0 9px; }
.attrs-rows { display: flex; flex-direction: column; gap: 8px; }
.attrs-row select, .attrs-row input { width: 100%; min-width: 0; padding: 6px 8px; font-size: 12.5px; border-radius: 8px; background: var(--panel-3); color: var(--text); border: 1px solid var(--line); }
.attrs-row .a-type { grid-area: type; } .attrs-row .a-amt { grid-area: amt; } .attrs-row .a-op { grid-area: op; }
.attrs-row .a-slot { grid-area: slot; } .attrs-row .a-eye { grid-area: eye; } .attrs-row .a-del { grid-area: del; }
.attrs-row .a-id { grid-area: id; font-size: 12px; } .attrs-row .a-hint { grid-area: hint; }
.attrs-row .btn.icon { padding: 5px 0; }
.attrs-foot { align-items: center; flex-wrap: wrap; }
.attrs-spacer { flex: 1; }
@media (max-width: 640px) {
  .attrs-head { display: none; }
  .attrs-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 32px 32px;
    grid-template-areas: "type type eye del" "amt op op op" "slot slot slot slot" "id id id id" "hint hint hint hint"; }
}

.btn.armed { color: var(--text); border-color: var(--accent-line); background: var(--accent-soft); }

/* Sign-in + Security */
.login-token { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.login-card .field input { width: 100%; }
.sec-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 16px 0 8px; }
.sec-h h3 { margin: 0; font-size: 13px; font-weight: 650; color: var(--text); }
.sec-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 10px; border: 1px solid var(--line-soft); border-radius: 10px; background: var(--panel-2); }
.sec-row .sec-main { flex: 1; min-width: 160px; display: flex; flex-direction: column; gap: 2px; }
.sec-row .sec-name { font-size: 13px; font-weight: 600; }
.sec-row .sec-meta { font-size: 12px; color: var(--muted); }
.sec-badge { font-size: 11px; padding: 1px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--text); border: 1px solid var(--accent-line); }
