.primary-listen-write-dialog { width: min(1120px, calc(100vw - 24px)); max-width: 1120px; max-height: calc(100dvh - 24px); margin: auto; padding: 0; overflow: auto; border: 1px solid #dce3d5; border-radius: 24px; background: #fffdf7; color: #233d35; box-shadow: 0 18px 80px #17332645; font-family: 'Nunito', sans-serif; }
.primary-listen-write-dialog::backdrop { background: #163b2d80; backdrop-filter: blur(5px); }
.primary-listen-write-dialog *, .primary-listen-write-dialog *::before, .primary-listen-write-dialog *::after { box-sizing: border-box; }
.primary-listen-write-dialog [hidden] { display: none !important; }
.primary-listen-write-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-listen-write-dialog button:hover:enabled { background: #edf4e8; border-color: #44764d; }
.primary-listen-write-dialog button:disabled { opacity: .48; cursor: default; }
.primary-listen-write-dialog button:focus-visible { outline: 3px solid #3768b6; outline-offset: 3px; }
.primary-listen-write-dialog .plw-primary { color: #fff; background: #286744; border-color: #286744; }
.primary-listen-write-dialog .plw-primary:hover:enabled { background: #205738; border-color: #205738; }
.plw-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 22px 26px; border-bottom: 1px solid #e2e7db; position: sticky; top: 0; z-index: 2; background: #fffdf7; }
.plw-eyebrow { margin: 0 0 6px; color: #58704f; font-size: 11px; font-weight: 900; letter-spacing: 1.2px; }
.plw-header h3 { margin: 0; font-size: clamp(23px, 4vw, 29px); line-height: 1.25; }
.plw-body h4:focus, .plw-header h3:focus { outline: none; }
.primary-listen-write-dialog .plw-close { flex: 0 0 48px; width: 48px; padding: 0; border-radius: 50%; font-size: 30px; font-weight: 600; line-height: 1; }
.plw-body { padding: 24px 26px 28px; }
.plw-body h4 { margin: 0 0 12px; font-size: clamp(23px, 4vw, 29px); line-height: 1.3; text-align: center; }
.plw-intro { margin: 0 0 23px; color: #536b4d; font-size: 17px; line-height: 1.6; text-align: center; }
.plw-levels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.plw-levels button { display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 8px; min-height: 174px; padding: 20px 8px; text-align: center; background: #f4f7ed; }
.plw-levels small { font-size: 12px; font-weight: 800; }
.plw-levels strong { font-size: 20px; line-height: 1.25; }
.plw-levels span:not(.plw-level-stars) { font-size: 13px; font-weight: 700; }
.plw-level-stars { min-height: 31px; color: #387553; font-size: 25px; letter-spacing: 3px; }
.plw-helper { margin: 20px 0 0; color: #536b4d; font-size: 14px; text-align: center; }
.plw-progress-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 18px; color: #536b4d; font-size: 13px; font-weight: 800; }
.plw-progress-row p { margin: 0; }
.plw-level-name { padding: 6px 11px; border-radius: 20px; background: #eaf1e3; }
.plw-paws { display: flex; justify-content: center; gap: 10px; margin: 10px 0 12px; padding: 0; list-style: none; }
.plw-paws li { width: 26px; height: 26px; color: #d5ddcf; }
.plw-paws li.is-complete { color: #387553; }
.plw-paws svg { display: block; width: 100%; height: 100%; fill: currentColor; }
.plw-voice-row { display: grid; grid-template-columns: minmax(0, 1fr) 90px; align-items: center; gap: 8px; height: 64px; padding: 6px 0; }
.plw-voice-row p { margin: 0; color: #536b4d; font-size: 13px; line-height: 1.3; }
.primary-listen-write-dialog .plw-small { min-height: 44px; padding: 8px; font-size: 13px; }
.primary-listen-write-dialog .plw-hear { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; min-height: 54px; margin-top: 10px; font-size: 20px; }
.plw-hear svg { width: 27px; height: 27px; flex: 0 0 27px; }
.plw-clue { position: relative; height: 150px; border: 1px solid #d9e3d4; border-radius: 17px; background: #f2f6ee; }
.plw-clue-placeholder { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; padding: 16px; color: #536b4d; font-size: 16px; line-height: 1.5; text-align: center; }
.plw-clue-content { display: flex; align-items: center; justify-content: center; gap: 20px; height: 100%; padding: 12px; }
.plw-picture-frame { flex: 0 0 auto; }
.plw-picture { display: block; font-family: 'Segoe UI Emoji', 'Apple Color Emoji', sans-serif; font-size: 72px; line-height: 1.2; text-align: center; white-space: nowrap; }
.plw-completed-word { min-width: 0; margin: 0; color: #233d35; font-size: clamp(30px, 4.3vw, 46px); font-weight: 900; letter-spacing: .035em; line-height: 1.2; white-space: nowrap; }
.plw-partial-word { min-width: 0; margin: 0; color: #233d35; font-size: clamp(24px, 3.5vw, 36px); font-weight: 900; line-height: 1.3; white-space: nowrap; }
.plw-clue.is-complete { background: #eaf3e2; border-color: #a7c499; }
.plw-clue.is-complete .plw-completed-word { color: #286744; }
.plw-body .plw-question { margin: 12px 0 10px; font-size: 18px; line-height: 1.35; }
.plw-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: #fff; }
.plw-pad canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; background: #fff; touch-action: none; user-select: none; -webkit-user-select: none; }
.plw-writing-actions { display: grid; grid-template-columns: minmax(80px, .65fr) minmax(0, 1.35fr); gap: 10px; margin: 13px 0 0; }
.plw-writing-actions button { min-height: 54px; }
.plw-writing-actions button, .plw-feedback-actions button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; }
.plw-writing-actions button svg, .plw-feedback-actions button svg { flex: 0 0 23px; width: 23px; height: 23px; }
.plw-feedback-panel { position: relative; margin-top: 20px; padding: 18px; border: 1px solid #d6e2cd; border-radius: 17px; background: #f0f5e9; scroll-margin-top: 125px; }
.plw-feedback-panel[data-kind='wrong'] { background: #fbf2e8; border-color: #ead7c0; }
.plw-feedback-panel p { margin: 0 0 12px; color: #286744; font-size: 21px; font-weight: 900; line-height: 1.4; text-align: center; }
.plw-feedback-panel[data-kind='error'] p { font-size: 16px; }
.plw-feedback-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.plw-feedback-actions button { flex: 1 1 110px; }
.plw-feedback-actions:empty { display: none; }
.plw-stars { position: absolute; top: -33px; left: 0; right: 0; display: flex; justify-content: center; gap: 18px; height: 32px; pointer-events: none; color: #ae851e; font-size: 27px; }
.plw-stars span { animation: plw-star-pop 850ms ease-out both; }
.plw-stars span:nth-child(2) { animation-delay: 90ms; }
.plw-stars span:nth-child(3) { animation-delay: 180ms; }
@keyframes plw-star-pop { 0% { opacity: 0; transform: scale(.65) translateY(7px); } 45% { opacity: 1; transform: scale(1.12) translateY(-4px); } 100% { opacity: 1; transform: scale(1) translateY(0); } }
.primary-listen-write-dialog .plw-change-level { display: block; margin: 20px auto 0; border-color: transparent; background: transparent; font-size: 14px; }
.plw-complete { padding: 18px 0 14px; text-align: center; }
.plw-complete-star { color: #ae851e; font-size: 76px; }
.plw-complete h4 { margin-top: 15px; }
.plw-complete p { margin: 0 0 23px; font-size: 18px; line-height: 1.6; }
.plw-complete-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; }
@media (max-width: 520px) {
  .primary-listen-write-dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); border-radius: 18px; }
  .plw-header { padding: 13px 14px; gap: 10px; }
  .plw-header h3 { font-size: 21px; }
  .plw-body { padding: 14px 12px 18px; }
  .plw-levels { grid-template-columns: 1fr; gap: 10px; }
  .plw-levels button { display: grid; grid-template-columns: 80px 1fr; grid-template-rows: auto auto auto; min-height: 108px; padding: 13px 15px; gap: 3px 10px; text-align: left; }
  .plw-level-stars { grid-row: 1 / 4; align-self: center; font-size: 21px; letter-spacing: 0; }
  .plw-levels strong { font-size: 19px; }
  .plw-intro { font-size: 15px; }
  .plw-paws { margin: 8px 0 10px; gap: 9px; }
  .plw-paws li { width: 23px; height: 23px; }
  .plw-progress-row { gap: 6px; font-size: 12px; }
  .plw-level-name { padding: 5px 8px; }
  .plw-clue { height: 178px; }
  .plw-clue-content { flex-direction: column; gap: 8px; padding: 10px; }
  .plw-picture { font-size: 64px; }
  .plw-completed-word { font-size: clamp(24px, 7.4vw, 34px); letter-spacing: .035em; }
  .plw-partial-word { font-size: clamp(21px, 6vw, 27px); }
  .plw-body .plw-question { margin: 10px 0 8px; font-size: 16px; }
  .plw-pad { height: 250px; min-height: 250px; max-height: 250px; aspect-ratio: auto; }
  .plw-writing-actions { gap: 8px; }
  .plw-writing-actions button { padding: 11px 9px; font-size: 14px; }
  .plw-writing-actions button svg { flex-basis: 20px; width: 20px; height: 20px; }
  .plw-feedback-panel { padding: 17px 12px; }
  .plw-feedback-panel p { font-size: 19px; }
  .plw-voice-row { height: 64px; }
  .primary-listen-write-dialog .plw-change-level { margin-top: 10px; }
}
@media (prefers-reduced-motion: reduce) { .plw-stars span { animation: none; } }

.plw-write-label { margin: 0 0 9px; color: #536b4d; text-align: center; font-size: 17px; font-weight: 800; }
.plw-writing-help { margin: 10px 0 0; color: #536b4d; font-size: 13px; line-height: 1.5; text-align: center; }
@media (max-width: 520px) {
  .plw-body .plw-question { font-size: 19px; }
  .plw-write-label { font-size: 16px; }
  .plw-writing-help { font-size: 12px; }
}
.plw-hint-row { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 15px; }
.plw-hint-row p { margin: 0; color: #536b4d; font-size: 13px; line-height: 1.4; }
.primary-listen-write-dialog .plw-hint { flex: 0 0 auto; background: #edf4e8; }
@media (max-width: 520px) {
  .plw-hint-row { gap: 9px; }
  .plw-hint-row p { font-size: 12px; }
}
.plw-phone-help { display: none; margin: 5px 0 0; color: #536b4d; font-size: 12px; line-height: 1.4; text-align: center; }
@media (max-width: 520px) { .plw-phone-help { display: block; } }
