/* Wildmere UI: deep-forest glass over the live world, cream serif display type, amber accent. */
:root {
  --bg: #0a1f1b;
  --ink: #f4eddd;
  --muted: #a9b9ae;
  --faint: #6f877b;
  --amber: #e8ad73;
  --amber-hi: #f2c08e;
  --leaf: #7fd69b;
  --danger: #ff7a7a;
  --glass: rgba(14, 40, 34, 0.62);
  --glass-solid: rgba(12, 32, 28, 0.94);
  --line: rgba(244, 237, 221, 0.14);
  --line-hi: rgba(244, 237, 221, 0.3);
  --slot: rgba(24, 58, 48, 0.78);
  --serif: "Instrument Serif", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --sans: "DM Sans", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  font-family: var(--sans);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); user-select: none; }
canvas#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; image-rendering: pixelated; }
.hidden { display: none !important; }
.grow { flex: 1; }
b { font-weight: 700; }
code { background: rgba(255, 255, 255, 0.1); padding: 1px 5px; border-radius: 4px; user-select: text; }
::selection { background: var(--amber); color: #20140a; }
/* Slim, themed scrollbars everywhere (Firefox + Chromium/Safari) */
* { scrollbar-width: thin; scrollbar-color: rgba(232, 173, 115, 0.45) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; margin: 4px; }
::-webkit-scrollbar-thumb { background: rgba(244, 237, 221, 0.18); border-radius: 99px; border: 3px solid transparent; background-clip: padding-box; transition: background-color 0.15s; }
::-webkit-scrollbar-thumb:hover { background: rgba(232, 173, 115, 0.75); background-clip: padding-box; border: 3px solid transparent; }
::-webkit-scrollbar-thumb:active { background: var(--amber-hi); background-clip: padding-box; border: 3px solid transparent; }
::-webkit-scrollbar-corner { background: transparent; }

/* ------------------------------------------------------------ screens */
.screen { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-start; justify-content: center; padding: 24px; overflow: auto; }
.screen > * { margin: auto; } /* centres short content, stays scrollable from the top when it is taller than the window */
.screen.scenic {
  background:
    linear-gradient(95deg, rgba(8, 30, 26, 0.94) 0%, rgba(8, 30, 26, 0.78) 34%, rgba(8, 30, 26, 0.25) 72%, rgba(8, 30, 26, 0.12) 100%),
    radial-gradient(120% 90% at 100% 100%, rgba(120, 200, 150, 0.18), transparent 60%);
}
.screen.scrim { background: rgba(5, 16, 14, 0.62); backdrop-filter: blur(7px); }
.glass { background: var(--glass); border: 1px solid var(--line); border-radius: 18px; backdrop-filter: blur(14px) saturate(1.15); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45); }
.card { width: min(460px, 100%); padding: 30px 32px; }
.card.wide { width: min(720px, 100%); }
.card.center { text-align: center; align-items: center; }
.stack { display: flex; flex-direction: column; gap: 14px; }

.eyebrow { margin: 0; font-size: 12px; font-weight: 600; letter-spacing: 0.22em; text-transform: uppercase; color: var(--amber); }
.eyebrow.danger { color: var(--danger); }
.display { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 34px; line-height: 1.05; letter-spacing: 0.005em; }
.display.big { font-size: 52px; }
.display.death { color: var(--danger); }
h3 { margin: 12px 0 4px; font-size: 12px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
h4 { margin: 0 0 10px; font-size: 13px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.fine { margin: 0; font-size: 12.5px; line-height: 1.55; color: var(--muted); }
.sub { font-size: 12px; color: var(--muted); }
.warning { color: #ffd68a; font-size: 12.5px; margin: 0; }
.form-error { margin: 0; padding: 9px 12px; border-radius: 10px; background: rgba(255, 90, 90, 0.14); border: 1px solid rgba(255, 122, 122, 0.4); color: #ffc4c4; font-size: 13px; user-select: text; }
.error-text { color: #ffc4c4; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; white-space: pre-wrap; user-select: text; }
.empty { color: var(--muted); text-align: center; padding: 18px; margin: 0; font-size: 14px; }

/* ------------------------------------------------------------ buttons */
button { font: inherit; color: inherit; }
.cta, .ghost, .chip {
  appearance: none; cursor: pointer; border-radius: 9px; font-weight: 600; font-size: 15px;
  transition: background 0.15s, border-color 0.15s, transform 0.1s, box-shadow 0.15s, color 0.15s;
}
.cta {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%;
  padding: 15px 20px; border: 1px solid var(--amber); background: var(--amber); color: #2a1a0b;
  box-shadow: 0 6px 24px rgba(232, 173, 115, 0.25);
}
.cta .arrow { font-weight: 400; opacity: 0.7; }
.cta:hover:not(:disabled) { background: var(--amber-hi); transform: translateY(-1px); box-shadow: 0 10px 30px rgba(232, 173, 115, 0.35); }
.cta.compact { width: auto; padding: 8px 16px; font-size: 14px; justify-content: center; }
.ghost { display: block; width: 100%; padding: 14px 20px; border: 1px solid var(--line-hi); background: rgba(10, 36, 30, 0.35); text-align: center; }
.ghost:hover:not(:disabled) { background: rgba(244, 237, 221, 0.1); border-color: var(--ink); }
.ghost.small { width: auto; padding: 7px 14px; font-size: 13px; }
.ghost.danger { color: #ffc4c4; border-color: rgba(255, 122, 122, 0.45); }
.ghost.danger:hover:not(:disabled) { background: rgba(255, 90, 90, 0.18); border-color: var(--danger); }
.ghost.gold, .chip.gold { color: #ffe2a8; border-color: rgba(246, 196, 83, 0.55); }
.chip { padding: 7px 14px; border: 1px solid var(--line); background: rgba(10, 36, 30, 0.45); font-size: 13px; color: var(--muted); }
.chip:hover { color: var(--ink); border-color: var(--line-hi); background: rgba(244, 237, 221, 0.1); }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
button:disabled { opacity: 0.4; cursor: not-allowed; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
.link { background: none; border: 0; color: var(--amber); cursor: pointer; font-size: 12.5px; padding: 2px 4px; text-decoration: underline; text-underline-offset: 3px; }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; }

/* ------------------------------------------------------------ forms */
label { display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; color: var(--muted); }
label output { float: right; color: var(--ink); font-weight: 600; }
label small { color: var(--faint); font-size: 11.5px; line-height: 1.4; }
input[type="text"], input[type="password"], select {
  appearance: none; background: rgba(5, 22, 18, 0.55); border: 1px solid var(--line); color: var(--ink);
  padding: 11px 13px; border-radius: 9px; font: inherit; font-size: 14.5px; user-select: text; width: 100%;
}
select { cursor: pointer; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 17px) 55%, calc(100% - 12px) 55%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 32px; }
select option { background: #0f2a25; color: var(--ink); }
input:focus, select:focus { border-color: var(--amber); }
input[type="range"] { accent-color: var(--amber); width: 100%; height: 22px; }
input[type="color"] { width: 100%; height: 38px; padding: 2px; border-radius: 9px; border: 1px solid var(--line); background: rgba(5, 22, 18, 0.55); cursor: pointer; }
input[type="checkbox"] { accent-color: var(--amber); width: 16px; height: 16px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; }
.colors { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.section-label { font-size: 11px; font-weight: 600; letter-spacing: 0.2em; text-transform: uppercase; color: var(--amber); margin-top: 4px; padding-top: 10px; border-top: 1px solid var(--line); }
.section-label:first-child { border-top: 0; padding-top: 0; margin-top: 0; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label { font-size: 12.5px; color: var(--muted); }
.seg { display: flex; gap: 4px; padding: 3px; border: 1px solid var(--line); border-radius: 10px; background: rgba(5, 22, 18, 0.45); }
.seg button { flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 10px; border: 0; background: transparent; border-radius: 7px; cursor: pointer; font-size: 13.5px; color: var(--muted); font-weight: 600; }
.seg button.active { background: var(--amber); color: #2a1a0b; }
.seg.small button { padding: 5px 10px; font-size: 12px; }
.sw { width: 12px; height: 12px; border-radius: 50%; display: inline-block; border: 1px solid rgba(0, 0, 0, 0.4); }
.tabs { display: flex; gap: 22px; border-bottom: 1px solid var(--line); margin: 2px 0 4px; }
.tab { background: none; border: 0; padding: 8px 0 10px; font-size: 14.5px; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 600; }
.tab.active { color: var(--ink); border-bottom-color: var(--amber); }

/* ------------------------------------------------------------ account screen */
.auth-shell { display: grid; grid-template-columns: minmax(0, 440px); gap: 24px; align-items: stretch; max-height: 100%; }
.auth-shell.with-preview { grid-template-columns: minmax(0, 480px) minmax(0, 420px); }
.auth-card { padding: 28px 30px; display: flex; flex-direction: column; gap: 14px; }
.preview-card { padding: 14px; display: flex; flex-direction: column; gap: 10px; align-items: center; justify-content: center; }
.preview-card canvas { width: 100%; max-width: 420px; height: auto; aspect-ratio: 440 / 560; cursor: grab; touch-action: none; }
.preview-bar { display: flex; flex-direction: column; align-items: center; gap: 8px; }

/* ------------------------------------------------------------ main menu */
#screen-main { align-items: stretch; justify-content: flex-start; padding: 0; overflow: hidden; }
#screen-main > * { margin: 0; }
.topbar { position: absolute; top: 22px; right: 26px; z-index: 2; }
.chip-account { display: flex; align-items: center; gap: 12px; padding: 7px 14px 7px 9px; border-radius: 99px; }
.chip-account img { width: 28px; height: 28px; object-fit: contain; }
.acc-text { display: flex; flex-direction: column; line-height: 1.2; font-size: 13px; }
.acc-text span { font-size: 11px; color: var(--muted); }
.main-left { display: flex; flex-direction: column; justify-content: center; padding: 0 0 0 clamp(28px, 6.5vw, 96px); width: min(560px, 100%); height: 100%; }
.main-left .eyebrow { font-size: 11.5px; margin-bottom: 14px; }
.wordmark { margin: 0; font-family: var(--serif); font-weight: 400; font-size: clamp(64px, 9vw, 112px); line-height: 0.95; letter-spacing: -0.01em; color: var(--ink); text-shadow: 0 4px 40px rgba(0, 0, 0, 0.35); }
.tagline { margin: 22px 0 16px; font-size: 12.5px; letter-spacing: 0.3em; text-transform: uppercase; color: var(--muted); }
.lede { margin: 0 0 28px; font-size: 16px; line-height: 1.65; color: var(--ink); opacity: 0.92; }
.menu-stack { display: flex; flex-direction: column; gap: 10px; width: min(400px, 100%); }
.footline { position: absolute; left: clamp(28px, 6.5vw, 96px); right: 28px; bottom: 26px; display: flex; gap: 28px; font-size: 11px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.footline #build-note { color: var(--ink); }

/* world list, settings, guide */
.world-list { display: flex; flex-direction: column; gap: 8px; max-height: 52vh; overflow: auto; }
.world-item, .trade { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; background: rgba(5, 22, 18, 0.45); border: 1px solid var(--line); border-radius: 12px; }
.world-item .info { min-width: 0; }
.world-item .name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.world-item .meta { font-size: 12px; color: var(--muted); }
.world-item .actions { display: flex; gap: 8px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 26px; }
.bindings { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 22px; }
.bind-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 14px; }
.bind-row button { min-width: 96px; }
.bind-row button.listening { background: var(--amber); color: #2a1a0b; border-color: var(--amber); }
.guide { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 26px; font-size: 14px; }
.guide.help-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; max-height: min(62vh, 520px); overflow: auto; padding-right: 4px; }
.card.help-wide { width: min(920px, 100%); }
.help-card { background: rgba(5, 22, 18, 0.55); border: 1px solid var(--line); border-radius: 14px; padding: 16px 18px; display: flex; flex-direction: column; gap: 8px; }
.help-card.accent { border-color: color-mix(in srgb, var(--amber) 55%, var(--line)); background: color-mix(in srgb, var(--amber) 8%, rgba(5, 22, 18, 0.55)); }
.help-card h3 { margin: 0 0 4px; font-size: 15px; font-weight: 700; letter-spacing: 0.02em; color: var(--ink); }
.guide .g-row { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.guide .g-row:last-child { border-bottom: 0; }
.help-feature { display: flex; flex-direction: column; gap: 2px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.help-feature:last-child { border-bottom: 0; }
.help-feature strong { font-size: 13px; color: var(--ink); }
.help-feature span { font-size: 12.5px; color: var(--muted); line-height: 1.35; }
.help-text { margin: 0; font-size: 13px; color: var(--muted); line-height: 1.45; }
.help-faction-list { display: flex; flex-direction: column; gap: 6px; max-height: 180px; overflow: auto; }
.help-faction-row { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; padding: 4px 0; border-bottom: 1px solid var(--line); }
.help-faction-row:last-child { border-bottom: 0; }
.help-faction-row span { color: var(--muted); white-space: nowrap; }
.guide kbd, .keycap { font: 600 11px var(--sans); padding: 3px 8px; border-radius: 6px; background: rgba(244, 237, 221, 0.12); border: 1px solid var(--line); color: var(--ink); white-space: nowrap; }
.bar { height: 8px; background: rgba(244, 237, 221, 0.12); border-radius: 99px; overflow: hidden; }
#loading-bar { height: 100%; width: 0; background: linear-gradient(90deg, #b9824f, var(--amber)); transition: width 0.15s; }

/* ------------------------------------------------------------ pause */
.pause-card { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(240px, 0.9fr); width: min(860px, 100%); overflow: hidden; }
.pause-main { padding: 34px 36px; display: flex; flex-direction: column; gap: 14px; }
.pause-side { padding: 30px 28px; background: rgba(4, 18, 15, 0.55); border-left: 1px solid var(--line); display: flex; flex-direction: column; gap: 16px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips .keycap { font-size: 12px; }
.id-card { display: flex; align-items: center; gap: 14px; }
.id-card img { width: 64px; height: 64px; object-fit: contain; }
.id-card > div { display: flex; flex-direction: column; gap: 2px; }
.id-card b { font-family: var(--serif); font-size: 26px; font-weight: 400; line-height: 1.1; }
.id-card span, .id-card em { font-size: 12.5px; color: var(--muted); font-style: normal; }
.facts { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 8px 14px; font-size: 13px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; text-align: right; font-weight: 600; user-select: text; }

/* ------------------------------------------------------------ rank / status bits */
.badge { object-fit: contain; flex: none; display: block; }
.rank-pill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 6px; border-radius: 99px; font-size: 12px; font-weight: 600; color: var(--rc, var(--ink)); background: color-mix(in srgb, var(--rc, #fff) 14%, transparent); border: 1px solid color-mix(in srgb, var(--rc, #fff) 40%, transparent); white-space: nowrap; }
.tap-row .rank-pill { padding: 3px 11px; }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.status i { width: 8px; height: 8px; border-radius: 50%; background: #66756d; }
.status.on { color: var(--leaf); }
.status.on i { background: var(--leaf); box-shadow: 0 0 8px var(--leaf); }
.tag { display: inline-block; padding: 2px 9px; border-radius: 6px; font-size: 11.5px; font-weight: 600; background: rgba(244, 237, 221, 0.12); white-space: nowrap; }
.tag.bad { background: rgba(255, 90, 90, 0.2); color: #ffc4c4; }

/* ------------------------------------------------------------ TAP + admin shared lists */
.tap { width: min(860px, 100%); max-height: 100%; display: flex; flex-direction: column; padding: 26px 28px; gap: 14px; }
.tap-head { display: flex; align-items: flex-end; gap: 24px; }
.tap-head > div:first-child { flex: 1; }
.tap-counts { display: flex; gap: 18px; font-size: 13px; color: var(--muted); }
.tap-counts b { color: var(--ink); font-size: 20px; font-family: var(--serif); font-weight: 400; margin-right: 3px; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; }
.toolbar input { flex: 1; min-width: 160px; width: auto; }
.toolbar select { width: auto; min-width: 130px; }
.table-wrap { overflow: auto; min-height: 120px; flex: 1; }
.rows { display: flex; flex-direction: column; gap: 6px; }
.row-item { display: flex; align-items: center; gap: 14px; padding: 9px 14px; border: 1px solid var(--line); border-radius: 12px; background: rgba(5, 22, 18, 0.4); }
.row-item.clickable, .clickable { cursor: pointer; }
.row-item.clickable:hover, .mini-row:hover { background: rgba(244, 237, 221, 0.09); border-color: var(--line-hi); }
.who { display: flex; flex-direction: column; line-height: 1.25; flex: 1; min-width: 0; }
.who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seen { display: flex; flex-direction: column; align-items: flex-end; min-width: 92px; }
.tap-row .playtime { min-width: 64px; text-align: right; font-variant-numeric: tabular-nums; color: var(--muted); }
.pager { display: flex; align-items: center; justify-content: center; gap: 16px; font-size: 13px; color: var(--muted); margin-top: 6px; }

/* ------------------------------------------------------------ administration */
.admin { position: relative; display: grid; grid-template-columns: 230px minmax(0, 1fr); width: min(1120px, 100%); height: min(760px, 100%); overflow: hidden; }
.admin-nav { display: flex; flex-direction: column; gap: 4px; padding: 22px 16px; background: rgba(4, 18, 15, 0.6); border-right: 1px solid var(--line); }
.admin-brand { padding: 0 8px 16px; }
.navbtn { text-align: left; padding: 10px 12px; border-radius: 9px; border: 0; background: none; color: var(--muted); font-size: 14px; font-weight: 600; cursor: pointer; }
.navbtn:hover { background: rgba(244, 237, 221, 0.08); color: var(--ink); }
.navbtn.active { background: rgba(232, 173, 115, 0.16); color: var(--amber-hi); }
.admin-me { display: flex; align-items: center; gap: 10px; padding: 10px 8px; font-size: 13px; }
.admin-me > div { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.admin-body { padding: 24px 28px; overflow: auto; position: relative; }
.admin-toast { position: absolute; top: 14px; right: 20px; padding: 9px 16px; border-radius: 10px; background: var(--glass-solid); border: 1px solid var(--leaf); font-size: 13px; opacity: 0; transform: translateY(-6px); transition: 0.2s; pointer-events: none; z-index: 5; }
.admin-toast.show { opacity: 1; transform: none; }
.admin-toast.bad { border-color: var(--danger); color: #ffc4c4; }
.page-title { margin: 0 0 14px; font-family: var(--serif); font-size: 32px; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--ink); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { padding: 16px 18px; border-radius: 14px; border: 1px solid var(--line); background: rgba(5, 22, 18, 0.45); display: flex; flex-direction: column; gap: 2px; }
.stat b { font-family: var(--serif); font-weight: 400; font-size: 36px; line-height: 1; color: var(--amber-hi); }
.stat span { font-size: 12px; color: var(--muted); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.box { padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: rgba(5, 22, 18, 0.4); margin-bottom: 14px; display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.bar-row > span { width: 104px; }
.bar-row .bar { flex: 1; height: 8px; }
.bar-row .bar i { display: block; height: 100%; border-radius: 99px; }
.bar-row b { width: 28px; text-align: right; }
.mini-row { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 8px; font-size: 13px; cursor: pointer; }
.log-row { display: flex; align-items: center; gap: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 13px; }
.log-row .sub.grow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.inline { display: flex; align-items: center; gap: 8px; }
.inline.wrap { flex-wrap: wrap; }
.inline select, .inline input { width: auto; flex: 1; min-width: 110px; }
.matrix { border: 1px solid var(--line); border-radius: 14px; overflow: auto; }
.matrix-row { display: grid; grid-template-columns: minmax(200px, 1.6fr) repeat(6, minmax(58px, 1fr)); align-items: center; padding: 8px 14px; border-bottom: 1px solid var(--line); font-size: 13px; gap: 6px; }
.matrix-row:last-child { border-bottom: 0; }
.matrix-row.head { background: rgba(244, 237, 221, 0.06); }
.matrix-row .cell { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; color: var(--muted); }
.drawer { position: absolute; top: 0; right: 0; bottom: 0; width: min(380px, 100%); padding: 24px; background: var(--glass-solid); border-left: 1px solid var(--line-hi); overflow: auto; display: flex; flex-direction: column; gap: 14px; z-index: 6; box-shadow: -20px 0 50px rgba(0, 0, 0, 0.4); }
.drawer .close { position: absolute; top: 14px; right: 14px; }
.drawer h3 { margin: 0 0 4px; font-family: var(--serif); font-size: 28px; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--ink); }
.profile-head { display: flex; align-items: center; gap: 16px; }
.profile-head > div { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.ban-note { margin: 0; padding: 10px 12px; border-radius: 10px; background: rgba(255, 90, 90, 0.14); border: 1px solid rgba(255, 122, 122, 0.4); font-size: 13px; color: #ffc4c4; }

/* ------------------------------------------------------------ HUD */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; }
#crosshair { position: absolute; left: 50%; top: 50%; width: 20px; height: 20px; transform: translate(-50%, -50%); }
#crosshair::before, #crosshair::after { content: ""; position: absolute; background: rgba(255, 255, 255, 0.9); mix-blend-mode: difference; }
#crosshair::before { left: 9px; top: 2px; width: 2px; height: 16px; }
#crosshair::after { left: 2px; top: 9px; width: 16px; height: 2px; }
#target { position: absolute; left: 50%; top: calc(50% + 28px); transform: translateX(-50%); font-size: 13px; text-shadow: 0 1px 3px #000; opacity: 0.9; white-space: nowrap; }
#debug { position: absolute; left: 10px; top: 120px; font: 12px/1.5 ui-monospace, Menlo, Consolas, monospace; background: rgba(0, 0, 0, 0.5); padding: 8px 10px; border-radius: 6px; white-space: pre; }
#toast { position: absolute; left: 50%; top: 18px; transform: translate(-50%, -20px); opacity: 0; background: var(--glass-solid); border: 1px solid var(--line-hi); padding: 9px 18px; border-radius: 99px; font-size: 14px; transition: opacity 0.2s, transform 0.2s; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#underwater { position: fixed; inset: 0; background: rgba(30, 90, 200, 0.28); pointer-events: none; z-index: 9; }
#dock { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); width: min(620px, 94vw); display: flex; flex-direction: column; align-items: stretch; gap: 10px; }
#vitals { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 26px; align-items: end; }
.vcol { display: flex; flex-direction: column; gap: 5px; }
.vhead { display: flex; justify-content: space-between; font-size: 10.5px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--ink); text-shadow: 0 1px 3px #000; }
.vhead b { font-weight: 600; }
.vthin { grid-column: 1 / 3; display: flex; flex-direction: column; gap: 3px; }
.vthin .vbar { height: 3px; }
.vinfo { grid-column: 1 / 3; display: flex; justify-content: space-between; font-size: 11px; color: var(--ink); text-shadow: 0 1px 3px #000; opacity: 0.85; }
.vbar { position: relative; height: 5px; background: rgba(244, 237, 221, 0.28); border-radius: 99px; overflow: hidden; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4); }
.vbar > div { height: 100%; width: 100%; border-radius: 99px; transition: width 0.12s; }
.vbar.health > div { background: #e8928a; }
.vbar.hunger > div { background: #d6c870; }
.vbar.stamina > div { background: var(--leaf); }
.vbar.air > div { background: #8ec5ff; }
.vbar.boss { height: 12px; }
.vbar.boss > div { background: linear-gradient(90deg, #8a1f4a, #e0306a); }
#hotbar { display: flex; justify-content: center; gap: 6px; }
#hints { display: flex; justify-content: center; flex-wrap: wrap; gap: 14px; font-size: 11.5px; color: var(--ink); text-shadow: 0 1px 3px #000; }
#hints .keycap { margin-right: 6px; background: rgba(8, 30, 26, 0.7); }
#bossbar { position: absolute; left: 50%; top: 56px; transform: translateX(-50%); width: min(420px, 70vw); text-align: center; }
#boss-name { font-weight: 700; text-shadow: 0 1px 3px #000; margin-bottom: 4px; }
#flash { position: fixed; inset: 0; pointer-events: none; opacity: 0; background: #ff2020; z-index: 8; }
#flash.white { background: #fff; }
#chat { --chat-lines: 7; --chat-size: 13px; --chat-bg: 0.6; position: absolute; left: 14px; top: 14px; width: min(480px, 60vw); display: flex; flex-direction: column; gap: 6px; }
#chat-log { height: calc(var(--chat-lines) * (var(--chat-size) * 1.45 + 6px)); overflow-y: auto; overflow-x: hidden; display: flex; flex-direction: column; justify-content: flex-start; pointer-events: none; overscroll-behavior: contain; scrollbar-width: none; }
#chat-log::-webkit-scrollbar { width: 0; height: 0; }
body.chatting #chat-log { pointer-events: auto; scrollbar-width: thin; }
body.chatting #chat-log::-webkit-scrollbar { width: 8px; }
#chat-log div { flex: none; background: rgba(5, 22, 18, var(--chat-bg)); padding: 2px 9px; border-radius: 6px; font-size: var(--chat-size); line-height: 1.45; margin-bottom: 2px; width: fit-content; max-width: 100%; word-break: break-word; transition: opacity 0.6s; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7); }
#chat-log .sys { color: #ffd68a; }
#chat-input { pointer-events: auto; }
body.chatting #chat-log div { opacity: 1 !important; }

/* slots */
.slot { position: relative; width: 52px; height: 52px; background: var(--slot); border: 1.5px solid rgba(244, 237, 221, 0.18); border-radius: 9px; display: flex; align-items: center; justify-content: center; backdrop-filter: blur(4px); }
.slot.selected { border-color: var(--amber); box-shadow: 0 0 0 1px var(--amber), 0 0 16px rgba(232, 173, 115, 0.35); }
.slot img { width: 34px; height: 34px; image-rendering: pixelated; pointer-events: none; }
.slot .count { position: absolute; right: 4px; bottom: 2px; font-size: 13px; font-weight: 700; text-shadow: 0 1px 2px #000, 0 0 3px #000; pointer-events: none; }
.slot .key { position: absolute; left: 5px; top: 2px; font-size: 10px; color: var(--muted); pointer-events: none; }
.slot-grid { display: grid; grid-template-columns: repeat(9, 52px); gap: 5px; }
.slot-grid .slot { cursor: pointer; }
.slot-grid .slot:hover { background: rgba(244, 237, 221, 0.18); }
.slot-grid.one { grid-template-columns: 52px; }
.slot.held { position: fixed; z-index: 40; pointer-events: none; background: transparent; border-color: transparent; transform: translate(-50%, -50%); }
.inventory { display: flex; flex-direction: column; gap: 10px; padding: 24px 28px; max-height: 100%; overflow: auto; }
.hotbar-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.18em; margin-top: 6px; }
.inv-top { display: flex; gap: 18px; align-items: flex-start; }
.armor-col { display: flex; flex-direction: column; gap: 5px; }
.armor-col .slot { cursor: pointer; }
.recipes-wrap { flex: 1; min-width: 0; }
.recipes { max-height: 160px; overflow: auto; display: flex; flex-direction: column; gap: 4px; padding-right: 4px; }
.recipe { display: flex; align-items: center; gap: 10px; text-align: left; padding: 5px 10px; border-radius: 8px; font-size: 12.5px; background: rgba(5, 22, 18, 0.5); color: var(--ink); border: 1px solid var(--line); cursor: pointer; }
.recipe img { width: 24px; height: 24px; image-rendering: pixelated; }
.recipe small { color: var(--muted); display: block; font-size: 10.5px; }
.recipe:hover:not(.locked) { border-color: var(--amber); }
.recipe.locked { opacity: 0.35; cursor: not-allowed; }
.furnace { display: flex; align-items: center; justify-content: center; gap: 18px; padding: 6px 0; }
.fcol { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.flabel { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; }
.flame, .progress { width: 52px; height: 7px; background: rgba(244, 237, 221, 0.14); border-radius: 99px; overflow: hidden; }
.flame > div { height: 100%; width: 0; background: linear-gradient(90deg, #ff9d2e, #ffd45e); }
.progress { width: 70px; }
.progress > div { height: 100%; width: 0; background: var(--amber); }
.trade .t { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.trade img { width: 26px; height: 26px; image-rendering: pixelated; }

/* ------------------------------------------------------------ small screens */
@media (max-width: 900px) {
  .auth-shell.with-preview { grid-template-columns: minmax(0, 480px); }
  .preview-card { order: -1; }
  .preview-card canvas { max-width: 220px; }
  .pause-card { grid-template-columns: 1fr; }
  .pause-side { border-left: 0; border-top: 1px solid var(--line); }
  .admin { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .admin-nav { flex-direction: row; flex-wrap: wrap; align-items: center; border-right: 0; border-bottom: 1px solid var(--line); padding: 10px; }
  .admin-brand, .admin-me { display: none; }
  .two-col, .settings-grid, .bindings, .guide, .two { grid-template-columns: 1fr; }
  .matrix-row { grid-template-columns: minmax(140px, 1.4fr) repeat(6, 54px); }
}
@media (max-width: 680px) {
  .slot, .slot-grid .slot { width: 36px; height: 36px; }
  .slot img { width: 26px; height: 26px; }
  .slot-grid { grid-template-columns: repeat(9, 36px); gap: 4px; }
  .screen.scenic { background: rgba(8, 30, 26, 0.82); }
  .main-left { padding: 0 24px; }
  .footline { left: 24px; }
}

/* ---- staff / moderation chat lines ---- */
#chat-log .k-report { background: rgba(60, 8, 8, 0.82); color: #ff0000; border-left: 3px solid #ff0000; font-weight: 600; }
#chat-log .k-cmd { background: rgba(40, 6, 6, 0.78); color: #ff0000; border-left: 3px solid #ff0000; font-weight: 600; }
#chat-log .k-warn { background: rgba(90, 60, 8, 0.82); color: #ffd36a; border-left: 3px solid #ffb300; font-weight: 600; }
#chat-log .k-jail { color: #c9ced6; border-left: 3px solid #8b929c; }
#chat-log .k-announce { background: rgba(10, 50, 80, 0.8); color: #9fd8ff; border-left: 3px solid #4aa8ee; font-weight: 600; }
#chat-log .k-staff { color: #ff0000; border-left: 3px solid #ff0000; font-weight: 600; }

/* ---- report form ---- */
textarea { appearance: none; background: rgba(5, 22, 18, 0.55); border: 1px solid var(--line); color: var(--ink); padding: 11px 13px; border-radius: 9px; font: inherit; font-size: 14.5px; user-select: text; width: 100%; resize: vertical; min-height: 96px; max-height: 220px; }
textarea:focus { border-color: var(--amber); outline: none; }
.navcount { display: inline-block; min-width: 18px; padding: 1px 6px; margin-left: 6px; border-radius: 99px; background: #ff7a7a; color: #2a0b0b; font-size: 11px; font-weight: 700; text-align: center; }
.tag.warn { background: rgba(255, 179, 0, 0.18); color: #ffd36a; }
.tag.jail { background: rgba(139, 146, 156, 0.22); color: #d3d8df; }
.mod-note { margin: 0; padding: 9px 12px; border-radius: 10px; font-size: 13px; background: rgba(139, 146, 156, 0.16); border: 1px solid rgba(170, 176, 186, 0.35); color: #d3d8df; }
.mod-note.warn { background: rgba(255, 179, 0, 0.12); border-color: rgba(255, 179, 0, 0.35); color: #ffd36a; }

/* ------------------------------------------------------------ custom dropdown (see src/ui/select.js) */
.dd { position: relative; display: block; width: 100%; min-width: 0; }
.toolbar .dd, .inline .dd { width: auto; min-width: 130px; flex: 1; }
.dd-native { position: absolute; left: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; padding: 0; border: 0; }
.dd-btn {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; text-align: left; cursor: pointer;
  background: rgba(5, 22, 18, 0.55); border: 1px solid var(--line); color: var(--ink); padding: 11px 13px; border-radius: 9px; font: inherit; font-size: 14.5px;
  transition: border-color 0.15s, background 0.15s;
}
.dd-btn:hover { border-color: var(--line-hi); background: rgba(10, 34, 28, 0.7); }
.dd-btn.open, .dd-btn:focus-visible { border-color: var(--amber); }
.dd-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-caret { flex: none; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translateY(-2px); transition: transform 0.18s; }
.dd-btn.open .dd-caret { transform: rotate(-135deg) translateY(-1px); }
.dd-menu {
  position: fixed; z-index: 1000; overflow-y: auto; padding: 5px; border-radius: 12px;
  background: rgba(10, 30, 26, 0.97); border: 1px solid var(--line-hi); backdrop-filter: blur(14px);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(0, 0, 0, 0.25); animation: dd-in 0.12s ease-out;
}
.dd-item { display: flex; align-items: center; gap: 8px; padding: 9px 11px; border-radius: 8px; font-size: 14px; color: var(--ink); cursor: pointer; white-space: nowrap; }
.dd-item.active { background: rgba(232, 173, 115, 0.16); }
.dd-item.selected { color: var(--amber-hi); font-weight: 600; }
.dd-item.selected::after { content: ""; margin-left: auto; width: 5px; height: 9px; border-right: 2px solid var(--amber); border-bottom: 2px solid var(--amber); transform: rotate(45deg); }
.dd-item.disabled { opacity: 0.4; cursor: not-allowed; }
@keyframes dd-in { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

/* ------------------------------------------------------------ factions (F3) */
.faction { position: relative; width: min(1080px, 100%); max-height: 100%; display: flex; flex-direction: column; padding: 22px 26px 18px; gap: 14px; overflow: hidden; }
.fac-empty { text-align: center; padding: 40px 20px; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.fac-toast { position: absolute; top: 12px; right: 18px; padding: 8px 15px; border-radius: 10px; background: var(--glass-solid); border: 1px solid var(--leaf); font-size: 13px; opacity: 0; transform: translateY(-6px); transition: 0.2s; pointer-events: none; z-index: 5; }
.fac-toast.show { opacity: 1; transform: none; }
.fac-toast.bad { border-color: var(--danger); color: #ffc4c4; }
.fac-head { display: flex; gap: 20px; align-items: flex-start; }
.fac-logo { --fc: #fff; flex: none; width: 92px; height: 92px; border-radius: 14px; display: grid; place-items: center; overflow: hidden; font: 700 40px var(--serif); color: #fff; background: color-mix(in srgb, var(--fc) 35%, #0a1f1b); border: 2px solid var(--fc); }
.fac-logo { position: relative; }
.fac-logo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; background: #0a1f1b; }
.fac-logo.big { width: 140px; height: 140px; font-size: 56px; }
.fac-title { flex: 1; min-width: 0; }
.fac-title h2 { margin: 0 0 8px; font-size: 28px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fac-facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 28px; font-size: 13.5px; }
.fac-fact .k { color: var(--muted); margin-right: 8px; }
.fac-fact .v.on { color: var(--leaf); font-weight: 600; }
.fac-side { display: flex; flex-direction: column; gap: 8px; align-items: flex-end; min-width: 170px; }
.fac-side .dd { min-width: 170px; }
.fac-main { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 18px; min-height: 0; flex: 1; }
.fac-nav { display: flex; flex-direction: column; gap: 4px; }
.fac-body { min-height: 260px; max-height: 52vh; overflow: auto; padding-right: 4px; display: flex; flex-direction: column; gap: 10px; }
.fac-bar { display: flex; gap: 16px; align-items: center; }
.fac-search { flex: 1; background: transparent !important; border: 0 !important; border-bottom: 1px solid var(--line-hi) !important; border-radius: 0 !important; padding-left: 2px !important; }
.fac-legend { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--muted); }
.fac-legend i { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-left: 8px; }
.fac-legend i.on { background: var(--leaf); } .fac-legend i.off { background: var(--danger); }
.fac-table { display: flex; flex-direction: column; }
.fac-tr { display: grid; grid-template-columns: 2.2fr 1.5fr 1.2fr 1fr; gap: 10px; padding: 8px 10px; border-bottom: 1px solid var(--line); font-size: 13.5px; cursor: pointer; align-items: center; }
.fac-tr span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fac-tr:not(.fac-th):hover { background: rgba(244, 237, 221, 0.06); }
.fac-tr.sel { background: rgba(232, 173, 115, 0.16); box-shadow: inset 3px 0 0 var(--amber); }
.fac-th { cursor: default; color: var(--muted); font-weight: 600; position: sticky; top: 0; background: var(--glass-solid); border-bottom: 1px solid var(--line-hi); }
.fac-tr .nm.on, .fac-tr .on { color: var(--leaf); }
.fac-tr .lead { color: var(--amber-hi); font-weight: 600; }
.fac-foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding-top: 4px; border-top: 1px solid var(--line); }
.fac-add { display: flex; gap: 8px; align-items: center; }
.fac-id { width: 110px !important; }
.ghost.danger { border-color: rgba(255, 122, 122, 0.5); color: #ffc4c4; }
.ghost.danger:hover:not(:disabled) { background: rgba(255, 90, 90, 0.18); }
.fac-rank { display: flex; gap: 8px; align-items: center; }
.fac-rank .n { width: 22px; color: var(--muted); text-align: right; }
.fac-rank input { flex: 1; }
.fac-settings { display: grid; grid-template-columns: minmax(0, 1fr) 160px; gap: 24px; align-items: start; }
.fac-body textarea { min-height: 200px; }
@media (max-width: 760px) { .fac-main { grid-template-columns: 1fr; } .fac-nav { flex-direction: row; } .fac-head { flex-wrap: wrap; } .fac-settings { grid-template-columns: 1fr; } }
label.check { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 12px; grid-column: 1 / -1; }
label.check small { grid-column: 1 / -1; }
