/* ============================================================
   Practice Builder — tool-specific styles (design system from
   shared/global.css; this file covers the builder only)
   ============================================================ */

.builder-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 1rem; align-items: start; }
.builder-column { display: grid; gap: 1rem; }
.panel-title { font-size: 0.82rem; text-transform: uppercase; letter-spacing: 0.09em; color: var(--muted); margin: 0 0 0.75rem; }

/* Source tabs */
.source-tabs { display: flex; gap: 0.4rem; border-bottom: 2px solid var(--line); padding-bottom: 0.55rem; margin-bottom: 0.8rem; }
.source-tab {
  font: inherit; font-weight: 800; font-size: 0.9rem; cursor: pointer; border: none; background: transparent;
  color: var(--muted); border-radius: var(--r-sm); padding: 0.5rem 0.75rem; white-space: nowrap;
}
.source-tab:hover { background: var(--brand-soft); color: var(--brand-strong); }
.source-tab[aria-selected="true"] { background: var(--brand); color: #fff; }
.source-panel { animation: fadeIn 0.2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
.source-desc { font-size: 0.88rem; color: var(--muted); margin: 0.2rem 0 0.8rem; line-height: 1.5; }
.select-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.65rem; }

/* Upload dropzone */
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 0.3rem; text-align: center;
  border: 2px dashed var(--line); border-radius: var(--r-lg); padding: 1.4rem 1rem; cursor: pointer;
  background: #fffdf6; transition: all 0.15s ease;
}
.dropzone:hover, .dropzone.drag-over { border-color: var(--brand); background: var(--brand-softer); }
.dropzone-icon { font-size: 2.1rem; }
.dropzone-hint { font-size: 0.78rem; color: var(--muted); }
.upload-meta { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; background: var(--brand-softer); border: 1.5px solid #bfe6dc; border-radius: var(--r-md); padding: 0.55rem 0.75rem; margin-top: 0.7rem; font-size: 0.88rem; font-weight: 600; flex-wrap: wrap; }

/* Paste */
.paste-area { font-size: 0.9rem; line-height: 1.55; resize: vertical; }
.paste-foot { display: flex; align-items: center; gap: 0.6rem; margin-top: 0.5rem; flex-wrap: wrap; }
.paste-count { font-size: 0.82rem; color: var(--muted); font-weight: 700; margin-right: auto; font-variant-numeric: tabular-nums; }

/* Preview */
.preview-meta { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-bottom: 0.7rem; }
.preview-chip { background: var(--brand); color: #fff; font-size: 0.8rem; font-weight: 800; border-radius: 999px; padding: 0.28rem 0.75rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.preview-chip.light { background: var(--brand-soft); color: var(--brand-strong); }
.preview-text {
  max-height: 180px; overflow-y: auto; background: #fffdf6; border: 1px solid var(--line);
  border-left: 4px solid var(--brand); border-radius: var(--r-sm);
  padding: 0.7rem 0.85rem; font-size: 0.87rem; line-height: 1.6; white-space: pre-wrap; margin: 0 0 0.7rem;
}
.activities-title { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); margin: 1.1rem 0 0.6rem; }
.activities-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.55rem; }
.activity-card {
  font: inherit; cursor: pointer; text-align: left; display: flex; flex-direction: column; gap: 0.15rem;
  background: #fff; border: 1.5px solid var(--line); border-radius: var(--r-md); padding: 0.7rem 0.8rem;
  transition: all 0.15s ease;
}
.activity-card:hover { border-color: var(--brand); transform: translateY(-2px); }
.a-icon { font-size: 1.4rem; }
.activity-card strong { font-size: 0.88rem; }
.activity-card small { font-size: 0.72rem; color: var(--muted); line-height: 1.35; }

/* Practice stage */
.practice-stage { min-height: 480px; display: flex; flex-direction: column; }
.stage-empty, .stage-center { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 0.3rem; padding: 1rem; }
.stage-emoji { font-size: 3rem; }
.stage-empty h2, .stage-center h2 { margin: 0.3rem 0 0.2rem; font-size: 1.3rem; letter-spacing: -0.02em; }
.stage-empty p { color: var(--muted); margin: 0; }
.runner-top { display: flex; justify-content: space-between; gap: 0.6rem; margin-bottom: 0.7rem; flex-wrap: wrap; }
.progress-pill { background: var(--brand-soft); color: var(--brand-strong); font-weight: 800; font-size: 0.83rem; border-radius: 999px; padding: 0.3rem 0.85rem; font-variant-numeric: tabular-nums; }
.score-pill { background: #fef3c7; color: #92400e; }
.runner-context { font-size: 0.78rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.07em; font-weight: 700; margin: 0.4rem 0 0.2rem; }
.runner-question { font-size: 1.05rem; font-weight: 700; line-height: 1.6; margin: 0.3rem 0 0.8rem; }
.runner-options { display: grid; grid-template-columns: 1fr 1fr; gap: 0.55rem; }
.runner-option {
  font: inherit; cursor: pointer; text-align: left; border: 2px solid var(--line); background: #fff;
  border-radius: var(--r-md); padding: 0.6rem 0.75rem; font-size: 0.92rem; font-weight: 600; transition: all 0.13s ease;
}
.runner-option:hover:not(:disabled) { border-color: var(--brand); background: var(--brand-softer); }
.runner-option.correct { border-color: var(--ok); background: var(--ok-bg); }
.runner-option.incorrect { border-color: var(--bad); background: var(--bad-bg); }
.runner-option:disabled { cursor: default; }
.feedback { margin: 0.7rem 0 0; }
.action-row { display: flex; gap: 0.65rem; margin-top: 0.8rem; flex-wrap: wrap; }
.action-row .btn { flex: 1; min-width: 140px; }
.results-score { font-size: 1.35rem; font-weight: 850; margin: 0.2rem 0; font-variant-numeric: tabular-nums; }
.results-note { color: var(--muted); margin: 0.1rem 0 0.7rem; }
.results-actions { justify-content: center; }

/* Flashcards */
.flashcard-count { font-size: 0.85rem; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.flashcard {
  font: inherit; cursor: pointer; width: min(420px, 100%); aspect-ratio: 8 / 5; border: none; border-radius: var(--r-lg);
  background: linear-gradient(150deg, #0f766e, #115e59); color: #fff; padding: 1.4rem;
  box-shadow: var(--shadow); display: grid; place-items: center; position: relative; transition: transform 0.15s ease;
}
.flashcard:active { transform: scale(0.98); }
.flashcard-face { font-size: clamp(1.2rem, 3.4vw, 1.7rem); font-weight: 800; line-height: 1.4; max-height: 100%; overflow-y: auto; }
.flashcard-back { font-size: clamp(0.92rem, 2.3vw, 1.1rem); font-weight: 500; }
.flashcard-hint { font-size: 0.78rem; color: var(--muted); margin: 0.5rem 0 0; }

/* Vocabulary list + worksheet */
.vocab-runner-head { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; margin-bottom: 0.7rem; flex-wrap: wrap; }
.vocab-list { margin: 0; padding-left: 1.4rem; columns: 2; gap: 2rem; }
.vocab-list li { break-inside: avoid; margin-bottom: 0.45rem; font-size: 0.92rem; }
.vocab-list strong { color: var(--brand-strong); }
.vocab-list small { color: var(--muted); display: block; font-size: 0.74rem; }
.worksheet-preview { border: 1px solid var(--line); border-radius: var(--r-md); padding: 0.7rem 1rem; max-height: 340px; overflow-y: auto; background: #fffdf6; font-size: 0.88rem; }
.worksheet-preview ol { margin: 0.3rem 0 0.6rem; padding-left: 1.3rem; }

.print-sheet { display: none; }

@media print {
  @page { size: A4; margin: 14mm; }
  body > * { display: none !important; }
  .print-sheet { display: block !important; }
  .print-sheet h1 { font-size: 17pt; text-align: center; margin: 0 0 2pt; }
  .print-sheet .print-subtitle { text-align: center; font-size: 10pt; margin: 0 0 6pt; color: #333; }
  .print-sheet ol { font-size: 11pt; line-height: 2.1; }
  .answer-key-page { page-break-before: always; }
  .print-sheet .key-grid { font-size: 11pt; line-height: 1.8; }
}

@media (max-width: 1060px) { .builder-grid { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .activities-grid { grid-template-columns: 1fr; }
  .runner-options { grid-template-columns: 1fr; }
  .select-row { grid-template-columns: 1fr; }
  .vocab-list { columns: 1; }
  .source-tabs { overflow-x: auto; flex-wrap: nowrap; }
}
