/* Hebrew Word Practice. Uses the Word Practice heading, chips and word card,
   with picture cards that match the game tiles (cream card, gold edge). */
body[data-view="hebrewWords"] main.hw-page { max-width: 1120px; margin: 0 auto; padding: 20px clamp(16px, 3vw, 36px) 40px; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
.hw-page .workshop-back { margin: 0 0 12px; }
.hw-game { display: flex; flex-direction: column; gap: 14px; }
.hw-loading { color: #f3e6ff; font-size: 17px; padding: 40px 0; }
.hw-game .practice-heading h1 { margin: 6px 0 4px; }

.hw-summary { display: flex; align-items: center; gap: 16px; color: #f3e6ff; font-size: 15px; font-weight: 600; }
.hw-meter { flex: 1; max-width: 320px; height: 10px; border-radius: 99px; background: #ffffff26; overflow: hidden; }
.hw-meter i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, #ffe7a8, #f3c56d); transition: width .5s ease; }

.hw-play { display: grid; gap: 18px; grid-template-columns: minmax(260px, 340px) 1fr; align-items: start; }

/* The Hebrew word */
.hw-game .hw-word-card { position: sticky; top: 12px; z-index: 2; margin: 0; min-height: 0 !important; padding: 26px 20px 20px; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; box-shadow: 0 18px 40px #1d0b2e40; }
.hw-word-card .practice-prompt { margin: 0; color: #6a4a7c; font-size: 15px; }
.hw-hebrew { font-family: "SF Hebrew", "Arial Hebrew", "Noto Sans Hebrew", "Rubik", "Segoe UI", Arial, sans-serif; font-size: clamp(54px, 7.5vw, 92px); font-weight: 700; line-height: 1.45; color: #4b2462; padding: 6px 8px 0; overflow-wrap: anywhere; unicode-bidi: isolate; }
.hw-hebrew.hw-pop { animation: hw-pop .35s ease; }
.hw-english { margin: 0; font-size: 22px; font-weight: 700; color: #2f7a46; animation: hw-pop .35s ease; }
.hw-word-card .hw-hear { position: absolute; top: 12px; right: 12px; margin: 0; color: #77508f; }
.hw-word-card .hw-hear svg { width: 24px; height: 24px; }
.hw-skip { display: inline-flex; align-items: center; justify-content: center; gap: 8px; margin-top: 10px; min-height: 48px; min-width: 140px; padding: 8px 22px; border: 2px solid #d8c3e3; border-radius: 16px; background: #fff9eb; color: #4c285d; font: inherit; font-size: 16px; font-weight: 700; cursor: pointer; touch-action: manipulation; }
.hw-skip svg { width: 22px; height: 22px; }
.hw-skip:disabled { opacity: .5; cursor: default; }

/* The pictures */
.hw-board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.hw-card { position: relative; aspect-ratio: 1; padding: 0; border: 3px solid #f0d9a8; border-radius: 22px; background: #fffaf0; box-shadow: 0 10px 0 #b88fc955, 0 16px 30px #1d0b2e33; cursor: pointer; overflow: hidden; touch-action: manipulation; -webkit-tap-highlight-color: transparent; transition: transform .15s ease, border-color .2s, box-shadow .2s, opacity .35s; }
.hw-card:hover:not(:disabled) { transform: translateY(-2px); }
.hw-card:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 4px 0 #b88fc955, 0 8px 18px #1d0b2e33; }
.hw-card:focus-visible { outline: 4px solid #ffe7a8; outline-offset: 3px; }
.hw-card-art { position: absolute; inset: 7%; display: grid; place-items: center; }
.hw-card-art img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; -webkit-user-select: none; user-select: none; }
.hw-picture-fallback { font-size: clamp(14px, 2.2vw, 19px); font-weight: 700; color: #5b3470; line-height: 1.25; text-align: center; overflow-wrap: normal; word-break: normal; hyphens: auto; padding: 4px; }
.hw-card:has(.hw-picture-fallback) { background: linear-gradient(135deg, #f0e4fa, #fff3d6); }
.hw-card-mark { position: absolute; top: 8px; right: 8px; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: #fff; opacity: 0; transform: scale(.4); transition: opacity .2s, transform .25s cubic-bezier(.3, 1.6, .5, 1); }
.hw-card-mark svg { width: 22px; height: 22px; }
.hw-card.hw-right { border-color: #5fae6e; box-shadow: 0 0 0 4px #9ee0a9aa, 0 16px 30px #1d0b2e33; transform: none; }
.hw-card.hw-right .hw-card-mark { opacity: 1; transform: scale(1); background: #3f9a57; }
.hw-card.hw-wrong { border-color: #e07b7b; animation: hw-shake .45s ease; }
.hw-card.hw-wrong .hw-card-mark { opacity: 1; transform: scale(1); background: #d25c5c; }
.hw-card.hw-leaving { opacity: 0; transform: scale(.6); }
.hw-card:disabled { cursor: default; }

/* Finished */
.hw-game .hw-finished, .hw-game .hw-empty { min-height: 0 !important; margin: 0; padding: 40px 24px; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.hw-finished h2, .hw-empty h2 { margin: 0; font-size: clamp(26px, 4vw, 38px); color: #4b2462; }
.hw-finished p, .hw-empty p { margin: 0; color: #6a4a7c; font-size: 17px; }
.hw-finished-he { font-family: "SF Hebrew", "Arial Hebrew", "Noto Sans Hebrew", Arial, sans-serif; font-size: clamp(34px, 5vw, 52px) !important; font-weight: 700; color: #b0731f !important; line-height: 1.5; }
.hw-finished-actions { display: flex; gap: 14px; flex-wrap: wrap; justify-content: center; margin-top: 12px; }
.hw-feedback { margin: 0; color: #eadcf5; text-align: center; }

@keyframes hw-shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-9px) rotate(-2deg); } 40% { transform: translateX(8px) rotate(2deg); } 60% { transform: translateX(-6px); } 80% { transform: translateX(4px); } }
@keyframes hw-pop { 0% { transform: scale(.85); opacity: .3; } 100% { transform: scale(1); opacity: 1; } }

/* iPad portrait and smaller: word on top, pictures below. */
@media (max-width: 1024px) {
  .hw-play { grid-template-columns: 1fr; }
  .hw-game .hw-word-card { flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 4px 18px; padding: 14px 52px 14px 16px; }
  .hw-word-card .practice-prompt { flex-basis: 100%; }
  .hw-hebrew { font-size: clamp(46px, 9vw, 76px); padding: 0 4px; }
  .hw-skip { margin-top: 0; min-width: 0; }
  .hw-english { flex-basis: 100%; }
}
@media (max-width: 600px) {
  .hw-board { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
  .hw-card { border-radius: 16px; border-width: 2px; box-shadow: 0 6px 0 #b88fc955, 0 10px 20px #1d0b2e33; }
  .hw-card-mark { width: 28px; height: 28px; top: 5px; right: 5px; }
  .hw-card-mark svg { width: 17px; height: 17px; }
  .hw-game .hw-word-card { top: 6px; }
  .hw-word-card .practice-prompt { font-size: 14px; }
  .hw-skip { min-height: 44px; padding: 6px 14px; font-size: 15px; }
}
@media (prefers-reduced-motion: reduce) {
  .hw-card, .hw-card-mark, .hw-meter i { transition: none; }
  .hw-card.hw-wrong, .hw-hebrew.hw-pop, .hw-english { animation: none; }
}

/* Parents → Hebrew words (admin) */
.hw-admin .parent-heading .note { max-width: 720px; }
.hw-admin-actions { display: flex; gap: 12px; margin: 18px 0 12px; }
.hw-admin-list { display: grid; gap: 12px; margin: 12px 0 24px; }
.hw-admin-set { display: grid; grid-template-columns: auto 1fr auto auto; align-items: center; gap: 16px; padding: 14px 16px; border: 1px solid #e3d3e8; border-radius: 16px; background: #fffdf8; }
.hw-admin-strip { display: grid; grid-template-columns: repeat(4, 40px); gap: 4px; }
.hw-admin-strip-thumb { width: 40px; height: 40px; border-radius: 8px; object-fit: contain; background: #f6eefa; display: grid; place-items: center; color: #b79ac8; }
.hw-admin-strip-thumb .ui-icon, .hw-admin-thumb .ui-icon { width: 16px; height: 16px; }
.hw-admin-set-copy { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hw-admin-set-copy strong { font-size: 17px; color: #452453; }
.hw-admin-set-copy span { font-size: 13px; color: #75577f; }
.hw-admin-set-buttons { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.hw-admin-help { margin-top: 8px; }
.hw-admin-editor > .back { margin: 0 0 14px; }
.hw-admin-form h2 { display: flex; align-items: baseline; gap: 12px; margin: 22px 0 12px; }
.hw-admin-count { font-size: 14px; font-weight: 600; color: #8a6c97; }
.hw-admin-set-fields { display: flex; flex-wrap: wrap; align-items: end; gap: 18px; }
.hw-admin-set-fields label:first-child { flex: 1; min-width: 240px; }
.hw-admin-form label { display: flex; flex-direction: column; gap: 6px; font-weight: 700; font-size: 14px; color: #4c285d; }
.hw-admin-form label.toggle { flex-direction: row; align-items: center; }
.hw-admin-form input:not([type=checkbox]) { min-height: 44px; padding: 8px 12px; border: 1px solid #cdb4dc; border-radius: 12px; font: inherit; font-size: 16px; color: #452453; background: #fff; }
.hw-admin-form .hw-admin-hebrew { font-family: "SF Hebrew", "Arial Hebrew", "Noto Sans Hebrew", Arial, sans-serif; font-size: 22px; text-align: right; }
.hw-admin-words { display: grid; gap: 10px; margin-bottom: 14px; }
.hw-admin-word { display: grid; grid-template-columns: 210px minmax(120px, 1fr) minmax(140px, 1fr) auto auto; align-items: end; gap: 14px; padding: 12px; border: 1px solid #eadcef; border-radius: 14px; background: #fffdf8; }
.hw-admin-word--off { opacity: .6; }
.hw-admin-picture { display: grid; grid-template-columns: 64px auto; justify-content: start; grid-template-rows: auto auto; gap: 4px 8px; align-items: center; }
.hw-admin-picture .hw-admin-thumb { grid-row: span 2; }
.hw-admin-thumb { width: 64px; height: 64px; border-radius: 12px; object-fit: contain; background: #fffaf0; border: 2px solid #f0d9a8; display: grid; place-items: center; color: #b79ac8; }
.hw-admin-thumb--empty { border-style: dashed; background: #f6eefa; }
.hw-admin-form .hw-admin-upload { flex-direction: row; min-height: 36px; padding: 4px 12px; font-size: 14px; cursor: pointer; }
.hw-admin-picture .text-button { font-size: 13px; justify-self: start; }
.hw-admin-remove { min-width: 44px; padding-inline: 10px; }
.hw-admin-save { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 22px; }
@media (max-width: 860px) {
  .hw-admin-set { grid-template-columns: 1fr auto; }
  .hw-admin-strip { grid-column: 1 / -1; }
  .hw-admin-set-buttons { grid-column: 1 / -1; justify-content: flex-start; }
  .hw-admin-word { grid-template-columns: 1fr 1fr; }
  .hw-admin-picture { grid-column: 1 / -1; }
}

/* Games tile: looping preview of the game (tile.js). */
.hw-tile-art { position: relative; display: block; overflow: hidden; container-type: inline-size; background: radial-gradient(ellipse at 50% 25%, #fff6dd, #f1def8 55%, #d6b8ea); }
.hw-tile-letter { position: absolute; left: var(--x); top: var(--y); font: normal 700 calc(34px * var(--s)) "SF Hebrew", "Arial Hebrew", "Noto Sans Hebrew", Arial, sans-serif; color: #9a73b8; opacity: .28; animation: hw-tile-float 6s ease-in-out var(--d) infinite alternate; }
.hw-tile-stage { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6cqw; padding: 5cqw 4cqw; transition: opacity .45s ease, transform .45s ease; }
.hw-tile-art[data-phase="out"] .hw-tile-stage { opacity: 0; transform: translateY(-3%); }
.hw-tile-art[data-phase="in"] .hw-tile-stage { animation: hw-tile-in .5s ease both; }
.hw-tile-word { display: grid; place-items: center; min-width: 46cqw; padding: 1.2cqw 7cqw; border: 2px solid #f0d9a8; border-radius: 5cqw; background: linear-gradient(135deg, #fffaf0, #fff0c9); box-shadow: 0 1.6cqw 0 #b88fc966, 0 4cqw 7cqw #4d2e6533; }
.hw-tile-word b { font: 700 13cqw/1.45 "SF Hebrew", "Arial Hebrew", "Noto Sans Hebrew", Arial, sans-serif; color: #4b2462; white-space: nowrap; }
.hw-tile-cards { display: grid; grid-template-columns: repeat(4, 19cqw); gap: 3cqw; }
.hw-tile-card { position: relative; aspect-ratio: 1; border: 2px solid #f0d9a8; border-radius: 4cqw; background: #fffaf0; box-shadow: 0 1.4cqw 0 #b88fc955, 0 3cqw 5cqw #1d0b2e2e; transition: transform .3s ease, opacity .4s ease, border-color .2s, box-shadow .2s; }
.hw-tile-card img { position: absolute; inset: 8%; width: 84%; height: 84%; object-fit: contain; mix-blend-mode: multiply; }
.hw-tile-check { position: absolute; top: -2.2cqw; right: -2.2cqw; width: 7cqw; height: 7cqw; border-radius: 50%; display: grid; place-items: center; background: #3f9a57; color: #fff; opacity: 0; transform: scale(.4); transition: opacity .2s, transform .3s cubic-bezier(.3, 1.6, .5, 1); }
.hw-tile-check svg { width: 64%; height: 64%; }
.hw-tile-tap { position: absolute; left: 50%; top: 55%; width: 9cqw; height: 9cqw; margin: -4.5cqw 0 0 -4.5cqw; border-radius: 50%; background: #ffffffcc; box-shadow: 0 0 0 1.2cqw #ffffff55; opacity: 0; pointer-events: none; }
.hw-tile-card.is-tap .hw-tile-tap { animation: hw-tile-tap .7s ease-out both; }
.hw-tile-card.is-tap { transform: translateY(.8cqw); }
.hw-tile-card.is-right { border-color: #5fae6e; box-shadow: 0 0 0 1cqw #9ee0a9aa, 0 3cqw 5cqw #1d0b2e2e; }
.hw-tile-card.is-right .hw-tile-check { opacity: 1; transform: scale(1); }
.hw-tile-card.is-gone { opacity: 0; transform: scale(.6); }
@keyframes hw-tile-tap { 0% { opacity: 0; transform: scale(.4); } 30% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1.7); } }
@keyframes hw-tile-in { from { opacity: 0; transform: translateY(4%); } to { opacity: 1; transform: none; } }
@keyframes hw-tile-float { to { transform: translateY(-10px) rotate(6deg); } }
@media (prefers-reduced-motion: reduce) { .hw-tile-letter, .hw-tile-art[data-phase] .hw-tile-stage { animation: none; } }
.game-preview-tile:has(.hw-tile-art) { display: flex; flex-direction: column; }
.game-preview-tile .hw-tile-art { flex: 1; aspect-ratio: auto; min-height: 240px; }
@media (min-width: 1025px) { .hw-board { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.hw-card:disabled { opacity: .85; }
.hw-card.hw-right:disabled { opacity: 1; }
.hw-admin-form input:not([type=checkbox]) { width: 100%; min-width: 0; box-sizing: border-box; }
.hw-admin-word > label { min-width: 0; }
@media (max-width: 600px) {
  .hw-admin-word { grid-template-columns: 1fr auto; }
  .hw-admin-word > label:not(.toggle) { grid-column: 1 / -1; }
  .hw-admin-set-fields label:first-child { min-width: 0; flex-basis: 100%; }
}

/* Words stay on one line; game.js shrinks the type to fit. */
.hw-hebrew, .hw-english, .hw-picture-fallback, .hw-finished-he { white-space: nowrap; overflow-wrap: normal; word-break: keep-all; hyphens: none; }
.hw-hebrew, .hw-english { align-self: stretch; width: 100%; text-align: center; }
.hw-picture-fallback { display: block; width: 100%; overflow: hidden; }
.hw-finished-he { align-self: stretch; width: 100%; text-align: center; }
@media (max-width: 1024px) {
  .hw-game .hw-word-card .hw-hebrew { width: auto; flex: 0 1 auto; min-width: 0; max-width: calc(100% - 160px); }
}
@media (max-width: 600px) {
  .hw-game .hw-word-card .hw-hebrew { max-width: 100%; flex-basis: 100%; }
}

/* The pictures have white backgrounds; blend them into the cream card. */
.hw-card-art img { mix-blend-mode: multiply; }
/* iPad portrait: six pictures per row so a whole set fits without scrolling. */
@media (min-width: 601px) and (max-width: 1024px) { .hw-board { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; } }
