:root {
  --bg: #f3f5f1;
  --surface: #ffffff;
  --surface-2: #eef2eb;
  --surface-3: #e3e9df;
  --text: #16201a;
  --muted: #5b6a60;
  --line: #dbe2d7;
  --grid: #e8ece6;
  --brand: #1d6b42;
  --brand-2: #2f8a58;
  --brand-ink: #ffffff;
  --brand-soft: #e3f1e8;
  --price: #8f5300;
  --danger: #b42318;
  --focus: #2563eb;
  --up: #c2410c;
  --down: #1d4ed8;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --slot: #d9ded6;
  --slot-hi: #f4f6f2;
  --slot-lo: #b7beb3;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(16, 24, 18, .05), 0 6px 20px rgba(16, 24, 18, .06);
  --c-block: #8b6d4f; --c-mineral: #3f7fbf; --c-food: #c0782b; --c-fish: #1f8fa0; --c-tool: #6b6f7a;
  --c-armor: #7a5aa8; --c-magic: #a8437d; --c-redstone: #b23a3a; --c-misc: #6f7f5a;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1411; --surface: #171f1a; --surface-2: #1e2822; --surface-3: #26322b; --text: #e7ede8; --muted: #9eaca2;
    --line: #2b3830; --grid: #222d26; --brand: #3fa56c; --brand-2: #57b97f; --brand-ink: #07130c; --brand-soft: #1b3326;
    --price: #f1b95c; --danger: #f87171; --up: #fb923c; --down: #7aa7ff;
    --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70;
    --slot: #2a352e; --slot-hi: #36443b; --slot-lo: #151c17;
    --shadow: 0 1px 2px rgba(0, 0, 0, .45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1411; --surface: #171f1a; --surface-2: #1e2822; --surface-3: #26322b; --text: #e7ede8; --muted: #9eaca2;
  --line: #2b3830; --grid: #222d26; --brand: #3fa56c; --brand-2: #57b97f; --brand-ink: #07130c; --brand-soft: #1b3326;
  --price: #f1b95c; --danger: #f87171; --up: #fb923c; --down: #7aa7ff;
  --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70;
  --slot: #2a352e; --slot-hi: #36443b; --slot-lo: #151c17;
  --shadow: 0 1px 2px rgba(0, 0, 0, .45);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.6 system-ui, -apple-system, "Hiragino Sans", "Noto Sans JP", "Yu Gothic UI", sans-serif;
  padding-bottom: env(safe-area-inset-bottom);
}
body.locked { overflow: hidden; }
a { color: var(--brand); }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; background: var(--surface-2); padding: 0 .35em; border-radius: 5px; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
button, input, select { font: inherit; color: inherit; }
h1 { font-size: 24px; line-height: 1.3; margin: 0 0 4px; letter-spacing: .01em; }
h2 { font-size: 17px; margin: 28px 0 12px; }
h3 { font-size: 15px; margin: 20px 0 8px; }
.panel h2, .chart-head h2 { margin: 0 0 12px; }
.lead { color: var(--muted); margin: 0 0 16px; }
.meta, .muted { color: var(--muted); font-size: 13px; }
.na { color: var(--muted); }

/* ------------------------------------------------------------ header */
.top {
  position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px max(16px, calc((100vw - 1120px) / 2)); background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px); -webkit-backdrop-filter: saturate(1.4) blur(10px); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); white-space: nowrap; font-weight: 700; }
.brand img { border-radius: 8px; }
.brand b { color: var(--brand); }
.tabs { display: flex; gap: 2px; overflow-x: auto; flex: 1 1 auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  text-decoration: none; color: var(--muted); padding: 7px 14px; border-radius: 10px; white-space: nowrap; font-weight: 600; font-size: 14px;
}
.tabs a:hover { background: var(--surface-2); color: var(--text); }
.tabs a[aria-current="page"] { background: var(--brand-soft); color: var(--brand); }
.account { display: flex; align-items: center; gap: 8px; font-size: 14px; white-space: nowrap; }
.who { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--text); padding: 4px 4px 4px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.who .bal { font-weight: 700; color: var(--price); font-variant-numeric: tabular-nums; background: var(--surface-2); border-radius: 999px; padding: 2px 10px; }
@media (max-width: 680px) {
  .top { padding: 8px 12px 0; gap: 8px; }
  .tabs { order: 3; flex-basis: 100%; margin: 0 -12px; padding: 0 8px 6px; flex-wrap: wrap; overflow: visible; row-gap: 2px; }
  .tabs a { padding: 6px 11px; }
  .account { margin-left: auto; }
  .who-name { max-width: 9em; overflow: hidden; text-overflow: ellipsis; }
}

.banner { max-width: 1088px; margin: 12px auto 0; padding: 10px 14px; border-radius: var(--radius); background: #fff4e5; color: #7a4100; border: 1px solid #f5c88a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .banner { background: #2b1f0d; color: #f5c88a; border-color: #5c4216; } }

main { max-width: 1120px; margin: 0 auto; padding: 20px 16px; outline: none; min-height: 60vh; }
.page-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 4px; }
.loading { color: var(--muted); text-align: center; padding: 48px 0; display: flex; gap: 10px; justify-content: center; align-items: center; }
.spinner { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--line); border-top-color: var(--brand); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.empty { color: var(--muted); text-align: center; padding: 40px 16px; display: grid; justify-items: center; gap: 4px; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }
.empty p { margin: 6px 0 0; max-width: 34em; }
.none { color: var(--muted); margin: 4px 0; }
.count { color: var(--muted); font-size: 13px; margin: 4px 0 10px; }

/* ------------------------------------------------------------ item slots (inventory look) */
.slot {
  --s: 48px; flex: 0 0 auto; width: var(--s); height: var(--s); position: relative; display: grid; place-items: center;
  background: var(--slot); border-radius: 8px;
  box-shadow: inset 2px 2px 0 var(--slot-lo), inset -2px -2px 0 var(--slot-hi);
}
.slot img { width: 84%; height: 84%; object-fit: contain; image-rendering: auto; }
.slot.sm { --s: 34px; border-radius: 7px; box-shadow: inset 1px 1px 0 var(--slot-lo), inset -1px -1px 0 var(--slot-hi); }
.slot.lg { --s: 64px; }
.slot.xl { --s: 80px; border-radius: 12px; }
.slot.xl img, .slot.lg img { image-rendering: pixelated; }
.slot .letter {
  width: 78%; height: 78%; border-radius: 6px; display: grid; place-items: center; color: #fff; font-weight: 800;
  font-size: calc(var(--s) * .38); background: var(--c-misc); text-shadow: 0 1px 1px rgba(0, 0, 0, .35);
}
.slot .qty {
  position: absolute; right: 2px; bottom: 0; font-weight: 800; font-size: max(11px, calc(var(--s) * .26)); color: #fff; line-height: 1;
  text-shadow: 1px 1px 0 #3f3f3f, -1px 0 0 rgba(0,0,0,.35); font-variant-numeric: tabular-nums;
}
.slot.ench { isolation: isolate; overflow: hidden; }
.slot.ench::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; mix-blend-mode: screen; border-radius: inherit;
  background: linear-gradient(115deg, transparent 30%, rgba(178, 120, 255, .55) 45%, rgba(120, 80, 255, .25) 55%, transparent 70%);
  background-size: 250% 250%; animation: glint 3.2s linear infinite;
}
@keyframes glint { from { background-position: 120% 0; } to { background-position: -120% 0; } }
@media (prefers-reduced-motion: reduce) { .slot.ench::after { animation: none; background-position: 50% 0; } .spinner { animation-duration: 2s; } }
.cat-block { background: var(--c-block); } .cat-mineral { background: var(--c-mineral); } .cat-food { background: var(--c-food); }
.cat-fish { background: var(--c-fish); } .cat-tool { background: var(--c-tool); } .cat-armor { background: var(--c-armor); }
.cat-magic { background: var(--c-magic); } .cat-redstone { background: var(--c-redstone); } .cat-misc { background: var(--c-misc); }

/* ------------------------------------------------------------ toolbar, chips, buttons */
.toolbar { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin: 12px 0 10px; }
.listings-toolbar { grid-template-columns: minmax(0, 1fr) auto auto; }
.search { display: flex; gap: 8px; }
.search input { flex: 1; min-width: 0; }
input[type="search"], input[type="text"], input[type="number"], input[type="password"], select {
  border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 9px 12px; min-height: 44px; width: 100%;
}
select { padding-right: 32px; }
input:focus, select:focus { border-color: var(--brand); }
@media (max-width: 520px) { .toolbar { grid-template-columns: 1fr; } }
@media (max-width: 680px) {
  .listings-toolbar { grid-template-columns: 1fr 1fr; }
  .listings-toolbar .search { grid-column: 1 / -1; }
}
.chips { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 8px; margin-bottom: 6px; scrollbar-width: thin; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface); border-radius: 999px;
  padding: 6px 13px; white-space: nowrap; cursor: pointer; font-size: 14px; min-height: 36px;
}
.chip:hover { border-color: var(--brand); }
.chip[aria-pressed="true"] { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.chip .dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 8px 18px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 700; text-decoration: none; color: var(--text);
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn.primary:hover { background: var(--brand-2); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.btn.small { min-height: 36px; padding: 4px 14px; font-size: 14px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }

/* ------------------------------------------------------------ listing cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(236px, 1fr)); gap: 12px; }
@media (max-width: 520px) { .grid { grid-template-columns: 1fr 1fr; gap: 8px; } }
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: inherit; min-width: 0;
  transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--brand); transform: translateY(-1px); }
.card-top { display: flex; gap: 10px; align-items: center; min-width: 0; }
.card-title { min-width: 0; }
.card .name { font-weight: 700; line-height: 1.35; overflow-wrap: anywhere; }
.ench-line { color: #7c4dd6; font-size: 12px; overflow-wrap: anywhere; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ench-line { color: #c4a5ff; } }
.card-price { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin-top: auto; }
.card .price { font-size: 20px; font-weight: 800; color: var(--price); }
.card .unit { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.card-foot { display: flex; gap: 8px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--line); padding-top: 8px; flex-wrap: wrap; }
.card-foot span:first-child { font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 60%; }
.tag { font-size: 11px; background: var(--brand-soft); color: var(--brand); border-radius: 6px; padding: 0 6px; font-weight: 700; }
@media (max-width: 520px) {
  .card { padding: 10px; gap: 8px; }
  .card-top { flex-direction: column; align-items: flex-start; }
  .card .price { font-size: 18px; }
}

.pager { display: flex; gap: 12px; justify-content: center; align-items: center; margin: 20px 0; color: var(--muted); }

/* ------------------------------------------------------------ tables */
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
th, td { padding: 10px 14px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; vertical-align: middle; }
thead th { font-size: 12px; color: var(--muted); font-weight: 600; background: var(--surface-2); position: sticky; top: 0; }
th:first-child, td:first-child { text-align: left; }
tbody th { font-weight: 600; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child > * { border-bottom: none; }
.cell { display: flex; align-items: center; gap: 10px; }
.cell .nm { display: block; }
.sub { font-size: 12px; color: var(--muted); font-weight: 400; }
.cell .sub { display: block; }
.spark-cell { width: 120px; }
.spark { display: block; margin-left: auto; overflow: visible; }
.spark-line { fill: none; stroke: var(--muted); stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.spark-end { fill: var(--series-1); }
.stock-cell { min-width: 132px; }
.stock-text { font-size: 13px; }
.npc-trade-cell { text-align: left; }
.npc-trade-actions { display: flex; gap: 6px; }
.npc-trade-actions .btn { padding-inline: 9px; }
.meter { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; margin-top: 4px; }
.meter > span { display: block; height: 100%; border-radius: 99px; background: var(--brand); }
.meter.low > span { background: var(--danger); }
.table-view table tbody tr { cursor: default; }
@media (max-width: 680px) {
  th, td { padding: 9px 10px; }
  table.npc .spark-cell, table.npc th:nth-child(3) { display: none; }
  table.npc th, table.npc td { padding-inline: 4px; }
  table.npc th { white-space: normal; }
  table.npc tbody th { min-width: 80px; }
  table.npc tbody td { font-size: 13px; }
  table.npc .cell { gap: 5px; }
  table.npc .cell .nm, table.npc .cell .sub { overflow-wrap: anywhere; }
  table.npc .stock-cell { min-width: 0; }
  table.npc .stock-text { font-size: 12px; }
  .npc-trade-actions { flex-direction: column; }
  .npc-trade-actions .btn { font-size: 13px; padding-inline: 7px; }
}
@media (max-width: 520px) {
  table.npc .cell { flex-direction: column; align-items: flex-start; }
  table.npc .cell .sub { display: none; }
}

/* change badges: direction glyph + colour */
.chg { display: inline-block; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; border-radius: 6px; padding: 0 6px; line-height: 1.6; }
.chg.up { color: var(--up); background: color-mix(in srgb, var(--up) 12%, transparent); }
.chg.down { color: var(--down); background: color-mix(in srgb, var(--down) 12%, transparent); }
.chg.flat { color: var(--muted); }

/* ------------------------------------------------------------ panels, stats */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); margin-top: 16px; }
.panels { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; margin-top: 16px; }
.panels .panel { margin-top: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 10px; margin-top: 16px; }
.stat-tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); min-width: 0; }
.stat-label { color: var(--muted); font-size: 12px; display: flex; align-items: center; gap: 6px; }
.stat-value { font-size: 22px; font-weight: 700; margin-top: 2px; overflow-wrap: anywhere; }
.stat-extra { font-size: 12px; color: var(--muted); margin-top: 2px; min-height: 1.2em; }
@media (max-width: 520px) { .stats { grid-template-columns: 1fr 1fr; } .stat-value { font-size: 18px; } }
.key { display: inline-block; width: 14px; height: 3px; border-radius: 2px; background: var(--muted); flex: 0 0 auto; }
.key.series-1 { background: var(--series-1); } .key.series-2 { background: var(--series-2); } .key.series-3 { background: var(--series-3); }

.list { display: flex; flex-direction: column; gap: 8px; }
.list-item { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.list-item .grow { flex: 1; min-width: 0; }
.list-item .name { font-weight: 700; overflow-wrap: anywhere; }
.dimension-filters { align-items: end; }
.dimension-filters label { display: grid; gap: 4px; }
.dimension-groups { display: grid; gap: 16px; }
.dimension-group h2 { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; margin-bottom: 8px; }
.dimension-group h2 .meta { font-weight: 400; }
.dimension-actions { display: flex; flex-wrap: wrap; gap: 6px; }
@media (max-width: 680px) {
  .dimension-row { flex-wrap: wrap; }
  .dimension-row .dimension-actions { flex-basis: 100%; }
}
.notice { font-size: 14px; padding: 8px 10px; border-left: 3px solid var(--brand); background: var(--surface-2); border-radius: 0 8px 8px 0; }
.trades { list-style: none; margin: 0; padding: 0; }
.trades li { display: grid; grid-template-columns: 6em 1fr auto; gap: 8px; padding: 6px 0; border-bottom: 1px dashed var(--line); font-variant-numeric: tabular-nums; font-size: 14px; }
.trades li:last-child { border-bottom: none; }

/* ------------------------------------------------------------ item page */
.crumbs { display: flex; gap: 8px; align-items: center; font-size: 14px; color: var(--muted); margin-bottom: 12px; }
.item-head { display: flex; gap: 16px; align-items: center; }
.item-head h1 { margin: 0; }
.movers-panels { margin-bottom: 4px; }
.movers { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.movers a { display: grid; grid-template-columns: auto 1fr auto auto; gap: 10px; align-items: center; text-decoration: none; color: var(--text); padding: 6px 8px; border-radius: 10px; }
.movers a:hover { background: var(--surface-2); }
.movers .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.mv-price { font-variant-numeric: tabular-nums; font-size: 14px; }

/* ------------------------------------------------------------ chart */
.chart-panel { transition: opacity .2s; }
.chart-panel.refreshing { opacity: .55; }
.chart-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.chart-head h2 { margin: 0; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 5px 12px; border-radius: 8px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); min-height: 32px; }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.legend { list-style: none; display: flex; flex-wrap: wrap; gap: 6px 16px; padding: 0; margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.legend li { display: flex; align-items: center; gap: 6px; }
.legend .legend-note { margin-left: auto; font-size: 12px; }
.chart { position: relative; width: 100%; border-radius: 8px; }
.chart:focus-visible { outline-offset: 4px; }
.chart-svg { display: block; width: 100%; height: auto; overflow: visible; }
.chart-svg .grid { stroke: var(--grid); stroke-width: 1; }
.chart-svg .baseline { stroke: var(--line); stroke-width: 1; }
.chart-svg .axis { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart-svg .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-svg .line.series-1 { stroke: var(--series-1); } .chart-svg .line.series-2 { stroke: var(--series-2); } .chart-svg .line.series-3 { stroke: var(--series-3); }
.chart-svg .dot { stroke: var(--surface); stroke-width: 2; }
.chart-svg .dot.series-1 { fill: var(--series-1); } .chart-svg .dot.series-2 { fill: var(--series-2); } .chart-svg .dot.series-3 { fill: var(--series-3); }
.chart-svg .cross { stroke: var(--muted); stroke-width: 1; }
.chart-svg .hit { fill: transparent; cursor: crosshair; }
.tip {
  position: absolute; z-index: 2; pointer-events: none; background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 10px; box-shadow: 0 6px 24px rgba(0, 0, 0, .14); font-size: 13px; min-width: 150px;
}
.tip-time { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.tip-row { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.tip-row b { font-variant-numeric: tabular-nums; font-size: 14px; }
.tip-row span { color: var(--muted); }
.chart-empty { text-align: center; padding: 28px 12px; color: var(--muted); background: var(--surface-2); border-radius: 10px; }
.chart-empty p { margin: 4px 0; }
.table-view { margin-top: 10px; }
.table-view summary { cursor: pointer; color: var(--brand); font-weight: 600; font-size: 14px; }
.table-view .table-wrap { margin-top: 8px; max-height: 320px; overflow: auto; box-shadow: none; }

/* ------------------------------------------------------------ forms, login */
.form { display: grid; gap: 12px; }
.form label { display: grid; gap: 4px; font-size: 14px; font-weight: 600; }
.form .hint, .hint { color: var(--muted); font-size: 13px; font-weight: 400; margin: 0; }
.form .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.login { max-width: 460px; margin: 24px auto; }
.login-icons { display: flex; gap: 8px; margin-bottom: 12px; }
.code-input { font-size: 22px; letter-spacing: .12em; text-transform: uppercase; text-align: center; font-family: ui-monospace, monospace; }
.steps { padding-left: 1.3em; color: var(--muted); }
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; background: var(--surface-2); border-radius: 12px; margin: 4px 0 14px; }
.seg button { border: 0; background: transparent; border-radius: 9px; min-height: 40px; font-weight: 700; color: var(--muted); cursor: pointer; }
.seg button[aria-selected="true"] { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }
.pane .hint { margin-top: 12px; }
.pw { position: relative; display: block; }
.pw input { padding-right: 64px; }
.pw .reveal {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: var(--surface-2); color: var(--text);
  border-radius: 8px; min-height: 32px; padding: 0 10px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.cred { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0 0 4px; }
.cred dt { color: var(--muted); font-size: 13px; }
.cred dd { margin: 0; overflow-wrap: anywhere; }
.cred-body > .hint { margin-top: 10px; }
.callout {
  display: flex; align-items: center; justify-content: space-between; gap: 10px 14px; flex-wrap: wrap; margin-top: 16px; padding: 12px 14px;
  background: var(--brand-soft); border: 1px solid color-mix(in srgb, var(--brand) 30%, var(--line)); border-radius: var(--radius);
}
@media (max-width: 520px) { .form .two { grid-template-columns: 1fr; } }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 16px; }
.actions .btn { flex: 1 1 auto; }
.actions.end { justify-content: flex-end; margin-top: 28px; }
.actions.end .btn { flex: 0 0 auto; }

/* ------------------------------------------------------------ sheet */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, .42); z-index: 20; }
.sheet {
  position: fixed; z-index: 21; background: var(--surface); color: var(--text); overflow: auto;
  right: 0; top: 0; bottom: 0; width: min(480px, 100%); padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
  box-shadow: -8px 0 32px rgba(0, 0, 0, .2);
}
@media (max-width: 680px) {
  .sheet { top: auto; left: 0; width: 100%; max-height: 90vh; border-radius: 20px 20px 0 0; box-shadow: 0 -8px 32px rgba(0, 0, 0, .25); }
}
.sheet-head { display: flex; gap: 14px; align-items: center; margin: 4px 36px 12px 0; }
.sheet-head h2 { margin: 0; font-size: 19px; overflow-wrap: anywhere; }
.sheet .close { position: absolute; right: 12px; top: 10px; border: none; background: none; font-size: 28px; cursor: pointer; color: var(--muted); line-height: 1; padding: 4px 10px; border-radius: 8px; }
.sheet .close:hover { background: var(--surface-2); }
.big-price { font-size: 30px; font-weight: 800; color: var(--price); font-variant-numeric: tabular-nums; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; margin: 12px 0; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.ench-list, .lore { margin: 8px 0; padding: 0; list-style: none; }
.ench-list li { color: #7c4dd6; font-weight: 600; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ench-list li { color: #c4a5ff; } }
.lore li { color: var(--muted); font-size: 14px; }
.durability { margin: 8px 0; }

.toast {
  pointer-events: none;
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 30;
  background: #1d2a21; color: #fff; padding: 10px 16px; border-radius: 12px; max-width: calc(100% - 32px); box-shadow: var(--shadow);
}
.toast.err { background: #8a1c12; }
.foot { max-width: 1120px; margin: 32px auto 40px; padding: 16px 16px 0; color: var(--muted); font-size: 13px; border-top: 1px solid var(--line); }
.foot p { margin: 4px 0; }
.noscript { text-align: center; padding: 40px; }
.item-picker { min-width: 0; }
.item-suggestions { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(230px, 100%), 1fr)); gap: 6px; max-height: 260px; overflow-y: auto; }
.item-option { display: flex; align-items: center; gap: 8px; min-width: 0; text-align: left; border: 1px solid var(--line); border-radius: 9px; padding: 6px 10px; background: var(--surface); color: inherit; cursor: pointer; }
.item-option:hover, .item-option:focus-visible { border-color: var(--brand); }
.item-option > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.item-option small { display: block; color: var(--muted); font-size: 11px; }
.toolbar + .item-suggestions { margin: -2px 0 10px; }
.item-option.custom small { color: var(--brand); }
.attributes { padding-left: 20px; font-size: 14px; }
.unbreakable { color: #6c87e8; font-weight: 600; }

/* ------------------------------------------------------------ operator exchange: market event and guidance */
.badge.event { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 700; line-height: 1.6;
  vertical-align: 1px; color: var(--price); background: color-mix(in srgb, var(--price) 14%, transparent); border: 1px solid color-mix(in srgb, var(--price) 40%, transparent); }
.event-head .badge.event { margin-left: 0; }
.event-banner { border-color: color-mix(in srgb, var(--price) 45%, var(--line)); background: color-mix(in srgb, var(--price) 7%, var(--surface)); }
.event-banner p { margin: 6px 0 0; }
.event-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.event-head b { font-size: 17px; }
.npc-guide p { margin: 0; }
.npc-guide p + p { margin-top: 6px; }
