:root {
  --brand: #ff7a00;
  --brand-dark: #e86a00;
  --bg: #f5f6f7;
  --card: #ffffff;
  --text: #1f2329;
  --muted: #8a9099;
  --line: #eceef0;
  --green: #00b578;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

#app { max-width: 560px; margin: 0 auto; min-height: 100vh; background: var(--bg); }

/* top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--brand);
  color: #fff; padding: 14px 16px;
  display: flex; align-items: center; gap: 10px;
}
.topbar .logo { font-size: 20px; font-weight: 700; }
.topbar .spacer { flex: 1; }
.topbar .nav-btn {
  background: rgba(255,255,255,.2); border: none; color: #fff;
  padding: 6px 12px; border-radius: 8px; font-size: 14px; cursor: pointer;
}
.topbar .nav-btn.active { background: rgba(255,255,255,.32); }
.back-btn { background: rgba(255,255,255,.2); border: none; color: #fff; font-size: 14px; padding: 6px 10px; border-radius: 8px; cursor: pointer; }

/* slogan */
.slogan { text-align: center; padding: 9px 16px; font-size: 13px; color: var(--muted); background: #fff; }

/* theme banner */
.theme-banner { padding: 10px 16px; font-size: 14px; color: #92400e; background: #fff7ed; border-bottom: 1px solid #fed7aa; text-align: center; }
.theme-banner b { color: #ea8600; }

/* carbon & title & early badges */
.card .carbon { margin-top: 6px; font-size: 12px; color: var(--green); }
.u-title { color: var(--brand); font-size: 12px; font-weight: 600; }
.badge-early { color: #b45309; font-size: 12px; }
.board-hint { text-align: center; color: var(--muted); font-size: 12px; margin-top: 8px; }

/* board */
.board-row { display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.board-row .rank { width: 28px; height: 28px; border-radius: 50%; background: #eef0f2; color: var(--muted); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; flex: none; }
.board-row .rank.top { background: var(--brand); color: #fff; }
.board-row .u-points { margin-left: auto; font-weight: 800; color: var(--brand); font-size: 16px; flex: none; }

/* apply list */
.app-list { padding: 12px 16px; }
.app-list h3 { font-size: 15px; margin-bottom: 10px; }
.app-row { background: #fff; border-radius: 12px; padding: 12px 14px; margin-bottom: 10px; display: flex; align-items: center; gap: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.app-row .u-main { flex: 1; }
.app-row.muted { opacity: .6; }
.app-row .status-tag { font-size: 12px; color: var(--muted); flex: none; }


/* tabs */
.tabs { display: flex; background: #fff; border-bottom: 1px solid var(--line); }
.tab {
  flex: 1; border: none; background: none; padding: 13px 0; font-size: 15px; cursor: pointer;
  color: var(--muted); position: relative;
}
.tab.active { color: var(--brand); font-weight: 700; }
.tab.active::after {
  content: ''; position: absolute; left: 50%; transform: translateX(-50%); bottom: 0;
  width: 28px; height: 3px; border-radius: 3px; background: var(--brand);
}

/* search */
.search-bar { padding: 12px 16px; background: #fff; border-bottom: 1px solid var(--line); display: flex; gap: 8px; }
.search-bar input {
  flex: 1; border: 1px solid var(--line); border-radius: 10px;
  padding: 9px 12px; font-size: 14px; outline: none; background: var(--bg);
}
.search-bar button {
  border: none; background: var(--brand); color: #fff; border-radius: 10px;
  padding: 0 16px; font-size: 14px; cursor: pointer;
}

/* category chips */
.chips { display: flex; gap: 8px; padding: 12px 16px; overflow-x: auto; background: #fff; border-bottom: 1px solid var(--line); }
.chip {
  flex: none; border: 1px solid var(--line); background: #fff; color: var(--text);
  padding: 6px 14px; border-radius: 999px; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.chip.active { background: var(--brand); color: #fff; border-color: var(--brand); }

/* item list */
.list { padding: 12px 16px 90px; }
.card {
  background: var(--card); border-radius: 14px; overflow: hidden; margin-bottom: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06); cursor: pointer; transition: transform .08s;
}
.card:active { transform: scale(.99); }
.card .thumb { width: 100%; height: 180px; object-fit: cover; background: #eef0f2; display: block; }
.card .thumb.placeholder { display: flex; align-items: center; justify-content: center; font-size: 48px; color: #c7ccd4; }
.card .body { padding: 12px 14px; }
.card .title { font-size: 16px; font-weight: 600; line-height: 1.4; }
.card .meta { margin-top: 8px; display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.card .tag { background: #fff3e8; color: var(--brand); padding: 2px 8px; border-radius: 6px; font-size: 12px; }
.card .status { margin-left: auto; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 6px; }
.card .status.available { background: #e6f9f0; color: var(--green); }
.card .status.claimed { background: #f0f1f3; color: var(--muted); }

/* auth */
.auth { padding: 60px 24px; }
.auth .brand { text-align: center; margin-bottom: 32px; }
.auth .brand .big { font-size: 30px; font-weight: 800; color: var(--brand); }
.auth .brand .sub { color: var(--muted); font-size: 14px; margin-top: 6px; }
.auth .card { padding: 24px; }
.auth h2 { font-size: 20px; margin-bottom: 20px; }
.auth label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
.auth input { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 12px; font-size: 15px; outline: none; }
.auth input:focus { border-color: var(--brand); }
.auth .btn { width: 100%; margin-top: 20px; border: none; border-radius: 10px; background: var(--brand); color: #fff; font-size: 16px; font-weight: 600; padding: 13px; cursor: pointer; }
.auth .btn:active { background: var(--brand-dark); }
.auth .switch { text-align: center; margin-top: 16px; font-size: 14px; color: var(--muted); }
.auth .switch a { color: var(--brand); cursor: pointer; }
.agree-line { display: flex; align-items: flex-start; gap: 6px; font-size: 13px; color: var(--muted); margin: 12px 0 6px; }
.agree-line input { margin-top: 2px; }
.agree-line a { color: var(--brand); cursor: pointer; }
.disclaimer-text { max-height: 60vh; overflow-y: auto; font-size: 14px; line-height: 1.7; color: #3a3f46; }
.disclaimer-text p { margin-bottom: 8px; }
.invite-hint { margin-top: 10px; padding: 8px 12px; background: #fff7ee; border-radius: 8px; font-size: 13px; color: var(--brand-dark); }
.invite-desc { font-size: 14px; color: var(--muted); margin-bottom: 10px; }
.invite-link { font-size: 13px; color: var(--brand); word-break: break-all; background: var(--bg); padding: 10px; border-radius: 8px; margin-bottom: 14px; }

/* detail */
.detail { padding-bottom: 90px; }
.detail .img { width: 100%; height: 280px; object-fit: cover; background: #eef0f2; }
.detail .img.placeholder { display: flex; align-items: center; justify-content: center; font-size: 72px; color: #c7ccd4; }
.detail .content { padding: 16px; }
.detail .title { font-size: 22px; font-weight: 700; line-height: 1.4; }
.detail .price { margin-top: 10px; font-size: 22px; font-weight: 800; color: var(--brand); }
.detail .info { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; font-size: 13px; color: var(--muted); }
.detail .info .tag { background: #f0f1f3; padding: 4px 10px; border-radius: 6px; }
.detail .contact-box { margin-top: 14px; padding: 12px 14px; background: #fff7ee; border-radius: 10px; font-size: 15px; color: var(--brand-dark); }
.detail .desc { margin-top: 20px; }
.detail .desc h3 { font-size: 15px; margin-bottom: 8px; }
.detail .desc p { font-size: 15px; line-height: 1.7; color: #3a3f46; white-space: pre-wrap; }
.detail .owner { margin-top: 20px; padding: 14px; background: #fff; border-radius: 12px; display: flex; align-items: center; gap: 10px; }
.detail .avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 18px; flex: none; }
.detail .owner .name { font-size: 15px; font-weight: 600; }
.detail .owner .time { font-size: 12px; color: var(--muted); margin-top: 2px; }
.report-link { margin-top: 16px; text-align: center; }
.report-link a { color: var(--muted); font-size: 13px; cursor: pointer; }

/* bottom action */
.actionbar {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 560px; background: #fff; border-top: 1px solid var(--line);
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  display: flex; gap: 10px;
}
.actionbar .btn { flex: 1; border: none; border-radius: 12px; font-size: 16px; font-weight: 600; padding: 14px; cursor: pointer; }
.actionbar .btn.primary { background: var(--brand); color: #fff; }
.actionbar .btn.primary:disabled { background: #ffc18a; }
.actionbar .btn.ghost { background: var(--bg); color: var(--text); }
.actionbar .btn.ghost.on { background: #fff3e8; color: var(--brand); }

/* post form */
.postform { padding: 16px; }
.postform .field { margin-bottom: 16px; }
.postform label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.postform input, .postform textarea, .postform select {
  width: 100%; border: 1px solid var(--line); border-radius: 10px;
  padding: 12px; font-size: 15px; outline: none; background: #fff; font-family: inherit;
}
.postform textarea { min-height: 100px; resize: vertical; }
.postform .img-preview { margin-top: 8px; }
.postform .img-preview img { width: 100%; max-height: 220px; object-fit: cover; border-radius: 10px; }
.loc-btn { margin-top: 8px; border: 1px solid var(--brand); background: #fff; color: var(--brand); border-radius: 8px; padding: 8px 14px; font-size: 14px; cursor: pointer; width: 100%; }
.loc-btn:disabled { opacity: .6; }
.loc-status { margin-top: 6px; font-size: 13px; color: var(--muted); }

/* conversations */
.convo { display: flex; gap: 12px; padding: 14px; background: #fff; border-radius: 12px; margin-bottom: 10px; cursor: pointer; align-items: center; }
.convo .avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 20px; flex: none; }
.convo-main { flex: 1; min-width: 0; }
.convo-top { display: flex; justify-content: space-between; align-items: center; }
.convo-top .name { font-size: 15px; font-weight: 600; }
.convo-top .time { font-size: 12px; color: var(--muted); }
.convo-item { font-size: 13px; color: var(--brand); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.convo-last { font-size: 14px; color: var(--muted); margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* user directory */
.user-row { display: flex; gap: 12px; padding: 14px; background: #fff; border-radius: 12px; margin-bottom: 10px; cursor: pointer; align-items: center; }
.user-row .avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--brand); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 20px; flex: none; }
.u-main { flex: 1; min-width: 0; }
.u-name { font-size: 15px; font-weight: 600; }
.u-sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.u-chat { flex: none; border: 1px solid var(--brand); color: var(--brand); border-radius: 8px; padding: 6px 14px; font-size: 13px; }

/* chat */
.chat-body { padding: 16px; display: flex; flex-direction: column; gap: 10px; min-height: 60vh; }
.msg { max-width: 75%; }
.msg.mine { align-self: flex-end; }
.msg.theirs { align-self: flex-start; }
.msg .bubble { padding: 10px 14px; border-radius: 14px; font-size: 15px; line-height: 1.5; word-break: break-word; }
.msg.mine .bubble { background: var(--brand); color: #fff; border-bottom-right-radius: 4px; }
.msg.theirs .bubble { background: #fff; color: var(--text); border-bottom-left-radius: 4px; }
.msg-time { font-size: 11px; color: var(--muted); margin-top: 4px; }
.msg.mine .msg-time { text-align: right; }
.chat-input {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 560px; background: #fff; border-top: 1px solid var(--line);
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); display: flex; gap: 8px;
}
.chat-input input { flex: 1; border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; font-size: 15px; outline: none; background: var(--bg); }
.chat-input button { border: none; background: var(--brand); color: #fff; border-radius: 10px; padding: 0 18px; font-size: 15px; cursor: pointer; }

/* report modal */
.overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50;
  display: flex; align-items: center; justify-content: center; padding: 24px;
}
.modal { background: #fff; border-radius: 16px; padding: 20px; width: 100%; max-width: 400px; }
.modal h3 { font-size: 18px; margin-bottom: 16px; }
.reasons { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.reason { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 8px 14px; font-size: 14px; cursor: pointer; }
.reason.sel { background: var(--brand); color: #fff; border-color: var(--brand); }
.modal textarea { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 10px; font-size: 14px; outline: none; min-height: 70px; resize: vertical; font-family: inherit; margin-bottom: 14px; }
.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn { flex: 1; border: none; border-radius: 10px; font-size: 15px; font-weight: 600; padding: 12px; cursor: pointer; }
.modal-actions .btn.primary { background: var(--brand); color: #fff; }
.modal-actions .btn.ghost { background: var(--bg); color: var(--text); }
.modal { position: relative; }
.modal-close { position: absolute; top: 10px; right: 12px; border: none; background: transparent; font-size: 26px; line-height: 1; color: var(--muted); cursor: pointer; padding: 4px 8px; }
.modal-dismiss { display: block; width: 100%; margin-top: 14px; border: none; background: transparent; color: var(--muted); font-size: 14px; cursor: pointer; padding: 6px; }

/* empty */
.empty { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty .emoji { font-size: 48px; }
.empty p { margin-top: 12px; font-size: 15px; }

/* fab */
.fab {
  position: fixed; bottom: 24px; right: 50%; transform: translateX(50%);
  margin-right: calc(-280px + 20px);
  width: 52px; height: 52px; border-radius: 50%; border: none;
  background: var(--brand); color: #fff; font-size: 28px; cursor: pointer;
  box-shadow: 0 4px 12px rgba(255,122,0,.4); z-index: 30;
}
@media (max-width: 560px) { .fab { right: 20px; transform: none; margin-right: 0; } }

/* toast */
#toast {
  position: fixed; top: 20px; left: 50%; transform: translateX(-50%) translateY(-20px);
  background: #32363d; color: #fff; padding: 10px 18px; border-radius: 10px;
  font-size: 14px; opacity: 0; pointer-events: none; transition: all .25s; z-index: 99; max-width: 80%;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.err { background: #e5484d; }

/* points badge */
.topbar .points { background: rgba(255,255,255,.22); padding: 4px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; }

/* admin */
.admin-row { background: #fff; border-radius: 12px; padding: 14px; margin-bottom: 10px; }
.a-top { display: flex; align-items: center; gap: 8px; }
.a-name { font-size: 15px; font-weight: 700; }
.a-info { font-size: 13px; color: var(--muted); margin-top: 6px; line-height: 1.6; }
.a-actions { margin-top: 10px; display: flex; gap: 8px; }
.a-btn { border: 1px solid var(--line); background: #fff; border-radius: 8px; padding: 7px 14px; font-size: 13px; cursor: pointer; }
.a-btn.danger { color: #e5484d; border-color: #f3c4c6; }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 6px; }
.b-ok { background: #e6f9f0; color: var(--green); }
.b-banned { background: #fdeaea; color: #e5484d; }
.b-pending { background: #fff3e8; color: var(--brand); }
.b-admin { background: #eef1ff; color: #4a5de0; }
.sensitive-msg { border-left: 3px solid #e5484d; }
.a-time { font-size: 12px; color: var(--muted); margin-left: auto; flex: none; }
.a-msg-text { font-size: 14px; color: var(--text); margin-top: 8px; line-height: 1.5; word-break: break-all; }
.sensitive-hit { color: #e5484d; font-weight: 600; }
.a-filter { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.a-filter .a-count { font-size: 13px; color: var(--muted); }
.a-btn.on { background: #fff3e8; color: var(--brand); border-color: var(--brand); }
