/* ============================================================
   岁窦答题站 · 设计系统
   base.css：变量、重置、排版、按钮、表单、通用组件
   ============================================================ */

:root {
  --blue-50: #f2f8ff;
  --blue-100: #e4f0ff;
  --blue-150: #d8e9ff;
  --blue-200: #c9e0ff;
  --blue-300: #9cc6ff;
  --blue-400: #6aa8f8;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --blue-700: #1d4ed8;
  --navy: #1e3a8a;

  --ink: #0f172a;
  --text: #1f2937;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --line: #dbe7fb;
  --line-soft: #eaf1fd;

  --success: #16a34a;
  --success-bg: #e9f9ef;
  --warning: #d97706;
  --warning-bg: #fff5e6;
  --danger: #dc2626;
  --danger-bg: #feecec;

  --bg: #f4f9ff;
  --surface: #ffffff;
  --surface-soft: rgba(255, 255, 255, .72);

  --shadow-xs: 0 1px 2px rgba(30, 58, 138, .06);
  --shadow-sm: 0 4px 14px rgba(30, 58, 138, .07);
  --shadow: 0 10px 30px rgba(30, 58, 138, .09);
  --shadow-lg: 0 24px 60px rgba(30, 58, 138, .16);

  --r-xs: 8px;
  --r-sm: 10px;
  --r: 14px;
  --r-lg: 18px;
  --r-xl: 24px;

  --header-h: 68px;
  --container: 1180px;
  --font: "Microsoft YaHei", "PingFang SC", "HarmonyOS Sans SC", "Segoe UI", system-ui, sans-serif;
  --mono: "Cascadia Code", Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(900px 500px at 12% -10%, #e8f3ff 0%, rgba(232, 243, 255, 0) 60%),
    radial-gradient(800px 480px at 92% 0%, #eef6ff 0%, rgba(238, 246, 255, 0) 55%),
    linear-gradient(180deg, #f8fcff 0%, #eef6ff 55%, #f4f9ff 100%);
}

h1, h2, h3, h4, h5 {
  margin: 0;
  color: var(--ink);
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: .01em;
}

p { margin: 0; }

a {
  color: var(--blue-600);
  text-decoration: none;
  transition: color .18s ease;
}

a:hover { color: var(--blue-700); }

img { max-width: 100%; display: block; }

button, input, select, textarea { font: inherit; color: inherit; }

button { cursor: pointer; }

ul, ol { margin: 0; padding: 0; }

::selection { background: #cfe4ff; color: var(--navy); }

:focus-visible {
  outline: 2px solid var(--blue-500);
  outline-offset: 2px;
}

/* 滚动条 */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: #c8ddf7;
  border: 3px solid transparent;
  border-radius: 10px;
  background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: #a9c9ee; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 布局工具 ---------- */
.container {
  width: min(var(--container), calc(100% - 48px));
  margin-inline: auto;
}

.section { padding: 72px 0; }

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--blue-600);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--blue-500);
}

.section-title { font-size: clamp(24px, 3vw, 32px); }
.section-desc { color: var(--muted); font-size: 14.5px; margin-top: 8px; }

.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.hidden { display: none !important; }
.sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

.stack { display: grid; gap: 16px; }
.row { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; }

/* ---------- 按钮 ---------- */
.btn {
  --btn-bg: var(--blue-600);
  --btn-fg: #fff;
  --btn-border: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 0 20px;
  border: 1px solid var(--btn-border);
  border-radius: var(--r-sm);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  transition: transform .16s ease, box-shadow .16s ease, background .16s ease, border-color .16s ease;
}

.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--blue-500), var(--blue-600));
  box-shadow: 0 8px 20px rgba(37, 99, 235, .24);
}
.btn-primary:hover { box-shadow: 0 12px 26px rgba(37, 99, 235, .32); color: #fff; }

.btn-soft {
  background: var(--blue-100);
  color: var(--blue-700);
}
.btn-soft:hover { background: var(--blue-150); color: var(--blue-700); }

.btn-ghost {
  background: rgba(255, 255, 255, .7);
  border-color: var(--line);
  color: var(--navy);
}
.btn-ghost:hover { background: #fff; border-color: var(--blue-300); color: var(--navy); }

.btn-white {
  background: #fff;
  color: var(--blue-700);
  border-color: #fff;
  box-shadow: var(--shadow-sm);
}

.btn-text {
  min-height: 0;
  padding: 4px 6px;
  background: transparent;
  color: var(--blue-600);
  font-weight: 600;
  border: 0;
}
.btn-text:hover { color: var(--blue-700); background: transparent; }

.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { min-height: 34px; padding: 0 14px; font-size: 13px; border-radius: var(--r-xs); }
.btn-lg { min-height: 50px; padding: 0 28px; font-size: 16px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn-icon { gap: 0; width: 42px; padding: 0; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid transparent;
  border-radius: 50%;
  background: transparent;
  color: var(--navy);
  transition: background .16s ease, color .16s ease;
}
.icon-btn:hover { background: var(--blue-100); color: var(--blue-700); }
.icon-btn svg { width: 19px; height: 19px; }

/* ---------- 徽标 / 标签 ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--blue-100);
  color: var(--blue-700);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
}

.badge-soft { background: #f1f6ff; color: #4b6b9c; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-navy { background: #e7edfb; color: var(--navy); }

.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

/* ---------- 卡片 ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}

.card-pad { padding: 26px; }

.glass {
  background: var(--surface-soft);
  border: 1px solid rgba(255, 255, 255, .7);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

/* ---------- 表单 ---------- */
.field { display: grid; gap: 8px; }

.field > label,
.field-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--navy);
  font-size: 13.5px;
  font-weight: 600;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: #fff;
  color: var(--ink);
  font-size: 14.5px;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.textarea { min-height: 110px; resize: vertical; line-height: 1.65; }

.input::placeholder,
.textarea::placeholder { color: var(--muted-2); }

.input:hover,
.select:hover,
.textarea:hover { border-color: var(--blue-200); }

.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--blue-400);
  box-shadow: 0 0 0 4px rgba(59, 130, 246, .13);
}

.select {
  appearance: none;
  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 6 6.5 11 1.5' fill='none' stroke='%2364748b' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
}

.field-hint { color: var(--muted); font-size: 12.5px; line-height: 1.5; }
.field-error { color: var(--danger); font-size: 12.5px; }

.checkbox,
.radio {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: var(--text);
  font-size: 14px;
  cursor: pointer;
}

.checkbox input,
.radio input {
  width: 17px;
  height: 17px;
  margin: 3px 0 0;
  accent-color: var(--blue-600);
  flex: none;
}

/* ---------- 弹层 ---------- */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(15, 23, 42, .42);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  opacity: 0;
  visibility: hidden;
  transition: opacity .2s ease, visibility .2s ease;
}

.overlay.is-open { opacity: 1; visibility: visible; }

.dialog {
  width: min(480px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  padding: 28px;
  border-radius: var(--r-xl);
  background: #fff;
  box-shadow: var(--shadow-lg);
  transform: translateY(10px) scale(.98);
  transition: transform .22s cubic-bezier(.22, .61, .36, 1);
}

.overlay.is-open .dialog { transform: none; }

.dialog-wide { width: min(760px, 100%); }

.dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.dialog-title { font-size: 19px; }

.dialog-close {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: var(--blue-50);
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
}
.dialog-close:hover { background: var(--blue-100); color: var(--navy); }

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

/* ---------- 提示 ---------- */
.toast-wrap {
  position: fixed;
  top: 84px;
  left: 50%;
  z-index: 120;
  display: grid;
  gap: 10px;
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 220px;
  max-width: 420px;
  padding: 12px 18px;
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 14px;
  animation: toast-in .24s ease both;
}

.toast::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blue-500);
  flex: none;
}

.toast-success::before { background: var(--success); }
.toast-warning::before { background: var(--warning); }
.toast-danger::before { background: var(--danger); }
.toast.is-out { animation: toast-out .2s ease both; }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: none; }
}
@keyframes toast-out {
  to { opacity: 0; transform: translateY(-8px); }
}

/* ---------- 空状态 / 骨架 ---------- */
.empty {
  padding: 54px 24px;
  border: 1px dashed var(--blue-200);
  border-radius: var(--r-lg);
  background: rgba(255, 255, 255, .6);
  text-align: center;
}

.empty-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  margin-bottom: 14px;
  border-radius: 50%;
  background: var(--blue-100);
  color: var(--blue-600);
}

.empty-icon svg { width: 26px; height: 26px; }
.empty-title { color: var(--navy); font-weight: 700; }
.empty-desc { margin-top: 6px; color: var(--muted); font-size: 13.5px; }

.skeleton {
  border-radius: var(--r-sm);
  background: linear-gradient(90deg, #eef4fd 25%, #f7fbff 37%, #eef4fd 63%);
  background-size: 400% 100%;
  animation: shimmer 1.4s ease infinite;
}

@keyframes shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}

/* ---------- 其他 ---------- */
.divider {
  height: 1px;
  margin: 22px 0;
  background: var(--line-soft);
}

.progress-track {
  height: 7px;
  border-radius: 999px;
  background: var(--blue-100);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue-400), var(--blue-600));
  transition: width .3s ease;
}

.tag-list { display: flex; flex-wrap: wrap; gap: 8px; }

.kbd {
  padding: 1px 6px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 5px;
  background: #fff;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
}

body.no-scroll { overflow: hidden; }

@media (max-width: 768px) {
  body { font-size: 14.5px; }
  .container { width: calc(100% - 32px); }
  .section { padding: 48px 0; }
  .section-head { align-items: flex-start; flex-direction: column; gap: 10px; }
  .dialog { padding: 22px; }
}
