/* Lab styles. Colours follow the EduFlint tokens in src/app/globals.css. Smallest text is 13px. */
.lab-shell { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.lab-main, .lab-side { min-width: 0; }
@media (min-width: 900px) {
  .lab-shell { grid-template-columns: 236px minmax(0, 1fr); align-items: start; gap: 24px; }
  .lab-side { position: sticky; top: 96px; }
}
.lab-side { display: flex; flex-direction: column; gap: 10px; }
.lab-side-h { margin: 0; font: 700 13px/1.2 var(--font-sans, sans-serif); letter-spacing: 0.12em; text-transform: uppercase; color: #007982; }
.lab-rail { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; padding: 0; margin: 0; }
@media (min-width: 900px) { .lab-rail { flex-direction: column; gap: 4px; } }
.lab-step { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 4px 12px 4px 6px; border-radius: 999px; border: 1px solid #e7e3da; background: #fff; color: #26385a; font-weight: 600; font-size: 15px; line-height: 1.2; cursor: pointer; text-align: left; }
@media (min-width: 900px) { .lab-step { border-radius: 12px; padding: 8px 12px 8px 8px; } }
.lab-step-n { display: inline-grid; place-items: center; flex: none; width: 30px; height: 30px; border-radius: 999px; background: #f8f6f1; color: #053068; font-weight: 800; font-size: 14px; }
.lab-step-text { display: flex; flex-direction: column; }
.lab-step-hint { display: none; font-weight: 500; font-size: 13px; color: #52627d; }
@media (min-width: 900px) { .lab-step-hint { display: block; } }
.lab-step.is-done { color: #0b1d3a; border-color: #b7dfe1; }
.lab-step.is-done .lab-step-n { background: #e3f5f6; color: #007982; }
.lab-step.is-current { background: #053068; color: #fff; border-color: #053068; }
.lab-step.is-current .lab-step-n { background: #f3a41d; color: #0b1d3a; }
.lab-step.is-current .lab-step-hint { color: #e6eef9; }
.lab-panel { padding: 20px; border: 1px solid #e7e3da; border-radius: 16px; background: #fff; box-shadow: 0 1px 2px rgba(11, 29, 58, 0.06); }
.lab-h { font-size: 1.25rem; font-weight: 700; margin: 0 0 12px; }
.lab-h:focus { outline: none; }
.lab-btn { min-height: 44px; min-width: 44px; padding: 0 14px; border-radius: 10px; border: 1px solid #053068; background: #fff; color: #053068; font-weight: 700; font-size: 1rem; cursor: pointer; }
.lab-btn:disabled { border-color: #d3cdc0; color: #52627d; background: #f8f6f1; cursor: not-allowed; }
.lab-primary { background: #053068; color: #fff; }
.lab-reset { border-color: #52627d; color: #0b1d3a; align-self: flex-start; }
.lab-nav { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.lab-bars { display: grid; gap: 20px; margin: 12px 0; }
.lab-bar { width: 100%; max-width: 560px; height: auto; display: block; }
.lab-bar-title { font-weight: 700; margin: 0 0 4px; }
.lab-controls { display: flex; flex-wrap: wrap; gap: 16px; margin-top: 8px; }
.lab-controls > .lab-btn { align-self: flex-start; }
.lab-stepper { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.lab-stepper-label { font-weight: 600; min-width: 96px; }
.lab-value { min-width: 2ch; text-align: center; font-weight: 700; font-size: 1.125rem; white-space: nowrap; }
.lab-result { font-size: 1.25rem; font-weight: 700; }
.lab-choices { border: 0; padding: 0; margin: 12px 0; }
.lab-choices legend { font-weight: 700; margin-bottom: 6px; }
.lab-choice { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.lab-choice input { width: 20px; height: 20px; }
.lab-feedback { font-weight: 600; }
.lab-text { width: 100%; border: 1px solid #94a3b8; border-radius: 10px; padding: 8px; margin-top: 6px; font: inherit; }
.lab-range { width: min(240px, 50vw); accent-color: #053068; }

/* Graded Record step */
.lab-graded { margin-top: 16px; padding: 16px; border-radius: 14px; background: #fef3dc; border: 1px solid #f3ddae; }
.lab-graded-q { margin: 0 0 10px; font-weight: 600; }
.lab-graded-row { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.lab-input { min-height: 44px; min-width: 0; flex: 1 1 140px; max-width: 260px; padding: 0 12px; border: 1px solid #94a3b8; border-radius: 10px; background: #fff; font: inherit; color: #0b1d3a; }
.lab-ok { color: #1f6b4a; font-weight: 700; }
.lab-bad { color: #a3431b; font-weight: 700; }

/* Lab record card (Check step) */
.lab-card { margin-top: 20px; padding: 18px; border-radius: 14px; border: 1px solid #e7e3da; background: #f8f6f1; }
.lab-card-h { margin: 0 0 12px; font-size: 1.125rem; font-weight: 700; }
.lab-card-list { display: grid; gap: 6px; margin: 14px 0 0; }
.lab-card-list > div { display: grid; grid-template-columns: minmax(110px, 30%) 1fr; gap: 10px; }
.lab-card-list dt { font-weight: 700; }
.lab-card-list dd { margin: 0; }
.lab-note { margin: 10px 0 0; font-size: 14px; color: #52627d; }
.lab-plan-tag { display: inline-flex; align-items: center; min-height: 28px; padding: 0 10px; margin-right: 6px; border-radius: 999px; background: #0b1d3a; color: #fff !important; font-weight: 600; font-size: 13px; text-decoration: none; }

.lab-table-wrap { overflow-x: auto; }
.lab-table { margin-top: 20px; width: 100%; border-collapse: collapse; font-size: 0.95rem; background: #fff; }
.lab-table caption { text-align: left; font-weight: 700; margin-bottom: 6px; }
.lab-table th, .lab-table td { border: 1px solid #e7e3da; padding: 8px; text-align: left; }
.lab-table th { background: #f8f6f1; }
@media (max-width: 640px) {
  .lab-table { table-layout: fixed; font-size: 0.8rem; }
  .lab-table th, .lab-table td { padding: 5px 4px; overflow-wrap: anywhere; }
}
.lab-live { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
@media print {
  .lab-side, .lab-nav, .lab-graded { display: none; }
  .lab-shell { display: block; }
}

/* Phones: the step rail scrolls sideways like an app tab strip instead of wrapping onto several lines. */
@media (max-width: 899px) {
  .lab-side { position: sticky; top: 60px; z-index: 5; flex-direction: row; align-items: center; margin-inline: -16px; padding: 8px 16px; background: rgba(248, 246, 241, 0.96); backdrop-filter: blur(10px); }
  .lab-side-h { display: none; }
  .lab-side > .lab-reset { flex: none; align-self: center; padding: 0 10px; font-size: 14px; }
  .lab-rail { flex: 1 1 auto; min-width: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .lab-rail::-webkit-scrollbar { display: none; }
  .lab-rail li { flex: none; }
  .lab-step { width: auto; white-space: nowrap; }
  .lab-panel { padding: 16px; }
  .lab-panel > .lab-nav { position: sticky; bottom: calc(76px + env(safe-area-inset-bottom)); background: #fff; padding-top: 10px; margin-inline: -16px; padding-inline: 16px; padding-bottom: 6px; }
  .lab-panel > .lab-nav .lab-btn { flex: 1 1 0; }
}

/* Motion layer (from the v0.3.0 animated labs): progress bar, step entrance, result pop, right/wrong feedback, new-row flash,
   circuit current flow and bulb glow. Everything here switches off under prefers-reduced-motion. */
.lab-progress { height: 6px; margin-bottom: 12px; border-radius: 999px; background: #e7e3da; overflow: hidden; }
.lab-progress > i { display: block; height: 100%; width: var(--p, 0%); border-radius: inherit; background: linear-gradient(90deg, #019aa2, #053068 70%, #f3a41d); transition: width 0.45s cubic-bezier(0.2, 0.7, 0.2, 1); }
.lab-panel.is-entering { animation: lab-enter 0.4s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
.lab-result.is-pop { animation: lab-pop 0.35s ease-out; }
.lab-feedback.is-right { color: #1f6b4a; animation: lab-pop 0.4s ease-out; }
.lab-feedback.is-wrong { color: #a3431b; animation: lab-shake 0.4s ease-out; }
.lab-table tr.is-new td { animation: lab-flash 1.2s ease-out; }
.lab-clock { display: inline-flex; flex-wrap: wrap; gap: 6px 14px; margin: 6px 0 0; padding: 8px 14px; border-radius: 12px; background: #0b1d3a; color: #e6eef9; font: 600 0.95rem/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; font-variant-numeric: tabular-nums; }
.lab-clock b { color: #f3a41d; }
.lab-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; margin: 6px 0 0; padding: 0; list-style: none; font-size: 14px; color: #52627d; }
.lab-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: -1px; }
.lab-flow { fill: none; stroke: #f3a41d; stroke-width: 5; stroke-linecap: round; stroke-dasharray: 0.1 14; animation: lab-flow var(--dur, 1s) linear infinite; }
.lab-glow { transform-box: fill-box; transform-origin: center; animation: lab-glow var(--dur, 2s) ease-in-out infinite; }
.lab-switch { transform-box: fill-box; transform-origin: 0% 100%; transition: transform 0.3s cubic-bezier(0.2, 0.7, 0.2, 1); }
.lab-bulb-lit { transition: fill-opacity 0.4s; }
.lab-bar rect { transition: fill 0.35s, fill-opacity 0.35s; }
.lab-ghost { pointer-events: none; }
.lab-controls + .lab-result { margin-top: 16px; }
@keyframes lab-enter { from { opacity: 0; transform: translateY(12px); } }
@keyframes lab-pop { 0% { transform: scale(0.96); } 55% { transform: scale(1.04); } 100% { transform: scale(1); } }
@keyframes lab-shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
@keyframes lab-flash { from { background: #fef3dc; } to { background: transparent; } }
@keyframes lab-flow { to { stroke-dashoffset: -14; } }
@keyframes lab-glow { 0%, 100% { opacity: 0.55; transform: scale(0.94); } 50% { opacity: 1; transform: scale(1.06); } }
@keyframes lab-grow { from { opacity: 0; transform: scaleY(0.15); } }
@media print { .lab-progress { display: none; } }
@media (prefers-reduced-motion: reduce) {
  .lab-flow { animation: none; }
  .lab-glow, .lab-panel.is-entering, .lab-result.is-pop, .lab-feedback.is-right, .lab-feedback.is-wrong, .lab-table tr.is-new td { animation: none; }
  .lab-progress > i, .lab-step, .lab-btn, .lab-switch, .lab-bar rect, .lab-bulb-lit { transition: none; }
}
