.primary-word-challenge-dialog { width: min(1120px, calc(100vw - 24px)); max-width: 1120px; max-height: calc(100dvh - 24px); margin: auto; padding: 0; overflow: auto; border: 1px solid #d5e0d3; border-radius: 24px; background: #fffdf7; color: #233d35; box-shadow: 0 18px 80px #17332645; font-family: 'Nunito', sans-serif; }
.primary-word-challenge-dialog::backdrop { background: #163b2d80; backdrop-filter: blur(5px); }
.primary-word-challenge-dialog *, .primary-word-challenge-dialog *::before, .primary-word-challenge-dialog *::after { box-sizing: border-box; }
.primary-word-challenge-dialog [hidden] { display: none !important; }
.primary-word-challenge-dialog button { min-height: 48px; padding: 12px 17px; border: 1px solid #b8cbb3; border-radius: 13px; background: #fffefb; color: #286744; font: 800 16px/1.3 'Nunito', sans-serif; cursor: pointer; }
.primary-word-challenge-dialog button:hover:enabled { background: #edf4e8; border-color: #44764d; }
.primary-word-challenge-dialog button:disabled { opacity: .48; cursor: default; }
.primary-word-challenge-dialog button:focus-visible { outline: 3px solid #3768b6; outline-offset: 3px; }
.primary-word-challenge-dialog .pwc-primary { color: white; background: #286744; border-color: #286744; }
.primary-word-challenge-dialog .pwc-primary:hover:enabled { background: #205738; border-color: #205738; }
.pwc-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 20px 26px; border-bottom: 1px solid #e2e7db; position: sticky; top: 0; z-index: 2; background: #fffdf7; }
.pwc-eyebrow { margin: 0 0 6px; color: #58704f; font-size: 11px; font-weight: 900; letter-spacing: 1px; }
.pwc-header h3 { margin: 0; font-size: clamp(23px, 4vw, 29px); line-height: 1.25; }
.pwc-body h4:focus, .pwc-header h3:focus { outline: none; }
.primary-word-challenge-dialog .pwc-close { flex: 0 0 48px; width: 48px; padding: 0; border-radius: 50%; font-size: 30px; font-weight: 600; line-height: 1; }
.pwc-body { padding: 23px 26px 26px; }
.pwc-body h4 { margin: 0 0 12px; font-size: clamp(22px, 4vw, 28px); line-height: 1.3; text-align: center; }
.pwc-intro { margin: 0 0 22px; color: #536b4d; font-size: 17px; line-height: 1.5; text-align: center; }
.pwc-levels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.pwc-levels button { display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 9px; min-height: 190px; padding: 20px 12px; background: #f2f6ea; text-align: center; }
.pwc-level-stars { color: #a58528; font-size: 24px; letter-spacing: 3px; }
.pwc-levels small { color: #58704f; font-size: 12px; font-weight: 900; }
.pwc-levels strong { font-size: 21px; line-height: 1.25; }
.pwc-levels button > span:last-child { color: #536b4d; font-size: 14px; font-weight: 700; }
.pwc-helper { margin: 20px 0 0; color: #536b4d; font-size: 14px; text-align: center; }
.pwc-progress-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 15px; color: #536b4d; font-size: 13px; font-weight: 800; }
.pwc-progress-row p { margin: 0; }
.pwc-level-name { padding: 6px 11px; border-radius: 20px; background: #eaf1e3; }
.pwc-progress { display: flex; justify-content: center; gap: 9px; margin: 10px 0 14px; padding: 0; list-style: none; }
.pwc-progress li { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #e4e9df; color: #60735a; font-size: 13px; font-weight: 800; }
.pwc-progress li.is-complete { background: #387553; color: white; }
.pwc-question-card { padding: 20px; border: 1px solid #d9e2d1; border-radius: 18px; background: #f3f6eb; text-align: center; }
.pwc-type { margin: 0 0 10px; color: #547145; font-size: 12px; font-weight: 900; letter-spacing: .055em; }
.pwc-question-card h4 { margin: 0; font-size: clamp(20px, 3vw, 26px); }
.pwc-prompt { max-width: 100%; margin: 17px 0 10px; color: #244d38; font-size: clamp(27px, 4vw, 40px); font-weight: 900; line-height: 1.55; letter-spacing: .035em; white-space: pre-wrap; overflow-wrap: anywhere; }
.pwc-prompt span { border-radius: 4px; }
.pwc-prompt .is-highlighted { background: #ffe49a; box-shadow: 0 2px 0 #b78c28; color: #3c512e; }
.pwc-clue { max-width: 750px; margin: 12px auto 0; color: #465d42; font-size: 18px; font-weight: 700; line-height: 1.55; white-space: pre-line; }
.pwc-picture-frame { margin: 14px auto 0; }
.pwc-picture { display: block; font-family: 'Segoe UI Emoji', 'Apple Color Emoji', sans-serif; font-size: 100px; line-height: 1.1; text-align: center; }
.pwc-picture svg { max-width: 100%; }
.pwc-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 18px; }
.primary-word-challenge-dialog .pwc-choices button { min-width: 0; min-height: 65px; font-size: clamp(20px, 3vw, 27px); overflow-wrap: anywhere; }
.primary-word-challenge-dialog .pwc-choices button.is-retry { background: #faf0e2; border-color: #caa779; }
.pwc-hint-row { display: flex; align-items: flex-start; gap: 13px; margin: 17px 0; padding: 13px; border: 1px solid #e4d6ae; border-radius: 14px; background: #fff8e6; }
.pwc-hint-row button { flex: 0 0 auto; }
.pwc-hint-content { min-width: 0; flex: 1; color: #66532a; }
.pwc-hint-content p { margin: 0; font-size: 15px; font-weight: 700; line-height: 1.5; }
.pwc-hint-content p + p { margin-top: 7px; }
.pwc-model { max-width: 100%; margin: 17px 0 10px; color: #286744; font-size: clamp(27px, 4.5vw, 43px); font-weight: 900; letter-spacing: .04em; line-height: 1.2; text-align: center; overflow-wrap: anywhere; }
.pwc-write-label { margin: 16px 0 10px; color: #4b6743; text-align: center; font-size: 17px; font-weight: 800; }
.pwc-pad { position: relative; width: 100%; aspect-ratio: 3.8; min-height: 265px; max-height: 320px; overflow: hidden; border: 2px solid #a6b9a0; border-radius: 18px; background: white; scroll-margin-top: 150px; }
.pwc-pad canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; background: white; touch-action: none; user-select: none; -webkit-user-select: none; }
.pwc-writing-help { margin: 10px 0 0; color: #536b4d; font-size: 13px; line-height: 1.5; text-align: center; }
.pwc-phone-help { display: none; }
.pwc-writing-actions { display: grid; grid-template-columns: minmax(80px, .65fr) minmax(0, 1.35fr); gap: 10px; margin: 13px 0 0; }
.pwc-writing-actions button { min-height: 54px; }
.pwc-voice-row { display: grid; grid-template-columns: minmax(0, 1fr) 90px; align-items: center; gap: 8px; min-height: 64px; padding: 5px 0; }
.pwc-voice-row p { margin: 0; color: #536b4d; font-size: 13px; line-height: 1.4; }
.primary-word-challenge-dialog .pwc-small { min-height: 44px; padding: 8px; font-size: 13px; }
.pwc-answer { padding: 16px; border: 1px solid #a7c499; border-radius: 17px; background: #eaf3e2; text-align: center; }
.pwc-answer-label, .pwc-completed-label { margin: 0 0 5px; color: #536b4d; font-size: 13px; font-weight: 800; }
.pwc-word, .pwc-completed-word { margin: 0; color: #286744; font-size: clamp(27px, 4.5vw, 43px); font-weight: 900; letter-spacing: .04em; line-height: 1.25; overflow-wrap: anywhere; }
.pwc-completed-label { margin-top: 13px; }
.pwc-explanation { max-width: 760px; margin: 12px auto 0; color: #3e6248; font-size: 17px; line-height: 1.5; }
.pwc-feedback-panel { position: relative; margin-top: 20px; padding: 18px; border: 1px solid #d6e2cd; border-radius: 17px; background: #f0f5e9; scroll-margin-top: 150px; }
.pwc-feedback-panel[data-kind='wrong'] { background: #fbf2e8; border-color: #ead7c0; }
.pwc-feedback-panel p { margin: 0; color: #286744; font-size: 21px; font-weight: 900; line-height: 1.4; text-align: center; }
.pwc-feedback-panel[data-kind='error'] p { font-size: 16px; }
.pwc-feedback-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.pwc-feedback-actions button { flex: 1 1 120px; margin-top: 12px; }
.pwc-stars { position: absolute; top: -32px; left: 0; right: 0; height: 32px; pointer-events: none; color: #ae851e; font-size: 27px; text-align: center; letter-spacing: 10px; animation: pwc-star-pop 650ms ease-out both; }
@keyframes pwc-star-pop { from { opacity: 0; transform: scale(.7); } to { opacity: 1; transform: scale(1); } }
.primary-word-challenge-dialog .pwc-change-level { display: block; margin: 18px auto 0; border-color: transparent; background: transparent; font-size: 14px; }
.pwc-complete { padding: 18px 0 14px; text-align: center; }
.pwc-complete-star { color: #ae851e; font-size: 76px; }
.pwc-complete h4 { margin-top: 15px; }
.pwc-complete p { margin: 0 0 23px; font-size: 18px; line-height: 1.6; }
.pwc-complete-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; }
@media (max-width: 520px) {
  .primary-word-challenge-dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); border-radius: 18px; }
  .pwc-header { padding: 13px 14px; gap: 8px; }
  .pwc-header h3 { font-size: 23px; }
  .pwc-eyebrow { font-size: 9px; letter-spacing: .7px; }
  .pwc-body { padding: 14px 12px 18px; }
  .pwc-levels { grid-template-columns: 1fr; gap: 10px; }
  .pwc-levels button { display: grid; grid-template-columns: 64px 1fr; grid-template-rows: auto auto auto; min-height: 114px; padding: 13px; gap: 4px 10px; text-align: left; }
  .pwc-level-stars { grid-row: 1 / 4; align-self: center; font-size: 21px; letter-spacing: 0; }
  .pwc-levels strong { font-size: 19px; }
  .pwc-levels button > span:last-child { font-size: 13px; }
  .pwc-intro { font-size: 15px; }
  .pwc-progress-row { font-size: 12px; }
  .pwc-level-name { padding: 5px 8px; }
  .pwc-progress { margin: 8px 0 10px; }
  .pwc-question-card { padding: 14px 11px; }
  .pwc-question-card h4 { font-size: 21px; }
  .pwc-type { font-size: 11px; }
  .pwc-prompt { margin-top: 12px; font-size: clamp(24px, 6.9vw, 33px); letter-spacing: .015em; }
  .pwc-clue { font-size: 16px; }
  .pwc-picture { font-size: 82px; }
  .pwc-choices { grid-template-columns: 1fr; gap: 8px; }
  .primary-word-challenge-dialog .pwc-choices button { min-height: 56px; padding: 10px; font-size: 23px; }
  .pwc-hint-row { flex-wrap: wrap; gap: 10px; }
  .pwc-hint-content { flex-basis: 170px; }
  .pwc-hint-content p { font-size: 14px; }
  .pwc-model, .pwc-word, .pwc-completed-word { font-size: clamp(24px, 6.6vw, 32px); letter-spacing: .025em; }
  .pwc-pad { height: 250px; min-height: 250px; max-height: 250px; aspect-ratio: auto; }
  .pwc-writing-help { font-size: 12px; }
  .pwc-phone-help { display: block; margin-top: 4px; }
  .pwc-writing-actions { gap: 8px; }
  .pwc-writing-actions button { padding: 11px 9px; font-size: 14px; }
  .pwc-feedback-panel { padding: 17px 12px; }
  .pwc-feedback-panel p { font-size: 19px; }
  .pwc-explanation { font-size: 16px; }
  .primary-word-challenge-dialog .pwc-change-level { margin-top: 10px; }
}
@media (prefers-reduced-motion: reduce) { .pwc-stars { animation: none; } }

/* Room for confident handwriting, with matching Clear and Undo controls. */
.pwc-pad { height:360px; min-height:360px; }
.pwc-writing-actions { grid-template-columns:minmax(70px,.7fr) minmax(70px,.7fr) minmax(0,1.6fr); }
@media (max-width:600px) {
  .pwc-pad { height:300px; min-height:300px; }
  .pwc-writing-actions { gap:8px; }
  .pwc-writing-actions button { min-width:0; padding:12px 8px; }
}

.pwc-body [data-pwc-hear] { display: block; margin: 14px auto; }
.pwc-body [data-pwc-response-bank] { margin: 18px 0; padding: 16px; border: 1px solid #d5e0d3; border-radius: 16px; background: #f2f6ea; text-align: center; }
.pwc-body [data-pwc-response-bank] > p:first-child { font-size: 17px; font-weight: 800; }

/* Keep translated writing controls readable on narrow screens. */
@media (max-width:600px) {
  .pwc-writing-actions { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .pwc-writing-actions > .pwc-primary { grid-column: 1 / -1; }
}
