:root {
  color-scheme: light;
  font-family: Heebo, "Noto Sans Hebrew", Gisha, "Arial Hebrew", Arial, sans-serif;
  color: #2c2243;
  background: #f8f6fc;
  font-synthesis: none;
  --ink: #2c2243;
  --muted: #6b6179;
  --accent: #6947c5;
  --accent-dark: #5534ae;
  --soft-accent: #f0eafb;
  --line: #e8e1f3;
  --panel: #fff;
  --radius: 24px;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 280px; }
button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; }
img { display: block; max-width: 100%; }
svg { inline-size: 1.25em; block-size: 1.25em; fill: none; stroke: currentColor; stroke-width: 1.85; stroke-linecap: round; stroke-linejoin: round; flex: none; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 3px solid #825ee1; outline-offset: 4px; }
main[tabindex="-1"]:focus, h1[tabindex="-1"]:focus { outline: none; }

.symbol-library { position: absolute; inline-size: 0; block-size: 0; overflow: hidden; }
.sr-only { position: absolute; inline-size: 1px; block-size: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.container { width: min(1120px, calc(100% - 64px)); margin-inline: auto; }
.skip { position: fixed; z-index: 5; inset-block-start: 8px; inset-inline-start: 8px; padding: 10px 14px; border-radius: 8px; color: white; background: var(--accent-dark); transform: translateY(-160%); }
.skip:focus { transform: none; }

.topbar { min-height: 89px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-size: 1.22rem; font-weight: 800; white-space: nowrap; }
.brand-icon { display: grid; place-items: center; inline-size: 41px; block-size: 41px; color: white; background: var(--accent); border-radius: 13px; box-shadow: inset 0 -3px #51339d55; }
.brand-icon svg { inline-size: 23px; block-size: 23px; }
.btn { display: inline-flex; justify-content: center; align-items: center; gap: .55em; min-height: 46px; padding: 9px 17px; border: 1px solid transparent; border-radius: 12px; color: var(--ink); background: transparent; font-weight: 700; text-align: center; line-height: 1.3; transition: background .18s, box-shadow .18s, color .18s, transform .18s; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn.primary { color: #fff; background: var(--accent); border-color: var(--accent); box-shadow: 0 4px 9px #482f9627; }
.btn.primary:hover:not(:disabled) { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn.outline { color: var(--accent-dark); background: #fff; border-color: #dbcef0; }
.btn.outline:hover:not(:disabled), .btn.plain:hover:not(:disabled) { background: #f3edfb; }
.btn.plain { color: var(--accent-dark); }
.btn.icon-btn { inline-size: 44px; block-size: 44px; padding: 0; background: #f6f2fc; color: var(--accent-dark); }
.btn.icon-btn:hover { background: #eee6fa; }
.header-action { min-height: 42px; padding-inline: 13px; font-size: .91rem; }
.header-action svg { inline-size: 18px; block-size: 18px; }

.hero { position: relative; display: grid; grid-template-columns: .93fr 1.07fr; min-height: 399px; border: 1px solid #eae3f1; border-radius: 30px; overflow: hidden; background: #fffcf7; box-shadow: 0 14px 36px #39276a0a; }
.hero-copy { align-self: center; padding: 41px clamp(28px, 4.9vw, 63px); position: relative; z-index: 1; container-type: inline-size; }
.eyebrow { display: inline-flex; align-items: center; gap: 7px; margin-block-end: 14px; padding: 7px 11px; color: #5c3ba6; background: #f0e9fb; border-radius: 8px; font-size: .91rem; font-weight: 700; line-height: 1.25; }
.eyebrow svg { width: 16px; height: 16px; }
.hero h1 { font-size: clamp(2.5rem, 6vw, 4.65rem); font-size: clamp(2.5rem, 18cqi, 4.65rem); font-weight: 900; letter-spacing: -.036em; line-height: .99; }
.hero h1 em { font-style: normal; color: var(--accent); }
.hero h1 em span { color: #e99a71; }
.lede { max-width: 31ch; margin-block-start: 20px; color: var(--muted); font-size: clamp(1.02rem, 1.65vw, 1.25rem); line-height: 1.58; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-block-start: 24px; }
.hero-actions .btn { min-height: 52px; padding-inline: 18px; font-size: 1rem; }
.hero + #library-root { margin-block-start: clamp(25px, 3.5vw, 43px); scroll-margin-block-start: 18px; }
.hero-art { display: grid; isolation: isolate; position: relative; min-width: 0; overflow: hidden; background: #d9c6f1; }
.hero-art img { position: absolute; inline-size: 100%; block-size: 100%; object-fit: cover; object-position: 50% 52%; }
.art-caption { display: inline-flex; align-items: center; gap: 6px; position: absolute; inset-block-end: 19px; inset-inline-end: 19px; padding: 8px 11px; background: #fffaf0ee; color: #573b88; border: 1px solid #fff9; border-radius: 9px; font-size: .82rem; font-weight: 700; box-shadow: 0 3px 12px #37204a19; }
.art-caption svg { inline-size: 14px; block-size: 14px; }

.how { margin-block: 38px 35px; }
.how h2 { margin-block-end: 17px; font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 800; letter-spacing: -.025em; }
.step-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.step-card { display: flex; align-items: center; gap: 15px; min-height: 100px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.step-icon { display: grid; place-items: center; inline-size: 52px; block-size: 52px; flex: none; border-radius: 14px; }
.step-icon svg { inline-size: 24px; block-size: 24px; }
.step-icon.peach { color: #a14b35; background: #fce7db; }
.step-icon.lilac { color: #6744b8; background: #eee5fb; }
.step-icon.mint { color: #2c7356; background: #e3f4e8; }
.step-icon.mint span { margin-block-start: -5px; font-size: 1.78rem; line-height: 1; font-weight: 700; }
.step-card h3 { font-size: 1.16rem; font-weight: 800; }
.step-card p { margin-block-start: 5px; color: var(--muted); font-size: .91rem; line-height: 1.45; }
.site-footer { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 8px 18px; padding-block: 16px 23px; border-block-start: 1px solid var(--line); color: var(--muted); font-size: .83rem; }
.site-footer span:first-child { color: #544665; font-weight: 700; }

.play { margin-block: 0 40px; }
.game-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-block-end: 14px; }
.game-top .btn.plain { padding-inline-start: 3px; }
.score-pill { display: inline-flex; align-items: center; gap: 7px; min-height: 39px; padding: 7px 12px; color: #68481f; background: #fff1d8; border: 1px solid #f4ddad; border-radius: 99px; font-size: .92rem; font-weight: 800; }
.score-pill svg { fill: #f8ca67; stroke: #806027; }
.progress-block { padding: 14px 18px; margin-block-end: 16px; border: 1px solid var(--line); background: #fff; border-radius: 15px; }
.progress-meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-block-end: 8px; color: var(--accent-dark); font-size: .92rem; font-weight: 700; }
.progress-track { inline-size: 100%; block-size: 9px; background: #eee8f7; border-radius: 99px; overflow: hidden; }
.progress-fill { display: block; block-size: 100%; background: linear-gradient(to left, #7652cb, #ae85ef); border-radius: inherit; transition: width .23s ease; }
.game-grid { display: grid; grid-template-columns: minmax(250px, .75fr) minmax(0, 1.25fr); gap: 18px; align-items: stretch; }
.clue-panel, .challenge-panel, .summary-card { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 10px 28px #3c286c09; }
.clue-panel { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 16px; position: relative; padding: clamp(16px, 3vw, 28px); background: #f3edf9; }
.clue-panel > p { text-align: center; }
.word-visual { display: grid; place-items: center; width: 100%; max-width: 330px; min-height: 159px; aspect-ratio: 4 / 3; border: 1px solid #e6d7f4; border-radius: 19px; overflow: hidden; background: linear-gradient(140deg, #fffbf1, #ead9f5 100%); font-size: clamp(4rem, 11vw, 7rem); line-height: 1; }
.word-visual img { width: 100%; height: 100%; min-height: 0; object-fit: cover; }
.listen { min-height: 52px; min-width: min(100%, 180px); color: #fff; background: var(--accent); }
.listen:hover, .listen.is-speaking { color: #fff; background: var(--accent-dark); }
.hint-button { min-height: 41px; }
.clue-copy, .audio-help { color: var(--muted); font-size: .92rem; line-height: 1.5; }
.audio-help { text-align: center; }
.audio-help details { margin-block-start: 5px; }
.audio-help summary, .extra-marks summary { color: var(--accent-dark); cursor: pointer; font-weight: 700; }
.challenge-panel { min-width: 0; padding: clamp(17px, 4vw, 33px); background: var(--panel); }
.challenge-panel h1, .summary-card h1 { font-size: clamp(1.65rem, 4vw, 2.55rem); font-weight: 800; letter-spacing: -.03em; }
.challenge-panel h1 + p, .summary-card > p { color: var(--muted); margin-block-start: 8px; line-height: 1.55; }
.game-kicker { color: var(--accent-dark); font-size: .86rem; font-weight: 800; }
.phase-steps { display: flex; flex-wrap: wrap; gap: 6px; margin-block: 0 14px; }
.phase-chip { display: inline-flex; align-items: center; gap: 5px; padding: 6px 9px; border-radius: 8px; color: var(--muted); background: #f6f2fa; font-size: .82rem; font-weight: 700; }
.phase-chip[aria-current], .phase-chip.active, .phase-chip.current { color: #53359b; background: #ede2fb; }
.phase-chip.done { color: #276049; background: #e6f4e9; }
.answer { display: block; inline-size: 100%; min-block-size: 64px; margin-block: 16px 11px; padding: 8px 12px; border: 2px solid #e1d5f3; border-radius: 13px; background: #fcfaff; color: var(--ink); font-size: 1.8rem; font-weight: 700; text-align: center; direction: rtl; }
.answer::placeholder { color: #81758d; font-weight: 400; font-size: 1.08rem; }
.answer:focus { outline: 0; border-color: #9170dc; }
.letter-keyboard { display: grid; gap: 6px; margin-block: 11px 15px; }
.keyboard-row { display: flex; justify-content: center; gap: 6px; }
.key, .mark-key, .letter-tile { display: inline-grid; place-items: center; border: 1px solid #e4d9f2; color: var(--ink); background: #fbf8ff; font-weight: 700; border-radius: 9px; transition: background .16s, border-color .16s, color .16s; }
.key:hover, .mark-key:hover, .letter-tile:hover { color: var(--accent-dark); border-color: #b99de7; background: #f0e7fb; }
.key { inline-size: clamp(28px, 6vw, 40px); min-inline-size: 0; block-size: 42px; padding: 0; font-size: 1.15rem; box-shadow: 0 2px 0 #ded3ed; }
.key svg { inline-size: 18px; block-size: 18px; }
.key.key-wide { inline-size: auto; min-inline-size: 48px; padding-inline: 9px; }
.challenge-actions, .nikud-options { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-block-start: 16px; }
.feedback { padding: 10px 13px; margin-block-start: 12px; border-radius: 10px; color: #584088; background: #f1e9fa; font-size: .94rem; line-height: 1.5; }
.feedback:empty { display: none; }
.feedback[data-kind="success"] { color: #255f47; background: #e7f4e9; }
.feedback[data-kind="hint"] { color: #6c4c21; background: #fff2d9; }
.feedback[data-kind="error"] { color: #8a3b38; background: #fcebe7; }
.tile-row { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 7px; margin-block: 17px; }
.letter-tile { inline-size: clamp(39px, 7vw, 59px); block-size: 68px; padding: 0 1px .1em; font-size: clamp(1.8rem, 5vw, 2.55rem); line-height: 1; }
.letter-tile[aria-pressed="true"], .letter-tile.selected, .letter-tile.active { border-color: #8c66de; color: #5531ac; background: #ece0fc; box-shadow: 0 0 0 2px #b695ef44; }
.letter-tile[data-correct="true"] { border-color: #7cba93; background: #e9f6ed; }
.letter-tile[data-correct="false"] { border-color: #dca29a; background: #fff0ed; }
.mark-pad { display: grid; grid-template-columns: repeat(auto-fit, minmax(66px, 1fr)); gap: 7px; }
.mark-key { min-height: 64px; padding: 4px; gap: 2px; }
.mark-key[aria-pressed="true"], .mark-key.selected { color: var(--accent-dark); border-color: #b99de7; background: #f0e7fb; }
.mark-sample { font-size: 1.46rem; line-height: 1.15; }
.mark-name { font-size: .78rem; line-height: 1.2; }
.extra-marks { margin-block-start: 10px; }
.extra-pad, .pointing-note { margin-block-start: 8px; }
.nikud-options { margin-block-start: 5px; }
.btn.subtle { min-height: 40px; padding-inline: 8px; font-size: .9rem; }
.word-complete .step-icon { margin-block-end: 10px; }
.finished-word { margin-block: 14px 20px; color: var(--accent-dark); font-size: clamp(2rem, 6vw, 3.3rem); font-weight: 800; }

.summary-card { margin-inline: auto; max-width: 730px; padding: clamp(21px, 5vw, 44px); background: #fff; }
.result-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(115px, 1fr)); gap: 9px; margin-block: 22px; }
.result-stat { padding: 14px 12px; border-radius: 12px; color: var(--accent-dark); background: #f3ecfb; }
.result-stat b { display: block; margin-block-end: 4px; font-size: 1.55rem; }
.result-list { line-height: 1.65; }
.result-list h2 { font-size: 1.2rem; }
.result-list ul { padding-inline-start: 22px; }
.summary-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-block-start: 18px; }

dialog { width: min(650px, calc(100% - 30px)); max-height: min(88dvh, 780px); padding: 0; border: 1px solid var(--line); border-radius: 23px; color: var(--ink); background: #fff; box-shadow: 0 21px 62px #23173840; }
dialog[open] { display: flex; flex-direction: column; }
dialog::backdrop { background: #29203965; backdrop-filter: blur(3px); }
.dialog-head { display: flex; gap: 13px; align-items: center; padding: 16px 20px; border-block-end: 1px solid var(--line); }
.dialog-head h2 { flex: 1; font-size: clamp(1.22rem, 4vw, 1.65rem); font-weight: 800; }
.dialog-head .step-icon { inline-size: 42px; block-size: 42px; }
.dialog-head .step-icon svg { inline-size: 20px; block-size: 20px; }
.dialog-content { overflow-y: auto; padding: 18px 21px; }
.deck-fields { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 12px; margin-block-end: 19px; }
.deck-fields label { display: grid; grid-template-columns: auto 1fr; align-content: start; align-items: baseline; gap: 6px; font-weight: 800; }
.deck-fields input { grid-column: 1 / -1; inline-size: 100%; min-inline-size: 0; padding: 9px 11px; color: var(--ink); border: 1px solid #e1d5f3; border-radius: 9px; background: #fcfaff; font-weight: 500; }
.optional-field { color: var(--muted); font-size: .8rem; font-weight: 500; }
.library-status { margin-block: 10px 0; }
.label { display: block; margin-block-end: 5px; font-weight: 800; }
.field-hint { margin-block-end: 8px; color: var(--muted); font-size: .9rem; line-height: 1.55; }
textarea, .parent-fields input:not([type="file"]), .parent-fields select, .parent-word input:not([type="file"]) { width: 100%; min-width: 0; padding: 9px 11px; color: var(--ink); border: 1px solid #e1d5f3; border-radius: 9px; background: #fcfaff; }
textarea { display: block; resize: vertical; line-height: 1.55; }
.storage-note { margin-block: 14px 0; }
.dialog-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 13px 20px; border-block-start: 1px solid var(--line); background: #fff; }
.parent-words { display: grid; gap: 10px; margin-block-start: 16px; }
.enrichment > summary { cursor: pointer; color: var(--accent-dark); font-weight: 800; line-height: 1.5; }
.enrichment > summary span { display: inline-block; margin-inline-start: 6px; color: var(--muted); font-size: .82rem; font-weight: 500; }
.enrichment > p, .parent-word + .parent-word { margin-block-start: 9px; }
.parent-word { padding: 12px; border: 1px solid var(--line); border-radius: 13px; }
.parent-word > summary { color: var(--accent-dark); cursor: pointer; font-weight: 700; }
.parent-word small { margin-inline-start: 6px; color: var(--muted); font-weight: 400; }
.parent-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-block-start: 10px; }
.parent-fields label { display: grid; gap: 4px; font-size: .87rem; font-weight: 700; }
.wide-field { grid-column: 1 / -1; }
.parent-media { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-block-start: 10px; }
.parent-media img { max-inline-size: 65px; max-block-size: 55px; border-radius: 6px; }
.parent-media audio { max-inline-size: 100%; }
.file-button { position: relative; cursor: pointer; }
.file-button input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.file-button:focus-within { outline: 3px solid #825ee1; outline-offset: 4px; }
.media-status:empty { display: none; }
.parent-nikud { margin-block-start: 12px; }
.parent-nikud > summary { color: var(--accent-dark); cursor: pointer; font-weight: 700; }
.parent-pad { padding-block-start: 4px; }
.parent-pad .letter-tile { block-size: 52px; }
.parent-pad .mark-key { min-height: 50px; }

.word-visual.art-tile {
  min-height: 0;
  max-width: 248px;
  aspect-ratio: 1;
  background-color: #eee6fa;
  background-image: url("assets/clue-art.jpg");
  background-size: 300% 200%;
  background-repeat: no-repeat;
}
.art-emoji { display: none; }
.art-0 { background-position: 0 0; }
.art-1 { background-position: 50% 0; }
.art-2 { background-position: 100% 0; }
.art-3 { background-position: 0 100%; }
.art-4 { background-position: 50% 100%; }
.art-5 { background-position: 100% 100%; }

@media (max-width: 920px) {
  .container { width: calc(100% - 44px); }
  .hero-copy { padding-inline: 32px; }
  .hero-actions .btn { padding-inline: 13px; }
  .hero { min-height: 420px; }
  .step-card { padding-inline: 12px; gap: 11px; }
  .step-icon { inline-size: 46px; block-size: 46px; }
}

@media (max-width: 710px) {
  .topbar { min-height: 72px; }
  .container { width: calc(100% - 30px); }
  .hero { grid-template-columns: 1fr; min-height: auto; border-radius: 24px; }
  .hero-copy { padding: 29px 22px 21px; }
  .hero h1 { font-size: clamp(2.65rem, 10vw, 4.45rem); }
  .hero-art { min-height: 230px; aspect-ratio: 1.62; }
  .hero-art img { object-position: 50% 58%; }
  .lede { margin-block-start: 15px; }
  .hero-actions { margin-block-start: 17px; }
  .hero-actions .btn { min-height: 47px; padding-inline: 13px; }
  .how { margin-block: 27px; }
  .step-grid { grid-template-columns: 1fr; gap: 8px; }
  .step-card { min-height: 73px; padding: 11px 13px; }
  .step-card p { margin-block-start: 3px; }
  .game-grid { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .clue-panel { display: grid; grid-template-columns: minmax(0, .82fr) minmax(0, 1fr); gap: 10px; align-items: center; }
  .clue-panel > :not(.word-visual):not(.listen) { grid-column: 1 / -1; }
  .word-visual { min-height: 94px; font-size: clamp(2.8rem, 12vw, 5.2rem); }
  .challenge-panel { padding-inline: clamp(11px, 3.5vw, 25px); }
}

@media (max-width: 410px) {
  .topbar { gap: 7px; }
  .brand { gap: 7px; font-size: 1rem; }
  .brand-icon { inline-size: 33px; block-size: 33px; border-radius: 10px; }
  .brand-icon svg { inline-size: 19px; block-size: 19px; }
  .header-action { padding-inline: 8px; font-size: .78rem; }
  .header-action svg { inline-size: 14px; block-size: 14px; }
  .keyboard-row { gap: 3px; }
  .key { inline-size: min(7.6vw, 34px); }
  .dialog-content, .dialog-head, .dialog-actions { padding-inline: 13px; }
  .parent-fields { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
