.build-write-word-dialog { width: min(940px, calc(100vw - 24px)); max-width: 940px; 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; }
.build-write-word-dialog::backdrop { background: #163b2d80; backdrop-filter: blur(5px); }
.build-write-word-dialog *, .build-write-word-dialog *::before, .build-write-word-dialog *::after { box-sizing: border-box; }
.build-write-word-dialog [hidden] { display: none !important; }
.build-write-word-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; }
.build-write-word-dialog button:hover:enabled { background: #edf4e8; border-color: #44764d; }
.build-write-word-dialog button:disabled { opacity: .48; cursor: default; }
.build-write-word-dialog button:focus-visible, .build-write-word-dialog summary:focus-visible { outline: 3px solid #3768b6; outline-offset: 3px; }
.build-write-word-dialog .bww-primary { color: white; background: #286744; border-color: #286744; }
.build-write-word-dialog .bww-primary:hover:enabled { background: #205738; border-color: #205738; }
.bww-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; }
.bww-eyebrow { margin: 0 0 6px; color: #58704f; font-size: 11px; font-weight: 900; letter-spacing: 1px; }
.bww-header h3 { margin: 0; font-size: clamp(23px, 4vw, 29px); line-height: 1.25; }
.bww-body h4:focus, .bww-header h3:focus { outline: none; }
.build-write-word-dialog .bww-close { flex: 0 0 48px; width: 48px; padding: 0; border-radius: 50%; font-size: 30px; font-weight: 600; line-height: 1; }
.bww-body { padding: 23px 26px 26px; }
.bww-body h4 { margin: 0 0 12px; font-size: clamp(22px, 4vw, 28px); line-height: 1.3; text-align: center; }
.bww-intro { margin: 0 0 22px; color: #536b4d; font-size: 17px; line-height: 1.5; text-align: center; }
.bww-levels { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.bww-levels button, .bww-optional 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; }
.bww-levels small, .bww-optional small { color: #58704f; font-size: 12px; font-weight: 900; }
.bww-levels strong, .bww-optional strong { font-size: 21px; line-height: 1.25; }
.bww-levels span, .bww-optional button span { font-size: 14px; font-weight: 700; }
.bww-optional { margin-top: 20px; padding: 0 16px 14px; border: 1px solid #ddcfb1; border-radius: 15px; background: #fff7e5; }
.bww-optional:not([open]) { padding-bottom: 0; }
.bww-optional summary { min-height: 48px; padding: 14px 0; color: #725922; font-weight: 800; cursor: pointer; }
.bww-optional p { margin: 0 0 12px; font-size: 14px; color: #665d43; }
.bww-optional button { width: 100%; min-height: 112px; background: #fffdf7; }
.bww-helper { margin: 20px 0 0; color: #536b4d; font-size: 14px; text-align: center; }
.bww-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; }
.bww-progress-row p { margin: 0; }
.bww-level-name { padding: 6px 11px; border-radius: 20px; background: #eaf1e3; }
.bww-progress { display: flex; justify-content: center; gap: 9px; margin: 10px 0 13px; padding: 0; list-style: none; }
.bww-progress li { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: #e4e9df; color: #60735a; font-size: 13px; font-weight: 800; }
.bww-progress li.is-complete { background: #387553; color: white; }
.bww-picture-row { display: flex; justify-content: center; align-items: center; gap: 28px; min-height: 100px; padding: 8px 14px; border: 1px solid #e1deca; border-radius: 18px; background: #faf4df; }
.bww-picture { flex: 0 0 90px; font-family: 'Segoe UI Emoji', 'Apple Color Emoji', sans-serif; font-size: 74px; line-height: 1; text-align: center; }
.build-write-word-dialog .bww-hear { display: inline-flex; align-items: center; justify-content: center; gap: 9px; min-height: 49px; background: #fffdf7; }
.bww-hear svg { flex: 0 0 23px; width: 23px; height: 23px; }
.bww-voice-row { display: grid; grid-template-columns: minmax(0, 1fr) 90px; align-items: center; gap: 8px; height: 62px; padding: 5px 0; }
.bww-voice-row p { margin: 0; color: #536b4d; font-size: 13px; line-height: 1.3; }
.build-write-word-dialog .bww-small { min-height: 44px; padding: 8px; font-size: 13px; }
.bww-tile-help { margin: -3px auto 16px; max-width: 430px; color: #536b4d; font-size: 15px; line-height: 1.5; text-align: center; }
.bww-slots, .bww-bank { display: flex; align-items: center; justify-content: center; gap: 12px; }
.bww-slots { min-height: 66px; margin: 0 auto; }
.bww-bank { min-height: 86px; padding: 10px; border: 2px solid #e0dfd2; border-radius: 16px; background: #f5f2e8; }
.bww-bank-label { margin: 19px 0 7px; color: #67735d; font-size: 11px; font-weight: 900; letter-spacing: 1.2px; text-align: center; }
.build-write-word-dialog .bww-tile, .build-write-word-dialog .bww-slot { flex: 0 1 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; }
.build-write-word-dialog .bww-tile { background: #fffefa; box-shadow: 0 3px 0 #d6dece; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; }
.build-write-word-dialog .bww-slot { background: #edf3e7; border-color: #bccdb4; }
.bww-slot span { color: #84947c; font-size: 16px; font-weight: 700; }
.build-write-word-dialog .bww-tile.is-selected { border-color: #735098; background: #eee3f7; box-shadow: 0 0 0 2px #b99bcc; }
.build-write-word-dialog .bww-tile.is-dragging { opacity: .35; }
.build-write-word-dialog .is-drop-target { outline: 3px solid #735098; outline-offset: 2px; }
.bww-bank-empty { max-width: 340px; color: #6d745f; font-size: 13px; line-height: 1.4; text-align: center; }
.bww-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; }
.bww-tile-tools { display: flex; justify-content: center; gap: 12px; margin-top: 12px; }
.build-write-word-dialog .bww-tile-tools button { min-height: 44px; padding: 9px 16px; font-size: 14px; }
.build-write-word-dialog .bww-check-word { display: block; width: min(100%, 420px); min-height: 52px; margin: 18px auto 0; font-size: 18px; }
.bww-model { margin: 6px 0 18px; color: #286744; font-size: clamp(38px, 7vw, 54px); font-weight: 900; letter-spacing: .12em; line-height: 1.2; text-align: center; }
.bww-pad { position: relative; width: 100%; aspect-ratio: 2.8; min-height: 235px; max-height: 300px; overflow: hidden; border: 2px solid #a6b9a0; border-radius: 18px; background: white; scroll-margin-top: 160px; }
.bww-pad canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; background: white; touch-action: none; user-select: none; -webkit-user-select: none; }
.bww-writing-help { margin: 10px 0 0; color: #536b4d; font-size: 13px; line-height: 1.5; text-align: center; }
.bww-writing-actions { display: grid; grid-template-columns: minmax(80px, .65fr) minmax(0, 1.35fr); gap: 10px; margin: 13px 0 0; }
.bww-writing-actions button { min-height: 54px; }
.bww-feedback-panel { position: relative; margin-top: 20px; padding: 18px; border: 1px solid #d6e2cd; border-radius: 17px; background: #f0f5e9; scroll-margin-top: 160px; }
.bww-feedback-panel[data-kind='wrong'] { background: #fbf2e8; border-color: #ead7c0; }
.bww-feedback-panel p { margin: 0; color: #286744; font-size: 21px; font-weight: 900; line-height: 1.4; text-align: center; }
.bww-feedback-panel[data-kind='error'] p { font-size: 16px; }
.bww-feedback-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.bww-feedback-actions button { flex: 1 1 120px; margin-top: 12px; }
.bww-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: bww-star-pop 650ms ease-out both; }
@keyframes bww-star-pop { from { opacity: 0; transform: scale(.7); } to { opacity: 1; transform: scale(1); } }
.build-write-word-dialog .bww-change-level { display: block; margin: 18px auto 0; border-color: transparent; background: transparent; font-size: 14px; }
.bww-complete { padding: 18px 0 14px; text-align: center; }
.bww-complete-star { color: #ae851e; font-size: 76px; }
.bww-complete h4 { margin-top: 15px; }
.bww-complete p { margin: 0 0 23px; font-size: 18px; line-height: 1.6; }
.bww-complete-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; }
@media (max-width: 520px) {
  .build-write-word-dialog { width: calc(100vw - 16px); max-height: calc(100dvh - 16px); border-radius: 18px; }
  .bww-header { padding: 13px 14px; gap: 8px; }
  .bww-header h3 { font-size: 21px; }
  .bww-eyebrow { font-size: 9px; letter-spacing: .7px; }
  .bww-body { padding: 14px 12px 18px; }
  .bww-levels { grid-template-columns: 1fr; gap: 10px; }
  .bww-levels button { min-height: 108px; padding: 13px 15px; gap: 5px; }
  .bww-levels strong, .bww-optional strong { font-size: 20px; }
  .bww-levels span, .bww-optional button span { font-size: 13px; }
  .bww-intro { font-size: 15px; }
  .bww-optional { padding-left: 12px; padding-right: 12px; }
  .bww-optional summary { font-size: 14px; }
  .bww-progress-row { font-size: 12px; }
  .bww-level-name { padding: 5px 8px; }
  .bww-progress { margin: 8px 0 10px; }
  .bww-picture-row { gap: 12px; min-height: 84px; padding: 8px; }
  .bww-picture { flex-basis: 67px; font-size: 60px; }
  .build-write-word-dialog .bww-hear { gap: 5px; padding: 10px 9px; font-size: 14px; }
  .bww-hear svg { flex-basis: 20px; width: 20px; height: 20px; }
  .bww-voice-row { height: 68px; }
  .bww-body h4 { font-size: 22px; }
  .bww-tile-help { margin-bottom: 12px; font-size: 13px; }
  .bww-slots, .bww-bank { gap: 6px; }
  .bww-slots { min-height: 50px; }
  .bww-bank { min-height: 74px; padding: 10px 6px; }
  .build-write-word-dialog .bww-tile, .build-write-word-dialog .bww-slot { flex-basis: 50px; width: 50px; height: 50px; min-height: 50px; font-size: 26px; border-radius: 10px; }
  .bww-bank-label { margin-top: 15px; }
  .bww-tile-tools { gap: 8px; }
  .build-write-word-dialog .bww-tile-tools button { padding: 9px 11px; font-size: 13px; }
  .build-write-word-dialog .bww-check-word { margin-top: 14px; }
  .bww-model { font-size: 38px; margin-bottom: 14px; letter-spacing: .10em; }
  .bww-pad { height: 220px; min-height: 220px; max-height: 220px; aspect-ratio: auto; }
  .bww-writing-help { font-size: 12px; }
  .bww-writing-actions { gap: 8px; }
  .bww-writing-actions button { padding: 11px 9px; font-size: 14px; }
  .bww-feedback-panel { padding: 17px 12px; }
  .bww-feedback-panel p { font-size: 19px; }
  .build-write-word-dialog .bww-change-level { margin-top: 10px; }
}
@media (prefers-reduced-motion: reduce) { .bww-stars { animation: none; } }
