:root {
  --bg: #f8fafc;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --soft: #f1f5f9;
  --dark: #0f172a;
  --indigo: #4f46e5;
  --green: #059669;
  --amber: #d97706;
  --rose: #e11d48;
  --violet: #7c3aed;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
.header { position: sticky; top: 0; z-index: 10; background: rgba(255,255,255,.94); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.header-inner { width: 100%; max-width: none; margin: 0 auto; padding: 8px 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.brand-wrap { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 0 0 auto; }
.brand { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.brand-title { font-weight: 900; font-size: 18px; white-space: nowrap; }
.brand-sub { display: none; color: var(--muted); font-size: 13px; }
.header-study-nav { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; }
.global-worker-status-wrap {
  position: fixed;
  top: 58px;
  left: 50%;
  z-index: 70;
  width: min(560px, calc(100vw - 18px));
  transform: translateX(-50%);
  pointer-events: none;
}
.global-worker-status {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 9px;
  border: 1px solid #bae6fd;
  border-radius: 999px;
  background: rgba(240,249,255,.98);
  color: #0f172a;
  padding: 7px 8px 7px 12px;
  box-shadow: 0 12px 26px rgba(15,23,42,.12);
}
.global-worker-status.done { border-color: #bbf7d0; background: rgba(240,253,244,.98); }
.global-worker-status.error { border-color: #fecdd3; background: rgba(255,241,242,.98); }
.global-worker-status-spinner,
.global-worker-status-dot {
  width: 12px;
  height: 12px;
  flex: 0 0 auto;
  border-radius: 999px;
}
.global-worker-status-spinner {
  border: 2px solid #93c5fd;
  border-top-color: #0f766e;
  animation: global-worker-spin .85s linear infinite;
}
.global-worker-status-dot { background: #16a34a; box-shadow: 0 0 0 4px rgba(34,197,94,.12); }
.global-worker-status.error .global-worker-status-dot { background: #e11d48; box-shadow: 0 0 0 4px rgba(225,29,72,.12); }
.global-worker-status-text { min-width: 0; display: grid; gap: 1px; flex: 1 1 auto; }
.global-worker-status-text b { font-size: 13px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.global-worker-status-text span { color: #475569; font-size: 11px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.global-worker-status .mini-button { flex: 0 0 auto; min-height: 30px; padding: 5px 9px; border-radius: 999px; }
@keyframes global-worker-spin { to { transform: rotate(360deg); } }
.header-example-nav {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  white-space: nowrap;
}
.header-example-nav button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 999px;
  background: #ffffff;
  color: #0f172a;
  font-size: 20px;
  font-weight: 950;
  line-height: 1;
}
.header-example-nav button:disabled {
  opacity: .35;
  cursor: default;
}
.header-example-nav span {
  min-width: 56px;
  text-align: center;
  color: #334155;
  font-size: 12px;
  font-weight: 900;
}
.header-exercise-nav {
  min-height: 40px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #ffffff;
  color: #334155;
  padding: 0 13px;
  font-size: 12px;
  font-weight: 950;
}
.nav { display: flex; gap: 4px; flex-wrap: nowrap; align-items: stretch; justify-content: flex-start; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.nav::-webkit-scrollbar { display: none; }
.nav button { flex: 0 0 auto; min-width: 62px; min-height: 44px; border: 0; border-radius: 14px; padding: 7px 8px; font-weight: 800; background: var(--soft); color: #334155; }
.nav button.active { background: var(--dark); color: white; }
.main { max-width: 1400px; margin: 0 auto; padding: 16px 18px 88px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: 28px; padding: 14px; box-shadow: 0 1px 2px rgba(15,23,42,.04); }
.panel-title { font-size: 17px; font-weight: 900; margin: 0 0 12px; display: flex; gap: 8px; align-items: center; }
.viewer { display: grid; gap: 12px; }
.viewer-main { background: var(--card); border: 1px solid var(--line); border-radius: 32px; padding: 12px; }
.problem-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 8px; }
.problem-id { font-size: 12px; color: var(--muted); font-weight: 800; }
.problem-title { font-size: 22px; font-weight: 950; letter-spacing: -.02em; }
.status { border-radius: 999px; background: var(--soft); color: #475569; padding: 6px 12px; font-size: 13px; font-weight: 800; }
.problem-relation-nav { border: 1px solid var(--line); border-radius: 12px; background: #f8fafc; padding: 8px; display: grid; gap: 6px; margin: 0 0 8px; }
.relation-label { color: var(--muted); font-size: 12px; font-weight: 850; }
.relation-chips { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.relation-chip { border: 1px solid var(--line); border-radius: 999px; background: #ffffff; color: #1e293b; padding: 6px 10px; min-height: 34px; font-size: 13px; font-weight: 900; text-decoration: none; display: inline-flex; align-items: center; }
.relation-chip.active { background: var(--dark); color: #ffffff; border-color: var(--dark); cursor: default; }
.study-route-hint { border: 1px solid var(--line); border-left-width: 5px; border-radius: 12px; background: #ffffff; padding: 10px; display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: center; margin: 10px 0; }
.study-route-hint.forward { border-left-color: var(--green); }
.study-route-hint.stay { border-left-color: var(--amber); }
.study-route-hint.back { border-left-color: var(--rose); }
.study-route-gate {
  margin-top: 8px;
}
.study-route-gate summary {
  cursor: pointer;
  color: #475569;
  font-size: 12px;
  font-weight: 900;
}
.study-route-gate .inline-badge-row {
  margin-top: 6px;
}
.study-route-gate ul {
  margin: 6px 0 0 18px;
  padding: 0;
  color: #475569;
  font-size: 12px;
  line-height: 1.55;
}
.study-route-copy { min-width: 0; display: grid; gap: 3px; }
.study-route-copy span { color: var(--muted); font-size: 12px; font-weight: 900; }
.study-route-copy strong { color: #0f172a; font-size: 14px; font-weight: 950; }
.study-route-copy small { color: #475569; line-height: 1.45; }
.study-route-reasons { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 2px; }
.study-route-reasons em { border-radius: 999px; background: #f1f5f9; color: #475569; padding: 3px 7px; font-size: 11px; font-style: normal; font-weight: 800; }
.study-route-next-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.study-route-action-chip { border: 1px solid #cbd5e1; border-radius: 8px; background: #ffffff; color: #0f172a; min-height: 30px; padding: 5px 9px; font-size: 12px; font-weight: 900; white-space: nowrap; }
.study-route-action-chip.active { border-color: #1f2937; background: #1f2937; color: #ffffff; }
.study-route-action-chip.ok { border-color: #86efac; background: #f0fdf4; color: #166534; }
.study-route-action-chip.warn { border-color: #fcd34d; background: #fffbeb; color: #92400e; }
.study-route-action { display: flex; justify-content: flex-end; }
.study-route-action button { border: 0; border-radius: 10px; background: var(--dark); color: #ffffff; min-height: 36px; padding: 8px 12px; font-weight: 900; white-space: nowrap; }
.study-route-action button.pending { background: #f59e0b; color: #1f2937; }
.stopwatch { background: var(--soft); border: 1px solid var(--line); border-radius: 18px; padding: 8px 10px; display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 8px 0 10px; }
.timebox { display: flex; align-items: baseline; gap: 10px; }
.time-label { color: var(--muted); font-size: 12px; font-weight: 800; }
.time { font-variant-numeric: tabular-nums; font-size: 27px; font-weight: 950; }
.small-buttons { display: grid; grid-template-columns: repeat(3, minmax(70px, 1fr)); gap: 6px; }
.small-buttons button { min-height: 36px; border: 0; border-radius: 12px; font-weight: 900; padding: 6px 10px; }
.btn-start { background: var(--green); color: white; }
.btn-stop { background: var(--amber); color: white; }
.btn-reset { background: #e2e8f0; color: #0f172a; }
.image-card { border: 1px solid var(--line); border-radius: 28px; padding: 6px; background: white; }
/* 13インチWQHD横置きでは、切り抜き画像を表示枠いっぱいに拡大する。
   画像そのものを縮小保存していなければ、ここで粗くなりにくい。 */
.image-stage { position: relative; height: min(63vh, 690px); min-height: 520px; border-radius: 24px; overflow: hidden; background: #f8fafc; border: 1px dashed #cbd5e1; display: flex; align-items: stretch; justify-content: center; text-align: center; padding: 4px; }
.image-stage.answer { background: #eef2ff; border-color: #a5b4fc; }
.image-stage img { width: 100%; height: 100%; object-fit: contain; display: block; image-rendering: auto; }
.title-mask-overlay { position: absolute; top: 0; left: 0; right: 0; height: var(--title-mask-height, 50px); background: linear-gradient(180deg, #fbfaf6 0%, #f7f3ea 100%); z-index: 2; pointer-events: none; box-shadow: 0 -1px 0 rgba(255,255,255,.72) inset, 0 1px 0 rgba(148,132,102,.18); }
.image-stage.manual-page-asset {
  height: auto;
  min-height: 0;
  align-items: center;
  background: #ffffff;
  padding: 0;
}
.image-stage.manual-page-asset img {
  width: 100%;
  height: auto;
  object-fit: contain;
}
.fallback-title { font-size: 18px; font-weight: 950; color: #334155; margin-bottom: 10px; }
.fallback-text { max-width: 820px; color: #475569; line-height: 1.7; }
.controls { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.controls button, .primary-button { min-height: 52px; border: 0; border-radius: 18px; font-weight: 950; padding: 8px 12px; background: var(--soft); color: #1e293b; }
.controls button.active { background: var(--dark); color: white; }
.controls button.record { background: var(--green); color: white; }
.supplement { background: #eef2ff; border: 1px solid #c7d2fe; border-radius: 24px; padding: 18px; margin-top: 10px; color: #172554; line-height: 1.75; }
.supplement h3 { margin: 0 0 8px; font-size: 14px; color: #4338ca; }
.supplement textarea, .memo, .gpt-textarea { width: 100%; border: 1px solid var(--line); border-radius: 18px; padding: 12px; resize: vertical; min-height: 120px; outline: none; }
.list-grid { display: grid; gap: 8px; }
.problem-row { width: 100%; text-align: left; background: white; border: 1px solid var(--line); border-radius: 20px; padding: 11px 12px; display: grid; gap: 4px; }
.problem-row.active { border-color: #0f172a; background: #f8fafc; }
.problem-row-top { display: flex; gap: 8px; justify-content: space-between; align-items: center; }
.problem-badge { background: var(--soft); border-radius: 999px; padding: 4px 9px; font-weight: 950; font-size: 13px; }
.problem-row-title { font-weight: 900; font-size: 14px; }
.problem-row-meta { color: var(--muted); font-size: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.quick-ratings { margin-top: 12px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.quick-ratings button { min-height: 92px; border: 0; border-radius: 24px; color: white; font-weight: 950; }
.quick-symbol { font-size: 38px; line-height: 1; }
.quick-label { margin-top: 4px; font-size: 16px; }
.rate-bad { background: var(--rose); }
.rate-weak { background: var(--amber); }
.rate-good { background: var(--green); }
.rate-easy { background: var(--violet); }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.metric { background: white; border: 1px solid var(--line); border-radius: 24px; padding: 14px; }
.metric-label { color: var(--muted); font-size: 13px; font-weight: 800; }
.metric-value { font-size: 36px; font-weight: 950; }
.top-dashboard { gap: 12px; }
.top-hero-panel { display: flex; justify-content: space-between; align-items: center; gap: 14px; border-radius: 18px; }
.top-hero-panel.behind, .top-hero-panel.late { border-left: 6px solid var(--rose); }
.top-hero-panel.ahead { border-left: 6px solid var(--green); }
.top-hero-panel.even { border-left: 6px solid #0891b2; }
.top-hero-copy h2 { margin: 0 0 4px; font-size: 24px; font-weight: 950; }
.top-hero-copy p { margin: 0; color: var(--muted); line-height: 1.55; }
.pace-target-field { display: grid; gap: 6px; min-width: 190px; color: var(--muted); font-size: 12px; font-weight: 900; }
.pace-target-field input { min-height: 42px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: #fff; color: #0f172a; font-weight: 900; }
.top-action-panel { display: grid; gap: 10px; border-radius: 18px; }
.top-action-link { border: 1px solid var(--line); border-radius: 10px; background: #fff; color: #0f172a; min-height: 36px; padding: 7px 12px; font-weight: 900; white-space: nowrap; }
.top-action-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.top-action-card { min-width: 0; min-height: 92px; border: 1px solid var(--line); border-left: 5px solid #94a3b8; border-radius: 12px; background: #ffffff; color: #0f172a; padding: 10px; display: grid; gap: 4px; text-align: left; cursor: pointer; }
.top-action-card.bad { border-left-color: var(--rose); background: #fff7f8; }
.top-action-card.warn { border-left-color: var(--amber); background: #fffbeb; }
.top-action-card.ok { border-left-color: var(--green); background: #f0fdf4; }
.top-action-card span { color: #334155; font-size: 12px; font-weight: 950; }
.top-action-card strong { font-size: 22px; line-height: 1; }
.top-action-card small { color: var(--muted); font-size: 12px; font-weight: 800; line-height: 1.35; overflow-wrap: anywhere; }
.top-action-card:disabled { opacity: .58; cursor: default; }
.top-workload-panel { display: grid; gap: 10px; border-radius: 18px; }
.top-workload-target { flex: 0 0 auto; border-radius: 999px; padding: 8px 12px; font-weight: 950; background: #f8fafc; color: #334155; }
.top-workload-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.top-workload-card { min-width: 0; border: 1px solid var(--line); border-top: 4px solid #94a3b8; border-radius: 10px; background: #fff; color: #0f172a; padding: 9px; display: grid; gap: 5px; text-align: left; cursor: pointer; }
.top-workload-card.bad { border-top-color: var(--rose); background: #fff7f8; }
.top-workload-card.warn { border-top-color: var(--amber); background: #fffbeb; }
.top-workload-card.ok { border-top-color: var(--green); background: #f0fdf4; }
.top-workload-card span { color: #334155; font-size: 12px; font-weight: 950; }
.top-workload-card strong { font-size: 22px; line-height: 1; }
.top-workload-card small { color: var(--muted); font-size: 12px; font-weight: 800; overflow-wrap: anywhere; }
.top-workload-card i { display: block; height: 7px; border-radius: 999px; background: #e2e8f0; overflow: hidden; }
.top-workload-card i b { display: block; height: 100%; background: #0f766e; }
.top-workload-card.bad i b { background: #e11d48; }
.top-workload-card.warn i b { background: #d97706; }
.top-workload-card:disabled { opacity: .55; cursor: default; }
.top-study-time-panel { display: grid; gap: 10px; border-radius: 18px; }
.top-study-time-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.top-study-time-card { min-width: 0; border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 12px; display: grid; gap: 5px; }
.top-study-time-card span { color: #334155; font-size: 12px; font-weight: 950; }
.top-study-time-card strong { font-size: 28px; line-height: 1.1; font-weight: 950; }
.top-study-time-card small { color: var(--muted); font-size: 12px; font-weight: 800; overflow-wrap: anywhere; }
.top-study-time-live { flex: 0 0 auto; border-radius: 999px; padding: 8px 12px; background: #ecfdf5; color: #047857; font-size: 13px; font-weight: 950; }
.top-metrics { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.pace-panel { display: grid; gap: 12px; border-radius: 18px; }
.pace-panel-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.pace-panel-head p { margin: -6px 0 0; color: var(--muted); font-size: 13px; }
.pace-delta { flex: 0 0 auto; border-radius: 999px; padding: 8px 12px; font-weight: 950; background: #f1f5f9; color: #334155; }
.pace-delta.behind, .pace-delta.late { background: #fff1f2; color: #be123c; }
.pace-delta.ahead { background: #ecfdf5; color: #047857; }
.pace-delta.even { background: #ecfeff; color: #0e7490; }
.pace-track { position: relative; height: 28px; border-radius: 6px; background: #e5e7eb; overflow: hidden; }
.pace-fill { display: block; height: 100%; background: #0891b2; }
.pace-fill.behind, .pace-fill.late { background: #e11d48; }
.pace-fill.ahead { background: #059669; }
.pace-expected { position: absolute; top: 0; bottom: 0; width: 3px; background: #0f172a; box-shadow: 0 0 0 2px rgba(255,255,255,.85); }
.pace-track-labels { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; font-weight: 900; }
.pace-type-breakdown { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.pace-type-card { border: 1px solid var(--line); border-top: 4px solid #94a3b8; border-radius: 10px; padding: 10px; background: #fff; display: grid; gap: 6px; min-width: 0; }
.pace-type-card.ok { border-top-color: var(--green); }
.pace-type-card.warn { border-top-color: var(--amber); }
.pace-type-card.bad { border-top-color: var(--rose); }
.pace-type-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; color: #334155; }
.pace-type-head strong { font-size: 13px; font-weight: 950; }
.pace-type-head span { color: var(--muted); font-size: 12px; font-weight: 900; }
.pace-type-main { display: flex; align-items: baseline; gap: 6px; }
.pace-type-main b { font-size: 22px; line-height: 1; }
.pace-type-main span, .pace-type-card small { color: var(--muted); font-size: 12px; font-weight: 800; overflow-wrap: anywhere; }
.pace-detail-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.pace-detail-grid div { border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: #f8fafc; display: grid; gap: 2px; }
.pace-detail-grid span { color: var(--muted); font-size: 12px; font-weight: 800; }
.pace-detail-grid b { font-size: 18px; overflow-wrap: anywhere; }
.pacemaker-chapter-list { display: grid; gap: 8px; }
.pacemaker-chapter-row { display: grid; grid-template-columns: minmax(0, 1fr) 164px; gap: 10px; align-items: center; border: 1px solid var(--line); border-left-width: 5px; border-radius: 10px; padding: 10px; background: #fff; }
.pacemaker-chapter-row.bad { border-left-color: var(--rose); }
.pacemaker-chapter-row.warn { border-left-color: var(--amber); }
.pacemaker-chapter-row.ok { border-left-color: var(--green); }
.pacemaker-chapter-main { display: grid; gap: 3px; min-width: 0; }
.pacemaker-chapter-main strong { font-size: 14px; }
.pacemaker-chapter-main span, .pacemaker-chapter-main small { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.pacemaker-chapter-meter { display: grid; gap: 5px; justify-items: end; }
.pacemaker-mini-track { width: 100%; height: 10px; background: #e2e8f0; border-radius: 999px; overflow: hidden; }
.pacemaker-mini-track span { display: block; height: 100%; background: #059669; }
.pacemaker-chapter-meter b { font-size: 12px; color: #334155; }
.pacemaker-chapter-actions { display: flex; gap: 4px; justify-content: flex-end; flex-wrap: wrap; }
.pacemaker-chapter-actions button { border: 1px solid var(--line); border-radius: 8px; background: #fff; color: #0f172a; min-height: 28px; padding: 0 8px; font-size: 12px; font-weight: 900; cursor: pointer; }
.pacemaker-chapter-actions button:hover { border-color: #94a3b8; background: #f8fafc; }
.pacemaker-chapter-actions button:disabled { opacity: .5; cursor: default; }
.progress-dashboard { gap: 12px; }
.progress-head-panel { display: grid; gap: 10px; }
.progress-title-row { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.progress-title-row p { margin: 0; color: var(--muted); font-size: 13px; }
.progress-toolbar { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.progress-segmented { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: #fff; }
.progress-segmented button { border: 0; border-right: 1px solid var(--line); background: #fff; min-height: 42px; padding: 0 18px; font-weight: 900; color: #334155; cursor: pointer; }
.progress-segmented button:last-child { border-right: 0; }
.progress-segmented button.active { background: #1f2937; color: #fff; }
.progress-segmented.small button { min-height: 34px; padding: 0 12px; font-size: 13px; }
.progress-metrics { grid-template-columns: repeat(8, minmax(0, 1fr)); }
.progress-main-panel { display: grid; gap: 10px; }
.progress-legend { display: flex; gap: 12px; flex-wrap: wrap; justify-content: flex-end; color: #334155; font-size: 13px; font-weight: 800; }
.progress-legend span { display: inline-flex; align-items: center; gap: 6px; }
.progress-legend i { width: 14px; height: 14px; border-radius: 999px; display: inline-block; }
.progress-legend i.first-ok, .progress-segment.first-ok { background: #f97316; }
.progress-legend i.improved, .progress-segment.improved { background: #eab308; }
.progress-legend i.not-yet, .progress-segment.not-yet { background: #2563eb; }
.progress-legend i.retained, .progress-segment.retained, .progress-vbar-segment.retained { background: #16a34a; }
.progress-legend i.review-due, .progress-segment.review-due, .progress-vbar-segment.review-due { background: #f59e0b; }
.progress-legend i.needs-back, .progress-segment.needs-back, .progress-vbar-segment.needs-back { background: #dc2626; }
.progress-legend i.not-started, .progress-segment.not-started, .progress-vbar-segment.not-started { background: #cbd5e1; }
.progress-table { display: grid; gap: 8px; }
.progress-row { display: grid; grid-template-columns: minmax(220px, 360px) minmax(0, 1fr); gap: 12px; align-items: center; min-height: 56px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.progress-row.has-children { background: #f8fafc; }
.progress-row.collapsed { border-color: #cbd5e1; }
.progress-row.depth-1 .progress-row-label,
.progress-row.depth-2 .progress-row-label { padding-left: 0; }
.progress-row-label { display: grid; gap: 3px; min-width: 0; }
.progress-row-title { display: flex; align-items: center; gap: 6px; min-width: 0; }
.progress-indent { flex: 0 0 calc(var(--progress-depth, 0) * 18px); }
.progress-tree-toggle { width: 24px; height: 24px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: #334155; font-size: 12px; font-weight: 900; line-height: 1; cursor: pointer; }
.progress-tree-toggle:hover { border-color: #94a3b8; background: #eef2ff; }
.progress-tree-spacer { width: 24px; height: 24px; flex: 0 0 24px; }
.progress-row-label strong { font-size: 14px; overflow-wrap: anywhere; }
.progress-row-label span { color: var(--muted); font-size: 12px; }
.progress-row-main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(90px, auto); gap: 10px; align-items: center; }
.progress-track { height: 28px; border-radius: 4px; background: #e5e7eb; overflow: hidden; display: flex; }
.progress-fill { display: block; height: 100%; background: #94a3b8; }
.progress-fill.work { background: #64748b; }
.progress-fill.time { background: #0891b2; }
.progress-track.stacked { background: #f1f5f9; }
.progress-segment { display: block; height: 100%; }
.progress-row-value { font-weight: 900; font-size: 13px; text-align: right; color: #0f172a; }
.progress-vbar-chart { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(78px, 112px); gap: 10px; align-items: end; overflow-x: auto; min-height: 286px; padding: 8px 2px 4px; }
.progress-vbar { display: grid; grid-template-rows: auto 190px auto; gap: 6px; min-width: 0; justify-items: center; cursor: default; }
.progress-vbar.has-children,
.progress-vbar[role="button"] { cursor: pointer; }
.progress-vbar-value { min-height: 18px; color: #0f172a; font-size: 12px; font-weight: 900; text-align: center; }
.progress-vbar-stack { width: 34px; height: 190px; display: flex; align-items: flex-end; justify-content: center; border-radius: 4px; background: #eef2f7; overflow: hidden; }
.progress-vbar-fill { width: 100%; min-height: 0; display: block; border-radius: 4px 4px 0 0; }
.progress-vbar-fill.time { background: #0891b2; }
.progress-vbar-fill-stack { width: 100%; min-height: 0; display: flex; flex-direction: column; justify-content: flex-end; border-radius: 4px 4px 0 0; overflow: hidden; }
.progress-vbar-segment { width: 100%; min-height: 0; display: block; }
.progress-vbar-label { width: 100%; min-height: 34px; color: #334155; font-size: 12px; font-weight: 800; line-height: 1.25; text-align: center; overflow-wrap: anywhere; }
.progress-vbar.depth-1 .progress-vbar-label { color: #0f172a; }
.progress-vbar.depth-2 .progress-vbar-stack { width: 28px; }
.progress-empty { color: var(--muted); padding: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.search { width: 100%; min-height: 48px; border: 1px solid var(--line); border-radius: 18px; padding: 10px 14px; outline: none; }
.rating-choice { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin: 10px 0; }
.rating-choice button { min-height: 58px; border: 0; border-radius: 18px; font-weight: 950; }
.rating-choice button.active { color: white; background: var(--dark); }
.gpt-box { white-space: pre-wrap; background: #f8fafc; border: 1px solid var(--line); border-radius: 20px; padding: 12px; min-height: 220px; max-height: 360px; overflow: auto; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12px; }
.gpt-review-workspace .panel {
  align-self: start;
}
.v712-promptbox {
  background: #0f172a;
  color: #e2e8f0;
  border-color: #0f172a;
  max-height: 440px;
}
.v712-textarea {
  width: 100%;
  min-height: 220px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}
.review-request-options {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  margin: 10px 0;
  background: #f8fafc;
}
.review-target-switch {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 8px;
}
.review-target-switch .target-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}
.review-target-switch button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: #1e293b;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 900;
}
.review-target-switch button.active {
  background: var(--dark);
  border-color: var(--dark);
  color: #ffffff;
}
.review-request-field-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.review-request-options label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.review-request-options select,
.review-request-textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: #ffffff;
  color: var(--text);
}
.review-request-textarea {
  min-height: 72px;
  margin-bottom: 8px;
  resize: vertical;
  font: inherit;
  font-size: 14px;
  line-height: 1.55;
}
.timed-exam-target-card {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 8px;
  margin: 8px 0;
  background: #ffffff;
}
.timed-exam-target-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
}
.timed-exam-target-metrics span {
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}
.timed-exam-target-metrics strong {
  color: var(--text);
  font-size: 13px;
}
.timed-exam-status.ok { color: #047857; }
.timed-exam-status.warn { color: #b45309; }
.timed-exam-status.fail { color: #b91c1c; }
.timed-exam-status.muted { color: var(--muted); }
.timed-exam-target-note {
  display: grid;
  gap: 2px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.v712-ok {
  background: #e8f5e9;
  color: #1b5e20;
  padding: 6px 10px;
  border-radius: 8px;
  margin: 6px 0;
}
.v712-bad {
  background: #ffebee;
  color: #b71c1c;
  padding: 6px 10px;
  border-radius: 8px;
  margin: 6px 0;
}
.v712-busy,
.v712-muted {
  color: #64748b;
  font-size: 12px;
}
.v712-apply-inline {
  margin-top: 8px;
  padding: 10px;
  border: 1px dashed #1565c0;
  border-radius: 10px;
}
.review-procedure {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.review-procedure div,
.socratic-step {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #ffffff;
  padding: 10px;
  display: grid;
  gap: 5px;
}
.review-procedure b,
.socratic-step b {
  font-size: 13px;
}
.review-procedure span,
.socratic-step span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}
.review-plan-list {
  display: grid;
  gap: 8px;
}
.review-plan-row {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #ffffff;
  padding: 10px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}
.review-plan-row.active {
  border-color: #0f172a;
  background: #f8fafc;
}
.review-plan-title {
  font-weight: 900;
  line-height: 1.35;
}
.review-plan-actions {
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.review-plan-actions button {
  border: 1px solid var(--line);
  background: #f8fafc;
  border-radius: 12px;
  min-height: 34px;
  padding: 6px 9px;
  font-weight: 850;
}
.review-mode-badge {
  border-radius: 999px;
  padding: 5px 8px;
  background: #ecfeff;
  color: #155e75;
  font-size: 12px;
  font-weight: 900;
}
.progression-suggestion {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  margin: 0 0 10px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  background: #ffffff;
}
.progression-suggestion h3 { margin: 0 0 4px; font-size: 13px; color: var(--muted); }
.progression-suggestion strong { display: block; font-size: 16px; margin-bottom: 3px; }
.progression-suggestion p { margin: 0 0 8px; color: #334155; line-height: 1.55; }
.progression-suggestion.back { border-left: 5px solid var(--rose); }
.progression-suggestion.stay { border-left: 5px solid var(--amber); }
.progression-suggestion.forward { border-left: 5px solid var(--green); }
.progression-reasons { display: flex; gap: 6px; flex-wrap: wrap; }
.progression-reasons span { border-radius: 999px; background: #f1f5f9; color: #475569; padding: 4px 8px; font-size: 12px; font-weight: 800; }
.progression-action button { border: 0; border-radius: 12px; background: var(--dark); color: #ffffff; min-height: 38px; padding: 8px 12px; font-weight: 900; white-space: nowrap; }
.progression-gpt-rec {
  margin-top: 10px;
  padding-top: 9px;
  border-top: 1px solid #e2e8f0;
}
.progression-gpt-rec-title {
  margin-bottom: 5px;
  color: #334155;
  font-size: 12px;
  font-weight: 900;
}
.progression-gpt-rec p {
  margin: 6px 0;
  color: #111827;
}
.progression-gpt-rec ul {
  margin: 6px 0 0;
  padding-left: 1.2em;
  color: #334155;
  line-height: 1.5;
}
.progression-queue-note {
  margin-top: 7px;
  padding: 7px 8px;
  border: 1px solid #dbe3ef;
  border-left: 4px solid #64748b;
  border-radius: 10px;
  background: #f8fafc;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}
.progression-queue-note.back { border-left-color: var(--rose); }
.progression-queue-note.stay { border-left-color: var(--amber); }
.progression-queue-note.forward { border-left-color: var(--green); }
.progression-queue-note b {
  display: inline-block;
  margin-right: 6px;
  font-size: 12px;
  color: #0f172a;
}
.progression-queue-note span,
.progression-queue-note small {
  display: inline-block;
  color: #475569;
  font-size: 12px;
  line-height: 1.45;
}
.progression-queue-note small {
  display: block;
  margin-top: 2px;
}
.progression-queue-action button {
  border: 1px solid var(--line);
  background: #ffffff;
  border-radius: 10px;
  min-height: 32px;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}
.progression-queue-routes {
  margin-top: 7px;
  display: flex;
  gap: 6px;
  align-items: center;
  flex-wrap: wrap;
}
.progression-queue-routes > span {
  color: #64748b;
  font-size: 11px;
  font-weight: 900;
}
.progression-queue-routes > div {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
.progression-queue-routes .study-route-action-chip {
  min-height: 28px;
  padding: 4px 7px;
  font-size: 11px;
}
.study-route-next-actions.has-recommended {
  padding-top: 2px;
}
.study-route-action-chip.recommended {
  border-color: #0f766e;
  background: #f0fdfa;
  color: #115e59;
  box-shadow: 0 0 0 2px rgba(20, 184, 166, 0.14);
}
.study-route-action-chip.recommended.warn {
  border-color: #d97706;
  background: #fffbeb;
  color: #92400e;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.16);
}
.study-route-action-chip.recommended.bad {
  border-color: #e11d48;
  background: #fff1f2;
  color: #9f1239;
  box-shadow: 0 0 0 2px rgba(225, 29, 72, 0.13);
}
.route-rec-badge {
  display: inline-flex;
  align-items: center;
  min-height: 16px;
  border-radius: 999px;
  padding: 1px 5px;
  margin-right: 4px;
  background: rgba(15, 23, 42, 0.08);
  color: inherit;
  font-size: 10px;
  font-weight: 900;
}
.progression-queue-routes.compact {
  margin-top: 0;
}
.progression-queue-note.compact {
  margin-top: 0;
  min-width: 190px;
}
.progression-filter-bar {
  margin: 8px 0;
  padding: 8px;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  background: #f8fafc;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.progression-filter-bar b {
  color: #334155;
  font-size: 13px;
}
.progression-filter-chips {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  align-items: center;
}
.progression-filter-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: #334155;
  min-height: 32px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 900;
}
.progression-filter-chip span {
  color: #64748b;
  margin-left: 3px;
}
.progression-filter-chip.active {
  background: var(--dark);
  border-color: var(--dark);
  color: #ffffff;
}
.progression-filter-chip.active span {
  color: #dbeafe;
}
.socratic-flow {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0;
}
.socratic-hints {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #f8fafc;
  padding: 12px;
  margin: 0 0 10px;
}
.socratic-hints h3 {
  margin: 0 0 7px;
  font-size: 13px;
  color: #334155;
}
.socratic-hints ul {
  margin: 0 0 10px;
  padding-left: 1.2em;
  color: #334155;
  line-height: 1.6;
  font-size: 13px;
}
.socratic-log-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 10px 0;
}
.socratic-log-grid label,
.review-policy-grid label {
  display: grid;
  gap: 6px;
  font-size: 13px;
  font-weight: 900;
  color: #334155;
}
.socratic-log-grid .memo {
  min-height: 92px;
}
.review-ops-table-wrap {
  width: 100%;
  overflow: auto;
  margin-top: 12px;
}
.review-ops-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
  font-size: 13px;
}
.review-ops-table th,
.review-ops-table td {
  border-bottom: 1px solid var(--line);
  padding: 8px;
  text-align: left;
  vertical-align: middle;
}
.review-ops-table th {
  background: #f8fafc;
  color: #334155;
  font-size: 12px;
}
.review-ops-more {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  color: #475569;
  font-size: 12px;
  font-weight: 850;
}
.review-policy-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(90px, 1fr));
  gap: 8px;
  margin: 8px 0 14px;
  align-items: end;
}
.review-policy-grid input {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 7px 9px;
}
.bottom-nav { display: none; }
@media (max-width: 900px) {
  .nav { display: none; }
  .brand-sub { display: none; }
  .main { padding: 12px 10px 90px; }
  .controls { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .controls button.record { grid-column: span 2; }
  .metrics, .grid-2, .review-procedure, .socratic-flow, .review-plan-row, .socratic-log-grid, .review-policy-grid, .review-request-field-grid, .timed-exam-target-metrics { grid-template-columns: 1fr; }
  .quick-ratings { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .image-stage { height: 54vh; min-height: 360px; }
  .bottom-nav { position: fixed; z-index: 20; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; padding: 7px; background: rgba(255,255,255,.96); border-top: 1px solid var(--line); }
  .bottom-nav button { min-height: 58px; border: 0; border-radius: 15px; background: var(--soft); font-size: 12px; font-weight: 900; }
  .bottom-nav button.active { background: var(--dark); color: white; }
}
@media (min-width: 901px) {
  .study-list { margin-top: 12px; }
}

.form-grid { display:grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap:10px; margin:12px 0; }
.form-grid label { display:flex; flex-direction:column; gap:6px; font-weight:800; color:#334155; }
.form-grid select { min-height:44px; border:1px solid #cbd5e1; border-radius:16px; padding:8px 10px; font-size:15px; background:#fff; }
.protocol-box { margin:10px 0; border:1px solid #e2e8f0; border-radius:18px; padding:10px 12px; background:#f8fafc; }
.protocol-box summary { cursor:pointer; font-weight:900; }
.symbol-list { display:grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap:6px; margin:10px 0; }
.symbol-list div { display:flex; gap:8px; align-items:center; padding:6px 8px; background:white; border:1px solid #e2e8f0; border-radius:12px; }
.symbol-list b { min-width:42px; color:#0f172a; }
.symbol-list span { color:#475569; font-size:14px; }
.cancel-format-card { border:1px solid #fecaca; border-radius:12px; background:#fff7f7; padding:10px; margin:10px 0; }
.cancel-format-line { display:grid; grid-template-columns:1fr auto; gap:12px; align-items:center; min-height:34px; border-bottom:1px solid #fee2e2; padding-bottom:6px; margin-bottom:6px; }
.cancel-format-line span { color:#6b7280; text-decoration:line-through; text-decoration-color:#dc2626; }
.cancel-format-line b { color:#dc2626; font-size:20px; line-height:1; }
@media (max-width: 900px) {
  .header-inner { align-items: stretch; flex-direction: column; }
  .brand-wrap { justify-content: space-between; }
  .form-grid, .symbol-list { grid-template-columns:1fr; }
}

.answer-upload { display:grid; gap:10px; margin-top:10px; }
.answer-upload-actions { display:grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap:8px; }
.file-button { min-height:52px; border:0; border-radius:18px; font-weight:950; padding:14px 16px; background:#0f172a; color:white; display:flex; align-items:center; justify-content:center; cursor:pointer; text-align:center; }
.file-button.camera { background:#0f766e; }
.file-button input { display:none; }
.answer-upload-actions .mini-button { min-height:52px; margin:0; border-radius:18px; font-weight:950; }
.answer-watch-status { border:1px solid #cbd5e1; border-radius:14px; background:#f8fafc; padding:10px 12px; display:grid; gap:4px; color:#334155; }
.answer-watch-status b { color:#0f172a; }
.answer-watch-status span { font-size:13px; color:#475569; }
.answer-watch-status small { color:#64748b; line-height:1.5; }
.answer-watch-status.armed { border-color:#99f6e4; background:#f0fdfa; }
.answer-watch-status.imported { border-color:#bbf7d0; background:#f0fdf4; }
.answer-watch-status.expired { border-color:#fed7aa; background:#fff7ed; }
.answer-crop-panel { display:grid; gap:10px; border:1px solid #cbd5e1; border-radius:16px; background:#fff; padding:10px; }
.answer-crop-head { display:flex; justify-content:space-between; align-items:flex-start; gap:10px; }
.answer-crop-head div { display:grid; gap:2px; }
.answer-crop-head span { color:#64748b; font-size:12px; word-break:break-all; }
.answer-crop-stage { min-height:220px; max-height:52vh; border:1px solid #e2e8f0; border-radius:14px; background:#f8fafc; display:flex; align-items:center; justify-content:center; overflow:hidden; }
.answer-crop-image { max-width:100%; max-height:52vh; object-fit:contain; border-radius:8px; box-shadow:0 0 0 9999px rgba(15,23,42,0.08); }
.answer-crop-controls { display:grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap:8px; }
.answer-crop-slider { display:grid; grid-template-columns:24px 1fr 44px; gap:8px; align-items:center; font-size:13px; color:#334155; }
.answer-crop-slider input { width:100%; }
.answer-crop-slider output { text-align:right; font-variant-numeric:tabular-nums; color:#475569; }
.answer-crop-actions { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }
.answer-crop-actions .primary-button, .answer-crop-actions .mini-button { margin:0; }
.answer-gallery { display:grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap:10px; }
.answer-gallery.compact { grid-template-columns: 1fr; margin-top:8px; }
.answer-card { border:1px solid var(--line); border-radius:18px; padding:8px; background:white; display:grid; gap:8px; }
.answer-card img { width:100%; max-height:360px; object-fit:contain; border-radius:12px; background:#f8fafc; border:1px solid #e2e8f0; }
.answer-gallery.compact .answer-card img { max-height:160px; }
.answer-card-file-fallback { display:grid; place-items:center; gap:8px; min-height:160px; padding:16px; text-align:center; color:#475569; background:#f8fafc; border:1px dashed #cbd5e1; border-radius:12px; }
.answer-card-file-fallback .answer-image-hint { font-size:12px; line-height:1.5; color:#64748b; }
.answer-meta { display:flex; flex-direction:column; gap:2px; color:#475569; font-size:13px; }
.answer-meta b { color:#0f172a; }
.answer-card pre { white-space:pre-wrap; background:#f8fafc; border:1px solid #e2e8f0; border-radius:12px; padding:8px; margin:0; font-size:12px; }
.answer-ocr-confirm {
  border: 1px solid #fbbf24;
  border-radius: 12px;
  background: #fffbeb;
  padding: 8px 10px;
}
.answer-ocr-confirm summary {
  cursor: pointer;
  font-weight: 900;
  color: #78350f;
}
.answer-ocr-confirm-note,
.answer-ocr-source {
  margin-top: 6px;
  color: #6b4e16;
  font-size: 12px;
  line-height: 1.55;
}
.answer-ocr-source {
  color: #475569;
}
.answer-ocr-textarea,
.answer-ocr-note-textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #fcd34d;
  border-radius: 10px;
  background: #fff;
  padding: 9px;
  margin-top: 8px;
  resize: vertical;
  font-size: 13px;
  line-height: 1.55;
}
.answer-ocr-textarea { min-height: 110px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.answer-ocr-note-textarea { min-height: 54px; }
.answer-ocr-actions { display:flex; flex-wrap:wrap; gap:8px; margin-top:8px; align-items:center; }
.answer-ocr-actions .primary-button,
.answer-ocr-actions .mini-button { margin:0; }
.mini-button.danger { border-color:#fecaca; background:#fef2f2; color:#991b1b; }
.mini-button.warn { border-color:#fed7aa; background:#fff7ed; color:#9a3412; }
.mini-answer-panel { margin-top:12px; border-top:1px solid var(--line); padding-top:10px; }
.mini-answer-panel h3 { margin:0 0 8px; font-size:14px; color:#334155; }
@media (min-width: 901px) { .controls { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (max-width: 900px) { .answer-gallery, .answer-upload-actions, .answer-crop-controls { grid-template-columns:1fr; } .bottom-nav { grid-template-columns: repeat(4, 1fr); } }

.material-row { display:grid; grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 1.1fr); gap:14px; align-items:start; padding:14px 0; border-top:1px solid var(--line); }
.material-row h3, .nested-panel h3 { margin:0 0 8px; font-size:15px; color:#334155; }
.material-textarea, .material-mini-textarea { width:100%; border:1px solid var(--line); border-radius:18px; padding:12px; resize:vertical; outline:none; background:white; }
.material-textarea { min-height:180px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size:13px; line-height:1.55; }
.material-mini-textarea { min-height:96px; }
.checkline { display:flex; gap:8px; align-items:center; font-weight:800; color:#334155; margin:6px 0 8px; }
.small-image .image-stage { min-height:240px; height:36vh; }
.nested-panel { margin-top:14px; background:#f8fafc; }
@media (max-width: 900px) { .material-row { grid-template-columns:1fr; } .small-image .image-stage { height:42vh; } }

/* v6.5: OCR Raw / 日本語ドキュメント切替 */
.material-source-tabs { display:flex; gap:8px; margin:8px 0 10px; flex-wrap:wrap; }
.material-source-tabs button { border:1px solid var(--line); background:#f8fafc; border-radius:999px; padding:7px 12px; font-weight:800; cursor:pointer; color:#334155; }
.material-source-tabs button.active { background:#0f172a; color:white; border-color:#0f172a; }
.material-source-pane[hidden] { display:none; }
.material-doc-textarea { font-family: inherit; font-size:14px; line-height:1.7; background:#fff; }
.material-raw-view { min-height:180px; max-height:360px; overflow:auto; white-space:pre-wrap; word-break:break-word; border:1px solid var(--line); border-radius:18px; padding:12px; background:#0f172a; color:#e2e8f0; font-family:ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size:12.5px; line-height:1.5; }
.mini-button { border:1px solid var(--line); background:white; border-radius:14px; padding:8px 12px; font-weight:800; cursor:pointer; margin:8px 0; }
.mini-button:hover { background:#f8fafc; }
.inline-actions { display:flex; gap:8px; flex-wrap:wrap; align-items:center; margin:8px 0; }


/* v6.8 GPT画像OCR workflow */
.vision-ocr-panel {
  border: 1px solid #c7d2fe;
  background: #eef2ff;
}
.gpt-json-textarea {
  min-height: 150px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}
.mini-button.secondary {
  background: #f8fafc;
  color: #334155;
  border-color: #cbd5e1;
}

/* v6.9 Gemini/GPT JSON material document UI */
.material-doc-preview {
  display: grid;
  gap: 10px;
}
.doc-meta-line {
  padding: 8px 10px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #334155;
}
.doc-preview-block {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #ffffff;
  padding: 10px 12px;
}
.doc-preview-block h4 {
  margin: 0 0 6px 0;
  color: #1f2937;
  font-size: 0.95rem;
}
.doc-preview-block pre {
  margin: 0;
  white-space: pre-wrap;
  font-family: inherit;
  line-height: 1.65;
  color: #111827;
}
.doc-preview-block ul {
  margin: 0;
  padding-left: 1.2em;
  line-height: 1.65;
}
.doc-edit-block {
  display: block;
  margin: 10px 0;
}
.doc-edit-block > span {
  display: inline-block;
  font-weight: 700;
  margin-bottom: 4px;
}
.inline-check {
  display: inline-flex;
  margin-left: 12px;
  font-weight: 400;
}
.compact-grid input.text-input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
}

/* v6.10: 教材ドキュメント表示の人間向け数式整形 */
.human-readable-doc,
.human-readable-list {
  font-size: 15px;
  letter-spacing: 0.01em;
}
.human-readable-doc {
  background: #fff;
}

/* v6.15: study view defaults to OCR document, tap/click toggles source image */
.study-content-card {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: #fff;
  padding: 10px;
  margin-top: 10px;
  cursor: pointer;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.study-content-card:hover {
  border-color: #94a3b8;
  box-shadow: 0 2px 8px rgba(15,23,42,.06);
}
.study-content-card.text-mode { background: #ffffff; }
.study-content-card.image-mode { background: #f8fafc; }
.study-content-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}
.study-content-head.with-stopwatch {
  align-items: center;
  gap: 8px;
  min-height: 56px;
}
.study-content-title-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
  flex: 1 1 280px;
}
.study-content-head h3 {
  margin: 0;
  font-size: 15px;
  color: #334155;
}
.study-content-head span {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}
.title-mask-controls {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  background: #ffffff;
  cursor: default;
}
.title-mask-controls button {
  height: 26px;
  min-width: 28px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  background: #f8fafc;
  color: #1e293b;
  font-weight: 900;
  line-height: 1;
}
.title-mask-controls button.title-mask-toggle {
  min-width: 64px;
  padding: 0 8px;
  font-size: 12px;
}
.title-mask-controls button.title-mask-toggle.active {
    border-color: #d6b46d;
    background: #fff7e6;
    color: #7c2d12;
  }
.title-mask-controls input {
  width: 52px;
  height: 26px;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  padding: 0 4px;
  text-align: right;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
}
.title-mask-unit {
  color: #64748b;
  font-size: 11px;
  font-weight: 900;
}
.study-card-stopwatch {
  flex: 0 0 392px;
  width: 392px;
  margin: 0;
  padding: 4px;
  gap: 8px;
  border-radius: 14px;
  background: #ffffff;
  position: static;
  top: auto;
  z-index: auto;
  box-shadow: none;
}
.study-card-stopwatch .timebox {
  flex: 0 0 104px;
  width: 104px;
  min-height: 38px;
  padding: 4px 10px;
  border: 1px solid #dbe4ef;
  border-radius: 10px;
  background: #ffffff;
}
.study-card-stopwatch .time {
  display: inline-block;
  width: 5ch;
  text-align: right;
  font-size: 27px;
}
.study-card-stopwatch .small-buttons {
  display: flex;
  flex: 0 0 238px;
  gap: 6px;
}
.study-card-stopwatch .small-buttons button {
  width: 74px;
  min-width: 74px;
  min-height: 40px;
  border-radius: 12px;
}
.study-readable-doc {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 18px;
  line-height: 1.85;
  color: #111827;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  padding: 16px;
}
.visual-reference-hint {
  margin-bottom: 8px;
  padding: 10px 12px;
  border: 1px solid #fed7aa;
  border-radius: 14px;
  background: #fff7ed;
  color: #9a3412;
  font-weight: 800;
  line-height: 1.6;
}
.study-answer-area {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}
@media (max-width: 900px) {
  .study-readable-doc { font-size: 16px; line-height: 1.75; padding: 12px; }
  .answer-card pre.learner-answer-readable,
  .learner-ocr-card pre.learner-answer-readable,
  pre.learner-answer-readable { font-size: 16px; line-height: 1.75; padding: 12px; }
  .study-content-head { align-items: flex-start; flex-direction: column; }
  .study-content-head span { white-space: normal; }
}

/* v6.16: 12.7インチ級タブレット縦長表示最適化 */
@media (orientation: portrait) and (max-width: 1200px) {
  :root { --tablet-reading-width: 980px; }
  html, body { font-size: 17px; overscroll-behavior-y: contain; }
  .header-inner, .main { max-width: var(--tablet-reading-width); }
  .header-inner { padding: 10px 14px; align-items: flex-start; }
  .brand-title { font-size: 18px; line-height: 1.25; }
  .brand-sub { display: none; }
  .nav { max-width: 100%; gap: 6px; justify-content: flex-end; }
  .nav button { min-height: 46px; padding: 8px 12px; border-radius: 15px; font-size: 14px; }
  .main { padding: 12px 14px calc(104px + env(safe-area-inset-bottom)); }
  .viewer, .grid-2, .material-row { grid-template-columns: 1fr !important; }
  .panel, .viewer-main { border-radius: 24px; padding: 12px; }
  .problem-head { align-items: flex-start; gap: 8px; }
  .problem-title { font-size: clamp(21px, 3vw, 30px); line-height: 1.28; }
  .problem-id, .status { font-size: 13px; }
  .stopwatch { position: sticky; top: 62px; z-index: 8; border-radius: 18px; box-shadow: 0 4px 16px rgba(15,23,42,.06); }
  .study-card-stopwatch { position: static; top: auto; z-index: auto; box-shadow: none; }
  .time { font-size: 30px; }
  .small-buttons button, .controls button, .primary-button, .file-button, .mini-button { min-height: 52px; touch-action: manipulation; }
  .controls { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 8px; }
  .controls button.record { grid-column: span 2; }
  .study-content-card { border-radius: 24px; padding: 12px; margin-top: 12px; }
  .study-content-head { align-items: flex-start; flex-direction: column; gap: 4px; }
  .study-content-head.with-stopwatch { align-items: center; flex-direction: row; flex-wrap: nowrap; gap: 8px; min-height: 56px; }
  .study-card-stopwatch { flex-basis: 392px; width: 392px; }
  .study-card-stopwatch .time { font-size: 27px; }
  .study-card-stopwatch .small-buttons button { min-height: 40px; }
  .study-content-head h3 { font-size: 16px; }
  .study-content-head span { white-space: normal; font-size: 12px; }
  .study-readable-doc { font-size: clamp(18px, 2.2vw, 22px); line-height: 1.9; padding: 18px; border-radius: 20px; }
  .image-stage { min-height: 420px; height: min(58vh, 820px); border-radius: 20px; }
  .small-image .image-stage { height: min(42vh, 560px); min-height: 320px; }
  .quick-ratings { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .quick-ratings button { min-height: 108px; border-radius: 24px; }
  .quick-symbol { font-size: 42px; }
  .problem-row { padding: 14px; border-radius: 22px; }
  .problem-row-title { font-size: 15px; }
  .answer-gallery, .metrics, .form-grid, .symbol-list { grid-template-columns: 1fr !important; }
  .material-textarea, .material-doc-textarea, .material-mini-textarea, .memo, .gpt-textarea { font-size: 16px; line-height: 1.7; border-radius: 18px; }
  .material-raw-view, .gpt-box, .answer-card pre { font-size: 13px; }
  .bottom-nav { position: fixed; z-index: 20; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 8px max(8px, env(safe-area-inset-left)) calc(8px + env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-right)); background: rgba(255,255,255,.96); border-top: 1px solid var(--line); backdrop-filter: blur(10px); }
  .bottom-nav button { min-height: 62px; border: 0; border-radius: 16px; background: var(--soft); font-size: 12px; font-weight: 900; touch-action: manipulation; }
  .bottom-nav button.active { background: var(--dark); color: white; }
}
@media (orientation: portrait) and (max-width: 760px) {
  .header-inner { flex-direction: column; align-items: stretch; }
  .nav { display: none; }
  .study-content-head.with-stopwatch { align-items: stretch; flex-direction: column; flex-wrap: nowrap; min-height: 0; }
  .study-card-stopwatch { flex-basis: auto; width: 100%; }
  .study-readable-doc { font-size: 17px; padding: 14px; }
  .image-stage { min-height: 340px; height: 52vh; }
}

/* v6.17 OCR progress */
.ocr-progress-panel {
  margin: 12px 0 16px;
  border: 1px solid #dbe3ef;
  border-radius: 14px;
  background: #f8fafc;
  padding: 10px 12px;
}
.ocr-progress-panel summary {
  cursor: pointer;
  font-weight: 700;
  color: #334155;
  min-height: 44px;
  display: flex;
  align-items: center;
}
.ocr-progress-table-wrap {
  overflow-x: auto;
  max-height: 360px;
  overflow-y: auto;
}
.ocr-progress-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
  background: white;
}
.ocr-progress-table th,
.ocr-progress-table td {
  border-bottom: 1px solid #e5e7eb;
  padding: 8px 10px;
  text-align: left;
  white-space: nowrap;
}
.ocr-progress-table th {
  position: sticky;
  top: 0;
  background: #eef2ff;
  z-index: 1;
}

/* v6.21: study DB readiness and review context workflow */
.study-db-panel .study-ready-summary {
  border-radius: 14px;
  padding: 12px 14px;
  margin: 8px 0 10px;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.study-db-panel .study-ready-summary.ready {
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
}
.study-db-panel .study-ready-summary.not-ready {
  background: #fff7ed;
  color: #9a3412;
  border: 1px solid #fed7aa;
}
.readiness-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 12px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 8px;
}
.readiness-list li {
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 8px 10px;
  background: #fff;
  display: flex;
  gap: 8px;
  align-items: center;
}
.readiness-list li.ok { color: #047857; }
.readiness-list li.ng { color: #6b7280; }
.review-context-panel textarea.gpt-json-textarea {
  min-height: 150px;
}


/* TWO_PANE_STUDY_WORKSPACE */
.study-two-pane-viewer {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(360px, 0.95fr);
  gap: 16px;
  align-items: start;
}

.study-two-left {
  position: sticky;
  top: 12px;
  max-height: calc(100vh - 24px);
  overflow: auto;
}

.study-two-right {
  max-height: calc(100vh - 24px);
  overflow: auto;
}

.study-right-pane-inner {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.study-right-topbar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  min-height: 32px;
}

.study-right-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 8px;
  border-bottom: 1px solid #e2e8f0;
}

.study-right-tabs button {
  min-height: 38px;
}

.study-right-content {
  min-height: 240px;
}

.review-check-left-stack {
  display: grid;
  grid-template-rows: auto minmax(170px, 1fr);
  gap: 0;
  margin-bottom: 10px;
  max-height: calc(100vh - 36px);
  min-height: 0;
}

.review-check-left-stack > .study-content-card {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  position: relative;
  z-index: 1;
}

.review-check-left-stack > .study-content-card .image-stage {
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  height: min(36vh, 420px);
  min-height: 220px;
}

.review-check-left-stack > .study-content-card .image-stage.manual-page-asset {
  height: auto;
  min-height: 0;
  padding: 0;
  display: block;
}

.review-check-left-stack > .study-content-card .image-stage.manual-page-asset img {
  width: 100%;
  height: auto;
  object-fit: contain;
}

.review-check-inline-paper {
  border: 1px solid var(--line);
  border-top: 0;
  border-radius: 0 0 18px 18px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  background: #ffffff;
  min-height: 0;
}

.review-check-inline-paper-panel {
  border-top: 0;
  background: #ffffff;
}

.review-check-inline-paper-panel + .review-check-inline-paper-panel {
  border-top: 0;
}

.review-check-inline-paper .image-stage {
  border: 0;
  border-radius: 0;
  background: #ffffff;
  margin: 0;
}

.review-check-inline-paper .image-stage.answer {
  background: #ffffff;
}

.review-check-inline-paper-doc {
  margin: 0;
  border: 0;
  border-radius: 0;
  background: #ffffff;
}

.problem-picker-inline {
  margin-top: 12px;
  border: 1px solid #d9e2ef;
  border-radius: 12px;
  padding: 10px;
  background: #fff;
}

.problem-picker-inline summary {
  cursor: pointer;
  font-weight: 800;
}

.problem-picker-tabs {
  display: inline-flex;
  gap: 0;
  margin: 10px 0;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
}

.problem-picker-tabs button {
  border: 0;
  border-right: 1px solid #cbd5e1;
  background: #ffffff;
  color: #334155;
  min-height: 38px;
  padding: 0 14px;
  font-weight: 950;
}

.problem-picker-tabs button:last-child {
  border-right: 0;
}

.problem-picker-tabs button.active {
  background: #1f2937;
  color: #ffffff;
}

.problem-picker-tabs span {
  margin-left: 4px;
  font-size: 12px;
  opacity: .75;
}

.problem-picker-grid {
  display: grid;
  gap: 8px;
}

.problem-picker-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  padding: 6px;
}

.problem-picker-row.active {
  border-color: #0f172a;
  background: #f8fafc;
}

.problem-picker-main-action {
  min-width: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #0f172a;
  padding: 7px 8px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  text-align: left;
}

.problem-picker-main-action.active {
  background: #e2e8f0;
}

.problem-picker-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 900;
}

.problem-picker-side-action {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #334155;
  min-width: 62px;
  padding: 5px 8px;
  display: grid;
  place-items: center;
  gap: 2px;
  font-size: 12px;
  font-weight: 950;
}

.problem-picker-side-action span {
  font-size: 10px;
  color: #64748b;
  font-weight: 850;
}

.problem-picker-side-action.active {
  border-color: #0f172a;
  background: #0f172a;
  color: #ffffff;
}

.problem-picker-side-action.active span {
  color: #e2e8f0;
}

.inline-review-readable h3,
.inline-review-readable h4 {
  margin: 14px 0 8px;
}

.inline-meta,
.inline-id-line {
  color: #64748b;
  font-size: 12px;
  margin: 6px 0;
}

.inline-review-group,
.inline-factor-card {
  border: 1px solid #d9e2ef;
  border-radius: 14px;
  padding: 12px;
  margin: 12px 0;
  background: #fff;
}

.inline-card-title {
  font-weight: 900;
  margin-bottom: 6px;
}

.inline-card-title span {
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.inline-db-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px 12px;
  margin: 10px 0;
}

.inline-db-card summary {
  cursor: pointer;
  font-weight: 800;
}

.inline-db-body {
  white-space: pre-wrap;
  word-break: break-word;
  margin-top: 8px;
  line-height: 1.65;
}

.inline-badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.inline-badge {
  display: inline-block;
  margin: 2px 4px 2px 0;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
  background: #e0f2fe;
  color: #075985;
}

.inline-badge.warn {
  background: #fef3c7;
  color: #92400e;
}
.inline-badge.ok {
  background: #dcfce7;
  color: #166534;
}
.inline-badge.bad {
  background: #fee2e2;
  color: #991b1b;
}

.relation-chip.pending,
.progression-action-pending {
  border-style: dashed;
  border-color: #f59e0b;
  background: #fffbeb;
  color: #92400e;
  cursor: default;
}
button.relation-chip.pending {
  cursor: pointer;
}
.pending-relation-chip {
  display: inline-flex;
  gap: 4px;
  align-items: center;
}
.relation-chip.pending.ocr {
  background: #fff7ed;
  border-color: #fb923c;
  color: #9a3412;
}

.v713-post-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  padding: 8px;
  border: 1px solid #bbf7d0;
  background: #f0fdf4;
  color: #166534;
  border-radius: 6px;
}
.progression-action button.pending {
  background: #f59e0b;
  color: #1f2937;
}

.exercise-link-import textarea {
  min-height: 180px;
  font-family: ui-monospace, SFMono-Regular, Consolas, monospace;
}

.exercise-link-prompt-preview {
  margin: 8px 0;
}

.exercise-link-prompt-preview summary {
  cursor: pointer;
  font-weight: 800;
}

.exercise-link-prompt-preview pre {
  max-height: 320px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  border: 1px solid #d9e2ef;
  border-radius: 8px;
  padding: 10px;
  background: #ffffff;
  font-size: 12px;
  line-height: 1.55;
}

.exercise-link-preview {
  margin-top: 8px;
  border: 1px solid #d9e2ef;
  border-radius: 8px;
  padding: 10px;
  background: #ffffff;
}

.exercise-link-preview.ok {
  border-color: #86efac;
  background: #f0fdf4;
}

.exercise-link-preview.warn {
  border-color: #fcd34d;
  background: #fffbeb;
}

.exercise-link-preview.bad {
  border-color: #fca5a5;
  background: #fff1f2;
}

.exercise-link-preview-list {
  margin: 8px 0 0;
  padding-left: 1.2em;
  line-height: 1.55;
}

.exercise-link-preview-list li {
  margin: 3px 0;
}

.exercise-link-preview-warnings {
  margin-top: 8px;
  color: #92400e;
  font-weight: 700;
  line-height: 1.55;
}

.review-check-layout {
  display: grid;
  gap: 14px;
}

.review-check-layout.clean {
  gap: 10px;
}

.review-check-section {
  border: 1px solid #d9e2ef;
  border-radius: 14px;
  padding: 12px;
  background: #ffffff;
}

.review-check-section h3 {
  margin: 0 0 8px;
  font-size: 16px;
  color: #0f172a;
}

.review-check-block {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid #e2e8f0;
}

.review-check-block h4 {
  margin: 0 0 6px;
  font-size: 13px;
  color: #334155;
}

.review-check-text,
.review-check-list {
  line-height: 1.65;
  color: #111827;
}

.review-check-text {
  white-space: pre-wrap;
  word-break: break-word;
}

.review-check-list {
  margin: 0;
  padding-left: 1.2em;
}

.review-check-card {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 10px;
  margin: 10px 0;
  background: #f8fafc;
}

.part-context-review {
  display: grid;
  gap: 10px;
}

.part-context-review.display-first {
  gap: 0;
}

.part-context-review.compact {
  border-radius: 8px;
  padding: 0;
  border: 0;
  background: transparent;
}

.teacher-display-review {
  border: 1px solid #d9e2ef;
  border-radius: 10px;
  padding: 13px;
  background: #ffffff;
}

.teacher-display-review.selected-review {
  border-radius: 8px;
  padding: 12px;
}

.teacher-display-review.compact {
  margin: 10px 0;
  background: #fffdf8;
}

.teacher-display-review h3 {
  margin: 0 0 8px;
  font-size: 16px;
  color: #0f172a;
}

.teacher-display-review-body {
  display: grid;
  gap: 9px;
}

.teacher-display-review-body.structured {
  gap: 10px;
}

.teacher-display-review-body p {
  margin: 0;
  color: #1f2937;
  line-height: 1.75;
  word-break: break-word;
}

.teacher-display-review-body ul {
  margin: 0;
  padding-left: 1.2em;
  color: #1f2937;
  line-height: 1.65;
}

.teacher-review-section {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
  padding: 10px;
}

.teacher-review-section.note {
  background: #f8fafc;
}

.teacher-review-section.correct {
  border-color: #bbf7d0;
}

.teacher-review-section.incorrect {
  border-color: #fecaca;
  background: #fffafa;
}

.teacher-review-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.teacher-review-section-head h4 {
  margin: 0;
  color: #0f172a;
  font-size: 14px;
}

.teacher-review-symbol {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  height: 26px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  font-weight: 950;
}

.teacher-review-symbol.correct {
  border-color: #86efac;
  background: #f0fdf4;
  color: #15803d;
}

.teacher-review-symbol.incorrect {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.teacher-review-section-body {
  display: grid;
  gap: 8px;
}

.review-check-selected {
  display: grid;
  gap: 10px;
}

.review-check-summary {
  border: 1px solid #d9e2ef;
  border-radius: 8px;
  padding: 10px;
  background: #ffffff;
}

.review-check-duration {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  padding: 0 0 8px;
  margin-bottom: 8px;
  border-bottom: 1px solid #e2e8f0;
  color: #0f172a;
}

.review-check-duration span {
  color: #64748b;
  font-size: 12px;
  font-weight: 900;
}

.review-check-duration strong {
  font-size: 22px;
  line-height: 1;
  font-weight: 950;
  font-variant-numeric: tabular-nums;
}

.review-check-duration em {
  font-style: normal;
  color: #0f766e;
  font-size: 12px;
  font-weight: 900;
}

.review-check-duration small {
  width: 100%;
  color: #64748b;
  font-size: 12px;
  font-weight: 700;
}

.review-check-summary.good {
  border-color: #86efac;
  background: #f7fef9;
}

.review-check-summary.excellent {
  border-color: #93c5fd;
  background: #f8fbff;
}

.review-check-summary.weak {
  border-color: #fcd34d;
  background: #fffdf3;
}

.review-check-summary.bad {
  border-color: #fecaca;
  background: #fffafa;
}

.review-check-summary-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.review-check-summary-date {
  color: #0f172a;
  font-weight: 950;
  font-size: 15px;
}

.review-check-summary-target {
  color: #64748b;
  font-size: 12px;
  font-weight: 800;
  margin-top: 2px;
}

.review-check-summary-result {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #0f172a;
  font-weight: 950;
}

.review-check-summary-symbol {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  background: #ffffff;
}

.material-structured-context {
  border: 1px solid #d9e2ef;
  border-radius: 8px;
  background: #fbfdff;
  padding: 9px 10px;
}

.material-structured-context-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 7px;
}

.material-structured-context-head h3 {
  margin: 0;
  color: #0f172a;
  font-size: 13px;
  font-weight: 950;
}

.material-structured-context-head span {
  color: #64748b;
  font-size: 11px;
  font-weight: 850;
}

.material-structured-context dl {
  display: grid;
  gap: 5px;
  margin: 0;
}

.material-structured-context dl > div {
  display: grid;
  grid-template-columns: minmax(72px, auto) 1fr;
  gap: 8px;
  align-items: start;
}

.material-structured-context dt {
  color: #475569;
  font-size: 12px;
  font-weight: 950;
}

.material-structured-context dd {
  margin: 0;
  color: #0f172a;
  font-size: 13px;
  line-height: 1.55;
}

.review-part-outcome-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.review-part-outcome {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #0f172a;
  font-weight: 950;
}

.review-part-outcome b {
  font-size: 12px;
  color: #475569;
}

.review-part-outcome.correct {
  border-color: #86efac;
  background: #f0fdf4;
  color: #15803d;
}

.review-part-outcome.incorrect {
  border-color: #fecaca;
  background: #fef2f2;
  color: #b91c1c;
}

.review-part-outcome.improved {
  border-color: #fcd34d;
  background: #fffbeb;
  color: #92400e;
}

.review-part-outcome.unknown {
  border-color: #cbd5e1;
  background: #f8fafc;
  color: #475569;
}

.review-next-action-card {
  border: 1px solid #d9e2ef;
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px;
}

.review-next-action-card .progression-gpt-rec {
  margin: 0;
}

.grouped-review-flow {
  width: fit-content;
  margin: -2px 0 10px;
  padding: 4px 8px;
  border: 1px solid #fcd34d;
  border-radius: 999px;
  background: #fffbeb;
  color: #92400e;
  font-size: 12px;
  font-weight: 950;
}

.grouped-review-trajectory {
  display: inline-flex;
  align-items: center;
  padding: 3px 7px;
  border-radius: 999px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  color: #0f172a;
  font-size: 13px;
  font-weight: 950;
}

.grouped-part-review-stack {
  display: grid;
  gap: 8px;
}

.grouped-part-review {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

.grouped-part-review.correct {
  border-color: #bbf7d0;
}

.grouped-part-review.incorrect {
  border-color: #fecaca;
  background: #fff7f7;
}

.grouped-part-review-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 9px;
  background: #f8fafc;
  color: #334155;
  font-size: 12px;
  font-weight: 950;
}

.grouped-part-review.incorrect .grouped-part-review-head {
  background: #fef2f2;
  color: #991b1b;
}

.grouped-part-review.correct .grouped-part-review-head {
  background: #f0fdf4;
  color: #166534;
}

.grouped-part-review .teacher-review-section-body {
  padding: 9px 10px;
}

.review-check-details {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #ffffff;
  overflow: hidden;
}

.review-check-details summary {
  cursor: pointer;
  padding: 9px 10px;
  color: #334155;
  font-size: 13px;
  font-weight: 950;
  background: #f8fafc;
}

.review-selected-ocr {
  padding: 10px;
}

.review-selected-ocr .learner-answer-readable {
  margin: 0;
}

.review-selected-ocr-parts,
.review-selected-ocr-notes {
  margin-top: 8px;
}

.review-history-date-buttons,
.review-history-controls,
.explanation-status {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  padding: 7px 8px;
}

.review-history-date-buttons {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  flex-wrap: wrap;
  width: 100%;
}

.review-history-date-button {
  min-height: 34px;
  padding: 5px 9px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #0f172a;
  font-weight: 900;
  line-height: 1.1;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.review-history-date-button small {
  color: #64748b;
  font-size: 11px;
  font-weight: 800;
}

.review-history-date-button em {
  color: #334155;
  font-size: 12px;
  font-style: normal;
  font-weight: 950;
  white-space: nowrap;
}

.review-history-date-button b {
  color: #1e293b;
  font-size: 11px;
  font-weight: 900;
  padding: 2px 5px;
  border-radius: 999px;
  background: rgba(255,255,255,.72);
  border: 1px solid rgba(148,163,184,.45);
}

.review-history-date-button.good {
  border-color: #86efac;
  background: #f0fdf4;
}

.review-history-date-button.excellent {
  border-color: #93c5fd;
  background: #eff6ff;
}

.review-history-date-button.weak {
  border-color: #fcd34d;
  background: #fffbeb;
}

.review-history-date-button.bad {
  border-color: #fecaca;
  background: #fef2f2;
}

.review-history-date-button.active {
  border-color: #0f172a;
  box-shadow: inset 0 0 0 1px #0f172a;
}

.review-agent-badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin: -2px 0 10px;
  padding: 4px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 999px;
  background: #f8fafc;
  color: #334155;
  font-size: 12px;
  font-weight: 900;
}

.inline-badge-row .review-agent-badge {
  margin: 0;
}

.review-history-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.review-history-controls.single {
  justify-content: flex-start;
}

.review-history-controls label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: min(100%, 360px);
  color: #334155;
  font-size: 13px;
  font-weight: 900;
}

.review-history-controls select {
  max-width: min(100%, 520px);
  padding: 7px 9px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #ffffff;
  color: #0f172a;
  font-size: 13px;
}

.explanation-status {
  margin-top: 8px;
}

.part-review-card {
  border: 1px solid #d9e2ef;
  border-radius: 8px;
  padding: 12px;
  background: #ffffff;
}

.part-review-card.correct {
  border-color: #bbf7d0;
}

.part-review-card.incorrect {
  border-color: #fed7aa;
  background: #fffdf8;
}

.part-review-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.part-review-header h4 {
  margin: 0;
  font-size: 15px;
  color: #0f172a;
}

.part-answer-ocr {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px;
}

.part-answer-label {
  color: #64748b;
  font-size: 12px;
  font-weight: 900;
  margin-bottom: 4px;
}

.part-answer-line {
  color: #111827;
  font-size: 15px;
  line-height: 1.75;
  word-break: break-word;
}

.part-answer-token {
  display: inline;
}

.part-answer-token.bad,
.part-answer-missing {
  color: #b91c1c;
  font-weight: 950;
}

.part-answer-token.ok {
  color: #111827;
  font-weight: 950;
}

.part-answer-expected {
  margin-top: 4px;
  color: #475569;
  font-size: 12px;
  line-height: 1.55;
  word-break: break-word;
}

.part-answer-empty {
  color: #64748b;
  font-weight: 800;
}

.part-review-narrative {
  margin-top: 10px;
}

.part-review-narrative.teacher {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 9px 10px;
  background: #ffffff;
}

.part-review-narrative.teacher.fix {
  background: #f8fafc;
}

.part-review-narrative.teacher.check {
  background: #f0f9ff;
  border-color: #bae6fd;
}

.part-review-narrative h5,
.part-review-global h4 {
  margin: 0 0 5px;
  color: #334155;
  font-size: 13px;
}

.part-review-narrative.teacher.mistake {
  border-color: #fed7aa;
  background: #fff7ed;
}

.teacher-review-lines {
  display: grid;
  gap: 5px;
}

.teacher-review-lines p {
  margin: 0;
  color: #1f2937;
  line-height: 1.65;
  word-break: break-word;
}

.review-teacher-note {
  color: #475569;
  font-size: 13px;
  line-height: 1.6;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 8px 10px;
}

.part-review-global {
  border-top: 1px solid #e2e8f0;
  padding-top: 10px;
}

.learner-ocr-panel {
  margin-top: 12px;
  border: 1px solid #fed7aa;
  border-radius: 14px;
  padding: 12px;
  background: #fff7ed;
}

.learner-ocr-panel h3 {
  margin: 0 0 8px;
  font-size: 15px;
  color: #7c2d12;
}

.learner-ocr-card {
  border: 1px solid #fed7aa;
  border-radius: 12px;
  padding: 10px;
  background: #ffffff;
  margin-top: 8px;
}

.learner-ocr-pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px;
  margin: 8px 0;
  line-height: 1.6;
}

.learner-ocr-details {
  margin-top: 8px;
}

.learner-ocr-details summary {
  cursor: pointer;
  font-weight: 800;
  color: #7c2d12;
}

.answer-workspace-inline textarea,
.answer-workspace-inline input {
  max-width: 100%;
}

@media (max-width: 900px) {
  .study-two-pane-viewer {
    grid-template-columns: 1fr;
  }

  .study-two-left {
    position: static;
    max-height: none;
  }

  .study-two-right {
    max-height: none;
  }

  .review-check-left-stack {
    max-height: calc(100vh - 112px);
  }

  .review-check-left-stack > .study-content-card .image-stage {
    height: min(34vh, 360px);
    min-height: 210px;
  }

  .review-check-left-stack > .study-content-card .image-stage.manual-page-asset {
    height: auto;
    min-height: 0;
  }

  .progression-suggestion {
    grid-template-columns: 1fr;
  }

  .progression-queue-note {
    grid-template-columns: 1fr;
  }

  .progression-action button {
    width: 100%;
  }

  .progression-queue-action button {
    width: 100%;
  }
}


/* GPT-CODE-CHANGE: v7.19-saved-learner-answer-capture */
.saved-answer-captures {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}
.saved-answer-card pre {
  white-space: pre-wrap;
  word-break: break-word;
  line-height: 1.6;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px;
  margin: 8px 0;
}
.answer-card pre.learner-answer-readable,
.learner-ocr-card pre.learner-answer-readable,
pre.learner-answer-readable {
  white-space: pre-wrap;
  word-break: break-word;
  font-family: inherit;
  font-size: 17px;
  line-height: 1.85;
  color: #111827;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 14px;
  margin: 8px 0;
}
pre.learner-answer-left-readable {
  background: #f8fafc;
  border-color: #cbd5e1;
}
.learner-ocr-crossed {
  display: inline-block;
  margin: 0 2px;
  padding: 0 6px;
  border: 1px solid #fecaca;
  border-left: 3px solid #dc2626;
  border-radius: 8px;
  background: #f3f4f6;
  color: #6b7280;
  text-decoration: line-through;
  text-decoration-color: #dc2626;
  text-decoration-thickness: 2px;
  font-weight: 850;
}
.saved-answer-subblock {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 10px;
  padding: 10px;
  margin-top: 8px;
}
.saved-answer-subblock ul {
  margin: 6px 0 0 18px;
  padding: 0;
}
.saved-answer-subblock li {
  margin: 4px 0;
  line-height: 1.7;
  font-size: 15px;
}
@media (max-width: 900px) {
  .answer-card pre.learner-answer-readable,
  .learner-ocr-card pre.learner-answer-readable,
  pre.learner-answer-readable {
    font-size: 16px;
    line-height: 1.75;
    padding: 12px;
  }
}

/* GPT-CODE-CHANGE: v7.20-learner-answer-visual-capture */
.visual-card {
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px;
  margin: 8px 0;
  background: #fafafa;
}
.visual-head {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-bottom: 4px;
}
.visual-details {
  margin-top: 6px;
}
.visual-details summary {
  cursor: pointer;
  font-weight: 600;
}
.visual-details pre {
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 220px;
  overflow: auto;
}
.visual-audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.visual-audit-table th, .visual-audit-table td {
  border-bottom: 1px solid #e5e7eb;
  padding: 8px;
  vertical-align: top;
}
.visual-audit-table th {
  text-align: left;
  background: #f8fafc;
}

.review-route-choice-panel {
  margin-bottom: 14px;
  border-color: #cbd5e1;
}

.review-route-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.review-route-card {
  border: 1px solid #d8dee8;
  border-radius: 10px;
  padding: 14px;
  background: #ffffff;
  display: grid;
  gap: 10px;
}

.review-route-card.gpt {
  border-top: 4px solid #2563eb;
}

.review-route-card.codex {
  border-top: 4px solid #059669;
}

.review-route-head {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
}

.review-route-number {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: #0f172a;
  color: #ffffff;
  font-weight: 900;
}

.review-route-head h3 {
  margin: 0 0 4px;
  font-size: 17px;
}

.review-route-head p {
  margin: 0;
  color: #475569;
  font-size: 13px;
  line-height: 1.5;
}

.review-route-steps {
  margin: 0;
  padding-left: 22px;
  color: #334155;
  line-height: 1.65;
  font-size: 14px;
}

.review-route-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.review-route-upload .answer-upload {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 10px;
  padding: 10px;
}

.review-route-upload .answer-upload .memo {
  min-height: 58px !important;
}

.review-route-status {
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: #475569;
}

.review-route-status code {
    word-break: break-all;
  }

.codex-experiment-panel {
    margin-top: 14px;
    border: 1px solid #b8c8dc;
    border-radius: 10px;
    padding: 14px;
    background: #f8fafc;
  }

.codex-experiment-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
  }

.codex-experiment-head h3 {
    margin: 0 0 4px;
    font-size: 16px;
    color: #0f172a;
  }

.codex-experiment-head p {
    margin: 0;
    color: #475569;
    font-size: 13px;
    line-height: 1.6;
  }

.codex-experiment-badge {
    flex: 0 0 auto;
    border-radius: 999px;
    padding: 4px 8px;
    background: #e0f2fe;
    color: #075985;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
  }

.codex-experiment-warning {
    margin-top: 10px;
    border-left: 4px solid #0ea5e9;
    padding: 8px 10px;
    background: #eff6ff;
    color: #334155;
    font-size: 12px;
    line-height: 1.6;
  }

.codex-experiment-status {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-top: 10px;
  }

.codex-experiment-status div {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 8px;
    background: white;
  }

.codex-experiment-status span {
    display: block;
    color: #64748b;
    font-size: 11px;
    font-weight: 800;
  }

.codex-experiment-status b {
    display: block;
    margin-top: 2px;
    color: #0f172a;
    font-size: 13px;
    word-break: break-all;
  }

  .codex-experiment-actions {
    margin-top: 10px;
  }

  .gemini-display-review-test {
    margin-top: 12px;
    border: 1px solid #c7d2fe;
    border-radius: 10px;
    padding: 12px;
    background: #ffffff;
  }

  .gemini-display-review-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
  }

  .gemini-display-review-head h4 {
    margin: 0 0 4px;
    color: #111827;
    font-size: 15px;
  }

  .gemini-display-review-head p {
    margin: 0;
    color: #475569;
    font-size: 12px;
    line-height: 1.6;
  }

  .gemini-display-review-head span {
    flex: 0 0 auto;
    border-radius: 999px;
    padding: 4px 8px;
    background: #eef2ff;
    color: #3730a3;
    font-size: 11px;
    font-weight: 900;
    text-transform: uppercase;
  }

  .gemini-display-review-textarea {
    margin-top: 10px;
    min-height: 170px;
  }

  .gemini-display-review-preview {
    margin-top: 10px;
  }

  .codex-experiment-details {
    margin-top: 10px;
    color: #334155;
    font-size: 12px;
  }

  .review-dispute-overlay {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: flex;
    align-items: flex-start;
    justify-content: flex-end;
    padding: 88px 16px 16px;
    background: transparent;
    pointer-events: none;
  }

  .review-dispute-dialog {
    width: min(520px, calc(100vw - 28px));
    max-height: min(720px, calc(100vh - 104px));
    overflow: auto;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    background: #fff;
    box-shadow: 0 18px 52px rgba(15, 23, 42, .22);
    pointer-events: auto;
  }

  .answer-workspace-inline .review-dispute-dialog.inline,
  .answer-workspace-inline .review-pending-dialog.inline {
    width: 100%;
    max-height: none;
    border-radius: 10px;
    box-shadow: none;
  }

  .answer-create-inline-status {
    margin: 10px 0 14px;
  }

  .review-result-overlay {
    position: fixed;
    inset: 0;
    z-index: 90;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(15, 23, 42, .28);
  }

  .review-result-dialog {
    width: min(520px, calc(100vw - 28px));
    max-height: calc(100vh - 40px);
    overflow: auto;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 22px 70px rgba(15, 23, 42, .28);
  }

  .review-result-dialog.ok {
    border-color: #86efac;
  }

  .review-result-dialog.warn {
    border-color: #fdba74;
  }

  .review-dispute-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px 12px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
  }

  .review-dispute-head h3 {
    margin: 0 0 5px;
    color: #0f172a;
    font-size: 18px;
  }

  .review-dispute-head p {
    margin: 0;
    color: #475569;
    font-size: 13px;
    line-height: 1.6;
  }

  .review-dispute-summary {
    padding: 14px 18px;
    border-bottom: 1px solid #e2e8f0;
  }

  .review-dispute-partmarks {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 10px;
    font-size: 18px;
    font-weight: 900;
    color: #0f172a;
  }

  .review-dispute-partmarks span {
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 5px 9px;
    background: #fff;
  }

  .review-dispute-wrong {
    display: grid;
    gap: 6px;
    margin-bottom: 10px;
    border-left: 4px solid #f97316;
    padding: 8px 10px;
    background: #fff7ed;
    color: #7c2d12;
    font-size: 14px;
  }

  .review-dispute-wrong ul {
    margin: 0;
    padding-left: 18px;
    line-height: 1.55;
  }

  .review-dispute-parts {
    margin: 10px 0 0;
    padding-left: 20px;
    display: grid;
    gap: 8px;
  }

  .review-dispute-details {
    margin: 8px 0;
    color: #334155;
    font-size: 13px;
  }

  .review-dispute-details summary {
    cursor: pointer;
    font-weight: 800;
  }

  .review-dispute-parts li {
    line-height: 1.5;
    color: #334155;
  }

  .review-dispute-parts span {
    display: inline-block;
    margin-left: 6px;
    border-radius: 999px;
    padding: 1px 7px;
    background: #fee2e2;
    color: #991b1b;
    font-size: 12px;
    font-weight: 800;
  }

  .review-dispute-parts small {
    display: block;
    color: #64748b;
    font-size: 12px;
  }

  .review-dispute-calc {
    margin-top: 10px;
    border-left: 4px solid #dc2626;
    padding: 8px 10px;
    background: #fef2f2;
    color: #7f1d1d;
    font-size: 13px;
  }

  .review-dispute-choice-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px 18px 0;
  }

  .review-dispute-choice-row .selected {
    outline: 3px solid rgba(37, 99, 235, .22);
  }

  .review-dispute-resubmit {
    min-height: 52px;
    border-radius: 18px;
    background: #0f766e;
    padding: 14px 16px;
  }

  .review-dispute-resubmit.secondary,
  .file-button.external-camera {
    background: #334155;
  }

  .review-dispute-resubmit-panel {
    padding: 12px 18px 0;
  }

  .review-dispute-form {
    display: grid;
    gap: 10px;
    padding: 14px 18px 18px;
  }

  .review-dispute-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .review-dispute-form label {
    display: grid;
    gap: 5px;
    color: #334155;
    font-size: 13px;
    font-weight: 700;
  }

  .review-dispute-form select,
  .review-dispute-textarea {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    padding: 8px 10px;
    background: #fff;
    color: #0f172a;
    font: inherit;
  }

  .review-dispute-textarea {
    min-height: 110px;
    resize: vertical;
    line-height: 1.55;
  }

  .review-dispute-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    align-items: center;
  }

  .review-result-actions {
    padding: 14px 18px 18px;
  }

  .review-dispute-status {
    border: 1px solid #bfdbfe;
    border-radius: 8px;
    padding: 8px 10px;
    background: #eff6ff;
    color: #1e3a8a;
    font-size: 13px;
  }

  .review-pending-dialog {
    width: min(480px, calc(100vw - 28px));
  }

  .review-pending-body {
    display: grid;
    grid-template-columns: 42px 1fr;
    gap: 12px;
    align-items: center;
    padding: 18px;
    border-bottom: 1px solid #e2e8f0;
    color: #0f172a;
  }

  .review-pending-body p {
    margin: 4px 0;
    color: #475569;
    font-size: 13px;
  }

  .review-pending-body small {
    display: block;
    margin-top: 3px;
    color: #64748b;
    font-size: 12px;
    word-break: break-all;
  }

  .review-pending-spinner {
    width: 32px;
    height: 32px;
    border: 4px solid #dbeafe;
    border-top-color: #2563eb;
    border-radius: 999px;
    animation: review-pending-spin 1s linear infinite;
  }

  @keyframes review-pending-spin {
    to { transform: rotate(360deg); }
  }

.codex-experiment-details ol {
    margin: 8px 0 0 20px;
    padding: 0;
    line-height: 1.7;
  }
  
@media (max-width: 900px) {
  .review-route-grid {
      grid-template-columns: 1fr;
    }

  .codex-experiment-status {
      grid-template-columns: 1fr;
  }
  
  .review-dispute-overlay {
    align-items: flex-end;
    justify-content: center;
    padding: 12px 12px 76px;
  }

  .review-dispute-dialog,
  .review-pending-dialog {
    width: 100%;
    max-height: min(58vh, 560px);
    border-radius: 14px;
  }

  .top-hero-panel,
  .pace-panel-head {
    display: grid;
  }
  .top-metrics,
  .top-action-grid,
  .top-workload-grid,
  .top-study-time-grid,
  .pace-type-breakdown,
  .pace-detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .pacemaker-chapter-row {
    grid-template-columns: 1fr;
  }
  .progress-title-row,
  .progress-toolbar {
    display: grid;
  }
  .progress-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .progress-row {
    grid-template-columns: 1fr;
  }
  .progress-row-main {
    grid-template-columns: 1fr auto;
  }
}
