/* 统一尺寸计算 */
* {
  box-sizing: border-box;
}

:root {
  color-scheme: light;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --text: #172b4d;
  --muted: #64748b;
  --border: #dce5f1;
}

/* 必须保留 hidden 的隐藏行为 */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100svh;
  padding: 40px 20px;
  display: grid;
  place-items: center;

  font-family:
    system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  line-height: 1.6;

  background:
    radial-gradient(
      circle at 15% 15%,
      #dbeafe 0,
      transparent 45%
    ),
    radial-gradient(
      circle at 85% 85%,
      #e0e7ff 0,
      transparent 45%
    ),
    #f4f7fc;
}

/* 页面卡片 */
main {
  width: 100%;
  max-width: 460px;
  padding: 36px;
  background: #ffffff;
  border: 1px solid #e8edf5;
  border-radius: 24px;
  box-shadow:
    0 24px 70px rgb(30 64 175 / 10%),
    0 4px 12px rgb(15 23 42 / 4%);
}

/* 用纯 CSS 绘制品牌标识 */
main::before {
  content: "T";
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-bottom: 20px;
  border-radius: 16px;
  background: linear-gradient(135deg, #2563eb, #6366f1);
  box-shadow: 0 8px 20px rgb(37 99 235 / 20%);
  color: #ffffff;
  font-size: 28px;
  font-weight: 800;
}

h1 {
  margin: 0 0 8px;
  font-size: 28px;
  line-height: 1.3;
  letter-spacing: -0.5px;
}

h2 {
  margin: 24px 0 16px;
  font-size: 19px;
}

p {
  margin: 14px 0;
  overflow-wrap: anywhere;
}

main > p,
form > p,
#login-section > p {
  color: var(--muted);
  font-size: 14px;
}

/* 表单 */
form {
  margin-top: 22px;
}

form p {
  margin: 0 0 18px;
}

label {
  display: inline-block;
  margin-bottom: 7px;
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
}

input {
  width: 100%;
  min-height: 48px;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8faff;
  color: var(--text);
  font: inherit;
  font-size: 16px;
  transition:
    border-color 0.15s ease,
    box-shadow 0.15s ease,
    background-color 0.15s ease;
}

input::placeholder {
  color: #7c8ba1;
}

input:focus {
  outline: none;
  border-color: var(--primary);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgb(37 99 235 / 12%);
}

/* 按钮与链接 */
button {
  width: 100%;
  min-height: 48px;
  padding: 12px 18px;
  border: 0;
  border-radius: 12px;
  background: var(--primary);
  color: #ffffff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition:
    background-color 0.15s ease,
    transform 0.15s ease;
}

button:hover:not(:disabled) {
  background: var(--primary-hover);
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

button:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid #2563eb;
  outline-offset: 4px;
}

a {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* 请求状态提示 */
#status {
  margin: 18px 0;
  padding: 12px 14px;
  border: 1px solid #dbeafe;
  border-radius: 12px;
  background: #eff6ff;
  color: #1e40af;
  font-size: 14px;
}

#status:empty {
  display: none;
}

/* 注册成功与已登录区域 */
#result,
#user-section {
  margin-top: 20px;
  padding: 20px;
  border: 1px solid #dbeafe;
  border-radius: 16px;
  background: #f8faff;
}

#result h2,
#user-section h2 {
  margin-top: 0;
}

#account-no,
#current-account {
  display: block;
  margin-top: 6px;
  color: var(--primary);
  font-size: clamp(24px, 6vw, 30px);
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  letter-spacing: 2px;
}

#registered-nickname,
#current-nickname {
  font-weight: 600;
}

#logout-button {
  margin-top: 10px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: #334155;
}

#logout-button:hover:not(:disabled) {
  background: #eef2f7;
}

.page-footer {
  margin-top: 24px;
  color: var(--muted);
  text-align: center;
  font-size: 13px;
}

/* 手机适配 */
@media (max-width: 480px) {
  body {
    padding: 20px 14px;
  }

  main {
    padding: 28px 22px;
    border-radius: 20px;
  }
}

/* 尊重用户的减少动画设置 */
@media (prefers-reduced-motion: reduce) {
  input,
  button {
    transition: none;
  }
}