* {
  box-sizing: border-box;
}

:root {
  --bg: #eef3f4;
  --surface: #ffffff;
  --surface-soft: #f7faf9;
  --text: #1f2a2e;
  --muted: #5e6d73;
  --border: #cfdcdd;
  --primary: #0f6b6e;
  --primary-dark: #0a4f52;
  --accent: #b25524;
  --accent-soft: #fff2ea;
  --focus: #213f99;
  --danger: #b03a2e;
  --shadow: 0 12px 28px rgba(31, 42, 46, 0.08);
}

body {
  font-family: Arial, sans-serif;
  background: var(--bg);
  margin: 0;
  color: var(--text);
  font-size: 16px;
  line-height: 1.55;
}

.app-shell {
  max-width: 1120px;
  margin: 0 auto;
  padding: 24px 18px 48px;
}

.app-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.app-footer {
  align-items: center;
  border-top: 1px solid var(--border);
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  margin: 28px auto 0;
  max-width: 860px;
  padding-top: 18px;
}

.app-footer a {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
}

.app-footer a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.app-title-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.access-badge {
  background: #eef7f2;
  border: 1px solid #b9d8ca;
  border-radius: 999px;
  color: #245c49;
  display: inline-flex;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  padding: 7px 10px;
  white-space: nowrap;
}

.eyebrow {
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  margin: 0 0 4px;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  overflow-wrap: anywhere;
}

h1 {
  font-size: 34px;
  line-height: 1.1;
  margin: 0;
}

h2 {
  font-size: 20px;
  line-height: 1.25;
  margin: 0;
}

h3 {
  font-size: 15px;
  margin: 0 0 12px;
}

.subtitle {
  color: var(--muted);
  font-size: 15px;
  margin: 8px 0 0;
}

.training-disclaimer {
  background: #fffaf6;
  border: 1px solid #efcfba;
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  color: #4c3930;
  font-size: 13px;
  line-height: 1.5;
  margin: 0 auto 14px;
  max-width: 860px;
  padding: 10px 12px;
}

.training-disclaimer {
  max-width: none;
}

.training-disclaimer strong {
  color: var(--accent);
}

.body-copy,
.step-note {
  color: var(--muted);
  font-size: 14px;
  margin: 0 0 14px;
}

.mode-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin: 18px auto 14px;
  max-width: 860px;
}

button {
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  min-height: 42px;
  padding: 10px 14px;
}

.button-link {
  align-items: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  display: inline-flex;
  justify-content: center;
  min-height: 42px;
  padding: 10px 14px;
  text-decoration: none;
}

button:hover {
  border-color: var(--primary);
}

.button-link:hover {
  border-color: var(--primary);
}

button:disabled {
  cursor: default;
  opacity: 0.78;
}

button:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(33, 63, 153, 0.22);
  outline-offset: 2px;
}

.mode-tab {
  font-weight: 700;
}

.mode-tab.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.primary-action {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 700;
}

.primary-action:hover {
  background: var(--primary-dark);
  border-color: var(--primary-dark);
}

.secondary-action {
  background: var(--surface);
  color: var(--primary);
  font-weight: 700;
}

.context-panel,
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.context-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 0 auto 16px;
  max-width: 980px;
  padding: 16px;
}

.panel {
  padding: 20px;
}

.panel-heading {
  margin-bottom: 16px;
}

.compact-heading {
  margin-bottom: 12px;
}

.mode-panel {
  display: none;
}

.mode-panel.active {
  display: block;
}

.ask-flow {
  display: grid;
  gap: 16px;
  margin: 0 auto;
  max-width: 860px;
}

.clinical-reasoning-panel {
  scroll-margin-top: 16px;
}

.question-entry {
  margin-bottom: 18px;
}

.reasoning-output {
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.section-heading {
  margin-bottom: 10px;
}

.followup-panel,
.feedback-panel {
  margin: 16px auto 0;
  max-width: 860px;
}

label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 6px;
}

.field-hint {
  color: var(--muted);
  font-size: 13px;
  margin: -2px 0 8px;
}

.spaced-label {
  margin-top: 18px;
}

select,
textarea,
input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font: inherit;
}

select,
input {
  background: #fff;
  min-height: 42px;
  padding: 9px 10px;
}

textarea {
  min-height: 170px;
  padding: 12px;
  resize: vertical;
}

.input-textarea {
  min-height: 155px;
}

.short-textarea {
  min-height: 92px;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
}

.answer-cards {
  display: grid;
  gap: 10px;
  min-height: 140px;
}

.answer-cards.empty-state {
  align-items: center;
  background: var(--surface-soft);
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  padding: 18px;
}

.answer-card {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  padding: 14px;
}

.answer-card h3 {
  background: #e6f3f2;
  border: 1px solid #c4dddd;
  border-radius: 999px;
  color: var(--primary-dark);
  display: inline-flex;
  font-size: 14px;
  letter-spacing: 0;
  margin: 0 0 9px;
  padding: 4px 9px;
  text-transform: uppercase;
}

.answer-card p {
  margin: 0;
  white-space: pre-wrap;
}

.answer-card.fallback {
  border-left-color: var(--accent);
}

.learning-thread {
  display: grid;
  gap: 12px;
}

.learning-thread.empty-state {
  align-items: center;
  background: var(--surface-soft);
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  min-height: 96px;
  padding: 18px;
}

.thread-item {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px;
  scroll-margin-top: 18px;
}

.thread-item.student {
  background: #fff;
  border-left: 4px solid var(--accent);
}

.thread-item.tutor {
  border-left: 4px solid var(--primary);
}

.thread-item.error {
  border-left-color: var(--danger);
}

.thread-item-meta {
  align-items: center;
  color: var(--muted);
  display: flex;
  font-size: 12px;
  font-weight: 700;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.thread-item-meta time {
  flex: 0 0 auto;
  font-weight: 400;
  text-transform: none;
}

.thread-item p {
  margin: 0;
  white-space: pre-wrap;
}

.thread-section-list {
  display: grid;
  gap: 10px;
}

.thread-section {
  background: #fff;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  padding: 10px 12px;
}

.thread-section h3 {
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 800;
  margin: 0 0 6px;
  text-transform: uppercase;
}

.thread-section p {
  margin: 0;
}

.thread-visual-aid {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 14px;
  padding: 12px;
}

.visual-aid-heading {
  margin-bottom: 10px;
}

.visual-aid-heading span {
  color: var(--accent);
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.visual-aid-heading h3 {
  font-size: 15px;
  margin: 2px 0 0;
}

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

.waveform-card {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
}

.waveform-card-title {
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 6px;
}

.waveform-card svg {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
  display: block;
  height: auto;
  width: 100%;
}

.waveform-grid {
  fill: none;
  opacity: 0.34;
  stroke: var(--border);
  stroke-width: 1;
}

.waveform-baseline {
  fill: none;
  opacity: 0.55;
  stroke: var(--muted);
  stroke-dasharray: 4 5;
  stroke-width: 1.4;
}

.waveform-line {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 5;
}

.waveform-line.normal {
  stroke: var(--primary);
}

.waveform-line.peaked {
  stroke: var(--accent);
}

.waveform-card p,
.visual-aid-caption,
.visual-aid-note {
  font-size: 13px;
}

.waveform-card p {
  color: var(--muted);
  margin: 8px 0 0;
}

.visual-aid-caption {
  margin: 10px 0 0;
}

.visual-aid-note {
  color: var(--muted);
  margin: 6px 0 0;
}

.answer-related-links {
  margin-top: 12px;
}

.related-links {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 14px;
  padding: 0;
}

.related-links summary {
  align-items: center;
  cursor: pointer;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  min-height: 42px;
  padding: 10px 12px;
}

.related-links summary::marker {
  color: var(--primary);
}

.related-links summary span {
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.related-links summary small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}

.related-links-note,
.related-look-for,
.related-link-list,
.related-search-phrase {
  margin: 0 12px 12px;
}

.related-links-note {
  color: var(--muted);
  font-size: 13px;
  padding-top: 2px;
}

.related-look-for {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}

.related-look-for h3 {
  color: var(--text);
  font-size: 13px;
  margin: 0 0 8px;
}

.related-look-for ul,
.related-link-list {
  padding-left: 18px;
}

.related-look-for li,
.related-link-list li {
  font-size: 13px;
  margin: 6px 0;
}

.related-link-list a {
  color: var(--primary);
  font-weight: 800;
}

.related-link-list span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 2px;
}

.related-search-phrase {
  align-items: center;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 12px;
}

.related-search-phrase span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.related-search-phrase code {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  flex: 1 1 220px;
  font-family: Arial, sans-serif;
  font-size: 13px;
  overflow-wrap: anywhere;
  padding: 7px 9px;
}

.related-search-phrase button {
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  min-height: 34px;
  padding: 7px 11px;
}

.thread-next-steps {
  align-items: center;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
}

.thread-next-steps span {
  color: var(--muted);
  flex: 0 0 auto;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.thread-next-steps button {
  background: #fff;
  color: var(--primary);
  font-size: 13px;
  font-weight: 700;
  min-height: 34px;
  padding: 7px 11px;
}

.thread-actions {
  align-items: center;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
}

.training-boundary-inline {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
  flex: 1 1 170px;
  font-size: 12px;
  font-weight: 800;
  gap: 8px;
  justify-content: flex-end;
  min-height: 34px;
}

.training-boundary-inline button {
  background: transparent;
  border: 0;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  min-height: 0;
  padding: 0;
  text-decoration: underline;
}

.thread-composer-anchor {
  scroll-margin-bottom: 24px;
}

.loading-card {
  animation: pulse 1.4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.62;
  }
}

.raw-output {
  margin-top: 12px;
}

.raw-output summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.raw-output textarea {
  margin-top: 8px;
  min-height: 160px;
}

.save-btn-row {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
}

.save-explanation-btn {
  min-height: 34px;
  padding: 7px 12px;
}

.save-explanation-btn.saved {
  border-color: #2a7a2a;
  color: #2a7a2a;
}

.followup-toolbar,
.placeholder-list,
.feedback-option-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.followup-toolbar {
  border-top: 1px solid var(--border);
  margin-top: 16px;
  padding-top: 14px;
}

.practice-flow {
  display: grid;
  gap: 16px;
  margin: 0 auto;
  max-width: 860px;
}

.practice-config-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(0, 1fr);
}

.practice-topic-field label {
  font-size: 15px;
}

.practice-topic-textarea {
  background: #fff;
  min-height: 118px;
}

.practice-output {
  display: grid;
  gap: 12px;
  min-height: 150px;
}

.practice-output.empty-state {
  align-items: start;
  background: var(--surface-soft);
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  padding: 18px;
}

.practice-card {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  padding: 14px;
}

.practice-card.error {
  border-left-color: var(--danger);
}

.practice-card-header {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.practice-card-header span {
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.practice-card-header small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}

.practice-stem {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 14px;
}

.practice-case-frame {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  margin: 0 0 14px;
}

.practice-case-frame div {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}

.practice-case-frame dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  margin: 0 0 3px;
  text-transform: uppercase;
}

.practice-case-frame dd {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.35;
  margin: 0;
}

.practice-scenario-block,
.practice-scenario-task,
.practice-cue-list {
  display: grid;
  gap: 6px;
}

.practice-scenario-block h3,
.practice-scenario-task h3,
.practice-cue-list h3 {
  color: var(--primary-dark);
  font-size: 13px;
  margin: 0;
  text-transform: uppercase;
}

.practice-scenario-block p,
.practice-scenario-task p {
  font-size: 15px;
  line-height: 1.6;
  margin: 0;
}

.practice-cue-list {
  border-top: 1px solid var(--border);
  margin-top: 14px;
  padding-top: 14px;
}

.practice-cue-list ul {
  margin: 0;
  padding-left: 18px;
}

.practice-cue-list li {
  font-size: 14px;
  line-height: 1.5;
  margin: 3px 0;
}

.practice-scenario-task {
  border-top: 1px solid var(--border);
  margin-top: 14px;
  padding-top: 14px;
}

.practice-reasoning-panel {
  background: #fff;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  margin-top: 14px;
  padding: 14px;
}

.practice-reasoning-panel label {
  color: var(--primary-dark);
  font-weight: 800;
}

.practice-feedback-output {
  margin-top: 14px;
}

.practice-feedback {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  display: grid;
  gap: 12px;
  padding: 14px;
}

.practice-student-answer,
.practice-feedback-summary {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}

.practice-student-answer h3,
.practice-feedback-summary h3,
.practice-feedback-grid h3 {
  color: var(--primary-dark);
  font-size: 13px;
  margin: 0 0 6px;
}

.practice-student-answer p,
.practice-feedback-summary p,
.practice-feedback-grid p {
  font-size: 14px;
  line-height: 1.55;
  margin: 0;
}

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

.practice-feedback-grid article {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}

.practice-feedback-grid ul {
  margin: 0;
  padding-left: 18px;
}

.practice-feedback-grid li {
  font-size: 14px;
  line-height: 1.55;
  margin: 4px 0;
}

.practice-choice-list {
  display: grid;
  gap: 8px;
}

.practice-choice-btn {
  align-items: flex-start;
  background: #fff;
  display: grid;
  gap: 10px;
  grid-template-columns: 34px minmax(0, 1fr);
  min-height: 54px;
  padding: 10px;
  text-align: left;
  width: 100%;
}

.practice-choice-btn span {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  display: inline-flex;
  font-weight: 800;
  height: 30px;
  justify-content: center;
  width: 30px;
}

.practice-choice-btn strong {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
}

.practice-choice-btn.selected,
.practice-choice-btn.correct,
.practice-choice-btn.incorrect {
  font-weight: 700;
}

.practice-choice-btn.correct {
  border-color: #2a7a2a;
}

.practice-choice-btn.correct span {
  background: #e8f6e8;
  border-color: #2a7a2a;
  color: #2a7a2a;
}

.practice-choice-btn.incorrect {
  border-color: var(--danger);
}

.practice-choice-btn.incorrect span {
  background: #fff0ee;
  border-color: var(--danger);
  color: var(--danger);
}

.practice-rationale {
  border-top: 1px solid var(--border);
  margin-top: 14px;
  padding-top: 14px;
}

.practice-result {
  background: #fff;
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  padding: 12px;
}

.practice-rationale.incorrect .practice-result {
  border-left-color: var(--danger);
}

.practice-result h3,
.practice-missed-concept h3 {
  font-size: 14px;
  margin: 0 0 8px;
}

.practice-result p,
.practice-missed-concept p {
  margin: 5px 0 0;
}

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

.practice-rationale-grid article,
.practice-missed-concept {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
}

.practice-rationale-grid h3 {
  color: var(--primary-dark);
  font-size: 13px;
  margin: 0 0 6px;
}

.practice-rationale-grid p {
  font-size: 13px;
  margin: 0;
}

.practice-missed-concept {
  margin-top: 10px;
}

.practice-actions {
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
}

.test-flow {
  display: grid;
  gap: 16px;
  margin: 0 auto;
  max-width: 860px;
}

.test-output {
  display: grid;
  gap: 12px;
  min-height: 150px;
}

.test-output.empty-state {
  align-items: start;
  background: var(--surface-soft);
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  padding: 18px;
}

.test-card,
.test-set,
.test-question-card {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  padding: 14px;
}

.test-card.error,
.test-question-card.incorrect {
  border-left-color: var(--danger);
}

.test-question-card.correct {
  border-left-color: #2a7a2a;
}

.test-set {
  display: grid;
  gap: 12px;
}

.test-set-header {
  align-items: start;
  border-bottom: 1px solid var(--border);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding-bottom: 12px;
}

.test-set-header h3 {
  font-size: 18px;
  margin: 0;
}

.test-set-header p {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  margin: 4px 0 0;
}

.test-status-pill,
.test-score-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--primary-dark);
  flex: 0 0 auto;
  font-size: 12px;
  font-weight: 800;
  padding: 7px 10px;
  text-align: center;
}

.test-score-card {
  display: grid;
  min-width: 82px;
}

.test-score-card strong {
  font-size: 18px;
  line-height: 1.1;
}

.test-score-card span {
  color: var(--muted);
}

.test-question-heading {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: space-between;
  margin-bottom: 10px;
}

.test-question-heading span {
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.test-question-heading small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}

.test-question-stem {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.55;
  margin: 0 0 12px;
}

.test-choice-list {
  display: grid;
  gap: 8px;
}

.test-choice-btn {
  align-items: flex-start;
  background: #fff;
  display: grid;
  gap: 10px;
  grid-template-columns: 34px minmax(0, 1fr);
  min-height: 54px;
  padding: 10px;
  text-align: left;
  width: 100%;
}

.test-choice-btn span {
  align-items: center;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  display: inline-flex;
  font-weight: 800;
  height: 30px;
  justify-content: center;
  width: 30px;
}

.test-choice-btn strong {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.45;
}

.test-choice-btn.selected {
  border-color: var(--primary);
  color: var(--primary-dark);
  font-weight: 800;
}

.test-choice-btn.correct {
  border-color: #2a7a2a;
}

.test-choice-btn.correct span {
  background: #e8f6e8;
  border-color: #2a7a2a;
  color: #2a7a2a;
}

.test-choice-btn.incorrect {
  border-color: var(--danger);
}

.test-choice-btn.incorrect span {
  background: #fff0ee;
  border-color: var(--danger);
  color: var(--danger);
}

.test-choice-btn:disabled {
  cursor: default;
  opacity: 1;
}

.test-rationale {
  border-top: 1px solid var(--border);
  margin-top: 14px;
  padding-top: 14px;
}

.continue-learning {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-top: 16px;
  padding: 16px;
}

.segmented-control {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.segment-btn {
  background: #fff;
  font-weight: 700;
}

.segment-btn.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}

.thinking-preview {
  background: #fff;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  color: var(--text);
  font-size: 13px;
  margin-top: 10px;
  padding: 10px 12px;
}

.thinking-preview.empty-preview {
  border-left-color: var(--border);
  color: var(--muted);
}

.chip-btn,
.feedback-option-btn,
.placeholder-list span {
  border-radius: 999px;
  font-size: 13px;
  min-height: 34px;
  padding: 7px 12px;
}

.chip-btn {
  background: #fff;
}

.placeholder-list span {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
}

.notebook-search-panel {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 14px;
  padding: 12px;
}

.notebook-search-row {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(180px, 1fr) auto auto;
}

.notebook-toolbar {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 14px;
}

.notebook-heading-row {
  align-items: start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.notebook-storage-note {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
  margin: 0 0 14px;
  padding: 10px 12px;
}

.notebook-summary {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 10px;
}

.notebook-layout {
  display: grid;
  gap: 14px;
  grid-template-columns: minmax(240px, 0.42fr) minmax(0, 1fr);
}

.notebook-list,
.notebook-detail {
  min-height: 280px;
}

.notebook-list {
  display: grid;
  gap: 8px;
  align-content: start;
}

.notebook-list-item {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-left: 4px solid transparent;
  border-radius: 8px;
  display: grid;
  gap: 4px;
  min-height: 0;
  padding: 10px 12px;
  text-align: left;
  width: 100%;
}

.notebook-list-item.selected {
  background: #fff;
  border-left-color: var(--primary);
}

.notebook-item-title {
  color: var(--text);
  font-weight: 800;
}

.notebook-item-meta,
.notebook-preview,
.notebook-tags {
  color: var(--muted);
  font-size: 12px;
}

.notebook-tags {
  font-weight: 700;
}

.notebook-preview {
  line-height: 1.4;
}

.notebook-review-flag {
  background: var(--accent-soft);
  border: 1px solid #f0cfbd;
  border-radius: 999px;
  color: var(--accent);
  display: inline-flex;
  font-size: 11px;
  font-weight: 800;
  justify-self: start;
  padding: 3px 8px;
}

.notebook-empty {
  align-items: center;
  background: var(--surface-soft);
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  display: flex;
  min-height: 160px;
  padding: 18px;
}

.notebook-note {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}

.notebook-note-heading {
  align-items: start;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  margin-bottom: 12px;
}

.notebook-note-heading h3 {
  font-size: 18px;
  margin: 0;
}

.notebook-note-meta {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin: 0 0 14px;
}

.notebook-note-meta div {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}

.notebook-note-meta dt {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.notebook-note-meta dd {
  margin: 2px 0 0;
}

.notebook-note-body {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: Arial, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  margin: 0;
  max-height: 520px;
  overflow: auto;
  padding: 12px;
  white-space: pre-wrap;
}

.notebook-input {
  margin-bottom: 12px;
}

.notebook-topic-textarea {
  margin-bottom: 12px;
  min-height: 72px;
}

.notebook-check {
  align-items: center;
  display: flex;
  gap: 8px;
  margin: 2px 0 12px;
}

.notebook-check input {
  min-height: auto;
  width: auto;
}

.notebook-section-picker {
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  padding: 12px;
}

.notebook-section-picker .body-copy {
  margin-bottom: 2px;
}

.notebook-section-choice {
  align-items: center;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  gap: 8px;
  margin: 0;
  padding: 8px 10px;
}

.notebook-section-choice input {
  min-height: auto;
  width: auto;
}

.notebook-section-choice span {
  font-size: 13px;
  font-weight: 800;
}

.notebook-note-textarea {
  min-height: 180px;
}

.notebook-modal-card {
  max-height: calc(100vh - 36px);
  max-width: 720px;
  overflow: auto;
}

.notebook-modal-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.guide-shell {
  max-width: 920px;
}

.guide-panel {
  margin: 16px auto 0;
}

.guide-list {
  margin: 0;
  padding-left: 20px;
}

.guide-list li {
  margin: 8px 0;
}

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

.feedback-panel-question {
  font-size: 14px;
  font-weight: 700;
  margin: 18px 0 8px;
}

.feedback-option-btn.selected {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--accent);
  font-weight: 700;
}

.feedback-log {
  margin-top: 18px;
}

.feedback-log-entry {
  background: var(--surface-soft);
  border-top: 1px solid var(--border);
  font-size: 13px;
  line-height: 1.55;
  margin-top: 10px;
  padding: 10px 12px;
}

.feedback-log-time {
  color: var(--muted);
  font-size: 11px;
  margin-bottom: 4px;
}

.dev-toggle-row {
  margin: 18px 0 0;
  text-align: center;
}

.dev-toggle-row button {
  color: var(--muted);
  font-size: 12px;
  min-height: 34px;
  padding: 6px 12px;
}

.dev-container {
  margin-top: 18px;
}

.mode-header,
.dev-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.dev-section {
  background: #f3f5f5;
  border-style: dashed;
  margin-top: 12px;
}

#limitModal,
#trainingUseModal,
#notebookModal {
  display: none;
  height: 100%;
  left: 0;
  position: fixed;
  top: 0;
  width: 100%;
  z-index: 1000;
}

.modal-overlay {
  align-items: flex-start;
  background: rgba(31, 42, 46, 0.55);
  display: flex;
  height: 100%;
  justify-content: center;
  overflow: auto;
  padding: 18px;
  width: 100%;
}

.modal-card {
  background: white;
  border-radius: 8px;
  box-shadow: 0 18px 42px rgba(31, 42, 46, 0.24);
  max-width: 430px;
  padding: 26px;
  width: 100%;
}

.training-ack-card {
  max-width: 560px;
}

.modal-message {
  font-size: 15px;
  margin: 0 0 20px;
}

.training-ack-copy {
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  margin: 0 0 16px;
}

.training-ack-check {
  align-items: flex-start;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: 8px;
  display: flex;
  gap: 10px;
  margin: 0 0 16px;
  padding: 12px;
}

.training-ack-check input {
  flex: 0 0 auto;
  margin-top: 3px;
  min-height: auto;
  width: auto;
}

.training-ack-check span {
  font-size: 14px;
  font-weight: 700;
}

.modal-buttons {
  display: grid;
  gap: 10px;
}

.reset-btn {
  border-color: var(--danger);
  color: var(--danger);
}

@media (max-width: 820px) {
  .app-header {
    align-items: stretch;
    flex-direction: column;
  }

  .context-panel {
    grid-template-columns: 1fr;
  }

  .practice-config-grid {
    grid-template-columns: 1fr;
  }

  .notebook-toolbar,
  .notebook-search-row,
  .notebook-layout,
  .notebook-note-meta,
  .guide-example-grid {
    grid-template-columns: 1fr;
  }

  .mode-tabs {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 560px) {
  .app-shell {
    padding: 18px 12px 36px;
  }

  h1 {
    font-size: 28px;
  }

  .panel,
  .context-panel {
    padding: 14px;
  }

  button,
  .action-row button,
  .save-btn-row button {
    width: 100%;
  }

  .training-boundary-inline {
    flex: 1 1 100%;
    justify-content: center;
  }

  .test-set-header {
    align-items: stretch;
    flex-direction: column;
  }

  .test-score-card,
  .test-status-pill {
    width: 100%;
  }

  .waveform-comparison {
    grid-template-columns: 1fr;
  }

  .practice-rationale-grid {
    grid-template-columns: 1fr;
  }

  .practice-feedback-grid {
    grid-template-columns: 1fr;
  }

  .save-btn-row {
    justify-content: stretch;
  }

  .modal-overlay {
    padding: 10px;
  }

  .modal-card {
    padding: 16px;
  }

  .notebook-modal-card {
    max-height: calc(100vh - 20px);
  }

  .notebook-note-textarea {
    min-height: 150px;
  }
}
