* { box-sizing: border-box; }

/* .btn { display:flex } 会盖掉原生 hidden，必须抬回隐藏状态。 */
[hidden] { display: none !important; }

html { font-size: 100%; }

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-family);
  font-size: var(--font-body);
  line-height: var(--lh-body, 1.6);
}

a { color: var(--color-primary); }

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

.shell {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: calc(var(--space-5) + var(--safe-top)) var(--space-side) var(--space-6);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.brand {
  font-size: var(--font-title);
  font-weight: 700;
  margin: 0;
}

.link-button {
  background: none;
  border: 0;
  color: var(--color-muted);
  min-height: var(--control-height);
  padding: 0 var(--space-2);
}

.card {
  background: var(--color-card);
  border: 0;
  box-shadow: var(--shadow-card);
  padding: 0;
  margin: 0 0 var(--space-6);
}

h1, h2, p { margin-top: 0; }

h1 { font-size: var(--font-title); line-height: 1.3; letter-spacing: var(--ls-head, -0.01em); }

h2 { font-size: var(--font-body); }

.muted { color: var(--color-muted); font-size: var(--font-small); }

.en-line {
  font-size: 1.75rem;
  line-height: var(--lh-en, 1.2);
  margin: var(--space-3) 0;
  overflow-wrap: break-word;
  font-weight: 700;
}

.speak-block .en-line {
  font-size: var(--font-en);
}

.eyebrow {
  margin: 0 0 var(--space-2);
  color: var(--color-primary);
  font-weight: 700;
  font-size: var(--font-body);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  background: transparent;
  color: var(--color-text);
  font-size: var(--font-body);
  padding: 0;
}

.dot {
  width: var(--dot-size);
  height: var(--dot-size);
  border-radius: var(--radius-pill);
  background: var(--color-status-not_started);
  display: inline-block;
}

.status-not_started .dot { background: var(--color-status-not_started); }
.status-learning .dot { background: var(--color-status-learning); }
.status-awaiting .dot { background: var(--color-status-awaiting); }
.status-passed .dot { background: var(--color-status-passed); }
.status-needs_rerecord .dot { background: var(--color-status-needs_rerecord); }
.status-submitted .dot { background: var(--color-status-awaiting); }
.status-open .dot { background: var(--color-status-not_started); }

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: var(--control-height);
  border-radius: var(--radius-pill);
  border: var(--line-width) solid var(--color-primary);
  background: var(--color-primary);
  color: var(--color-on-primary);
  text-decoration: none;
  padding: var(--space-2) var(--space-4);
  margin-top: var(--space-4);
  box-shadow: none;
  font-size: 18px;
  font-weight: 700;
}

.btn-quiet {
  background: transparent;
  color: var(--color-primary);
}

.btn:disabled { opacity: 0.55; }

/* 录音键外形：外圈 200px、第二圈 140px、实心 92px。呼吸动画只写在 tokens.css 的 .rec.is-recording 里。 */
.btn.rec,
.record-btn.rec {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--rec-ring-2);
  min-width: var(--rec-ring-2);
  height: var(--rec-ring-2);
  min-height: var(--rec-ring-2);
  margin: var(--space-5) auto 0;
  padding: 0;
  border: 0;
  border-radius: var(--radius-pill);
  background: var(--c-surface-2);
  color: var(--color-on-primary);
  overflow: visible;
  box-shadow: none;
}

.rec > div {
  width: var(--rec-ring-1);
  height: var(--rec-ring-1);
  border-radius: var(--radius-pill);
  background: var(--c-accent-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}

.rec > div > div {
  width: var(--rec-size);
  height: var(--rec-size);
  min-height: var(--btn-min);
  border-radius: var(--radius-pill);
  background: var(--c-rec);
  color: var(--color-on-primary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.record-btn .record-label {
  position: relative;
  z-index: 1;
  font-size: var(--font-small);
}

.field { margin-bottom: var(--space-4); }

.field span { display: block; margin-bottom: var(--space-2); font-size: var(--font-body); }

input, textarea {
  width: 100%;
  min-height: var(--control-height);
  border: var(--line-width) solid var(--color-line);
  border-radius: var(--radius-pill);
  background: transparent;
  padding: var(--space-2) var(--space-4);
  font-size: var(--font-body);
}

textarea { min-height: calc(var(--control-height) * 2); border-radius: var(--radius-lg); }

.error {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  border-radius: var(--radius-pill);
  padding: var(--space-3) var(--space-4);
  font-size: var(--font-body);
}

audio { width: 100%; margin-top: var(--space-3); }

.pick-list { display: flex; flex-direction: column; gap: 12px; }

.pick {
  width: 100%;
  height: 64px;
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  background: var(--c-surface, var(--color-card));
  border: 3px solid transparent;
  border-radius: var(--radius-pill);
  padding: 0 22px;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.pick.is-latest { border-color: var(--color-primary); }

.pick:has(.pick-svg),
.pick:has(img) {
  height: auto;
  min-height: 64px;
  flex-direction: column;
  padding: 12px 22px;
}

.pick-svg { width: 100%; height: var(--pick-size); display: block; }

/* 听力选择：题目在上、播放胶囊居中、选项在下。三张选项卡合计约 216px（64+12+64+12+64）。 */
.step-screen[data-kind="choose"] .task-zh,
.step-screen[data-kind="pick"] .task-zh {
  text-align: center;
  margin-bottom: 0;
}

.step-screen[data-kind="choose"] .player-row,
.step-screen[data-kind="pick"] .player-row {
  justify-content: center;
  margin-top: 20px;
}

.listen-choices { margin-top: 24px; }

.listen-choices form { margin: 0; }

.step-label { color: var(--color-muted); margin-bottom: var(--space-3); font-size: var(--font-body); }

.list { list-style: none; padding: 0; margin: 0; }

.list a, .list li {
  display: flex;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4) 0;
  border-bottom: var(--line-width) solid var(--color-line);
  text-decoration: none;
  color: var(--color-text);
  min-height: var(--control-height);
  align-items: center;
  font-size: var(--font-body);
}

.name-read {
  margin-top: var(--space-7);
  padding-top: var(--space-5);
  border-top: var(--line-width) solid var(--color-line);
}

.fine-print {
  color: var(--color-muted);
  font-size: var(--font-label);
  margin-top: var(--space-6);
}

.tabbar {
  position: fixed;
  left: 50%;
  right: auto;
  bottom: calc(var(--safe-bottom) + var(--space-2));
  transform: translateX(-50%);
  width: calc(100% - (var(--space-side) * 2));
  max-width: var(--max-width);
  display: flex;
  background: var(--c-surface, var(--color-bg));
  border: 0;
  border-radius: 32px;
  box-shadow: none;
  padding-bottom: 0;
  z-index: 2;
}

.tabbar a {
  flex: 1;
  text-align: center;
  text-decoration: none;
  color: var(--color-muted);
  min-height: var(--tab-height);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-body);
}

.tabbar a[aria-current="page"] {
  color: var(--color-primary);
  font-weight: 700;
}

.has-tabs { padding-bottom: calc(var(--tab-height) + var(--safe-bottom) + var(--space-4)); }

:focus-visible { outline: var(--line-width) solid var(--color-focus); outline-offset: var(--space-1); }

/* 步骤页：录音键紧贴播放器或「看提示」，只有操作按钮落在底部。 */
.step-screen {
  display: flex;
  flex-direction: column;
}

.step-main { display: flex; flex-direction: column; }

.task-zh { margin: 0 0 var(--space-3); }

.player-row {
  display: flex;
  align-items: flex-start;
  justify-content: flex-start;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: var(--space-5);
}

.player-row:not(:has(.player-avatar)) {
  align-items: center;
}

.player-person {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: none;
  min-width: 0;
}

.player-person:has(.player-avatar) {
  width: 64px;
}

.player-speaker {
  margin: 0;
  margin-top: 6px;
  font-size: var(--fs-caption);
  font-weight: 400;
  line-height: 1.3;
  color: var(--c-text-2);
  text-align: center;
  background: none;
  pointer-events: none;
}

.player-person:not(:has(.player-avatar)) .player-speaker {
  margin-top: 0;
}

.player-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}

.player-row:has(.player-avatar) .player-controls {
  min-height: 64px;
}

.player-avatar {
  flex: none;
  width: 64px;
  height: 64px;
  padding: 0;
  border: 0;
  border-radius: var(--r-avatar);
  background: var(--c-surface-2, var(--color-icon-soft));
  overflow: hidden;
  cursor: pointer;
}

.player-avatar img {
  display: block;
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: inherit;
}


.pill {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 22px;
  border: 0;
  border-radius: 24px;
  background: var(--c-surface-2, var(--color-icon-soft));
  font-size: var(--font-body);
  font-weight: 700;
  color: var(--color-primary);
  cursor: pointer;
}

.slow-link {
  background: none;
  border: 0;
  padding: 0;
  color: var(--color-muted);
  font-size: var(--font-body);
  font-weight: 700;
  cursor: pointer;
}

.slow-link.is-active { color: var(--color-primary); }

.hint-link {
  align-self: flex-start;
  margin-top: var(--space-2);
  margin-bottom: var(--space-2);
  background: none;
  border: 0;
  padding: 0;
  color: var(--color-primary);
  font-size: var(--font-body);
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 5px;
  cursor: pointer;
}

.record-cluster {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  margin-top: 28px; /* 播放器（或题目）到录音键：固定 28px，不随根字号变化 */
}

/* 紧邻录音区的上一个元素不再叠加底边距，保证间距就是 28px */
.step-main > :has(+ .record-cluster),
.step-main > :has(+ .note) {
  margin-bottom: 0;
}

.record-cluster .rec { margin-top: 0; }

.record-cluster > p { margin: 0; }

.record-cluster .note,
.step-main > .note { margin: var(--space-3) 0 0; text-align: center; }

.step-actions {
  margin-top: auto;
  padding-top: var(--space-4);
  padding-bottom: var(--safe-b, var(--safe-bottom));
  flex: none;
}

.step-actions .btn { width: 100%; }

.credit,
.fine-print {
  overflow-wrap: anywhere;
  word-break: break-word;
  max-width: 100%;
  white-space: normal;
}

.fine-print { overflow-x: hidden; }


.back-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--c-surface-2, var(--color-icon-soft));
  color: var(--color-text);
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex: none;
  line-height: 1;
}

.is-study .shell {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  max-height: 100dvh;
  overflow: hidden;
  box-sizing: border-box;
  padding-top: calc(var(--space-3) + var(--safe-top, 0px));
  padding-bottom: var(--safe-b, var(--safe-bottom));
}

.is-study .topbar { margin-bottom: var(--space-2); }

.is-study h1 { margin-bottom: var(--space-2); }

.is-study .step-label { margin-bottom: var(--space-2); }

.is-study .en-line { margin: var(--space-2) 0; }

.is-study .player-row { margin-top: var(--space-3); }

.is-study .step-actions {
  padding-top: var(--space-3);
}

.is-study .step-actions form { margin: 0; }

.is-study .step-screen {
  flex: 1 1 0;
  min-height: 0;
  overflow: hidden;
}

.is-study .step-main {
  flex: 1 1 0;
  min-height: 0;
  overflow: auto;
}

.is-study .step-main > :has(+ .record-cluster),
.is-study .step-main > :has(+ .note) {
  margin-bottom: 0;
}

