/* authgate 登录页 —— 亮色、移动端优先、零 CDN、零框架、零 JS。
 *
 * tab 切换是纯 CSS：两个 `input[type=radio].tabin` 藏在 .tabs 最前面，
 * 用 `:checked ~` 兄弟选择器点亮对应的 .tabbar label 与 .pane。
 * 不用 JS 的理由和整个 fitcoach 一样：三年后打开还要能跑。
 *
 * ⚠ 本文件由 `{gate.URL_PREFIX}/static/gate.css` 提供。前缀是派生的，
 *   别在 HTML 里写死 —— 写死过一次，结果是 404 + 整页无样式（2026-08-05）。
 */
:root {
  --bg-a: #eef1f6;
  --bg-b: #f7f8fa;
  --card: #ffffff;
  --ink: #14181d;
  --muted: #6b7280;
  --faint: #9aa2ad;
  --line: #e4e7ec;
  --accent: #2f6df6;
  --accent-dk: #1e51d4;
  --err-bg: #fef3f2;
  --err: #b42318;
  --ok-bg: #ecfdf3;
  --ok: #067647;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 28px 20px;
  background: radial-gradient(1100px 620px at 50% -10%, var(--bg-b), var(--bg-a));
  color: var(--ink);
  font: 16px/1.6 -apple-system, BlinkMacSystemFont, "PingFang SC",
        "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

.card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 30px 26px 26px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, .04),
              0 12px 32px -12px rgba(16, 24, 40, .14);
}

.mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  margin-bottom: 16px;
  border-radius: 13px;
  color: var(--accent);
  background: #eef3ff;
  border: 1px solid #dfe8ff;
}

h1 { margin: 0 0 5px; font-size: 21px; letter-spacing: .2px; }
.sub { margin: 0 0 20px; color: var(--muted); font-size: 13.5px; }

/* --- 提示条 --- */
.msg {
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13.5px;
  line-height: 1.5;
}
.msg.err { background: var(--err-bg); color: var(--err); border: 1px solid #fecdc9; }
.msg.ok  { background: var(--ok-bg);  color: var(--ok);  border: 1px solid #b9e6c9; }

/* --- tab（纯 CSS）--- */
.tabin { position: absolute; opacity: 0; pointer-events: none; }

.tabbar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  margin-bottom: 20px;
  background: #f2f4f7;
  border-radius: 11px;
}
.tabbar label {
  padding: 8px 4px;
  text-align: center;
  font-size: 14px;
  font-weight: 500;
  color: var(--muted);
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  transition: background .15s, color .15s;
}
.tabbar label:hover { color: var(--ink); }

.pane { display: none; }
#tab-pw:checked ~ .tabbar label[for="tab-pw"],
#tab-em:checked ~ .tabbar label[for="tab-em"] {
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .08);
}
#tab-pw:checked ~ .pane-pw,
#tab-em:checked ~ .pane-em { display: block; }

/* 键盘可达：radio 拿到焦点时给对应 label 描边 */
.tabin:focus-visible + .tabin + .tabbar label[for="tab-pw"],
.tabin + .tabin:focus-visible ~ .tabbar label[for="tab-em"] {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

/* --- 表单 --- */
.stack { display: flex; flex-direction: column; gap: 8px; }

label[for] {
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
}

input[type="password"],
input[type="email"],
input[type="text"] {
  width: 100%;
  padding: 12px 14px;
  font-size: 17px;            /* ≥16px 防 iOS 聚焦时自动放大页面 */
  font-family: inherit;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  transition: border-color .15s, box-shadow .15s;
}
input::placeholder { color: var(--faint); }
input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3.5px rgba(47, 109, 246, .14);
}

.otp {
  letter-spacing: .42em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
/* 字距只给真输入的数字。不排除 placeholder 的话「6 位数字」会被拉成「6 位 数 字」。 */
.otp::placeholder { letter-spacing: normal; }

button[type="submit"] {
  margin-top: 6px;
  padding: 12px;
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: var(--accent);
  border: 0;
  border-radius: 10px;
  cursor: pointer;
  transition: background .15s;
}
button[type="submit"]:hover  { background: var(--accent-dk); }
button[type="submit"]:active { transform: translateY(.5px); }

/* CF Access 那条路是一个**链接**（要跳去 Cloudflare 边缘），不是表单提交，
   所以单独给 <a> 一套和 submit 按钮一致的外观。 */
.hint {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--muted);
}
a.btn {
  display: block;
  padding: 12px;
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border-radius: 10px;
  text-decoration: none;
  transition: background .15s;
}
a.btn:hover { background: var(--accent-dk); }

/* 「重新发送」做成链接样式的 button —— 它必须是 form 提交（POST），不能是 <a> */
.inline { margin-top: 14px; text-align: center; }
button.link {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  font-size: 13.5px;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.foot { margin: 12px 0 0; text-align: center; font-size: 13.5px; }
.foot a { color: var(--muted); text-decoration: underline; text-underline-offset: 3px; }
.foot a:hover { color: var(--ink); }

.brand {
  margin: 0;
  font-size: 12px;
  letter-spacing: .09em;
  color: var(--faint);
}

@media (max-width: 380px) {
  .card { padding: 24px 18px 22px; border-radius: 15px; }
}
