@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:ital,wght@0,300;0,400;0,500;0,600;0,700;0,800;1,400&family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

/* Universal Typography Reset for Vietnamese Diacritics & Academic Layout */
.brainstorm-matrix-wrap,
.brainstorm-matrix-table,
.peer-step-card,
.peer-step-label,
.peer-step-question-box,
.peer-step-question-title,
.peer-step-question-text,
.peer-step-guidance-box,
.peer-keyword-row,
.peer-keyword-label,
.peer-keyword-tag,
.peer-starter-chip,
.peer-model-check,
.peer-model-text,
.peer-steps-grid,
.peer-collocs-footer,
.peer-coaching-intro,
.btn-peer-copy-full,
.matrix-legend-bar,
.idea-scaffold-wrap,
.practice-outline-content {
  font-family: 'Be Vietnam Pro', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif !important;
}

/**
 * IELTS Writing Hub - 5x5 Brainstorming Matrix & P-E-E-R Development Stylesheet
 * File: Writing-Hub/css/writing-matrix.css
 * 
 * Features:
 * - 5x5 Brainstorming Factor-by-Level Matrix Table
 * - Adaptive Dark & Light Cell Tokens with Level Gradients & Contrast-Safe Typography
 * - Active Selection Ring with Pulsing Indicator
 * - 4-Stage P-E-E-R Development Panel (Point, Explanation, Example, Result)
 * - Interactive Cell Detail Modal (#matrixCellDetailModal)
 * - Text-to-Speech & Collocation Chips
 */

/* Responsive Modal Container Expansion for Matrix Mode */
.idea-modal-container.matrix-mode-active {
  max-width: min(96vw, 1200px);
}

/* 5x5 Brainstorming Matrix Table (Sample File Aesthetic) */
.brainstorm-matrix-wrap {
  width: 100%;
  overflow-x: auto;
  margin-top: 0.5rem;
  padding-bottom: 0.5rem;
}
.matrix-legend-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  font-size: 0.76rem;
}
:root[data-theme="light"] .matrix-legend-bar, html:not(.dark) .matrix-legend-bar {
  background: #f8fafc;
  border-color: #e2e8f0;
}
.matrix-legend-hint {
  color: #64748b;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}
.matrix-legend-items {
  display: flex;
  align-items: center;
  gap: 12px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 0.74rem;
  font-weight: 600;
  color: #64748b;
}
.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.legend-dot.key-idea { background: #f59e0b; }
.legend-dot.body-1 { background: #f43f5e; }
.legend-dot.body-2 { background: #10b981; }
.legend-dot.extension { background: #0284c7; }
/* Semantic Legend Dots */
.legend-dot.badge-agree,
.legend-dot.badge-advantage,
.legend-dot.badge-positive,
.legend-dot.badge-solution { background: #10b981; }
.legend-dot.badge-disagree,
.legend-dot.badge-disadvantage,
.legend-dot.badge-negative { background: #f43f5e; }
.legend-dot.badge-cause { background: #f97316; }
.legend-dot.badge-view1,
.legend-dot.badge-q1 { background: #0284c7; }
.legend-dot.badge-view2,
.legend-dot.badge-q2 { background: #8b5cf6; }
.legend-dot.badge-nuance,
.legend-dot.badge-extension { background: #6366f1; }

.brainstorm-matrix-table {
  width: 100%;
  min-width: 820px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.82rem;
  background: rgba(15, 23, 42, 0.8);
  color: #f1f5f9;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(8px);
}
:root[data-theme="light"] .brainstorm-matrix-table,
html:not(.dark) .brainstorm-matrix-table {
  background: #ffffff;
  color: #0f172a;
  border: 1.5px solid #cbd5e1;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}
.brainstorm-matrix-table th,
.brainstorm-matrix-table td {
  border: 1px solid rgba(255, 255, 255, 0.07);
  padding: 10px 12px;
  vertical-align: top;
}
:root[data-theme="light"] .brainstorm-matrix-table th,
:root[data-theme="light"] .brainstorm-matrix-table td,
html:not(.dark) .brainstorm-matrix-table th,
html:not(.dark) .brainstorm-matrix-table td {
  border: 1px solid #e2e8f0;
}
.brainstorm-matrix-table thead tr {
  background: #090d16;
  color: #f8fafc;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.brainstorm-matrix-table thead th {
  padding: 12px 10px;
  font-weight: 700;
  text-align: left;
  border-bottom: 2px solid rgba(255, 255, 255, 0.12);
}
:root[data-theme="light"] .brainstorm-matrix-table thead th,
html:not(.dark) .brainstorm-matrix-table thead th {
  border-bottom-color: #0f172a;
}
.brainstorm-matrix-table thead th.corner-cell {
  background: #050811;
  width: 16%;
  color: #94a3b8;
}
.brainstorm-matrix-table thead th.th-health {
  background: #4c0519; /* Rose-950 */
  color: #fecdd3;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
}
.brainstorm-matrix-table thead th.th-edu {
  background: #172554; /* Blue-950 */
  color: #bfdbfe;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
}
.brainstorm-matrix-table thead th.th-work {
  background: #1e1b4b; /* Indigo-950 */
  color: #c7d2fe;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
}
.brainstorm-matrix-table thead th.th-econ {
  background: #022c22; /* Emerald-950 */
  color: #a7f3d0;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
}
.brainstorm-matrix-table thead th.th-env {
  background: #3b0764; /* Purple-950 */
  color: #e9d5ff;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
}

.brainstorm-matrix-table tbody th.row-header {
  background: rgba(15, 23, 42, 0.95);
  color: #f8fafc;
  font-weight: 700;
  font-size: 0.8rem;
  text-align: left;
  width: 16%;
  border-right: 2px solid rgba(255, 255, 255, 0.12);
  padding: 12px 10px;
}
:root[data-theme="light"] .brainstorm-matrix-table tbody th.row-header,
html:not(.dark) .brainstorm-matrix-table tbody th.row-header {
  background: #f8fafc;
  color: #0f172a;
  border-right-color: #cbd5e1;
}
.row-header-wrap {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.row-header-title {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #818cf8; /* indigo-400 */
  font-weight: 800;
  font-size: 0.82rem;
}
:root[data-theme="light"] .row-header-title,
html:not(.dark) .row-header-title {
  color: #4338ca;
}
.row-header-subtitle {
  font-size: 0.68rem;
  font-weight: 500;
  color: #94a3b8;
  margin-left: 18px;
}
:root[data-theme="light"] .row-header-subtitle,
html:not(.dark) .row-header-subtitle {
  color: #64748b;
}

.brainstorm-matrix-table tbody td {
  width: 16.8%;
  background: rgba(255, 255, 255, 0.02);
  color: #e2e8f0;
  font-size: 0.78rem;
  line-height: 1.4;
  transition: all 0.18s ease;
  position: relative;
}
:root[data-theme="light"] .brainstorm-matrix-table tbody td,
html:not(.dark) .brainstorm-matrix-table tbody td {
  background: #ffffff;
  color: #1e293b;
}
.brainstorm-matrix-table tbody td.matrix-cell-active {
  cursor: pointer;
  border-radius: 6px;
}
.brainstorm-matrix-table tbody td.matrix-cell-active:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
  z-index: 2;
}
:root[data-theme="light"] .brainstorm-matrix-table tbody td.matrix-cell-active:hover,
html:not(.dark) .brainstorm-matrix-table tbody td.matrix-cell-active:hover {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.09);
}

/* Cell Type Backgrounds in Dark Mode */
.brainstorm-matrix-table tbody td.matrix-cell-key {
  background: rgba(245, 158, 11, 0.12);
  border: 1.5px solid rgba(245, 158, 11, 0.4);
}
.brainstorm-matrix-table tbody td.matrix-cell-key:hover {
  background: rgba(245, 158, 11, 0.22);
}
.brainstorm-matrix-table tbody td.matrix-cell-b1 {
  background: rgba(244, 63, 94, 0.12);
  border: 1.5px solid rgba(244, 63, 94, 0.35);
}
.brainstorm-matrix-table tbody td.matrix-cell-b1:hover {
  background: rgba(244, 63, 94, 0.22);
}
.brainstorm-matrix-table tbody td.matrix-cell-b2 {
  background: rgba(16, 185, 129, 0.12);
  border: 1.5px solid rgba(16, 185, 129, 0.35);
}
.brainstorm-matrix-table tbody td.matrix-cell-b2:hover {
  background: rgba(16, 185, 129, 0.22);
}
.brainstorm-matrix-table tbody td.matrix-cell-ext {
  background: rgba(2, 132, 199, 0.12);
  border: 1.5px solid rgba(2, 132, 199, 0.35);
}
.brainstorm-matrix-table tbody td.matrix-cell-ext:hover {
  background: rgba(2, 132, 199, 0.22);
}
.brainstorm-matrix-table tbody td.matrix-cell-empty {
  background: rgba(255, 255, 255, 0.01);
  border: 1px solid rgba(255, 255, 255, 0.03);
}

/* Cell Type Backgrounds in Light Mode */
:root[data-theme="light"] .brainstorm-matrix-table tbody td.matrix-cell-key,
html:not(.dark) .brainstorm-matrix-table tbody td.matrix-cell-key {
  background: #fffbeb;
  border: 1.5px solid #fde68a;
}
:root[data-theme="light"] .brainstorm-matrix-table tbody td.matrix-cell-key:hover,
html:not(.dark) .brainstorm-matrix-table tbody td.matrix-cell-key:hover {
  background: #fef3c7;
}
:root[data-theme="light"] .brainstorm-matrix-table tbody td.matrix-cell-b1,
html:not(.dark) .brainstorm-matrix-table tbody td.matrix-cell-b1 {
  background: #fff1f2;
  border: 1.5px solid #fecdd3;
}
:root[data-theme="light"] .brainstorm-matrix-table tbody td.matrix-cell-b1:hover,
html:not(.dark) .brainstorm-matrix-table tbody td.matrix-cell-b1:hover {
  background: #ffe4e6;
}
:root[data-theme="light"] .brainstorm-matrix-table tbody td.matrix-cell-b2,
html:not(.dark) .brainstorm-matrix-table tbody td.matrix-cell-b2 {
  background: #f0fdf4;
  border: 1.5px solid #bbf7d0;
}
:root[data-theme="light"] .brainstorm-matrix-table tbody td.matrix-cell-b2:hover,
html:not(.dark) .brainstorm-matrix-table tbody td.matrix-cell-b2:hover {
  background: #dcfce7;
}
:root[data-theme="light"] .brainstorm-matrix-table tbody td.matrix-cell-ext,
html:not(.dark) .brainstorm-matrix-table tbody td.matrix-cell-ext {
  background: #f0f9ff;
  border: 1.5px solid #bae6fd;
}
:root[data-theme="light"] .brainstorm-matrix-table tbody td.matrix-cell-ext:hover,
html:not(.dark) .brainstorm-matrix-table tbody td.matrix-cell-ext:hover {
  background: #e0f2fe;
}
:root[data-theme="light"] .brainstorm-matrix-table tbody td.matrix-cell-empty,
html:not(.dark) .brainstorm-matrix-table tbody td.matrix-cell-empty {
  background: #fafafa;
  border: 1px solid #f1f5f9;
}

/* ACTIVE SELECTED STATE (Clicked cell highlight) */
.brainstorm-matrix-table tbody td.matrix-cell-active.selected {
  outline: 2.5px solid var(--accent-cyan, #06b6d4) !important;
  outline-offset: -1px;
  box-shadow: 0 0 18px rgba(6, 182, 212, 0.45) !important;
  transform: translateY(-2px);
  z-index: 5;
}
:root[data-theme="light"] .brainstorm-matrix-table tbody td.matrix-cell-active.selected,
html:not(.dark) .brainstorm-matrix-table tbody td.matrix-cell-active.selected {
  outline: 2.5px solid #0284c7 !important;
  box-shadow: 0 0 16px rgba(2, 132, 199, 0.35) !important;
}

.cell-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 4px;
  margin-bottom: 4px;
}
.cell-card-title {
  font-weight: 800;
  font-size: 0.79rem;
  color: #f8fafc;
  line-height: 1.25;
}
:root[data-theme="light"] .cell-card-title,
html:not(.dark) .cell-card-title {
  color: #0f172a;
}
.cell-card-badge {
  display: inline-flex;
  align-items: center;
  padding: 1px 5px;
  border-radius: 9999px;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
  flex-shrink: 0;
}
.cell-card-badge.key-idea {
  background: #f59e0b;
  color: #ffffff;
}
.cell-card-badge.body-1 {
  background: #f43f5e;
  color: #ffffff;
}
.cell-card-badge.body-2 {
  background: #10b981;
  color: #ffffff;
}
.cell-card-badge.extension {
  background: #0284c7;
  color: #ffffff;
}
/* Semantic Cell Badges */
.cell-card-badge.badge-agree,
.cell-card-badge.badge-advantage,
.cell-card-badge.badge-positive,
.cell-card-badge.badge-solution {
  background: #10b981;
  color: #ffffff;
}
.cell-card-badge.badge-disagree,
.cell-card-badge.badge-disadvantage,
.cell-card-badge.badge-negative {
  background: #f43f5e;
  color: #ffffff;
}
.cell-card-badge.badge-cause {
  background: #f97316;
  color: #ffffff;
}
.cell-card-badge.badge-view1,
.cell-card-badge.badge-q1 {
  background: #0284c7;
  color: #ffffff;
}
.cell-card-badge.badge-view2,
.cell-card-badge.badge-q2 {
  background: #8b5cf6;
  color: #ffffff;
}
.cell-card-badge.badge-nuance,
.cell-card-badge.badge-extension {
  background: #6366f1;
  color: #ffffff;
}
.cell-card-desc {
  color: #cbd5e1;
  font-size: 0.72rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
:root[data-theme="light"] .cell-card-desc,
html:not(.dark) .cell-card-desc {
  color: #475569;
}

/* P-E-E-R Development Panel (Mounted directly beneath Matrix) */
.matrix-peer-panel {
  margin-top: 1rem;
  padding: 1.25rem 1.4rem;
  background: rgba(15, 23, 42, 0.85);
  border: 1.5px solid rgba(6, 182, 212, 0.35);
  border-radius: 16px;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(10px);
  animation: peerPanelFadeIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
:root[data-theme="light"] .matrix-peer-panel,
html:not(.dark) .matrix-peer-panel {
  background: #ffffff;
  border-color: #cbd5e1;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}
@keyframes peerPanelFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.peer-panel-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding-bottom: 0.9rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}
:root[data-theme="light"] .peer-panel-header,
html:not(.dark) .peer-panel-header {
  border-bottom-color: #f1f5f9;
}
.peer-header-left {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  flex: 1;
  min-width: 260px;
}
.peer-tags-wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.peer-badge-category {
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.1);
}
:root[data-theme="light"] .peer-badge-category,
html:not(.dark) .peer-badge-category {
  background: #f1f5f9;
  color: #475569;
  border-color: #e2e8f0;
}
.peer-badge-body {
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 9999px;
  color: #ffffff;
}
.peer-badge-body.body-1 { background: #f43f5e; }
.peer-badge-body.body-2 { background: #10b981; }
.peer-badge-body.extension { background: #0284c7; }
/* Semantic Peer Badges */
.peer-badge-body.badge-agree,
.peer-badge-body.badge-advantage,
.peer-badge-body.badge-positive,
.peer-badge-body.badge-solution { background: #10b981; }
.peer-badge-body.badge-disagree,
.peer-badge-body.badge-disadvantage,
.peer-badge-body.badge-negative { background: #f43f5e; }
.peer-badge-body.badge-cause { background: #f97316; }
.peer-badge-body.badge-view1,
.peer-badge-body.badge-q1 { background: #0284c7; }
.peer-badge-body.badge-view2,
.peer-badge-body.badge-q2 { background: #8b5cf6; }
.peer-badge-body.badge-nuance,
.peer-badge-body.badge-extension { background: #6366f1; }
.peer-badge-super {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.68rem;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 9999px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.35);
}

.peer-panel-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #f8fafc;
  line-height: 1.3;
  margin: 0;
}
:root[data-theme="light"] .peer-panel-title,
html:not(.dark) .peer-panel-title {
  color: #0f172a;
}

.peer-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.btn-peer-copy-full {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(6, 182, 212, 0.15);
  border: 1px solid rgba(6, 182, 212, 0.4);
  color: #22d3ee;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.18s ease;
}
.btn-peer-copy-full:hover {
  background: var(--accent-cyan, #06b6d4);
  color: #090d16;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(6, 182, 212, 0.35);
}
:root[data-theme="light"] .btn-peer-copy-full,
html:not(.dark) .btn-peer-copy-full {
  background: #f0f9ff;
  border-color: #0284c7;
  color: #0284c7;
}
:root[data-theme="light"] .btn-peer-copy-full:hover,
html:not(.dark) .btn-peer-copy-full:hover {
  background: #0284c7;
  color: #ffffff;
}

/* 4-Step P-E-E-R Grid */
.peer-steps-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.85rem;
  margin-top: 0.9rem;
}
@media (max-width: 860px) {
  .peer-steps-grid {
    grid-template-columns: 1fr;
  }
}

.peer-step-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
  font-family: 'Be Vietnam Pro', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
:root[data-theme="light"] .peer-step-card,
html:not(.dark) .peer-step-card {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.peer-step-card.card-point {
  border-left: 3.5px solid #06b6d4;
  background: rgba(6, 182, 212, 0.06);
}
.peer-step-card.card-explanation {
  border-left: 3.5px solid #f43f5e;
  background: rgba(244, 63, 94, 0.06);
}
.peer-step-card.card-example {
  border-left: 3.5px solid #10b981;
  background: rgba(16, 185, 129, 0.06);
}
.peer-step-card.card-result {
  border-left: 3.5px solid #a855f7;
  background: rgba(168, 85, 247, 0.06);
}

:root[data-theme="light"] .peer-step-card.card-point,
html:not(.dark) .peer-step-card.card-point {
  background: #f0fdfa;
  border-left-color: #0d9488;
}
:root[data-theme="light"] .peer-step-card.card-explanation,
html:not(.dark) .peer-step-card.card-explanation {
  background: #fff1f2;
  border-left-color: #e11d48;
}
:root[data-theme="light"] .peer-step-card.card-example,
html:not(.dark) .peer-step-card.card-example {
  background: #f0fdf4;
  border-left-color: #059669;
}
:root[data-theme="light"] .peer-step-card.card-result,
html:not(.dark) .peer-step-card.card-result {
  background: #faf5ff;
  border-left-color: #9333ea;
}

.peer-step-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-family: 'Be Vietnam Pro', 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.peer-step-card.card-point .peer-step-label { color: #22d3ee; }
.peer-step-card.card-explanation .peer-step-label { color: #fb7185; }
.peer-step-card.card-example .peer-step-label { color: #34d399; }
.peer-step-card.card-result .peer-step-label { color: #c084fc; }

:root[data-theme="light"] .peer-step-card.card-point .peer-step-label { color: #0f766e; }
:root[data-theme="light"] .peer-step-card.card-explanation .peer-step-label { color: #be123c; }
:root[data-theme="light"] .peer-step-card.card-example .peer-step-label { color: #047857; }
:root[data-theme="light"] .peer-step-card.card-result .peer-step-label { color: #7e22ce; }

.peer-step-content {
  font-size: 0.82rem;
  line-height: 1.5;
  color: #f1f5f9;
}
:root[data-theme="light"] .peer-step-content,
html:not(.dark) .peer-step-content {
  color: #1e293b;
}

.peer-step-tip {
  margin-top: 0.35rem;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.25);
  font-size: 0.72rem;
  color: #fcd34d;
  line-height: 1.4;
}
:root[data-theme="light"] .peer-step-tip,
html:not(.dark) .peer-step-tip {
  background: #fffbeb;
  border-color: #fde68a;
  color: #92400e;
}

.peer-copy-icon-btn {
  background: transparent;
  border: none;
  color: inherit;
  opacity: 0.75;
  cursor: pointer;
  padding: 2px 5px;
  font-size: 0.72rem;
  border-radius: 4px;
  transition: all 0.15s;
}
.peer-copy-icon-btn:hover {
  opacity: 1;
  background: rgba(255, 255, 255, 0.1);
}
:root[data-theme="light"] .peer-copy-icon-btn:hover,
html:not(.dark) .peer-copy-icon-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

/* Collocations Bar inside PEER Panel */
.peer-collocs-footer {
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}
:root[data-theme="light"] .peer-collocs-footer,
html:not(.dark) .peer-collocs-footer {
  border-top-color: #e2e8f0;
}
.peer-collocs-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: #94a3b8;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: 4px;
}
:root[data-theme="light"] .peer-collocs-label,
html:not(.dark) .peer-collocs-label {
  color: #64748b;
}
.peer-colloc-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #34d399;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.peer-colloc-pill:hover {
  background: rgba(16, 185, 129, 0.25);
  color: #6ee7b7;
  transform: translateY(-1px);
}
:root[data-theme="light"] .peer-colloc-pill,
html:not(.dark) .peer-colloc-pill {
  background: #f0fdf4;
  border-color: #bbf7d0;
  color: #15803d;
}
:root[data-theme="light"] .peer-colloc-pill:hover,
html:not(.dark) .peer-colloc-pill:hover {
  background: #dcfce7;
  color: #166534;
}

/* Interactive Cell Detail Modal (Theme-native) */
.matrix-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 99999;
  background: rgba(11, 15, 25, 0.78);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.matrix-modal-card {
  background: #0f172a;
  color: #f8fafc;
  border-radius: 20px;
  max-width: 620px;
  width: 100%;
  padding: 1.5rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.7);
  border: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 1rem;
  animation: matrixModalFadeIn 0.18s ease-out;
}
:root[data-theme="light"] .matrix-modal-card,
html:not(.dark) .matrix-modal-card {
  background: #ffffff;
  color: #0f172a;
  border-color: #e2e8f0;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
}
@keyframes matrixModalFadeIn {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}
.matrix-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 0.75rem;
}
:root[data-theme="light"] .matrix-modal-header,
html:not(.dark) .matrix-modal-header {
  border-bottom-color: #f1f5f9;
}
.matrix-modal-category {
  font-size: 0.65rem;
  font-family: 'JetBrains Mono', monospace;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: #94a3b8;
  display: inline-block;
  margin-bottom: 4px;
}
:root[data-theme="light"] .matrix-modal-category,
html:not(.dark) .matrix-modal-category {
  background: #f1f5f9;
  color: #475569;
}
.matrix-modal-title {
  font-size: 1.15rem;
  font-weight: 800;
  color: #f8fafc;
  line-height: 1.3;
}
:root[data-theme="light"] .matrix-modal-title,
html:not(.dark) .matrix-modal-title {
  color: #0f172a;
}
.matrix-modal-close {
  background: rgba(255, 255, 255, 0.06);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #94a3b8;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}
.matrix-modal-close:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #f8fafc;
}
:root[data-theme="light"] .matrix-modal-close,
html:not(.dark) .matrix-modal-close {
  background: #f1f5f9;
  color: #64748b;
}
:root[data-theme="light"] .matrix-modal-close:hover,
html:not(.dark) .matrix-modal-close:hover {
  background: #e2e8f0;
  color: #0f172a;
}
.matrix-modal-section {
  padding: 0.8rem 1rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.matrix-modal-section.section-point {
  background: rgba(6, 182, 212, 0.06);
  border-color: rgba(6, 182, 212, 0.25);
}
.matrix-modal-section.section-mechanism {
  background: rgba(255, 255, 255, 0.03);
}
.matrix-modal-section.section-example {
  background: rgba(16, 185, 129, 0.06);
  border-color: rgba(16, 185, 129, 0.25);
}
.matrix-modal-section.section-tip {
  background: rgba(245, 158, 11, 0.06);
  border-color: rgba(245, 158, 11, 0.25);
}

:root[data-theme="light"] .matrix-modal-section,
html:not(.dark) .matrix-modal-section {
  border-color: #e2e8f0;
}
:root[data-theme="light"] .matrix-modal-section.section-point,
html:not(.dark) .matrix-modal-section.section-point {
  background: #f0fdfa;
  border-color: #99f6e4;
}
:root[data-theme="light"] .matrix-modal-section.section-mechanism,
html:not(.dark) .matrix-modal-section.section-mechanism {
  background: #f8fafc;
}
:root[data-theme="light"] .matrix-modal-section.section-example,
html:not(.dark) .matrix-modal-section.section-example {
  background: #f0fdf4;
  border-color: #bbf7d0;
}
:root[data-theme="light"] .matrix-modal-section.section-tip,
html:not(.dark) .matrix-modal-section.section-tip {
  background: #fffbeb;
  border-color: #fde68a;
}

.matrix-modal-sec-title {
  font-size: 0.72rem;
  font-weight: 800;
  color: #94a3b8;
}
.matrix-modal-section.section-point .matrix-modal-sec-title { color: #22d3ee; }
.matrix-modal-section.section-example .matrix-modal-sec-title { color: #34d399; }
.matrix-modal-section.section-tip .matrix-modal-sec-title { color: #fbbf24; }

:root[data-theme="light"] .matrix-modal-sec-title,
html:not(.dark) .matrix-modal-sec-title {
  color: #334155;
}
:root[data-theme="light"] .matrix-modal-section.section-point .matrix-modal-sec-title,
html:not(.dark) .matrix-modal-section.section-point .matrix-modal-sec-title {
  color: #0f766e;
}
:root[data-theme="light"] .matrix-modal-section.section-example .matrix-modal-sec-title,
html:not(.dark) .matrix-modal-section.section-example .matrix-modal-sec-title {
  color: #047857;
}
:root[data-theme="light"] .matrix-modal-section.section-tip .matrix-modal-sec-title,
html:not(.dark) .matrix-modal-section.section-tip .matrix-modal-sec-title {
  color: #92400e;
}

.matrix-modal-sec-text {
  font-size: 0.8rem;
  line-height: 1.45;
  color: #f1f5f9;
}
:root[data-theme="light"] .matrix-modal-sec-text,
html:not(.dark) .matrix-modal-sec-text {
  color: #475569;
}
.matrix-modal-collocs-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}
.matrix-colloc-chip {
  background: rgba(16, 185, 129, 0.12);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s;
}
.matrix-colloc-chip:hover {
  background: rgba(16, 185, 129, 0.22);
  color: #6ee7b7;
}
:root[data-theme="light"] .matrix-colloc-chip,
html:not(.dark) .matrix-colloc-chip {
  background: #f0fdf4;
  color: #166534;
  border-color: #bbf7d0;
}
:root[data-theme="light"] .matrix-colloc-chip:hover,
html:not(.dark) .matrix-colloc-chip:hover {
  background: #dcfce7;
}

/* ==========================================================================
   P-E-E-R Pedagogical Coaching Styles (Questions & Keywords Framework)
   ========================================================================== */
.peer-step-question-box {
  margin-bottom: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.06);
}
:root[data-theme="light"] .peer-step-question-box,
html:not(.dark) .peer-step-question-box {
  background: #ffffff;
  border-color: #e2e8f0;
}
.peer-step-question-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: #94a3b8;
  margin-bottom: 0.25rem;
  display: flex;
  align-items: center;
  gap: 5px;
}
:root[data-theme="light"] .peer-step-question-title,
html:not(.dark) .peer-step-question-title {
  color: #64748b;
}
.peer-step-question-text {
  font-size: 0.84rem;
  font-weight: 500;
  color: #f1f5f9;
  line-height: 1.45;
}
:root[data-theme="light"] .peer-step-question-text,
html:not(.dark) .peer-step-question-text {
  color: #1e293b;
}
.peer-step-guidance-box {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 0.5rem;
}
.peer-keyword-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.peer-keyword-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  color: #94a3b8;
  margin-right: 0.2rem;
}
:root[data-theme="light"] .peer-keyword-label,
html:not(.dark) .peer-keyword-label {
  color: #64748b;
}
.peer-keyword-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.76rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #e2e8f0;
}
:root[data-theme="light"] .peer-keyword-tag,
html:not(.dark) .peer-keyword-tag {
  background: #f1f5f9;
  border-color: #cbd5e1;
  color: #334155;
}
.peer-starter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.74rem;
  font-style: italic;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(99, 102, 241, 0.1);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #a5b4fc;
  cursor: pointer;
  transition: all 0.15s ease;
}
.peer-starter-chip:hover {
  background: rgba(99, 102, 241, 0.25);
  color: #ffffff;
  transform: translateY(-1px);
}
:root[data-theme="light"] .peer-starter-chip,
html:not(.dark) .peer-starter-chip {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: #4338ca;
}
:root[data-theme="light"] .peer-starter-chip:hover,
html:not(.dark) .peer-starter-chip:hover {
  background: #e0e7ff;
  color: #312e81;
}

/* Collapsible Model Reference Check */
.peer-model-check {
  margin-top: 0.45rem;
  border-radius: 8px;
  border: 1px dashed rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.18);
  overflow: hidden;
  transition: all 0.2s ease;
}
:root[data-theme="light"] .peer-model-check,
html:not(.dark) .peer-model-check {
  border-color: #cbd5e1;
  background: #f8fafc;
}
.peer-model-check summary {
  padding: 6px 10px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #94a3b8;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
  list-style: none;
}
.peer-model-check summary::-webkit-details-marker {
  display: none;
}
.peer-model-check summary:hover {
  color: #38bdf8;
}
:root[data-theme="light"] .peer-model-check summary:hover,
html:not(.dark) .peer-model-check summary:hover {
  color: #0284c7;
}
.peer-model-text {
  padding: 8px 12px;
  border-top: 1px dashed rgba(255, 255, 255, 0.08);
  font-size: 0.8rem;
  font-weight: 500;
  line-height: 1.5;
  color: #cbd5e1;
  background: rgba(0, 0, 0, 0.25);
}
:root[data-theme="light"] .peer-model-text,
html:not(.dark) .peer-model-text {
  border-top-color: #e2e8f0;
  color: #334155;
  background: #ffffff;
}
.peer-model-badge-note {
  font-size: 0.68rem;
  font-style: italic;
  color: #f59e0b;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Authentic Practice Book Segmented View Switcher */
.pb-view-toggle-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  background: var(--bg-card, #1e293b);
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.1));
  border-radius: 0.75rem;
  padding: 0.5rem 0.75rem;
}
:root[data-theme="light"] .pb-view-toggle-bar,
html:not(.dark) .pb-view-toggle-bar {
  background: #ffffff;
  border-color: #e2e8f0;
}
.pb-view-group {
  display: inline-flex;
  gap: 0.35rem;
  background: rgba(0, 0, 0, 0.2);
  padding: 3px;
  border-radius: 0.6rem;
  border: 1px solid var(--border-color, rgba(255, 255, 255, 0.08));
}
:root[data-theme="light"] .pb-view-group,
html:not(.dark) .pb-view-group {
  background: #f1f5f9;
  border-color: #cbd5e1;
}
.pb-view-btn {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-muted, #94a3b8);
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: 0.45rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: all 0.2s ease;
  font-family: inherit;
  outline: none;
}
:root[data-theme="light"] .pb-view-btn,
html:not(.dark) .pb-view-btn {
  color: #64748b;
}
.pb-view-btn:hover {
  color: var(--text-main, #f8fafc);
  background: rgba(255, 255, 255, 0.06);
}
:root[data-theme="light"] .pb-view-btn:hover,
html:not(.dark) .pb-view-btn:hover {
  color: #0f172a;
  background: rgba(0, 0, 0, 0.04);
}
.pb-view-btn.active {
  background: rgba(6, 182, 212, 0.18);
  border-color: rgba(6, 182, 212, 0.45);
  color: #38bdf8;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}
:root[data-theme="light"] .pb-view-btn.active,
html:not(.dark) .pb-view-btn.active {
  background: #ffffff;
  border-color: #0891b2;
  color: #0891b2;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}


