/* ==========================================================================
   שש-בש — עיצוב Ebony & Copper: אבנוס חם, נחושת/ברונזה, שנהב.
   מותאם קודם כול לטלפון.
   ========================================================================== */

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

:root {
  --bg-0: #120e0a;
  --bg-1: #1e1610;
  --surface: rgba(255, 232, 196, .055);
  --surface-2: rgba(255, 232, 196, .10);
  --line: rgba(255, 232, 196, .10);
  --text: #f2e8d8;
  --text-dim: #96806a;
  --gold: #c07840;
  --gold-hi: #da9a60;
  --gold-dim: #8a5020;

  /* ערכת הלוח — נדרסת ב-body[data-board] */
  --felt: #140f0c;
  --pt-light-a: #584a38;
  --pt-light-b: #3c3024;
  --pt-dark-a: #231c14;
  --pt-dark-b: #17110b;
  --frame-a: #231c14; --frame-b: #13100c; --frame-c: #100e0b;
  --bar-a: #120e0a;   --bar-b: #1e1610;
  --chk-w-1: #ffffff; --chk-w-2: #f3efe6; --chk-w-3: #cfc7b6; --chk-w-ring: #8d7f61;
  --chk-b-1: #40393a; --chk-b-2: #231d1b; --chk-b-3: #100c0a; --chk-b-ring: #8a7a6a;
  --die-a: #fbfcfd;   --die-b: #dbe1e8;   --die-pip: #1b222b;
  --die-ai-a: #352a22; --die-ai-b: #1e1510; --die-ai-pip: #f0e4d0;
  --pnum: rgba(255, 232, 196, .3);

  --ar: 1.6;                     /* יחס רוחב/גובה של הלוח */
  --ease: cubic-bezier(.22, .61, .36, 1);
  --move: 260ms;
}

/* גובה הלוח נגזר מיחס המסך — בטלפון הלוח מאונך וממלא את הגובה */
@media (max-aspect-ratio: 4/5)   { :root { --ar: .66; } }
@media (min-aspect-ratio: 4/5) and (max-aspect-ratio: 5/4) { :root { --ar: 1; } }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;              /* אין גלילה של הדף עצמו — רק אזורים פנימיים נגללים */
  overscroll-behavior: none;     /* בלי "קפיצת גומי" בקצוות */
}

body {
  position: fixed;               /* נועל את הדף למקומו, שלא יזוז עם שורת הכתובת */
  inset: 0;
  width: 100%;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(120% 80% at 50% -10%, #2a1a0c 0%, transparent 55%),
    radial-gradient(90% 60% at 50% 108%, #1e1206 0%, transparent 60%),
    var(--bg-0);
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}

/* ---------- מסכים ---------- */

.screen {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 100vh;      /* גיבוי לדפדפנים ישנים */
  height: 100svh;     /* גובה יציב (עם שורת הכתובת) — כל הממשק תמיד נכנס בלי גלילה */
  display: none;
  flex-direction: column;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  overflow: hidden;
}
.screen.on { display: flex; animation: screen-in .28s var(--ease); }
@keyframes screen-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- מסך הבית ---------- */

.home-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: safe center;
  gap: 10px;
  padding: 12px 22px 16px;
  text-align: center;
}
.home-scroll::-webkit-scrollbar { display: none; }

.home-hero { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.logo-lg {
  width: clamp(68px, 18vmin, 92px);
  aspect-ratio: 1;
  filter: drop-shadow(0 10px 24px rgba(192, 120, 64, .28));
}
.home-title {
  margin: 2px 0 0;
  font-size: clamp(1.7rem, 7vmin, 2.3rem);
  font-weight: 800;
  letter-spacing: -.01em;
}
.home-sub { margin: 0; font-size: .82rem; color: var(--text-dim); }

/* צ'יפ הפרופיל הפעיל */
.who-chip {
  font: inherit;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 14px 8px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  cursor: pointer;
  transition: background .16s, transform .1s;
}
.who-chip:active { transform: scale(.97); background: var(--surface-2); }
.who-av { font-size: 1.1rem; line-height: 1; }
.who-name { font-size: .9rem; font-weight: 700; }
.who-swap { font-size: .69rem; color: var(--gold); opacity: .85; }

/* רשימת הפרופילים */
.prof-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 4px;
  border-top: 1px solid var(--line);
}
.prof-row.on .prof-name { color: var(--gold); }
.prof-av {
  flex: none;
  width: 40px; height: 40px;
  border-radius: 50%;
  font-size: 1.15rem;
  background: var(--surface);
  border: 1px solid var(--line);
  cursor: pointer;
}
.prof-row.on .prof-av { border-color: var(--gold); }
.prof-main {
  flex: 1;
  min-width: 0;
  text-align: start;
  background: none;
  border: none;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  padding: 0 2px;
}
.prof-name { display: block; font-size: .92rem; font-weight: 700; }
.prof-sub { display: block; font-size: .68rem; color: var(--text-dim); margin-top: 1px; }
.prof-ico {
  flex: none;
  width: 34px; height: 34px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: .85rem;
  cursor: pointer;
}

/* שורת נתונים מהירה */
.home-quick {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 380px;
}
.home-quick .q {
  flex: 1;
  min-width: 0;          /* רוחב שווה לשלושת הכרטיסים גם עם מילה ארוכה */
  padding: 11px 6px;
  border-radius: 15px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.home-quick .q b { display: block; font-size: 1.1rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.home-quick .q span { font-size: .6rem; letter-spacing: .1em; color: var(--text-dim); }

.home-actions { display: flex; flex-direction: column; gap: 8px; width: 100%; max-width: 380px; }
.home-btn-row { display: flex; gap: 8px; width: 100%; }
.home-btn-row .home-btn { flex: 1; justify-content: center; }
.home-btn {
  font: inherit;
  font-size: .95rem;
  font-weight: 700;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 17px;
  padding: 13px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  transition: background .16s, transform .1s;
}
.home-btn:active { transform: scale(.975); background: var(--surface-2); }
.home-btn.primary {
  background: linear-gradient(180deg, var(--gold-hi), var(--gold-dim));
  color: #1a0e06;
  border-color: transparent;
  box-shadow: 0 12px 28px -10px rgba(192, 120, 64, .65);
}
.home-btn:disabled { opacity: .4; box-shadow: none; cursor: default; }
.home-btn:disabled:active { transform: none; }
.home-btn svg { width: 19px; height: 19px; fill: currentColor; }
.home-btn svg.stroke { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.home-foot { margin: 0; font-size: .72rem; color: var(--text-dim); opacity: .75; }

/* ---------- מסכי משנה (סטטיסטיקות, לובי) ---------- */

.sub-top {
  flex: none;
  height: 54px;
  display: grid;
  grid-template-columns: 40px 1fr 40px;
  align-items: center;
  padding: 0 12px;
}
.ghost-spacer { display: block; }
.ghost-btn.back svg { stroke-width: 2.2; }

.sub-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 16px calc(28px + env(safe-area-inset-bottom));
}

/* כרטיסי סטטיסטיקה */
.stat-sec { margin-bottom: 20px; }
.stat-sec h4 {
  margin: 0 0 9px;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .1em;
  color: var(--text-dim);
}
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 15px;
  padding: 13px 11px;
  text-align: center;
}
.stat-card b {
  display: block;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.stat-card b.gold { color: var(--gold); }
.stat-card span { font-size: .66rem; color: var(--text-dim); line-height: 1.3; display: block; margin-top: 2px; }

/* שורות ערך */
.stat-rows { background: var(--surface); border: 1px solid var(--line); border-radius: 15px; overflow: hidden; }
.stat-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 14px;
  font-size: .82rem;
}
.stat-row + .stat-row { border-top: 1px solid var(--line); }
.stat-row b { font-weight: 700; font-variant-numeric: tabular-nums; }

/* התפלגות דירוגים */
.qbar { display: flex; align-items: center; gap: 9px; padding: 7px 14px; font-size: .78rem; }
.qbar + .qbar { border-top: 1px solid var(--line); }
.qbar .lbl { flex: none; width: 74px; color: var(--grade, var(--text-dim)); font-weight: 600; }
.qbar .track { flex: 1; height: 7px; border-radius: 99px; background: rgba(255,255,255,.07); overflow: hidden; }
.qbar .fill { display: block; height: 100%; border-radius: 99px; background: var(--grade, #888); transition: width .5s var(--ease); }
.qbar .val { flex: none; min-width: 30px; text-align: end; font-variant-numeric: tabular-nums; font-weight: 700; }

.stat-empty { text-align: center; color: var(--text-dim); font-size: .84rem; padding: 40px 10px; }

/* ---------- כותרת מסך משנה ---------- */

.intro-hero { text-align: center; padding: 12px 6px 20px; }
.intro-hero .logo-lg { width: 74px; }
.intro-hero p { margin: 0; font-size: .85rem; color: var(--text-dim); line-height: 1.55; }

/* ---------- לובי משחק מול חבר ---------- */

.code-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 22px 18px;
  border-radius: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  margin-bottom: 14px;
}
.code-cap { font-size: .74rem; letter-spacing: .08em; color: var(--text-dim); }
#room-code {
  font-size: 2.3rem;
  font-weight: 800;
  letter-spacing: .22em;
  color: var(--gold);
  text-indent: .22em;      /* מאזן את הרווח הנגרר מ-letter-spacing */
  font-variant-numeric: tabular-nums;
}
#join-input {
  font: inherit;
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: .18em;
  text-align: center;
  text-transform: uppercase;
  width: 100%;
  max-width: 260px;
  padding: 10px 8px;
  color: var(--gold);
  background: rgba(0, 0, 0, .35);
  border: 1px solid var(--line);
  border-radius: 13px;
  outline: none;
}
#join-input:focus { border-color: var(--gold); }
#join-input::placeholder { color: rgba(255, 255, 255, .16); letter-spacing: .18em; }

.lobby-status { text-align: center; font-size: .84rem; color: var(--text-dim); margin: 6px 0 14px; min-height: 20px; }

.dots-wait { display: flex; gap: 7px; justify-content: center; margin-bottom: 20px; }
.dots-wait i {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--gold);
  animation: dotpulse 1.3s ease-in-out infinite;
}
.dots-wait i:nth-child(2) { animation-delay: .18s; }
.dots-wait i:nth-child(3) { animation-delay: .36s; }
@keyframes dotpulse { 0%, 100% { opacity: .25; transform: scale(.8); } 50% { opacity: 1; transform: scale(1); } }

/* ---------- אודות ---------- */
.about-hero { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px 0 20px; }
.about-hero .logo-lg { width: 80px; height: 80px; filter: drop-shadow(0 8px 24px rgba(192,120,64,.3)); }
.about-name { font-size: 1.6rem; font-weight: 700; letter-spacing: -.02em; }
.about-tagline { font-size: .88rem; color: var(--text-dim); }
.about-version { font-size: .72rem; color: var(--text-dim); opacity: .7; margin-top: 2px; }
.about-section { padding: 14px 0; border-top: 1px solid var(--line); }
.about-section h3 { font-size: .92rem; font-weight: 600; margin-bottom: 8px; color: var(--gold-hi); }
.about-section p { font-size: .84rem; color: var(--text-dim); line-height: 1.6; margin: 4px 0; }
.about-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.about-list li { font-size: .84rem; color: var(--text-dim); line-height: 1.55; padding-right: 12px; position: relative; }
.about-list li::before { content: ""; position: absolute; right: 0; top: 8px; width: 4px; height: 4px; border-radius: 50%; background: var(--gold); }
.about-footer { text-align: center; border-top: none; padding: 24px 0 12px; }
.about-footer p { color: var(--text-dim); font-size: .8rem; }

/* התראת ניתוק בתוך מסך המשחק */
#net-warn {
  flex: none;
  margin: 0 12px 3px;
  padding: 7px 12px;
  border-radius: 12px;
  text-align: center;
  font-size: .78rem;
  font-weight: 600;
  color: #ffd9a8;
  background: rgba(226, 128, 60, .16);
  border: 1px solid rgba(226, 128, 60, .4);
}

/* ---------- כרטיסי רמת קושי ---------- */

.lvl-cards { display: flex; flex-direction: column; gap: 9px; }
.lvl-card {
  font: inherit;
  text-align: start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
  cursor: pointer;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 3px 12px;
  transition: background .16s, border-color .16s, transform .1s;
}
.lvl-card:active { transform: scale(.98); }
.lvl-card:hover { background: var(--surface-2); border-color: rgba(192,120,64,.4); }
.lvl-name { grid-column: 1; font-size: .98rem; font-weight: 700; color: var(--text); }
.lvl-desc { grid-column: 1; font-size: .75rem; color: var(--text-dim); line-height: 1.4; }
.lvl-dots { grid-column: 2; grid-row: 1 / span 2; align-self: center; display: flex; gap: 4px; }
.lvl-dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.14); }
.lvl-dots i.on { background: var(--gold); }
/* אלוף — כרטיס פרימיום עם מסגרת זהב */
.lvl-card.champion {
  border-color: rgba(192,120,64,.5);
  background: linear-gradient(150deg, color-mix(in srgb, var(--gold) 12%, var(--surface)), var(--surface) 70%);
}
.lvl-card.champion .lvl-name { color: var(--gold-hi); }
.lvl-card.champion:hover { border-color: rgba(192,120,64,.75); }

.row-lbl small { display: block; font-size: .68rem; color: var(--text-dim); margin-top: 1px; }

/* ---------- סרגל עליון ---------- */

#topbar {
  flex: none;
  height: 52px;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  padding: 0 12px;
  gap: 8px;
}

.title {
  text-align: center;
  font-size: 1.02rem;
  font-weight: 700;
  letter-spacing: .2px;
  line-height: 1.15;
}
.title-sub {
  display: block;
  font-size: .69rem;
  font-weight: 500;
  letter-spacing: .16em;
  color: var(--text-dim);
  text-transform: uppercase;
}

.ghost-btn {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  padding: 0;
  transition: background .16s, transform .1s;
}
.ghost-btn:active { transform: scale(.94); background: var(--surface-2); }
.ghost-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; }

.stat-chip {
  width: 44px; height: 44px;
  display: grid; place-items: center;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  color: var(--gold);
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: background .16s, transform .1s;
}
.stat-chip:active { transform: scale(.94); }
.stat-num { font-size: .92rem; font-weight: 800; letter-spacing: -.02em; }
.stat-cap { font-size: .6rem; letter-spacing: .08em; color: var(--text-dim); margin-top: 1px; }

/* ---------- רצועות השחקנים ---------- */

.strip {
  flex: none;
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 3px 12px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 15px;
  background: var(--surface);
  transition: border-color .25s, background .25s, box-shadow .25s;
}
.strip.active {
  border-color: rgba(192, 120, 64, .5);
  background: rgba(192, 120, 64, .09);
  box-shadow: 0 0 0 1px rgba(192, 120, 64, .12), 0 6px 22px -10px rgba(192, 120, 64, .5);
}

/* טיימר התור — פס שמתקצר לאורך תחתית הרצועה של מי שתורו.
   מוקטן ב-transform ולא ברוחב, כדי לא לחתוך את זוהר מגש ההורדה. */
.strip { position: relative; }
.strip::after {
  content: "";
  position: absolute;
  left: 10px; right: 10px;
  bottom: 3px;
  height: 3px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold-hi));
  transform: scaleX(0);
  transform-origin: right center;   /* RTL — מתרוקן מימין לשמאל */
  transition: background .3s;
  pointer-events: none;
}
.strip.timing::after { transform: scaleX(var(--t, 1)); }
.strip.timing.urgent::after { background: linear-gradient(90deg, #b3402f, #ec7145); }
.strip.timing.urgent { border-color: rgba(236, 113, 69, .55); }

.who { display: flex; align-items: center; gap: 7px; flex: none; }
.avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-size: .8rem;
  border: 1px solid var(--line);
}
.avatar.w { background: linear-gradient(160deg, #fdfaf3, #d8d0c1); }
.avatar.b { background: linear-gradient(160deg, #2b323b, #14181d); }
.nm { font-size: .8rem; font-weight: 600; }

/* מונה חיילים שהורדו */
.borne {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 3px;
  height: 16px;
  padding: 0 4px;
  border-radius: 999px;
  background: rgba(0, 0, 0, .3);
  border: 1px solid rgba(255, 255, 255, .06);
  overflow: hidden;
  transition: box-shadow .25s;
}
.borne i {
  flex: 1;
  height: 7px;
  min-width: 2px;
  border-radius: 2px;
  background: rgba(255, 255, 255, .10);
  transition: background .3s var(--ease), box-shadow .3s;
}
.borne i.on { background: linear-gradient(180deg, var(--gold-hi), var(--gold-dim)); box-shadow: 0 0 6px rgba(192, 120, 64, .55); }
.borne.target { box-shadow: 0 0 0 2px var(--gold), 0 0 16px rgba(192, 120, 64, .55); cursor: pointer; animation: borne-pulse 1s ease-in-out infinite; }
@keyframes borne-pulse {
  0%, 100% { box-shadow: 0 0 0 2px var(--gold), 0 0 12px rgba(192, 120, 64, .45); }
  50%      { box-shadow: 0 0 0 3px var(--gold-hi), 0 0 22px rgba(192, 120, 64, .8); }
}

.pipbox { flex: none; text-align: center; line-height: 1.05; }
.pipbox b { display: block; font-size: .95rem; font-weight: 800; letter-spacing: -.02em; }
.pipbox span { font-size: .64rem; letter-spacing: .08em; color: var(--text-dim); }

/* ---------- הלוח ---------- */

#board-area {
  flex: 1;
  min-height: 0;
  display: grid;
  place-items: center;
  padding: 4px 10px;
}

#board {
  position: relative;
  width: 100%;
  max-width: 100%;
  max-height: 100%;
  aspect-ratio: var(--ar);
  border-radius: 18px;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  background: linear-gradient(165deg, var(--frame-a), var(--frame-b) 60%, var(--frame-c));
  box-shadow:
    0 1px 0 rgba(255, 255, 255, .09) inset,
    0 30px 60px -24px rgba(0, 0, 0, .95),
    0 0 0 1px rgba(255, 255, 255, .05);
}

/* משטח המשחק */
.field {
  position: absolute;
  left: 2.4%; right: 2.4%;
  top: 2.6%; bottom: 2.6%;
  border-radius: 8px;
  background: var(--felt);
  box-shadow:
    inset 0 2px 14px rgba(0, 0, 0, .75),
    inset 0 0 0 1px rgba(255, 255, 255, .045);
}

/* משולשי הנקודות */
.point {
  position: absolute;
  height: 41%;
  transition: filter .2s, opacity .2s;
}
.point.top    { top: 2.6%;    clip-path: polygon(6% 0, 94% 0, 50% 100%); }
.point.bottom { bottom: 2.6%; clip-path: polygon(6% 100%, 94% 100%, 50% 0); }
.point.c1        { background: linear-gradient(180deg, var(--pt-light-a), var(--pt-light-b)); }
.point.c0        { background: linear-gradient(180deg, var(--pt-dark-a), var(--pt-dark-b)); }
.point.bottom.c1 { background: linear-gradient(0deg, var(--pt-light-a), var(--pt-light-b)); }
.point.bottom.c0 { background: linear-gradient(0deg, var(--pt-dark-a), var(--pt-dark-b)); }

.point.src-hl  { filter: brightness(1.3); }
.point.dest-hl { filter: brightness(1.55) saturate(1.2); }
/* סימון המהלך שהרמז ממליץ עליו — הבהוב עדין בזהב */
.point.hint-hl {
  filter: brightness(1.5) saturate(1.25);
  animation: hint-pulse 1.1s ease-in-out infinite;
}
@keyframes hint-pulse {
  0%, 100% { filter: brightness(1.35) saturate(1.15); }
  50%      { filter: brightness(1.85) saturate(1.35); }
}

/* מספרי נקודות */
.pnum {
  position: absolute;
  text-align: center;
  font-size: clamp(9px, 1.5vmin, 11px);
  font-weight: 600;
  color: var(--pnum);
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}
.pnum.top { top: .5%; }
.pnum.bottom { bottom: .5%; }

/* הבר המרכזי */
.bar {
  position: absolute;
  top: 0; bottom: 0;
  background: linear-gradient(90deg, var(--bar-a), var(--bar-b) 50%, var(--bar-a));
  box-shadow: inset 1px 0 0 rgba(255,255,255,.05), inset -1px 0 0 rgba(255,255,255,.05);
  z-index: 2;
}
.bar::after {
  content: "";
  position: absolute;
  left: 50%; top: 8%; bottom: 8%;
  width: 1px;
  transform: translateX(-50%);
  background: linear-gradient(180deg, transparent, rgba(192,120,64,.28) 20%, rgba(192,120,64,.28) 80%, transparent);
}

/* ---------- חיילים ---------- */

.checker {
  position: absolute;
  border-radius: 50%;
  z-index: 5;
  will-change: left, top;
  transition:
    left var(--move) var(--ease),
    top var(--move) var(--ease),
    opacity 180ms linear,
    transform 200ms var(--ease),
    box-shadow 180ms;
}
.checker.w {
  background: radial-gradient(circle at 34% 28%, var(--chk-w-1), var(--chk-w-2) 42%, var(--chk-w-3) 92%);
  box-shadow:
    inset 0 0 0 1px rgba(120, 105, 80, .35),
    inset 0 -3px 5px rgba(120, 100, 65, .28),
    0 3px 7px rgba(0, 0, 0, .55);
}
.checker.b {
  background: radial-gradient(circle at 34% 28%, var(--chk-b-1), var(--chk-b-2) 45%, var(--chk-b-3) 92%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, .14),
    inset 0 -3px 5px rgba(0, 0, 0, .6),
    0 3px 7px rgba(0, 0, 0, .6);
}
.checker::after {
  content: "";
  position: absolute;
  inset: 21%;
  border-radius: 50%;
  border: 1px solid currentColor;
  opacity: .3;
}
.checker.w::after { color: var(--chk-w-ring); }
.checker.b::after { color: var(--chk-b-ring); }

.checker .cnt {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 62%;
  font-weight: 800;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}
.checker.w .cnt { color: #6b5f45; }
.checker.b .cnt { color: #dde5ee; }

/* חייל שהורד מהלוח — מתכווץ ונעלם */
.checker.gone { opacity: 0; transform: scale(.35); }

/* חייל שאפשר להזיז */
.checker.movable { cursor: grab; }
.checker.movable::before {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 2px solid var(--gold);
  opacity: .85;
  animation: halo 1.9s ease-in-out infinite;
}
@keyframes halo {
  0%, 100% { opacity: .45; transform: scale(1); }
  50%      { opacity: .95; transform: scale(1.06); }
}
.checker.selected { z-index: 40; }
.checker.selected::before {
  animation: none;
  opacity: 1;
  inset: -4px;
  border-width: 2.5px;
  box-shadow: 0 0 14px rgba(192, 120, 64, .85);
}
.checker.dragging {
  z-index: 60;
  transition: none;
  transform: scale(1.14);
  box-shadow: 0 14px 26px rgba(0, 0, 0, .7);
}
/* חייל שהוכה — עף אל הבר בקשת קצרה עם הילה אדומה */
.checker.flying {
  z-index: 55;
  animation: fly 420ms var(--ease);
  box-shadow: 0 0 0 3px rgba(255, 96, 84, .9), 0 0 22px rgba(255, 96, 84, .6), 0 8px 16px rgba(0,0,0,.6);
}
@keyframes fly {
  0%   { transform: scale(1.3) rotate(-14deg); }
  60%  { transform: scale(1.16) rotate(8deg); }
  100% { transform: none; }
}

/* הבזק במקום הפגיעה */
.spark {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9;
  border: 2px solid rgba(255, 96, 84, .95);
  animation: spark 500ms ease-out forwards;
}
@keyframes spark {
  0%   { transform: scale(.5); opacity: 1; }
  100% { transform: scale(2.1); opacity: 0; }
}

/* סמן יעד */
.dest {
  position: absolute;
  border-radius: 50%;
  z-index: 8;
  cursor: pointer;
  border: 2px dashed rgba(192, 120, 64, .9);
  background: rgba(192, 120, 64, .14);
  animation: halo 1.9s ease-in-out infinite;
}
.dest.hit {
  border-color: rgba(255, 116, 106, .95);
  background: rgba(255, 116, 106, .18);
}

/* ---------- קוביות ---------- */

.die {
  position: absolute;
  border-radius: 22%;
  background: linear-gradient(160deg, var(--die-a), var(--die-b));
  box-shadow:
    inset 0 1px 1px rgba(255, 255, 255, .9),
    inset 0 -3px 5px rgba(90, 105, 120, .35),
    0 5px 12px rgba(0, 0, 0, .55);
  z-index: 4;
  transition: opacity .25s, filter .25s, transform .25s var(--ease);
}
.die.ai { background: linear-gradient(160deg, var(--die-ai-a), var(--die-ai-b)); box-shadow: inset 0 1px 1px rgba(255,255,255,.16), inset 0 -3px 5px rgba(0,0,0,.6), 0 5px 12px rgba(0,0,0,.6); }
.die .grid {
  position: absolute;
  inset: 16%;
  display: grid;
  grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  place-items: center;
}
.die .pip {
  width: 74%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--die-pip);
  visibility: hidden;
}
.die.ai .pip { background: var(--die-ai-pip); }
.die.used { opacity: .26; filter: grayscale(1); transform: scale(.78); }
.die.throw { animation: throw 380ms var(--ease); }
@keyframes throw {
  0%   { transform: translateY(-14%) rotate(-140deg) scale(.5); opacity: 0; }
  65%  { transform: translateY(0) rotate(12deg) scale(1.1); opacity: 1; }
  100% { transform: none; opacity: 1; }
}

/* ---------- מזח תחתון ---------- */

#dock {
  flex: none;
  padding: 2px 14px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

/* גובה קבוע: כך הופעת כרטיס הדירוג לא מזיזה את הלוח */
#feedback {
  width: 100%;
  max-width: 440px;
  min-height: 62px;
  display: grid;
  place-items: center;
}

#status-text {
  font-size: .82rem;
  color: var(--text-dim);
  text-align: center;
  line-height: 1.35;
  animation: fade .25s ease-out;
}
#status-text b { color: var(--gold); font-weight: 700; }
#status-text span[dir="ltr"] { unicode-bidi: isolate; }

/* כרטיס הדירוג — יושב במקום שורת הסטטוס, לא מסתיר את הלוח */
#rating {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 13px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-inline-start: 3px solid var(--grade, #888);
  animation: rating-in 300ms var(--ease);
}
@keyframes rating-in { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
.rating-body { min-width: 0; text-align: start; }
#rating-grade { font-size: .8rem; font-weight: 700; color: var(--grade, #ccc); }
#rating-expl  { font-size: .75rem; color: var(--text); margin-top: 1px; line-height: 1.32; }
#rating-best  { font-size: .71rem; color: var(--text-dim); margin-top: 2px; }
#rating-best span[dir="ltr"] { unicode-bidi: isolate; color: var(--gold); font-weight: 700; }
#rating-hint { font-size: .69rem; color: var(--gold); font-weight: 700; margin-top: 4px; }
#rating.tappable { cursor: pointer; transition: border-color .16s, transform .1s; }
#rating.tappable:hover { border-inline-start-color: var(--gold); }
#rating.tappable:active { transform: scale(.99); }

/* ---------- שורת המאמן (שידור חוזר) ---------- */
#coach-bar {
  flex: none;
  padding: 4px 14px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
}
.coach-info {
  width: 100%;
  max-width: 440px;
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 13px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-inline-start: 3px solid var(--gold);
}
.coach-txt { flex: 1; min-width: 0; text-align: start; }
#coach-title { font-size: .82rem; font-weight: 800; color: var(--gold-hi); }
#coach-desc { font-size: .78rem; font-weight: 600; margin-top: 1px; }
#coach-desc span[dir="ltr"] { unicode-bidi: isolate; color: var(--gold); }
#coach-expl { font-size: .73rem; color: var(--text-dim); margin-top: 2px; line-height: 1.35; }
.coach-ctl { width: 100%; max-width: 440px; display: flex; align-items: center; gap: 10px; }
.coach-seg {
  flex: 1;
  display: flex;
  gap: 4px;
  padding: 4px;
  border-radius: 13px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.cseg-btn {
  flex: 1;
  padding: 8px 6px;
  border-radius: 9px;
  border: none;
  background: transparent;
  color: var(--text-dim);
  font-size: .78rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .16s, color .16s;
}
.cseg-btn.on { background: color-mix(in srgb, var(--gold) 22%, transparent); color: var(--gold-hi); }
.coach-ctl .pill-btn { flex: none; }

#actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 56px;
}

.pill-btn {
  font: inherit;
  font-size: .85rem;
  font-weight: 600;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 10px 18px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  cursor: pointer;
  transition: background .16s, transform .1s;
}
.pill-btn:active { transform: scale(.96); background: var(--surface-2); }
.pill-btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.pill-btn.wide { flex: 1; justify-content: center; padding: 13px 18px; }
/* אותו כפתור מחוץ למכל flex צריך להימתח בעצמו */
.sub-scroll > .pill-btn.wide,
#lobby-host > .pill-btn.wide,
#lobby-join > .pill-btn.wide { display: flex; width: 100%; }
.pill-btn.danger {
  margin-top: 10px;
  color: #ff9d8a;
  border-color: rgba(226, 80, 76, .4);
  background: rgba(226, 80, 76, .1);
}
.pill-btn.gold {
  background: linear-gradient(180deg, var(--gold-hi), var(--gold-dim));
  color: #241a08;
  border-color: transparent;
  font-weight: 700;
}
.pill-btn.hint {
  color: #ffd98a;
  border-color: rgba(247, 208, 120, .38);
  background: rgba(247, 208, 120, .12);
}
.pill-btn.hint svg { stroke: #ffd98a; }
.pill-btn.hint:active { background: rgba(247, 208, 120, .22); }

/* כפתור ההטלה */
.roll-btn {
  position: relative;
  width: 56px; height: 56px;
  border-radius: 20px;
  border: none;
  cursor: pointer;
  padding: 0;
  background: linear-gradient(160deg, var(--gold-hi), var(--gold-dim));
  box-shadow: 0 8px 22px -6px rgba(192, 120, 64, .6), inset 0 1px 0 rgba(255, 255, 255, .55);
  display: grid;
  place-items: center;
  transition: transform .12s var(--ease), opacity .2s;
  animation: breathe 2.4s ease-in-out infinite;
}
@keyframes breathe {
  0%, 100% { box-shadow: 0 8px 22px -6px rgba(192, 120, 64, .45), inset 0 1px 0 rgba(255,255,255,.55); }
  50%      { box-shadow: 0 8px 30px -4px rgba(192, 120, 64, .85), inset 0 1px 0 rgba(255,255,255,.55); }
}
.roll-btn:active { transform: scale(.93); }
.roll-btn .roll-face {
  width: 26px; height: 26px;
  border-radius: 8px;
  background: #241a08;
  position: relative;
}
.roll-btn .roll-face::before,
.roll-btn .roll-face::after {
  content: "";
  position: absolute;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--gold-hi);
}
.roll-btn .roll-face::before { top: 5px; left: 5px; }
.roll-btn .roll-face::after  { bottom: 5px; right: 5px; }

/* ---------- שורת צפייה חוזרת ---------- */

#replay-bar {
  flex: none;
  padding: 4px 14px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.replay-info {
  width: 100%;
  max-width: 440px;
  min-height: 58px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 13px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.replay-txt { flex: 1; min-width: 0; text-align: start; }
#replay-desc { font-size: .82rem; font-weight: 600; }
#replay-desc span[dir="ltr"] { unicode-bidi: isolate; color: var(--gold); }
#replay-expl { font-size: .73rem; color: var(--text-dim); margin-top: 2px; line-height: 1.35; }
#replay-count { flex: none; font-size: .72rem; color: var(--text-dim); font-variant-numeric: tabular-nums; }

.replay-ctl { display: flex; align-items: center; gap: 10px; }
.rp-btn {
  width: 44px; height: 44px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font-size: .9rem;
  cursor: pointer;
  transition: background .16s, transform .1s, opacity .16s;
}
.rp-btn:active { transform: scale(.94); }
.rp-btn:disabled { opacity: .3; cursor: default; }
.rp-btn.big {
  width: 52px; height: 52px;
  background: linear-gradient(180deg, var(--gold-hi), var(--gold-dim));
  color: #241a08;
  border-color: transparent;
  font-size: 1rem;
}

/* ---------- דירוג ---------- */

.score-ring {
  flex: none;
  width: 42px; height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: .98rem;
  font-weight: 800;
  color: var(--grade, #8fa8c8);
  background: color-mix(in srgb, var(--grade, #888) 16%, transparent);
  box-shadow: inset 0 0 0 2px var(--grade, #888);
  font-variant-numeric: tabular-nums;
}

.g-excellent  { --grade: #4ecb82; }
.g-verygood   { --grade: #86cf62; }
.g-good       { --grade: #c3d155; }
.g-ok         { --grade: #edc752; }
.g-inaccurate { --grade: #eda047; }
.g-mistake    { --grade: #ec7145; }
.g-blunder    { --grade: #e2504c; }
.g-forced     { --grade: #8fa8c8; }

/* ---------- גיליון הגדרות ---------- */

.sheet-backdrop, #modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 7, 10, .68);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 200;
  display: flex;
  animation: fade .2s ease-out;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.sheet-backdrop { align-items: flex-end; justify-content: center; }
.sheet {
  width: 100%;
  max-width: 460px;
  max-height: 88dvh;
  overflow-y: auto;
  background: linear-gradient(180deg, #19212a, #10161d);
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 24px 24px 0 0;
  padding: 10px 20px calc(22px + env(safe-area-inset-bottom));
  animation: sheet-up 300ms var(--ease);
}
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
.grabber { width: 38px; height: 4px; border-radius: 99px; background: var(--surface-2); margin: 0 auto 14px; }
.sheet h3 { margin: 0 0 14px; font-size: 1rem; font-weight: 700; }

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0;
  border-top: 1px solid var(--line);
}
.row-lbl { font-size: .87rem; color: var(--text); }
/* שורה עם הרבה אפשרויות (ערכת לוח) — התווית למעלה, הכפתורים נגללים לשורות */
.row.row-wrap { flex-direction: column; align-items: stretch; gap: 9px; }
.row.row-wrap .row-lbl { align-self: flex-start; }
#board-seg { flex-wrap: wrap; }
#board-seg button { flex: 1 0 26%; }

.seg { display: flex; background: rgba(0,0,0,.35); border: 1px solid var(--line); border-radius: 11px; padding: 3px; gap: 2px; }
.seg button {
  font: inherit;
  font-size: .78rem;
  font-weight: 600;
  color: var(--text-dim);
  background: transparent;
  border: none;
  border-radius: 8px;
  padding: 7px 12px;
  cursor: pointer;
  transition: background .18s, color .18s;
}
.seg button.on { background: var(--surface-2); color: var(--text); }
/* בורר הרמות (4 אפשרויות) — מצטמצם כדי שהכול ייכנס בטלפון */
#level-seg { flex: 1; }
#level-seg button { flex: 1; padding: 7px 6px; font-size: .74rem; text-align: center; }

.toggle {
  width: 46px; height: 27px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,.4);
  cursor: pointer;
  padding: 0;
  position: relative;
  transition: background .22s;
}
.toggle i {
  position: absolute;
  top: 2px; inset-inline-start: 2px;
  width: 21px; height: 21px;
  border-radius: 50%;
  background: var(--text-dim);
  transition: transform .22s var(--ease), background .22s;
}
.toggle.on { background: linear-gradient(180deg, var(--gold-hi), var(--gold-dim)); border-color: transparent; }
.toggle.on i { transform: translateX(-19px); background: #241a08; }
html[dir="rtl"] .toggle.on i { transform: translateX(-19px); }

.sheet-actions { display: flex; gap: 10px; margin-top: 18px; }
.app-version { text-align: center; font-size: 11px; color: var(--muted); margin: 10px 0 2px; }

/* ---------- מודאל סיכום ---------- */

#modal-backdrop { align-items: center; justify-content: center; padding: 18px; }
#modal {
  background: linear-gradient(180deg, #19212a, #10161d);
  border: 1px solid var(--line);
  border-radius: 24px;
  max-width: 420px;
  width: 100%;
  max-height: 84dvh;
  overflow-y: auto;
  padding: 26px 24px;
  box-shadow: 0 30px 70px -20px rgba(0, 0, 0, .95);
  text-align: center;
  animation: modal-in 280ms var(--ease);
}
@keyframes modal-in { from { transform: scale(.93); opacity: 0; } to { transform: none; opacity: 1; } }

#modal h2 { margin: 0 0 4px; font-size: 1.3rem; font-weight: 800; }
#modal .win-kind { color: var(--gold); font-size: .85rem; margin-bottom: 14px; }
#modal .points-badge {
  display: inline-flex; align-items: baseline; gap: 6px;
  margin: 0 auto 14px;
  padding: 7px 16px;
  border-radius: 99px;
  font-weight: 800;
  background: color-mix(in srgb, var(--gold) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--gold) 40%, transparent);
  color: var(--gold-hi);
}
#modal .points-badge.lost {
  background: color-mix(in srgb, #b45 14%, transparent);
  border-color: color-mix(in srgb, #b45 40%, transparent);
  color: #e79;
}
#modal .points-badge .pts-n { font-size: 1.5rem; line-height: 1; font-variant-numeric: tabular-nums; }
#modal .points-badge .pts-n::before { content: "+"; font-size: 1rem; opacity: .8; }
#modal .points-badge.lost .pts-n::before { content: "\2212"; }
#modal .points-badge .pts-lbl { font-size: .74rem; letter-spacing: .04em; }
#modal .overall {
  width: 96px; height: 96px;
  margin: 14px auto 10px;
  border-radius: 50%;
  display: grid;
  place-content: center;
  color: var(--grade, #888);
  background: color-mix(in srgb, var(--grade, #888) 14%, transparent);
  box-shadow: inset 0 0 0 3px var(--grade, #888);
}
#modal .overall .num { font-size: 2.1rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
#modal .overall .lbl { font-size: .58rem; letter-spacing: .14em; color: var(--text-dim); margin-top: 3px; }
#modal .overall-grade { font-weight: 700; font-size: 1rem; color: var(--grade, #ccc); margin-bottom: 12px; }

#modal .dist { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; margin: 12px 0 6px; }
#modal .dist .chip {
  font-size: .72rem;
  font-weight: 600;
  color: var(--grade, #ccc);
  background: color-mix(in srgb, var(--grade, #888) 13%, transparent);
  border: 1px solid color-mix(in srgb, var(--grade, #888) 35%, transparent);
  border-radius: 99px;
  padding: 5px 11px;
}
#modal p.note { color: var(--text-dim); font-size: .76rem; margin: 8px 0 0; }

#modal .worst { text-align: start; margin-top: 18px; }
#modal .worst h3 { font-size: .82rem; font-weight: 700; margin: 0 0 8px; color: var(--text-dim); }
#modal .worst ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
#modal .worst li {
  font-size: .76rem;
  line-height: 1.45;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 9px 11px;
}
#modal .worst .sc { font-weight: 800; color: var(--grade, #ccc); }
#modal .actions { margin-top: 20px; display: flex; gap: 10px; }

/* ---------- מסכים רחבים ---------- */

@media (min-width: 720px) and (min-aspect-ratio: 5/4) {
  #topbar { height: 60px; }
  .title { font-size: 1.15rem; }
  .strip { max-width: 940px; width: 100%; margin-inline: auto; padding: 9px 16px; }
  #board-area { padding: 8px 14px; }
  #board { max-width: 940px; }
  #status-text { font-size: .9rem; }
}

/* טלפון לרוחב — הכל עובר לפס צדדי, אחרת לא נשאר גובה ללוח */
@media (orientation: landscape) and (max-height: 560px) {
  #screen-game.on {
    display: grid;
    grid-template-columns: 1fr clamp(160px, 26vw, 230px);
    grid-template-rows: auto auto auto 1fr;
    grid-template-areas:
      "board top"
      "board ai"
      "board me"
      "board dock";
    column-gap: 8px;
    padding-inline: 8px;
  }
  #board-area { grid-area: board; padding: 4px 0; }
  #topbar     { grid-area: top; height: 42px; padding: 0; }
  #strip-ai   { grid-area: ai; }
  #strip-me   { grid-area: me; }
  #dock       { grid-area: dock; justify-content: flex-start; padding: 4px 0 6px; }

  .title { font-size: .85rem; }
  .title-sub { display: none; }
  .strip { margin: 2px 0; padding: 5px 9px; flex-wrap: wrap; row-gap: 5px; }
  .borne { flex-basis: 100%; order: 3; height: 12px; }
  .borne i { height: 5px; }
  .nm { font-size: .72rem; }
  .avatar { width: 20px; height: 20px; font-size: .62rem; }
  .pipbox b { font-size: .85rem; }

  #feedback { min-height: 0; max-width: none; }
  #rating { flex-direction: column; align-items: flex-start; gap: 6px; padding: 8px 10px; }
  .score-ring { width: 34px; height: 34px; font-size: .84rem; }
  #status-text { font-size: .74rem; }
  #actions { min-height: 44px; width: 100%; }
  .roll-btn { width: 44px; height: 44px; border-radius: 15px; }
  .roll-btn .roll-face { width: 20px; height: 20px; }
}

/* מסכים נמוכים — מצמצמים את המסגרת כדי לפנות גובה ללוח */
@media (max-height: 700px) {
  #topbar { height: 44px; }
  .title { font-size: .92rem; }
  .ghost-btn, .stat-chip { width: 40px; height: 40px; border-radius: 11px; }
  .strip { padding: 5px 10px; margin: 2px 10px; }
  .avatar { width: 22px; height: 22px; font-size: .68rem; }
  #feedback { min-height: 52px; }
  #actions { min-height: 46px; }
  .roll-btn { width: 46px; height: 46px; border-radius: 16px; }
  .roll-btn .roll-face { width: 21px; height: 21px; }
  #dock { padding: 2px 12px 6px; }
}

@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

@media (prefers-contrast: more) {
  :root {
    --text-dim: #c0ccd8;
    --surface:  rgba(255,255,255,.10);
    --surface-2: rgba(255,255,255,.18);
    --border:   rgba(255,255,255,.35);
  }
  .score-ring { box-shadow: inset 0 0 0 3px var(--grade, #888); }
  .ghost-btn, .stat-chip, .prof-av { outline: 1px solid rgba(255,255,255,.25); }
}


/* ==========================================================================
   ערכות לוח — משנות רק את הלוח עצמו, לא את מסגרת הממשק
   ========================================================================== */

body[data-board="wood"] {
  --felt: #c9a273;
  --pnum: rgba(255, 240, 214, .58);
  --pt-light-a: #f2dbb0; --pt-light-b: #dcbc85;
  --pt-dark-a: #8d5a2b;  --pt-dark-b: #62391a;
  --frame-a: #7a4f26; --frame-b: #4e2d13; --frame-c: #351e0c;
  --bar-a: #4a2b13;   --bar-b: #6d4420;
  --chk-w-1: #fffdf6; --chk-w-2: #f0e6cd; --chk-w-3: #c9b78d; --chk-w-ring: #907b45;
  --chk-b-1: #6b5541; --chk-b-2: #392a1d; --chk-b-3: #17100a; --chk-b-ring: #c2a883;
  --die-a: #fffdf6;   --die-b: #e3d5b6;   --die-pip: #3b2611;
  --die-ai-a: #4a3524; --die-ai-b: #241708; --die-ai-pip: #f0e2c6;
}

body[data-board="felt"] {
  --felt: #12351f;
  --pt-light-a: #e8dcc0; --pt-light-b: #c9bb9a;
  --pt-dark-a: #1f5c33;  --pt-dark-b: #123a20;
  --frame-a: #3b2a18; --frame-b: #241809; --frame-c: #170f05;
  --bar-a: #21170c;   --bar-b: #3a2916;
  --chk-w-1: #fffefa; --chk-w-2: #f2ece0; --chk-w-3: #cec6b4; --chk-w-ring: #8a8069;
  --chk-b-1: #4a2a2a; --chk-b-2: #2a1414; --chk-b-3: #120707; --chk-b-ring: #b98d8d;
  --die-a: #fffefa;   --die-b: #ded7c6;   --die-pip: #1a2b1f;
  --die-ai-a: #3a2020; --die-ai-b: #1b0d0d; --die-ai-pip: #f2e6e6;
}

body[data-board="ivory"] {
  --felt: #e8e3d8;
  --pnum: rgba(30, 26, 18, .5);
  --pt-light-a: #f4f1e8; --pt-light-b: #ddd6c4;
  --pt-dark-a: #a8b2bd;  --pt-dark-b: #7f8c99;
  --frame-a: #cdc5b4; --frame-b: #a89d88; --frame-c: #8a7e69;
  --bar-a: #b8ae9a;   --bar-b: #d6cdbb;
  --chk-w-1: #ffffff; --chk-w-2: #f7f4ec; --chk-w-3: #d8d2c3; --chk-w-ring: #9b9282;
  --chk-b-1: #55606c; --chk-b-2: #2f3841; --chk-b-3: #161c22; --chk-b-ring: #aebbc8;
  --die-a: #ffffff;   --die-b: #e4e0d5;   --die-pip: #2c343d;
  --die-ai-a: #46505b; --die-ai-b: #232a31; --die-ai-pip: #eef2f6;
}

/* שכבת סימן-מים של הערכה — יושבת מעל המשולשים ומתחת לחיילים */
.board-art {
  position: absolute;
  left: 2.4%; right: 2.4%;
  top: 2.6%; bottom: 2.6%;
  z-index: 3;
  pointer-events: none;
  background-repeat: no-repeat;
  background-position: center;
  opacity: 0;                       /* ברירת מחדל — בלי סימן מים */
  transition: opacity .3s;
  border-radius: 8px;
}
body[data-board="coast"] .board-art { opacity: .22; }

/* סמל היחידה — אחד בכל חצי לוח (מוצג רק בערכת "אלבטרוס") */
.emblem {
  position: absolute;
  top: 50%;
  width: 38%;
  height: auto;
  transform: translateY(-50%);
  display: none;
  overflow: visible;
  color: #1a2b37;
}
.emblem.l { left: 3%; }
.emblem.r { right: 3%; }
.emblem .ink * { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.emblem .bird path { fill: currentColor; stroke: none; }
.emblem .wing { transform-box: view-box; transform-origin: 207px 168px; }
body[data-board="coast"] .emblem { display: block; }

/* נפנוף כנפי הציפור בתוך הסמל — באכילה */
body[data-board="coast"] .board-art.flapping { opacity: .4; }
.board-art.flapping .emblem .wing.left  { animation: flap-l .5s ease-in-out 4; }
.board-art.flapping .emblem .wing.right { animation: flap-r .5s ease-in-out 4; }
@keyframes flap-l { 0%, 100% { transform: rotate(3deg); }  50% { transform: rotate(-26deg); } }
@keyframes flap-r { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(26deg); } }
body[data-board="lagoon"] .board-art {
  background-image: url("img/lagoon-couple.jpg");
  background-size: cover;
  background-position: center 32%;
  opacity: .14;
  mix-blend-mode: luminosity;       /* מתמזג עם צבעי הלוח */
  -webkit-mask-image: radial-gradient(ellipse 75% 80% at 50% 42%, #000 55%, transparent 100%);
          mask-image: radial-gradient(ellipse 75% 80% at 50% 42%, #000 55%, transparent 100%);
}

/* שחף — קו-חוף מינימליסטי: נייר-חול חמים מול דיו כחול-ים עמוק */
body[data-board="coast"] {
  --felt: #e7ded0;
  --pnum: rgba(24, 44, 58, .5);
  --pt-light-a: #f4eee0; --pt-light-b: #ddd2bd;
  --pt-dark-a: #24404f;  --pt-dark-b: #172a36;
  --frame-a: #22394a; --frame-b: #142530; --frame-c: #0d1a22;
  --bar-a: #162833;   --bar-b: #22394a;
  --chk-w-1: #fffdf7; --chk-w-2: #eee6d4; --chk-w-3: #cfc4ac; --chk-w-ring: #8a8168;
  --chk-b-1: #2f4a5a; --chk-b-2: #182b37; --chk-b-3: #0a161d; --chk-b-ring: #9fbccb;
  --die-a: #fffdf7;   --die-b: #e0d7c3;   --die-pip: #1b3240;
  --die-ai-a: #253c4a; --die-ai-b: #0f1e28; --die-ai-pip: #e6f0f5;
}

/* לגונה — מים מוזהבים בשמש עם טורקיז: חול-זהב חמים מול מים ירוק-כחול */
body[data-board="lagoon"] {
  --felt: #a9762f;
  --pnum: rgba(255, 238, 205, .6);
  --pt-light-a: #f2d69d; --pt-light-b: #dcb46a;
  --pt-dark-a: #1c6f78;  --pt-dark-b: #114c53;
  --frame-a: #6f4720; --frame-b: #472a10; --frame-c: #2f1b0a;
  --bar-a: #3f2911;   --bar-b: #63431f;
  --chk-w-1: #fffdf5; --chk-w-2: #f4e7c9; --chk-w-3: #d3bd8b; --chk-w-ring: #927b43;
  --chk-b-1: #1a6b74; --chk-b-2: #0d434b; --chk-b-3: #041d21; --chk-b-ring: #74c2ca;
  --die-a: #fffdf5;   --die-b: #ecdcb8;   --die-pip: #6d4a20;
  --die-ai-a: #12545c; --die-ai-b: #062529; --die-ai-pip: #d7f2f5;
}

.stat-row b.lead { color: #4ecb82; }
.stat-row b.trail { color: #e2504c; }

/* ---------- מסך הפתיחה ---------- */

.av-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  max-width: 380px;
}
.av-opt {
  width: 46px; height: 46px;
  border-radius: 50%;
  font-size: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--line);
  cursor: pointer;
  transition: border-color .16s, transform .1s, background .16s;
}
.av-opt:active { transform: scale(.92); }
.av-opt.on { border-color: var(--gold); background: rgba(192, 120, 64, .14); }

.name-input {
  font: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  text-align: center;
  width: 100%;
  max-width: 380px;
  padding: 15px 16px;
  color: var(--text);
  background: rgba(0, 0, 0, .35);
  border: 1px solid var(--line);
  border-radius: 15px;
  outline: none;
}
.name-input:focus { border-color: var(--gold); }
.name-input::placeholder { color: var(--text-dim); font-weight: 400; }

/* כפתור אישור התור */
.pill-btn.confirm {
  background: linear-gradient(180deg, #63d68d, #2f9e5b);
  color: #06210f;
  border-color: transparent;
  font-weight: 700;
  padding: 12px 22px;
  box-shadow: 0 10px 24px -10px rgba(76, 200, 128, .7);
  animation: breathe-green 2.4s ease-in-out infinite;
}
@keyframes breathe-green {
  0%, 100% { box-shadow: 0 10px 24px -12px rgba(76, 200, 128, .5); }
  50%      { box-shadow: 0 10px 30px -8px rgba(76, 200, 128, .9); }
}
.pill-btn.confirm svg { stroke-width: 2.6; }

/* ---------- מדריך למתחילים ---------- */

#tutorial {
  position: fixed;
  inset: 0;
  z-index: 300;
}

/* הזרקור הוא חור: מסגרת שקופה עם צל ענק שמכהה את כל השאר */
#tut-spot {
  position: fixed;
  border-radius: 16px;
  box-shadow: 0 0 0 9999px rgba(4, 7, 10, .8), 0 0 0 2px var(--gold) inset;
  border: 2px solid var(--gold);
  pointer-events: none;
  transition: left .3s var(--ease), top .3s var(--ease),
              width .3s var(--ease), height .3s var(--ease);
  animation: spot-in .3s var(--ease);
}
@keyframes spot-in { from { opacity: 0; } to { opacity: 1; } }

/* בלי זרקור — מכהים את כל המסך ברקע מלא, לא בצל */
#tut-spot.full {
  inset: 0;
  width: auto; height: auto;
  border: none;
  border-radius: 0;
  box-shadow: none;
  background: rgba(4, 7, 10, .8);
}

#tut-card {
  position: fixed;
  inset-inline: 0;
  bottom: calc(16px + env(safe-area-inset-bottom));
  width: min(92vw, 430px);
  margin: 0 auto;
  padding: 18px 20px 16px;
  border-radius: 20px;
  background: linear-gradient(180deg, #1b232d, #11171e);
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px -18px rgba(0, 0, 0, .95);
  animation: tut-in .3s var(--ease);
}
#tut-card.at-top { bottom: auto; top: calc(16px + env(safe-area-inset-top)); }
@keyframes tut-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

#tut-dots { display: flex; gap: 5px; margin-bottom: 12px; }
#tut-dots i {
  flex: 1;
  height: 3px;
  border-radius: 99px;
  background: rgba(255, 255, 255, .12);
  transition: background .25s;
}
#tut-dots i.on { background: var(--gold); }

#tut-card h3 { margin: 0 0 6px; font-size: 1.08rem; font-weight: 800; }
#tut-card p { margin: 0; font-size: .87rem; line-height: 1.55; color: var(--text-dim); }
.tut-actions { display: flex; gap: 10px; margin-top: 16px; }
.tut-actions .pill-btn { flex: 1; justify-content: center; }
.tut-actions .pill-btn.gold { flex: 2; }

@media (max-height: 700px) {
  #tut-card { padding: 14px 16px 13px; }
  #tut-card h3 { font-size: 1rem; }
  #tut-card p { font-size: .82rem; line-height: 1.45; }
}

/* ---------- מאזן מול חברים ---------- */

.rivals {
  font: inherit;
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: center;
  width: 100%;
  max-width: 380px;
  padding: 11px 12px;
  border-radius: 15px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text);
  cursor: pointer;
  transition: background .16s, transform .1s;
}
.rivals:active { transform: scale(.98); background: var(--surface-2); }
.rivals-cap {
  width: 100%;
  font-size: .6rem;
  letter-spacing: .1em;
  color: var(--text-dim);
  margin-bottom: 2px;
}
.rival {
  font-size: .76rem;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .06);
  border: 1px solid var(--line);
}
.rival b { font-variant-numeric: tabular-nums; margin-inline-start: 5px; }
.rival.lead { border-color: rgba(78, 203, 130, .4); }
.rival.lead b { color: #4ecb82; }
.rival.trail { border-color: rgba(226, 80, 76, .4); }
.rival.trail b { color: #e2504c; }

/* מאזן ראש בראש במסך הסיום */
.h2h {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 14px 0 4px;
  padding: 12px 10px;
  border-radius: 15px;
  background: var(--surface);
  border: 1px solid var(--line);
}
.h2h-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: .72rem;
  color: var(--text-dim);
  min-width: 70px;
}
.h2h-side b {
  font-size: 1.7rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.h2h-vs { font-size: .6rem; letter-spacing: .12em; color: var(--text-dim); }
.h2h-games { text-align: center; font-size: .68rem; color: var(--text-dim); margin: 0 0 4px; unicode-bidi: isolate; }

/* ---------- בחירת סוג משחק ---------- */

.seg.wide-seg { width: 100%; }
.seg.wide-seg button { flex: 1; }
.seg-note { font-size: .72rem; color: var(--text-dim); margin: 8px 2px 16px; line-height: 1.5; }
.seg-lbl { display: block; font-size: .68rem; letter-spacing: .06em; color: var(--text-dim); margin-bottom: 7px; }
.lobby-variant { margin: 4px 0 14px; }

/* ---------- בוחר הדאבל (3-4) — פס קומפקטי מעל המזח, הלוח נשאר גלוי ---------- */

#dbl-bar {
  position: fixed;
  left: 50%;
  bottom: calc(12px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 150;
  width: min(94vw, 420px);
  padding: 10px 12px 12px;
  border-radius: 18px;
  background: rgba(16, 21, 27, .93);
  backdrop-filter: blur(14px) saturate(1.3);
  -webkit-backdrop-filter: blur(14px) saturate(1.3);
  border: 1px solid var(--line);
  box-shadow: 0 18px 44px -14px rgba(0, 0, 0, .9);
  text-align: center;
  animation: tut-in .28s var(--ease);
}
.dbl-cap { display: block; font-size: .8rem; font-weight: 600; color: var(--text-dim); margin-bottom: 8px; }
.dbl-cap b { color: var(--gold); unicode-bidi: isolate; }
.dbl-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}
.dbl-die {
  aspect-ratio: 1;
  border-radius: 22%;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, #fbfcfd, #dbe1e8);
  cursor: pointer;
  padding: 15%;
  display: grid;
  grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  place-items: center;
  gap: 6%;
  transition: transform .1s, box-shadow .16s;
  box-shadow: 0 3px 9px -3px rgba(0, 0, 0, .55);
}
.dbl-die:active { transform: scale(.9); }
.dbl-die:hover { box-shadow: 0 0 0 2px var(--gold), 0 3px 12px -3px rgba(192, 120, 64, .6); }
.dbl-die span { width: 100%; height: 100%; }
.dbl-die span.dot { border-radius: 50%; background: #1b222b; }

/* ---------- רשימת חוקי טורקי ---------- */

.rules-list {
  list-style: none;
  margin: 4px 0 8px;
  padding: 0;
  text-align: start;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.rules-list li {
  font-size: .84rem;
  line-height: 1.5;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}
.rules-list li b { color: var(--gold); }
.rules-list li b[dir="ltr"] { unicode-bidi: isolate; }

/* מאזן תיקו בשורת יריב */
.vs-rec { display: inline-flex; align-items: center; gap: 8px; }
.vs-draw { font-size: .66rem; color: var(--text-dim); }

/* ---------- אנימציית החלפת צדדים (טורקי, 1-2) ---------- */

/* החלקה איטית של החיילים למקומם החדש כדי שהסיבוב יהיה ברור */
#board.swapping .checker { transition-duration: 720ms; }

/* אנימציית פתיחה — "הגשת" החיילים למקומם */
#board.dealing-board .checker { transition: none; }
.checker.deal { animation: deal-in 520ms cubic-bezier(.18,.85,.28,1) backwards; }
@keyframes deal-in {
  0%   { opacity: 0; transform: translateY(-40%) scale(.4); }
  55%  { opacity: 1; }
  100% { opacity: 1; transform: none; }
}

.swap-flash {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  pointer-events: none;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--gold-hi);
  text-shadow: 0 2px 10px rgba(0, 0, 0, .8);
  animation: swap-flash 1.5s ease-out forwards;
}
.swap-flash .swap-ico {
  font-size: 2.6rem;
  animation: swap-spin 1.1s var(--ease);
}
@keyframes swap-spin {
  from { transform: rotate(0); }
  to   { transform: rotate(360deg); }
}
@keyframes swap-flash {
  0%   { opacity: 0; transform: scale(.8); }
  18%  { opacity: 1; transform: scale(1); }
  75%  { opacity: 1; }
  100% { opacity: 0; }
}

/* סנאקבּר — הודעה קצרה שצפה מלמטה (קריצות הרמזים) */
#snack {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translate(-50%, 16px);
  z-index: 60;
  max-width: 88vw;
  padding: 12px 18px;
  border-radius: 14px;
  background: rgba(24, 26, 32, .96);
  border: 1px solid rgba(247, 208, 120, .35);
  color: var(--gold-hi);
  font-weight: 700;
  font-size: .95rem;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
  opacity: 0;
  pointer-events: none;
  transition: opacity .28s, transform .28s;
}
#snack.show { opacity: 1; transform: translate(-50%, 0); }

/* ==========================================================================
   עיצוב נאומורפי — רקע אחיד, כרטיסים בצל כפול רך (בהיר מלמעלה, כהה מלמטה),
   פינות עגולות, בלי קווי מתאר. שכבה עצמאית בסוף הקובץ (קל לכוונן/להסיר).
   הלוח עצמו נשאר חד וברור — הסגנון חל רק על ממשק המסביב.
   ========================================================================== */
:root {
  --bg-0: #171c22;
  --bg-1: #171c22;
  --surface:   #1a2028;
  --surface-2: #20272f;
  --line: rgba(0, 0, 0, .28);            /* קו-הפרדה כמו חריץ עדין */
  --nm-lite: rgba(255, 255, 255, .055);
  --nm-dark: rgba(0, 0, 0, .60);
  --nm-up:    -5px -5px 12px var(--nm-lite),  6px 6px 15px var(--nm-dark);
  --nm-up-sm: -3px -3px 7px  var(--nm-lite),  3px 3px 8px  var(--nm-dark);
  --nm-in:    inset 5px 5px 11px var(--nm-dark), inset -4px -4px 10px var(--nm-lite);
  --nm-in-sm: inset 3px 3px 7px  var(--nm-dark), inset -3px -3px 6px  var(--nm-lite);
}

body { background: var(--bg-0); }

/* כרטיסים וכפתורים מוגבהים — אותו גוון רקע, מובחנים רק בצל הכפול */
.who-chip, .home-quick .q, .home-btn, .ghost-btn, #avg-chip, .prof-av, .prof-ico,
.strip, .stat-card, .lvl-card, .pill-btn, .coach-info, .replay-info,
#rating, .points-badge, .h2h, .rules-list li, #dbl-bar {
  border: none;
  background: var(--surface);
  box-shadow: var(--nm-up);
}
.home-quick .q, .stat-card, .prof-av, .prof-ico, #rating, .points-badge, .h2h { box-shadow: var(--nm-up-sm); }

/* לחיצה — הכרטיס "נלחץ" פנימה */
.who-chip:active, .home-btn:active, .ghost-btn:active, .pill-btn:active,
.lvl-card:active, #avg-chip:active {
  box-shadow: var(--nm-in);
  background: var(--surface);
  transform: none;
}

/* בורר מקטעים — מגרעת שקועה, והכפתור הפעיל בולט החוצה */
.seg { border: none; background: var(--surface); box-shadow: var(--nm-in-sm); }
.seg button.on { background: var(--surface-2); box-shadow: var(--nm-up-sm); }

/* מגרעות שקועות: פסי התקדמות, מגש ההורדה, מסלול הטיימר */
.qbar .track { background: var(--surface); box-shadow: var(--nm-in-sm); }
.borne { border: none; background: var(--surface); box-shadow: var(--nm-in-sm); }
.avatar { border: none; box-shadow: var(--nm-up-sm); }

/* משטחים גדולים */
.sheet, #modal { border: none; background: var(--surface); box-shadow: var(--nm-up); }
.stat-rows { border: none; background: var(--surface); box-shadow: var(--nm-in-sm); overflow: hidden; }

/* הרצועה הפעילה — הבלטה זהובה עדינה בתוך הסגנון הרך */
.strip.active {
  background: var(--surface-2);
  box-shadow: var(--nm-up), inset 0 0 0 1px rgba(227, 189, 119, .22);
}

/* כפתורי הזהב והקובייה — מוגבהים עם זוהר חם, ונלחצים פנימה */
.home-btn.primary, .pill-btn.gold, .roll-btn {
  border: none;
  box-shadow:
    -4px -4px 10px rgba(255, 255, 255, .06),
    5px 5px 14px rgba(0, 0, 0, .55),
    0 10px 26px -12px rgba(192, 120, 64, .5);
}
.home-btn.primary:active, .pill-btn.gold:active, .roll-btn:active {
  box-shadow:
    inset 4px 4px 10px rgba(0, 0, 0, .38),
    inset -3px -3px 8px rgba(255, 255, 255, .18);
}

/* ---------- קוביית הכפלה ---------- */

.cube-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 44px; min-height: 44px;
  padding: 4px 10px;
  border: 2px solid var(--gold);
  border-radius: 8px;
  background: rgba(192,120,64,.12);
  color: var(--gold);
  font-weight: 800; font-size: 15px;
  cursor: pointer;
  transition: background .18s, transform .12s;
}
.cube-btn:active { transform: scale(.93); background: rgba(192,120,64,.22); }

.cube-display {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px;
  border: 1.5px solid var(--gold);
  border-radius: 5px;
  background: rgba(192,120,64,.10);
  color: var(--gold);
  font-weight: 800; font-size: 13px;
  margin-inline-start: 6px;
  flex-shrink: 0;
}

.cube-offer {
  position: fixed; inset: auto 0 0 0; z-index: 200;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 18px 16px calc(env(safe-area-inset-bottom, 0px) + 14px);
  background: var(--bg-1); border-top: 1px solid rgba(255,255,255,.08);
  text-align: center; color: var(--text);
}
.cube-offer p { margin: 0; font-size: 16px; }
.cube-offer b { color: var(--gold); }
.cube-offer-actions { display: flex; gap: 10px; }

/* אונבורדינג אימון */
.coach-onboard {
  position: fixed; inset: 0; z-index: 300;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.72);
  padding: 16px;
}
.coach-onboard-card {
  background: var(--bg-1); border-radius: 16px;
  padding: 28px 22px 20px; max-width: 340px; width: 100%;
  text-align: center; color: var(--text);
}
.coach-onboard-card h3 { margin: 0 0 10px; font-size: 20px; color: var(--gold); }
.coach-onboard-card p { margin: 0 0 16px; font-size: 15px; line-height: 1.5; opacity: .88; }
#cob-dots { display: flex; justify-content: center; gap: 6px; margin-bottom: 16px; }
#cob-dots i { display: block; width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.2); }
#cob-dots i.on { background: var(--gold); }

/* הלוח — צל חיצוני רך שמתיישב בתוך המשטח, הפנים נשאר חד לחלוטין */
#board {
  box-shadow:
    -6px -6px 16px var(--nm-lite),
    10px 12px 30px rgba(0, 0, 0, .72),
    0 1px 0 rgba(255, 255, 255, .06) inset;
}

/* כפתור עדכון — נצמד לפינה העליונה-ימנית, מעל הכל */
#update-btn {
  position: fixed;
  top: 12px;
  inset-inline-end: 12px;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px 8px 12px;
  background: var(--gold);
  color: #0d1117;
  border: none;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0,0,0,.45);
  animation: update-pulse 2.4s ease-in-out infinite;
}
#update-btn[hidden] { display: none; }
#update-btn:active { transform: scale(.95); }
.update-ico {
  font-size: 17px;
  line-height: 1;
  display: inline-block;
  animation: update-bounce 2.4s ease-in-out infinite;
}
@keyframes update-pulse {
  0%, 100% { box-shadow: 0 4px 16px rgba(0,0,0,.45); }
  50%       { box-shadow: 0 4px 24px rgba(192,120,64,.55); }
}
@keyframes update-bounce {
  0%, 60%, 100% { transform: translateY(0); }
  30%           { transform: translateY(-3px); }
}
