/* ============================================================
   app.css - פריסה ורכיבים
   ============================================================ */

* { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  background: var(--ink);
  color: var(--parchment);
  font-family: var(--font-ui);
  font-size: var(--t-body);
  -webkit-text-size-adjust: 100%;
}

body {
  min-height: 100vh;
  /* רקע פסיפס עדין: רשת אבנים כהה */
  background-image:
    radial-gradient(circle at 50% 0%, rgba(246,167,43,.10), transparent 55%),
    repeating-linear-gradient(0deg, rgba(255,255,255,.022) 0 1px, transparent 1px 22px),
    repeating-linear-gradient(90deg, rgba(255,255,255,.022) 0 1px, transparent 1px 22px);
  background-attachment: fixed;
}

.app {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: var(--s3) var(--s4) 108px;
}

h1, h2, h3 { font-family: var(--font-display); font-weight: 400; margin: 0; line-height: 1.15; }
h1 { font-size: var(--t-hero); }
h2 { font-size: var(--t-title); }
h3 { font-size: var(--t-sub); }
p  { line-height: 1.55; margin: 0 0 var(--s3); max-width: 62ch; }

:focus-visible {
  outline: 3px solid var(--lamp);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------- סרגל עליון ---------- */
.topbar {
  display: flex; align-items: center; gap: var(--s2);
  padding: var(--s2) 0 var(--s4);
}
.rankbadge {
  display: flex; align-items: center; gap: var(--s2);
  background: var(--ink-2); border: var(--stroke);
  border-radius: var(--r-pill); padding: 5px 12px 5px 6px;
  box-shadow: var(--lift);
}
.rankbadge .dot {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--lamp); border: var(--stroke);
  display: grid; place-items: center;
  font-family: var(--font-display); font-size: .8rem; color: var(--ink);
}
.rankbadge b { font-size: var(--t-small); font-weight: 700; }
.spacer { flex: 1; }
.coins {
  display: flex; align-items: center; gap: 6px;
  background: var(--ink-2); border: var(--stroke); box-shadow: var(--lift);
  border-radius: var(--r-pill); padding: 6px 12px;
  font-weight: 800; font-variant-numeric: tabular-nums;
}
.coins svg { width: 18px; height: 18px; }

/* ---------- נר הרצף (הגיבור של מסך הבית) ---------- */
.lamp-stage {
  position: relative;
  display: grid; place-items: center;
  padding: var(--s5) 0 var(--s3);
}
.lamp-glow {
  position: absolute; top: 4%; left: 50%; transform: translateX(-50%);
  width: 240px; height: 240px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255,211,122,.34), rgba(246,167,43,.10) 45%, transparent 70%);
  pointer-events: none;
}
.lamp-svg { width: 190px; height: 210px; position: relative; }
.flame { transform-origin: 50% 100%; animation: flicker 2.6s ease-in-out infinite; }
@keyframes flicker {
  0%,100% { transform: scale(1) translateY(0); }
  35%     { transform: scale(1.06, .96) translateY(1px); }
  70%     { transform: scale(.97, 1.04) translateY(-1px); }
}
.streak-line {
  font-family: var(--font-display);
  font-size: var(--t-title);
  text-align: center;
  margin-top: var(--s2);
}
.streak-line span { color: var(--lamp); }
.streak-sub { text-align: center; color: var(--parchment-2); font-size: var(--t-small); margin-top: 2px; }

/* ---------- כפתורים ---------- */
.btn {
  font-family: var(--font-ui); font-size: var(--t-body); font-weight: 800;
  color: var(--ink); background: var(--lamp);
  border: var(--stroke); border-radius: var(--r-card);
  box-shadow: var(--lift-lg);
  padding: var(--s3) var(--s5);
  cursor: pointer; width: 100%;
  transition: transform .08s ease, box-shadow .08s ease;
}
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--ink-line); }
.btn[disabled] { opacity: .45; cursor: default; }
.btn.ghost { background: var(--ink-2); color: var(--parchment); }
.btn.olive { background: var(--olive); color: var(--parchment); }
.btn.small { padding: var(--s2) var(--s4); font-size: var(--t-small); width: auto; box-shadow: var(--lift); }

.cta-daily { position: relative; text-align: center; }
.cta-daily .cta-main { font-family: var(--font-display); font-size: 1.45rem; display: block; }
.cta-daily .cta-meta { display: block; font-size: var(--t-small); font-weight: 600; opacity: .8; margin-top: 2px; }

/* ---------- אריחי פסיפס לניווט ---------- */
.tilegrid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: var(--s2); margin-top: var(--s5);
}
.tile {
  background: var(--ink-2); border: var(--stroke); border-radius: var(--r-tile);
  box-shadow: var(--lift);
  padding: var(--s3) var(--s2); text-align: center; cursor: pointer;
  color: var(--parchment); font-weight: 700; font-size: var(--t-small);
  display: grid; gap: 6px; justify-items: center;
  transition: transform .08s ease;
}
.tile:active { transform: translateY(3px); box-shadow: none; }
.tile .ic { width: 30px; height: 30px; display: grid; place-items: center; }
.tile .ic svg { width: 28px; height: 28px; }
.tile[data-accent="brick"]   { border-color: var(--ink-line); background: linear-gradient(var(--ink-2), var(--ink-2)) padding-box; }
.tile .ic[data-c="brick"]   svg { color: var(--brick); }
.tile .ic[data-c="olive"]   svg { color: var(--olive); }
.tile .ic[data-c="tchelet"] svg { color: var(--tchelet); }
.tile .ic[data-c="lamp"]    svg { color: var(--lamp); }
.tile .ic[data-c="plum"]    svg { color: var(--plum); }

/* אלמנטים שנהפכו לכפתורים: מאפסים את ברירת המחדל של הדפדפן */
.clue, .word, .orderitem, .station, .charcard {
  font-family: inherit; font-size: inherit; color: inherit;
  text-align: right; width: 100%;
}
.word { width: auto; }
.station { background: none; border: none; padding: var(--s2) 0; }
.charcard { padding: 0; }
button.clue, button.word, button.orderitem, button.station, button.charcard { cursor: pointer; }
.word[disabled] { cursor: default; }

/* ---------- לוח כללי ---------- */
.panel {
  background: var(--ink-2); border: var(--stroke); border-radius: var(--r-card);
  box-shadow: var(--lift); padding: var(--s4); margin-bottom: var(--s3);
}
.panel h3 { margin-bottom: var(--s2); }
.muted { color: var(--parchment-2); font-size: var(--t-small); }

/* ---------- מסך שאלה ---------- */
.qhead { display: flex; align-items: center; gap: var(--s2); margin-bottom: var(--s3); }
.progressbar {
  flex: 1; height: 12px; background: var(--ink-2);
  border: var(--stroke); border-radius: var(--r-pill); overflow: hidden;
}
.progressbar i { display: block; height: 100%; background: var(--lamp); width: 0; transition: width .3s ease; }
.qtype {
  font-family: var(--font-display); font-size: var(--t-small);
  background: var(--ink-3); border: var(--stroke); border-radius: var(--r-pill);
  padding: 3px 10px; white-space: nowrap;
}
.timer { font-weight: 800; font-variant-numeric: tabular-nums; min-width: 42px; text-align: center; }

.qcard {
  background: var(--ink-2); border: var(--stroke); border-radius: var(--r-card);
  box-shadow: var(--lift-lg); padding: var(--s5) var(--s4); margin-bottom: var(--s4);
}
.verse {
  font-family: var(--font-verse); font-size: 1.32rem; line-height: 1.85;
  color: var(--lamp-soft); text-align: center;
}
.qprompt { font-family: var(--font-display); font-size: var(--t-sub); text-align: center; margin-top: var(--s3); }
.source { text-align: center; font-size: var(--t-tiny); color: var(--parchment-2); margin-top: var(--s2); }

.options { display: grid; gap: var(--s2); }
.opt {
  text-align: right; font-family: var(--font-ui); font-size: var(--t-body); font-weight: 600;
  background: var(--ink-2); color: var(--parchment);
  border: var(--stroke); border-radius: var(--r-tile); box-shadow: var(--lift);
  padding: var(--s3) var(--s4); cursor: pointer; width: 100%;
  display: flex; align-items: center; gap: var(--s3);
  transition: transform .08s ease;
}
.opt .mark {
  width: 24px; height: 24px; flex: none; border-radius: 50%;
  border: var(--stroke); background: var(--ink-3);
  display: grid; place-items: center; font-weight: 800; font-size: .8rem;
}
.opt:active { transform: translateY(3px); box-shadow: none; }
.opt.is-right { background: var(--olive); color: #fff; }
.opt.is-wrong { background: var(--brick); color: #fff; }
.opt.is-dim   { opacity: .45; }
.opt[disabled] { cursor: default; }

/* רמזים (מי אני) */
.clues { display: grid; gap: var(--s2); margin-bottom: var(--s4); }
.clue {
  border: var(--stroke); border-radius: var(--r-tile); padding: var(--s3);
  background: var(--ink-3); display: flex; gap: var(--s3); align-items: center;
}
.clue .n {
  width: 26px; height: 26px; flex: none; border-radius: 6px; border: var(--stroke);
  background: var(--lamp); color: var(--ink); display: grid; place-items: center;
  font-family: var(--font-display); font-size: .85rem;
}
.clue.locked { background: transparent; border-style: dashed; color: var(--parchment-2); cursor: pointer; }

/* מילים (השלמת פסוק / מצא את הטעות) */
.wordrow { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.word {
  font-family: var(--font-verse); font-size: 1.22rem;
  background: var(--ink-3); border: var(--stroke); border-radius: 8px;
  padding: 4px 10px; cursor: pointer; color: var(--parchment);
  transition: transform .08s ease;
}
.word:active { transform: translateY(2px); }
.word.plain { background: transparent; border-color: transparent; cursor: default; }
.word.is-right { background: var(--olive); color: #fff; }
.word.is-wrong { background: var(--brick); color: #fff; }
.blank {
  display: inline-block; min-width: 76px; border-bottom: 3px solid var(--lamp);
  color: var(--lamp-soft); text-align: center;
}
.blank.filled { border-bottom-color: var(--olive); }

/* סידור אירועים */
.orderlist { display: grid; gap: var(--s2); }
.orderitem {
  display: flex; align-items: center; gap: var(--s3);
  background: var(--ink-3); border: var(--stroke); border-radius: var(--r-tile);
  padding: var(--s3); cursor: pointer;
}
.orderitem .n {
  width: 28px; height: 28px; flex: none; border-radius: 50%; border: var(--stroke);
  background: var(--ink-2); display: grid; place-items: center;
  font-family: var(--font-display); font-size: .85rem; color: var(--parchment-2);
}
.orderitem.picked .n { background: var(--lamp); color: var(--ink); }
.orderitem.is-right { background: var(--olive); color: #fff; }
.orderitem.is-wrong { background: var(--brick); color: #fff; }

/* משוב */
.feedback {
  border: var(--stroke); border-radius: var(--r-card); padding: var(--s4);
  margin-bottom: var(--s3); box-shadow: var(--lift);
}
.feedback.good { background: color-mix(in srgb, var(--olive) 26%, var(--ink-2)); }
.feedback.bad  { background: color-mix(in srgb, var(--brick) 22%, var(--ink-2)); }
.feedback h3 { font-size: var(--t-sub); margin-bottom: 6px; }
.feedback .verse { font-size: 1.1rem; text-align: right; }

/* פסוק עם מקומות ריקים: זרימת טקסט רגילה, לא אריחים */
.versefill { line-height: 2.1; }
.versefill .blank { margin: 0 5px; vertical-align: -3px; padding-bottom: 2px; }

/* רצועת השבוע */
.weekpanel { margin-top: var(--s4); }
.weekdots { display: flex; justify-content: space-between; gap: 4px; }
.wd {
  flex: 1; aspect-ratio: 1; max-width: 40px; border-radius: 50%;
  border: var(--stroke); background: var(--ink-3); color: var(--parchment-2);
  display: grid; place-items: center; font-weight: 800; font-size: var(--t-small);
}
.wd.lit { background: var(--lamp); color: var(--ink); }
.wd.today { box-shadow: 0 0 0 3px rgba(246,167,43,.28); }

/* ---------- אוסף כרטיסים ---------- */
.cardgrid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--s2); }
.charcard {
  border: var(--stroke); border-radius: var(--r-tile); overflow: hidden;
  background: var(--ink-2); box-shadow: var(--lift); cursor: pointer;
  display: grid; grid-template-rows: auto auto;
}
.charcard .art { aspect-ratio: 1; display: grid; place-items: center; border-bottom: var(--stroke); }
.charcard .art svg { width: 62%; height: 62%; }
.charcard .nm { padding: 6px 4px; text-align: center; font-weight: 800; font-size: var(--t-small); }
.charcard.locked { opacity: .55; }
.silhouette svg { filter: brightness(0); opacity: .45; }
.charcard.locked .nm { font-family: var(--font-display); }
.charcard[data-r="common"] .art { background: color-mix(in srgb, var(--rare-common) 30%, var(--ink)); }
.charcard[data-r="rare"]   .art { background: color-mix(in srgb, var(--rare-rare) 34%, var(--ink)); }
.charcard[data-r="epic"]   .art { background: color-mix(in srgb, var(--rare-epic) 40%, var(--ink)); }
.charcard[data-r="legend"] .art { background: color-mix(in srgb, var(--rare-legend) 34%, var(--ink)); }

/* ---------- חנות ---------- */
.shopgrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--s2); }
.shopitem {
  border: var(--stroke); border-radius: var(--r-tile); background: var(--ink-2);
  box-shadow: var(--lift); padding: var(--s3); display: grid; gap: 6px; justify-items: center; text-align: center;
}
.shopitem .art { width: 64px; height: 64px; }
.shopitem .art svg { width: 100%; height: 100%; }
.shopitem .nm { font-weight: 800; font-size: var(--t-small); }
.shopitem .who { font-size: var(--t-tiny); color: var(--parchment-2); }
.shopitem .price { display: flex; align-items: center; gap: 4px; font-weight: 800; font-size: var(--t-small); }
.shopitem .price svg { width: 15px; height: 15px; }
.shopitem.owned { border-color: var(--olive); }

/* אווטאר */
.avatar-stage { display: grid; place-items: center; gap: var(--s3); }
.medallion {
  width: 168px; height: 168px; border-radius: 50%;
  border: 4px solid var(--ink-line); background: var(--ink-3);
  position: relative; display: grid; place-items: center;
  box-shadow: 0 0 0 6px var(--lamp), 0 6px 0 var(--ink-line);
}
.medallion .base { width: 74%; height: 74%; }
.medallion .slot { position: absolute; width: 46px; height: 46px; }
.medallion .slot svg { width: 100%; height: 100%; }
.slot-hand { bottom: 8px; right: -8px; }
.slot-head { top: -14px; left: 50%; transform: translateX(-50%); }
.slot-back { bottom: 8px; left: -8px; }

/* ---------- מפה ---------- */
.route { position: relative; padding: var(--s3) 0; }
.route::before {
  content: ""; position: absolute; top: 0; bottom: 0; right: 26px;
  width: 4px; background: repeating-linear-gradient(180deg, var(--ink-3) 0 9px, transparent 9px 18px);
}
.station {
  display: flex; gap: var(--s3); align-items: flex-start;
  padding: var(--s2) 0; position: relative;
}
.station .pin {
  width: 56px; height: 56px; flex: none; border-radius: 50%;
  border: var(--stroke); background: var(--ink-2);
  display: grid; place-items: center; z-index: 1;
  box-shadow: var(--lift);
}
.station .pin svg { width: 30px; height: 30px; color: var(--parchment-2); }
.station.done .pin { background: var(--olive); }
.station.done .pin svg { color: #fff; }
.station.current .pin { background: var(--lamp); box-shadow: 0 0 0 5px rgba(246,167,43,.22), var(--lift); }
.station.current .pin svg { color: var(--ink); }
.station.locked { opacity: .45; }
.station .body { padding-top: 6px; }
.station .body b { font-family: var(--font-display); font-size: var(--t-sub); font-weight: 400; }
.station .body p { margin: 2px 0 0; font-size: var(--t-small); color: var(--parchment-2); }

/* ---------- מפת ידע ---------- */
.heatrow { display: flex; align-items: center; gap: var(--s2); margin-bottom: 6px; }
.heatrow .lbl { width: 92px; flex: none; font-size: var(--t-small); font-weight: 700; }
.heatbar { flex: 1; height: 22px; border: var(--stroke); border-radius: 6px; background: var(--ink-3); overflow: hidden; }
.heatbar i { display: block; height: 100%; transition: width .4s ease; }
.heatrow .pct { width: 44px; text-align: left; font-size: var(--t-small); font-variant-numeric: tabular-nums; color: var(--parchment-2); }

/* ---------- ניווט תחתון ---------- */
.navbar {
  position: fixed; bottom: 0; right: 0; left: 0;
  background: var(--ink-2); border-top: var(--stroke);
  padding: 6px max(var(--s3), env(safe-area-inset-right)) calc(6px + env(safe-area-inset-bottom));
  z-index: 40;
}
.navbar .inner { max-width: var(--maxw); margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); }
.navbtn {
  background: none; border: none; color: var(--parchment-2); cursor: pointer;
  display: grid; justify-items: center; gap: 2px; padding: 6px 0;
  font-family: var(--font-ui); font-size: var(--t-tiny); font-weight: 700;
}
.navbtn svg { width: 24px; height: 24px; }
.navbtn.active { color: var(--lamp); }

/* ---------- מודאל ---------- */
.modal-bg {
  position: fixed; inset: 0; background: rgba(6,10,22,.82);
  display: grid; place-items: center; padding: var(--s4); z-index: 60;
}
.modal {
  background: var(--ink-2); border: var(--stroke); border-radius: var(--r-card);
  box-shadow: var(--lift-lg); padding: var(--s5); max-width: 420px; width: 100%;
  text-align: center;
}
.modal .bigart { width: 120px; height: 120px; margin: 0 auto var(--s3); }
.modal .bigart svg { width: 100%; height: 100%; }

/* ---------- שונות ---------- */
.row { display: flex; gap: var(--s2); }
.row > * { flex: 1; }
.center { text-align: center; }
.stack > * + * { margin-top: var(--s3); }
.backlink svg { width: 22px; height: 22px; display: block; }
.backlink {
  background: none; border: none; color: var(--parchment-2); cursor: pointer;
  font-family: var(--font-ui); font-weight: 700; font-size: var(--t-small); padding: 0;
}
.pillrow { display: flex; flex-wrap: wrap; gap: 6px; }
.pill {
  border: var(--stroke); border-radius: var(--r-pill); padding: 4px 12px;
  font-size: var(--t-small); font-weight: 700; background: var(--ink-3); cursor: pointer;
}
.pill.on { background: var(--lamp); color: var(--ink); }

.scorebig { font-family: var(--font-display); font-size: 3.4rem; color: var(--lamp); line-height: 1; }

@media (max-width: 360px) {
  .cardgrid { grid-template-columns: repeat(2, 1fr); }
}

@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}
