/* Watch and practise together, rather than scrolling between two boards. */
.writing-workspace {display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.2fr);align-items:start;gap:18px;margin:20px 0}
.writing-workspace .letter-demo {max-width:none;margin:0;min-width:0}
.writing-workspace .canvas-container {margin:0;min-width:0}
.writing-workspace .canvas-wrapper {max-width:100%;width:min(100%,400px);aspect-ratio:1;height:auto}
.writing-workspace canvas {max-width:100%;max-height:100%;width:100%;height:100%}
.writing-workspace #feedback {grid-column:1/-1;grid-row:2}
.writing-workspace .letter-demo {grid-column:1;grid-row:1}
.writing-workspace .canvas-container {grid-column:2;grid-row:1}
.writing-workspace .canvas-container h2 {color:#183c57;margin:0 0 .75rem}
.writing-workspace #feedback.show {font-size:1.2rem;border:3px solid currentColor}
.writing-workspace #feedback-text {font-size:1.65rem;font-weight:900}
.letter-grid {grid-template-columns:repeat(5,minmax(0,1fr))!important}
@media(max-width:560px){.writing-workspace {gap:16px;grid-template-columns:minmax(0,1fr)}.writing-workspace .letter-demo {grid-column:1;grid-row:1;padding:12px}.writing-workspace .canvas-container {grid-column:1;grid-row:2}.writing-workspace #feedback {grid-row:3}.writing-workspace .canvas-controls {gap:8px}.writing-workspace button {min-height:44px}}
/* Learner-paced stroke controls — deliberately scoped to the writing demo. */
.letter-demo .stroke-step-details summary {
  min-height: 44px;
  padding: .65rem;
  color: #075f70;
  font-weight: 900;
  cursor: pointer;
}

.letter-demo .stroke-step-details summary:focus-visible {
  outline: 3px solid #183c57;
  outline-offset: 2px;
}

.writing-board-status {
  width: min(100%, 400px);
  margin: 0 auto .8rem;
  padding: .8rem;
  border: 2px solid #9adce7;
  border-radius: 14px;
  background: #d8f5fc;
  color: #183c57;
  font-size: .9rem;
  font-weight: 800;
  line-height: 1.5;
}

#writing-board-next:not(:disabled) {
  min-height: 44px;
  border: 2px solid #df9a23;
  color: #55340b;
  background: #ffd348;
  font-weight: 900;
}

#writing-canvas {
  touch-action: none;
}

.letter-demo .stroke-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: .55rem;
  margin: .8rem 0 .9rem;
}

.letter-demo .stroke-controls button {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  margin: 0;
  padding: .62rem .95rem;
  border: 2px solid #087e91;
  border-radius: 999px;
  background: #087e91;
  color: #fffdf2;
  font-family: "Nunito", "Noto Sans Devanagari", sans-serif;
  font-size: .92rem;
  font-weight: 900;
  line-height: 1.2;
  cursor: pointer;
  transition: background-color .16s ease, border-color .16s ease, color .16s ease,
    box-shadow .16s ease, transform .16s ease;
}

.letter-demo .stroke-controls button:hover {
  border-color: #065f6e;
  background: #065f6e;
  transform: translateY(-1px);
}

.letter-demo .stroke-controls button:active {
  transform: translateY(0);
}

.letter-demo .stroke-controls button:focus-visible {
  outline: 3px solid #183c57;
  outline-offset: 3px;
  box-shadow: 0 0 0 2px #fffdf2;
}

.letter-demo .stroke-controls #letter-demo-replay {
  border-color: #ff705e;
  background: #ff705e;
  color: #183c57;
}

.letter-demo .stroke-controls #letter-demo-replay:hover {
  border-color: #dc5144;
  background: #dc5144;
  color: #fffdf2;
}

.letter-demo .stroke-controls #writing-audio-toggle {
  border-color: #087e91;
  background: #fffdf2;
  color: #075f70;
}

.letter-demo .stroke-controls #writing-audio-toggle[aria-pressed="true"] {
  border-color: #087e91;
  background: #087e91;
  color: #fffdf2;
}

.letter-demo .stroke-controls #writing-audio-toggle:hover {
  border-color: #065f6e;
  box-shadow: inset 0 0 0 1px currentColor;
}

.letter-demo .stroke-steps {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: .45rem;
  margin: .65rem 0 .8rem;
  padding: 0;
  list-style: none;
  counter-reset: stroke-step;
}

.letter-demo .stroke-steps li {
  display: flex;
  min-height: 36px;
  align-items: center;
  gap: .4rem;
  padding: .35rem .65rem;
  border: 1.5px solid #d8e9df;
  border-radius: 12px;
  background: #fffdf2;
  color: #41627a;
  font-size: .82rem;
  font-weight: 800;
  line-height: 1.25;
  counter-increment: stroke-step;
}

.letter-demo .stroke-steps li::before {
  content: counter(stroke-step);
  display: inline-grid;
  width: 1.4rem;
  height: 1.4rem;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: #c9f7fa;
  color: #075f70;
  font-size: .75rem;
  font-weight: 900;
}

.letter-demo .stroke-steps li.current {
  border-color: #087e91;
  background: #e5fbfb;
  color: #12485a;
  box-shadow: 0 0 0 2px rgba(8, 126, 145, .14);
}

.letter-demo .stroke-steps li.current::before {
  background: #087e91;
  color: #fffdf2;
}

.letter-demo .stroke-steps li.completed {
  border-color: #75cf72;
  background: #eff9e9;
  color: #315f3b;
}

.letter-demo .stroke-steps li.completed::before {
  content: "✓";
  background: #75cf72;
  color: #183c57;
  font-size: .85rem;
}

.letter-demo .writing-audio-note {
  max-width: 34rem;
  margin: .4rem auto .55rem;
  color: #31566b;
  font-size: .84rem;
  line-height: 1.5;
}

.letter-demo .stroke-reference {
  display: block;
  margin: .65rem auto 0;
  color: #41627a;
  font-size: .75rem;
  line-height: 1.45;
}

.letter-demo .stroke-reference a {
  color: #075f70;
  font-weight: 800;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

.letter-demo .stroke-reference a:hover {
  color: #b33e36;
  text-decoration-thickness: 2px;
}

.letter-demo .stroke-reference a:focus-visible {
  border-radius: 3px;
  outline: 3px solid #183c57;
  outline-offset: 2px;
}

@media (max-width: 480px) {
  .letter-demo .stroke-controls {
    gap: .45rem;
  }

  .letter-demo .stroke-controls button {
    flex: 1 1 calc(50% - .45rem);
    padding-inline: .55rem;
  }

  .letter-demo .stroke-steps {
    justify-content: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .letter-demo .stroke-controls button {
    transition: none;
  }

  .letter-demo .stroke-controls button:hover,
  .letter-demo .stroke-controls button:active {
    transform: none;
  }
}
