/* Practice page styles (global.css provides :root vars, reset, nav) */

/* ── Setup ──────────────────────────────────────────── */

.practice-setup {
  max-width: 520px;
  margin: 0 auto;
  padding: 48px 32px;
}

.practice-setup h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
}

.setup-desc {
  color: var(--text-dim);
  font-size: 15px;
  margin-bottom: 20px;
}

/* ── Mode Toggle ────────────────────────────────────── */

.mode-toggle {
  display: flex;
  gap: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 3px;
  margin-bottom: 20px;
}

.mode-btn {
  flex: 1;
  background: none;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 14px;
  font-family: var(--font-sans);
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.15s;
}

.mode-btn:hover { color: var(--text); }
.mode-btn.active { background: var(--accent); color: #fff; }

.srs-info {
  padding: 12px 16px;
  background: rgba(108,140,255,0.06);
  border: 1px solid rgba(108,140,255,0.15);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text-dim);
}

.srs-info .srs-count { color: var(--accent); font-weight: 600; }
.srs-info a { color: var(--accent); text-decoration: none; }
.srs-info a:hover { text-decoration: underline; }

.setup-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.setup-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.setup-field label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}

.form-select {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  font-size: 15px;
  font-family: var(--font-sans);
  cursor: pointer;
}

.form-select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

/* ── Buttons ────────────────────────────────────────── */

.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius);
  padding: 12px 24px;
  font-size: 15px;
  font-family: var(--font-sans);
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary:hover { background: #5a7ae6; }

/* ── Exercise Area ──────────────────────────────────── */

.exercise-area {
  max-width: 640px;
  margin: 0 auto;
  padding: 32px;
}

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

.exercise-progress {
  display: flex;
  align-items: center;
  gap: 10px;
}

.exercise-counter {
  font-size: 14px;
  color: var(--text-dim);
  font-family: var(--font-mono);
}

.type-badge {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 4px;
  background: var(--surface2);
  color: var(--text-dim);
}

.type-badge[data-type="conjugation"] { background: rgba(108,140,255,0.12); color: var(--accent); }
.type-badge[data-type="particle-selection"] { background: rgba(250,204,21,0.12); color: var(--yellow); }
.type-badge[data-type="translation"] { background: rgba(74,222,128,0.12); color: var(--green); }
.type-badge[data-type="sentence-assembly"] { background: rgba(251,146,60,0.12); color: var(--orange); }

.exercise-score {
  font-size: 14px;
  font-family: var(--font-mono);
  color: var(--text-dim);
}

.score-correct { color: var(--green); font-weight: 600; }

/* ── Progress Bar ───────────────────────────────────── */

.progress-bar-track {
  height: 3px;
  background: var(--surface2);
  border-radius: 2px;
  margin-bottom: 24px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 2px;
  transition: width 0.3s ease;
  width: 0;
}

/* ── Exercise Card ──────────────────────────────────── */

.exercise-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  min-height: 160px;
}

.exercise-instruction {
  font-size: 14px;
  color: var(--text-dim);
  margin-bottom: 16px;
}

.exercise-stimulus {
  font-family: var(--font-mono);
  font-size: 18px;
  line-height: 1.5;
  margin-bottom: 20px;
  color: var(--text);
}

.exercise-stimulus .blank {
  display: inline-block;
  min-width: 60px;
  border-bottom: 2px solid var(--accent);
  margin: 0 4px;
}

.exercise-hint {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 12px;
  font-style: italic;
}

/* ── Input Types ────────────────────────────────────── */

.exercise-input {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-family: var(--font-mono);
  font-size: 16px;
  margin-bottom: 12px;
}

.exercise-input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.exercise-textarea {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-family: var(--font-mono);
  font-size: 16px;
  min-height: 80px;
  resize: vertical;
  margin-bottom: 12px;
}

.exercise-textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.submit-btn {
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 20px;
  font-size: 14px;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.submit-btn:hover { border-color: var(--accent-dim); background: var(--surface); }

/* ── Particle Options ───────────────────────────────── */

.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}

.option-btn {
  background: var(--bg);
  color: var(--text);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 16px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  text-align: center;
}

.option-btn:hover { border-color: var(--accent-dim); background: var(--surface2); }
.option-btn.selected { border-color: var(--accent); background: rgba(108,140,255,0.1); }
.option-btn.correct { border-color: var(--green); background: rgba(74,222,128,0.1); color: var(--green); }
.option-btn.wrong { border-color: var(--red); background: rgba(248,113,113,0.1); color: var(--red); }
.option-btn.disabled { pointer-events: none; opacity: 0.6; }

/* ── Assembly Chips ─────────────────────────────────── */

.chip-source {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.chip {
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 8px 16px;
  font-family: var(--font-mono);
  font-size: 15px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, opacity 0.15s;
  user-select: none;
}

.chip:hover { border-color: var(--accent-dim); background: var(--surface2); }
.chip.used { opacity: 0.3; pointer-events: none; }

.assembly-target {
  min-height: 52px;
  background: var(--bg);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 10px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.assembly-target .chip {
  border-color: var(--accent-dim);
  background: rgba(108,140,255,0.06);
  cursor: pointer;
}

.assembly-target .chip:hover { background: rgba(248,113,113,0.1); border-color: var(--red); }

/* ── Feedback ───────────────────────────────────────── */

.feedback {
  margin-top: 16px;
  padding: 16px 20px;
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.5;
}

.feedback.correct {
  background: rgba(74,222,128,0.08);
  border: 1px solid rgba(74,222,128,0.2);
  color: var(--green);
}

.feedback.wrong {
  background: rgba(248,113,113,0.08);
  border: 1px solid rgba(248,113,113,0.2);
  color: var(--text);
}

.feedback-label {
  font-weight: 600;
  margin-bottom: 4px;
}

.feedback-expected {
  font-family: var(--font-mono);
  font-size: 15px;
  margin-top: 6px;
  color: var(--text);
}

.feedback-explanation {
  margin-top: 6px;
  color: var(--text-dim);
  font-size: 13px;
}

/* ── AI Tutor ──────────────────────────────────────── */

.tutor-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.tutor-btn {
  background: var(--surface2);
  color: var(--accent);
  border: 1px solid var(--accent-dim);
  border-radius: var(--radius);
  padding: 6px 16px;
  font-size: 13px;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, opacity 0.15s;
}

.tutor-btn:hover { background: var(--accent-dim); color: white; }
.tutor-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.tutor-btn:disabled:hover { background: var(--surface2); color: var(--accent); }
.tutor-btn.loading { opacity: 0.7; }

.tutor-response {
  margin-top: 12px;
  padding: 12px 16px;
  background: var(--surface2);
  border: 1px solid var(--accent-dim);
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  color: var(--text);
}

.tutor-response .tutor-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
  margin-bottom: 6px;
}

/* ── Mini Preview ───────────────────────────────────── */

.preview-mini {
  margin-top: 16px;
  padding: 16px 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.preview-mini .label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.preview-mini-stage {
  display: flex;
  align-items: center;
  gap: 12px;
}

.preview-mini .preview-element {
  padding: 8px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  transition: all 0.3s;
  color: var(--text);
  background: var(--surface2);
}

.preview-mini .preview-element.active {
  border-color: var(--accent);
  background: rgba(108,140,255,0.15);
  color: var(--accent);
}

.preview-mini .preview-element.highlight {
  border-color: var(--green);
  background: rgba(74,222,128,0.15);
  color: var(--green);
}

.preview-mini .preview-element.hidden { opacity: 0.3; }

/* ── Exercise Actions ───────────────────────────────── */

.exercise-actions {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
}

/* ── Summary ────────────────────────────────────────── */

.summary {
  max-width: 520px;
  margin: 0 auto;
  padding: 48px 32px;
  text-align: center;
}

.summary h2 {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 24px;
}

.summary-score {
  font-size: 48px;
  font-weight: 700;
  font-family: var(--font-mono);
  margin-bottom: 8px;
}

.summary-score .score-fraction {
  color: var(--text-dim);
  font-size: 20px;
  font-weight: 400;
}

.summary-breakdown {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.breakdown-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 16px;
  min-width: 120px;
}

.breakdown-item .breakdown-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-dim);
  margin-bottom: 4px;
}

.breakdown-item .breakdown-value {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 600;
}

.tracked-notice {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 20px;
}

.tracked-notice a { color: var(--accent); text-decoration: none; }
.tracked-notice a:hover { text-decoration: underline; }

/* ── Interlinear Gloss ─────────────────────────────── */

.gloss-grid {
  display: inline-grid;
  gap: 2px 12px;
  margin: 12px 0;
  padding: 12px 16px;
  background: rgba(108,140,255,0.04);
  border: 1px solid rgba(108,140,255,0.1);
  border-radius: var(--radius);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.4;
}

.gloss-token {
  font-weight: 600;
  color: var(--text);
}

.gloss-role {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  font-weight: 500;
}

.gloss-english {
  color: var(--text-dim);
  font-size: 13px;
}

.feedback-gloss {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.feedback-gloss .gloss-grid {
  margin: 4px 0 0;
}

/* ── Error Correction ──────────────────────────────── */

.error-stimulus {
  color: var(--red);
  text-decoration: underline wavy var(--red);
  text-underline-offset: 4px;
}

.type-badge[data-type="error-correction"] { background: rgba(248,113,113,0.12); color: var(--red); }

/* ── Session Info ──────────────────────────────────── */

.session-info {
  padding: 12px 16px;
  background: rgba(108,140,255,0.06);
  border: 1px solid rgba(108,140,255,0.15);
  border-radius: var(--radius);
  font-size: 14px;
  color: var(--text-dim);
}

.session-info .setup-field {
  margin-bottom: 10px;
}

.session-info .optional-label {
  font-size: 10px;
  color: var(--text-dim);
  opacity: 0.7;
}

.session-desc {
  font-size: 13px;
  color: var(--text-dim);
  margin: 0;
  line-height: 1.5;
}

/* ── Phase Label ───────────────────────────────────── */

.phase-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 3px 10px;
  border-radius: 4px;
  font-weight: 600;
}

.phase-warmup {
  background: rgba(250,204,21,0.12);
  color: var(--yellow);
}

.phase-guided {
  background: rgba(108,140,255,0.12);
  color: var(--accent);
}

/* ── Responsive: Tablet ───────────────────────────────── */

@media (max-width: 768px) {
  .practice-setup {
    padding: 32px 16px;
  }

  .practice-setup h2 {
    font-size: 20px;
  }

  .exercise-area {
    padding: 20px 16px;
  }

  .exercise-card {
    padding: 20px;
  }

  .exercise-stimulus {
    font-size: 16px;
  }

  .options-grid {
    grid-template-columns: 1fr;
  }

  .option-btn {
    padding: 12px;
    font-size: 15px;
  }

  .gloss-grid {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }

  .chip-source {
    gap: 6px;
  }

  .chip {
    padding: 6px 12px;
    font-size: 14px;
  }

  .assembly-target {
    padding: 8px;
    gap: 6px;
  }

  .preview-mini {
    padding: 12px;
  }

  .preview-mini-stage {
    flex-wrap: wrap;
    gap: 8px;
  }

  .preview-mini .preview-element {
    padding: 6px 12px;
    font-size: 12px;
  }

  .summary {
    padding: 32px 16px;
  }

  .summary-score {
    font-size: 36px;
  }

  .summary-breakdown {
    gap: 10px;
  }

  .breakdown-item {
    padding: 10px 12px;
    min-width: 100px;
  }

  .phase-transition-content {
    padding: 24px 32px;
    margin: 0 16px;
  }
}

/* ── Responsive: Small Phone ──────────────────────────── */

@media (max-width: 480px) {
  .practice-setup {
    padding: 24px 12px;
  }

  .exercise-area {
    padding: 16px 12px;
  }

  .exercise-card {
    padding: 16px;
    min-height: 120px;
  }

  .exercise-stimulus {
    font-size: 15px;
  }

  .exercise-input, .exercise-textarea {
    font-size: 15px;
    padding: 10px 12px;
  }

  .chip {
    padding: 5px 10px;
    font-size: 13px;
  }

  .mode-btn {
    padding: 6px 10px;
    font-size: 13px;
  }

  .summary-score {
    font-size: 28px;
  }

  .summary-breakdown {
    flex-direction: column;
    align-items: center;
  }

  .breakdown-item {
    width: 100%;
    max-width: 200px;
  }
}

/* ── Phase Transition Overlay ──────────────────────── */

.phase-transition {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.6);
  z-index: 100;
  animation: fadeIn 0.2s ease;
}

.phase-transition-content {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 48px;
  text-align: center;
  animation: scaleIn 0.3s ease;
}

.phase-transition-content p {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.9); }
  to { opacity: 1; transform: scale(1); }
}
