@font-face { font-family: 'Rubik'; src: url('assets/fonts/Rubik.ttf') format('truetype'); font-weight: 300 900; font-display: swap; }
:root {
  --ink: #1d2340; --ink-2: #4a5078; --cream: #fffaf0; --gold: #ffcf3a; --orange: #ff7a1a; --teal: #17a596; --purple: #5a35d6;
  --glass: rgba(255, 251, 242, .92); --glass-edge: rgba(255, 255, 255, .95);
  --lift: 0 3px 0 rgba(29, 35, 64, .16), 0 8px 22px rgba(10, 40, 90, .18);
  --r-pill: 999px; --h: 44px;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #8fd0ff; font-family: 'Rubik', Arial, sans-serif; color: var(--ink); user-select: none; -webkit-user-select: none; touch-action: none; }
#game { position: fixed; inset: 0; width: 100%; height: 100%; display: block; filter: saturate(1.12) contrast(1.04); }
#vignette { position: fixed; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 50% 45%, transparent 62%, rgba(10, 30, 60, .28) 100%); }
button { font-family: inherit; cursor: pointer; border: 0; color: inherit; background: none; padding: 0; }
svg { width: 1em; height: 1em; flex: none; }

/* ---------------------------------------------------------------- כפתור אייקון אחיד */
.ibtn { position: relative; display: inline-grid; place-items: center; width: var(--h); height: var(--h); border-radius: 50%; background: var(--glass); color: var(--ink); font-size: 22px; box-shadow: var(--lift); border: 2px solid var(--glass-edge); transition: transform .12s, background .2s; }
.ibtn:hover { transform: translateY(-1px); }
.ibtn:active { transform: translateY(2px) scale(.96); }
.ibtn.accent { background: linear-gradient(180deg, #ffa53a, #ff6a1a); color: #fff; border-color: #ffd2a6; }
.ibtn > svg { grid-area: 1 / 1; }
.ibtn .slash { display: none; color: #e8453c; font-size: 26px; }
.off .slash { display: block; }
.off > svg:not(.slash), .off .ibtn > svg:not(.slash) { opacity: .4; }
.ibtn .fs-out, .sbtn .fs-out { display: none; }
.is-full .fs-in { display: none; } .is-full .fs-out { display: block; }
body:not(.can-full) .fs-only { display: none !important; }

/* ---------------------------------------------------------------- HUD */
#hud { position: fixed; top: max(10px, env(safe-area-inset-top)); left: max(12px, env(safe-area-inset-left)); right: max(12px, env(safe-area-inset-right)); display: flex; justify-content: space-between; align-items: center; gap: 8px; pointer-events: none; opacity: 0; transition: opacity .4s; }
#hud.show { opacity: 1; }
.hud-group { display: flex; gap: 8px; align-items: center; }
.pill { pointer-events: auto; display: flex; align-items: center; gap: 7px; height: var(--h); padding: 0 16px; border-radius: var(--r-pill); background: var(--glass); border: 2px solid var(--glass-edge); box-shadow: var(--lift); font-weight: 800; font-size: 20px; font-variant-numeric: tabular-nums; }
.pill .ico { font-size: 24px; }
.pill.name { font-size: 15px; font-weight: 700; color: var(--ink-2); padding: 0 14px; }
.btn-bar { pointer-events: auto; display: flex; gap: 6px; padding: 4px; border-radius: var(--r-pill); background: rgba(29, 35, 64, .18); backdrop-filter: blur(4px); }
.btn-bar .ibtn { --h: 40px; font-size: 20px; box-shadow: 0 2px 0 rgba(29, 35, 64, .18); }
.hearts { gap: 4px; padding: 0 12px; }
.heart { width: 24px; height: 22px; display: inline-block; background: linear-gradient(180deg, #ff6b7a, #e8304a); clip-path: path('M12 21 C5 15 0 11 0 6 C0 2.5 2.7 0 6 0 C8.5 0 10.5 1.4 12 3.4 C13.5 1.4 15.5 0 18 0 C21.3 0 24 2.5 24 6 C24 11 19 15 12 21Z'); transition: transform .25s cubic-bezier(.2, 2, .4, 1); }
.heart.empty { background: #d8d0c2; transform: scale(.82); }
.letters { gap: 5px; padding: 0 10px; }
.letters span { display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: #ece6f8; color: #b1a6cf; font-weight: 900; font-size: 18px; border: 2px dashed #cfc5e8; transition: all .3s cubic-bezier(.2, 1.6, .4, 1); }
.letters span.got { background: radial-gradient(circle at 40% 30%, #9b7bff, #4b2bc4); color: #ffd84a; border: 2px solid #ffd34d; box-shadow: 0 0 12px rgba(184, 155, 255, .9); transform: scale(1.12); }
#toast { position: fixed; top: calc(max(10px, env(safe-area-inset-top)) + 58px); left: 50%; transform: translate(-50%, -20px); opacity: 0; padding: 10px 22px; border-radius: 16px; background: rgba(29, 35, 64, .9); border: 2px solid rgba(255, 255, 255, .25); color: #fff; font-weight: 700; font-size: 19px; pointer-events: none; transition: all .35s cubic-bezier(.2, 1.6, .4, 1); white-space: nowrap; box-shadow: 0 8px 24px rgba(0, 0, 0, .25); }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------------------------------------------------------------- מסכים */
.screen { position: fixed; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding: 20px; text-align: center; }
.screen.show { display: flex; animation: pop .45s cubic-bezier(.2, 1.4, .4, 1); }
#title { background: linear-gradient(180deg, rgba(20, 50, 110, .42), rgba(20, 40, 80, .18) 45%, rgba(15, 40, 30, .42)); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
#pause, #win { background: rgba(20, 30, 60, .38); backdrop-filter: blur(4px); }
@keyframes pop { from { opacity: 0; transform: scale(.94); } }
.logo { position: relative; line-height: .9; transform: rotate(-3deg); filter: drop-shadow(0 10px 18px rgba(0, 30, 80, .35)); }
.logo-top { font-size: clamp(34px, 6vw, 64px); font-weight: 900; color: #fff; -webkit-text-stroke: 8px var(--ink); paint-order: stroke fill; letter-spacing: 2px; }
.logo-main { font-size: clamp(80px, 15vw, 170px); font-weight: 900; color: var(--gold); -webkit-text-stroke: 14px var(--ink); paint-order: stroke fill; text-shadow: 0 9px 0 var(--ink), 0 18px 24px rgba(0, 0, 0, .35); }
.logo-badge { position: absolute; left: -14px; bottom: 10px; background: var(--teal); color: #fff; font-weight: 900; font-size: clamp(16px, 2.4vw, 26px); padding: 4px 14px; border-radius: 12px; border: 4px solid var(--ink); transform: rotate(-8deg); direction: ltr; }
.tag { margin: 0; font-size: clamp(16px, 2.2vw, 22px); font-weight: 600; color: #fff; text-shadow: 0 2px 0 rgba(0, 0, 0, .35), 0 0 12px rgba(0, 0, 0, .25); }
.tag b { color: var(--gold); }

/* כפתורי טקסט — אותו מבנה: אייקון + מילים */
.big, .mid { display: inline-flex; align-items: center; justify-content: center; gap: 10px; font-weight: 900; border-radius: 22px; transition: transform .12s, box-shadow .12s; }
.big { font-size: clamp(21px, 2.8vw, 28px); padding: 14px 36px; color: #fff; background: linear-gradient(180deg, #ffad42, #ff6a1a); box-shadow: 0 6px 0 #b3410a, 0 12px 26px rgba(0, 0, 0, .25); border: 2px solid #ffd2a6; }
.big svg { font-size: 1.05em; }
.big:hover { transform: translateY(-2px) scale(1.03); }
.big:active { transform: translateY(4px); box-shadow: 0 2px 0 #b3410a; }
.mid { font-size: 17px; font-weight: 700; padding: 11px 22px; background: #eef2fc; color: var(--ink); box-shadow: 0 4px 0 #b9c3dd; border: 2px solid #fff; }
.mid svg { font-size: 20px; color: var(--ink-2); }
.mid:active { transform: translateY(3px); box-shadow: 0 1px 0 #b9c3dd; }
.mid:disabled { opacity: .55; cursor: default; transform: none; }
.row-btns { display: flex; flex-direction: column; align-items: center; gap: 10px; }

/* שורת הגדרות: עיגול אייקון ומתחתיו תווית */
.settings { display: flex; gap: 18px; justify-content: center; }
.sbtn { display: flex; flex-direction: column; align-items: center; gap: 5px; font-size: 13px; font-weight: 700; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, .5); }
.card .sbtn { color: var(--ink-2); text-shadow: none; }
.sbtn .ibtn { --h: 50px; font-size: 24px; }
.sbtn:active .ibtn { transform: translateY(2px) scale(.96); }

.keys { display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: center; color: #fff; font-weight: 600; text-shadow: 0 1px 2px rgba(0, 0, 0, .5); font-size: 15px; }
kbd { display: inline-block; min-width: 26px; padding: 2px 6px; margin: 0 2px; border-radius: 7px; background: rgba(255, 255, 255, .94); color: var(--ink); font-family: inherit; font-weight: 800; box-shadow: 0 2px 0 rgba(0, 0, 0, .3); text-shadow: none; }

.card { position: relative; background: var(--glass); border-radius: 30px; padding: 26px 34px; display: flex; flex-direction: column; align-items: center; gap: 14px; box-shadow: 0 10px 0 rgba(0, 0, 0, .14), 0 30px 60px rgba(0, 20, 60, .35); border: 4px solid #fff; min-width: min(420px, 92vw); }
.card h2 { margin: 0; font-size: 36px; font-weight: 900; }
.card-badge { position: absolute; top: -26px; left: 50%; transform: translateX(-50%); display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; background: linear-gradient(180deg, #ffad42, #ff6a1a); color: #fff; font-size: 24px; border: 4px solid #fff; box-shadow: var(--lift); }
.card-badge + h2 { margin-top: 10px; }
.win-title { color: var(--orange); -webkit-text-stroke: 7px #8a3300; paint-order: stroke fill; text-shadow: 0 4px 0 #8a3300; letter-spacing: 1px; }
#winStars { display: flex; gap: 10px; direction: ltr; }
.star { width: 62px; height: 62px; background: #ddd5c3; clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); transition: all .4s cubic-bezier(.2, 2, .4, 1); transform: scale(.8); }
.star:nth-child(2) { width: 76px; height: 76px; margin-top: -10px; }
.star.on { background: linear-gradient(180deg, #fff1a0, #ffc21a); transform: scale(1.1) rotate(8deg); filter: drop-shadow(0 0 10px #ffd84a); }
.big-letters span { width: 40px; height: 40px; font-size: 24px; margin: 0 2px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.stats div { background: #f3eddf; border-radius: 16px; padding: 8px 12px; display: flex; flex-direction: column; align-items: center; gap: 2px; border: 2px solid #fff; }
.stats svg { font-size: 22px; color: var(--ink-2); }
.stats b { font-size: 21px; font-variant-numeric: tabular-nums; }
.stats span { font-size: 12px; color: #6a6450; }
.hint { margin: 0; font-size: 14px; color: #6a6450; max-width: 360px; }

#fade { position: fixed; inset: 0; background: #0d1530; opacity: 0; pointer-events: none; transition: opacity .35s; }
#fade.on { opacity: 1; }
#loading { position: fixed; inset: 0; display: grid; place-items: center; background: linear-gradient(180deg, #4a9ff0, #8fd0ff); }
.spinner { width: 54px; height: 54px; border-radius: 50%; border: 6px solid rgba(255, 255, 255, .35); border-top-color: #fff; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------------------------------------------------------------- מגע */
#touch { display: none; position: fixed; inset: auto 0 0 0; padding: 0 max(18px, env(safe-area-inset-left)) max(18px, env(safe-area-inset-bottom)); justify-content: space-between; align-items: flex-end; pointer-events: none; direction: ltr; }
body.touch.playing #touch { display: flex; }
.pad { display: flex; gap: 14px; align-items: flex-end; pointer-events: auto; }
.pad .col { display: flex; flex-direction: column; gap: 10px; }
#touch button { display: grid; place-items: center; width: 76px; height: 76px; border-radius: 50%; background: rgba(255, 251, 242, .3); border: 3px solid rgba(255, 255, 255, .8); color: #fff; font-size: 34px; filter: drop-shadow(0 2px 3px rgba(0, 0, 0, .35)); backdrop-filter: blur(3px); touch-action: none; transition: transform .08s, background .08s; }
#touch button.small { width: 54px; height: 54px; font-size: 24px; }
#touch button.jump { width: 96px; height: 96px; font-size: 44px; background: linear-gradient(180deg, rgba(255, 173, 66, .65), rgba(255, 106, 26, .65)); }
#touch button.down { background: rgba(255, 255, 255, .7); color: var(--ink); transform: scale(.93); }

@media (max-width: 760px) {
  :root { --h: 38px; }
  .pill { font-size: 16px; padding: 0 10px; }
  .pill.name { display: none; }
  .btn-bar .ibtn { --h: 34px; font-size: 17px; }
  .letters span { width: 22px; height: 22px; font-size: 13px; }
  .heart { width: 20px; height: 19px; clip-path: path('M10 18 C4 13 0 9.5 0 5 C0 2 2.3 0 5 0 C7 0 8.8 1.2 10 2.9 C11.2 1.2 13 0 15 0 C17.7 0 20 2 20 5 C20 9.5 16 13 10 18Z'); }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .keys { display: none; }
}
@media (max-height: 500px) {
  .logo-main { font-size: 84px; } .logo-top { font-size: 32px; }
  .screen { gap: 10px; }
  .card { padding: 14px 24px; gap: 8px; }
  .card h2 { font-size: 26px; }
  .card-badge { display: none; }
  .star { width: 46px; height: 46px; } .star:nth-child(2) { width: 56px; height: 56px; }
  .big { padding: 10px 28px; }
  .sbtn .ibtn { --h: 42px; font-size: 20px; }
}
body.touch .keys { display: none; }

/* ---------------------------------------------------------------- יכולות ב־HUD */
.abilities { gap: 6px; padding: 0 12px; color: var(--teal); font-size: 24px; }
.abilities.hide { display: none; }
.row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.win-title { font-size: clamp(24px, 3.4vw, 36px) !important; }

/* ---------------------------------------------------------------- בחירת פרשה */
#levels { background: linear-gradient(180deg, rgba(20, 40, 90, .55), rgba(20, 40, 60, .45)); backdrop-filter: blur(3px); }
.levels-head { display: flex; align-items: center; gap: 14px; }
.levels-head h2 { margin: 0; display: flex; align-items: center; gap: 10px; color: #fff; font-size: clamp(26px, 4vw, 40px); font-weight: 900; -webkit-text-stroke: 6px var(--ink); paint-order: stroke fill; }
.levels-head h2 svg { color: var(--gold); filter: drop-shadow(0 2px 0 var(--ink)); }
.level-grid { display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; max-width: 980px; }
.lvl { position: relative; width: 210px; min-height: 230px; padding: 18px 14px 14px; border-radius: 26px; display: flex; flex-direction: column; align-items: center; gap: 8px;
  background: var(--glass); border: 4px solid #fff; box-shadow: 0 8px 0 rgba(0, 0, 0, .16), 0 18px 34px rgba(0, 20, 60, .3); transition: transform .15s; overflow: hidden; }
.lvl::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 92px; background: var(--lvl-bg); z-index: 0; }
.lvl > * { position: relative; z-index: 1; }
.lvl:hover { transform: translateY(-4px) rotate(-1deg); }
.lvl:active { transform: translateY(2px); }
.lvl.locked { filter: grayscale(.8); opacity: .6; cursor: default; transform: none; }
.theme-eden { --lvl-bg: linear-gradient(180deg, #5fb0ff, #9be27a); }
.theme-flood { --lvl-bg: linear-gradient(180deg, #4a5a74, #6fa0b8); }
.theme-canaan { --lvl-bg: linear-gradient(180deg, #3a3a7a, #f2a46a); }
.lvl-num { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 50%; background: #fff; color: var(--ink); font-weight: 900; font-size: 22px; box-shadow: 0 3px 0 rgba(0, 0, 0, .2); }
.lvl-book { margin-top: 18px; font-size: 13px; font-weight: 700; color: var(--ink-2); }
.lvl-name { font-size: 34px; font-weight: 900; color: var(--ink); line-height: 1; }
.lvl-letters { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; }
.lvl-letters i { font-style: normal; display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: radial-gradient(circle at 40% 30%, #9b7bff, #4b2bc4); color: #ffd84a; font-weight: 900; font-size: 15px; border: 2px solid #ffd34d; }
.lvl-stars { display: flex; gap: 4px; direction: ltr; margin-top: auto; }
.lvl-stars i { width: 24px; height: 24px; background: #ddd5c3; clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
.lvl-stars i.on { background: linear-gradient(180deg, #fff1a0, #ffc21a); }
@media (max-height: 500px) { .lvl { width: 170px; min-height: 0; padding: 12px 10px 10px; gap: 5px; } .lvl::before { height: 70px; } .lvl-name { font-size: 26px; } .lvl-book { margin-top: 8px; } }

/* ---------------------------------------------------------------- הודעות אייקון, כרטיס פתיחה וחושך */
#toast.icons { display: flex; align-items: center; gap: 10px; font-size: 30px; padding: 8px 18px; }
#toast.icons svg { color: #fff; }
#toast.icons b { font-size: 26px; font-weight: 900; color: #bfe6ff; }
#toast.icons .miss { font-style: normal; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: 2px dashed #cfc5e8; color: #e6dcff; font-size: 20px; font-weight: 900; }
#toast .trophy-ico { color: #8a5a00; }
#dark { position: fixed; inset: 0; pointer-events: none; display: none; }
body.dark-level.playing #dark { display: block; }
#intro { position: fixed; left: 50%; top: 22%; transform: translate(-50%, -10px) scale(.9); opacity: 0; pointer-events: none; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; }
#intro.show { animation: intro 2.4s ease forwards; }
@keyframes intro { 0% { opacity: 0; transform: translate(-50%, 10px) scale(.9); } 12% { opacity: 1; transform: translate(-50%, 0) scale(1); } 78% { opacity: 1; transform: translate(-50%, 0) scale(1); } 100% { opacity: 0; transform: translate(-50%, -16px) scale(.96); } }
#intro small { font-size: 16px; font-weight: 800; color: #fff; text-shadow: 0 2px 4px rgba(0, 0, 0, .5); letter-spacing: 1px; }
#intro b { font-size: clamp(46px, 8vw, 84px); font-weight: 900; color: var(--gold); -webkit-text-stroke: 10px var(--ink); paint-order: stroke fill; line-height: 1; text-shadow: 0 6px 0 var(--ink); }
#intro span { display: flex; gap: 6px; direction: rtl; }
#intro span i { font-style: normal; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: rgba(255, 251, 242, .92); border: 3px dashed #b8a9e0; color: #8f80bf; font-size: 22px; font-weight: 900; }
.letters span.pop { animation: lpop .6s cubic-bezier(.2, 2, .4, 1); }
@keyframes lpop { 0% { transform: scale(2.2); } 100% { transform: scale(1.12); } }

/* ---------------------------------------------------------------- בחירת פרשה לפי ספרים */
.levels-head { flex-wrap: wrap; justify-content: center; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.tab { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 8px 16px; border-radius: 18px; background: rgba(255, 251, 242, .55); border: 3px solid rgba(255, 255, 255, .7); color: var(--ink); box-shadow: 0 3px 0 rgba(0, 0, 0, .15); transition: transform .12s; }
.tab b { font-size: 20px; font-weight: 900; }
.tab span { display: flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 800; color: var(--ink-2); }
.tab .st { width: 14px; height: 14px; background: linear-gradient(180deg, #fff1a0, #ffc21a); clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
.tab.on { background: var(--glass); border-color: #fff; transform: translateY(-2px); box-shadow: 0 5px 0 rgba(0, 0, 0, .18); }
.level-grid { max-width: 1060px; max-height: 64vh; overflow-y: auto; padding: 6px; scrollbar-width: thin; }
.lvl { width: 150px; min-height: 0; height: 150px; padding: 12px 10px 10px; gap: 6px; }
.lvl::before { height: 54px; }
.lvl-num { width: 40px; height: 40px; font-size: 19px; }
.lvl-name { font-size: 26px; margin-top: 8px; }
.lvl.done .lvl-num { background: var(--gold); }
.lvl-lock { position: absolute; top: 10px; left: 10px; font-size: 22px; z-index: 2; }
.star-keys { display: flex; gap: 22px; direction: ltr; margin-top: -6px; }
.star-keys span { display: flex; align-items: center; gap: 3px; font-size: 22px; font-weight: 900; opacity: .35; color: var(--ink-2); }
.star-keys span.on { opacity: 1; }
#btnNext.hide { display: none; }
.theme-canaanDay { --lvl-bg: linear-gradient(180deg, #5fb0ff, #e2c88a); }
.theme-night { --lvl-bg: linear-gradient(180deg, #0a1238, #3b4f86); }
.theme-egypt, .theme-sea { --lvl-bg: linear-gradient(180deg, #5fb0ff, #e8c98a); }
.theme-egyptBlood { --lvl-bg: linear-gradient(180deg, #5fb0ff, #b84a3a); }
.theme-egyptDark { --lvl-bg: linear-gradient(180deg, #05060f, #3a3a5a); }
.theme-sinai { --lvl-bg: linear-gradient(180deg, #3a4560, #a89a8a); }
.theme-mishkan { --lvl-bg: linear-gradient(180deg, #3b5fb8, #f0b878); }
.theme-desert { --lvl-bg: linear-gradient(180deg, #5fb0ff, #dcb878); }
.theme-moav { --lvl-bg: linear-gradient(180deg, #3a86d8, #a4b866); }
.theme-rain { --lvl-bg: linear-gradient(180deg, #5a7aa0, #8fbf6a); }
@media (max-height: 500px) { .lvl { width: 120px; height: 120px; } .lvl::before { height: 44px; } .lvl-name { font-size: 21px; margin-top: 4px; } .level-grid { max-height: 58vh; } .tab { padding: 4px 10px; } .tab b { font-size: 16px; } }

#dark { z-index: 1; }
#hud, #toast, #intro, .screen, #touch, #fade { z-index: 2; }
#fade { z-index: 5; }

/* ---------------------------------------------------------------- סמלי המכניקות על כרטיס הפרשה */
.lvl-mech { display: flex; gap: 3px; justify-content: center; min-height: 22px; }
.lvl-mech svg { width: 22px; height: 22px; color: #3b1f08; filter: drop-shadow(0 1px 0 rgba(255,255,255,.6)); }
.lvl.locked .lvl-mech { opacity: .45; }
@media (max-height: 500px) { .lvl-mech svg { width: 17px; height: 17px; } .lvl-mech { min-height: 17px; } }

/* רווח בין מילים בשם הפרשה */
#letters .word-gap, #winLetters .word-gap { width: 12px; min-width: 12px; padding: 0; border: 0; background: none; box-shadow: none; }
#intro i.word-gap { width: 16px; border: 0; background: none; box-shadow: none; }

/* כרטיס פרשה לפי המראה שלה */
.look-dawn { --lvl-bg: linear-gradient(180deg, #3a4a8c, #c99ab8 55%, #ffd7a8); }
.look-sunset { --lvl-bg: linear-gradient(180deg, #2a2468, #d8644e 55%, #ffb262); }
.look-night { --lvl-bg: linear-gradient(180deg, #050a22, #16244e 55%, #2e4278); }
.look-rain { --lvl-bg: linear-gradient(180deg, #5a6e8a, #93a6ba 55%, #cdd6de); }
.look-storm { --lvl-bg: linear-gradient(180deg, #2e3a50, #5f6f86 55%, #98a4b2); }
.look-snow { --lvl-bg: linear-gradient(180deg, #6f86a8, #bccadb 55%, #ffffff); }
.look-fog { --lvl-bg: linear-gradient(180deg, #8f9cac, #bcc5ce 55%, #d6dce1); }

/* ---------------------------------------------------------------- מקרא הכוחות */
button.abilities { border: 0; font: inherit; cursor: pointer; pointer-events: auto; }
button.abilities:hover { transform: translateY(-1px); }
.abilities svg { width: 28px; height: 28px; }
#powers { background: rgba(20, 30, 60, .38); backdrop-filter: blur(4px); }
.power-list { display: flex; flex-direction: column; gap: 12px; width: 100%; }
.power { display: grid; grid-template-columns: 52px auto 1fr; align-items: center; gap: 14px; background: rgba(255, 255, 255, .6); border-radius: 18px; padding: 10px 14px; text-align: right; }
.power .pic { width: 46px; height: 46px; }
.power .how { display: flex; align-items: center; gap: 6px; direction: rtl; }
.power .txt { font-size: 18px; font-weight: 800; color: var(--ink); }
.power kbd { display: inline-grid; place-items: center; min-width: 36px; height: 34px; padding: 0 8px; border-radius: 9px; background: #fff; border: 2px solid #c9c2b0; border-bottom-width: 4px; font: 900 15px Rubik, sans-serif; color: var(--ink); }
.power .kbtn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: rgba(255, 255, 255, .9); border: 2px solid #c9c2b0; }
.power .kbtn svg { width: 20px; height: 20px; }
.power .air { width: 22px; height: 22px; color: #8fa6c8; }
.power .then { width: 14px; height: 2px; background: #b8b0a0; border-radius: 2px; }
.power .hold { outline: 3px dashed #ffb35a; outline-offset: 3px; border-radius: 12px; }
.power .cnt { font-size: 24px; color: #e8a800; }
@media (max-height: 500px) { .power { padding: 6px 10px; gap: 10px; } .power .pic { width: 34px; height: 34px; } .power .txt { font-size: 15px; } }

/* לוגו בפינה השמאלית העליונה — במסך הפתיחה ובבחירת פרשה */
#brand-logo { position: fixed; top: max(14px, env(safe-area-inset-top)); left: max(16px, env(safe-area-inset-left)); width: 84px; height: auto; z-index: 3; pointer-events: none; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .35)); display: none; }
body.show-logo #brand-logo { display: block; }
@media (max-width: 700px), (max-height: 500px) { #brand-logo { width: 58px; top: 10px; left: 12px; } }

/* ---------------------------------------------------------------- משתמשים */
#users, #newUser, #confirm, #shop { background: linear-gradient(180deg, rgba(20, 40, 90, .55), rgba(20, 40, 60, .45)); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); }
.users-head, .shop-head { display: flex; align-items: center; gap: 14px; width: min(1000px, 94vw); }
.screen-title { flex: 1; display: flex; align-items: center; justify-content: center; gap: 10px; margin: 0; font-size: 40px; font-weight: 900; color: #fff; text-shadow: 0 3px 0 rgba(0, 0, 0, .25); }
.screen-title svg { width: 40px; height: 40px; }
.user-grid { display: flex; flex-wrap: wrap; gap: 18px; justify-content: center; max-width: 1000px; }
.ucard { position: relative; width: 190px; padding: 18px 14px 14px; border-radius: 28px; background: var(--glass); border: 4px solid #fff; box-shadow: 0 8px 0 rgba(0, 0, 0, .14), 0 20px 40px rgba(0, 20, 60, .3); display: flex; flex-direction: column; align-items: center; gap: 6px; transition: transform .15s; cursor: pointer; }
.ucard:hover { transform: translateY(-4px); }
.ucard .av { width: 96px; height: 96px; border-radius: 50%; background: var(--av, #ffe7c2); padding: 6px; box-shadow: inset 0 -4px 0 rgba(0, 0, 0, .12); }
.ucard b { font-size: 26px; font-weight: 900; color: var(--ink); }
.ucard .stats { display: flex; gap: 12px; font-weight: 800; color: var(--ink-2); font-size: 17px; }
.ucard .stats span { display: flex; align-items: center; gap: 4px; }
.ucard .stats svg { width: 20px; height: 20px; }
.ucard .st { width: 18px; height: 18px; background: linear-gradient(180deg, #fff1a0, #ffc21a); clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
.ucard .del { position: absolute; top: 8px; left: 8px; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: rgba(255, 255, 255, .8); color: #c0392b; border: 2px solid #f0c0b8; }
.ucard .del svg { width: 20px; height: 20px; }
.ucard.add { justify-content: center; min-height: 210px; border-style: dashed; background: rgba(255, 255, 255, .35); color: #fff; }
.ucard.add svg { width: 64px; height: 64px; }
.newuser-card { gap: 18px; }
#nuName { width: min(340px, 80vw); font: 900 30px Rubik, sans-serif; text-align: center; padding: 12px 16px; border-radius: 18px; border: 3px solid #d8cfe8; background: #fff; color: var(--ink); outline: none; }
#nuName:focus { border-color: #9b7bff; }
.gender-pick { display: flex; gap: 18px; }
.gpick { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 14px 22px; border-radius: 24px; background: rgba(255, 255, 255, .6); border: 4px solid transparent; transition: transform .12s; }
.gpick .av { width: 110px; height: 110px; }
.gpick b { font-size: 24px; font-weight: 900; color: var(--ink); }
.gpick.on { border-color: #ffb800; background: #fff8dc; transform: scale(1.06); }
.note { display: flex; align-items: center; gap: 6px; margin: 0; font-weight: 800; color: var(--ink-2); font-size: 16px; }
.note svg { width: 20px; height: 20px; }
.row { display: flex; gap: 12px; align-items: center; justify-content: center; }
button.big:disabled { opacity: .45; filter: grayscale(.6); pointer-events: none; }
.danger, button.big.danger { background: linear-gradient(180deg, #ff6a5a, #e0392b) !important; }
.card-badge.danger { color: #fff; }
#confirmText { font-size: 24px; font-weight: 900; color: var(--ink); margin: 6px 0; }
.me-bar { display: flex; gap: 8px; align-items: center; }
.user-chip { border: 0; font: inherit; cursor: pointer; gap: 8px; padding: 0 12px 0 6px; }
.user-chip .av { width: 34px; height: 34px; }
.user-chip b { font-size: 18px; }
.user-chip span { display: flex; align-items: center; gap: 3px; font-weight: 800; }
.user-chip span svg { width: 20px; height: 20px; }
.user-chip i { font-style: normal; }
/* ---------------------------------------------------------------- חנות */
.shop-body { display: flex; gap: 18px; width: min(1000px, 94vw); height: min(560px, 72vh); }
.shop-stage { position: relative; flex: 0 0 38%; border-radius: 28px; overflow: hidden; background: radial-gradient(circle at 50% 35%, #fff6e0, #ffd9a8 60%, #f0b878); border: 4px solid #fff; box-shadow: 0 8px 0 rgba(0, 0, 0, .14); }
.shop-stage canvas { width: 100%; height: 100%; display: block; }
.shop-try { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); display: none; gap: 8px; }
.shop-try.show { display: flex; }
.shop-try button { display: flex; align-items: center; gap: 6px; padding: 10px 18px; border-radius: 999px; font: 900 20px Rubik, sans-serif; color: #fff; background: linear-gradient(180deg, #4ad07a, #22a050); border: 3px solid #fff; box-shadow: 0 4px 0 rgba(0, 0, 0, .18); }
.shop-try button svg { width: 22px; height: 22px; }
.shop-try button.no-money { background: linear-gradient(180deg, #b8b8c8, #8a8a9a); }
.shop-side { flex: 1; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.shop-tabs { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.shop-tabs button { width: 58px; height: 58px; border-radius: 18px; display: grid; place-items: center; background: rgba(255, 251, 242, .6); border: 3px solid rgba(255, 255, 255, .7); box-shadow: 0 3px 0 rgba(0, 0, 0, .15); }
.shop-tabs button svg { width: 36px; height: 36px; color: var(--ink); }
.shop-tabs button.on { background: #fff; border-color: #ffb800; transform: translateY(-2px); }
.shop-grid { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; padding: 4px; align-content: start; scrollbar-width: thin; }
.sitem { position: relative; aspect-ratio: 1; border-radius: 20px; background: var(--glass); border: 3px solid #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; box-shadow: 0 4px 0 rgba(0, 0, 0, .12); transition: transform .12s; }
.sitem:hover { transform: translateY(-2px); }
.sitem .th { width: 64px; height: 64px; }
.sitem .price { display: flex; align-items: center; gap: 3px; font-weight: 900; font-size: 17px; color: var(--ink); }
.sitem .price svg { width: 18px; height: 18px; }
.sitem.locked .price { color: #a0907a; }
.sitem.owned .price { display: none; }
.sitem.on { border-color: #4ad07a; background: #effff2; }
.sitem .mark { position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%; background: #4ad07a; color: #fff; display: none; place-items: center; }
.sitem .mark svg { width: 16px; height: 16px; }
.sitem.on .mark { display: grid; }
.sitem.try { border-color: #ffb800; background: #fff8dc; }
.sitem.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.wallet { gap: 6px; font-size: 22px; }
.wallet svg { width: 26px; height: 26px; }
.wallet.bump { animation: lpop .5s; }
@media (max-height: 520px), (max-width: 760px) {
  .shop-body { height: 74vh; gap: 10px; } .shop-stage { flex-basis: 34%; } .screen-title { font-size: 28px; } .screen-title svg { width: 30px; height: 30px; }
  .shop-tabs button { width: 46px; height: 46px; } .shop-tabs button svg { width: 28px; height: 28px; } .shop-grid { grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); } .sitem .th { width: 48px; height: 48px; }
  .ucard { width: 150px; padding: 12px 10px 10px; } .ucard .av { width: 70px; height: 70px; } .ucard b { font-size: 20px; } .ucard.add { min-height: 160px; }
  .gpick .av { width: 80px; height: 80px; } #nuName { font-size: 24px; padding: 8px 12px; }
}

.me-bar.hide { display: none; }
.wallet-line { color: #2e7d32; }

/* ---------------------------------------------------------------- בית */
#home { background: linear-gradient(180deg, rgba(20, 40, 90, .5), rgba(20, 40, 60, .4)); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); }
.home-wrap { display: flex; align-items: center; gap: 22px; }
.home-stage { width: min(300px, 34vw); height: min(420px, 62vh); border-radius: 28px; overflow: hidden; background: radial-gradient(circle at 50% 35%, #fff6e0, #ffd9a8 60%, #f0b878); border: 4px solid #fff; box-shadow: 0 8px 0 rgba(0, 0, 0, .14); }
.home-stage canvas { width: 100%; height: 100%; display: block; }
.home-card { gap: 16px; min-width: min(380px, 50vw); }
.home-name { font-size: 46px; font-weight: 900; color: var(--ink); }
.home-stats { display: flex; gap: 22px; font-size: 26px; font-weight: 900; color: var(--ink-2); }
.home-stats span { display: flex; align-items: center; gap: 6px; }
.home-stats svg { width: 30px; height: 30px; }
.home-stats .st { width: 28px; height: 28px; background: linear-gradient(180deg, #fff1a0, #ffc21a); clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%); }
.home-stats i { font-style: normal; }
@media (max-height: 520px), (max-width: 700px) { .home-name { font-size: 32px; } .home-stage { height: 70vh; } .home-card { gap: 10px; } }

/* השלב הנוכחי בבחירת פרשה */
.lvl.current { outline: 5px solid #ffb800; outline-offset: 3px; box-shadow: 0 0 0 9px rgba(255, 184, 0, .25), 0 10px 0 rgba(0, 0, 0, .14); animation: curPulse 1.6s ease-in-out infinite; }
@keyframes curPulse { 50% { outline-color: #ffe066; } }

/* תפריט עצירה: עמודה אחת ברוחב קבוע — המשך, שורת ניווט של שלושה, ושורת הגדרות מיושרת אליה */
.pause-card { width: min(360px, 92vw); min-width: 0; padding: 34px 26px 22px; gap: 16px; align-items: stretch; }
.pause-card > .big { width: 100%; }
.pause-nav, .pause-set { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; width: 100%; }
.pause-set { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); padding-top: 14px; border-top: 2px dashed rgba(60, 70, 110, .16); }
.pause-set .sbtn { justify-self: center; }
.tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 12px 4px 10px; border-radius: 18px; background: #eef2fc; color: var(--ink); font-size: 15px; font-weight: 800; box-shadow: 0 4px 0 #b9c3dd; border: 2px solid #fff; transition: transform .12s, box-shadow .12s; }
.tile svg { font-size: 26px; color: var(--ink-2); }
.tile:hover { transform: translateY(-1px); }
.tile:active { transform: translateY(3px); box-shadow: 0 1px 0 #b9c3dd; }
@media (max-height: 520px) { .pause-card { padding: 16px 20px 14px; gap: 10px; } .tile { padding: 8px 4px 6px; } .tile svg { font-size: 22px; } .pause-set { padding-top: 8px; } }

/* מסך סיום: עמודה אחת ברוחב קבוע, הכול מיושר לאותם קצוות */
.win-card { width: min(440px, 94vw); min-width: 0; align-items: stretch; gap: 14px; padding: 22px 26px 20px; }
.win-card > .win-title, .win-card > #winLetters { align-self: center; }
.win-card #winStars { justify-content: center; align-items: flex-end; gap: 18px; }
.star-col { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.crit { display: flex; align-items: center; gap: 3px; font-size: 21px; font-weight: 900; color: var(--ink-2); opacity: .3; }
.crit.on { opacity: 1; }
.win-card .stats { grid-template-columns: repeat(4, 1fr); width: 100%; }
.win-card .stats div { padding: 8px 4px; }
.wallet-strip { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 8px 14px; border-radius: 16px; background: #eaf6e6; border: 2px solid #fff; color: #2e7d32; font-size: 15px; }
.wallet-strip svg { font-size: 22px; }
.wallet-strip b { font-size: 22px; font-variant-numeric: tabular-nums; }
.wallet-strip span { margin-inline-start: auto; font-size: 20px; font-weight: 900; color: var(--ink); font-variant-numeric: tabular-nums; }
.wallet-strip .coin-ic { color: #e0a412; }
.win-card > .big { width: 100%; }
.hide { display: none !important; }
@media (max-height: 560px) { .win-card { gap: 8px; padding: 12px 20px; } .win-card .stats b { font-size: 17px; } .crit { font-size: 15px; } }

#hearts .heart.pop { animation: heartPop .5s ease-out; }
@keyframes heartPop { 0% { transform: scale(1.8); } 60% { transform: scale(.9); } 100% { transform: scale(1); } }

/* כפתור גרפיקה: ארבעה פסים — כמה מהם מלאים לפי הרמה; A קטן במצב אוטומטי */
.gfx .ibtn { position: relative; }
.gfx-bars { width: 1em; height: 1em; }
.gfx-bars rect { fill: currentColor; opacity: .22; transition: opacity .2s; }
.gfx[data-q="low"] .b1, .gfx[data-q="medium"] .b1, .gfx[data-q="medium"] .b2, .gfx[data-q="high"] rect { opacity: 1; }
.gfx[data-q="medium"] .b3 { opacity: 1; }
.gfx-a { position: absolute; top: -4px; right: -4px; display: none; width: 18px; height: 18px; border-radius: 50%; background: var(--orange, #ff7a1a); color: #fff; font-size: 11px; line-height: 18px; text-align: center; font-weight: 900; border: 2px solid #fff; }
.gfx.auto .gfx-a { display: block; }

/* לחצן בית בפינה — באזור המשתמש */
.screen-home { position: absolute; top: 16px; right: 16px; z-index: 2; }
