.primary-unscramble-words-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-unscramble-words-dialog::backdrop { background: #163b2d80; backdrop-filter: blur(5px); }
.primary-unscramble-words-dialog *, .primary-unscramble-words-dialog *::before, .primary-unscramble-words-dialog *::after { box-sizing: border-box; }
.primary-unscramble-words-dialog [hidden] { display: none !important; }
.primary-unscramble-words-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-unscramble-words-dialog button:hover:enabled { background: #edf4e8; border-color: #44764d; }
.primary-unscramble-words-dialog button:disabled { opacity: .48; cursor: default; }
.primary-unscramble-words-dialog button:focus-visible { outline: 3px solid #3768b6; outline-offset: 3px; }
.primary-unscramble-words-dialog .puw-primary { color: white; background: #286744; border-color: #286744; }
.primary-unscramble-words-dialog .puw-primary:hover:enabled { background: #205738; border-color: #205738; }
.puw-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; }
.puw-eyebrow { margin: 0 0 6px; color: #58704f; font-size: 11px; font-weight: 900; letter-spacing: 1px; }
.puw-header h3 { margin: 0; font-size: clamp(23px, 4vw, 29px); line-height: 1.25; }
.puw-body h4:focus, .puw-header h3:focus { outline: none; }
.primary-unscramble-words-dialog .puw-close { flex: 0 0 48px; width: 48px; padding: 0; border-radius: 50%; font-size: 30px; font-weight: 600; line-height: 1; }
.puw-body { padding: 23px 26px 26px; }
.puw-body h4 { margin: 0 0 12px; font-size: clamp(22px, 4vw, 28px); line-height: 1.3; text-align: center; }
.puw-intro { margin: 0 0 22px; color: #536b4d; font-size: 17px; line-height: 1.5; text-align: center; }
.puw-levels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.puw-levels button { display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 10px; min-height: 160px; padding: 20px 12px; text-align: center; background: #f2f6ea; }
.puw-levels small { color: #58704f; font-size: 12px; font-weight: 900; }
.puw-levels strong { font-size: 21px; line-height: 1.25; }
.puw-levels span { font-size: 14px; font-weight: 700; }
.puw-helper { margin: 20px 0 0; color: #536b4d; font-size: 14px; text-align: center; }
.puw-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; }
.puw-progress-row p { margin: 0; }
.puw-level-name { padding: 6px 11px; border-radius: 20px; background: #eaf1e3; }
.puw-progress { display: flex; justify-content: center; gap: 9px; margin: 10px 0 13px; padding: 0; list-style: none; }
.puw-progress li { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #e4e9df; color: #60735a; font-size: 13px; font-weight: 800; }
.puw-progress li.is-complete { background: #387553; color: white; }
.puw-picture-row { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 16px 28px; min-height: 124px; padding: 8px 14px; border: 1px solid #dbe6d5; border-radius: 18px; background: #f1f6ea; }
.puw-picture { display: block; max-width: 100%; font-family: 'Segoe UI Emoji', 'Apple Color Emoji', sans-serif; font-size: 92px; line-height: 1.1; text-align: center; }
.puw-picture svg { display: block; width: 112px; height: 112px; }
.primary-unscramble-words-dialog .puw-hear { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 49px; background: #fffdf7; }
.puw-hear svg { flex: 0 0 23px; width: 23px; height: 23px; }
.puw-voice-row { display: grid; grid-template-columns: minmax(0, 1fr) 90px; align-items: center; gap: 8px; height: 62px; padding: 5px 0; }
.puw-voice-row p { margin: 0; color: #536b4d; font-size: 13px; line-height: 1.3; }
.primary-unscramble-words-dialog .puw-small { min-height: 44px; padding: 8px; font-size: 13px; }
.puw-tile-help { margin: -3px auto 16px; max-width: 430px; color: #536b4d; font-size: 15px; line-height: 1.5; text-align: center; }
.puw-slots, .puw-bank { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 10px; }
.puw-slots { min-height: 66px; margin: 0 auto; }
.puw-bank { min-height: 86px; padding: 10px; border: 2px solid #e0dfd2; border-radius: 16px; background: #f5f2e8; }
.puw-bank-label { margin: 19px 0 7px; color: #67735d; font-size: 11px; font-weight: 900; letter-spacing: 1.2px; text-align: center; }
.primary-unscramble-words-dialog .puw-tile, .primary-unscramble-words-dialog .puw-slot { position: relative; flex: 0 0 64px; width: 64px; min-width: 44px; height: 64px; min-height: 64px; padding: 5px; border: 2px solid #a5b7a1; border-radius: 12px; font-size: 30px; line-height: 1; }
.primary-unscramble-words-dialog .puw-tile { background: #fffefa; box-shadow: 0 3px 0 #d6dece; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.puw-tile[data-puw-slot] { padding-bottom: 15px; }
.puw-tile small { position: absolute; bottom: 4px; left: 0; width: 100%; color: #5b7353; font-size: 10px; line-height: 1; font-weight: 700; text-align: center; }
.primary-unscramble-words-dialog .puw-tile.is-fixed { opacity: 1; cursor: default; touch-action: pan-y; color: #205d3e; background: #deecd6; border-color: #39754e; box-shadow: none; }
.primary-unscramble-words-dialog .puw-slot { background: #edf3e7; border-color: #bccdb4; }
.puw-slot span { color: #84947c; font-size: 16px; font-weight: 700; }
.primary-unscramble-words-dialog .puw-tile.is-selected { border-color: #735098; background: #eee3f7; box-shadow: 0 0 0 2px #b99bcc; }
.primary-unscramble-words-dialog .puw-tile.is-dragging { opacity: .35; }
.primary-unscramble-words-dialog .is-drop-target { outline: 3px solid #735098; outline-offset: 2px; }
.puw-bank-empty { max-width: 340px; color: #6d745f; font-size: 13px; line-height: 1.4; text-align: center; }
.puw-drag-ghost { position: fixed; z-index: 20; display: grid; place-items: center; width: 62px; height: 62px; border: 2px solid #735098; border-radius: 12px; background: #fff8e3; color: #286744; box-shadow: 0 5px 20px #233d3555; transform: translate(-50%, -55%); pointer-events: none; font-size: 30px; font-weight: 900; }
.puw-tile-tools { display: flex; justify-content: center; gap: 12px; margin-top: 12px; }
.primary-unscramble-words-dialog .puw-tile-tools button { min-height: 44px; padding: 9px 16px; font-size: 14px; }
.primary-unscramble-words-dialog .puw-check-word { display: block; width: min(100%, 420px); min-height: 52px; margin: 18px auto 0; font-size: 18px; }
.puw-hint-row { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 16px; padding: 13px; border: 1px solid #d5dfce; border-radius: 14px; background: #f3f6eb; }
.puw-hint-row > div { min-width: 0; }
.puw-hint-row button { flex-shrink: 0; }
.puw-hint-row p { margin: 0; color: #4a6542; font-size: 14px; line-height: 1.5; }
.puw-hint-row .puw-compound-hint { margin-top: 8px; color: #286744; font-size: clamp(18px, 3vw, 24px); font-weight: 900; overflow-wrap: anywhere; }
.puw-model { max-width: 100%; margin: 6px 0 18px; color: #286744; font-size: clamp(29px, 5vw, 46px); font-weight: 900; letter-spacing: .04em; line-height: 1.2; text-align: center; overflow-wrap: anywhere; }
.puw-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: 160px; }
.puw-pad canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; background: white; touch-action: none; user-select: none; -webkit-user-select: none; }
.puw-writing-help { margin: 10px 0 0; color: #536b4d; font-size: 13px; line-height: 1.5; text-align: center; }
.puw-phone-help { display: none; }
.puw-writing-actions { display: grid; grid-template-columns: minmax(80px, .65fr) minmax(0, 1.35fr); gap: 10px; margin: 13px 0 0; }
.puw-writing-actions button { min-height: 54px; }
.puw-feedback-panel { position: relative; margin-top: 20px; padding: 18px; border: 1px solid #d6e2cd; border-radius: 17px; background: #f0f5e9; scroll-margin-top: 160px; }
.puw-feedback-panel[data-kind='wrong'] { background: #fbf2e8; border-color: #ead7c0; }
.puw-feedback-panel p { margin: 0; color: #286744; font-size: 21px; font-weight: 900; line-height: 1.4; text-align: center; }
.puw-feedback-panel[data-kind='error'] p { font-size: 16px; }
.puw-feedback-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.puw-feedback-actions button { flex: 1 1 120px; margin-top: 12px; }
.puw-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: puw-star-pop 650ms ease-out both; }
@keyframes puw-star-pop { from { opacity: 0; transform: scale(.7); } to { opacity: 1; transform: scale(1); } }
.primary-unscramble-words-dialog .puw-change-level { display: block; margin: 18px auto 0; border-color: transparent; background: transparent; font-size: 14px; }
.puw-complete { padding: 18px 0 14px; text-align: center; }
.puw-complete-star { color: #ae851e; font-size: 76px; }
.puw-complete h4 { margin-top: 15px; }
.puw-complete p { margin: 0 0 23px; font-size: 18px; line-height: 1.6; }
.puw-complete-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; }
@media (max-width: 520px) {
  .primary-unscramble-words-dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); border-radius: 18px; }
  .puw-header { padding: 13px 14px; gap: 8px; }
  .puw-header h3 { font-size: 21px; }
  .puw-eyebrow { font-size: 9px; letter-spacing: .7px; }
  .puw-body { padding: 14px 12px 18px; }
  .puw-levels { grid-template-columns: 1fr; gap: 10px; }
  .puw-levels button { min-height: 108px; padding: 13px 15px; gap: 5px; }
  .puw-levels strong { font-size: 20px; }
  .puw-levels span { font-size: 13px; }
  .puw-intro { font-size: 15px; }
  .puw-progress-row { font-size: 12px; }
  .puw-level-name { padding: 5px 8px; }
  .puw-progress { margin: 8px 0 10px; }
  .puw-picture-row { gap: 12px; min-height: 104px; padding: 8px; }
  .puw-picture { font-size: 78px; }
  .puw-picture svg { width: 90px; height: 90px; }
  .primary-unscramble-words-dialog .puw-hear { gap: 5px; padding: 10px 9px; font-size: 14px; }
  .puw-hear svg { flex-basis: 20px; width: 20px; height: 20px; }
  .puw-voice-row { height: 68px; }
  .puw-body h4 { font-size: 22px; }
  .puw-tile-help { margin-bottom: 12px; font-size: 13px; }
  .puw-slots, .puw-bank { gap: 6px; }
  .puw-slots { min-height: 50px; }
  .puw-bank { min-height: 74px; padding: 10px 6px; }
  .primary-unscramble-words-dialog .puw-tile, .primary-unscramble-words-dialog .puw-slot { flex-basis: 46px; width: 46px; height: 52px; min-height: 52px; font-size: 26px; border-radius: 10px; }
  .puw-bank-label { margin-top: 15px; }
  .puw-tile-tools { gap: 8px; }
  .primary-unscramble-words-dialog .puw-tile-tools button { padding: 9px 11px; font-size: 13px; }
  .primary-unscramble-words-dialog .puw-check-word { margin-top: 14px; }
  .puw-model { font-size: clamp(23px, 6vw, 30px); margin-bottom: 14px; letter-spacing: .025em; }
  .puw-pad { height: 250px; min-height: 250px; max-height: 250px; aspect-ratio: auto; }
  .puw-hint-row { align-items: flex-start; flex-wrap: wrap; padding: 11px; }
  .puw-hint-row > div { flex: 1 1 170px; }
  .puw-hint-row p { font-size: 13px; }
  .puw-phone-help { display: block; margin-top: 4px; }
  .puw-writing-help { font-size: 12px; }
  .puw-writing-actions { gap: 8px; }
  .puw-writing-actions button { padding: 11px 9px; font-size: 14px; }
  .puw-feedback-panel { padding: 17px 12px; }
  .puw-feedback-panel p { font-size: 19px; }
  .primary-unscramble-words-dialog .puw-change-level { margin-top: 10px; }
}
@media (prefers-reduced-motion: reduce) { .puw-stars { animation: none; } }
