/* ==========================================================================
   设计系统：所有颜色、间距、圆角都是 CSS 变量。换品牌色只改 :root 里的 --brand-*。
   深色模式跟随系统（prefers-color-scheme），只换变量，不换组件。
   手机优先：先写 375px 的样式，再用 min-width 往大屏幕加。
   ========================================================================== */

:root {
  --brand-50: #f0fdfa;
  --brand-100: #ccfbf1;
  --brand-500: #14b8a6;
  --brand-600: #0d9488;
  --brand-700: #0f766e;
  --brand-800: #115e59;

  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --text: #0f172a;
  --muted: #475569;          /* 在 --bg 和 --surface 上对比度都 ≥ 4.5:1 */
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --primary: var(--brand-700);
  --primary-hover: var(--brand-800);
  --on-primary: #ffffff;
  --link: var(--brand-700);
  --ring: 0 0 0 3px rgb(20 184 166 / 0.35);

  --success-bg: #ecfdf5; --success-text: #065f46; --success-line: #a7f3d0;
  --error-bg: #fef2f2;   --error-text: #991b1b;   --error-line: #fecaca;
  --info-bg: #eff6ff;    --info-text: #1e40af;    --info-line: #bfdbfe;
  --danger: #b91c1c;     --danger-hover: #991b1b;

  --radius: 10px;
  --radius-sm: 6px;
  --shadow: 0 1px 2px rgb(15 23 42 / 0.06), 0 4px 16px rgb(15 23 42 / 0.06);
  --space: 1rem;
  --container: 1120px;
  --header-h: 60px;

  /* 系统字体，不加载网络字体（缅甸网速慢）。缅文字体放在中文之后作为后备。 */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial,
          "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans SC",
          "Myanmar Text", "Noto Sans Myanmar", Padauk, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --leading: 1.6;

  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220;
    --surface: #111a2e;
    --surface-2: #17223a;
    --text: #e2e8f0;
    --muted: #a3b1c6;
    --line: #22304a;
    --line-strong: #334766;
    --primary: var(--brand-500);
    --primary-hover: #2dd4bf;
    --on-primary: #042f2e;       /* 深色字压亮色按钮，对比度够 */
    --link: #5eead4;
    --success-bg: #052e22; --success-text: #a7f3d0; --success-line: #065f46;
    --error-bg: #3b0d0d;   --error-text: #fecaca;   --error-line: #7f1d1d;
    --info-bg: #0c1a3d;    --info-text: #bfdbfe;    --info-line: #1e3a8a;
    --danger: #ef4444;     --danger-hover: #f87171;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 4px 16px rgb(0 0 0 / 0.3);
    color-scheme: dark;
  }
}

/* 缅文字形高、上下都有附加符号：行距至少 2.0，标题和按钮也要放宽，
   否则上一行的下标会压住下一行的上标。缅文也不能加字距（会拆散叠字）。 */
html[lang="my"] { --leading: 2; }
html[lang="my"] :is(h1, h2, h3, .btn, .badge, .menu > summary) { line-height: 1.8; }
html[lang="my"] :is(.table th, .nav-group-title) { letter-spacing: normal; text-transform: none; }

/* ---------- 基础 ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  line-height: var(--leading);
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-wrap: anywhere;          /* 长邮箱、长缅文词不撑破布局 */
}
img, svg { max-width: 100%; height: auto; }
a { color: var(--link); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
h1, h2, h3 { line-height: 1.3; margin: 0 0 0.6em; }
h1 { font-size: clamp(1.5rem, 1.2rem + 1.4vw, 2.1rem); }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
code, pre { font-family: var(--font-mono); font-size: 0.92em; }
pre { overflow: auto; background: var(--surface-2); padding: 0.75rem; border-radius: var(--radius-sm); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-sm); }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); border: 0; }
.skip-link { position: absolute; left: -999px; top: 0.5rem; background: var(--surface); padding: 0.5rem 1rem; z-index: 100; }
.skip-link:focus { left: 0.5rem; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
.inline { display: inline; margin: 0; }
.empty { color: var(--muted); text-align: center; padding: 2rem 1rem; }

/* ---------- 布局 ---------- */
.container { width: min(var(--container), 100% - 2rem); margin-inline: auto; }
.main { flex: 1; padding-block: 1.5rem 3rem; }
.narrow { max-width: 440px; margin-inline: auto; }
.stack { display: grid; gap: 1rem; }
.grid { display: grid; gap: 1rem; }
.grid.two { grid-template-columns: 1fr; }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr)); }
@media (min-width: 900px) { .grid.two { grid-template-columns: 1fr 1fr; } }

/* ---------- 头部导航 ---------- */
.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.header-row { display: flex; align-items: center; gap: 1rem; min-height: var(--header-h); flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 1.1rem; color: var(--text); text-decoration: none; margin-right: auto; }
.site-nav { display: none; width: 100%; flex-direction: column; gap: 0.25rem; padding-bottom: 1rem; }
.site-nav.is-open { display: flex; }
.site-nav a, .site-nav .link-button { color: var(--text); text-decoration: none; padding: 0.5rem 0.25rem; }
.site-nav a[aria-current="page"] { color: var(--primary); font-weight: 600; }
.site-nav .btn { color: var(--on-primary); text-align: center; }
.nav-spacer { display: none; }

.nav-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border: 1px solid var(--line); border-radius: var(--radius-sm);
  background: transparent; color: var(--text); cursor: pointer;
}
.burger, .burger::before, .burger::after {
  display: block; width: 18px; height: 2px; background: currentColor; border-radius: 2px; position: relative;
}
.burger::before, .burger::after { content: ""; position: absolute; left: 0; }
.burger::before { top: -6px; }
.burger::after { top: 6px; }

@media (min-width: 900px) {
  .nav-toggle { display: none; }
  .site-nav { display: flex; flex-direction: row; align-items: center; width: auto; flex: 1; padding: 0; gap: 0.5rem; }
  .nav-spacer { display: block; flex: 1; }
  .brand { margin-right: 1rem; }
}

/* 下拉菜单（用 <details>，不需要 JS 也能用） */
.menu { position: relative; }
.menu > summary { list-style: none; cursor: pointer; padding: 0.5rem 0.25rem; color: var(--text); }
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary::after { content: " ▾"; color: var(--muted); }
.menu-panel {
  display: flex; flex-direction: column; min-width: 160px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 0.35rem;
}
.menu-panel a { padding: 0.45rem 0.75rem; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; }
.menu-panel a:hover, .menu-panel a[aria-current="true"] { background: var(--surface-2); }
@media (min-width: 900px) {
  .menu-panel { position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; }
}

.site-footer { border-top: 1px solid var(--line); padding: 1.5rem 0; color: var(--muted); font-size: 0.9rem; }

/* ---------- 手机底部导航栏（partials/tab-bar.php） ----------
   固定在屏幕底部，避开 iPhone 底部的横条（safe-area，需要 head 里的 viewport-fit=cover）。
   body 底部留出同样的高度，最后一行内容不会被挡住。≥900px 隐藏，用顶部导航。 */
:root { --tab-bar-h: 60px; }
html[lang="my"] { --tab-bar-h: 68px; }
body { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
body.has-tab-bar { padding-bottom: calc(var(--tab-bar-h) + env(safe-area-inset-bottom)); }
.tab-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex;
  min-height: calc(var(--tab-bar-h) + env(safe-area-inset-bottom));
  padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background: var(--surface); border-top: 1px solid var(--line);
}
.tab-bar a {
  flex: 1 1 0; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-height: var(--tab-bar-h); padding: 4px 2px;
  color: var(--muted); text-decoration: none; font-size: 0.75rem; line-height: 1.3;
}
.tab-bar a span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
html[lang="my"] .tab-bar a { line-height: 1.8; }
.tab-bar svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tab-bar a[aria-current="page"] { color: var(--primary); font-weight: 600; }
.tab-bar a[aria-current="page"] svg { stroke-width: 2.2; }
@media (min-width: 900px) {
  .tab-bar { display: none; }
  body.has-tab-bar { padding-bottom: 0; }
}

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-height: 44px; padding: 0.55rem 1.1rem;
  font: inherit; font-weight: 600; line-height: 1.2;
  color: var(--on-primary); background: var(--primary);
  border: 1px solid transparent; border-radius: var(--radius-sm);
  text-decoration: none; cursor: pointer;
}
.btn:hover { background: var(--primary-hover); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line-strong); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: var(--danger-hover); }
.btn-small { min-height: 36px; padding: 0.35rem 0.8rem; font-size: 0.92rem; }
.btn-block { width: 100%; }
.link-button { background: none; border: 0; padding: 0; font: inherit; color: var(--link); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.actions { display: flex; gap: 0.75rem; flex-wrap: wrap; }

/* ---------- 表单 ---------- */
label { display: grid; gap: 0.35rem; font-weight: 600; font-size: 0.95rem; }
label.check { display: flex; align-items: center; gap: 0.5rem; font-weight: 500; }
input, select, textarea {
  font: inherit; font-weight: 400; color: var(--text);
  width: 100%; min-height: 44px; padding: 0.55rem 0.75rem;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
}
input[type="checkbox"], input[type="radio"] { width: 1.15rem; min-height: 0; height: 1.15rem; accent-color: var(--primary); }
input[type="file"] { padding: 0.4rem; }
input:disabled { background: var(--surface-2); color: var(--muted); }
textarea { resize: vertical; line-height: var(--leading); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: var(--ring); }
.hint { font-weight: 400; color: var(--muted); font-size: 0.88rem; }
.code-input { font-family: var(--font-mono); letter-spacing: 0.15em; max-width: 14rem; }
.row-form { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.row-form input { flex: 1 1 10rem; }
.form-card h1 { font-size: 1.5rem; }
.form-links { margin: 1rem 0 0; text-align: center; font-size: 0.95rem; }
.divider { display: flex; align-items: center; gap: 0.75rem; color: var(--muted); margin: 1rem 0; font-size: 0.9rem; }
.divider::before, .divider::after { content: ""; flex: 1; border-top: 1px solid var(--line); }

/* ---------- 卡片、提示、徽章 ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); }
.card-body { padding: 1rem; }
.callout { border-color: var(--brand-500); }
.post-card { padding: 0; overflow: hidden; color: var(--text); text-decoration: none; display: flex; flex-direction: column; }
.post-card img { aspect-ratio: 16 / 9; object-fit: cover; width: 100%; }
.post-card h3 { margin-bottom: 0.25rem; }
.post-card time { color: var(--muted); font-size: 0.88rem; }
.post-card:hover h3 { color: var(--primary); }

.alert {
  display: flex; align-items: flex-start; gap: 0.75rem; justify-content: space-between;
  padding: 0.75rem 1rem; margin-bottom: 1rem; border-radius: var(--radius-sm); border: 1px solid;
}
.alert-success { background: var(--success-bg); color: var(--success-text); border-color: var(--success-line); }
.alert-error { background: var(--error-bg); color: var(--error-text); border-color: var(--error-line); }
.alert-info { background: var(--info-bg); color: var(--info-text); border-color: var(--info-line); }
.alert-close { background: none; border: 0; font-size: 1.25rem; line-height: 1; color: inherit; cursor: pointer; padding: 0 0.25rem; }

.badge { display: inline-block; white-space: nowrap; padding: 0.1rem 0.55rem; border-radius: 999px; font-size: 0.8rem; font-weight: 600; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); }
.badge-success { background: var(--success-bg); color: var(--success-text); border-color: var(--success-line); }
.badge-danger { background: var(--error-bg); color: var(--error-text); border-color: var(--error-line); }

/* ---------- 表格 ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.table th, .table td { text-align: left; padding: 0.65rem 0.75rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.table th { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--muted); font-weight: 600; }
.table tr.is-inactive td { opacity: 0.6; }
@media (max-width: 640px) { .hide-sm { display: none; } }

.pagination { display: flex; gap: 1rem; align-items: center; justify-content: center; margin: 1.5rem 0; }

/* ---------- 页面块 ---------- */
.hero { padding: 2rem 0 2.5rem; }
.hero .lead { font-size: 1.15rem; color: var(--muted); max-width: 40rem; }
.prose { max-width: 42rem; margin-inline: auto; }
.prose .cover { border-radius: var(--radius); margin-bottom: 1.5rem; }
.error-page { padding-top: 3rem; }
.error-code { font-size: 3.5rem; font-weight: 800; color: var(--line-strong); margin: 0; }
.debug { text-align: left; font-size: 0.8rem; max-height: 50vh; }

/* 两步验证设置 */
.steps { display: grid; gap: 1.25rem; padding-left: 1.25rem; margin: 0; }
.qr { background: #fff; display: inline-block; padding: 0.5rem; border-radius: var(--radius-sm); margin: 0.75rem 0; }
.qr svg { display: block; width: 200px; height: 200px; }
.secret { font-size: 1.05rem; letter-spacing: 0.08em; word-break: break-all; }
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; padding: 0; list-style: none; }
.codes code { display: block; padding: 0.4rem 0.6rem; background: var(--surface-2); border-radius: var(--radius-sm); text-align: center; font-size: 1rem; }
.only-mobile { display: block; }
@media (min-width: 900px) { .only-mobile { display: none; } }

/* ---------- 法务页面与页脚 ---------- */
.legal { max-width: 44rem; padding: 1.5rem 0 2.5rem; }
.legal h1 { font-size: 1.6rem; margin: 0 0 0.3rem; }
.legal h2 { font-size: 1.05rem; margin: 1.6rem 0 0.5rem; }
.legal p, .legal li { max-width: 42rem; }
.legal ul { padding-left: 1.2rem; display: grid; gap: 0.35rem; }
.site-footer-row { display: flex; gap: 1rem; justify-content: space-between; flex-wrap: wrap; align-items: center; }
.site-footer-row nav { display: flex; gap: 1rem; }
