/* P0 practice fixes (2026-10-22). Loaded after exam-practice.css and the zen shell.
   Scope: unit practice pages only. Colours: correct #E6F4EA/#1E7A45,
   wrong #FCEBEA/#B23A32, selected #E8EEF6/#4A6A8F. */
:root {
  --p0-correct-bg: #e6f4ea; --p0-correct: #1e7a45;
  --p0-wrong-bg: #fcebea; --p0-wrong: #b23a32;
  --p0-selected-bg: #e8eef6; --p0-selected: #4a6a8f;
  --p0-revealed-bg: #fff3d8; --p0-revealed: #8a5a12;
}
html[data-practice-ui-experiment] body .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* 1. option states: neutral selection, red ✕ wrong, green ✓ correct */
html[data-practice-ui-experiment] body .option-button { position: relative; }
html[data-practice-ui-experiment] body .option-button[aria-checked="true"],
html[data-practice-ui-experiment] body .option-button.p0-selected {
  border-color: var(--p0-selected); color: #1f2a26; background: var(--p0-selected-bg); box-shadow: inset 0 0 0 1px rgba(74, 106, 143, .18);
}
html[data-practice-ui-experiment] body .option-button[aria-checked="true"] .option-key,
html[data-practice-ui-experiment] body .option-button.p0-selected .option-key { color: #fff; border-color: var(--p0-selected); background: var(--p0-selected); }
html[data-practice-ui-experiment] body .option-button.p0-correct { border-color: var(--p0-correct); color: #163f27; background: var(--p0-correct-bg); box-shadow: inset 0 0 0 1px rgba(30, 122, 69, .25); }
html[data-practice-ui-experiment] body .option-button.p0-correct .option-key { color: #fff; border-color: var(--p0-correct); background: var(--p0-correct); }
html[data-practice-ui-experiment] body .option-button.p0-wrong { border-color: var(--p0-wrong); color: #5c1f1a; background: var(--p0-wrong-bg); box-shadow: inset 0 0 0 1px rgba(178, 58, 50, .22); }
html[data-practice-ui-experiment] body .option-button.p0-wrong .option-key { color: #fff; border-color: var(--p0-wrong); background: var(--p0-wrong); }
html[data-practice-ui-experiment] body .option-button.p0-correct,
html[data-practice-ui-experiment] body .option-button.p0-wrong { padding-right: 40px; }
html[data-practice-ui-experiment] body .option-button .p0-option-mark {
  position: absolute; top: 50%; right: 14px; transform: translateY(-50%); font-size: 18px; font-weight: 800; line-height: 1;
}
html[data-practice-ui-experiment] body .option-button.p0-correct .p0-option-mark { color: var(--p0-correct); }
html[data-practice-ui-experiment] body .option-button.p0-wrong .p0-option-mark { color: var(--p0-wrong); }
html[data-practice-ui-experiment] body .option-button:disabled { opacity: 1; }

/* 2. feedback box: no permanent focus ring, readable copy */
html[data-practice-ui-experiment] body #check-feedback { outline: none; box-shadow: none; border: 1px solid transparent; }
html[data-practice-ui-experiment] body #check-feedback:focus,
html[data-practice-ui-experiment] body #check-feedback:focus-visible { outline: none; box-shadow: none; }
html[data-practice-ui-experiment] body #check-feedback.is-correct { color: #163f27; background: var(--p0-correct-bg); border-color: rgba(30, 122, 69, .25); }
html[data-practice-ui-experiment] body #check-feedback.is-incorrect { color: #5c1f1a; background: var(--p0-wrong-bg); border-color: rgba(178, 58, 50, .22); }
html[data-practice-ui-experiment] body #check-feedback #feedback-title { font-size: 15px; line-height: 1.4; }
html[data-practice-ui-experiment] body #check-feedback #feedback-copy { margin-top: 3px; font-size: 14px; line-height: 1.55; opacity: 1; }
html[data-practice-ui-experiment] body #check-feedback .p0-attempt-history { margin: 4px 0 0; font-size: 12px; line-height: 1.5; color: #5d6a64; opacity: 1; }

/* drawer: "看了答案" is not the same as "做对" */
html[data-practice-ui-experiment] body .drawer-status-legend [data-status="revealed"]::before,
html[data-practice-ui-experiment] body .activity-nav-status[data-status="revealed"]::before { border-color: #b98a3a; background: var(--p0-revealed-bg); }
html[data-practice-ui-experiment] body .question-overview-card .question-navigation .drawer-question-button.status-revealed:not(.is-active),
html[data-practice-ui-experiment] body .question-navigation button.status-revealed:not(.is-active) { border-color: #c99b56; color: var(--p0-revealed); background: var(--p0-revealed-bg); }
html[data-practice-ui-experiment] body .drawer-status-legend [data-status="revealed"]::before { content: ""; }

/* 3. drawer trigger docked in the toolbar instead of a fixed left-edge tab */
html[data-practice-ui-experiment] body #open-question-overview.p0-docked {
  position: static; inset: auto; transform: none; writing-mode: horizontal-tb;
  display: inline-flex; width: auto; height: auto; min-height: 36px; align-items: center; gap: 6px;
  padding: 0 12px; border: 1px solid var(--line, #d8ded9); border-radius: 8px; background: #fff; box-shadow: none;
  font-size: 13px; font-weight: 700; color: #1f2a26;
}
html[data-practice-ui-experiment] body #open-question-overview.p0-docked img { width: 16px; height: 16px; margin: 0; }
html[data-practice-ui-experiment] body #open-question-overview.p0-docked .zen-practice-drawer-label { writing-mode: horizontal-tb; letter-spacing: 0; font-size: 13px; }

/* 8. typography: reading text never smaller than options; header controls ≥ 13px */
html[data-practice-ui-experiment] body .session .passage { font-size: 16px; line-height: 1.7; }
html[data-practice-ui-experiment] body .session.is-complete-words .passage { line-height: 2.2; }
html[data-practice-ui-experiment] body .practice-header :is(.unit-return, .toolbar-button, .save-state, .session-mode, .session-pool, .question-counter) { font-size: 13px; }
html[data-practice-ui-experiment] body .practice-header .question-counter strong { font-size: 16px; }
html[data-practice-ui-experiment] body #material-category { font-size: 11px; }
html[data-practice-ui-experiment] body .session.is-complete-words .composite-stats { font-size: 12px; }

/* 8. desktop: material column sticks to the viewport and scrolls on its own;
      question column capped near 640px */
@media (min-width: 901px) {
  html[data-practice-ui-experiment] body .session.is-sat .practice-content,
  html[data-practice-ui-experiment] body .session.is-toefl_reading:not(.is-complete-words) .practice-content {
    grid-template-columns: minmax(340px, 1fr) minmax(400px, 640px);
  }
  html[data-practice-ui-experiment] body .session.is-sat .material-card,
  html[data-practice-ui-experiment] body .session.is-toefl_reading:not(.is-complete-words) .material-card {
    position: sticky; top: 72px; display: flex; flex-direction: column;
    height: calc(100dvh - 92px); max-height: none;
  }
  html[data-practice-ui-experiment] body .session.is-sat .material-card .passage,
  html[data-practice-ui-experiment] body .session.is-toefl_reading:not(.is-complete-words) .material-card .passage {
    flex: 1 1 auto; max-height: none; min-height: 0; overflow: auto;
  }
  html[data-practice-ui-experiment] body .p0-more-actions { display: none; }
}

/* 4. Complete the Words: prefix + letters + underline stay one unbreakable unit;
      per-blank result sits directly under the blank */
html[data-practice-ui-experiment] body .complete-word-slot {
  position: relative; display: inline-flex; flex-wrap: nowrap; white-space: nowrap; align-items: baseline;
  margin: 0 .15em; padding: 0; font: inherit; font-family: inherit; vertical-align: baseline;
}
html[data-practice-ui-experiment] body .complete-word-prefix { font: inherit; font-weight: 400; color: #1f2a26; line-height: inherit; }
html[data-practice-ui-experiment] body .completion-word-entry {
  position: relative; display: inline-block; width: calc(var(--completion-letters) * 0.62em + 0.25em);
  height: auto; line-height: inherit; vertical-align: baseline;
}
html[data-practice-ui-experiment] body .completion-letter-guides { display: none; }
html[data-practice-ui-experiment] body .completion-word-input {
  display: inline-block; width: 100%; height: 1.35em; min-height: 0; padding: 0 .05em; margin: 0;
  border: 0; border-bottom: 2px dashed #7f938b; border-radius: 0; outline: none; background: transparent; box-shadow: none;
  font: inherit; font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; font-size: .92em; font-weight: 600;
  letter-spacing: .02em; color: #163f33; line-height: 1.35; vertical-align: baseline;
}
html[data-practice-ui-experiment] body .completion-word-input:focus { border-bottom-color: #1e5a48; border-bottom-style: solid; background: rgba(30, 90, 72, .06); }
html[data-practice-ui-experiment] body .complete-word-slot.is-correct .completion-word-input { border-bottom: 2px solid var(--p0-correct); color: var(--p0-correct); }
html[data-practice-ui-experiment] body .complete-word-slot.is-incorrect .completion-word-input { border-bottom: 2px solid var(--p0-wrong); color: var(--p0-wrong); }
html[data-practice-ui-experiment] body .complete-word-slot.is-correct,
html[data-practice-ui-experiment] body .complete-word-slot.is-incorrect { background: transparent; border: 0; }
html[data-practice-ui-experiment] body .complete-word-status {
  position: absolute; top: calc(100% - 2px); left: 0; display: block; min-width: max-content;
  font-family: var(--sans, "PingFang SC", sans-serif); font-size: 11px; font-weight: 700; line-height: 1.1; letter-spacing: 0;
  pointer-events: none; color: #5d6a64;
}
html[data-practice-ui-experiment] body .complete-word-slot.is-correct .complete-word-status { color: var(--p0-correct); }
html[data-practice-ui-experiment] body .complete-word-slot.is-incorrect .complete-word-status { color: var(--p0-wrong); }
html[data-practice-ui-experiment] body .complete-word-slot.is-correct .complete-word-status::before { content: "✓ "; }
html[data-practice-ui-experiment] body .complete-word-slot.is-incorrect .complete-word-status::before { content: "✕ "; }

/* 9. completion page */
html[data-practice-ui-experiment] body #complete-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
html[data-practice-ui-experiment] body #complete-metrics .p0-metric { display: grid; gap: 2px; padding: 10px 12px; border-radius: 10px; font-size: 13px; text-align: left; }
html[data-practice-ui-experiment] body #complete-metrics .p0-metric strong { font-size: 22px; }
html[data-practice-ui-experiment] body .p0-metric-first { color: var(--p0-correct); background: var(--p0-correct-bg); }
html[data-practice-ui-experiment] body .p0-metric-retry { color: #315a68; background: #e7f1f5; }
html[data-practice-ui-experiment] body .p0-metric-revealed { color: var(--p0-revealed); background: var(--p0-revealed-bg); }
html[data-practice-ui-experiment] body .p0-metric-incomplete { color: #4f5b56; background: #f1f3f2; }
html[data-practice-ui-experiment] body .p0-review-list { display: grid; gap: 6px; margin: 14px 0; text-align: left; }
html[data-practice-ui-experiment] body .p0-review-list h3 { margin: 0 0 4px; font-size: 15px; }
html[data-practice-ui-experiment] body .p0-review-item {
  display: flex; justify-content: space-between; gap: 10px; align-items: center; min-height: 44px; padding: 8px 12px;
  border: 1px solid #d8ded9; border-radius: 8px; background: #fff; color: #1f2a26; font-size: 14px; text-align: left; cursor: pointer;
}
html[data-practice-ui-experiment] body .p0-review-item small { flex: none; font-size: 12px; color: #6b5a3a; }

/* 3. phones: one-row action bar (更多 · 揭晓 · 检查 · 下一题), secondary actions in a popover */
@media (max-width: 900px) {
  html[data-practice-ui-experiment] body .question-actions,
  html[data-practice-ui-experiment] body .question-card.is-composite-controller .question-actions {
    position: sticky; bottom: 6px; z-index: 8;
    display: flex; flex-wrap: nowrap; align-items: center; gap: 6px;
    min-height: 0; margin-top: 12px; padding: 6px; border-radius: 12px;
  }
  html[data-practice-ui-experiment] body .question-actions > *,
  html[data-practice-ui-experiment] body .question-actions .practice-step-navigation > * { min-height: 44px; }
  html[data-practice-ui-experiment] body .question-actions :is(#reset-answer, #undo-answer) { display: none; }
  html[data-practice-ui-experiment] body .question-actions > *,
  html[data-practice-ui-experiment] body .question-actions .practice-step-navigation > * { min-width: 0; }
  html[data-practice-ui-experiment] body .question-actions .practice-step-navigation { display: flex; flex: 1 1 0; min-width: 0; gap: 6px; margin: 0; }
  html[data-practice-ui-experiment] body .question-actions .practice-step-navigation #previous-question { display: none; }
  html[data-practice-ui-experiment] body .question-actions .practice-step-navigation #next-question { flex: 1 1 0; width: auto; min-width: 0; margin: 0; padding-inline: 8px; white-space: nowrap; }
  html[data-practice-ui-experiment] body .question-actions :is(#check-answer, #check-material) { flex: 1 1 0; min-width: 0; padding-inline: 8px; white-space: nowrap; font-size: 14px; }
  html[data-practice-ui-experiment] body .question-actions #reveal-answer { flex: 0 0 84px; width: 84px; max-width: 84px; min-height: 44px; padding: 2px 4px; white-space: normal; font-size: 12.5px; line-height: 1.2; text-align: center; }
  html[data-practice-ui-experiment] body .question-actions .p0-more-actions { flex: none; width: 52px; min-width: 52px; padding: 0 6px; font-size: 13px; }
  html[data-practice-ui-experiment] body .question-actions.p0-more-open :is(#reset-answer, #undo-answer, #previous-question):not([hidden]) {
    display: inline-flex; position: absolute; bottom: calc(100% + 6px); z-index: 9; min-width: 96px; justify-content: center;
    background: #fff; box-shadow: 0 10px 24px rgba(24, 42, 37, .16);
  }
  html[data-practice-ui-experiment] body .question-actions.p0-more-open #reset-answer:not([hidden]) { left: 6px; }
  html[data-practice-ui-experiment] body .question-actions.p0-more-open #undo-answer:not([hidden]) { left: 110px; }
  html[data-practice-ui-experiment] body .question-actions.p0-more-open #previous-question { left: 214px; }
  html[data-practice-ui-experiment] body .question-actions.p0-more-open .practice-step-navigation { position: static; }
  html[data-practice-ui-experiment] body .question-card { padding-bottom: 24px; }
  html[data-practice-ui-experiment] body #complete-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* narrow phones: keep the toolbar row compact once the drawer trigger is docked */
@media (max-width: 430px) {
  html[data-practice-ui-experiment] body .practice-header .session-tools { flex-wrap: wrap; row-gap: 4px; justify-content: flex-end; }
  html[data-practice-ui-experiment] body .practice-header .question-counter { white-space: nowrap; font-size: 12.5px; }
  html[data-practice-ui-experiment] body .practice-header .assist-badge { padding: 3px 6px; font-size: 11px; white-space: nowrap; }
  html[data-practice-ui-experiment] body #open-question-overview.p0-docked { min-width: 44px; min-height: 44px; justify-content: center; padding: 0 10px; }
  html[data-practice-ui-experiment] body .practice-header:has(.assist-badge:not([hidden])) #open-question-overview.p0-docked .zen-practice-drawer-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
}
@media (max-width: 430px) {
  html[data-practice-ui-experiment] body .practice-header:has(.assist-badge:not([hidden])) #question-subposition { display: none; }
}
