:root {
  --bg: #f4eddf;
  --card: #ece3d1;
  --card-border: #d8cab0;
  --text: #4a3b28;
  --muted: #8a7a62;
  --tag: #ddd2bc;
  --gold-1: #f7d977;
  --gold-2: #e5ae37;
  --gold-text: #5a3d0c;
  --price: #c4561c;
  --lead: #e5ae37;
  --danger: #c0392b;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[v-cloak] { display: none; }

html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  min-height: 100vh;
}
button, input, select { font: inherit; color: inherit; }

/* ---------- 通用控件 ---------- */
.btn {
  border: 1px solid #c99a2e;
  background: linear-gradient(180deg, var(--gold-1), var(--gold-2));
  color: var(--gold-text);
  font-weight: 600;
  border-radius: 6px;
  padding: 0 12px;
  height: 34px;
  white-space: nowrap;
  cursor: pointer;
}
.btn:active { filter: brightness(.95); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.plain { background: #f8f3e8; border-color: var(--card-border); color: var(--text); font-weight: 400; }
.btn.block { width: 100%; height: 42px; font-size: 16px; }

.input {
  border: 1px solid #cdbd9e;
  background: #fbf7ef;
  border-radius: 6px;
  height: 34px;
  padding: 0 10px;
  outline: none;
  min-width: 0;
}
.input:focus { border-color: var(--gold-2); box-shadow: 0 0 0 2px rgba(229, 174, 55, .2); }

.link { background: none; border: 0; padding: 0; color: var(--muted); text-decoration: underline; cursor: pointer; }

#toast {
  position: fixed; left: 50%; top: 40%; transform: translate(-50%, -50%);
  background: rgba(40, 32, 20, .88); color: #fff; padding: 10px 16px; border-radius: 8px;
  font-size: 14px; max-width: 80vw; text-align: center;
  opacity: 0; pointer-events: none; transition: opacity .2s; z-index: 100;
}
#toast.show { opacity: 1; }

/* ---------- 顶部 ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  background: var(--bg);
  border-bottom: 1px solid var(--card-border);
  padding: 8px 12px 6px;
}
.topbar .row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.topbar .alliance { font-weight: 700; font-size: 16px; }
.topbar .date {
  border: 1px solid var(--card-border); background: #f8f3e8; border-radius: 14px;
  height: 28px; padding: 0 10px; font-size: 13px;
}
.topbar .summary {
  margin-top: 6px; font-size: 13px; background: var(--card);
  border: 1px solid var(--card-border); border-radius: 6px; padding: 4px 8px;
  display: flex; justify-content: space-between; align-items: center;
}
.summary b { color: var(--price); font-size: 15px; }
.summary .me { background: none; border: 0; color: var(--muted); padding: 0; cursor: pointer; }

.round-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 8px;
}
.round-tab {
  border: 1px solid var(--card-border); background: #f8f3e8; border-radius: 8px;
  padding: 8px 10px; text-align: left; cursor: pointer; color: var(--muted);
}
.round-tab.on {
  background: linear-gradient(180deg, var(--gold-1), var(--gold-2));
  border-color: #c99a2e; color: var(--gold-text);
}
.round-tab .rt-title { font-weight: 700; font-size: 14px; }
.round-tab .rt-meta { font-size: 12px; margin-top: 2px; opacity: .9; }
.round-tab .rt-status {
  display: inline-block; margin-left: 4px; padding: 0 5px; border-radius: 4px;
  font-size: 11px; background: rgba(0,0,0,.08);
}
.round-tab.on .rt-status { background: rgba(90, 61, 12, .12); }
.round-tab.ended .rt-status { color: var(--danger); }

.cat-bar {
  display: flex; gap: 6px; overflow-x: auto; padding: 8px 0 2px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.cat-bar::-webkit-scrollbar { display: none; }
.cat-chip {
  flex: none; border: 1px solid var(--card-border); background: #f8f3e8;
  border-radius: 14px; height: 28px; padding: 0 12px; font-size: 13px;
  color: var(--muted); cursor: pointer;
}
.cat-chip.on {
  background: linear-gradient(180deg, var(--gold-1), var(--gold-2));
  border-color: #c99a2e; color: var(--gold-text); font-weight: 600;
}
.subfilters { display:flex; gap:6px; overflow-x:auto; padding:2px 0 4px; }
.filter-select { border:1px solid var(--card-border); background:#f8f3e8; border-radius:6px; height:28px; padding:0 6px; color:var(--muted); font-size:12px; }
.sound-toggle {
  display:flex; align-items:center; gap:8px; width:100%; min-height:40px;
  border:1px solid transparent; border-radius:8px; background:transparent;
  color:var(--muted); font-size:13px; padding:6px 10px; text-align:left;
  cursor:pointer; touch-action:manipulation; user-select:none;
}
.sound-toggle:active { background:#e9dec9; }
.sound-toggle.on { color:var(--text); }
.sound-check {
  display:inline-flex; align-items:center; justify-content:center; flex:none;
  width:22px; height:22px; border:2px solid #b8a98c; border-radius:4px;
  background:#f8f3e8; color:transparent; font-size:16px; line-height:1;
}
.sound-toggle.on .sound-check { border-color:#1682d4; background:#1682d4; color:#fff; }

/* ---------- 物品卡片 ---------- */
.list { padding: 8px 10px 40px; max-width: 640px; margin: 0 auto; }
.card {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-left: 4px solid var(--card-border);
  border-radius: 8px;
  padding: 8px 8px 8px 6px;
  margin-bottom: 8px;
}
.card.lead { border-left-color: var(--lead); }
.card.pinned { order: -1; box-shadow: 0 0 0 1px var(--gold-2); }
.card.closed { opacity: .65; }
.card .thumb {
  width: 56px; height: 56px; border-radius: 8px; object-fit: cover;
  background: #d9cdb5; border: 1px solid rgba(0, 0, 0, .08);
}
.card .info { min-width: 0; }
.card .name { font-weight: 700; font-size: 15px; line-height: 1.3; white-space: normal; overflow-wrap: anywhere; }
.card .tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.tag { background: var(--tag); border-radius: 4px; padding: 0 6px; font-size: 12px; line-height: 20px; color: #6b5a40; }
.tag.qty { background: #f3dfa5; color: var(--gold-text); font-weight: 600; }
.tag.pin { background: #f0c36a; color: #5a3b08; font-weight: 700; }
.tag.proxy { background: #dcebd8; color: #3e6844; }
.tag.affix { background: #f6e7bd; color: var(--gold-text); }
.affix-wrap { margin-top: 4px; min-width: 0; }
.card .affix-tags { margin-top: 0; display: grid; grid-template-columns: repeat(2, minmax(0, max-content)); }
.card .affix-tags .tag { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.card .side { min-width: 0; display: grid; gap: 6px; align-items: center; justify-items: end; }
.card .top { font-size: 14px; min-height: 20px; white-space: nowrap; transition: background .3s; border-radius: 4px; padding: 0 4px; }
.card .side .top { text-align: right; }
.card .top .who { color: var(--text); margin-right: 4px; max-width: 6em; overflow: hidden; text-overflow: ellipsis; display: inline-block; vertical-align: bottom; }
.card .top .amount { color: var(--price); font-weight: 700; font-size: 16px; }
.card .top .none { color: var(--price); font-weight: 700; }
.card .top.flash { background: #ffe39a; }
.card .bid { display: flex; gap: 4px; }
.card .bid .input { width: 62px; height: 32px; min-width: 0; padding: 0 6px; }
.card .bid .btn { height: 32px; padding: 0 8px; font-size: 13px; white-space: nowrap; }

.empty { text-align: center; color: var(--muted); padding: 60px 0; }

/* ---------- 状态页 / 登录页 ---------- */
.panel {
  max-width: 380px; margin: 12vh auto 0; padding: 24px 20px;
  background: var(--card); border: 1px solid var(--card-border); border-radius: 12px;
}
.panel h1 { margin: 0 0 4px; font-size: 22px; text-align: center; }
.panel .sub { text-align: center; color: var(--muted); margin-bottom: 18px; }
.panel .field { margin-bottom: 12px; }
.panel .field label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.panel .field .input { width: 100%; height: 40px; font-size: 15px; }
.panel .row { display: flex; gap: 8px; }
.panel .row .input { flex: 1; }
.panel .foot { margin-top: 14px; display: flex; justify-content: space-between; color: var(--muted); font-size: 13px; }

.tabs { display: flex; background: #e2d7c1; border-radius: 8px; padding: 3px; margin-bottom: 16px; }
.tabs button {
  flex: 1; border: 0; background: none; height: 34px; border-radius: 6px; cursor: pointer; color: var(--muted);
}
.tabs button.on { background: linear-gradient(180deg, var(--gold-1), var(--gold-2)); color: var(--gold-text); font-weight: 600; }

/* ---------- 弹窗 ---------- */
.mask {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .35); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.dialog { background: var(--bg); border-radius: 12px; padding: 18px; width: 100%; max-width: 340px; }
.dialog h3 { margin: 0 0 12px; font-size: 16px; }
.dialog-label { display: block; color: var(--muted); font-size: 12px; margin: 10px 0 4px; }
.dialog .input { width: 100%; height: 40px; }
.dialog-hint { color: var(--muted); font-size: 12px; line-height: 1.5; margin-top: 6px; }
.dialog .actions { display: flex; gap: 8px; margin-top: 14px; }
.dialog .actions .btn { flex: 1; height: 38px; }

@media (max-width: 480px) {
  .list { padding: 6px 8px 28px; }
  .card { grid-template-columns: 44px minmax(0, 1fr) auto; gap: 6px; padding: 6px 6px 6px 4px; margin-bottom: 6px; }
  .card .thumb { width: 44px; height: 44px; border-radius: 6px; }
  .card .name { font-size: 14px; line-height: 1.2; }
  .card .tags { gap: 3px; margin-top: 2px; }
  .tag { padding: 0 5px; font-size: 11px; line-height: 18px; }
  .affix-wrap { margin-top: 2px; }
  .card .side { gap: 3px 5px; }
  .card .top { min-height: 18px; font-size: 13px; }
  .card .top .amount { font-size: 15px; }
  .card .bid { gap: 3px; }
  .card .bid .input, .card .bid .btn { height: 30px; }
  .card .bid .input { width: 52px; padding: 0 5px; font-size: 13px; }
  .card .bid .btn { padding: 0 6px; font-size: 12px; }
}

@media (max-width: 360px) {
  .card { grid-template-columns: 40px minmax(0, 1fr) auto; gap: 5px; }
  .card .thumb { width: 40px; height: 40px; }
  .card .bid .input { width: 46px; padding: 0 4px; }
}
