/* Hallmark · genre: modern-minimal · macrostructure: Workbench · tone: utilitarian · theme: existing teal · contrast: pass */
/* Hallmark · pre-emit critique: P5 H5 E4 S5 R5 V5 */
:root {
  --teal-dark: #163d42;
  --teal-mid: #236068;
  --teal: #3a9099;
  --teal-light: #66abb2;
  --teal-bg: #eaf5f6;
  --border: #d7e8ea;
  --text: #1c2b2d;
  --text-muted: #5c7275;
  --danger: #c0392b;
  --good: #2a7a4f;
  --radius: 12px;
  --shadow: 0 8px 28px rgba(22, 61, 66, 0.10);
}

* { box-sizing: border-box; }
html, body { overflow-x: clip; }

body {
  margin: 0;
  font-family: "PingFang SC", "Noto Sans SC", "Microsoft YaHei", -apple-system, sans-serif;
  background: #f4f9f9;
  color: var(--text);
  line-height: 1.6;
}

a { color: var(--teal-mid); }

.topbar {
  background: linear-gradient(160deg, var(--teal-dark) 0%, var(--teal-mid) 70%, var(--teal) 100%);
  color: #fff;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar .brand-group { display: flex; align-items: center; gap: 12px; }
.topbar .brand-group img {
  height: 46px;
  width: auto;
  object-fit: contain;
  filter: brightness(0) invert(1);
  opacity: 0.95;
}
.topbar .brand { font-size: 1.15rem; font-weight: 700; letter-spacing: 0.04em; }
.topbar .brand small { display: block; font-size: 0.68rem; font-weight: 400; opacity: 0.75; letter-spacing: 0.12em; }
.topbar .nav-actions { display: flex; gap: 12px; align-items: center; font-size: 0.88rem; }
.topbar button.link, .topbar a.link { background: none; border: none; color: #d9f0f1; cursor: pointer; font-size: 0.88rem; }

.site-footer {
  max-width: 880px;
  margin: 0 auto;
  padding: 24px 20px 40px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.8;
}
.site-footer a { color: var(--text-muted); text-decoration: underline; }
.site-footer a:hover { color: var(--teal-mid); }

.page {
  max-width: 880px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}
.page.narrow { max-width: 460px; }

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
  margin-bottom: 20px;
}

h1.page-title { font-size: 1.4rem; margin: 0 0 4px; }
p.page-sub { color: var(--text-muted); margin: 0 0 24px; font-size: 0.92rem; }

label { display: block; font-size: 0.8rem; font-weight: 700; color: var(--teal-mid); letter-spacing: 0.04em; margin: 16px 0 6px; }
label:first-child { margin-top: 0; }

input[type="text"], input[type="email"], input[type="password"], input[type="number"], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 0.95rem;
  font-family: inherit;
  color: var(--text);
  background: #fff;
}
textarea { resize: vertical; min-height: 120px; line-height: 1.7; }

.password-field { position: relative; }
.password-field input { padding-right: 40px; }
.pw-toggle {
  position: absolute;
  right: 6px; top: 50%; transform: translateY(-50%);
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  background: none; border: none; border-radius: 6px;
  cursor: pointer; color: var(--text-muted);
  padding: 0;
}
.pw-toggle:hover { color: var(--teal-mid); background: var(--teal-bg); }
.pw-toggle svg { width: 18px; height: 18px; }
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--teal-light);
  box-shadow: 0 0 0 3px rgba(102, 171, 178, 0.18);
}

.row { display: flex; gap: 14px; }
.row > * { flex: 1; min-width: 0; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: 8px;
  padding: 11px 22px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}
.btn-primary { background: linear-gradient(135deg, var(--teal-mid) 0%, var(--teal-light) 100%); color: #fff; box-shadow: 0 4px 14px rgba(58, 144, 153, 0.35); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-ghost { background: var(--teal-bg); color: var(--teal-mid); }
.btn-danger { background: #fbeceb; color: var(--danger); }
.btn-block { width: 100%; justify-content: center; }

.msg { font-size: 0.88rem; margin-top: 12px; }
.msg.error { color: var(--danger); }
.msg.success { color: var(--good); }

.divider { height: 1px; background: var(--border); margin: 22px 0; }

.task-list { display: flex; flex-direction: column; gap: 12px; }
.task-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #fff;
  flex-wrap: wrap;
}
.task-item .info { min-width: 0; }
.task-item .title { font-weight: 700; margin-bottom: 4px; }
.task-item .meta { font-size: 0.82rem; color: var(--text-muted); display: flex; gap: 10px; flex-wrap: wrap; }
.task-item .actions { display: flex; gap: 8px; flex-shrink: 0; }

.pill {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--teal-bg);
  color: var(--teal-mid);
}

table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--text-muted); font-size: 0.76rem; letter-spacing: 0.04em; text-transform: uppercase; }
td.num { font-variant-numeric: tabular-nums; }

.score-pill { font-weight: 700; padding: 3px 10px; border-radius: 999px; font-size: 0.82rem; }
.score-pill.high { background: #e5f3ea; color: var(--good); }
.score-pill.mid { background: #fdf3e3; color: #9a6a11; }
.score-pill.low { background: #fbeceb; color: var(--danger); }

.empty-state { text-align: center; color: var(--text-muted); padding: 40px 0; }

.question-draft { border: 1px solid var(--border); border-radius: 10px; padding: 16px; margin-bottom: 14px; }
.question-draft .opt-row { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.question-draft .opt-row input[type="radio"] { accent-color: var(--teal); }
.question-draft .opt-row input[type="text"] { flex: 1; }
.template-guide {
  margin-top: 10px;
  padding: 12px 14px;
  border-left: 3px solid var(--teal);
  border-radius: 6px;
  background: var(--teal-bg);
  color: var(--text-muted);
  font-size: 0.84rem;
}
.template-guide strong { color: var(--teal-mid); }
.template-guide span { display: inline-block; margin-top: 5px; }

.source-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 4px 0 22px;
}
.source-option {
  min-width: 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--text);
  text-align: left;
  font: inherit;
  cursor: pointer;
}
.source-option:hover { border-color: var(--teal-light); background: var(--teal-bg); }
.source-option:focus-visible { outline: 3px solid var(--teal-light); outline-offset: 2px; }
.source-option:active { transform: translateY(1px); }
.source-option.active { border-color: var(--teal); background: var(--teal-bg); box-shadow: inset 3px 0 0 var(--teal); }
.source-option strong { display: block; color: var(--teal-dark); }
.source-option span { display: block; margin-top: 3px; color: var(--text-muted); font-size: 0.78rem; }
.source-textarea { min-height: 220px; }
.field-meta { display: flex; justify-content: space-between; gap: 12px; margin-top: 6px; color: var(--text-muted); font-size: 0.76rem; }
.script-editor { margin: 22px 0; padding: 18px; border: 1px solid var(--border); border-radius: 10px; background: #f8fbfb; }
.script-editor-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.script-editor-head h2 { margin: 0; font-size: 1rem; color: var(--teal-dark); }
.script-editor-head p { margin: 3px 0 0; color: var(--text-muted); font-size: 0.8rem; }
.speaker-editor { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.speaker-card { padding: 12px; border: 1px solid var(--border); border-radius: 9px; background: #fff; }
.speaker-card label { margin-top: 0; }
.speaker-card small { display: block; margin-top: 7px; color: var(--text-muted); }
.segment-editor { display: flex; flex-direction: column; gap: 8px; }
.segment-row { display: grid; grid-template-columns: 125px minmax(0, 1fr); gap: 8px; align-items: start; }
.segment-row select, .segment-row textarea { min-height: 46px; }
.ap-groups-editor { margin: 22px 0; }
.ap-group-card { padding: 18px; margin-bottom: 14px; border: 1px solid var(--border); border-radius: 10px; background: #f8fbfb; }
.ap-group-title { display: flex; justify-content: space-between; gap: 12px; align-items: center; font-weight: 700; color: var(--teal-dark); }
.ap-group-context { margin: 5px 0 10px; color: var(--text-muted); font-size: 0.82rem; }
.ap-group-card textarea { min-height: 130px; }
.chart-preview { margin-top: 12px; padding: 14px; border: 1px solid var(--border); border-radius: 8px; background: #fff; }
.chart-preview strong { display: block; margin-bottom: 8px; }
.chart-row { display: grid; grid-template-columns: minmax(90px, 1fr) 3fr auto; gap: 8px; align-items: center; margin: 6px 0; font-size: 0.8rem; }
.chart-bar { height: 14px; background: linear-gradient(90deg, var(--teal), var(--teal-light)); border-radius: 4px; min-width: 4px; }
.ap-2027-meta { margin: 5px 0 10px; font-size: 0.75rem; color: var(--text-muted); }
.ap-group-student { margin-bottom: 24px; padding: 18px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; }
.ap-group-student-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; margin-bottom: 10px; }
.ap-group-student-head h2 { margin: 5px 0 0; font-size: 1.05rem; }
.ap-group-student-head > div:last-child { text-align: right; }
.ap-student-chart { margin-bottom: 16px; }
@media (max-width: 620px) {
  .speaker-editor { grid-template-columns: 1fr; }
  .segment-row { grid-template-columns: 1fr; }
}

/* ── 学生端 ── */
.listen-hero {
  text-align: center;
  padding: 8px 0 20px;
}
.listen-hero .exam-tag { font-size: 0.8rem; color: var(--teal-mid); font-weight: 700; letter-spacing: 0.06em; }
.listen-hero h1 { font-size: 1.3rem; margin: 6px 0 0; }

.player {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-align: center;
  background: var(--teal-bg);
  margin-bottom: 20px;
}
.play-btn {
  width: 76px; height: 76px;
  border-radius: 50%;
  border: none;
  background: linear-gradient(135deg, var(--teal-mid) 0%, var(--teal-light) 100%);
  color: #fff;
  font-size: 1.6rem;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(58, 144, 153, 0.4);
}
.play-btn:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }
.replay-count { margin-top: 12px; font-size: 0.85rem; color: var(--text-muted); }
.speed-control { margin-top: 14px; font-size: 0.85rem; color: var(--text-muted); }
.speed-control label { display: block; margin-bottom: 6px; }
.speed-control input[type="range"] { width: 100%; accent-color: var(--teal-mid); }

.mcq-item { border: 1px solid var(--border); border-radius: 10px; padding: 16px 18px; margin-bottom: 12px; background: #fff; }
.mcq-item .q-text { font-weight: 700; margin-bottom: 10px; }
.question-play-btn {
  border: 0;
  border-radius: 8px;
  padding: 9px 13px;
  margin: 0;
  background: var(--teal-bg);
  color: var(--teal-mid);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.question-play-btn:disabled { opacity: 0.55; cursor: not-allowed; }
.question-replay-info { color: var(--text-muted); font-size: 0.78rem; white-space: nowrap; }

/* AP 接话题：参考正式练习页的“题号 + 单题播放 + 两列选项”结构 */
.page.ap-assessment { max-width: 780px; }
.ap-assessment .listen-hero { text-align: left; padding: 18px 0 26px; border-bottom: 1px solid var(--border); }
.ap-assessment .listen-hero h1 { font-size: clamp(1.5rem, 4vw, 2rem); overflow-wrap: anywhere; min-width: 0; }
.ap-assessment .exam-tag { letter-spacing: 0.035em; }
.ap-assessment .ap-question {
  border: 0;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  padding: 30px 0 34px;
  margin: 0;
  background: transparent;
}
.ap-question-head { display: flex; align-items: center; gap: 10px; margin-bottom: 15px; }
.ap-question-number { color: var(--teal-dark); font-size: 1.05rem; font-weight: 800; }
.ap-question .question-play-btn {
  border: 1px solid var(--teal);
  padding: 5px 11px;
  background: transparent;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}
.ap-question .q-text { margin-bottom: 10px; font-weight: 400; }
.question-label { font-weight: 800; }
.ap-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2px 24px; }
.ap-question .opt { min-height: 48px; padding: 10px 14px; gap: 8px; border: 1px solid transparent; }
.ap-question .opt:hover { border-color: var(--border); }
.option-letter { flex: 0 0 1.35rem; font-weight: 700; }
.answer-explanation {
  margin-top: 12px;
  padding: 10px 12px;
  border-left: 3px solid var(--teal-light);
  background: var(--teal-bg);
  color: var(--text-muted);
  font-size: 0.86rem;
}
.mcq-item .opt {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 8px; cursor: pointer;
  border: 1px solid transparent;
}
.mcq-item .opt:hover { background: var(--teal-bg); }
.mcq-item .opt.selected { background: var(--teal-bg); border-color: var(--teal-light); }
.mcq-item .opt.correct { background: #e5f3ea; border-color: var(--good); }
.mcq-item .opt.incorrect { background: #fbeceb; border-color: var(--danger); }

.result-summary { text-align: center; padding: 20px 0; }
.result-summary .big-score { font-size: 2.6rem; font-weight: 800; color: var(--teal-mid); }

/* ── 管理后台 ── */
.admin-badge {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 3px 12px;
  border-radius: 999px;
  background: #fbeceb;
  color: var(--danger);
  margin-left: 10px;
  vertical-align: middle;
}
.admin-tabs {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}
.admin-tab {
  border: none;
  background: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  font-family: inherit;
}
.admin-tab.active { background: var(--teal-bg); color: var(--teal-mid); }
.admin-tab:disabled { opacity: 0.4; cursor: not-allowed; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 8px;
}
.stat-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 16px;
  text-align: center;
}
.stat-card .num { font-size: 1.9rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.stat-card .label { font-size: 0.82rem; color: var(--text-muted); margin-top: 4px; }
.stat-card.c-teal .num { color: var(--teal-mid); }
.stat-card.c-red .num { color: var(--danger); }
.stat-card.c-gold .num { color: #9a6a11; }
.stat-card.c-purple .num { color: #7a4fa0; }
.stat-card.c-blue .num { color: #2f6fb8; }
.stat-card.c-green .num { color: var(--good); }
.stat-card.c-orange .num { color: #c06a1f; }

.admin-toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
.admin-toolbar input[type="text"] { max-width: 260px; }
.admin-toolbar select { max-width: 160px; }

.pagination { display: flex; gap: 8px; justify-content: center; margin-top: 16px; font-size: 0.85rem; }
.pagination button { border: 1px solid var(--border); background: #fff; border-radius: 6px; padding: 4px 10px; cursor: pointer; font-family: inherit; }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination .page-info { color: var(--text-muted); padding: 4px 6px; }

@media (max-width: 700px) {
  .source-switch { grid-template-columns: minmax(0, 1fr); }
  .field-meta { align-items: flex-start; flex-direction: column; gap: 2px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .ap-options { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .ap-question-head { flex-wrap: wrap; }
  .ap-question-replay-info { width: 100%; }
  .ap-assessment .ap-question { padding: 24px 0 28px; }
}
