:root {
  --bg: #101418;
  --card: #1a2128;
  --line: #2c3640;
  --text: #e8eef4;
  --muted: #8b9aab;
  --accent: #3d9cf0;
  --good: #3dd68c;
  --bad: #f07178;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Noto Sans KR", "Malgun Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
}
header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 18px 22px 10px;
  border-bottom: 1px solid var(--line);
}
h1 { margin: 0; font-size: 22px; }
.sub { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.header-actions, .controls, .filters {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.controls { padding: 10px 22px 0; }
label { font-size: 13px; color: var(--muted); }
label.check { display: flex; align-items: center; gap: 6px; }
input, select {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 16px;
}
input[type=number] { width: 72px; }
button {
  background: var(--accent);
  color: #061018;
  border: 0;
  border-radius: 6px;
  padding: 8px 12px;
  font-weight: 700;
  cursor: pointer;
}
button.ghost {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--line);
}
button.tab {
  background: transparent;
  color: var(--muted);
  font-weight: 600;
}
button.tab.on { color: var(--text); border-bottom: 2px solid var(--accent); border-radius: 0; }
nav { padding: 0 22px; border-bottom: 1px solid var(--line); margin-top: 8px; }
.panel { display: none; padding: 16px 22px 40px; }
.panel.on { display: block; }
.filters { margin-bottom: 12px; }
.filters input { min-width: 260px; flex: 1; }
.table-wrap { overflow: auto; max-height: calc(100vh - 320px); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left; }
th { position: sticky; top: 0; background: #151b21; color: var(--muted); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.good { color: var(--good); }
.bad { color: var(--bad); }
.status-line { font-size: 12px; color: var(--muted); margin: 8px 22px 0; }
.prog-wrap { padding: 10px 22px 0; }
.prog-track { height: 8px; background: var(--card); border-radius: 99px; overflow: hidden; }
.prog-bar { height: 100%; width: 0; background: var(--accent); transition: width .2s linear; }
#progText { display: inline-block; margin-top: 6px; font-size: 12px; color: var(--muted); }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 10px;
}
.card h3 { margin: 0; }
.mats { color: var(--muted); font-size: 13px; }
.stats { display: flex; gap: 18px; margin-top: 8px; flex-wrap: wrap; }
.muted { color: var(--muted); }
.row-click { cursor: pointer; }
.row-click:hover { background: #222b33; }
.icon { width: 32px; height: 32px; vertical-align: middle; margin-right: 8px; }
td.name { display: flex; align-items: center; gap: 6px; }
.card-top { display: flex; gap: 10px; align-items: center; }
.card-top .icon { width: 56px; height: 56px; }
.mats .icon { width: 22px; height: 22px; margin-right: 4px; }
.sep { margin: 0 8px; color: var(--muted); }
.star {
  background: transparent;
  color: var(--muted);
  padding: 0 4px;
  font-size: 16px;
}
.star.on { color: #f5c84c; }
.modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; overflow: auto;
}
.modal[hidden] { display: none; }
.modal-card {
  width: min(760px, 100%);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 18px;
}
.modal-card h2 { margin: 0 0 8px; }
.kv { width: 100%; margin-top: 10px; }
.ov-price {
  width: 96px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.ov-price:focus { border-color: var(--accent); outline: none; }
.badge {
  font-size: 11px;
  color: #f5c84c;
  border: 1px solid #f5c84c55;
  border-radius: 4px;
  padding: 1px 5px;
  margin-left: 4px;
}
h3 .ghost { margin-left: 8px; font-size: 12px; padding: 4px 8px; }
.note { font-size: 12px; color: var(--muted); margin-top: 6px; }
.ver {
  font-size: 13px;
  color: var(--accent);
  font-weight: 700;
  margin-left: 8px;
}
.block-title { margin: 18px 0 8px; font-size: 15px; }
.card.slim { padding: 10px 14px; }
.price-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.price-form input.price-in, .city-price { width: 110px; text-align: right; }
.price-form select.city-mini { width: 140px; }
button.mini { padding: 5px 8px; font-size: 12px; }
.city-price {
  width: 110px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.card-top { justify-content: flex-start; flex-wrap: wrap; }
.card-top-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.fav-bldg {
  font-size: 12px;
  font-weight: 700;
  color: #f5c84c;
  border: 1px solid #f5c84c66;
  background: #f5c84c14;
  border-radius: 999px;
  padding: 4px 10px;
  white-space: nowrap;
}
.fav-inline { color: #f5c84c; }

.type-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 8px 0 4px;
}
.chip {
  background: var(--card);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.chip.on {
  color: #061018;
  background: var(--accent);
  border-color: var(--accent);
}
.ench-row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 8px 0 4px; }
.ench-row .chip:disabled { opacity: 0.35; }

.pwa-hint {
  margin: 8px 22px 0;
  padding: 10px 12px;
  background: #1e2a36;
  border: 1px solid #3d9cf055;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}
.share-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 10px;
}
.type-bar { padding-left: 22px; padding-right: 22px; }

@media (max-width: 820px) {
  header { padding: 12px 12px 8px; }
  h1 { font-size: 18px; }
  .controls, .status-line, .prog-wrap, .panel { padding-left: 12px; padding-right: 12px; }
  nav { padding: 0 12px; }
  .type-bar { padding-left: 12px; padding-right: 12px; }
  .pwa-hint { margin-left: 12px; margin-right: 12px; }
  .filters input { min-width: 0; width: 100%; }
  input[type=number] { width: 64px; }
  .table-wrap { max-height: none; overflow: visible; }
  table thead { display: none; }
  #rankBody tr {
    display: grid;
    grid-template-columns: 36px 1fr auto;
    gap: 2px 8px;
    padding: 10px 8px;
    border-bottom: 1px solid var(--line);
    align-items: center;
  }
  #rankBody td { border: 0; padding: 0; }
  #rankBody .c-star { grid-column: 1; grid-row: 1 / span 2; }
  #rankBody td.name { grid-column: 2; grid-row: 1; font-weight: 700; }
  #rankBody .c-profit { grid-column: 3; grid-row: 1; font-size: 16px; font-weight: 700; }
  #rankBody .c-rate { grid-column: 3; grid-row: 2; }
  #rankBody .c-cat, #rankBody .c-tier { grid-column: 2; grid-row: 2; display: inline; color: var(--muted); font-size: 12px; }
  #rankBody .c-tier::before { content: " · "; }
  #rankBody .c-cost,
  #rankBody .c-sell,
  #rankBody .c-tax,
  #rankBody .c-path,
  #rankBody .c-vol { display: none; }
  .modal { padding: 8px; align-items: stretch; }
  .modal-card { width: 100%; min-height: 100%; border-radius: 8px; }
  button { min-height: 40px; }
  .chip { min-height: 34px; }
}


.stale { color: #c0392b; }
#reviewList table { width: 100%; }
.gap { display:inline-block; margin-left:6px; padding:0 6px; border-radius:8px; font-size:11px; color:#b7791f; background:rgba(214,158,46,.18); white-space:nowrap; cursor:help; }
th.sortable { cursor:pointer; user-select:none; }
th.sortable::after { content: attr(data-arrow); color:#d4af37; }
th.sorted { color:#d4af37; }

.age { font-size: 0.85em; margin-left: 4px; }
