/* Writing Lab — guided worksheet session */
.wl-root--worksheet {
  max-width: 560px;
  margin: 0 auto;
  padding: 8px 12px 24px;
  display: flex;
  flex-direction: column;
  min-height: min(92vh, 720px);
}

#wlPlayfield {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.wl-trace-zone {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  margin-top: auto;
  padding-top: 8px;
}

.wl-trace-zone__hint {
  margin: 0 0 6px;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--wl-ink-muted, #64748b);
}

.wl-trace-zone__note {
  margin: 0 0 8px;
  padding: 8px 12px;
  text-align: center;
  font-size: 0.8rem;
  line-height: 1.45;
  font-weight: 600;
  color: #334155;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
}

.wl-trace-zone__note em {
  font-style: normal;
  font-weight: 800;
  color: #1d4ed8;
}

.wl-trace-zone__glyph {
  display: block;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 800;
  color: #94a3b8;
  margin-bottom: 4px;
}

.wl-stage-wrap--worksheet {
  position: relative;
  flex: 1;
  min-height: min(50vh, 420px);
  max-height: min(58vh, 480px);
  margin-bottom: 8px;
  isolation: isolate;
  overflow: hidden;
}

#wlGuideGroup circle {
  fill: #1e293b;
  opacity: 1;
}

.wl-outline-guide {
  vector-effect: non-scaling-stroke;
  pointer-events: none;
}

/* Guides below; ink canvas must be on top (sentences use many SVG paths) */
.wl-stage-wrap--worksheet .wl-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}

.wl-stage-wrap--worksheet .wl-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  touch-action: none;
  pointer-events: auto;
  cursor: crosshair;
  background: transparent !important;
}

.wl-tools--trace {
  flex-shrink: 0;
  padding-bottom: env(safe-area-inset-bottom, 8px);
}

.wl-worksheet__progress-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.wl-worksheet__counter {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--wl-accent, #2f7dff);
  white-space: nowrap;
}

.wl-progress--overall {
  flex: 1;
}

.wl-sequence {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin-bottom: 12px;
  max-height: 72px;
  overflow-y: auto;
  padding: 4px;
}

.wl-seq-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 6px;
  border-radius: 10px;
  font-weight: 800;
  font-size: 0.85rem;
  background: var(--wl-chip-bg, rgba(47, 125, 255, 0.08));
  color: var(--wl-ink-muted, #64748b);
  border: 2px solid transparent;
  transition: transform 0.25s ease, background 0.25s ease, color 0.25s ease;
}

.wl-seq-chip.is-active {
  background: linear-gradient(135deg, #2f7dff, #6366f1);
  color: #fff;
  transform: scale(1.08);
  box-shadow: 0 4px 12px rgba(47, 125, 255, 0.35);
}

.wl-seq-chip.is-done {
  background: rgba(34, 197, 94, 0.15);
  color: #16a34a;
  border-color: rgba(34, 197, 94, 0.4);
}

.wl-item-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.wl-item-progress__label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--wl-ink-muted, #64748b);
  white-space: nowrap;
}

.wl-progress--item {
  flex: 1;
  height: 8px;
}

.wl-progress__bar--item {
  background: linear-gradient(90deg, #f59e0b, #22c55e);
}

.wl-success-flash {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: none;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  font-weight: 900;
  color: #22c55e;
  background: rgba(255, 255, 255, 0.75);
  pointer-events: none;
}

.wl-success-flash.is-visible {
  display: flex;
  animation: wl-flash-in 0.5s ease;
}

@keyframes wl-flash-in {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

.wl-result {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(20, 33, 61, 0.55);
  backdrop-filter: blur(6px);
}

.wl-result[hidden] {
  display: none !important;
}

.wl-result__card {
  position: relative;
  width: min(100%, 420px);
  padding: 28px 24px;
  border-radius: 24px;
  background: linear-gradient(160deg, #fff 0%, #f0f7ff 100%);
  box-shadow: 0 20px 50px rgba(20, 33, 61, 0.2);
  text-align: center;
  overflow: hidden;
}

.wl-result__mascot {
  font-size: 4rem;
  line-height: 1;
  margin-bottom: 8px;
}

.wl-child-greet {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 800;
  color: #6366f1;
}

.wl-btn--tool.is-active {
  background: linear-gradient(135deg, #2f7dff, #6366f1);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 10px rgba(47, 125, 255, 0.3);
}

.wl-canvas--eraser {
  cursor: cell;
}

.wl-result__title {
  margin: 0 0 4px;
  font-family: 'Baloo 2', cursive;
  font-size: 1.6rem;
  color: var(--wl-ink, #14213d);
}

.wl-result__child {
  margin: 0 0 12px;
  font-size: 0.95rem;
  color: #64748b;
}

.wl-result__badge {
  margin: 0 0 20px;
  font-weight: 800;
  color: #6366f1;
  font-size: 1rem;
}

.wl-result__stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.wl-result__stat {
  padding: 12px;
  border-radius: 14px;
  background: rgba(47, 125, 255, 0.08);
}

.wl-result__stat-val {
  display: block;
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--wl-ink, #14213d);
}

.wl-result__stat-lbl {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
}

.wl-result__actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wl-result__actions .wl-btn {
  width: 100%;
}

@media (max-width: 480px) {
  .wl-sequence {
    max-height: 56px;
  }

  .wl-seq-chip {
    min-width: 1.75rem;
    height: 1.75rem;
    font-size: 0.75rem;
  }
}
