/* ==========================================================================
   משחקות בארגז החול — שפת עיצוב: בורדו חי וזהב בוהק על רקעים בהירים (סעיף 11)
   ========================================================================== */
:root {
  --bordo-deep: #470E19;   /* כותרות, טקסט כהה */
  --bordo: #A82858;        /* כפתורים, כרטיסי כותרת */
  --bordo-glow: #BD356A;   /* הדגשות, מצב נבחר */
  --gold: #F9B82A;         /* קווים, אייקונים, מסגרות */
  --gold-light: #FDD672;   /* רקע זוהר, ניצוצות */
  --cream: #FEFCF5;        /* רקע מסכים */
  --ink: #3A1220;
  --muted: #8A6B75;
  --card: #FFFFFF;
  --radius: 18px;
  --shadow: 0 6px 24px rgba(71, 14, 25, 0.08);
  --font-head: 'Noto Serif Hebrew', serif;
  --font-body: 'Noto Sans Hebrew', sans-serif;
  --font-scale: 1;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html { font-size: calc(16px * var(--font-scale)); }

body {
  font-family: var(--font-body);
  background: var(--cream);
  color: var(--ink);
  min-height: 100vh;
  padding-top: calc(74px + env(safe-area-inset-top));
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
}

body.no-chrome { padding-top: 0; padding-bottom: 0; }

h1, h2, h3, .head { font-family: var(--font-head); color: var(--bordo-deep); }

/* ---- סרגל עליון קבוע ---- */
.topbar {
  position: fixed; top: 0; right: 0; left: 0; z-index: 50;
  height: calc(74px + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  background: var(--cream);
  border-bottom: 1.5px solid var(--gold);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1px;
}
.topbar-symbol { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 1.5px var(--gold-light); }
.topbar-title { font-family: var(--font-head); font-size: 0.82rem; font-weight: 600; color: var(--bordo-deep); letter-spacing: 0.02em; }

/* ---- סרגל תחתון ---- */
.bottomnav {
  position: fixed; bottom: 0; right: 0; left: 0; z-index: 50;
  height: calc(66px + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--cream);
  border-top: 1.5px solid var(--gold);
  display: flex; justify-content: space-around; align-items: stretch;
}
.navitem {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; border: none; background: none; cursor: pointer;
  color: #C9A9B4; font-family: var(--font-body); font-size: 0.72rem; font-weight: 500;
  transition: color .2s;
}
.navitem svg { width: 24px; height: 24px; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.navitem.active { color: var(--bordo); }

/* ---- מבנה כללי ---- */
main#app { max-width: 560px; margin: 0 auto; padding: 14px 18px 24px; }
.screen { animation: fadeUp .35s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.card {
  background: var(--card);
  border: 1.5px solid rgba(249, 184, 42, 0.45);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 14px;
}

.card-head {
  background: linear-gradient(135deg, var(--bordo) 0%, var(--bordo-glow) 100%);
  color: #FFF7EC;
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 14px;
  box-shadow: 0 8px 22px rgba(168, 40, 88, 0.25);
}
.card-head h2 { color: #FFF7EC; font-size: 1.25rem; margin-bottom: 2px; }
.card-head .sub { font-size: 0.85rem; opacity: .92; font-weight: 300; }

.card-gold {
  background: linear-gradient(135deg, var(--gold-light) 0%, var(--gold) 100%);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 14px;
  color: var(--bordo-deep);
  box-shadow: 0 8px 22px rgba(249, 184, 42, 0.3);
}

/* ---- כפתורים ---- */
.btn {
  display: block; width: 100%;
  background: linear-gradient(135deg, var(--bordo) 0%, var(--bordo-glow) 100%);
  color: #FFF7EC; border: none; border-radius: 999px;
  padding: 14px 22px; font-family: var(--font-body); font-size: 1rem; font-weight: 600;
  cursor: pointer; transition: transform .15s, box-shadow .2s;
  box-shadow: 0 6px 18px rgba(168, 40, 88, 0.3);
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: default; box-shadow: none; }
.btn-outline {
  background: none; color: var(--bordo);
  border: 1.5px solid var(--bordo); box-shadow: none;
}
.btn-gold {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  color: var(--bordo-deep); box-shadow: 0 6px 18px rgba(249, 184, 42, .35);
}
.btn-small { width: auto; padding: 8px 18px; font-size: .85rem; }
.btn-row { display: flex; gap: 10px; }
.btn-row .btn { flex: 1; }

/* ---- שדות ---- */
label.flabel { display: block; font-weight: 600; color: var(--bordo-deep); margin: 14px 0 4px; font-size: .95rem; }
.fhint { font-size: .8rem; color: var(--muted); margin-bottom: 6px; line-height: 1.5; }
input[type=text], input[type=password], input[type=date], textarea, select {
  width: 100%; border: 1.5px solid #EAD9DE; border-radius: 14px;
  background: #FFFDF8; padding: 12px 14px; font-family: var(--font-body); font-size: 1rem;
  color: var(--ink); transition: border-color .2s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(249,184,42,.18); }
textarea { min-height: 110px; resize: vertical; line-height: 1.7; }

/* ---- מסך כניסה ---- */
.welcome { text-align: center; padding-top: 8px; }
.welcome-logo { width: 210px; height: 210px; max-width: 62vw; max-height: 62vw; aspect-ratio: 1/1; object-fit: cover; border-radius: 50%; margin: 10px auto 14px; display: block; background: #FEFCF5; box-shadow: 0 10px 30px rgba(249,184,42,.35); }
.welcome h1 { font-size: 1.55rem; line-height: 1.4; }
.welcome .tag { color: var(--bordo); font-weight: 600; margin: 6px 0 2px; }
.welcome .desc { color: var(--muted); font-size: .92rem; line-height: 1.7; margin: 10px 0 18px; }

/* ---- מפת מסע ---- */
.greet-card { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.greet-card .week { font-size: .8rem; opacity: .85; }
.progressbar { height: 10px; border-radius: 999px; background: rgba(255,255,255,.55); overflow: hidden; margin-top: 10px; }
.progressbar > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--bordo), var(--bordo-glow)); transition: width .5s; }
.progressbar.ondark { background: rgba(71,14,25,.12); }
.progressbar.ondark > i { background: linear-gradient(90deg, var(--gold), var(--gold-light)); }
.progress-label { font-size: .78rem; margin-top: 6px; color: rgba(71,14,25,.75); }

.taskrow {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border: 1.5px solid rgba(249,184,42,.45); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 10px; cursor: pointer; box-shadow: var(--shadow);
  transition: transform .15s;
}
.taskrow:active { transform: scale(.98); }
.taskrow .ticon {
  width: 46px; height: 46px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--gold); background: #FFFDF8;
}
.taskrow .ticon svg, .taskrow .ticon img { width: 26px; height: 26px; }
.taskrow .ticon svg { stroke: var(--bordo); fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.taskrow .tname { font-family: var(--font-head); font-weight: 700; color: var(--bordo-deep); font-size: 1.02rem; }
.taskrow .tmeta { font-size: .78rem; color: var(--muted); margin-top: 2px; }
.taskrow.locked { opacity: .62; }
.taskrow.done .ticon { background: linear-gradient(135deg, var(--gold-light), var(--gold)); border-color: var(--gold); }
.taskrow.open { border-color: var(--bordo); border-width: 2px; }
.taskrow .chev { margin-inline-start: auto; color: var(--gold); font-size: 1.2rem; }
.taskrow.shabbat { border-style: dashed; background: #FFFDF6; }

/* ---- קלף משימה ---- */
.stages-dots { display: flex; justify-content: center; gap: 7px; margin: 4px 0 16px; }
.stages-dots i { width: 9px; height: 9px; border-radius: 50%; background: #EBD8DD; transition: background .2s; }
.stages-dots i.done { background: var(--gold); }
.stages-dots i.now { background: var(--bordo); transform: scale(1.25); }
.stage-q { font-family: var(--font-head); font-size: 1.15rem; font-weight: 700; color: var(--bordo-deep); margin-bottom: 4px; }
.stage-sub { color: var(--muted); font-size: .88rem; line-height: 1.7; margin-bottom: 12px; }
.video-box {
  border-radius: var(--radius); background: linear-gradient(160deg, #FFF3D6, #FBE9B8);
  border: 1.5px solid var(--gold-light);
  min-height: 190px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 22px; text-align: center;
}
.video-box .play {
  width: 68px; height: 68px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--gold-light), var(--gold));
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 8px 20px rgba(249,184,42,.45);
}
.video-box .play svg { width: 30px; height: 30px; fill: var(--bordo-deep); margin-inline-start: -3px; }
.video-box video { width: 100%; border-radius: 12px; }

/* טיימר */
.timer-wrap { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 8px 0 4px; }
.timer-ring { position: relative; width: 230px; height: 230px; }
.timer-ring svg { transform: rotate(-90deg); }
.timer-ring .t-time {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-family: var(--font-head); font-size: 2.6rem; font-weight: 800; color: var(--bordo-deep);
}
.timer-ring .t-time small { font-size: .8rem; font-weight: 400; color: var(--muted); font-family: var(--font-body); }
.dancer-icon { width: 84px; height: 84px; }
.timer-note { text-align: center; color: var(--muted); font-size: .85rem; line-height: 1.7; }

/* סמלים אישיים */
.sym-grid { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; margin: 14px 0; }
.sym-btn {
  width: 58px; height: 58px; border-radius: 50%; border: 2px solid var(--gold-light);
  background: #FFFDF8; cursor: pointer; padding: 5px; transition: transform .15s, border-color .2s, box-shadow .2s;
}
.sym-btn img { width: 100%; height: 100%; }
.sym-btn.sel { border-color: var(--bordo); box-shadow: 0 0 0 4px rgba(189,53,106,.18); transform: scale(1.08); }

/* קלף הפתעה */
.surprise-cards { display: grid; gap: 10px; margin: 12px 0; }
.surprise-card {
  border: 1.5px solid var(--gold-light); border-radius: var(--radius); background: #FFFDF8;
  padding: 14px 16px; cursor: pointer; font-size: .92rem; line-height: 1.6; transition: border-color .2s, box-shadow .2s;
}
.surprise-card.sel { border-color: var(--bordo); box-shadow: 0 0 0 4px rgba(189,53,106,.15); }

/* ניקוד */
.points-hero { text-align: center; padding: 20px 16px; }
.points-hero .big { font-family: var(--font-head); font-size: 2.6rem; font-weight: 800; color: var(--bordo-deep); }
.points-hero .of { color: var(--muted); font-size: .85rem; }
.raffle-banner {
  border-radius: var(--radius); padding: 14px 16px; margin: 14px 0;
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  color: var(--bordo-deep); font-weight: 600; text-align: center; line-height: 1.6;
}
.raffle-banner.pending { background: #FBF3E2; border: 1.5px dashed var(--gold); font-weight: 500; }
.ptable { width: 100%; border-collapse: collapse; font-size: .88rem; }
.ptable td { padding: 8px 6px; border-bottom: 1px solid #F3E7EB; }
.ptable td:last-child { text-align: left; color: var(--bordo); font-weight: 600; }

/* קהילה */
.post { position: relative; }
.post .phead { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.post .avatar {
  width: 40px; height: 40px; border-radius: 50%; background: #FFF3D6;
  display: flex; align-items: center; justify-content: center; border: 1.5px solid var(--gold-light);
  font-family: var(--font-head); font-weight: 700; color: var(--bordo);
}
.post .pname { font-weight: 700; color: var(--bordo-deep); font-size: .92rem; }
.post .pmeta { font-size: .72rem; color: var(--muted); }
.post .ptext { line-height: 1.8; font-size: .95rem; white-space: pre-wrap; }
.post .pactions { display: flex; gap: 14px; margin-top: 10px; font-size: .78rem; color: var(--muted); }
.linklike { background: none; border: none; color: var(--bordo); font-size: .78rem; cursor: pointer; font-family: var(--font-body); padding: 0; }
.comment { background: #FBF3E2; border-radius: 12px; padding: 8px 12px; margin-top: 8px; font-size: .85rem; line-height: 1.6; }
.comment b { color: var(--bordo-deep); }
.preset-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.chip {
  border: 1.5px solid var(--gold-light); background: #FFFDF8; color: var(--bordo-deep);
  border-radius: 999px; padding: 7px 14px; font-size: .8rem; cursor: pointer; font-family: var(--font-body);
}
.chip:active { background: var(--gold-light); }
.rules-box { background: #FFF8E7; border: 1.5px solid var(--gold-light); border-radius: 14px; padding: 12px 14px; font-size: .82rem; line-height: 1.8; color: var(--bordo-deep); }

/* מפה אישית */
.map-canvas {
  border-radius: var(--radius); background: radial-gradient(circle at 50% 30%, #FFF6DE, #FCEFC9);
  border: 1.5px solid var(--gold-light); min-height: 300px; position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 8px;
  padding: 24px; text-align: center;
}
.map-sym { width: 92px; height: 92px; }
.map-stamps { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.stamp {
  width: 52px; height: 52px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  border: 2px dashed #E3CBA0; opacity: .45;
}
.stamp.done { border: 2px solid var(--gold); opacity: 1; background: rgba(255,255,255,.7); box-shadow: 0 4px 14px rgba(249,184,42,.35); }
.stamp img { width: 34px; height: 34px; }

/* יומן */
.journal-entry { border-inline-start: 3px solid var(--gold); padding-inline-start: 12px; margin-bottom: 16px; }
.journal-entry .jq { font-family: var(--font-head); font-weight: 700; color: var(--bordo-deep); font-size: .9rem; }
.journal-entry .ja { font-size: .9rem; line-height: 1.8; white-space: pre-wrap; margin-top: 3px; }
.journal-entry .jmeta { font-size: .72rem; color: var(--muted); margin-top: 3px; }

/* ניהול */
.admin-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.admin-tabs button {
  border: 1.5px solid var(--gold-light); background: #FFFDF8; border-radius: 999px;
  padding: 7px 14px; font-size: .8rem; cursor: pointer; font-family: var(--font-body); color: var(--bordo-deep);
}
.admin-tabs button.active { background: var(--bordo); color: #FFF7EC; border-color: var(--bordo); }
.code-chip { font-family: monospace; background: #FFF3D6; border-radius: 8px; padding: 4px 10px; margin: 3px; display: inline-block; letter-spacing: .08em; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid #F3E7EB; }
.switch { position: relative; width: 48px; height: 27px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .sl { position: absolute; inset: 0; border-radius: 999px; background: #E4CFD6; transition: .2s; cursor: pointer; }
.switch .sl:before { content: ''; position: absolute; width: 21px; height: 21px; border-radius: 50%; background: #fff; top: 3px; inset-inline-start: 3px; transition: .2s; }
.switch input:checked + .sl { background: var(--bordo); }
.switch input:checked + .sl:before { transform: translateX(-21px); }

/* מודלים וטוסט */
.modal-back { position: fixed; inset: 0; background: rgba(71,14,25,.45); z-index: 90; display: flex; align-items: flex-end; justify-content: center; }
.modal {
  background: var(--cream); border-radius: 22px 22px 0 0; width: 100%; max-width: 560px;
  max-height: 86vh; overflow-y: auto; padding: 22px 20px calc(22px + env(safe-area-inset-bottom));
  animation: fadeUp .3s ease both;
}
.toast {
  position: fixed; bottom: calc(84px + env(safe-area-inset-bottom)); right: 50%; transform: translateX(50%);
  background: var(--bordo-deep); color: #FFF7EC; border-radius: 999px; padding: 10px 22px;
  font-size: .88rem; z-index: 99; box-shadow: 0 8px 24px rgba(0,0,0,.3); max-width: 88vw; text-align: center;
}

.note { font-size: .8rem; color: var(--muted); line-height: 1.7; }
.divider { height: 1.5px; background: linear-gradient(90deg, transparent, var(--gold-light), transparent); margin: 18px 0; border: none; }
.center { text-align: center; }
.mt { margin-top: 14px; }
.mb { margin-bottom: 14px; }
.zoom-link { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--bordo-deep); }
.zoom-link .zicon { width: 38px; height: 38px; border-radius: 50%; border: 1.5px solid var(--gold); display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.zoom-link .zicon svg { width: 20px; height: 20px; stroke: var(--bordo); fill: none; stroke-width: 1.7; }

/* הפחתת תנועה (נגישות) */
body.reduce-motion * { animation: none !important; transition: none !important; }

@media (min-width: 561px) {
  .bottomnav { max-width: 560px; right: 50%; transform: translateX(50%); border-radius: 20px 20px 0 0; border: 1.5px solid var(--gold); border-bottom: none; }
  .topbar { max-width: 560px; right: 50%; transform: translateX(50%); border-radius: 0 0 20px 20px; border: 1.5px solid var(--gold); border-top: none; }
}
