/* ============================================================
   怪谈操盘手 —— 暗黑平面主题
   直角、细边、低饱和、无渐变无阴影
   ============================================================ */

:root {
  --bg: #07080a;
  --surface: #0e0f12;
  --surface-2: #15161a;
  --line: #232529;
  --line-strong: #34373c;

  --text: #d6d8dc;
  --text-dim: #a4a8af;
  --muted: #6a6f78;

  --accent: #a8453f;
  --gold: #b3915a;

  --red: #a8453f;
  --green: #4f7f63;
  --blue: #4a6795;
  --purple: #71558c;
  --cyan: #3d7373;

  --tier-common: #6f747c;
  --tier-rare: #4a6795;
  --tier-danger: #a07a44;
  --tier-forbidden: #a8453f;
  --tier-abyss: #71558c;
  --tier-concept: #3d7373;

  --f-urban: #4a6795;
  --f-cult: #71558c;
  --f-mech: #4f7f63;
  --f-taboo: #a8453f;

  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC",
    "Microsoft YaHei", sans-serif;
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  overscroll-behavior: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
}

input {
  font: inherit;
}

/* ============ 外壳 ============ */
.app {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg);
}

@media (min-width: 520px) {
  .app {
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }
}

/* ============ 顶栏 ============ */
.topbar {
  flex: none;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.funds-label {
  display: block;
  font-size: 11px;
  letter-spacing: 1.5px;
  color: var(--muted);
  margin-bottom: 3px;
}

.funds-value {
  font-family: var(--mono);
  font-size: 23px;
  font-weight: 500;
  line-height: 1.2;
  color: var(--gold);
  letter-spacing: -0.3px;
}

.meta {
  text-align: right;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.8;
  letter-spacing: 0.3px;
}

.meta .rank {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
  letter-spacing: 0.5px;
}

/* ============ 屏幕 ============ */
main {
  flex: 1;
  overflow: hidden;
}

.screen {
  display: none;
  height: 100%;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 16px 28px;
}

.screen.active {
  display: block;
}

/* ============ 底部导航 ============ */
.tabbar {
  flex: none;
  display: flex;
  background: var(--bg);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}

.tab {
  flex: 1;
  position: relative;
  padding: 13px 0;
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--muted);
}

.tab.active {
  color: var(--text);
}

.tab.active::after {
  content: "";
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--accent);
}

/* ============ 标题 ============ */
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 9px;
  margin-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.section-head h2,
h2.h2 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 2px;
  color: var(--text);
}

.section-head .count,
h2 .count {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.5px;
  color: var(--muted);
}

.mt-10 {
  margin-top: 8px;
}

.mt-24 {
  margin-top: 28px;
}

/* ============ 按钮 ============ */
.btn {
  display: block;
  width: 100%;
  padding: 13px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background: transparent;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 1px;
  text-align: center;
  transition: background 0.12s, color 0.12s, border-color 0.12s;
}

.btn:active {
  background: var(--surface-2);
  color: var(--text);
}

.btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.btn-sm {
  width: auto;
  padding: 6px 12px;
  font-size: 11px;
  letter-spacing: 0.5px;
}

.btn-accent {
  border-color: #5c2a27;
  background: #1a1214;
  color: #c98d88;
}

.btn-accent:active {
  background: #241618;
  color: #e0b0ab;
}

.btn-danger {
  border-color: #5c2a27;
  color: #c98d88;
}

.btn-long {
  border-color: #4a2a28;
  color: #b8837e;
}

.btn-short {
  border-color: #2a4535;
  color: #7ba58d;
}

.btn-row {
  display: flex;
  gap: 8px;
}

/* ============ 情报 ============ */
.news {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: var(--surface);
  border-left: 2px solid var(--accent);
  padding: 11px 12px;
  font-size: 13px;
  line-height: 1.65;
  color: var(--text-dim);
  margin-bottom: 22px;
}

.news-tag {
  flex: none;
  font-size: 11px;
  letter-spacing: 1px;
  color: var(--accent);
  padding-top: 2px;
}

/* ============ 说明 ============ */
.tips {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  font-size: 13px;
  line-height: 1.7;
  color: var(--muted);
}

.tips li {
  padding-left: 12px;
  border-left: 1px solid var(--line);
}

.tips b {
  color: var(--text-dim);
  font-weight: 500;
}

/* ============ 阶位 ============ */
.level-card {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 13px;
}

.level-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  letter-spacing: 0.5px;
  color: var(--text-dim);
}

.level-row span:last-child {
  flex: none;
  font-size: 11px;
  color: var(--muted);
  text-align: right;
}

.level-card .heat-bar {
  margin: 10px 0 0;
}

.level-card .heat-bar i {
  width: 0;
  background: var(--accent);
  opacity: 0.9;
}

.level-hint {
  font-size: 11px;
  line-height: 1.7;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-top: 8px;
}

/* ============ 行情 ============ */
.market {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 13px;
  margin-bottom: 8px;
}

.market-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dot {
  width: 5px;
  height: 5px;
  flex: none;
  display: inline-block;
}

.market-name {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 1px;
  color: var(--text);
}

.market-heat {
  font-family: var(--mono);
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.3px;
}

.heat-bar {
  height: 2px;
  background: var(--surface-2);
  overflow: hidden;
  margin: 10px 0 9px;
}

.heat-bar i {
  display: block;
  height: 100%;
  transition: width 0.3s linear;
  opacity: 0.75;
}

.market-foot {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-bottom: 11px;
}

/* ============ 陈列室 ============ */
.vault-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 7px;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 10px;
}

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.tier {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 1.5px;
  padding: 1px 5px;
  border: 1px solid currentColor;
  background: transparent !important;
  line-height: 1.6;
}

.faction {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  letter-spacing: 0.5px;
  color: var(--muted);
  white-space: nowrap;
}

.card-name {
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  color: var(--text);
}

.card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: auto;
  padding-top: 4px;
  border-top: 1px solid var(--line);
}

.card-value {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--gold);
  letter-spacing: -0.2px;
}

.affix {
  background: var(--surface-2);
  border-left: 1px solid var(--line-strong);
  padding: 7px 8px;
}

.affix-name {
  font-size: 11px;
  letter-spacing: 0.8px;
  color: var(--gold);
}

.affix-desc {
  font-size: 11px;
  line-height: 1.55;
  color: var(--muted);
  margin-top: 3px;
}

.affix-bar {
  height: 2px;
  background: #26282c;
  overflow: hidden;
  margin-top: 7px;
}

.affix-bar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--green);
}

.locked {
  background: var(--surface-2);
  border-left: 1px solid var(--accent);
  padding: 8px;
  text-align: center;
}

.locked .btn {
  display: block;
  width: 100%;
}

.locked p {
  font-size: 11px;
  letter-spacing: 0.5px;
  color: #b8837e;
  margin-bottom: 7px;
}

.empty {
  grid-column: 1 / -1;
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--muted);
  padding: 40px 0;
  text-align: center;
  border: 1px solid var(--line);
}

/* ============ 拍卖行 ============ */
.seg {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.seg-btn {
  flex: 1;
  padding: 10px 6px;
  background: transparent;
  border: 1px solid var(--line);
  font-size: 12px;
  letter-spacing: 1px;
  color: var(--muted);
}

.seg-btn.active {
  border-color: var(--line-strong);
  background: var(--surface-2);
  color: var(--text);
}

.seg-btn:disabled {
  opacity: 0.35;
}

.room {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 13px;
  margin-bottom: 8px;
}

.room-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.room-name {
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 1px;
  color: var(--text);
}

.room-fee {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--gold);
}

.room-tiers {
  font-size: 11px;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-top: 5px;
}

.room-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.room-status {
  font-size: 11px;
  letter-spacing: 0.5px;
}

.room-status.ok {
  color: var(--green);
}

.room-status.lock {
  color: #a0706c;
}

/* 密室 */
.lot {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 16px;
  text-align: center;
}

.lot-tier {
  font-size: 10px;
  letter-spacing: 3px;
}

.lot-name {
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 1px;
  margin: 8px 0 16px;
  line-height: 1.4;
  color: var(--text);
}

.lot-meta {
  display: flex;
  justify-content: space-around;
  gap: 8px;
  font-size: 11px;
  letter-spacing: 0.5px;
  color: var(--muted);
  padding: 11px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.lot-meta b {
  font-weight: 500;
  color: var(--text-dim);
}

.lot-range {
  font-size: 11px;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-top: 12px;
}

.lot-range b {
  font-family: var(--mono);
  font-weight: 400;
  color: var(--gold);
  letter-spacing: 0;
}

.lot-bidders {
  font-size: 11px;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-top: 8px;
}

.lot-bidders span {
  color: var(--text-dim);
  margin-left: 8px;
}

.supply-box {
  margin-top: 12px;
  padding-top: 11px;
  border-top: 1px solid var(--line);
  text-align: left;
}

.supply-head {
  font-size: 11px;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-bottom: 8px;
}

.supply-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.supply-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 11px;
  letter-spacing: 0.5px;
  color: var(--muted);
  text-align: left;
}

.supply-chip.active {
  border-color: #5c2a27;
  background: #1a1214;
  color: var(--text);
}

.supply-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-dim);
}

.supply-chip.active .supply-name {
  color: var(--text);
}

.supply-meta {
  flex: none;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--gold);
}

.bid-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 13px;
  margin-top: 8px;
}

.bid-top {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-bottom: 10px;
}

.bid-top b {
  font-family: var(--mono);
  font-weight: 400;
  color: var(--gold);
  letter-spacing: 0;
}

.bid-row {
  display: flex;
  gap: 8px;
}

.bid-row input {
  flex: 1;
  min-width: 0;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 0;
  padding: 11px;
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  text-align: center;
  outline: none;
  appearance: none;
}

.bid-row input:focus {
  border-color: var(--line-strong);
}

.bid-row input::placeholder {
  color: #4a4e55;
  font-family: inherit;
  font-size: 12px;
  letter-spacing: 1px;
}

.bid-row .btn {
  width: auto;
  flex: none;
  padding: 0 18px;
}

.log {
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 13px;
  margin-top: 8px;
  font-size: 12px;
  line-height: 1.9;
  color: var(--muted);
}

.log b {
  font-weight: 500;
  letter-spacing: 1px;
  color: var(--text-dim);
}

.log .num {
  font-family: var(--mono);
}

.log .win {
  color: #7ba58d;
}

.log .lose {
  color: #b8837e;
}

.log .warn {
  color: #b8837e;
}

/* ============ 提示 ============ */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(74px + env(safe-area-inset-bottom));
  transform: translate(-50%, 10px);
  width: max-content;
  max-width: calc(100% - 32px);
  background: #0b0c0e;
  border: 1px solid var(--line-strong);
  padding: 11px 15px;
  font-size: 12px;
  line-height: 1.8;
  letter-spacing: 0.5px;
  text-align: center;
  white-space: pre-line;
  color: var(--text-dim);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s, transform 0.16s;
  z-index: 50;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* 收益飘字 */
.float-gain {
  position: absolute;
  right: 10px;
  top: 8px;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--green);
  pointer-events: none;
  animation: floatUp 1s ease-out forwards;
}

@keyframes floatUp {
  0% {
    opacity: 0.9;
    transform: translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateY(-12px);
  }
}
