.word-main { padding-block: 15px 28px; }
.word-intro { display: flex; align-items: end; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.word-intro h1 { font-size: clamp(2.25rem, 6vw, 4rem); letter-spacing: -.07em; line-height: 1.02; }
.word-layout { display: grid; grid-template-columns: minmax(210px, 256px) minmax(0, 1fr); align-items: start; gap: 14px; }
.word-settings, .word-cabinet { border: 1px solid #d5e4f3; border-radius: 20px; background: #fcfeff; box-shadow: 0 10px 28px #4868870b; }
.word-settings { padding: 13px; }
.word-guide, .word-tip { display: flex; align-items: center; gap: 9px; border-radius: 13px; }
.word-guide { padding: 8px; min-height: 81px; background: linear-gradient(120deg, #e1fbf7, #fff2d2); }
.word-guide img { width: 59px; height: 65px; object-fit: contain; }
.word-guide .eyebrow, .word-build .eyebrow, .word-level { color: #325e75; font-size: .65rem; }
.word-guide h2, .word-scorebar h2 { font-size: clamp(1.17rem, 3vw, 1.8rem); letter-spacing: -.045em; line-height: 1.1; }
.word-settings fieldset { display: grid; gap: 6px; padding: 0; margin: 11px 0; border: 0; }
.word-option { display: grid; grid-template-columns: auto auto minmax(0, 1fr); gap: 7px; align-items: center; min-height: 51px; padding: 6px 8px; border: 1px solid #ddd9ee; border-radius: 11px; background: #faf8ff; color: #352853; cursor: pointer; }
.word-option:has(input:checked) { border-color: #8c69c6; background: #f1e9ff; }
.word-option input { width: 16px; height: 16px; margin: 0; accent-color: #6944ac; }
.word-option strong, .word-option small { display: block; line-height: 1.24; }
.word-option strong { font-size: .8rem; }
.word-option small { margin-top: 2px; color: #504565; font-size: .65rem; }
.option-number { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 7px; background: #e8daf8; color: #5a3296; font-size: .78rem; font-weight: 800; }
.word-settings .word-primary { width: 100%; }
.word-tip { margin-top: 11px; padding: 7px 8px; background: #e8f5ff; color: #264a66; font-size: .74rem; line-height: 1.3; }
.word-tip img { width: 32px; height: 43px; object-fit: contain; }
.pending-word, .word-local { margin-top: 7px; color: #514a63; font-size: .73rem; }

.word-cabinet { display: grid; min-width: 0; gap: 8px; padding: 12px; background: linear-gradient(#fff, #f7f4ff); }
.word-scorebar { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 1px 1px 4px; }
.word-stats { display: flex; gap: 5px; }
.word-stats p { min-width: 62px; border: 1px solid #efd7a0; border-radius: 10px; padding: 4px 8px; text-align: center; line-height: 1.15; background: #fff3d8; color: #644512; }
.word-stats .word-best { background: #e8f6ff; border-color: #cee6f5; color: #244c6d; }
.word-stats small { display: block; margin-top: 3px; font-size: .64rem; font-weight: 800; }
.word-progress { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 4px; }
.word-progress[data-compact] { gap: 2px; }
.word-progress span { height: 5px; border-radius: 12px; background: #e5e2f4; }
.word-progress [data-step="active"] { background: #9371cb; }
.word-progress [data-step="solved"] { background: #64b693; }
.word-progress [data-step="star"] { background: #d29b36; }

.word-bench {
  display: grid;
  align-items: stretch;
  min-height: 335px;
  padding: clamp(9px, 2vw, 20px);
  border: 1px solid #d2e6f2;
  border-radius: 15px;
  background:
    linear-gradient(100deg, #e9fcf4ea 5%, #fff4e4ed 59%, #f7efffef),
    url("../assets/paxa-school-city-v1.webp") center 42% / cover;
}
.word-puzzle { display: grid; grid-template-columns: minmax(135px, .7fr) minmax(0, 1.4fr); align-items: center; gap: clamp(12px, 3vw, 30px); }
.word-picture-card {
  display: grid;
  place-items: center;
  gap: 7px;
  width: min(100%, 245px);
  justify-self: center;
  padding: 10px;
  border: 1px solid #d1e3dd;
  border-radius: 17px;
  background: #ffffffde;
  box-shadow: 0 5px 0 #96b3aa2c;
}
.word-picture { width: min(100%, 168px); aspect-ratio: 1; overflow: hidden; border-radius: 14px; }
.word-picture .tile-picture { display: block; width: 100%; height: 100%; background-repeat: no-repeat; background-size: 500% 1000%; }
.word-build { min-width: 0; }
.word-build h3 { margin: 3px 0 4px; font-size: clamp(1.25rem, 3.3vw, 1.78rem); letter-spacing: -.04em; line-height: 1.15; }
.word-clue { color: #493b5b; font-size: .86rem; min-height: 1.4em; }
.word-answer, .word-bank, .word-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.word-answer { margin-block: 13px 10px; }
.word-bank { margin-bottom: 12px; min-height: 51px; }
.word-slot, .word-tile { display: inline-grid; place-items: center; position: relative; min-width: 54px; height: 56px; padding: 4px 7px; border-radius: 11px; font-weight: 800; font-size: clamp(1.2rem, 4vw, 1.55rem); line-height: 1; color: #352255; }
.word-slot { border: 2px dashed #a99abd; background: #ffffffac; }
.word-slot:disabled { cursor: default; }
.word-slot[data-filled] { border: 1px solid #9d81c9; background: #eee2ff; box-shadow: 0 2px 0 #cdb9e8; }
.word-slot[data-correct] { border-color: #76af8d; background: #dcf7e5; color: #225137; box-shadow: 0 2px 0 #afd4be; }
.word-slot small { color: #625675; font-size: .65rem; }
.word-tile { border: 1px solid var(--tile-border); background: var(--tile-bg); box-shadow: 0 3px 0 var(--tile-border); padding-bottom: 11px; }
.word-tile:nth-child(3n+1) { --tile-bg: #e9d9ff; --tile-border: #b496dc; }
.word-tile:nth-child(3n+2) { --tile-bg: #ffefc4; --tile-border: #d5b574; }
.word-tile:nth-child(3n) { --tile-bg: #d8f7f0; --tile-border: #7fbdb0; }
.word-tile small { position: absolute; inset: auto 5px 4px auto; color: #534461; font-size: .57rem; font-weight: 800; }
.word-tile[aria-disabled="true"] { opacity: .42; cursor: default; }
.word-tile[data-hinted]:not([aria-disabled="true"]) { outline: 3px solid #7c51bc; outline-offset: 3px; }
.word-tile:hover:not([aria-disabled="true"]), .word-slot[data-filled]:not(:disabled):hover { filter: brightness(.97); transform: translateY(-1px); }
.word-actions .word-primary { min-width: 100px; }

.word-soft, .word-primary, .word-listen {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 44px; padding: 5px 10px; border-radius: 10px; border: 1px solid #d8c9ee;
  font: 800 .8rem/1.25 Manrope, system-ui, sans-serif; text-align: center;
}
.word-soft { background: #f8f1ff; color: #573586; }
.word-listen { width: 100%; border-color: #add5cc; background: #e7faf4; color: #205a56; }
.word-primary { border-color: #7147ad; background: #64409c; color: #fff; }
.word-primary:hover:not(:disabled) { background: #532c8a; }
.word-soft:hover:not(:disabled) { background: #efe2ff; }
.word-listen:hover { background: #d4f2e9; }
.word-actions :disabled { opacity: .57; cursor: default; }

.word-toolbar { display: flex; align-items: stretch; gap: 6px; min-width: 0; }
.word-display { display: flex; gap: 5px; align-items: center; flex: none; }
.word-display .word-soft { min-width: 44px; }
.word-display .sound-off, .word-display .shrink-icon { display: none; }
#sound-toggle[aria-pressed="true"] .sound-off { display: inline; }
#sound-toggle[aria-pressed="true"] .sound-on { display: none; }
.word-status { display: flex; align-items: center; gap: 6px; flex: 1; min-width: 0; min-height: 44px; padding: 6px 8px; border-radius: 9px; background: #f1e9ff; color: #4a346e; font-size: .78rem; font-weight: 750; line-height: 1.25; }
.word-status[data-tone="success"] { background: #e0f7ea; color: #215639; }
.word-status[data-tone="retry"] { background: #fff0d7; color: #69461c; }
#status-mark { display: grid; place-items: center; flex: 0 0 21px; height: 21px; border-radius: 50%; background: #ffffffb8; }
.word-finish { display: grid; align-content: center; justify-items: center; gap: 6px; text-align: center; color: #30234a; }
.word-finish h3 { font-size: clamp(1.3rem, 4vw, 2rem); letter-spacing: -.045em; }
.word-finish p { font-size: .84rem; }
.word-finish .eyebrow { color: #5b3883; }
.word-finish .word-primary { margin-top: 6px; }
.word-celebration { display: flex; justify-content: center; align-items: end; gap: 6px; }
.word-celebration img { width: auto; height: clamp(72px, 15dvh, 128px); object-fit: contain; }
.word-sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.word-layout:is(:fullscreen, .is-expanded) { display: block; width: 100%; height: 100%; background: #f7f4ff; overflow: auto; }
.word-layout.is-expanded { position: fixed; inset: 0; z-index: 100; height: 100dvh; }
html:has(.word-layout.is-expanded) { overflow: hidden; }
.word-page:has(.word-layout:is(:fullscreen, .is-expanded)) :is(.site-header, .skip, .word-intro, .word-local, .game-crumbs, .game-reading, .games-footer) { visibility: hidden; }
.word-layout:is(:fullscreen, .is-expanded) .word-settings { display: none; }
.word-layout:is(:fullscreen, .is-expanded) .word-cabinet {
  height: 100%; min-height: 100%; grid-template-rows: auto auto minmax(min-content, 1fr) auto;
  border: 0; border-radius: 0; box-shadow: none;
  padding: max(7px, env(safe-area-inset-top)) max(8px, env(safe-area-inset-right)) max(7px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
}
.word-layout:is(:fullscreen, .is-expanded) .word-bench { min-height: 0; padding: clamp(8px, 1.8vw, 26px); }
.word-layout:is(:fullscreen, .is-expanded) .word-puzzle {
  min-height: 0; width: 100%; grid-template-columns: minmax(0, 4fr) minmax(0, 6fr);
  align-items: stretch; gap: clamp(10px, 3vw, 48px);
}
.word-layout:is(:fullscreen, .is-expanded) .word-picture-card {
  width: 100%; min-width: 0; min-height: 0; grid-template-columns: minmax(0, 1fr);
  grid-template-rows: minmax(0, 1fr) auto; padding: clamp(6px, 1.1vw, 17px);
}
.word-layout:is(:fullscreen, .is-expanded) .word-picture {
  display: grid; place-items: center; width: 100%; height: 100%; min-height: 0;
  aspect-ratio: auto; container-type: size;
}
.word-layout:is(:fullscreen, .is-expanded) .word-picture > :is(.tile-picture, .word-workbook-image) {
  width: min(100cqi, 100cqb); height: min(100cqi, 100cqb);
}
.word-layout:is(:fullscreen, .is-expanded) .word-build {
  display: flex; flex-direction: column; justify-content: center; container-type: inline-size;
}
.word-layout:is(:fullscreen, .is-expanded) .word-build h3 { font-size: clamp(1.25rem, min(3.9vw, 6dvh), 3.6rem); }
.word-layout:is(:fullscreen, .is-expanded) .word-clue { font-size: clamp(.81rem, 2.2dvh, 1.25rem); }
.word-layout:is(:fullscreen, .is-expanded) :is(.word-answer, .word-bank, .word-actions) { gap: clamp(4px, .95cqi, 12px); }
.word-layout:is(:fullscreen, .is-expanded) :is(.word-slot, .word-tile) {
  --word-edge: clamp(40px, min(11cqi, 13dvh), 106px);
  min-width: var(--word-edge); height: var(--word-edge);
  padding-inline: 4px; font-size: clamp(1rem, min(4.2cqi, 6dvh), 2.75rem);
}
.word-layout:is(:fullscreen, .is-expanded) :is(.word-listen, .word-actions button) {
  min-height: clamp(44px, 6.6dvh, 68px);
  font-size: clamp(.8rem, 2.1dvh, 1.2rem);
}
.word-layout:is(:fullscreen, .is-expanded) .word-display .word-soft { background: #fff9; }
.word-layout:is(:fullscreen, .is-expanded) .word-display span,
.word-layout:is(:fullscreen, .is-expanded) .expand-icon { display: none; }
.word-layout:is(:fullscreen, .is-expanded) .shrink-icon { display: inline; }

@media (max-width: 820px) {
  .word-layout { grid-template-columns: minmax(0, 1fr); gap: 9px; }
  .word-settings form fieldset { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .word-tip { display: none; }
}
@media (max-width: 580px) {
  .word-main { width: calc(100% - 20px); }
  .word-intro { align-items: start; }
  .word-intro .word-soft { flex: none; min-height: 40px; padding-inline: 6px; font-size: .68rem; }
  .word-settings, .word-cabinet { padding: 8px; border-radius: 14px; }
  .word-guide { min-height: 58px; }
  .word-guide img { height: 44px; width: 43px; }
  .word-option { grid-template-columns: auto minmax(0, 1fr); padding: 4px 5px; gap: 3px; }
  .word-option small, .option-number { display: none; }
  .word-option input { width: 13px; height: 13px; }
  .word-option strong { font-size: .71rem; }
  .word-puzzle { grid-template-columns: minmax(0, 1fr); gap: 9px; }
  .word-picture-card { width: 100%; grid-template-columns: 73px minmax(0, 146px); justify-content: center; padding: 5px 8px; }
  .word-picture { width: 73px; }
  .word-build h3 { font-size: 1.17rem; }
  .word-clue { font-size: .76rem; }
  .word-answer, .word-bank, .word-actions { gap: 5px; }
  .word-answer { margin-block: 8px 7px; }
  .word-bank { margin-bottom: 8px; min-height: 43px; }
  .word-slot, .word-tile { min-width: 37px; height: 42px; }
  .word-display span { display: none; }
  .word-bench { min-height: 290px; }
}
@media (max-width: 720px) and (orientation: portrait) {
  .word-layout:is(:fullscreen, .is-expanded) .word-puzzle {
    grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(118px, 1fr) auto; gap: 8px;
  }
  .word-layout:is(:fullscreen, .is-expanded) .word-answer { margin-block: 7px; }
  .word-layout:is(:fullscreen, .is-expanded) .word-bank { margin-bottom: 7px; }
  .word-layout:is(:fullscreen, .is-expanded) .word-actions .word-primary { min-width: 76px; }
}
@media (max-width: 440px) and (max-height: 650px) and (orientation: portrait) {
  .word-layout:is(:fullscreen, .is-expanded) .word-picture-card {
    grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
    grid-template-rows: minmax(0, 1fr); align-items: center;
  }
}
.word-layout:is(:fullscreen, .is-expanded) .word-toolbar {
  position: sticky;
  z-index: 2;
  bottom: 0;
  background: #f7f4ffde;
}
@media (max-height: 470px) and (min-width: 581px) {
  .word-layout:is(:fullscreen, .is-expanded) .word-cabinet { gap: 5px; }
  .word-layout:is(:fullscreen, .is-expanded) .word-bench { padding: 8px; }
  .word-layout:is(:fullscreen, .is-expanded) .word-build h3 { font-size: clamp(1.12rem, 5.2dvh, 1.7rem); }
  .word-layout:is(:fullscreen, .is-expanded) .word-answer { margin-block: 5px; }
  .word-layout:is(:fullscreen, .is-expanded) .word-bank { margin-bottom: 5px; min-height: 44px; }
  .word-layout:is(:fullscreen, .is-expanded) :is(.word-slot, .word-tile) {
    --word-edge: clamp(36px, min(10.7cqi, 12dvh), 52px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .word-tile:hover, .word-slot:hover { transform: none !important; }
}


/* Word workshop controls and the picture dictionary */
.word-options, .word-library-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
.word-options label, .library-filters label {
  display: grid; gap: 3px; min-width: 0; color: #3d3156; font-size: .73rem; font-weight: 800;
}
.word-options select, .library-filters :is(input, select) {
  width: 100%; min-width: 0; min-height: 42px; padding: 6px 7px;
  border: 1px solid #dacbec; border-radius: 9px; background: #faf7ff; color: #352353; font: inherit;
}
.deck-summary { margin: 6px 0 8px; color: #504365; font-size: .7rem; font-weight: 750; }
.word-library-actions { margin-top: 7px; }
.word-library-actions .word-soft { padding-inline: 5px; font-size: .68rem; }
.word-library-actions .word-soft:disabled, .library-pagination button:disabled { opacity: .6; cursor: default; }
#review-count { min-width: 17px; padding: 2px 4px; border-radius: 6px; background: #e9dbfb; color: #4c2679; }
.word-pattern {
  margin-top: 6px; color: #4a336b; font-size: .83rem; font-weight: 800; overflow-wrap: anywhere;
}
.word-workbook-image { display: block; width: 100%; height: 100%; object-fit: contain; }
.word-library {
  width: min(900px, calc(100% - 24px)); max-height: calc(100dvh - 24px);
  padding: clamp(12px, 3vw, 22px); border: 1px solid #cbb8e9; border-radius: 18px;
  background: #faf7ff; color: #25183c; box-shadow: 0 16px 65px #35204e46;
}
.word-library::backdrop { background: #2516408a; }
.library-heading, .library-pagination { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.library-heading h2 { font-size: clamp(1.3rem, 4vw, 1.9rem); letter-spacing: -.04em; }
.library-heading .eyebrow { color: #5d378f; font-size: .64rem; }
.library-lead { margin-block: 3px 10px; color: #473b58; font-size: .8rem; }
.library-filters { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); gap: 8px; }
.library-filters :is(input, select) { background: #fff; }
.library-status { min-height: 20px; margin-block: 7px; color: #493667; font-size: .75rem; font-weight: 800; }
.library-results { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.library-card {
  display: grid; grid-template-rows: auto auto 1fr auto; align-items: start; gap: 4px; min-width: 0;
  padding: 7px; border: 1px solid #e0d5ef; border-radius: 11px; background: #fff;
}
.library-art { width: min(100%, 94px); aspect-ratio: 1; justify-self: center; }
.library-art .tile-picture { display: block; width: 100%; height: 100%; background-repeat: no-repeat; background-size: 500% 1000%; }
.library-card h3 { overflow-wrap: anywhere; font-size: .83rem; line-height: 1.25; }
.library-card p { overflow-wrap: anywhere; color: #5b4d68; font-size: .66rem; line-height: 1.3; }
.library-actions { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1fr); gap: 4px; margin-top: 4px; }
.library-actions .word-soft { min-width: 0; min-height: 36px; padding-inline: 3px; font-size: .68rem; }
.library-pagination { margin-top: 9px; color: #503870; font-size: .73rem; font-weight: 800; }
@media (max-width: 620px) {
  .library-results { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-height: 470px) and (min-width: 581px) {
  .word-layout:is(:fullscreen, .is-expanded) .word-pattern { margin-top: 2px; font-size: .72rem; }
  .word-layout:is(:fullscreen, .is-expanded) .word-pattern:not([hidden]) + .word-answer { margin-block: 4px; }
}
