/* 港澳台坐班邮件助手 —— 简约、系统原生风格 */
:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --ink: #1d1d1f;
  --ink-2: #6e6e73;
  --ink-3: #86868b;
  --hair: rgba(0, 0, 0, .08);
  --fill: rgba(118, 118, 128, .12);
  --fill-2: rgba(118, 118, 128, .08);
  --accent: #0071e3;
  --accent-press: #0062c4;
  --accent-soft: rgba(0, 113, 227, .1);
  --green: #248a3d;
  --green-soft: rgba(36, 138, 61, .1);
  --orange: #b25000;
  --orange-soft: rgba(255, 149, 0, .12);
  --red: #d70015;
  --nav-bg: rgba(245, 245, 247, .72);
  --shadow: 0 2px 6px rgba(0, 0, 0, .04), 0 12px 32px rgba(0, 0, 0, .06);
  --ease: cubic-bezier(.25, .1, .25, 1);
  --r-lg: 20px;
  --r-md: 14px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000; --surface: #1c1c1e; --ink: #f5f5f7; --ink-2: #a1a1a6; --ink-3: #8e8e93;
    --hair: rgba(255, 255, 255, .1); --fill: rgba(118, 118, 128, .24); --fill-2: rgba(118, 118, 128, .16);
    --accent: #2997ff; --accent-press: #0a84ff; --accent-soft: rgba(41, 151, 255, .16);
    --green: #30d158; --green-soft: rgba(48, 209, 88, .14); --orange: #ff9f0a; --orange-soft: rgba(255, 159, 10, .14); --red: #ff453a;
    --nav-bg: rgba(22, 22, 23, .72); --shadow: 0 0 0 1px rgba(255, 255, 255, .06);
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font);
  font-size: 17px; line-height: 1.47; letter-spacing: -.01em;
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--accent-soft); outline-offset: 2px; border-radius: 10px; }
[hidden] { display: none !important; }

/* ---------- 顶部导航（毛玻璃） ---------- */
.nav {
  position: sticky; top: 0; z-index: 40;
  background: var(--nav-bg); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--hair);
}
.nav-inner { max-width: 1080px; margin: 0 auto; height: 52px; padding: 0 22px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 0; }
.brand-mark { width: 26px; height: 26px; border-radius: 8px; background: var(--ink); color: var(--bg); display: grid; place-items: center; font-size: 14px; font-weight: 700; }
.brand-name { font-size: 15px; font-weight: 600; }
.nav-right { display: flex; align-items: center; gap: 16px; }
.nav-link { font-size: 13px; color: var(--ink-2); text-decoration: none; transition: color .2s var(--ease); }
.nav-link:hover { color: var(--ink); }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); }
.status i { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); }
.status.ok i { background: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.status.mock i { background: var(--orange); box-shadow: 0 0 0 3px var(--orange-soft); }

.stepper { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 6px; }
.stepper li { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-3); transition: color .3s var(--ease); }
.stepper li + li::before { content: ""; width: 22px; height: 1px; background: var(--hair); margin-right: 2px; }
.stepper i { width: 8px; height: 8px; border-radius: 50%; background: var(--fill); transition: background .3s var(--ease), transform .3s var(--ease); }
.stepper li.active { color: var(--ink); font-weight: 600; }
.stepper li.active i { background: var(--accent); transform: scale(1.25); }
.stepper li.done i { background: var(--ink-2); }

/* ---------- 布局与视图切换 ---------- */
main { max-width: 1080px; margin: 0 auto; padding: 0 22px 140px; }
.view { display: none; }
.view.is-active { display: block; animation: viewIn .45s var(--ease) both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

.hero { text-align: center; padding: 64px 0 32px; }
.hero.compact { padding: 44px 0 24px; }
h1 { font-size: 48px; line-height: 1.08; font-weight: 700; letter-spacing: -.03em; margin: 0; }
.hero.compact h1 { font-size: 40px; }
.lead { font-size: 21px; line-height: 1.38; color: var(--ink-2); margin: 12px auto 0; max-width: 34em; letter-spacing: -.015em; }

/* ---------- 输入卡片 ---------- */
.composer { max-width: 780px; margin: 0 auto; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden; transition: box-shadow .3s var(--ease); }
.composer:focus-within { box-shadow: var(--shadow), 0 0 0 4px var(--accent-soft); }
.composer textarea { display: block; width: 100%; border: 0; outline: 0; resize: vertical; background: transparent; padding: 22px 24px; font-size: 17px; line-height: 1.6; min-height: 240px; }
.composer textarea::placeholder { color: var(--ink-3); }
.composer-foot { border-top: 1px solid var(--hair); padding: 14px 24px 16px; }
.inline-field { display: flex; align-items: center; gap: 12px; }
.inline-field span { font-size: 13px; color: var(--ink-2); white-space: nowrap; }
.inline-field input { flex: 1; border: 0; outline: 0; background: var(--fill-2); border-radius: 10px; padding: 8px 12px; font-size: 15px; transition: background .2s var(--ease); }
.inline-field input:focus { background: var(--fill); }
.mask-note { margin: 10px 0 0; font-size: 13px; color: var(--ink-3); }
.mask-preview { margin: 10px 0 0; white-space: pre-wrap; font-family: var(--font); font-size: 14px; color: var(--ink-2); background: var(--fill-2); border-radius: 12px; padding: 12px 14px; max-height: 220px; overflow: auto; animation: viewIn .3s var(--ease); }

/* ---------- 按钮 ---------- */
.pill {
  border: 0; border-radius: 980px; background: var(--accent); color: #fff; font-size: 17px; font-weight: 500;
  padding: 11px 22px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: background .2s var(--ease), transform .15s var(--ease), opacity .2s var(--ease);
}
.pill:hover:not(:disabled) { background: var(--accent-press); }
.pill:active:not(:disabled) { transform: scale(.97); }
.pill:disabled { opacity: .35; cursor: not-allowed; }
.pill.large { font-size: 17px; padding: 14px 32px; min-height: 52px; }
.pill.small { font-size: 13px; padding: 6px 14px; min-height: 30px; }
.pill.secondary { background: var(--fill); color: var(--ink); }
.pill.secondary:hover:not(:disabled) { background: var(--fill); filter: brightness(.96); }
.pill.done { background: var(--green); }
.link { border: 0; background: none; color: var(--accent); font-size: 15px; padding: 6px 4px; border-radius: 8px; transition: opacity .2s var(--ease); }
.link:hover:not(:disabled) { text-decoration: underline; text-underline-offset: 3px; }
.link:active:not(:disabled) { opacity: .6; }
.link:disabled { color: var(--ink-3); cursor: default; }

.actions { display: flex; align-items: center; gap: 18px; margin-top: 28px; flex-wrap: wrap; }
.actions.center { justify-content: center; }
.actions.split { justify-content: space-between; max-width: 780px; margin-left: auto; margin-right: auto; }
.actions-left, .actions-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.kbd-hint { text-align: center; font-size: 12px; color: var(--ink-3); margin-top: 14px; }
kbd { font-family: var(--font); font-size: 11px; background: var(--surface); border: 1px solid var(--hair); border-bottom-width: 2px; border-radius: 5px; padding: 1px 5px; }

/* ---------- 第 2 步 ---------- */
.banner { max-width: 780px; margin: 0 auto 20px; border-radius: var(--r-md); padding: 14px 18px; font-size: 15px; animation: viewIn .35s var(--ease); }
.banner.warn { background: var(--orange-soft); color: var(--ink); }
.banner.warn strong { color: var(--orange); }
.banner ul { margin: 8px 0 0; padding-left: 20px; }
.banner li { margin: 4px 0; color: var(--ink-2); }

.who { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-bottom: 36px; }
.select-pill { display: inline-flex; align-items: center; gap: 6px; background: var(--surface); border-radius: 980px; padding: 6px 8px 6px 14px; box-shadow: var(--shadow); font-size: 14px; }
.select-pill span { color: var(--ink-3); font-size: 13px; }
.select-pill select { border: 0; outline: 0; background: transparent; font-weight: 600; font-size: 14px; padding: 2px 4px; cursor: pointer; }

.layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 32px; align-items: start; }
.group-title { font-size: 22px; font-weight: 700; letter-spacing: -.02em; margin: 8px 0 4px; display: flex; align-items: center; gap: 10px; }
.group-title + .group-hint { margin-top: 0; }
.group-hint { color: var(--ink-2); font-size: 15px; margin: 0 0 14px; }
.count { font-size: 13px; font-weight: 600; min-width: 24px; height: 24px; padding: 0 8px; border-radius: 12px; background: var(--fill); color: var(--ink-2); display: inline-grid; place-items: center; transition: background .3s var(--ease), color .3s var(--ease); }
.count.alert { background: var(--orange-soft); color: var(--orange); }
.count.ok { background: var(--green-soft); color: var(--green); }
.group { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); margin-bottom: 40px; overflow: hidden; }
.group .empty { color: var(--ink-3); font-size: 15px; padding: 20px 22px; margin: 0; }

.row { padding: 18px 22px; position: relative; transition: background .3s var(--ease); }
.row + .row { border-top: 1px solid var(--hair); }
.row-head { display: flex; gap: 12px; align-items: flex-start; }
.row-q { font-size: 17px; font-weight: 600; flex: 1; line-height: 1.4; }
.mark { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--ink-3); margin-top: 1px; display: grid; place-items: center; transition: background .25s var(--ease), border-color .25s var(--ease); }
.mark svg { width: 12px; height: 12px; stroke: #fff; stroke-width: 2.6; fill: none; stroke-dasharray: 20; stroke-dashoffset: 20; transition: stroke-dashoffset .35s var(--ease) .05s; }
.row.resolved .mark { background: var(--green); border-color: var(--green); }
.row.resolved .mark svg { stroke-dashoffset: 0; }
.row-meta { margin: 6px 0 0 34px; font-size: 14px; color: var(--ink-2); }
.row-meta .why { color: var(--orange); }
.row-body { margin: 12px 0 0 34px; }
.tag { font-size: 12px; font-weight: 500; color: var(--orange); background: var(--orange-soft); padding: 2px 8px; border-radius: 6px; white-space: nowrap; }

.seg { position: relative; display: inline-grid; grid-auto-flow: column; grid-auto-columns: 1fr; background: var(--fill); border-radius: 10px; padding: 2px; margin-top: 12px; }
.seg-thumb { position: absolute; top: 2px; bottom: 2px; left: 2px; border-radius: 8px; background: var(--surface); box-shadow: 0 3px 8px rgba(0, 0, 0, .12), 0 1px 1px rgba(0, 0, 0, .04); transition: transform .3s var(--ease), opacity .2s var(--ease); opacity: 0; }
.seg button { position: relative; z-index: 1; border: 0; background: none; font-size: 13px; font-weight: 500; padding: 6px 16px; border-radius: 8px; color: var(--ink-2); transition: color .2s var(--ease); white-space: nowrap; }
.seg button.on { color: var(--ink); font-weight: 600; }

.field { display: block; width: 100%; border: 0; outline: 0; background: var(--fill-2); border-radius: 12px; padding: 10px 14px; font-size: 15px; line-height: 1.55; resize: vertical; transition: background .2s var(--ease), box-shadow .2s var(--ease); }
.field:focus { background: var(--surface); box-shadow: 0 0 0 1px var(--hair), 0 0 0 4px var(--accent-soft); }
.field + .field { margin-top: 8px; }
.ask-teacher { background: var(--accent-soft); border-radius: 12px; padding: 10px 14px; font-size: 14px; margin-bottom: 8px; color: var(--ink); }
.ask-teacher b { color: var(--accent); font-weight: 600; margin-right: 4px; }
.row-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 8px; font-size: 13px; color: var(--ink-3); flex-wrap: wrap; }
.row.off .row-q, .row.off .field { opacity: .45; }

/* iOS 风格开关 */
.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); cursor: pointer; user-select: none; }
.switch input { appearance: none; -webkit-appearance: none; width: 42px; height: 26px; border-radius: 13px; background: var(--fill); position: relative; cursor: pointer; transition: background .25s var(--ease); margin: 0; }
.switch input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .2); transition: transform .25s var(--ease); }
.switch input:checked { background: var(--green); }
.switch input:checked::after { transform: translateX(16px); }

.ask-list { list-style: none; margin: 0; padding: 0; }
.ask-list li { display: flex; align-items: center; gap: 12px; padding: 14px 22px; font-size: 15px; border-bottom: 1px solid var(--hair); animation: viewIn .3s var(--ease); }
.ask-list li.empty { color: var(--ink-3); }
.ask-list .x { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--red); color: #fff; font-size: 16px; line-height: 1; display: grid; place-items: center; padding: 0; transition: transform .15s var(--ease); }
.ask-list .x:active { transform: scale(.9); }
.ask-add { display: flex; align-items: center; gap: 8px; padding: 10px 14px 10px 22px; }
.ask-add input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 15px; padding: 6px 0; }

.side-card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 18px 20px; margin-bottom: 16px; }
.sticky { position: sticky; top: 72px; }
.side-head { display: flex; justify-content: space-between; align-items: center; }
.side-card h3 { font-size: 17px; font-weight: 600; margin: 0; }
.teacher-list { margin: 10px 0 0; padding-left: 20px; font-size: 14px; color: var(--ink); }
.teacher-list li { margin: 8px 0; transition: color .3s var(--ease); animation: viewIn .3s var(--ease); }
.teacher-list li.done { color: var(--ink-3); text-decoration: line-through; }
.teacher-list li.empty { list-style: none; margin-left: -20px; color: var(--ink-3); }
details.side-card summary { list-style: none; display: flex; justify-content: space-between; align-items: center; cursor: pointer; }
details.side-card summary::-webkit-details-marker { display: none; }
.chev { width: 9px; height: 9px; border-right: 2px solid var(--ink-3); border-bottom: 2px solid var(--ink-3); transform: rotate(45deg); transition: transform .3s var(--ease); margin-right: 4px; }
details[open] .chev { transform: rotate(-135deg); }
.record { display: grid; gap: 8px; margin: 14px 0 6px; }
.rec-row { display: grid; gap: 2px; font-size: 12px; color: var(--ink-3); }
.rec-row input { border: 0; outline: 0; background: var(--fill-2); border-radius: 8px; padding: 6px 10px; font-size: 14px; }

/* 底部操作栏 */
.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 12px 22px calc(12px + env(safe-area-inset-bottom)); background: var(--nav-bg); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px); border-top: 1px solid var(--hair); animation: dockIn .45s var(--ease) both; }
@keyframes dockIn { from { transform: translateY(100%); } to { transform: none; } }
.dock-inner { max-width: 1080px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.dock-opts { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex: 1; }
.dock .select-pill { box-shadow: none; background: var(--fill-2); }
.note-input { flex: 1; min-width: 180px; border: 0; outline: 0; background: var(--fill-2); border-radius: 980px; padding: 8px 14px; font-size: 14px; }
.dock-go { display: flex; align-items: center; gap: 14px; }
.dock-status { font-size: 13px; color: var(--ink-2); transition: color .3s var(--ease); }
.dock-status.ready { color: var(--green); font-weight: 600; }

/* ---------- 第 3 步 ---------- */
#step3 .composer textarea { min-height: 420px; font-size: 16px; }

/* ---------- 弹层、加载、提示 ---------- */
.sheet { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 22px; background: rgba(0, 0, 0, .28); animation: fadeIn .2s var(--ease); }
.sheet-card { width: min(380px, 100%); background: var(--surface); border-radius: 22px; padding: 26px 24px 20px; text-align: center; box-shadow: 0 24px 64px rgba(0, 0, 0, .2); animation: popIn .32s var(--ease); }
.sheet-card h3 { font-size: 19px; margin: 0 0 6px; }
.sheet-card p { color: var(--ink-2); font-size: 15px; margin: 0 0 20px; }
.sheet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: scale(.94); } }

.loading { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; background: rgba(245, 245, 247, .5); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); animation: fadeIn .25s var(--ease); }
@media (prefers-color-scheme: dark) { .loading { background: rgba(0, 0, 0, .5); } body .toast { background: rgba(58, 58, 60, .95); } }
.loading-card { text-align: center; }
.loading-card p { color: var(--ink-2); font-size: 15px; margin-top: 14px; min-height: 1.5em; transition: opacity .3s var(--ease); }
.spinner { width: 34px; height: 34px; margin: 0 auto; border-radius: 50%; border: 3px solid var(--fill); border-top-color: var(--ink-2); animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast { position: fixed; left: 50%; top: 66px; z-index: 80; transform: translate(-50%, -12px); opacity: 0; pointer-events: none; background: rgba(29, 29, 31, .92); color: #f5f5f7; font-size: 14px; padding: 10px 18px; border-radius: 980px; max-width: calc(100% - 44px); transition: opacity .25s var(--ease), transform .25s var(--ease); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 登录与 FAQ 页 ---------- */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 22px; }
.auth-card { width: min(380px, 100%); text-align: center; }
.auth-card .brand-mark { width: 52px; height: 52px; border-radius: 14px; font-size: 26px; margin: 0 auto 22px; }
.auth-card h1 { font-size: 32px; }
.auth-card .lead { font-size: 17px; margin-bottom: 28px; }
.auth-input { width: 100%; border: 1px solid var(--hair); outline: 0; background: var(--surface); border-radius: 14px; padding: 14px 16px; font-size: 17px; text-align: center; transition: box-shadow .2s var(--ease); }
.auth-input:focus { box-shadow: 0 0 0 4px var(--accent-soft); border-color: var(--accent); }
.auth-card .pill { width: 100%; margin-top: 14px; }
.err { color: var(--red); font-size: 14px; min-height: 1.4em; margin-top: 12px; }
.shake { animation: shake .4s var(--ease); }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

.faq-wrap { max-width: 780px; margin: 0 auto; }
.faq-item { padding: 18px 22px; }
.faq-item + .faq-item { border-top: 1px solid var(--hair); }
.faq-item .meta { font-size: 13px; color: var(--ink-3); margin-bottom: 8px; }
.faq-item .actions { margin-top: 12px; justify-content: flex-end; }

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .sticky { position: static; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  .nav-inner, main { padding-left: 16px; padding-right: 16px; }
  .brand-name, .nav-link, .stepper span { display: none; }
  .hero { padding: 40px 0 24px; }
  h1 { font-size: 34px; }
  .hero.compact h1 { font-size: 30px; }
  .lead { font-size: 17px; }
  .composer textarea { padding: 18px; }
  .composer-foot { padding: 12px 18px 14px; }
  .inline-field { flex-direction: column; align-items: stretch; gap: 6px; }
  .row { padding: 16px 18px; }
  .row-meta, .row-body { margin-left: 0; }
  .seg { display: grid; width: 100%; }
  .seg button { padding: 7px 6px; }
  .dock { padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
  .note-input { display: none; }
  .dock-inner { gap: 10px; }
  .dock-go { width: 100%; justify-content: space-between; }
  .actions.split { flex-direction: column-reverse; align-items: stretch; }
  .actions-right { display: grid; grid-template-columns: 1fr 1fr; }
  .actions-left { justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
