/* ============================================================
 * 《华强北捡漏王》 样式 —— 移动端竖屏 · 赛博市场风
 * ============================================================ */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
:root {
  --bg: #0d1120; --bg2: #151b30; --card: #1c2340; --card2: #232c4e;
  --line: #2e3a63; --txt: #e8ecf8; --sub: #8b96bd;
  --gold: #ffd75c; --cyan: #5ce1e6; --green: #7ec8a9; --red: #ff7d7d; --blue: #6aa9ff;
}
html, body { height: 100%; }
body {
  background: #05070f;
  font-family: -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--txt);
  display: flex; justify-content: center;
  user-select: none; -webkit-user-select: none;
}
#app {
  width: 100%; max-width: 480px; height: 100dvh;
  background: radial-gradient(1200px 500px at 50% -10%, #1a2450 0%, var(--bg) 55%);
  display: flex; flex-direction: column;
  position: relative; overflow: hidden;
}

/* ---------- 顶部状态栏 ---------- */
#topbar {
  padding: calc(8px + env(safe-area-inset-top)) 12px 8px;
  background: linear-gradient(180deg, rgba(21,27,48,.95), rgba(21,27,48,.75));
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(8px);
  z-index: 5;
}
.tb-row { display: flex; gap: 8px; }
.tb-row + .tb-row { margin-top: 5px; }
.tb-item {
  flex: 1; background: rgba(255,255,255,.05); border: 1px solid var(--line);
  border-radius: 8px; padding: 4px 8px; font-size: 12px; color: var(--sub);
  display: flex; align-items: center; gap: 4px; white-space: nowrap; overflow: hidden;
}
.tb-item b { color: var(--txt); font-size: 13px; margin-left: auto; }
.tb-item.day b { color: var(--gold); }
.tb-item.debt b { color: var(--red); }
.tb-item.worth b { color: var(--cyan); }

/* ---------- 主内容 ---------- */
#screen {
  flex: 1; overflow-y: auto; padding: 12px;
  scrollbar-width: none;
}
#screen::-webkit-scrollbar { display: none; }
.foot-space { height: 16px; }

.sec-title {
  margin: 16px 2px 8px; font-size: 14px; font-weight: 700;
  display: flex; align-items: baseline; gap: 8px;
}
.sec-title small { font-weight: 400; color: var(--sub); font-size: 11px; }

/* ---------- 卡片 ---------- */
.card {
  background: linear-gradient(160deg, var(--card), var(--card2));
  border: 1px solid var(--line); border-radius: 14px;
  padding: 12px; margin-bottom: 10px;
}
.list .card:active { transform: scale(.985); }
.list .card { cursor: pointer; transition: transform .1s; }

.empty { text-align: center; color: var(--sub); padding: 24px 0; font-size: 13px; line-height: 1.8; }
.empty-inline { color: var(--sub); font-size: 12px; }
.tip { color: var(--sub); font-size: 12px; line-height: 1.6; margin: 6px 0; }
.pos { color: var(--green); } .neg { color: var(--red); }
.gain { color: var(--gold); font-weight: 600; }

/* ---------- 悬赏横幅 ---------- */
.bounty {
  display: flex; align-items: center; gap: 10px;
  background: linear-gradient(90deg, #3a2c10, #4d3a12);
  border: 1px solid #8a6d2f; border-radius: 12px;
  padding: 10px 12px; margin-bottom: 10px; cursor: pointer;
}
.bounty span { font-size: 12px; color: var(--gold); }
.bounty b { flex: 1; font-size: 14px; }
.bounty em { font-style: normal; font-size: 12px; color: var(--gold); font-weight: 700; }
.bounty.done { opacity: .55; filter: grayscale(.4); }

/* ---------- 事件 chips ---------- */
.ev-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip {
  background: rgba(92,225,230,.1); border: 1px solid rgba(92,225,230,.35);
  color: var(--txt); border-radius: 20px; padding: 4px 10px; font-size: 12px;
}
.chip.ev { border-color: #8a6d2f; background: rgba(255,215,92,.08); }
.chip.ev i { font-style: normal; color: var(--gold); margin-left: 3px; font-size: 10px; }
.chip.on { background: var(--cyan); color: #06222a; font-weight: 700; }
.chip.buyer { cursor: pointer; border-color: var(--line); background: var(--card); }
.chip.buyer:active { transform: scale(.94); }

/* ---------- 卖家卡 ---------- */
.seller-head { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 42px; height: 42px; border-radius: 50%; flex-shrink: 0;
  background: radial-gradient(circle at 30% 30%, #3a4a80, #1a2244);
  display: flex; align-items: center; justify-content: center; font-size: 22px;
  border: 1px solid var(--line);
}
.avatar.big { width: 52px; height: 52px; font-size: 28px; }
.seller-head b { font-size: 15px; }
.seller-head small { display: block; color: var(--sub); font-size: 11px; margin-top: 2px; }
.line { color: var(--sub); font-size: 12px; margin-top: 8px; font-style: italic; }
.line.big { font-size: 13px; text-align: center; margin: 4px 0 10px; }

.tag {
  display: inline-block; background: rgba(106,169,255,.15); color: var(--blue);
  border-radius: 6px; padding: 2px 8px; font-size: 11px; margin: 2px 2px 2px 0;
}
.tag.danger { background: rgba(255,125,125,.15); color: var(--red); }
.tag.ok { background: rgba(126,200,169,.15); color: var(--green); }

/* ---------- 盲盒 ---------- */
.boxes .box { display: flex; align-items: center; gap: 10px; }
.box-icon { font-size: 28px; }
.box-icon.big { font-size: 40px; }
.box b { font-size: 14px; }
.box small { display: block; color: var(--sub); font-size: 11px; margin-top: 2px; }
.box-right { margin-left: auto; text-align: right; }
.box-right em { display: block; font-style: normal; color: var(--gold); font-weight: 700; }
.box-right small { margin-top: 2px; }

.buyer-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }

/* ---------- 按钮 ---------- */
.btn {
  display: block; width: 100%; padding: 12px; border: none; border-radius: 12px;
  background: var(--card2); color: var(--txt); font-size: 14px; font-weight: 600;
  cursor: pointer; border: 1px solid var(--line);
}
.btn:active { transform: scale(.97); }
.btn.primary { background: linear-gradient(90deg, #2f6df6, #28b7d8); border: none; color: #fff;
  box-shadow: 0 4px 14px rgba(47,109,246,.35); }
.btn.danger { background: rgba(255,125,125,.15); border-color: rgba(255,125,125,.4); color: var(--red); }
.btn.big { padding: 14px; font-size: 15px; margin-top: 12px; }
.btn[disabled] { opacity: .45; }
.ghostbtn { opacity: .8; }
.modal-btns { display: flex; gap: 8px; margin-top: 12px; }
.modal-btns .btn { flex: 1; }

.mini {
  padding: 7px 10px; border-radius: 9px; border: 1px solid var(--line);
  background: rgba(255,255,255,.06); color: var(--txt); font-size: 12px; cursor: pointer;
}
.mini:active { transform: scale(.95); }
.mini[disabled] { opacity: .35; }
.mini.gold { border-color: rgba(255,215,92,.45); color: var(--gold); background: rgba(255,215,92,.08); }
.mini.buy { border-color: rgba(126,200,169,.5); color: var(--green); background: rgba(126,200,169,.1); font-weight: 700; }

/* ---------- 弹窗 ---------- */
#modal-root { position: absolute; inset: 0; z-index: 20; pointer-events: none; }
#modal-root.open { pointer-events: auto; }
.modal-mask {
  position: absolute; inset: 0; background: rgba(3,6,16,.72);
  display: flex; align-items: flex-end; justify-content: center;
  backdrop-filter: blur(3px);
  animation: fadein .18s;
}
@keyframes fadein { from { opacity: 0; } }
.modal {
  width: 100%; max-height: 88dvh; overflow-y: auto;
  background: linear-gradient(180deg, #1e2748, #161d38);
  border: 1px solid var(--line); border-bottom: none;
  border-radius: 20px 20px 0 0; padding: 16px 14px calc(18px + env(safe-area-inset-bottom));
  animation: slideup .22s ease-out; scrollbar-width: none;
}
.modal::-webkit-scrollbar { display: none; }
@keyframes slideup { from { transform: translateY(60px); opacity: .4; } }
.modal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.modal-head b { font-size: 16px; flex: 1; }
.modal-head small { display: block; color: var(--sub); font-size: 11px; margin-top: 2px; font-weight: 400; }
.x {
  width: 30px; height: 30px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--card); color: var(--sub); font-size: 13px; cursor: pointer; flex-shrink: 0;
}

/* ---------- 洽谈单条 ---------- */
.deal-item {
  background: rgba(255,255,255,.04); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px; margin-top: 10px;
}
.di-head { display: flex; align-items: center; gap: 10px; }
.picon { font-size: 26px; flex-shrink: 0; }
.picon.big { font-size: 40px; }
.di-name { flex: 1; min-width: 0; }
.di-name b { font-size: 14px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.di-name small { color: var(--sub); font-size: 11px; }
.ask { font-size: 16px; font-weight: 800; color: var(--gold); }
.claim { font-size: 12px; color: var(--sub); margin: 6px 0; }
.known { font-size: 12px; color: var(--cyan); margin: 4px 0; line-height: 1.5; }
.est { font-size: 12px; color: var(--gold); margin: 6px 0; }
.di-btns { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.haggle-info { color: var(--sub); font-size: 11px; display: block; margin-top: 6px; }
.ip-bar {
  background: rgba(92,225,230,.1); border: 1px solid rgba(92,225,230,.3);
  border-radius: 8px; padding: 6px 10px; font-size: 12px; margin-top: 8px;
}
.ip-bar b { color: var(--cyan); }

/* ---------- 选项列表 ---------- */
.pick-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.pick-item {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255,255,255,.04); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px; cursor: pointer;
}
.pick-item:active, .pick-item.sel { border-color: var(--cyan); background: rgba(92,225,230,.08); }
.pick-item.disabled { opacity: .4; pointer-events: none; }
.pick-item b { font-size: 13px; display: block; }
.pick-item small { color: var(--sub); font-size: 11px; }
.pick-item em { margin-left: auto; font-style: normal; color: var(--gold); font-weight: 700; font-size: 13px; }

/* ---------- 道德选择 ---------- */
.ethics { display: flex; gap: 8px; margin-top: 10px; }
.eth {
  flex: 1; border-radius: 12px; padding: 10px; cursor: pointer; text-align: left;
  border: 1px solid; background: rgba(255,255,255,.04); color: var(--txt);
}
.eth b { display: block; font-size: 13px; margin-bottom: 4px; }
.eth small { font-size: 11px; line-height: 1.5; color: var(--sub); }
.eth.honest { border-color: rgba(126,200,169,.5); }
.eth.lie { border-color: rgba(255,125,125,.45); }
.eth:active { transform: scale(.97); }
.eth u { color: var(--red); }

/* ---------- 结果弹窗 ---------- */
.result { text-align: center; padding: 6px 4px; }
.r-icon { font-size: 52px; margin-bottom: 8px; }
.result h3 { margin-bottom: 8px; font-size: 18px; }
.result p { font-size: 13px; color: var(--sub); line-height: 1.7; margin: 6px 0; }
.result .btn { margin-top: 14px; }
.result.intro .intro-line { text-align: left; background: rgba(255,255,255,.04);
  border-left: 3px solid var(--gold); border-radius: 0 8px 8px 0;
  padding: 8px 10px; margin: 8px 0; font-size: 13px; }
.day-summary p { text-align: left; }

/* ---------- 库存 ---------- */
.inv-head { font-size: 13px; color: var(--sub); margin-bottom: 10px; }
.inv-item .di-btns { margin-top: 8px; }

input[type=number] {
  width: 100%; padding: 12px; border-radius: 10px; font-size: 16px;
  background: rgba(255,255,255,.06); border: 1px solid var(--line);
  color: var(--txt); margin-top: 8px; outline: none;
}

/* ---------- 店铺 ---------- */
.stall-card .btn { margin-top: 10px; }
.staff-card .mini, .card .mini { margin-top: 8px; }

/* ---------- 图鉴 ---------- */
.cat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cat-item {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 6px; text-align: center; cursor: pointer;
}
.cat-item .picon { font-size: 26px; display: block; margin-bottom: 4px; }
.cat-item b { font-size: 11px; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cat-item small { font-size: 10px; color: var(--sub); }
.cat-item.unseen { opacity: .55; }
.cat-item.locked { filter: grayscale(.8); }
.museum-item { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.museum-item span { font-size: 24px; }
.museum-item b { font-size: 13px; display: block; }
.museum-item small { color: var(--sub); font-size: 11px; }

/* ---------- 我的 ---------- */
.me-cards { display: flex; gap: 8px; margin-bottom: 10px; }
.me-card {
  flex: 1; background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px; text-align: center;
}
.me-card small { display: block; color: var(--sub); font-size: 11px; margin-bottom: 4px; }
.me-card b { font-size: 15px; color: var(--cyan); }
.debt-card .di-btns { margin-top: 8px; }

.ci-row { display: flex; gap: 5px; margin-bottom: 8px; }
.ci-day {
  flex: 1; background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 6px 2px; text-align: center;
}
.ci-day small { display: block; font-size: 9px; color: var(--sub); }
.ci-day span { font-size: 16px; display: block; margin: 2px 0; }
.ci-day b { font-size: 9px; font-weight: 400; color: var(--sub); display: block; white-space: nowrap; overflow: hidden; }
.ci-day.claimed { border-color: var(--green); opacity: .75; }
.ci-day.next { border-color: var(--gold); box-shadow: 0 0 8px rgba(255,215,92,.25); }

.task { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.task:last-child { border-bottom: none; }
.task > div { flex: 1; }
.task b { font-size: 13px; }
.task small { display: block; color: var(--sub); font-size: 11px; margin: 2px 0 4px; }
.task.done b { color: var(--gold); }
.bar { height: 5px; background: rgba(255,255,255,.08); border-radius: 3px; overflow: hidden; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), #ff9d5c); border-radius: 3px; }

.ad-card { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; cursor: pointer; }
.ad-card em { margin-left: auto; font-style: normal; color: var(--cyan); font-size: 18px; }
.ad-card.off { opacity: .45; }
.ad-card b { font-size: 13px; }
.ad-card small { display: block; color: var(--sub); font-size: 11px; margin-top: 2px; }

.lb-card { padding: 6px 12px; }
.lb-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line); }
.lb-row:last-of-type { border-bottom: none; }
.lb-row span { width: 22px; text-align: center; color: var(--sub); font-size: 12px; }
.lb-row:nth-child(1) span, .lb-row:nth-child(2) span, .lb-row:nth-child(3) span { color: var(--gold); font-weight: 800; }
.lb-row b { flex: 1; font-size: 13px; }
.lb-row em { font-style: normal; font-size: 12px; color: var(--cyan); font-weight: 700; }
.lb-row.me b, .lb-row.me em { color: var(--gold); }

.rebirth.off { opacity: .55; }
.rebirth .btn { margin-top: 8px; }
.log-card { padding: 8px 12px; }
.log-line { font-size: 12px; color: var(--sub); padding: 5px 0; border-bottom: 1px dashed var(--line); line-height: 1.5; }
.log-line:last-child { border-bottom: none; }
.log-line small { color: var(--gold); margin-right: 6px; }

/* ---------- 广告弹窗 ---------- */
.ad-screen {
  background: linear-gradient(135deg, #2a1e5c, #14486b);
  border-radius: 14px; height: 170px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  position: relative; overflow: hidden;
}
.ad-screen::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.12) 45%, transparent 60%);
  animation: shine 2.2s infinite;
}
@keyframes shine { from { transform: translateX(-100%);} to { transform: translateX(100%);} }
.ad-logo { font-size: 44px; animation: bounce 1.4s infinite ease-in-out; }
@keyframes bounce { 0%,100% { transform: translateY(0);} 50% { transform: translateY(-8px);} }
.ad-screen b { font-size: 15px; }
.ad-screen small { color: var(--sub); font-size: 11px; }
.ad-screen em {
  position: absolute; top: 10px; right: 12px; font-style: normal;
  background: rgba(0,0,0,.5); border-radius: 8px; padding: 2px 10px;
  font-size: 14px; font-weight: 800; color: var(--gold);
}
.ad-bar { height: 6px; background: rgba(255,255,255,.1); border-radius: 3px; margin: 12px 0 4px; overflow: hidden; }
.ad-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--cyan), var(--green)); transition: width 1s linear; }
.ad-box .btn { margin-top: 10px; }

/* ---------- 开箱 ---------- */
.box-items { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }

/* ---------- Toast ---------- */
#toast {
  position: absolute; left: 50%; bottom: 110px; transform: translateX(-50%) translateY(20px);
  background: rgba(10,14,28,.92); border: 1px solid var(--line);
  color: var(--txt); padding: 10px 18px; border-radius: 24px;
  font-size: 13px; opacity: 0; pointer-events: none; z-index: 50;
  transition: all .25s; max-width: 86%; text-align: center;
  border: 1px solid var(--cyan);
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { border-color: var(--red); }
#toast.ok { border-color: var(--green); }

/* ---------- 底部导航 ---------- */
.tabbar {
  display: flex; border-top: 1px solid var(--line);
  background: rgba(13,17,32,.96); backdrop-filter: blur(10px);
  padding-bottom: env(safe-area-inset-bottom); z-index: 5;
}
.tabbar button {
  flex: 1; padding: 8px 0 6px; border: none; background: none;
  color: var(--sub); font-size: 20px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.tabbar button span { font-size: 10px; }
.tabbar button.on { color: var(--gold); }
.tabbar button:active { transform: scale(.93); }

@media (min-width: 481px) {
  #app { box-shadow: 0 0 60px rgba(0,0,0,.6); }
}
