/* ============ Real TOEFL 统一站点 — 基础样式 ============ */
:root {
  --bg: #f5f7fa;
  --surface: #ffffff;
  --border: #e2e8f0;
  --text: #1a202c;
  --text-dim: #64748b;
  --brand: #1d4ed8;
  --brand-dark: #1e3a8a;
  --brand-light: #eff6ff;
  --gold: #b8860b;
  --ok: #15803d;
  --err: #dc2626;
  --warn: #d97706;
  --shadow: 0 1px 3px rgba(16, 24, 40, .08), 0 1px 2px rgba(16, 24, 40, .04);
  --shadow-lg: 0 10px 30px rgba(16, 24, 40, .12);
  --radius: 10px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
          "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- 顶部导航 ---------- */
.site-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.site-header .inner {
  max-width: 1440px; margin: 0 auto;
  display: flex; align-items: center; gap: 20px;
  padding: 10px 20px;
}
.site-logo {
  font-weight: 700; font-size: 17px; color: var(--brand-dark);
  white-space: nowrap; letter-spacing: -.2px;
}
.site-logo span { color: var(--gold); }

.site-nav { display: flex; gap: 4px; flex: 1; flex-wrap: wrap; }
.site-nav a {
  padding: 7px 13px; border-radius: 8px;
  color: var(--text-dim); font-size: 14px; font-weight: 500;
  white-space: nowrap;
}
.site-nav a:hover { background: var(--brand-light); color: var(--brand); text-decoration: none; }
.site-nav a.active { background: var(--brand); color: #fff; }

.header-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 12px; border-radius: 20px;
  background: var(--brand-light); color: var(--brand-dark);
  font-size: 13.5px; font-weight: 500; cursor: pointer;
  border: 1px solid #dbeafe;
}
.user-chip .avatar {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--brand); color: #fff;
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
}
.plan-tag {
  font-size: 11px; padding: 1px 6px; border-radius: 8px;
  background: var(--gold); color: #fff; font-weight: 600;
}
.plan-tag.free { background: #94a3b8; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 16px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font-size: 14px; font-weight: 500;
  cursor: pointer; transition: all .15s; font-family: inherit;
  white-space: nowrap;
}
.btn:hover { border-color: #cbd5e1; background: #f8fafc; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.btn-gold { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn-gold:hover { filter: brightness(.93); }
.btn-lg { padding: 12px 28px; font-size: 15.5px; border-radius: 10px; }
.btn-sm { padding: 5px 11px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---------- 卡片与布局 ---------- */
.wrap { max-width: 1440px; margin: 0 auto; padding: 24px 20px 60px; }
.wrap-narrow { max-width: 760px; margin: 0 auto; padding: 40px 20px 60px; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 22px; margin-bottom: 18px;
}

.page-title { font-size: 24px; font-weight: 700; margin: 0 0 6px; letter-spacing: -.4px; }
.page-sub { color: var(--text-dim); font-size: 14px; margin: 0 0 22px; }

/* ---------- 首页模块卡 ---------- */
.mod-grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.mod-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow); transition: all .18s;
  display: flex; flex-direction: column;
}
.mod-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); border-color: #c7d2fe; }
.mod-card h3 { margin: 0 0 4px; font-size: 17px; }
.mod-card .en { font-size: 12px; color: var(--text-dim); letter-spacing: .5px; text-transform: uppercase; }
.mod-card .stat { margin: 12px 0; font-size: 13px; color: var(--text-dim); }
.mod-card .stat b { color: var(--brand-dark); font-size: 20px; font-weight: 700; }
.mod-card .go { margin-top: auto; }

/* ---------- 统计条 ---------- */
.stat-row { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); }
.stat-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px 18px;
}
.stat-box .k { font-size: 12.5px; color: var(--text-dim); }
.stat-box .v { font-size: 26px; font-weight: 700; color: var(--brand-dark); line-height: 1.25; }
.stat-box .v small { font-size: 14px; color: var(--text-dim); font-weight: 500; }

/* ---------- 表格 ---------- */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th {
  text-align: left; padding: 10px 12px; font-size: 12.5px;
  color: var(--text-dim); font-weight: 600; border-bottom: 2px solid var(--border);
  background: #f8fafc; white-space: nowrap;
}
.tbl td { padding: 11px 12px; border-bottom: 1px solid var(--border); }
.tbl tr:last-child td { border-bottom: none; }
.tbl tr:hover td { background: #fafbfc; }
.tbl .num { font-variant-numeric: tabular-nums; }

/* ---------- 徽章 ---------- */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 20px;
  font-size: 12px; font-weight: 600;
}
.badge-ok { background: #dcfce7; color: var(--ok); }
.badge-err { background: #fee2e2; color: var(--err); }
.badge-warn { background: #fef3c7; color: var(--warn); }
.badge-info { background: var(--brand-light); color: var(--brand); }
.badge-mute { background: #f1f5f9; color: var(--text-dim); }

/* ---------- 表单 ---------- */
.field { margin-bottom: 15px; }
.field label { display: block; font-size: 13.5px; font-weight: 600; margin-bottom: 6px; }
.field input, .field textarea, .field select {
  width: 100%; padding: 10px 13px;
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 15px; font-family: inherit; background: var(--surface);
  color: var(--text); transition: border-color .15s;
}
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none; border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, .1);
}
.field .hint { font-size: 12.5px; color: var(--text-dim); margin-top: 5px; }

.msg { padding: 10px 14px; border-radius: 8px; font-size: 13.5px; margin-bottom: 14px; display: none; }
.msg.show { display: block; }
.msg-err { background: #fef2f2; color: var(--err); border: 1px solid #fecaca; }
.msg-ok { background: #f0fdf4; color: var(--ok); border: 1px solid #bbf7d0; }

/* ---------- 弹窗 ---------- */
.modal-mask {
  position: fixed; inset: 0; background: rgba(15,23,42,.5);
  display: none; place-items: center; z-index: 1000; padding: 20px;
}
.modal-mask.show { display: grid; }
.modal {
  background: var(--surface); border-radius: 14px;
  padding: 28px; width: 100%; max-width: 400px;
  box-shadow: 0 25px 60px rgba(0,0,0,.3);
  max-height: 90vh; overflow-y: auto;
}
.modal h2 { margin: 0 0 4px; font-size: 20px; }
.modal .sub { color: var(--text-dim); font-size: 13.5px; margin: 0 0 20px; }
.modal .tabs { display: flex; gap: 4px; margin-bottom: 20px; background: #f1f5f9; padding: 4px; border-radius: 9px; }
.modal .tabs button {
  flex: 1; padding: 8px; border: none; background: transparent;
  border-radius: 7px; font-size: 14px; font-weight: 600;
  color: var(--text-dim); cursor: pointer; font-family: inherit;
}
.modal .tabs button.active { background: var(--surface); color: var(--brand); box-shadow: var(--shadow); }

/* ---------- 考试界面 ---------- */
.exam-bar {
  position: sticky; top: 57px; z-index: 50;
  background: var(--brand-dark); color: #fff;
  padding: 10px 20px; display: flex; align-items: center; gap: 18px;
  box-shadow: var(--shadow);
}
.exam-bar .timer { font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.exam-bar .timer.low { color: #fca5a5; animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .55; } }
.exam-bar .progress { flex: 1; height: 6px; background: rgba(255,255,255,.25); border-radius: 3px; overflow: hidden; }
.exam-bar .progress i { display: block; height: 100%; background: var(--gold); transition: width .3s; }

.q-block { border-bottom: 1px solid var(--border); padding: 18px 0; }
.q-block:last-child { border-bottom: none; }
.q-stem { font-weight: 600; margin-bottom: 12px; font-size: 15px; }
.opt {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 13px; border: 1px solid var(--border);
  border-radius: 8px; margin-bottom: 8px; cursor: pointer;
  transition: all .12s; background: var(--surface);
}
.opt:hover { border-color: #c7d2fe; background: #fafbff; }
.opt.sel { border-color: var(--brand); background: var(--brand-light); }
.opt.correct { border-color: var(--ok); background: #f0fdf4; }
.opt.wrong { border-color: var(--err); background: #fef2f2; }
.opt.locked { cursor: default; }
.opt .key {
  width: 22px; height: 22px; border-radius: 50%; flex-shrink: 0;
  background: #f1f5f9; display: grid; place-items: center;
  font-size: 12.5px; font-weight: 700; color: var(--text-dim);
}
.opt.sel .key { background: var(--brand); color: #fff; }
.opt.correct .key { background: var(--ok); color: #fff; }
.opt.wrong .key { background: var(--err); color: #fff; }

/* ---------- 报告 ---------- */
.score-hero {
  text-align: center; padding: 32px 20px;
  background: linear-gradient(135deg, var(--brand-dark), var(--brand));
  border-radius: 14px; color: #fff; margin-bottom: 22px;
}
.score-hero .big { font-size: 64px; font-weight: 800; line-height: 1; letter-spacing: -2px; }
.score-hero .big small { font-size: 22px; font-weight: 500; opacity: .75; }
.score-hero .cap { opacity: .85; font-size: 15px; margin-top: 8px; }

.bar-wrap { height: 9px; background: #e2e8f0; border-radius: 5px; overflow: hidden; margin-top: 7px; }
.bar-wrap i { display: block; height: 100%; border-radius: 5px; background: var(--brand); transition: width .5s; }

.empty { text-align: center; padding: 50px 20px; color: var(--text-dim); }
.empty .icon { font-size: 42px; margin-bottom: 12px; opacity: .5; }

.toast {
  position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(90px);
  background: #1e293b; color: #fff; padding: 12px 22px; border-radius: 9px;
  font-size: 14px; z-index: 2000; transition: transform .28s; box-shadow: var(--shadow-lg);
}
.toast.show { transform: translateX(-50%) translateY(0); }

@media (max-width: 720px) {
  .site-header .inner { flex-wrap: wrap; gap: 10px; padding: 9px 14px; }
  .site-nav { order: 3; width: 100%; overflow-x: auto; padding-bottom: 2px; }
  .site-nav a { padding: 6px 11px; font-size: 13px; }
  .site-logo { font-size: 15px; }
  .wrap { padding: 16px 14px 50px; }
  .exam-bar { top: 0; padding: 9px 14px; gap: 12px; }
  .exam-bar .timer { font-size: 17px; }
  .score-hero .big { font-size: 52px; }
  .tbl { font-size: 13px; }
  .tbl th, .tbl td { padding: 8px 8px; }
}
