
/* ------------------------------------------------------------------ */
/* 設計 tokens                                                          */
/* 單欄手機 App：首頁 = 兩個圓形按鈕（求帶=珊瑚 / 幫帶=湖水綠）             */
/* 流程：首頁 → 買/帶 → 地區 → 結構化表單                                  */
/* ------------------------------------------------------------------ */
:root {
  --field-control-gap: 7px;
  --form-field-gap: 18px;
  --app-viewport-height: 100vh;
  --bg: #F5EFE3;
  --surface: #FFFCF4;
  --surface-2: #EFE7D8;
  --fg: #2B2418;
  --muted: #85785F;
  --line: #E3D8C3;
  --ask: #D9482F;
  --ask-deep: #B93A24;
  --ask-ink: #B23A24;
  --ask-soft: #FBE9E2;
  --offer: #0C7A5B;
  --offer-deep: #096348;
  --offer-ink: #0A5F47;
  --offer-soft: #E1F0E8;
  --danger: #B23A24;
  --shadow: 0 1px 2px rgba(75,55,25,.06), 0 10px 24px -12px rgba(75,55,25,.20);
  --glow-ask: rgba(217,72,47,.40);
  --glow-offer: rgba(12,122,91,.40);
  --font-display: "Noto Sans TC","PingFang TC","Heiti TC","Microsoft JhengHei",sans-serif;
  --font-body: "Noto Sans TC","PingFang TC","Heiti TC","Microsoft JhengHei",sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17140E;
    --surface: #211D15;
    --surface-2: #2C2619;
    --fg: #F1EADB;
    --muted: #A2957B;
    --line: #3A3224;
    --ask: #EF6A4F;
    --ask-deep: #C9503A;
    --ask-ink: #F9A48E;
    --ask-soft: #3A2219;
    --offer: #2FA980;
    --offer-deep: #1E8A66;
    --offer-ink: #7ED3B2;
    --offer-soft: #143027;
    --danger: #F06A54;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 12px 28px -14px rgba(0,0,0,.6);
    --glow-ask: rgba(239,106,79,.45);
    --glow-offer: rgba(47,169,128,.45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #17140E;
  --surface: #211D15;
  --surface-2: #2C2619;
  --fg: #F1EADB;
  --muted: #A2957B;
  --line: #3A3224;
  --ask: #EF6A4F;
  --ask-deep: #C9503A;
  --ask-ink: #F9A48E;
  --ask-soft: #3A2219;
  --offer: #2FA980;
  --offer-deep: #1E8A66;
  --offer-ink: #7ED3B2;
  --offer-soft: #143027;
  --danger: #F06A54;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 12px 28px -14px rgba(0,0,0,.6);
  --glow-ask: rgba(239,106,79,.45);
  --glow-offer: rgba(47,169,128,.45);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { min-height: 100%; }
@supports (height: 100dvh) {
  :root { --app-viewport-height: 100dvh; }
}
body {
  min-height: 100vh;
  min-height: var(--app-viewport-height, 100vh);
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
.wrap {
  max-width: 540px;
  min-height: 100vh;
  min-height: var(--app-viewport-height, 100vh);
  margin: 0 auto;
  padding: 0 16px;
  padding-block: calc(env(safe-area-inset-top,0px) + 20px) calc(env(safe-area-inset-bottom,0px) + 96px);
  overflow-anchor: none;
}
h1, h2, p { margin: 0; }
h1, h2 { font-weight: 900; }
button { font-family: inherit; }
button, input, textarea { -webkit-tap-highlight-color: transparent; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
[hidden] { display: none !important; }

.access-locked { overflow: hidden; }
.access-locked .wrap, .access-locked .tabbar, .access-locked #toast { display: none !important; }
.access-gate {
  display: none;
  min-height: 100vh;
  min-height: var(--app-viewport-height, 100vh);
  box-sizing: border-box;
  padding: calc(env(safe-area-inset-top, 0px) + 24px) 20px calc(env(safe-area-inset-bottom, 0px) + 24px);
  align-items: center;
  justify-content: center;
}
.access-locked .access-gate { display: flex; }
.access-gate-card {
  width: min(100%, 400px);
  box-sizing: border-box;
  padding: 34px 30px 26px;
  border: 1px solid var(--line);
  border-radius: 26px;
  background: var(--surface);
  box-shadow: 0 20px 60px rgba(24, 38, 62, .12);
}
.access-gate-heading { margin-bottom: 28px; text-align: center; }
.access-gate-card h1 { display: grid; gap: 2px; margin: 0 0 12px; color: var(--fg); font-family: var(--font-display); line-height: 1.16; }
.access-gate-card h1 span:first-child { font-size: 32px; letter-spacing: -.025em; }
.access-gate-card h1 span:last-child { font-size: 34px; }
.access-gate-heading > p { color: var(--muted); font-size: 14px; }
.access-gate-card label { display: block; margin-bottom: var(--field-control-gap); color: var(--fg); font-size: 14px; font-weight: 700; }
.access-gate-card input { display: block; width: 100%; height: 48px; box-sizing: border-box; margin: 0 0 var(--form-field-gap); padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; outline: none; background: var(--surface); color: var(--fg); font: inherit; font-size: 17px; letter-spacing: .22em; text-align: center; }
.access-gate-card input:focus { border-color: var(--ask); box-shadow: 0 0 0 3px var(--ask-soft); }
.access-gate-card .submit { width: 100%; background: var(--ask); box-shadow: 0 8px 18px var(--glow-ask); }
.access-gate-card .submit:hover { background: var(--ask-deep); }
.access-gate-error { min-height: 1.5em; margin-top: 12px; color: #b42318; font-size: 14px; }
@media (max-width: 380px) {
  .access-gate-card { padding: 30px 22px 22px; }
  .access-gate-card h1 span:first-child { font-size: 29px; }
  .access-gate-card h1 span:last-child { font-size: 31px; }
}

/* ---------- 首頁：只有兩個圓形按鈕 ---------- */
#view-home {
  min-height: calc(100vh - 116px);
  min-height: calc(var(--app-viewport-height, 100vh) - env(safe-area-inset-top,0px) - env(safe-area-inset-bottom,0px) - 116px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}
@media (max-width: 600px) {
  #view-home { margin-bottom: 120px; }
}
.hero { text-align: center; margin-bottom: 40px; }
.hero h1 {
  font-family: var(--font-display);
  font-size: 34px;
  line-height: 1.2;
}
.hero .tag {
  margin: 10px auto 0;
  font-size: 14px;
  color: var(--muted);
  letter-spacing: .04em;
}

.doorways { display: flex; justify-content: center; align-items: center; gap: min(5vw, 20px); }
.door {
  position: relative;
  width: min(42vw, 188px);
  aspect-ratio: 1;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #FFF8F3;
  transition: transform .12s ease, box-shadow .12s ease;
}
.door:active { transform: scale(.965); }
.door.ask {
  background: radial-gradient(circle at 32% 26%, var(--ask), var(--ask-deep) 78%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.28),
    inset 0 -10px 24px rgba(0,0,0,.14),
    0 16px 34px -14px var(--glow-ask);
}
.door.offer {
  background: radial-gradient(circle at 32% 26%, var(--offer), var(--offer-deep) 78%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.28),
    inset 0 -10px 24px rgba(0,0,0,.14),
    0 16px 34px -14px var(--glow-offer);
}
.door:focus-visible { outline: 3px solid var(--fg); outline-offset: 4px; }
.door-role {
  position: absolute; top: 18px; left: 18px;
  padding: 4px 9px; border: 1px solid rgba(255,255,255,.42); border-radius: 999px;
  color: #fff; font-size: 12px; font-weight: 700; letter-spacing: .04em;
}
.door .chars {
  writing-mode: vertical-rl;
  font-family: var(--font-display);
  font-weight: 900;
  font-size: 18px;
  letter-spacing: .06em;
  line-height: 1.4;
}

.foot { margin-top: 34px; font-size: 12px; color: var(--muted); text-align: center; line-height: 1.7; }

/* ---------- 子頁共用標頭 ---------- */
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.back {
  border: 0; background: var(--surface-2); color: var(--fg);
  width: 38px; height: 38px; border-radius: 12px; cursor: pointer;
  display: grid; place-items: center; font-size: 18px;
}
.eyebrow { font-size: 12px; letter-spacing: .18em; color: var(--muted); }
.page-head h2 { font-family: var(--font-display); font-size: 23px; line-height: 1.25; }
.lead { margin-bottom: 18px; font-size: 14px; color: var(--muted); }

/* ---------- 選項清單（類型 / 地區共用） ---------- */
.opt-list { display: grid; gap: 12px; }
.opt {
  display: flex; align-items: center; gap: 14px; width: 100%;
  padding: 14px 16px; border-radius: 16px; border: 1.5px solid var(--line);
  background: var(--surface); box-shadow: var(--shadow); cursor: pointer; text-align: left;
  transition: border-color .12s ease, background .12s ease, transform .12s ease;
}
.opt:active { transform: scale(.99); }
.opt .mark {
  flex: none; width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 900; font-size: 22px;
  background: var(--surface-2); color: var(--fg);
}
#view-type.ask .opt .mark, #view-region.ask .opt .mark { background: var(--ask); color: #FFF8F3; }
#view-type.offer .opt .mark, #view-region.offer .opt .mark { background: var(--offer); color: #F0FBF6; }
.opt .rt { min-width: 0; }
.opt .name { display: block; font-size: 17px; font-weight: 700; color: var(--fg); }
.opt .sub { display: block; margin-top: 2px; font-size: 13px; color: var(--muted); }
.opt .arrow { margin-left: auto; flex: none; font-size: 18px; color: var(--muted); }
#view-type.ask .opt.selected, #view-region.ask .opt.selected { border-color: var(--ask); background: var(--ask-soft); }
#view-type.offer .opt.selected, #view-region.offer .opt.selected { border-color: var(--offer); background: var(--offer-soft); }
#view-type.ask .opt.selected .arrow, #view-region.ask .opt.selected .arrow { color: var(--ask-ink); }
#view-type.offer .opt.selected .arrow, #view-region.offer .opt.selected .arrow { color: var(--offer-ink); }

/* ---------- 表單 ---------- */
/* 已確認的表單基準：欄位間距、標籤與輸入控制項間距、提示文字間距及按鈕尺寸／外觀，以求買／求帶為準；旅人表單沿用相同共用類別。 */
.form { display: grid; gap: var(--form-field-gap); }
.form-field-group { display: grid; gap: var(--form-field-gap); }
.region-pin {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-2); border-radius: 12px; padding: 11px 14px;
}
.region-pin .k { font-size: 13px; font-weight: 700; color: var(--muted); }
.region-pin .k b { color: var(--danger); font-weight: 700; }
.region-pin .v { font-size: 15px; font-weight: 700; color: var(--fg); }
.region-pin .change {
  margin-left: auto; border: 0; background: transparent; color: var(--fg);
  font-size: 13px; font-weight: 700; cursor: pointer; text-decoration: underline;
}
.field { display: grid; gap: var(--field-control-gap); min-width: 0; }
.field label { font-size: 13px; font-weight: 700; color: var(--muted); }
.field label b { color: var(--danger); font-weight: 700; }
.field input, .field textarea, .field select {
  width: 100%; min-width: 0; font-family: inherit; font-size: 16px; color: var(--fg);
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; outline: none;
}
.field textarea { resize: vertical; min-height: 70px; }
.field input::placeholder, .field textarea::placeholder { color: var(--muted); opacity: .7; }
.field select.is-placeholder { color: var(--muted); }
.field select[id$="-admin"] {
  -webkit-appearance: none;
  appearance: none;
  padding-right: 42px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='m1 1 4 4 4-4' fill='none' stroke='%2366758a' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: right 12px center;
  background-size: 10px 6px;
  background-repeat: no-repeat;
}
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--fg); }
.formview.ask .field input:focus, .formview.ask .field textarea:focus, .formview.ask .field select:focus { border-color: var(--ask); box-shadow: 0 0 0 3px var(--ask-soft); }
.formview.offer .field input:focus, .formview.offer .field textarea:focus { border-color: var(--offer); box-shadow: 0 0 0 3px var(--offer-soft); }
.submit {
  width: 100%; border: 0; border-radius: 14px; padding: 15px;
  font-size: 16px; font-weight: 700; color: #FFF8F3; cursor: pointer;
}
.formview.ask .submit { background: var(--ask); }
.formview.offer .submit { background: var(--offer); }
.form-hint { font-size: 12px; color: var(--muted); margin-top: -6px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 420px) { .row2 { grid-template-columns: 1fr; } }

/* ---------- 商品來源（實體 / 電商） ---------- */
.src-group { display: grid; gap: 10px; }
.buy-extras { display: grid; gap: 16px; } /* 幫人買才顯示：在哪買 / 型號規格 / 數量 / 預算 */
.src-label { font-size: 13px; font-weight: 700; color: var(--muted); }
.src-label b { color: var(--danger); font-weight: 700; }
.src-tabs, .hv-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.src-tab, .hv-tab {
  border: 1.5px solid var(--line); background: var(--surface); color: var(--muted);
  border-radius: 12px; padding: 12px; font-size: 15px; font-weight: 700; cursor: pointer;
  transition: border-color .12s ease, background .12s ease, color .12s ease;
}
.src-tab.on, .hv-tab.on { border-color: var(--ask); color: var(--ask-ink); background: var(--ask-soft); }
.src-cond { margin-top: 2px; }
.src-cond input {
  font-variant-numeric: normal;
}
.hv-group { display: grid; gap: 10px; }

/* ---------- 底部 tab：發布 / 訊息 / 我的 ---------- */
.tabbar {
  position: fixed; inset: auto 0 0;
  margin: 0;
  transform: none;
  display: flex;
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  z-index: 40;
}
.tab-btn {
  position: relative;
  flex: 1; border: 0; background: transparent; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 0 7px;
  color: var(--muted); font-size: 11px; font-weight: 700;
  transition: color .12s ease;
}
.tab-icon-wrap { position: relative; display: block; flex: none; width: 24px; height: 24px; }
.tab-ic { display: grid; place-items: center; width: 24px; height: 24px; font-size: 0; line-height: 1; }
.tab-ic svg { display: block; width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab-btn.on { color: var(--fg); }

/* ---------- 我的（註冊 / 個人檔案） ---------- */
.tip {
  background: var(--surface-2); border-radius: 12px; padding: 12px 14px;
  font-size: 13px; color: var(--fg); line-height: 1.6;
}
#form-email-login .submit.primary, #login-with-password { background: var(--ask); color: #FFF8F3; border: 0; border-radius: 15px; min-height: 52px; padding: 15px; font-size: 16px; font-weight: 700; box-shadow: 0 8px 18px rgba(23,43,77,.12); }
#email-code-login { display: grid; gap: 18px; }
#password-login-panel { margin-top: 18px; }
.login-status { margin: 0; min-height: 1.5em; color: var(--muted); font-size: 13px; line-height: 1.6; }
.login-status.error { color: var(--danger); }
.login-status.success { color: var(--offer); }
.login-method-toggle { display: block; margin: 8px auto 0; padding: 8px 12px; border: 0; background: transparent; color: var(--ask-ink); font: inherit; font-size: 14px; font-weight: 700; text-decoration: underline; cursor: pointer; }
.profile-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.pc-av {
  width: 54px; height: 54px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: radial-gradient(circle at 32% 26%, var(--ask), var(--ask-deep) 78%);
  color: #FFF8F3; font-size: 22px; font-weight: 900;
}
.pc-info { flex: 1; min-width: 0; display: grid; gap: 2px; }
.pc-name { font-size: 17px; font-weight: 900; }
.pc-contact { font-size: 13px; color: var(--muted); word-break: break-all; }
.pc-since { font-size: 12px; color: var(--muted); }
.pc-edit {
  flex: none; border: 1.5px solid var(--line); background: var(--surface);
  color: var(--fg); border-radius: 10px; padding: 8px 14px;
  font-size: 13px; font-weight: 700; cursor: pointer;
}

/* ---------- 訊息：通知 / 聊天 ---------- */
.seg { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 16px; }
.auth-mode-tabs { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.seg-btn {
  border: 1.5px solid var(--line); background: var(--surface); color: var(--muted);
  border-radius: 12px; padding: 10px; font-size: 15px; font-weight: 700; cursor: pointer;
  transition: border-color .12s ease, background .12s ease, color .12s ease;
}
.seg-btn.on { border-color: var(--fg); color: var(--fg); background: var(--surface-2); }
.msg-empty { color: var(--muted); font-size: 13px; line-height: 1.7; text-align: center; padding: 30px 12px; }
.ghost {
  border: 1.5px dashed var(--line); background: transparent; color: var(--muted);
  border-radius: 10px; padding: 7px 14px; font-size: 12px; font-weight: 700; cursor: pointer; margin-top: 12px;
}
.notice-card {
  display: grid; gap: 5px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 14px; margin-bottom: 12px;
  cursor: pointer; text-align: left; color: inherit; width: 100%; font: inherit;
}
.notice-card:hover { border-color: color-mix(in srgb, var(--ask) 18%, var(--line)); outline: none; }
.notice-card:focus-visible { border-color: var(--line); outline: 2px solid var(--offer); outline-offset: 2px; }
.notice-card.notice-unread { border-left: 4px solid #e5484d; padding-left: 11px; }
.notice-card.notice-read { background: var(--surface-2); }
.notice-card.notice-read .nc-title { color: var(--muted); }
.notice-preview { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.notice-body-outcome { display: flex; align-items: flex-end; gap: 8px; min-width: 0; }
.notice-body-outcome .notice-preview { flex: 1; min-width: 0; margin: 0; }
.notice-body-outcome .match-outcome-badge { flex: none; margin-bottom: 1px; }
.nc-head { display: flex; align-items: center; justify-content: space-between; }
.nc-badge {
  background: var(--ask-soft); color: var(--ask-ink);
  font-size: 12px; font-weight: 900; padding: 3px 10px; border-radius: 999px;
}
.match-outcome-badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.match-outcome-accepted { background: var(--offer-soft); color: var(--offer-ink); }
.match-outcome-declined { background: var(--surface-2); color: var(--muted); }
.match-outcome-pending { background: var(--ask-soft); color: var(--ask-ink); }
.match-outcome-row { display: flex; justify-content: flex-end; margin-top: 4px; }
.pending-action-count, .unread-count { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px; background: #e5484d; color: #fff; font-size: 10px; font-weight: 900; line-height: 1; vertical-align: middle; }
.pending-action-count[hidden], .unread-count[hidden] { display: none; }
.seg-btn .pending-action-count { margin-left: 5px; }
.seg-btn .unread-count { margin-left: 5px; }
.message-tab-count { position: absolute; top: -4px; left: calc(100% - 1px); }
.nc-time { font-size: 13px; color: var(--muted); }
.nc-title { font-size: 16px; font-weight: 900; }
.notice-earnings { display: flex; flex-wrap: wrap; align-items: baseline; gap: 5px 9px; width: fit-content; margin: 5px 0; padding: 6px 10px; border: 1px solid #a8d8b7; border-radius: 10px; background: #eaf7ee; color: #245b38; }
.notice-earnings-label { font-size: 12px; font-weight: 750; }
.notice-earnings-amount { font-size: 20px; font-weight: 900; letter-spacing: -.02em; }
#notice-dialog-content { display: grid; gap: 8px; }
#notice-dialog-content > .notice-earnings { gap: 4px 8px; margin: 0 0 0 auto; padding: 5px 9px; }
#notice-dialog-content > .notice-earnings .notice-earnings-amount { font-size: 18px; }
#notice-dialog-content > .nc-text { margin: 0; }
.nc-route { font-size: 13px; color: var(--muted); }
.notice-summary { display: grid; gap: 5px; margin: 0; }
.notice-summary-row { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 8px; font-size: 13px; line-height: 1.45; }
.notice-summary-label { color: var(--muted); }
.notice-summary-value { min-width: 0; overflow-wrap: anywhere; }
.nc-text { font-size: 13px; line-height: 1.5; }
.notice-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
#notice-dialog-content > .notice-actions { margin-top: 2px; }
.pending-action-card > .notice-actions { margin-top: 7px; }
.notice-actions .ghost { margin-top: 0; }
.notice-decline-form { display: grid; gap: var(--form-field-gap); }
.notice-decline-form .field { gap: var(--field-control-gap); }
.notice-decline-reasons { min-width: 0; margin: 0; padding: 0; border: 0; }
.notice-decline-reasons legend { margin-bottom: var(--field-control-gap); font-size: 13px; font-weight: 700; color: var(--muted); }
.notice-decline-options { display: grid; gap: 8px; }
.notice-decline-option { display: flex; align-items: center; gap: 9px; min-height: 42px; padding: 8px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--fg); cursor: pointer; }
.notice-decline-option input { width: 18px; height: 18px; margin: 0; accent-color: var(--ask); }
.notice-decline-other[hidden] { display: none; }
.btn-go:disabled { cursor: default; }
.btn-go.pending-payment { border: 1px solid var(--line); }
.notice-dialog {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(620px, calc(100vw - 28px)); max-height: min(82vh, 680px); margin: 0;
  overflow: auto; border: 1px solid var(--line); border-radius: 18px; outline: none; padding: 46px 18px 14px;
  background: var(--surface); color: var(--fg); box-shadow: 0 20px 70px #0003;
}
.notice-dialog:focus { outline: none; }
.notice-dialog::backdrop { background: #17212b66; }
.dialog-close { position: absolute; top: 9px; right: 11px; display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 0; border-radius: 50%; outline: none; background: var(--surface-2); color: var(--muted); cursor: pointer; }
.dialog-close svg { display: block; width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-width: 1.8; }
.dialog-close:focus { outline: none; box-shadow: none; }
.dialog-close:focus-visible { outline: 2px solid var(--ask); outline-offset: 2px; }
.dialog-close:hover { color: var(--fg); background: var(--line); }
.notice-dialog-title { margin: 0 0 2px; font-size: 18px; line-height: 1.35; }
.invitation-details { margin: 0; padding: 8px 0 0; border-top: 1px solid var(--line); }
.invitation-details-title { margin: 0 0 6px; font-size: 14px; line-height: 1.4; font-weight: 800; }
.invitation-details-list { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.4fr); gap: 4px 12px; margin: 0; font-size: 13px; line-height: 1.45; }
.invitation-details-list dt { color: var(--muted); font-size: 13px; font-weight: 700; }
.invitation-details-list dd { min-width: 0; margin: 0; color: var(--fg); font-weight: 600; overflow-wrap: anywhere; }
@media (max-width: 420px) {
  .invitation-details-list { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .invitation-details-list dd { margin-bottom: 3px; }
}
.seg-btn[data-msg] { position: relative; }
.unread-dot { display: inline-block; width: 8px; height: 8px; margin-left: 6px; vertical-align: 1px; border-radius: 50%; background: #e5484d; }
.unread-dot[hidden] { display: none; }
.btn-go {
  justify-self: start; border: 0; background: var(--ask); color: #FFF8F3;
  border-radius: 10px; padding: 8px 16px; font-size: 13px; font-weight: 700; cursor: pointer;
}
.chat-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  border: 1px solid var(--line); background: var(--surface); border-radius: 14px;
  padding: 12px 14px; margin-bottom: 10px; cursor: pointer; text-align: left;
}
.chat-item.has-unread { border-color: color-mix(in srgb, #e5484d 35%, var(--line)); }
.ci-av {
  width: 42px; height: 42px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--offer-soft); color: var(--offer-ink); font-size: 17px; font-weight: 900;
}
.ci-info { flex: 1; min-width: 0; display: grid; gap: 2px; }
.ci-unread-dot { flex: none; width: 10px; height: 10px; margin: 0 2px 0 8px; box-shadow: 0 0 0 2px var(--surface); }
.ci-name { font-size: 15px; font-weight: 900; }
.ci-last {
  font-size: 12px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-thread { display: flex; flex-direction: column; gap: 10px; padding: 2px 0 14px; }
.msg-line { display: flex; flex-direction: column; align-items: flex-start; }
.msg-line.me { align-items: flex-end; }
.bubble {
  max-width: 78%; padding: 10px 13px; border-radius: 16px;
  font-size: 14px; line-height: 1.55; word-break: break-word;
}
.msg-line.me .bubble { background: var(--ask); color: #FFF8F3; border-bottom-right-radius: 5px; }
.msg-line.them .bubble { background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.msg-time { font-size: 10px; color: var(--muted); margin-top: 3px; padding: 0 4px; }
.chat-image-link { display: block; min-height: 0; max-width: 78%; padding: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); color: inherit; text-align: left; cursor: pointer; }
.chat-image { display: block; width: auto; max-width: min(260px, 72vw); max-height: 360px; object-fit: contain; }
.chat-input {
  position: sticky; bottom: calc(env(safe-area-inset-bottom, 0px) + 64px);
  display: flex; gap: 8px; background: var(--bg); padding: 10px 0;
}
.chat-input input { flex: 1; }
.send {
  flex: none; width: 46px; border: 0; border-radius: 12px;
  background: var(--ask); color: #FFF8F3; font-size: 16px; cursor: pointer;
}

/* ---------- toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom,0px) + 24px);
  transform: translateX(-50%) translateY(6px);
  background: #2B2418; color: #FFF8F3; font-size: 14px;
  padding: 11px 18px; border-radius: 999px; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease;
  z-index: 50;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ---- 以下原為 <body> 內 #view-home 的覆寫 ---- */

      .hero h1 {
        font-size: clamp(32px, 5vw, 56px);
      }
      .hero .tag {
        font-size: clamp(14px, 2vw, 22px);
      }

/* ---------- refreshed Taiwan / US mobile product styling ---------- */
:root {
  --bg: #f4f7fb;
  --surface: #fff;
  --surface-2: #edf2f8;
  --post-muted-surface: #e9edf2;
  --fg: #172b4d;
  --muted: #66758a;
  --line: #dce5ef;
  --ask: #e56851;
  --ask-deep: #c94f3b;
  --ask-ink: #b44735;
  --ask-soft: #fff0ec;
  --offer: #287a70;
  --offer-deep: #1e625c;
  --offer-ink: #21685f;
  --offer-soft: #e9f5f2;
  --danger: #b44735;
  --shadow: 0 8px 24px rgba(23,43,77,.07);
  --glow-ask: rgba(229,104,81,.2);
  --glow-offer: rgba(40,122,112,.18);
  --font-display: "Noto Sans TC","PingFang TC","Heiti TC","Microsoft JhengHei",sans-serif;
  --font-body: "Noto Sans TC","PingFang TC","Heiti TC","Microsoft JhengHei",sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111b2b; --surface: #19263a; --surface-2: #24344b;
    --post-muted-surface: #293645;
    --fg: #f2f6fb; --muted: #a8b6c9; --line: #33445c;
    --ask: #ee806b; --ask-deep: #c95d4c; --ask-ink: #ffb0a0; --ask-soft: #3b292d;
    --offer: #53aa9b; --offer-deep: #388b80; --offer-ink: #8bd4c8; --offer-soft: #1d3839;
    --danger: #ff9d8b; --shadow: 0 8px 24px rgba(0,0,0,.2);
    --glow-ask: rgba(238,128,107,.2); --glow-offer: rgba(83,170,155,.18); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111b2b; --surface: #19263a; --surface-2: #24344b;
  --post-muted-surface: #293645;
  --fg: #f2f6fb; --muted: #a8b6c9; --line: #33445c;
  --ask: #ee806b; --ask-deep: #c95d4c; --ask-ink: #ffb0a0; --ask-soft: #3b292d;
  --offer: #53aa9b; --offer-deep: #388b80; --offer-ink: #8bd4c8; --offer-soft: #1d3839;
  --danger: #ff9d8b; --shadow: 0 8px 24px rgba(0,0,0,.2);
  --glow-ask: rgba(238,128,107,.2); --glow-offer: rgba(83,170,155,.18); color-scheme: dark;
}
body { background: var(--bg); letter-spacing: .01em; }
.wrap { max-width: 560px; padding-inline: 20px; }
#view-home { align-items: stretch; }
.hero { text-align: left; width: 100%; margin-bottom: 32px; }
.hero h1 { color: var(--fg); font-size: clamp(34px, 8vw, 46px); letter-spacing: -.04em; }
.hero .tag { margin: 10px 0 0; letter-spacing: 0; line-height: 1.7; }
.doorways { width: 100%; display: grid; grid-template-columns: 1fr; gap: 14px; }
.door { width: 100%; min-height: 130px; aspect-ratio: auto; border-radius: 22px; padding: 44px 24px 18px; align-items: flex-start; justify-content: center; flex-direction: column; gap: 5px; color: white; text-align: left; }
.door.ask { background: linear-gradient(120deg, #e8755f, #ce5743); box-shadow: 0 12px 26px -12px var(--glow-ask); }
.door.offer { background: linear-gradient(120deg, #398b80, #246c64); box-shadow: 0 12px 26px -12px var(--glow-offer); }
.door-icon { position: absolute; right: 22px; top: 18px; width: 38px; height: 38px; border: 1px solid rgba(255,255,255,.38); border-radius: 50%; display: grid; place-items: center; font-size: 22px; }
.door .chars { writing-mode: horizontal-tb; font-size: 20px; letter-spacing: 0; line-height: 1.4; }
.door-note { font-size: 13px; opacity: .85; }
.foot { text-align: left; width: 100%; margin-top: 22px; }
.page-head { gap: 14px; margin-bottom: 22px; }
.back { background: var(--surface); border: 1px solid var(--line); border-radius: 50%; width: 42px; height: 42px; font-size: 23px; }
.page-head h2 { font-size: 25px; letter-spacing: -.02em; }
.eyebrow { letter-spacing: .08em; margin-bottom: 3px; }
.lead { line-height: 1.75; }
.opt-list { gap: 10px; }
.opt { border: 1px solid var(--line); border-radius: 18px; padding: 16px; box-shadow: var(--shadow); }
.opt .mark { border-radius: 14px; }
.form { gap: var(--form-field-gap); }
.region-pin { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 12px 14px; }
.field { gap: var(--field-control-gap); }
.field label, .src-label { color: var(--fg); font-size: 14px; }
.field input, .field textarea { border-radius: 14px; border-color: var(--line); padding: 13px 14px; }
.date-range { display: grid; grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1fr); align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }
.date-range > span { min-width: 0; text-align: center; white-space: nowrap; }
.date-range input { display: block; box-sizing: border-box; min-width: 0; max-width: 100%; width: 100%; height: 48px; font-family: inherit; font-size: 16px; line-height: normal; color: var(--fg); background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 13px 10px; -webkit-appearance: none; appearance: none; }
.date-range input::-webkit-date-and-time-value { min-width: 0; text-align: left; }
.date-range input:focus { outline: none; border-color: var(--ask); box-shadow: 0 0 0 3px var(--ask-soft); }
.date-range input:disabled { border-color: var(--line); background: var(--surface-2); color: var(--muted); opacity: .55; cursor: not-allowed; }
.date-hint { margin-top: -2px; color: var(--muted); font-size: 12px; }
@media (max-width: 600px) {
  .date-range { grid-template-columns: minmax(0, 1fr) 32px minmax(0, 1fr); gap: 6px; }
  .date-range input { padding-inline: 8px; }
}
.reward-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 4px; border-radius: 14px; background: var(--surface-2); }
.reward-mode { border: 0; border-radius: 10px; background: transparent; color: var(--muted); padding: 10px 8px; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.reward-mode.on { color: var(--fg); background: var(--surface); box-shadow: 0 1px 4px rgba(23,43,77,.1); }
.reward-slider { display: grid; gap: 7px; padding: 12px 2px 0; }
.reward-value, .range-limits { display: flex; align-items: center; justify-content: space-between; }
.reward-value { color: var(--muted); font-size: 13px; }
.reward-value output { color: var(--fg); font-size: 19px; font-weight: 900; font-variant-numeric: tabular-nums; }
.reward-estimate { margin-left: auto; color: var(--muted); font-size: 11px; font-weight: 500; text-align: right; }
.product-value-field { margin: 2px 0 4px; }
.reward-currency-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.reward-currency-row label { color: var(--muted); font-size: 12px; }
.reward-currency-fixed { display: inline-flex; align-items: center; min-height: 42px; padding: 0 12px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--fg); font-size: 14px; }
.reward-amount-entry { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: 0; min-height: 48px; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.value-entry.reward-amount-entry { grid-template-columns: auto minmax(0, 1fr); gap: 0; }
.currency-prefix { padding: 0 0 0 14px; color: var(--muted); font-size: 15px; font-weight: 700; }
.reward-amount-entry input { width: 100%; min-width: 0; min-height: 48px; padding: 11px 13px; border: 0; border-radius: 0; outline: none; background: transparent; color: var(--fg); font: inherit; font-size: 16px; }
.reward-amount-entry:focus-within { border-color: var(--ask); box-shadow: 0 0 0 3px var(--ask-soft); }
.my-posts { display: grid; gap: 12px; margin-top: 30px; }
.wallet-panel { display: grid; gap: 26px; margin-top: 30px; }
.wallet-login { display: grid; gap: 12px; }
.wallet-content { display: grid; gap: 24px; }
.wallet-balance-group, .wallet-history-group { display: grid; gap: 12px; }
.wallet-login p, .wallet-balance-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.wallet-login .submit.primary { background: var(--ask); color: #FFF8F3; border: 0; padding: 15px; font: inherit; font-size: 15px; font-weight: 700; cursor: pointer; }
.wallet-balance-card { display: grid; gap: 8px; padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.wallet-balance-card > strong { color: var(--fg); font-size: clamp(30px, 8vw, 42px); font-variant-numeric: tabular-nums; }
.wallet-withdrawal-note { margin: 4px 0 0; padding-top: 10px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; line-height: 1.6; }
.wallet-status { min-height: 0; margin: 0; color: var(--muted); font-size: 13px; }
.wallet-status:empty { display: none; }
.wallet-status.error { color: #a34836; }
.wallet-history-title { margin: 0; color: var(--fg); font-size: 18px; font-weight: 900; }
#wallet-transactions { display: grid; gap: 8px; }
.wallet-transaction { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); }
.wallet-transaction-details { display: grid; gap: 4px; min-width: 0; }
.wallet-transaction-details strong { overflow-wrap: anywhere; color: var(--fg); font-size: 13px; }
.wallet-transaction-details time { color: var(--muted); font-size: 11px; }
.wallet-amount { flex: none; color: var(--offer-ink); font-size: 14px; font-variant-numeric: tabular-nums; }
.wallet-amount.negative { color: var(--ask-ink); }
.my-posts-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.my-posts-head h3 { margin: 0; color: var(--fg); font-size: 19px; font-weight: 900; }
.my-posts-head > span { color: var(--muted); font-size: 12px; }
.post-filters { display: flex; flex-wrap: wrap; gap: 7px; width: fit-content; max-width: 100%; }
.post-filter { border: 1px solid var(--line); border-radius: 999px; padding: 6px 11px; background: var(--surface); color: var(--muted); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; transition: color .12s ease, background .12s ease, border-color .12s ease; }
.post-filter.on { border-color: var(--ask); background: var(--ask-soft); color: var(--ask); }
.post-filter:focus-visible { outline: 2px solid var(--ask); outline-offset: 2px; }
.my-posts-gate { display: grid; gap: 12px; }
.my-posts-gate p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.my-posts-gate .submit.primary { background: var(--ask); color: #FFF8F3; border: 0; padding: 15px; font: inherit; font-size: 15px; font-weight: 700; cursor: pointer; }
.my-posts-empty { margin: 0; padding: 18px; border: 1px dashed var(--line); border-radius: 16px; color: var(--muted); background: var(--surface); font-size: 13px; line-height: 1.7; }
#my-posts-list { display: grid; gap: 12px; }
.my-post-card { display: grid; gap: 7px; padding: 15px; border: 1px solid var(--line); border-radius: 17px; background: var(--surface); box-shadow: var(--shadow); }
.my-post-card.is-completed, .my-post-card.is-expired { background: var(--post-muted-surface); box-shadow: none; }
.mpc-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.mpc-badge { padding: 4px 10px; border-radius: 999px; background: var(--offer-soft); color: var(--offer-ink); font-size: 12px; font-weight: 900; }
.mpc-badge.ask { background: var(--ask-soft); color: var(--ask-ink); }
.mpc-status { margin-left: auto; padding: 4px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 800; }
.mpc-progress-trigger { border: 1px solid var(--ask); background: var(--ask-soft); color: var(--ask-ink); font-family: inherit; font-size: 12px; font-weight: 800; line-height: inherit; cursor: pointer; }
.mpc-progress-trigger:hover { filter: brightness(.97); }
.mpc-progress-trigger { user-select: none; -webkit-tap-highlight-color: transparent; }
.mpc-progress-trigger:focus, .mpc-progress-trigger:focus-visible { outline: none; box-shadow: none; }
.match-progress-dialog { position: fixed; top: 50%; left: 50%; transform: translate(-50%,-50%); width: min(620px,calc(100vw - 28px)); max-height: min(82vh,680px); overflow: auto; margin: 0; padding: 36px 18px 14px; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--fg); box-shadow: 0 20px 70px #0003; }
.match-progress-dialog::backdrop { background: #17212b66; }
.match-progress-dialog h3 { margin: 0 0 12px; color: var(--fg); font-size: 19px; }
.match-progress-dialog:focus, .match-progress-dialog h3 { outline: none; user-select: none; -webkit-tap-highlight-color: transparent; }
.match-progress-list { display: grid; gap: 16px; }
.match-progress-match { display: grid; gap: 10px; }
.match-progress-partner { margin: 0; color: var(--fg); font-size: 14px; font-weight: 800; }
.match-progress-track { display: flex; align-items: flex-start; padding: 0 2px; }
.match-progress-step { position: relative; z-index: 0; display: grid; flex: 1; justify-items: center; gap: 5px; min-width: 0; text-align: center; }
.match-progress-step::before { position: absolute; z-index: -1; top: 7px; right: 50%; width: 100%; height: 3px; background: var(--line); content: ''; }
.match-progress-step:first-child::before { display: none; }
.match-progress-step.reached::before { background: var(--ask); }
.match-progress-dot { width: 17px; height: 17px; border: 3px solid var(--line); border-radius: 50%; background: var(--surface); }
.match-progress-step.reached .match-progress-dot { border-color: var(--ask); background: var(--ask); }
.match-progress-label { display: flex; align-items: flex-start; justify-content: center; min-height: 2.5em; color: var(--muted); font-size: 11px; line-height: 1.3; white-space: pre-line; overflow-wrap: anywhere; }
.match-progress-step.reached .match-progress-label { color: var(--ask-ink); font-weight: 800; }
.mpc-time { color: var(--muted); font-size: 12px; }
.mpc-title { margin: 0; color: var(--fg); font-size: 16px; font-weight: 900; overflow-wrap: anywhere; }
.mpc-route { margin: 0; color: var(--muted); font-size: 13px; }
.mpc-details { display: grid; gap: 6px; margin: 2px 0 0; padding: 10px 0 0; border-top: 1px solid var(--line); list-style: none; color: var(--muted); font-size: 13px; line-height: 1.55; }
.mpc-details li { overflow-wrap: anywhere; }
.seg-btn[data-mine]:not(.on), .seg-btn[data-msg]:not(.on) { color: var(--muted); background: transparent; }
.seg-btn[data-mine].on, .seg-btn[data-msg].on { color: var(--ask); background: var(--surface); }
.reward-slider input[type="range"] { appearance: auto; display: block; width: 100%; height: 24px; margin: 5px 0; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; accent-color: var(--ask); }
.range-limits { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.value-entry { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.volume-inputs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.volume-inputs input { width: 100%; min-width: 0; padding: 12px 10px; text-align: center; }
.value-entry input { min-width: 0; }
.value-entry select { width: 160px; max-width: 52vw; min-width: 145px; padding: 0 30px 0 12px; border: 1px solid var(--line); border-radius: 14px; background-color: var(--surface); color: var(--fg); font: inherit; font-size: 14px; }
.value-entry select:focus { outline: none; border-color: var(--offer); box-shadow: 0 0 0 3px var(--offer-soft); }
.field input:focus, .field textarea:focus, .field select:focus { border-color: #6481a5; box-shadow: 0 0 0 3px rgba(77,119,168,.12); }
.formview.ask .field input:focus, .formview.ask .field textarea:focus, .formview.ask .field select:focus { border-color: var(--ask); box-shadow: 0 0 0 3px var(--ask-soft); }
.formview.offer .field input:focus, .formview.offer .field textarea:focus, .formview.offer .field select:focus { border-color: var(--offer); box-shadow: 0 0 0 3px var(--offer-soft); }
.submit { border-radius: 15px; min-height: 52px; box-shadow: 0 8px 18px rgba(23,43,77,.12); }
.submit:active, .btn-go:active, .send:active { transform: scale(.99); }
.tip, .profile-card, .notice-card, .chat-item { border-radius: 18px; }
.tabbar { background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(16px); border-top-color: var(--line); padding-top: 2px; }
.tab-btn { padding: 4px 0 5px; }
.tab-btn.on { color: var(--ask); }
.trip-form-fields { gap: var(--form-field-gap); }
.accepted-goods > label { color: var(--fg); font-size: 14px; font-weight: 700; }
.trip-route-field { gap: var(--field-control-gap); }
.trip-route-button { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; height: 48px; padding: 0 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--fg); text-align: left; font: inherit; font-size: 16px; cursor: pointer; }
.trip-route-value { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.trip-route-button .arrow { color: var(--muted); font-size: 22px; line-height: 1; }
.trip-type-field, .trip-direction-field { gap: var(--field-control-gap); }
.trip-type-options { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.trip-type-option { min-height: 48px; padding: 12px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--muted); font: inherit; font-size: 15px; font-weight: 700; cursor: pointer; }
.trip-type-option.on { border-color: var(--offer); background: var(--offer-soft); color: var(--offer-ink); }
.trip-direction-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.trip-direction-option { min-width: 0; min-height: 48px; padding: 10px 6px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--muted); font: inherit; font-size: 14px; font-weight: 700; cursor: pointer; }
.trip-direction-option.on { border-color: var(--offer); background: var(--offer-soft); color: var(--offer-ink); }
#view-trip:not([hidden]) + #view-form-buy { margin-top: var(--form-field-gap); }
.trip-route-button:focus-visible { outline: 2px solid var(--offer); outline-offset: 2px; }
.formview.offer #trip-departure-date, .formview.offer #trip-return-date { width: 100%; min-width: 0; height: 48px; box-sizing: border-box; padding: 13px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); color: var(--fg); font: inherit; font-size: 16px; }
.formview.offer #trip-departure-date:focus, .formview.offer #trip-return-date:focus { outline: none; border-color: var(--offer); box-shadow: 0 0 0 3px var(--offer-soft); }
.seg { padding: 4px; background: var(--surface-2); border-radius: 14px; gap: 4px; }
.seg-btn { border: 0; background: transparent; border-radius: 11px; }
.seg-btn.on { background: var(--surface); box-shadow: 0 1px 4px rgba(23,43,77,.1); }
.msg-empty { background: var(--surface); border: 1px dashed var(--line); border-radius: 18px; margin-top: 14px; }
@media (min-width: 600px) {
  #view-home { align-items: center; }
  .hero { text-align: center; }
  .hero .tag { margin-inline: auto; }
  .doorways { grid-template-columns: 1fr 1fr; }
  .door { min-height: 190px; }
  .foot { text-align: center; }
}


.auth-dialog {
  width: min(420px, calc(100vw - 32px));
  border: 1px solid var(--line, #e8e1d8);
  border-radius: 18px;
  padding: 24px;
  background: var(--surface);
  color: var(--fg);
  box-shadow: 0 18px 60px rgba(28, 22, 16, .22);
}
.auth-dialog::backdrop { background: rgba(25, 22, 18, .38); }
.auth-dialog h3 { margin: 0 0 8px; color: var(--ask-ink); font-size: 19px; font-weight: 800; }
.auth-dialog p { margin: 0 0 20px; color: var(--muted, #77716a); }
.auth-dialog-actions { display: grid; gap: 10px; }
.auth-dialog .submit.primary {
  min-height: 50px;
  border: 1px solid var(--ask-soft);
  border-radius: 14px;
  background: var(--ask-soft);
  color: var(--ask-ink);
  box-shadow: none;
  font-size: 16px;
  font-weight: 800;
  transition: background .15s ease, transform .15s ease;
}
.auth-dialog .submit.primary:hover { background: color-mix(in srgb, var(--ask-soft) 72%, var(--ask) 28%); }
.auth-dialog .submit.primary:focus-visible {
  outline: 2px solid var(--ask);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px var(--surface);
}
.legal-register { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.legal-register-status { color: var(--muted); font-size: 12px; }
.legal-register-status.accepted { color: var(--offer-ink); font-weight: 800; }
.legal-dialog {
  width: min(560px, calc(100vw - 32px)); max-height: min(86vh, 760px); overflow: auto;
  border: 1px solid var(--line); border-radius: 18px; padding: 24px;
  background: var(--surface); color: var(--fg); box-shadow: 0 20px 70px #0003;
}
.legal-dialog::backdrop { background: #17212b66; }
.legal-dialog h3 { margin: 0 0 6px; font-size: 20px; }
.legal-draft-note { margin: 0 0 14px; color: var(--muted); font-size: 12px; }
.legal-consent-body { max-height: 46vh; overflow: auto; padding: 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.legal-consent-body p { margin: 0 0 12px; font-size: 14px; line-height: 1.7; }
.legal-consent-body p:last-child { margin-bottom: 0; }
.legal-consent-check { display: flex; align-items: flex-start; gap: 9px; margin: 16px 0; font-size: 13px; line-height: 1.5; }
.legal-consent-check input { flex: none; width: 18px; height: 18px; margin: 0; accent-color: var(--ask); }
.legal-dialog .auth-dialog-actions { grid-template-columns: 1fr 1fr; }
.legal-dialog .submit.primary:disabled { opacity: .48; cursor: not-allowed; }

/* Add scroll room only while the iPhone keyboard covers the auth form. */
.auth-keyboard-open .wrap {
  padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 96px + var(--auth-keyboard-space, 0px));
}

/* Modern chat composer */
.chat-input {
  z-index: 30;
  align-items: center;
  gap: 8px;
  margin: 12px 0 0;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: 0 6px 20px rgba(23, 43, 77, .08);
  backdrop-filter: blur(12px);
}
.chat-input input {
  flex: 1;
  min-width: 0;
  height: 42px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  outline: 0;
  background: transparent;
  color: var(--fg);
  font: inherit;
  font-size: 16px;
  box-shadow: none;
}
.chat-input input::placeholder { color: var(--muted); opacity: .85; }
.chat-input input:focus { border: 0; outline: 0; box-shadow: none; }
.chat-input:focus-within {
  border-color: color-mix(in srgb, var(--ask) 55%, var(--line));
  box-shadow: 0 0 0 3px var(--ask-soft), 0 6px 20px rgba(23, 43, 77, .08);
}
.chat-input .send {
  display: grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: var(--ask);
  color: #fff;
  cursor: pointer;
  transition: background .15s ease, transform .15s ease;
}
.chat-input .send:hover { background: var(--ask-deep); }
.chat-input .send:disabled { opacity: .55; cursor: wait; }
.chat-input .send:focus-visible { outline: 2px solid var(--ask); outline-offset: 3px; }
.chat-input .send svg { width: 20px; height: 20px; }
.chat-input .chat-image-input { display: none; }
.chat-input .chat-image-button, .chat-input .chat-image-clear {
  display: grid; place-items: center; flex: none; width: 36px; height: 36px; padding: 0;
  border: 0; border-radius: 50%; background: var(--surface-2); color: var(--muted); cursor: pointer;
}
.chat-input .chat-image-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.chat-input .chat-image-button:hover, .chat-input .chat-image-clear:hover { color: var(--fg); background: var(--line); }
.chat-input .chat-image-button:focus-visible, .chat-input .chat-image-clear:focus-visible { outline: 2px solid var(--ask); outline-offset: 2px; }
.chat-input .chat-image-name { max-width: 90px; overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.chat-input .chat-image-name[hidden], .chat-input .chat-image-clear[hidden] { display: none; }
#chat-room { padding-bottom: 0; }
.chat-input {
  position: fixed;
  left: 50%;
  right: auto;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 72px + var(--chat-keyboard-space, 0px));
  width: min(520px, calc(100% - 32px));
  margin: 0;
  transform: translateX(-50%);
}
#chat-thread { padding-bottom: 84px; }
.mpc-actions { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 4px; }
.mpc-action { border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; background: var(--surface); color: var(--fg); font: inherit; font-size: 12px; font-weight: 750; cursor: pointer; }
.mpc-action:hover { border-color: var(--ask); color: var(--ask); }
.mpc-action.danger { color: #a34836; }
.mpc-action.danger:hover { border-color: #a34836; }
.post-status-filter { display: block; width: fit-content; max-width: 100%; min-width: 0; }
.post-status-filter select { appearance: none; -webkit-appearance: none; display: block; width: 180px; max-width: 100%; min-width: 0; min-height: 40px; box-sizing: border-box; padding: 8px 36px 8px 12px; border: 1px solid var(--line); border-radius: 12px; background-color: var(--surface); background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='m1 1 5 5 5-5' fill='none' stroke='%236b7280' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 12px 8px; color: var(--fg); font: inherit; font-size: 13px; cursor: pointer; }
.post-filter-level { display: grid; gap: var(--field-control-gap); }
.my-posts-count-wrap { margin-top: 2px; color: var(--muted); font-size: 12px; text-align: right; }
.mpc-status-detail { margin: -2px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.product-photo-preview, .product-photo-gallery, .invitation-product-photos { display: flex; flex-wrap: wrap; gap: 10px; }
.product-photo-preview { margin-top: 2px; }
.product-photo-tile { position: relative; width: 92px; height: 92px; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); }
.product-photo-tile img, .product-photo-gallery img, .invitation-product-photos img { display: block; width: 100%; height: 100%; object-fit: cover; }
.product-photo-remove { position: absolute; top: 4px; right: 4px; display: grid; width: 24px; height: 24px; place-items: center; border: 0; border-radius: 50%; background: rgba(18, 28, 43, .82); color: #fff; font-size: 18px; line-height: 1; cursor: pointer; }
.product-photo-gallery { margin: 10px 0; }
.product-photo-gallery button, .invitation-product-photos button { display: block; width: 76px; height: 76px; overflow: hidden; padding: 0; border: 0; border-radius: 10px; background: var(--surface-2); cursor: pointer; }
.invitation-product-photos { margin-top: 14px; }
.invitation-product-photos button { width: 88px; height: 88px; }
.product-photo-viewer { position: fixed; top: 50%; left: 50%; grid-template-columns: 42px minmax(0, 1fr) 42px; grid-template-rows: minmax(100px, 1fr) auto; align-items: center; justify-items: center; gap: 10px; width: min(720px, calc(100vw - 28px)); max-height: min(86vh, 760px); margin: 0; padding: 42px 16px 14px; transform: translate(-50%, -50%); overflow: visible; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); color: var(--fg); box-shadow: 0 20px 70px #0005; }
.product-photo-viewer:not([open]) { display: none; }
.product-photo-viewer[open] { display: grid; }
.product-photo-viewer::backdrop { background: #17212b99; }
.product-photo-viewer > img { grid-column: 2; grid-row: 1; display: block; max-width: 100%; max-height: min(70vh, 620px); object-fit: contain; touch-action: pan-y; user-select: none; -webkit-user-drag: none; }
.product-photo-viewer .dialog-close { z-index: 1; top: 8px; right: 8px; font-size: 22px; line-height: 1; }
.product-photo-viewer .dialog-close:focus, .product-photo-viewer .dialog-close:focus-visible { outline: none; box-shadow: none; }
.product-photo-viewer-nav { grid-row: 1; display: grid; width: 38px; height: 38px; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--surface-2); color: var(--fg); font-size: 28px; line-height: 1; cursor: pointer; }
.product-photo-viewer-nav.previous { grid-column: 1; }
.product-photo-viewer-nav.next { grid-column: 3; }
.product-photo-viewer-position { grid-column: 1 / -1; grid-row: 2; margin: 0; color: var(--muted); font-size: 12px; }
