/* Deeprock Idle — UI */
:root {
  --bg: #0b0e12;
  --bg2: #0f1419;
  --panel: #141a21;
  --panel2: #19222b;
  --line: #26313d;
  --line2: #33404f;
  --text: #dbe3ec;
  --muted: #8492a3;
  --dim: #5d6b7c;
  --copper: #d99a4e;
  --copper2: #f0b96a;
  --teal: #7fd0b6;
  --red: #d76a5c;
  --gold: #e6c15a;
  --green: #86c47a;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "SF Mono", monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(1100px 500px at 15% -10%, rgba(217, 154, 78, .10), transparent 60%),
    radial-gradient(900px 400px at 90% 0%, rgba(127, 208, 182, .07), transparent 60%),
    var(--bg);
  color: var(--text);
  font: 14px/1.45 "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  overflow: hidden;
}

button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3, h4, p { margin: 0; }
.muted { color: var(--muted); }
.gold { color: var(--gold); }
.hidden { display: none !important; }

::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: #2a3542; border-radius: 9px; border: 2px solid var(--panel); }
::-webkit-scrollbar-thumb:hover { background: #3a4757; }
::-webkit-scrollbar-track { background: transparent; }

#app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }

/* ------------------------------------------------------------------ top */
.top {
  display: flex; align-items: center; gap: 18px;
  padding: 9px 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #121820, #0e1319);
  flex: 0 0 auto;
}
.brand { display: flex; align-items: center; gap: 9px; min-width: 150px; }
.logo {
  width: 30px; height: 30px; display: grid; place-items: center;
  color: #10151b; font-size: 14px;
  background: linear-gradient(145deg, var(--copper2), #b97a34);
  border-radius: 8px;
  box-shadow: 0 0 18px rgba(217, 154, 78, .25);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-text b { font-size: 13px; letter-spacing: .18em; color: var(--copper2); }
.brand-text small { font-size: 10px; color: var(--dim); letter-spacing: .12em; }

.hud { display: flex; align-items: center; gap: 20px; margin-left: 8px; }
.hud-item { display: flex; align-items: center; gap: 7px; }
.hud-item > span { font-size: 10px; letter-spacing: .14em; color: var(--dim); text-transform: uppercase; }
.hud-item b { font: 700 15px/1 var(--mono); color: var(--text); }
.hud-item .gold { color: var(--gold); }

.hpbar { width: 108px; height: 6px; border-radius: 6px; background: #0a0e13; border: 1px solid #2a3541; overflow: hidden; }
.hpbar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #9c4a41, #c96a58); transition: width .2s ease; }
.hud-item.wide b { font-size: 11px; color: var(--muted); min-width: 58px; }

.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.online { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); }
.online i { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); animation: pulse 2.4s infinite; }
.online b { font: 700 12px var(--mono); color: var(--green); }
.online em { font-style: normal; color: var(--dim); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

.iconbtn {
  width: 30px; height: 28px; border-radius: 7px; border: 1px solid var(--line);
  background: var(--panel); font-size: 13px; line-height: 1;
}
.iconbtn:hover { border-color: var(--line2); background: var(--panel2); }

/* ---------------------------------------------------------------- world */
/* the old side-scrolling strip is intentionally gone; the map is the world now */

/* ----------------------------------------------------------------- tabs */
.tabs { display: flex; gap: 3px; padding: 7px 14px 0; flex: 0 0 auto; }
.tabs button {
  border: 1px solid transparent; background: transparent;
  padding: 6px 14px; border-radius: 8px 8px 0 0;
  color: var(--muted); font-size: 12.5px;
}
.tabs button:hover { color: var(--text); background: rgba(255, 255, 255, .03); }
.tabs button.on {
  color: var(--copper2);
  background: var(--panel);
  border-color: var(--line);
  border-bottom-color: var(--panel);
}

/* --------------------------------------------------------------- layout */
.layout {
  flex: 1 1 auto; min-height: 0;
  display: grid;
  grid-template-columns: 238px minmax(0, 1fr) 300px;
  gap: 10px;
  padding: 0 14px 10px;
}

.panel {
  background: linear-gradient(180deg, var(--panel), #121820);
  border: 1px solid var(--line);
  border-radius: 12px;
  min-height: 0;
  display: flex; flex-direction: column;
  overflow: hidden;
}

/* --------------------------------------------------------------- skills */
.skills { padding: 7px; gap: 3px; overflow-y: auto; }
.skill {
  display: grid; grid-template-columns: 30px 1fr; align-items: center; gap: 8px;
  width: 100%; text-align: left;
  padding: 7px 8px; border-radius: 8px;
  border: 1px solid transparent; background: transparent;
}
.skill:hover { background: rgba(255, 255, 255, .035); }
.skill.on { background: rgba(217, 154, 78, .07); border-color: rgba(217, 154, 78, .35); }
.sk-ico { font-size: 17px; text-align: center; filter: saturate(.9); }
.sk-main { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.sk-name { display: flex; justify-content: space-between; gap: 6px; font-size: 12.5px; }
.sk-name b { font: 700 11px var(--mono); color: var(--muted); }
.skill.on .sk-name b { color: var(--copper2); }
.sk-bar { display: block; height: 3px; border-radius: 3px; background: #0a0e12; overflow: hidden; }
.sk-bar i { display: block; height: 100%; width: 0; border-radius: 3px; transition: width .35s ease; }
.run-dot {
  display: inline-block; width: 5px; height: 5px; border-radius: 50%;
  background: var(--copper); margin-left: 6px; vertical-align: middle;
  box-shadow: 0 0 6px rgba(217, 154, 78, .8);
  animation: pulse 1.6s infinite;
}
.hint-line { margin-top: 9px; font-size: 11.5px; color: var(--copper2); opacity: .82; }

/* ----------------------------------------------------------------- view */
.view { padding: 13px 15px 18px; overflow-y: auto; }
.view-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 11px; }
.view-head h2 { font-size: 17px; font-weight: 650; letter-spacing: .02em; }
.view-head p { margin-top: 3px; font-size: 12px; color: var(--muted); }
.lvl-chip {
  flex: 0 0 auto; text-align: right;
  border: 1px solid var(--line); border-radius: 9px;
  padding: 5px 10px; background: #10161c;
}
.lvl-chip b { font: 700 16px var(--mono); color: var(--copper2); }
.lvl-chip span { display: block; font: 10px var(--mono); color: var(--dim); }

/* current action */
.nowcard {
  border: 1px solid var(--line2);
  border-radius: 11px;
  padding: 11px 13px;
  background: linear-gradient(120deg, rgba(217, 154, 78, .10), rgba(217, 154, 78, .02) 55%), #11171d;
  transition: border-color .2s;
}
.nowcard.idle { border-color: var(--line); background: #11161c; }
.now-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.now-title { font-size: 14.5px; font-weight: 650; display: flex; align-items: center; gap: 7px; }
.now-title .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--copper); box-shadow: 0 0 8px var(--copper); }
.now-title .now-mob { width: 28px; height: 28px; image-rendering: pixelated; margin: -6px 0; }
.badge .mob-pix { width: 30px; height: 30px; }
.badge.lg .mob-pix { width: 40px; height: 40px; }
.now-sub { display: block; margin-top: 3px; font-size: 11px; color: var(--muted); }
.now-meta { display: flex; justify-content: space-between; gap: 10px; margin-top: 6px; font: 10.5px var(--mono); color: var(--dim); }

.bar { height: 8px; border-radius: 6px; background: #080b0f; border: 1px solid #222c37; overflow: hidden; margin-top: 9px; }
.bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #b97a34, var(--copper2)); transition: width .12s linear; }
.bar.big { height: 10px; }
.bar.monster i { background: linear-gradient(90deg, #8f3d35, #d76a5c); transition: none; }

.mon { margin-top: 9px; padding-top: 9px; border-top: 1px dashed var(--line); }
.mon-head { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--muted); }
.mon-head b { font-family: var(--mono); color: var(--text); }

.btn {
  border: 1px solid var(--line2); background: var(--panel2); color: var(--text);
  padding: 6px 12px; border-radius: 7px; font-size: 12px;
}
.btn:hover { border-color: #4a5a6c; }
.btn.primary { background: linear-gradient(180deg, #e0a55a, #c8873d); border-color: #e0a55a; color: #171008; font-weight: 700; }
.btn.primary:hover { filter: brightness(1.07); }
.btn.ghost { background: transparent; }
.btn.danger { border-color: rgba(215, 106, 92, .5); color: #e7978c; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.small { padding: 3px 8px; font-size: 11px; border-radius: 5px; }

/* card grid */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(212px, 1fr)); gap: 9px; margin-top: 12px; }
.card {
  border: 1px solid var(--line); border-radius: 10px;
  background: #12181f; padding: 10px;
  display: flex; flex-direction: column; gap: 7px;
  position: relative; transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--line2); }
.card.locked { opacity: .5; }
.card.active { border-color: rgba(217, 154, 78, .55); box-shadow: inset 0 0 0 1px rgba(217, 154, 78, .12); }
.card-top { display: flex; gap: 8px; align-items: center; }
.badge {
  flex: 0 0 auto; width: 32px; height: 32px; border-radius: 8px;
  display: grid; place-items: center;
  font: 700 11px/1 var(--mono); letter-spacing: 0;
  color: var(--c, var(--copper2));
  background: color-mix(in srgb, var(--c, #d99a4e) 16%, #0d1217);
  border: 1px solid color-mix(in srgb, var(--c, #d99a4e) 45%, #0d1217);
}
.badge.lg { width: 42px; height: 42px; font-size: 14px; border-radius: 10px; }
.badge.pix-badge { background: transparent; border-color: transparent; padding: 0; }
.badge .pix { display: block; width: 26px; height: 26px; image-rendering: pixelated; }
.badge.lg .pix { width: 38px; height: 38px; }
.cell .badge .pix { width: 24px; height: 24px; }
.card h4 { font-size: 13px; font-weight: 650; }
.card .meta { font: 10.5px var(--mono); color: var(--dim); margin-top: 2px; }
.card .req { font-size: 11px; color: var(--muted); }
.card .req .no { color: var(--red); }
.card .req .ok { color: var(--green); }
.card .btn { width: 100%; margin-top: auto; border-color: rgba(217, 154, 78, .32); color: var(--copper2); background: rgba(217, 154, 78, .06); }
.card .btn:hover:not(:disabled) { background: rgba(217, 154, 78, .14); border-color: rgba(217, 154, 78, .55); }
.card .btn:disabled { color: var(--dim); border-color: var(--line); background: transparent; }
.card .lock { position: absolute; top: 8px; right: 9px; font-size: 9px; color: var(--dim); }

/* --------------------------------------------------------------- market */
.filters { display: flex; flex-wrap: wrap; gap: 5px; margin: 4px 0 10px; }
.chip {
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  padding: 3px 9px; border-radius: 20px; font-size: 11px;
}
.chip:hover { color: var(--text); }
.chip.on { color: var(--copper2); border-color: rgba(217, 154, 78, .5); background: rgba(217, 154, 78, .08); }

table.market { width: 100%; border-collapse: collapse; font-size: 12px; }
table.market th {
  position: sticky; top: -13px; z-index: 2;
  text-align: left; font: 600 10px var(--mono); letter-spacing: .1em;
  color: var(--dim); text-transform: uppercase;
  background: #121820; padding: 7px 6px; border-bottom: 1px solid var(--line);
}
table.market td { padding: 6px; border-bottom: 1px solid rgba(38, 49, 61, .55); vertical-align: middle; }
table.market tr:hover td { background: rgba(255, 255, 255, .02); }
.item-cell { display: flex; align-items: center; gap: 8px; }
.item-cell .name { font-size: 12px; }
.item-cell .sub { font: 9.5px var(--mono); color: var(--dim); }
.num { font-family: var(--mono); text-align: right; white-space: nowrap; }
.trend { font-size: 10px; margin-left: 3px; }
.trend.up { color: var(--green); }
.trend.down { color: var(--red); }
.trade-btns { display: flex; gap: 3px; justify-content: flex-end; }
.sell { color: var(--gold); }

/* ------------------------------------------------------------- character */
.char-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 9px; margin-top: 10px; }
.stat-card { border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; background: #12181f; }
.stat-card span { font-size: 10px; letter-spacing: .1em; color: var(--dim); text-transform: uppercase; }
.stat-card b { display: block; margin-top: 2px; font: 700 16px var(--mono); color: var(--text); }
.equip-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 9px; margin-top: 10px; }
.equip-slot {
  border: 1px dashed var(--line2); border-radius: 9px; padding: 9px;
  display: flex; align-items: center; gap: 9px; min-height: 58px; background: #10151b;
}
.equip-slot .empty { color: var(--dim); font-size: 11px; }
.skill-table { margin-top: 14px; display: flex; flex-direction: column; gap: 5px; }
.skill-row { display: grid; grid-template-columns: 26px 62px 1fr 42px; align-items: center; gap: 8px; font-size: 12px; }
.skill-row .track { height: 5px; background: #0a0e12; border-radius: 5px; overflow: hidden; }
.skill-row .track i { display: block; height: 100%; }
.skill-row .lv { font: 700 11px var(--mono); color: var(--muted); text-align: right; }

/* ---------------------------------------------------------- achievements */
.ach-summary { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: 12px; color: var(--muted); }
.ach-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.ach {
  border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; background: #11171d;
  display: flex; gap: 9px; align-items: flex-start; opacity: .55;
}
.ach.done { opacity: 1; border-color: rgba(127, 208, 182, .35); background: rgba(127, 208, 182, .05); }
.ach .mark { font-size: 15px; }
.ach h4 { font-size: 12.5px; font-weight: 600; }
.ach p { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* -------------------------------------------------------------- settings */
.set-block { border: 1px solid var(--line); border-radius: 10px; padding: 12px 13px; background: #11171d; margin-bottom: 10px; }
.set-block h3 { font-size: 12.5px; color: var(--copper2); margin-bottom: 8px; letter-spacing: .04em; }
.set-block p { font-size: 11.5px; color: var(--muted); }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
input[type="text"], input[type="file"] {
  background: #0b1015; border: 1px solid var(--line2); border-radius: 7px;
  color: var(--text); padding: 6px 9px; font: 12px var(--mono); outline: none;
}
input[type="text"]:focus { border-color: var(--copper); }
.switch { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); cursor: pointer; }
.switch input { accent-color: var(--copper); }

/* ------------------------------------------------------------------ side */
.side { display: flex; flex-direction: column; }
.side-head { display: flex; align-items: center; justify-content: space-between; padding: 9px 11px 5px; flex: 0 0 auto; }
.side-head h3 { font-size: 11px; letter-spacing: .12em; color: var(--dim); text-transform: uppercase; }
.side-head .muted { font: 10px var(--mono); }
.link { border: 0; background: transparent; color: var(--dim); font-size: 10px; }
.link:hover { color: var(--muted); }

.inv {
  display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px;
  padding: 2px 10px 8px; flex: 0 0 auto;
}
.cell {
  position: relative; aspect-ratio: 1; border-radius: 7px;
  border: 1px solid var(--line); background: #0f151b;
  display: grid; place-items: center; padding: 0;
}
.cell:hover { border-color: var(--line2); background: #131a22; }
.cell.empty { border-style: dashed; border-color: #18212a; background: transparent; pointer-events: none; opacity: .55; }
.cell .qty {
  position: absolute; right: 2px; bottom: 1px;
  font: 700 9px var(--mono); color: var(--text);
  text-shadow: 0 1px 2px #000, 0 0 3px #000;
}
.cell .badge { width: 30px; height: 30px; font-size: 10px; border-radius: 6px; }

.log { flex: 1 1 auto; overflow-y: auto; padding: 0 10px 10px; min-height: 60px; }
.log p { font: 11px/1.45 var(--mono); color: var(--muted); padding: 2.5px 0; border-bottom: 1px solid rgba(38, 49, 61, .35); }
.log p:last-child { border-bottom: 0; }
.log p .t { color: #3f4b59; margin-right: 5px; }
.log p.good { color: #9fd3a4; }
.log p.bad { color: #e08e82; }
.log p.lvl { color: var(--copper2); }
.log p.ach { color: var(--teal); }
.log p.trade { color: #c8b27a; }

/* ------------------------------------------------------------------ foot */
.foot {
  flex: 0 0 auto; height: 25px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 16px; border-top: 1px solid var(--line);
  font-size: 10.5px; color: var(--dim); background: #0c1015;
}

/* ---------------------------------------------------------------- modals */
.modal {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  background: rgba(5, 8, 11, .72);
  backdrop-filter: blur(3px);
  padding: 18px;
}
.modal-card {
  width: min(480px, 100%); max-height: 84vh; overflow-y: auto;
  background: linear-gradient(180deg, #171f27, #11171d);
  border: 1px solid var(--line2); border-radius: 14px;
  padding: 18px 19px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
}
.modal-card h2 { font-size: 17px; }
.modal-card .sub, .modal-card .modal-sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.modal-card .body { margin-top: 12px; font-size: 12.5px; }
.modal-card .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.trade-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 13px; }
.trade-side { background: #0f151b; border: 1px solid var(--line); border-radius: 9px; padding: 9px; }
.trade-side h4 { font-size: 12px; color: var(--copper2); display: flex; justify-content: space-between; gap: 6px; }
.trade-side h4 em { font-style: normal; font-size: 9.5px; color: var(--green); }
.trade-list { min-height: 62px; margin-top: 6px; display: flex; flex-direction: column; gap: 3px; }
.trade-row { display: flex; align-items: center; gap: 6px; font-size: 11px; background: rgba(255, 255, 255, .035); padding: 3px 5px; border-radius: 5px; }
.trade-row b { margin-left: auto; color: var(--dim); font-family: var(--mono); }
.trade-x { border: 0; background: none; color: var(--muted); font-size: 13px; cursor: pointer; padding: 0 2px; }
.trade-x:hover { color: var(--danger); }
.trade-empty { color: var(--dim); font-size: 10.5px; }
.trade-gold-line { font-size: 11px; margin-top: 7px; color: var(--muted); }
.trade-gold-line b { color: var(--copper2); font-family: var(--mono); }
.trade-add { display: flex; gap: 4px; margin-top: 5px; }
.trade-add select, .trade-add input {
  min-width: 0; flex: 1; font-size: 11px; padding: 4px 6px;
  background: #0b1116; border: 1px solid var(--line2); border-radius: 5px;
  color: var(--text); outline: none;
}
.trade-add select:focus, .trade-add input:focus { border-color: rgba(217, 154, 78, .55); }
.trade-add .btn { width: auto; flex: 0 0 auto; margin: 0; padding: 3px 7px; font-size: 10.5px; }

.map-party {
  display: flex; align-items: center; justify-content: space-between; gap: 7px;
  border: 1px solid rgba(127, 208, 182, .35);
  background: rgba(127, 208, 182, .07);
  border-radius: 8px; padding: 5px 7px;
}
.map-party b { display: block; font-size: 10.5px; color: var(--teal); }
.map-party span { display: block; font-size: 9.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 180px; }
.map-party .btn { width: auto; margin: 0; padding: 2px 7px; font-size: 10px; }
.report { display: flex; flex-direction: column; gap: 7px; }
.report .line { display: flex; justify-content: space-between; gap: 10px; padding: 6px 9px; border-radius: 7px; background: #0f151b; border: 1px solid var(--line); }
.report .line b { font-family: var(--mono); }
.report .line .pos { color: var(--green); }
.report .line .neg { color: var(--red); }
.report h4 { font-size: 10.5px; letter-spacing: .12em; color: var(--dim); text-transform: uppercase; margin-top: 6px; }

/* item sheet */
.sheet-head { display: flex; gap: 12px; align-items: center; }
.sheet-head h2 { font-size: 16px; }
.sheet-head .sub { font: 10.5px var(--mono); color: var(--dim); margin-top: 2px; }
.sheet-desc { color: var(--muted); font-size: 12px; margin-top: 10px; }
.sheet-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }

/* ---------------------------------------------------------------- toasts */
.toasts { position: fixed; right: 14px; bottom: 34px; z-index: 60; display: flex; flex-direction: column; gap: 7px; align-items: flex-end; }
.toast {
  background: #182129; border: 1px solid var(--line2); border-left: 3px solid var(--copper);
  color: var(--text); border-radius: 8px; padding: 8px 12px;
  font-size: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
  animation: toast-in .25s ease;
}
.toast.good { border-left-color: var(--green); }
.toast.ach { border-left-color: var(--teal); }
.toast.bad { border-left-color: var(--red); }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ------------------------------------------------------------------ boss */
.bossbar {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 9px;
  padding: 5px 14px;
  background: linear-gradient(90deg, #291214, #1a0f11 60%, #141013);
  border-bottom: 1px solid #4a2427;
  font-size: 12px;
}
.bossbar .boss-face { color: #e07a5f; font-size: 14px; }
.bossbar b { color: #f0a08e; font-size: 12.5px; white-space: nowrap; }
.bossbar .bar { flex: 1 1 auto; margin: 0; height: 8px; min-width: 80px; }
.bar.boss { background: #120b0c; border-color: #47262a; }
.bar.boss i { background: linear-gradient(90deg, #8a2f2a, #e07a5f); transition: width .2s linear; }
.boss-meta { font: 10.5px var(--mono); color: #b08d8d; white-space: nowrap; }
.bossbar.dead { opacity: .75; }
body:not(.is-online) .bossbar { display: none !important; }

/* ------------------------------------------------------------------ chat */
.sidetabs { display: flex; gap: 2px; }
.sidetabs button {
  border: 1px solid transparent; background: transparent; color: var(--dim);
  font-size: 10px; padding: 1px 7px; border-radius: 5px;
}
.sidetabs button.on { color: var(--copper2); border-color: var(--line); background: #10161c; }
body:not(.is-online) .sidetabs [data-side="chat"] { display: none; }

.chat { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }
.chat-list { flex: 1 1 auto; overflow-y: auto; padding: 0 10px 6px; min-height: 45px; }
.chat-list p { font-size: 11.5px; line-height: 1.45; color: var(--muted); padding: 1.5px 0; word-break: break-word; }
.chat-list p b { color: var(--copper2); font-weight: 600; margin-right: 4px; }
.chat-list p.sys { color: var(--teal); font-style: italic; }
.chat-form { display: flex; gap: 5px; padding: 7px 10px 9px; border-top: 1px solid var(--line); }
.chat-form input {
  flex: 1 1 auto; min-width: 0;
  background: #0b1015; border: 1px solid var(--line2); border-radius: 6px;
  color: var(--text); padding: 5px 8px; font-size: 12px; outline: none;
}
.chat-form input:focus { border-color: var(--copper); }

/* -------------------------------------------------------- online market */
.mp-grid { display: grid; grid-template-columns: minmax(0, 1fr) 236px; gap: 11px; align-items: start; }
.mp-sell {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 11px;
  background: #12181f;
}
.mp-sell h3 { font-size: 12px; color: var(--copper2); margin-bottom: 4px; }
.mp-sell p { font-size: 10.5px; color: var(--dim); }
.mp-field { display: block; margin-top: 8px; font-size: 10.5px; color: var(--dim); }
.mp-field select, .mp-field input {
  width: 100%; margin-top: 3px;
  background: #0b1015; border: 1px solid var(--line2); border-radius: 6px;
  color: var(--text); padding: 5px 7px; font: 12px var(--mono); outline: none;
}
.mp-field select:focus, .mp-field input:focus { border-color: var(--copper); }
.mp-sell .btn { width: 100%; margin-top: 9px; }
.my-listing { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 5px 0; border-bottom: 1px solid rgba(38, 49, 61, .5); font-size: 11.5px; }
.my-listing:last-child { border-bottom: 0; }
.mp-sub { font-size: 11px; letter-spacing: .1em; color: var(--dim); text-transform: uppercase; margin: 12px 0 5px; }
.mp-trades { font-size: 10.5px; color: var(--dim); margin-top: 8px; line-height: 1.5; }
.online.bad i { background: var(--red); box-shadow: 0 0 8px var(--red); animation: none; }
.online.bad b { color: var(--red); }

/* ------------------------------------------------------------------- map */
#view.map-view { padding: 0; overflow: hidden; }
body.map-mode .skills, body.map-mode .side { display: none; }
body.map-mode .bossbar { display: none !important; }
body.map-mode .layout { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 0; }
body.map-mode .view {
  display: flex; flex-direction: column; min-height: 0;
  padding: 0; border: 0; border-radius: 0; background: transparent;
}
body.map-mode .foot { display: none; }

.map-shell { position: relative; flex: 1 1 auto; height: auto; min-height: 0; }
.map-main {
  position: absolute; inset: 0;
  padding-right: 300px;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(900px 500px at 50% 42%, rgba(40, 70, 50, .22), transparent 72%),
    radial-gradient(1200px 700px at 50% 50%, #0b1210, #070a09 75%);
  overflow: hidden;
  touch-action: none;
}
.map-main::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  box-shadow: inset 0 0 120px 30px rgba(0, 0, 0, .55);
}
#mapcanvas {
  display: block; transform-origin: 50% 50%;
  cursor: grab;
  filter: saturate(1.04) contrast(1.02);
  box-shadow: 0 18px 60px rgba(0, 0, 0, .5);
}
#mapcanvas.dragging { cursor: grabbing; }

.map-topbar {
  position: absolute; top: 14px; left: 16px; z-index: 5;
  display: flex; align-items: flex-start; gap: 14px;
  pointer-events: none;
}
.map-title {
  padding: 8px 12px 9px;
  border: 1px solid rgba(180, 160, 120, .22);
  border-left: 2px solid var(--copper);
  border-radius: 3px 9px 9px 3px;
  background: linear-gradient(90deg, rgba(9, 14, 12, .9), rgba(9, 14, 12, .55));
  backdrop-filter: blur(7px);
}
.map-title small { display: block; font-size: 9px; letter-spacing: .28em; color: var(--dim); text-transform: uppercase; }
.map-title b { display: block; font-size: 19px; letter-spacing: .12em; color: #e6d7b5; font-weight: 600; margin-top: 1px; }
.map-title span { display: block; margin-top: 2px; font: 10px var(--mono); color: var(--muted); }

.map-compass {
  position: relative; width: 46px; height: 46px; border-radius: 50%;
  border: 1px solid rgba(180, 160, 120, .32);
  background: rgba(9, 14, 12, .6);
  backdrop-filter: blur(7px);
}
.map-compass::before, .map-compass::after {
  content: ""; position: absolute; left: 50%; top: 50%; background: rgba(216, 196, 150, .25);
}
.map-compass::before { width: 1px; height: 30px; transform: translate(-50%, -50%); }
.map-compass::after { width: 30px; height: 1px; transform: translate(-50%, -50%); }
.map-compass i { position: absolute; left: 50%; top: 3px; transform: translateX(-50%); font: 9px var(--mono); color: var(--copper2); font-style: normal; }
.map-compass span {
  position: absolute; left: 50%; top: 50%; width: 0; height: 0;
  transform: translate(-50%, -62%);
  border-left: 4px solid transparent; border-right: 4px solid transparent;
  border-bottom: 13px solid rgba(217, 154, 78, .85);
}
.map-compass b { position: absolute; left: 50%; bottom: 3px; transform: translateX(-50%); font: 9px var(--mono); color: var(--dim); }

.map-zoombar {
  position: absolute; left: 16px; bottom: 16px; z-index: 5;
  display: flex; align-items: center; gap: 2px;
  padding: 4px; border-radius: 8px;
  border: 1px solid rgba(180, 160, 120, .22);
  background: rgba(9, 14, 12, .8); backdrop-filter: blur(7px);
}
.map-zoombar button {
  width: 26px; height: 24px; border-radius: 5px;
  border: 1px solid transparent; background: transparent;
  color: var(--muted); font-size: 13px; line-height: 1;
}
.map-zoombar button:hover { color: var(--text); background: rgba(255, 255, 255, .05); border-color: var(--line); }
.map-zoombar span { min-width: 38px; text-align: center; font: 9.5px var(--mono); color: var(--dim); }

.map-legend {
  position: absolute; left: 16px; bottom: 52px; z-index: 5;
  display: flex; align-items: center; gap: 6px;
  font-size: 9.5px; color: var(--dim);
  padding: 4px 8px; border-radius: 6px;
  background: rgba(9, 14, 12, .62); border: 1px solid rgba(180, 160, 120, .14);
  backdrop-filter: blur(6px);
}
.map-legend span { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.map-legend .lg-self { background: var(--copper); box-shadow: 0 0 5px var(--copper); }
.map-legend .lg-real { background: var(--teal); box-shadow: 0 0 5px var(--teal); }
.map-legend .lg-npc { background: #6c7a6a; }
.map-legend .lg-pin {
  width: 0; height: 0; border-radius: 0; background: none;
  border-left: 3px solid transparent; border-right: 3px solid transparent;
  border-top: 7px solid var(--copper2);
}

.map-side {
  position: absolute; top: 14px; right: 14px; bottom: 14px; width: 286px; z-index: 6;
  min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: 5px;
  padding: 10px 10px 8px;
  border: 1px solid rgba(180, 160, 120, .22);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(12, 18, 15, .92), rgba(8, 12, 10, .9));
  backdrop-filter: blur(10px);
  box-shadow: 0 18px 50px rgba(0, 0, 0, .45);
  scrollbar-width: thin;
}
.map-head { display: flex; align-items: center; justify-content: space-between; }
.map-head b { font-size: 13px; color: var(--copper2); letter-spacing: .08em; }
.map-head span { font: 10px var(--mono); color: var(--dim); }
.map-people-label {
  font-size: 9px; letter-spacing: .12em; color: var(--dim);
  text-transform: uppercase; margin: 1px 0 -3px 2px;
}
.map-people {
  flex: 0 0 auto;
  display: flex; flex-direction: column; gap: 1px;
  border: 1px solid var(--line); border-radius: 8px;
  padding: 4px; max-height: 120px; overflow-y: auto;
  background: rgba(10, 15, 12, .35);
}
.map-person {
  display: grid; grid-template-columns: 7px minmax(0, 1fr) auto;
  column-gap: 6px; align-items: center;
  padding: 2px 5px; border-radius: 5px;
  border: 1px solid transparent; background: transparent;
  text-align: left;
}
.map-person:hover:not(:disabled) { background: rgba(255, 255, 255, .04); }
.map-person:disabled { cursor: default; }
.map-person i { width: 5px; height: 5px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 5px var(--teal); }
.map-person i.self { background: var(--copper); box-shadow: 0 0 5px var(--copper); }
.map-person b { font-size: 11px; color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-person em {
  font-style: normal; font-size: 9.5px; color: var(--muted);
  max-width: 92px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  text-align: right;
}
.map-places { display: flex; flex-direction: column; gap: 2px; }
.map-place {
  display: flex; align-items: center; justify-content: space-between;
  padding: 3px 8px; border-radius: 6px;
  border: 1px solid transparent; background: transparent;
  color: var(--muted); font-size: 11.5px; text-align: left;
}
.map-place:hover { background: rgba(255, 255, 255, .03); color: var(--text); }
.map-place.on { border-color: rgba(217, 154, 78, .38); background: rgba(217, 154, 78, .08); color: var(--text); }
.map-place b { font: 700 10px var(--mono); color: var(--dim); }
.map-detail { border: 1px solid var(--line); border-radius: 9px; background: #11171d; padding: 8px 9px; }
.map-detail h4 { font-size: 12.5px; }
.map-detail p { margin-top: 3px; font-size: 10.5px; color: var(--muted); line-height: 1.45; }
.map-detail .btn { width: 100%; margin-top: 5px; padding: 5px 10px; font-size: 11.5px; }
.map-boss {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  margin-top: 7px; padding: 6px 8px; border-radius: 6px;
  background: rgba(224, 86, 63, .08); border: 1px solid rgba(224, 86, 63, .25);
  font-size: 11px;
}
.map-boss b { color: #e79a86; }
.map-boss span { font: 10px var(--mono); color: #b08d8d; }
.map-boss .btn { width: auto; margin: 0; padding: 2px 8px; font-size: 10px; border-radius: 5px; }
.map-now {
  margin-top: auto; border: 1px dashed var(--line2); border-radius: 8px;
  padding: 5px 8px; font-size: 10.5px; color: var(--muted);
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
}
.map-now span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* -------------------------------------------------------------- responsive */
@media (max-width: 1260px) {
  .mp-grid { grid-template-columns: 1fr; }
}
@media (max-width: 1120px) {
  .layout { grid-template-columns: 200px minmax(0, 1fr); }
  .side { grid-column: 1 / -1; flex-direction: row; max-height: 168px; }
  .side .inv { flex: 1 1 auto; grid-template-columns: repeat(10, 1fr); overflow-y: auto; }
  .side .log { flex: 1 1 50%; border-left: 1px solid var(--line); }
  .side .chat { flex: 1 1 50%; border-left: 1px solid var(--line); }
  .side-head { display: none; }
  #view.map-view { overflow: hidden; }
  .map-main { padding-right: 266px; }
  .map-side { width: 252px; }
  .map-title b { font-size: 17px; }
  .map-now { margin-top: 0; }
}
@media (max-width: 980px) {
  .mp-grid { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  body { overflow: auto; }
  #app { height: auto; min-height: 100vh; }
  .top { flex-wrap: wrap; gap: 10px; }
  .hud { gap: 12px; }
  .hpbar { width: 70px; }
  .layout { display: block; }
  .skills { flex-direction: row; overflow-x: auto; gap: 5px; padding: 6px; margin-bottom: 8px; }
  .skill { min-width: 132px; }
  .view { min-height: 320px; }
  .side { max-height: none; flex-direction: column; margin-top: 8px; }
  .side-head { display: flex; }
  .side .inv { grid-template-columns: repeat(6, 1fr); }
  .side .log { border-left: 0; border-top: 1px solid var(--line); max-height: 200px; }
  body.map-mode #app { height: 100dvh; min-height: 0; }
  body.map-mode .layout { height: calc(100dvh - 118px); min-height: 420px; }
  body.map-mode .view { height: 100%; min-height: 0; }
  body.map-mode .map-side { display: none; }
  body.map-mode .map-shell { height: auto; min-height: 0; }
  .map-main { padding-right: 0; }
  .map-title { padding: 6px 9px; }
  .map-title b { font-size: 15px; }
  .map-compass { display: none; }
  .map-legend { display: none; }
  .map-zoombar { bottom: 10px; left: 10px; }
  .map-topbar { top: 10px; left: 10px; }
}

