:root { color-scheme: dark; --bg: #0a0f1a; --side: #0d1422; --card: #111a2a; --line: #1f2b40; --fg: #dbe4f3; --dim: #8796ad; --teal: #2dd4bf; --go: #1f8a6e; --red: #e5484d; --amber: #f5a524; --purple: #a78bfa; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--fg); font: 15px/1.45 system-ui, 'Segoe UI', sans-serif; }
body { display: grid; grid-template-columns: 240px 1fr; }
[hidden] { display: none !important; }
.dim { color: var(--dim); }

/* ---------- sidebar ---------- */
#side { background: var(--side); border-right: 1px solid var(--line); padding: 16px 10px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.brand { font-size: 18px; padding: 4px 10px 18px; border-bottom: 1px solid var(--line); margin-bottom: 8px; }
.brand span { color: var(--teal); }
.brand em { font: 700 10px/1 system-ui; font-style: normal; color: var(--teal); border: 1px solid var(--teal); border-radius: 4px; padding: 3px 5px; margin-left: 6px; vertical-align: 3px; }
#side h6 { margin: 18px 10px 6px; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--dim); font-weight: 600; }
#side a { display: flex; gap: 10px; align-items: center; padding: 9px 12px; border-radius: 8px; color: var(--fg); text-decoration: none; margin: 2px 0; }
#side a:hover { background: #16213a; }
#side a.on { background: #12343a; color: var(--teal); box-shadow: inset 3px 0 0 var(--teal); }
#side a.off { color: #56637a; cursor: default; }
#side a.off:hover { background: none; }
/* glass toggle footer (plain layout: renders with glass on and off) */
.side-foot { margin-top: 18px; padding: 12px 12px 4px; border-top: 1px solid var(--line); }
.side-foot label { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--dim); cursor: pointer; }
.side-foot input { accent-color: var(--teal); }
.side-foot #btnLogout { margin-top: 10px; width: 100%; }

/* login veil: full-screen gate until the operator token is accepted */
#loginVeil { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; background: rgba(8, 12, 20, 0.92); padding: 16px; }
#loginVeil[hidden] { display: none; }
#loginVeil .card { width: min(380px, 100%); }
#loginVeil h4 { margin: 0 0 4px; }

/* ---------- content ---------- */
main { min-width: 0; padding: 0 28px 40px; }
.top { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 22px 0 18px; border-bottom: 1px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.top h1 { margin: 0; font-size: 22px; }
.top p { margin: 2px 0 0; color: var(--dim); font-size: 13px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn { font: 600 13px system-ui; color: var(--fg); background: #18233a; border: 1px solid #2a3a58; border-radius: 6px; padding: 8px 14px; cursor: pointer; }
.btn:hover:not(:disabled) { border-color: #4a618c; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.go { background: #12463b; border-color: var(--go); color: #7ee8c9; }
.btn.stop { background: #4a1c22; border-color: var(--red); color: #ffb3b5; }
.btn.teal { background: var(--teal); border-color: var(--teal); color: #062a26; }
.btn.ok { background: #143b2a; border-color: #2f9e62; color: #8ff0bb; }
.btn.sm { padding: 4px 9px; font-size: 12px; }
.msg { min-height: 20px; margin: 2px 0 12px; color: var(--teal); }
.msg.error { color: #ff9a9d; }
.invisible { visibility: hidden; }
/* visible keyboard focus on every interactive element */
#side a:focus-visible, .chlink:focus-visible, .sktab:focus-visible, .idbtn:focus-visible,
.qp-opt:focus-visible, .qp-chip button:focus-visible, .ann-slot .x:focus-visible,
#annPreview:focus-visible, .chcell:focus-visible, .tp-table a:focus-visible, .grid a:focus-visible {
  outline: 2px solid #2f6f8f; outline-offset: 2px; border-radius: 4px;
}
pre[tabindex]:focus-visible { outline: 2px solid #2f6f8f; outline-offset: -2px; }
/* labeled-field + compact filter-search patterns shared by every view */
.fld { display: grid; gap: 6px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); min-width: 0; }
.fld > input, .fld > select, .fld > textarea { width: 100%; box-sizing: border-box; font-size: 14px; text-transform: none; letter-spacing: 0; }
.fld.grow { flex: 2 1 220px; }
.fsearch { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
.fsearch input { font-size: 14px; text-transform: none; letter-spacing: 0; min-width: 0; }
.stat-row { display: flex; align-items: baseline; gap: 14px; }
.stat .stat-row b { display: inline-block; }
.engine { font-size: 13px; font-weight: 700; letter-spacing: .04em; padding: 2px 8px; border-radius: 6px; border: 1px solid currentColor; }

.cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 16px; }
.cards.two { grid-template-columns: 1fr 1fr; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; margin-bottom: 16px; position: relative; overflow-x: auto; }
.cards .card { margin-bottom: 0; }
.card h5 { margin: 0 0 10px; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); font-weight: 600; }
.stat b { display: block; font-size: 30px; line-height: 1.1; color: var(--teal); }
.stat small { color: var(--dim); font-size: 12px; }
.stat i { position: absolute; right: 18px; top: 16px; font-style: normal; opacity: .55; font-size: 20px; }
.chead { display: flex; justify-content: space-between; align-items: baseline; }
.chart canvas { width: 100%; height: 190px; display: block; }
.legend { display: flex; gap: 18px; font-size: 12px; color: var(--dim); margin-top: 6px; }
.legend span::before { content: ''; display: inline-block; width: 14px; height: 3px; border-radius: 2px; margin-right: 6px; vertical-align: 3px; }
.legend .l1::before { background: var(--teal); } .legend .l2::before { background: var(--purple); }
.svc { border-top: 3px solid #33405a; }
#svcGame { border-top-color: #22c55e; } #svcDb { border-top-color: #38bdf8; }
.shead { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.shead h4 { margin: 0; font-size: 16px; }
.shead .port { margin-left: auto; color: var(--dim); font-size: 12px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--red); flex: none; }
.dot.up { background: #22c55e; } .dot.wait { background: var(--amber); }
dl { display: grid; grid-template-columns: repeat(4, auto); gap: 4px 16px; margin: 0; }
.svc dl, dl.ltnow { grid-template-columns: auto 1fr auto 1fr; }
dt { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
dd { margin: 0 0 8px; font-weight: 600; }
.logs pre { margin: 6px 0 0; height: 260px; overflow: auto; background: #070b14; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font: 12.5px/1.5 ui-monospace, Consolas, monospace; color: #b8c6dc; white-space: pre-wrap; word-break: break-word; }
.logs pre .build { color: #f5c87a; } .logs pre .panel { color: var(--teal); } .logs pre .client { color: #9fc2ff; } .logs pre .cf { color: #fb923c; }

/* ---------- Server management: one row per server ---------- */
.servers p { margin: 0 0 6px; font-size: 13px; }
.srv { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); }
.srv-info { flex: 1; min-width: 0; }
.srv-info b { display: block; font-size: 14px; }
.srv-info small { color: var(--dim); font-size: 12px; }
.srv-info code { font-size: 11.5px; color: #b8c6dc; }
.srv-status { font-size: 12.5px; white-space: nowrap; }
.srv-btns { display: flex; gap: 6px; flex-wrap: wrap; }
a.btn { text-decoration: none; display: inline-block; }
a.btn.off { opacity: .45; pointer-events: none; }
@media (max-width: 900px) { .srv { flex-wrap: wrap; } .srv-btns { width: 100%; } }

table.grid { width: 100%; border-collapse: collapse; font-size: 14px; }
.grid th { text-align: left; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); font-weight: 600; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.grid td { padding: 9px 10px; border-bottom: 1px solid #172236; vertical-align: middle; }
.grid td.empty { text-align: center; color: var(--dim); padding: 22px; }
.grid td.break { overflow-wrap: anywhere; word-break: break-all; }
.grid .tags span { display: inline-block; background: #18233a; border: 1px solid #2a3a58; border-radius: 4px; padding: 1px 7px; margin: 1px 4px 1px 0; font-size: 12px; }
.badge { font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 10px; }
.badge.on { background: #12463b; color: #7ee8c9; } .badge.ban { background: #4a1c22; color: #ffb3b5; } .badge.adm { background: #2e2350; color: #cbb8ff; } .badge.orig { background: #1d2f4d; color: #9fc2ff; }
.grid .acts { display: flex; gap: 5px; flex-wrap: wrap; }

.searchbar { display: grid; grid-template-columns: 1fr 1fr auto auto; gap: 10px; margin-bottom: 16px; align-items: end; }
.searchbar .btn { align-self: end; }
input, select, textarea { font: 14px system-ui; color: var(--fg); background: #0d1526; border: 1px solid #263553; border-radius: 6px; padding: 9px 12px; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid #2f6f8f; outline-offset: 0; }
.create .row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin: 12px 0; }
.create .row > .fld { flex: 1 1 150px; }
.create .row > .btn, .create .row > .ann-check { flex: 0 0 auto; }
.create .row.end { justify-content: flex-end; }
.create .row > .ann-check { padding-bottom: 10px; }
.rates .row { display: grid; grid-template-columns: repeat(3, minmax(0, 160px)) auto; gap: 14px; align-items: end; justify-content: start; margin: 12px 0; }
.rates label { display: grid; gap: 6px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
.rates .small { font-size: 12px; margin: 0; }
.announce .row { display: grid; grid-template-columns: 1fr auto auto; gap: 14px; align-items: end; margin: 12px 0; }
.announce label { display: grid; gap: 6px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
.announce .small { font-size: 12px; margin: 6px 0 0; }
.ann-loop { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 12px 0 4px; }
.ann-loop select { width: auto; }
.ann-check { display: flex !important; flex-direction: row !important; align-items: center; gap: 8px; text-transform: none !important; letter-spacing: 0 !important; font-size: 13px !important; color: var(--text, #dfe7f1) !important; }
.ann-slots-title { margin: 16px 0 8px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); font-weight: 600; }
.ann-slots-title .small { text-transform: none; letter-spacing: 0; }
.ann-slots { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.ann-slot { position: relative; min-height: 58px; padding: 10px 28px 10px 12px; border: 1px dashed rgb(120 150 190 / .35); border-radius: 8px; background: rgb(255 255 255 / .02); color: var(--dim); font-size: 13px; text-align: left; cursor: pointer; overflow-wrap: anywhere; }
.ann-slot.full { border-style: solid; border-color: rgb(45 212 191 / .35); color: #e8eef6; }
.ann-slot.over { border-color: #2dd4bf; background: rgb(45 212 191 / .12); }
.ann-slot b { display: block; font-size: 10px; letter-spacing: .08em; color: var(--dim); margin-bottom: 4px; }
.ann-slot { padding-right: 12px; }
.ann-use { display: block; width: 100%; border: 0; background: none; color: inherit; font: inherit; text-align: left; cursor: pointer; padding: 0 20px 0 0; overflow-wrap: anywhere; border-radius: 6px; }
.ann-use:focus-visible { outline: 2px solid #2f6f8f; outline-offset: 2px; }
.ann-slot .x:focus-visible { outline: 2px solid #2f6f8f; outline-offset: 1px; border-radius: 4px; }
.ann-slot .x { position: absolute; top: 4px; right: 6px; border: 0; background: none; color: var(--dim); font-size: 16px; cursor: pointer; }
.ann-slot .x:hover { color: #f87171; }
#annPreview[draggable="true"] { cursor: grab; }
#annPreview:focus-visible { outline: 2px solid #2f6f8f; outline-offset: 4px; border-radius: 4px; }
/* preview: the same marquee as the game (client/style.css .announce) */
.ann-preview { position: relative; overflow: hidden; height: 46px; border-radius: 8px; background: linear-gradient(90deg, transparent, rgb(8 20 40 / .85) 18%, rgb(8 20 40 / .85) 82%, transparent); border-block: 1px solid rgb(255 214 120 / .35);
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 15%, #000 85%, transparent); mask-image: linear-gradient(90deg, transparent, #000 15%, #000 85%, transparent); }
.ann-preview span { position: absolute; top: 50%; left: 0; white-space: nowrap; font: 700 20px/1 Georgia, 'Times New Roman', serif; letter-spacing: .04em; color: #ffe7a8; text-shadow: 0 0 10px rgb(255 190 80 / .6), 0 2px 2px #000; animation: annPrev 9s linear infinite; }
@keyframes annPrev { from { transform: translate(100vw, -50%); } to { transform: translate(-100%, -50%); } }#unbanForm .fld { margin-bottom: 10px; }
#unbanForm input { width: 100%; }
.pager { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 14px; color: var(--dim); font-size: 13px; }
.pager.end { justify-content: flex-end; }

dialog { background: var(--card); color: var(--fg); border: 1px solid #2a3a58; border-radius: 10px; padding: 20px 22px; min-width: 320px; }
dialog::backdrop { background: rgb(0 0 0 / .55); }
dialog h4 { margin: 0 0 14px; }
tr.accrow { cursor: pointer; }
tr.accrow:hover, tr.accrow:focus-visible { background: rgb(255 255 255 / .04); }
.dactions.accacts { border-top: 1px solid var(--line); padding-top: 14px; flex-wrap: wrap; }
dialog label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--dim); }
dialog input { width: 100%; }
.dactions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

@media (max-width: 1100px) { .cards { grid-template-columns: 1fr 1fr; } }
@media (max-width: 760px) {
  body { grid-template-columns: 1fr; }
  #side { position: static; height: auto; }
  main { padding: 0 16px 32px; }
  .cards, .cards.two, .searchbar, .rates .row { grid-template-columns: 1fr; }
  dl { grid-template-columns: auto auto; }
}

/* ---------- Database: connection | install | backup + reset, and the list below ---------- */
.dbcols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; align-items: start; margin-bottom: 16px; }
.dbcols > .card, .dbcols .col > .card { margin-bottom: 0; }
.dbcols .col { display: flex; flex-direction: column; gap: 16px; }
#view-database .card p { margin: 0 0 10px; }
#view-database .fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; margin: 4px 0 12px; }
#view-database .fields label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--dim); min-width: 0; }
#view-database .fields label.wide { grid-column: 1 / -1; }
#view-database .fields input, #view-database .card > input, #view-database .card > .fld input { width: 100%; box-sizing: border-box; }
#view-database .card > input, #view-database .card > .fld { margin-bottom: 10px; }
#view-database .row { display: flex; gap: 10px; flex-wrap: wrap; }
#view-database code { font-size: 12.5px; color: #b8c6dc; }
.card.danger { border-color: #5a2026; }
.card.danger h5 { color: #ff9a9d; }
.card.conn.attention, .card.install.attention { border-color: var(--amber); box-shadow: 0 0 0 1px var(--amber) inset; }
#insLog { margin: 10px 0 0; background: #070b14; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; font: 12.5px/1.5 ui-monospace, Consolas, monospace; color: #b8c6dc; white-space: pre-wrap; }
#dbStatusCard .shead h4 { margin: 0; font-size: 15px; }
#dbInUse.bad { color: #ff9a9d; }
#dlgRestore p, #dlgConfirm p { max-width: 420px; overflow-wrap: anywhere; }
#dlgRestore input { width: 100%; box-sizing: border-box; }
.dbname { font: 13px ui-monospace, Consolas, monospace; word-break: break-all; }
.dbacts { display: flex; gap: 6px; flex-wrap: wrap; }
@media (max-width: 1300px) { .dbcols { grid-template-columns: 1fr 1fr; } .dbcols .col { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; } }
@media (max-width: 800px) { .dbcols, .dbcols .col { grid-template-columns: 1fr; } }
#view-database .small { font-size: 12px; }

/* ---------- Items ---------- */
.itfilters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 16px; }
.itfilters select { flex: 1 1 140px; min-width: 0; box-sizing: border-box; }
table.grid.items td { vertical-align: middle; }
table.grid.items td.ic { width: 40px; }
table.grid.items img.ic { width: 32px; height: 32px; display: block; image-rendering: pixelated; }
.idbtn { font: 600 13px ui-monospace, Consolas, monospace; color: var(--teal); background: #0e2a2f; border: 1px solid #1f5a5a; border-radius: 5px; padding: 3px 8px; cursor: pointer; }
.idbtn:hover { border-color: var(--teal); }
.idbtn.ok { color: #062a26; background: var(--teal); }
.itname b { display: block; } .itname small { color: var(--dim); font: 12px ui-monospace, Consolas, monospace; }
.itname small.itdesc { display: block; font-family: inherit; font-size: 12.5px; margin-top: 2px; }
table.grid.items th.num, table.grid.items td.num { text-align: right; }
table.grid.items td:last-child { text-align: right; white-space: nowrap; }
.itkind { color: var(--dim); font-size: 12.5px; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 10px; margin-left: 6px; vertical-align: 1px; }
.badge.edited { background: #3d3214; color: #f5c87a; } .badge.new { background: #12343a; color: var(--teal); } .badge.removed { background: #4a1c22; color: #ffb3b5; }
tr.removed td { opacity: .55; }
.itdlg { width: min(1100px, calc(100vw - 32px)); max-height: calc(100vh - 40px); }
.itdlg .ithead { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.itdlg .ithead img { width: 48px; height: 48px; image-rendering: pixelated; background: #070b14; border: 1px solid var(--line); border-radius: 6px; }
.itdlg .ithead h4 { margin: 0; }
.itgrid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.itgrid fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; margin: 0; }
.itgrid legend { color: var(--dim); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; padding: 0 4px; }
.itgrid label { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; color: var(--dim); min-width: 0; }
.itgrid label.wide { grid-column: 1 / -1; }
.itgrid input, .itgrid select, .itgrid textarea { width: 100%; box-sizing: border-box; }
.itgrid .changed { outline: 2px solid #f5a524; outline-offset: -1px; }
.itgrid fieldset.fx { grid-column: 1 / -1; grid-template-columns: 1fr; }
#ie_fx { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 12px; }
#ie_fx .fxrow { display: grid; grid-template-columns: 1fr 90px; gap: 6px; }
.dactions .grow { flex: 1; }
#dlgNewItem label { display: flex; flex-direction: column; gap: 4px; margin: 8px 0; font-size: 13px; color: var(--dim); }
#dlgNewItem input { width: 100%; box-sizing: border-box; min-width: 360px; }
@media (max-width: 900px) { .itgrid { grid-template-columns: 1fr; } #ie_fx { grid-template-columns: 1fr; } }

/* ---------- Load test ---------- */
.ltpresets { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.ltfields { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px 14px; margin-bottom: 10px; }
.ltfields label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--dim); min-width: 0; }
.ltfields small.hint { font-size: 11.5px; letter-spacing: 0; text-transform: none; color: var(--dim); }
.ltform .small { font-size: 12.5px; margin: 0; }
.ltform code { font-size: 12px; color: #b8c6dc; }
.stat b.bad { color: #ff9a9d; } .stat b.warn { color: var(--amber); }
.ltverdict { border-left: 4px solid var(--teal); }
.ltverdict.bad { border-left-color: var(--red); }
.ltverdict h4 { margin: 0 0 6px; font-size: 16px; }
.ltverdict p { margin: 4px 0 0; color: var(--dim); font-size: 13.5px; }
dl.ltnow { grid-template-columns: repeat(4, auto); }
#ltLog { height: 180px; }
.legend .la::before { background: var(--amber); } .legend .lb::before { background: #38bdf8; } .legend .lr::before { background: var(--red); }
.ltok { color: #7ee8c9; } .ltbad { color: #ff9a9d; }
@media (max-width: 1100px) { .ltfields { grid-template-columns: 1fr 1fr; } }
@media (max-width: 760px) { dl.ltnow { grid-template-columns: auto auto; } }

/* ---------- skills ---------- */
.skmode h5 { margin: 0 0 10px; }
.skopt { display: grid; grid-template-columns: auto auto 1fr; gap: 10px; align-items: center; padding: 8px 0; cursor: pointer; }
.skhint { margin: 8px 0 0; font-size: 13px; }
.sktabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 16px 0; }
.sktab { font: 600 13px system-ui; color: var(--fg); background: #18233a; border: 1px solid #2a3a58; border-radius: 6px; padding: 7px 12px; cursor: pointer; }
.sktab small { color: var(--dim); margin-left: 4px; }
.sktab.on { background: #12343a; border-color: var(--teal); color: var(--teal); }
.skgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.skcell { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; padding: 12px 8px; background: #0d1422; border: 1px solid var(--line); border-radius: 8px; font-size: 12px; }
.skcell:hover { border-color: var(--teal); }
.skcell:focus-visible { border-color: var(--teal); outline: 2px solid #2f6f8f; outline-offset: 2px; }
.skcell img { image-rendering: pixelated; }
.skname { font-weight: 600; font-size: 13px; }
.sktip { position: fixed; z-index: 50; width: 440px; max-width: calc(100vw - 16px); pointer-events: none; background: #0b1220; border: 1px solid #3a4f78; border-radius: 8px; padding: 12px 14px; box-shadow: 0 8px 28px #000a; font-size: 13px; }
.sktip p { margin: 8px 0; }
.skth { display: flex; gap: 10px; align-items: center; }
.skth img { image-rendering: pixelated; }
.sktip table { width: 100%; border-collapse: collapse; font-size: 12px; }
.sktip th, .sktip td { padding: 2px 6px; text-align: left; border-bottom: 1px solid var(--line); }
.sktip th { color: var(--dim); font-weight: 600; }

.tp-bar { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin: 8px 0; }
.tp-bar input { flex: 1; max-width: 360px; }
.tp-bar .fsearch { flex: 1 1 220px; max-width: 380px; }
.tp-bar .fsearch input { flex: 1; max-width: none; }
.tp-wrap { max-height: 420px; overflow: auto; border: 1px solid var(--line, #243044); border-radius: 8px; }
.tp-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.tp-table th { position: sticky; top: 0; background: var(--panel, #0f1826); text-align: left; padding: 6px 8px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
.tp-table td { padding: 4px 8px; border-top: 1px solid var(--line, #243044); overflow-wrap: anywhere; }
.tp-table td:last-child { white-space: nowrap; }
.tp-table td:last-child .btn { margin-right: 4px; }
.tp-table td:last-child .btn:last-child { margin-right: 0; }
.tp-num { width: 90px; }
.tp-table .btn { padding: 3px 10px; margin-right: 4px; }
.tp-add { display: grid; grid-template-columns: minmax(190px, 1.5fr) minmax(130px, 1fr) minmax(110px, .7fr) repeat(3, minmax(64px, .45fr)) minmax(150px, 1.3fr) auto; align-items: end; gap: 8px 10px; margin: 10px 0; padding: 10px; border: 1px dashed var(--line, #243044); border-radius: 8px; }
.tp-add strong { grid-column: 1 / -1; }
.tp-add input, .tp-add select { min-width: 0; }
@media (max-width: 1100px) { .tp-add { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 760px) { .tp-add { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.itfilters .fsearch { flex: 2 1 260px; min-width: 0; }
.itfilters .fsearch input { flex: 1; }
.searchbar.ch .fsearch { max-width: 560px; }
.searchbar.ch .fsearch input { flex: 1; }

.qf { display: flex; flex-wrap: wrap; gap: 12px; margin: 8px 0; align-items: flex-end; }
.qf label, .qwide { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--dim); }
.qf label input, .qf label select { min-width: 160px; }
.qf label input[type="checkbox"] { min-width: 0; }
.qwide { margin: 8px 0; } .qwide textarea { width: 100%; }
.q-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; align-items: center; }
.q-item { min-width: 260px; }
/* ---------- Quests: new/edit modal (exits only via ✕ or Cancel) ---------- */
.qdlg { width: min(920px, calc(100vw - 32px)); max-height: calc(100vh - 40px); padding: 0; overflow: hidden; }
.qdlg form { display: flex; flex-direction: column; max-height: calc(100vh - 40px); }
.qdlg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.qdlg-head h5 { margin: 0; font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); font-weight: 600; }
.qdlg-body { padding: 8px 18px 14px; overflow-y: auto; }
.qdlg-foot { display: flex; align-items: center; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--line); }
.qdlg-foot .grow { flex: 1; }
#qDirty { margin-left: 0; }
/* ---------- Quest modal: numbered sections ---------- */
.qdlg-body #qErr { margin: 8px 0 0; min-height: 0; }
.qsec { border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; margin: 12px 0; background: rgb(255 255 255 / .015); }
.qsec h6, .qsec summary { margin: 0 0 8px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); font-weight: 600; display: flex; align-items: center; gap: 8px; }
.qsec summary { cursor: pointer; margin: 0; list-style: none; }
.qsec summary::-webkit-details-marker { display: none; }
.qsec summary::before { content: '▸'; color: var(--teal); font-size: 13px; }
details.qsec[open] > summary::before { content: '▾'; }
.qsec .qf { margin: 4px 0; }
.qn { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: #12343a; color: var(--teal); font-size: 11px; font-weight: 700; flex: none; }
.qgroup { margin: 6px 0 10px; }
.qgroup-head { display: flex; align-items: baseline; gap: 8px; margin: 4px 0; }
.qgroup-head b { font-size: 13.5px; }
/* ---------- Quest modal: labeled row fields ---------- */
.q-row { background: #0d1526; border: 1px solid #1b2740; border-radius: 8px; padding: 8px 10px; }
.qfld { display: flex; flex-direction: column; gap: 3px; font-size: 11px; letter-spacing: .05em; text-transform: uppercase; color: var(--dim); }
.qfld input, .qfld select { font-size: 14px; text-transform: none; letter-spacing: 0; }
.qfld .qp { flex: none; width: 100%; }
#qReqWrap .qp { flex: none; width: 100%; min-width: 220px; }
.q-row > .btn { align-self: flex-end; }
.q-row .qfld:first-child { flex: 1 1 240px; }
/* ---------- Quest modal: searchable item/monster picker ---------- */
.qp { position: relative; display: inline-flex; align-items: center; flex-wrap: wrap; gap: 6px; min-width: 260px; flex: 1 1 260px; text-transform: none; }
.qp-sub { flex-basis: 100%; font-size: 11.5px; min-height: 0; }
.qp-ic { width: 30px; height: 30px; image-rendering: pixelated; background: #070b14; border: 1px solid var(--line); border-radius: 6px; flex: none; }
.qp-ic[hidden] { display: none; }
.qp-text { flex: 1; min-width: 140px; }
.qp-list { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; right: 0; min-width: 300px; max-height: 240px; overflow-y: auto; background: #0b1220; border: 1px solid #3a4f78; border-radius: 8px; box-shadow: 0 8px 28px #000a; padding: 4px; }
.qp-list[hidden] { display: none; }
.qp-opt { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 8px; border: 0; border-radius: 6px; background: none; color: var(--fg); font: 13.5px system-ui; text-align: left; cursor: pointer; }
.qp-opt img { width: 28px; height: 28px; image-rendering: pixelated; background: #070b14; border: 1px solid var(--line); border-radius: 5px; flex: none; }
.qp-opt small { display: block; color: var(--dim); font-size: 11.5px; }
.qp-opt.on, .qp-opt:hover { background: #12343a; }
.qp-note { padding: 8px 10px; color: var(--dim); font-size: 13px; }
.qp-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.qp-chip { display: inline-flex; align-items: center; gap: 6px; background: #12343a; border: 1px solid var(--teal); color: #b8f4e8; border-radius: 12px; padding: 2px 4px 2px 10px; font-size: 12.5px; }
.qp-chip button { border: 0; background: none; color: var(--dim); font-size: 13px; cursor: pointer; padding: 0 4px; }
.qp-chip button:hover { color: #f87171; }
.qp-chips:empty { display: none; }
.qp.multi { flex-wrap: wrap; }
.qp.multi .qp-text { flex: 1 1 160px; }
.qp-any { color: var(--amber); font-weight: 700; }

/* ---------- Characters (read-only) ---------- */
.searchbar.ch { grid-template-columns: 1fr; }
.chlink { color: var(--teal); text-decoration: none; }
.chlink:hover { text-decoration: underline; }
.grid .tags a.chlink span { color: var(--teal); }
.grid .tags a.chlink:hover span { border-color: var(--teal); }
.chhead h2 { margin: 0 0 4px; font-size: 22px; }
.chhead p { margin: 0; }
.chstats { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.chstat { background: #0d1526; border: 1px solid #1f2b40; border-radius: 8px; padding: 8px 10px; }
.chstat span { display: block; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); }
.chstat b { font-size: 16px; }
.chq span { font: 12px ui-monospace, Consolas, monospace; }

/* ---------- Characters: game-inventory-style sheet ---------- */
.chlayout { display: grid; grid-template-columns: 372px minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 1000px) { .chlayout { grid-template-columns: 1fr; } }
.chinv { position: sticky; top: 12px; padding: 14px; background: linear-gradient(#17202f, #111a2a); }
.chcell { position: relative; width: 44px; height: 44px; display: grid; place-items: center; background: #1a2438; border: 1px solid #2a3a58; border-radius: 6px; color: var(--dim); }
.chcell img { width: 32px; height: 32px; image-rendering: pixelated; }
.chcell.empty { background: #131c2d; border-color: #1f2b40; }
.chcell.empty small { font-size: 10px; text-transform: uppercase; letter-spacing: .03em; color: #6b7a94; text-align: center; line-height: 1.1; }
.chcell:not(.empty):hover { border-color: var(--teal); box-shadow: 0 0 0 1px var(--teal) inset; }
.chcell.g2 { border-color: #4a78c8; } .chcell.g3 { border-color: #b07ae0; } .chcell.g4 { border-color: #e0a040; }
.chcell em { position: absolute; font: 700 11px/1 system-ui; font-style: normal; text-shadow: 0 1px 2px #000; pointer-events: none; }
.chcell em.up { left: 3px; top: 3px; color: #ffd24a; }
.chcell em.n { right: 3px; bottom: 3px; color: #fff; }
.chcell.sk { width: 40px; height: 40px; }
.cheq { display: grid; grid-template-columns: 44px 1fr 44px; grid-template-areas: 'top top top' 'left mid right' 'cash cash cash'; gap: 6px 8px; margin-bottom: 12px; }
.cheq-top { grid-area: top; display: flex; justify-content: center; gap: 6px; }
.cheq-left, .cheq-right { display: grid; gap: 6px; align-content: start; }
.cheq-left { grid-area: left; } .cheq-right { grid-area: right; }
.cheq-mid { grid-area: mid; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border-radius: 8px; background: radial-gradient(circle at 50% 35%, #1e2c47, #0f1626 70%); text-align: center; padding: 8px; }
.cheq-mid b { font-size: 16px; } .cheq-mid span { color: var(--dim); font-size: 13px; }
.cheq-cash { grid-area: cash; display: flex; justify-content: center; gap: 6px; }
.chbag { display: grid; grid-template-columns: repeat(7, 44px); gap: 4px; justify-content: space-between; padding: 8px; background: #0d1526; border: 1px solid #1f2b40; border-radius: 8px; }
.chlock { margin: 8px 0 0; font-size: 12px; text-align: center; }
.chmoney { display: flex; gap: 8px; margin-top: 10px; }
.chmoney span { flex: 1; display: flex; justify-content: space-between; padding: 6px 10px; background: #0d1526; border: 1px solid #1f2b40; border-radius: 14px; font-size: 12px; color: var(--dim); }
.chmoney b { color: var(--fg); }
.chinfo .card { margin-bottom: 14px; }
.chskills { display: flex; flex-wrap: wrap; gap: 6px; }

.chbars { display: grid; gap: 6px; margin-bottom: 12px; }
.chbar { display: grid; grid-template-columns: 38px 1fr; align-items: center; gap: 8px; }
.chbar label { font: 700 13px system-ui; color: #8fa6e8; }
.chbar > div { position: relative; height: 18px; border-radius: 9px; background: #0b1120; border: 1px solid #2a3552; overflow: hidden; }
.chbar i { position: absolute; inset: 0 auto 0 0; border-radius: 9px; box-shadow: inset 0 6px 0 rgb(255 255 255 / .22); }
.chbar b { position: absolute; inset: 0; text-align: center; font: 700 12px/18px system-ui; color: #fff; text-shadow: 0 0 2px #000, 0 1px 1px #000; }
.chbar.hp i { background: linear-gradient(#ff6b6b, #c0262d); }
.chbar.mp i { background: linear-gradient(#6fb3ff, #2a62c9); }
.chbar.fp i { background: linear-gradient(#6fe28a, #1f9a45); }
.chbar.exp i { background: linear-gradient(#ffe27a, #d19a1a); }

/* ---------- Website shop: add-item form + rows ---------- */
.vh { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
.btn:focus-visible { outline: 2px solid #2f6f8f; outline-offset: 1px; }
input[aria-invalid="true"], select[aria-invalid="true"] { outline: 2px solid var(--red); outline-offset: 0; border-color: var(--red); }
#wsMsg:focus { outline: none; }
#wsMsg:focus-visible { outline: 2px solid #2f6f8f; outline-offset: 2px; border-radius: 4px; }
#wsForm .row.ws-search { grid-template-columns: 1fr auto; align-items: end; }
#wsForm .row.ws-add { grid-template-columns: minmax(180px, 2fr) 110px 140px 90px 90px minmax(130px, 1fr) auto auto; align-items: end; }
#wsForm .row.ws-search, #wsForm .row.ws-add { margin: 12px 0; }
#wsForm .row.ws-search:first-of-type { margin-top: 4px; }
.ws-fld { display: grid; gap: 6px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--dim); min-width: 0; }
.ws-fld input, .ws-fld select { width: 100%; box-sizing: border-box; font-size: 14px; text-transform: none; letter-spacing: 0; }
#wsForm .ws-check { padding-bottom: 10px; white-space: nowrap; }
#wsForm .ws-search .btn, #wsForm .ws-add .btn { align-self: end; }
#view-wshop .tp-table td:nth-child(7) { white-space: normal; min-width: 150px; }
#view-wshop .tp-cat { width: 150px; max-width: 100%; }
#view-wshop .tp-table td:last-child .btn { margin-right: 6px; }
#view-wshop .tp-table td:last-child .btn:last-child { margin-right: 0; }
@media (max-width: 1350px) { #wsForm .row.ws-add { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  #wsForm .row.ws-search, #wsForm .row.ws-add { grid-template-columns: 1fr; }
  #wsForm .ws-check { padding-bottom: 0; }
  #view-wshop .tp-cat { width: 100%; }
}
