/* העיצוב של המשחק (לפי קנבס העיצוב https://claude.ai/artifact/MxeCJLDqfQFcU5EiKad222):
 * רקע שמנת, קווי מתאר שחורים, כרטיסים צבעוניים וכפתורים שחורים מעוגלים, ודמות החבילה ב-SVG.
 * נטען אחרי css/style.css (המבנה והפריסה) ודורס את הצבעים, הקווים והצללים שלו.
 * גם גרסת ההדגמה (tools/build-artifact.js) משתמשת בקובץ הזה. */
:root {
  --bg: #F5F0E4;
  --bg-2: #F5F0E4;
  --card: #FFFFFF;
  --card-ink: #141414;
  --ink: #141414;
  --muted: #55514A;
  --accent: #FF9A3C;
  --accent-2: #FFD84D;
  --mint: #2BAE7E;
  --pink: #FF6FA8;
  --sky: #B9A7FF;
  --glass: #FFFFFF;
  --glass-border: #141414;
  --line: 2.5px solid #141414;
  --lift: 0 5px 0 #141414;
  color-scheme: light;
}
body { background: var(--bg); background-image: none; color: var(--ink); }
h1, h2, h3 { font-weight: 900; }
.hero h1 { font-size: 40px; letter-spacing: -1px; }
.hero .sub, .lead, .hint, .install-text span, #dock-info { color: var(--muted); }

/* ---------- כרטיסים, שדות, צ'יפים ---------- */
.card { background: #FFFFFF; border: var(--line); -webkit-backdrop-filter: none; backdrop-filter: none; }
.card h2, details.card > summary { font-weight: 800; }
details.card > summary::after { color: var(--ink); }
input[type="text"], input[type="url"] { background: #FFFFFF; border: var(--line); color: var(--ink); }
input::placeholder { color: var(--muted); }
input:focus { border-color: #141414; box-shadow: 0 0 0 3px var(--accent-2); }
#join-code::placeholder { color: var(--muted); }
button:focus-visible, input:focus-visible, summary:focus-visible { outline-color: #141414; }

.chip { background: #FFFFFF; border: var(--line); color: var(--ink); font-weight: 700; }
.chip.on { background: var(--accent-2); border-color: #141414; box-shadow: 0 3px 0 #141414; }
.chip.on[data-cat="kids"] { background: var(--sky); }
.chip.on[data-cat="family"] { background: var(--mint); }
.chip.on[data-cat="party"] { background: var(--pink); }
.chip.on[data-cat="bold"] { background: var(--accent); }
.chip.on[data-cat="quick"] { background: var(--accent-2); }
/* סגנון מוזיקה שנבחר: שחור, כדי שלא יתבלבל עם הצהוב של "מהיר" */
.chip.on:not([data-cat]):not(.player) { background: #141414; color: #FFFFFF; }
/* סימון ✓ בכל צ'יפ שנבחר, כדי שהבחירה לא תסתמך רק על צבע */
.chip.on:not(.player)::after {
  content: ''; display: inline-block; width: 0.8em; height: 0.8em; margin-inline-start: 6px; vertical-align: -0.05em;
  background-color: currentColor;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12.5l5 5L20 6.5'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 12.5l5 5L20 6.5'/%3E%3C/svg%3E") center / contain no-repeat;
}
.chip.player { background: #FFFFFF; border-color: #141414; }
.chip.player.on { background: var(--accent-2); }
.seg { background: var(--bg); border: var(--line); }
.seg button { color: var(--ink); }
.seg button.on { background: #141414; color: #FFFFFF; box-shadow: none; }
input[type="range"], .switch input { accent-color: #141414; }
.link-btn { color: var(--ink); }

/* ---------- כפתורים ---------- */
.btn { color: var(--ink); background: #FFFFFF; border: var(--line); border-radius: 999px; }
.btn-primary { background: #141414; color: #FFFFFF; border-color: #141414; box-shadow: none; }
.btn-xl { border-radius: 999px; font-weight: 800; }
.btn-ghost, .btn-ghost.dark { background: #FFFFFF; border: var(--line); color: var(--ink); }
.icon-btn { background: #FFFFFF; border: var(--line); color: var(--ink); display: flex; align-items: center; justify-content: center; padding: 0; width: 44px; height: 44px; }
.lang-btn { background: #FFFFFF; border: var(--line); color: var(--ink); font-weight: 700; }
#round-label, .top-title { color: var(--ink); font-weight: 800; }
.me-badge { background: var(--accent-2); border: var(--line); width: 44px; height: 44px; }
.error { color: #7A1030; background: #FFE1EC; border: var(--line); }

/* ---------- מסך הבית ---------- */
.choice { background: #FFFFFF; border: var(--line); color: var(--ink); box-shadow: var(--lift); }
.choice-host { background: var(--accent-2); border: var(--line); box-shadow: var(--lift); }
.choice-text small { color: #3D3A33; }
.home-actions { margin-bottom: 72px; gap: 22px; } /* שני הכפתורים קצת יותר למעלה, לא צמודים לתחתית */

/* ---------- חדר המשחק ---------- */
.code-box { background: var(--accent); border: var(--line); box-shadow: var(--lift); }
.code-label { color: var(--ink); font-weight: 700; }
.code { color: var(--ink); font-weight: 900; }

/* ---------- המשחק ---------- */
#st-passing.active { background: var(--pink); border: var(--line); border-radius: 32px; box-shadow: 0 6px 0 #141414; padding: 24px 16px; box-sizing: border-box; }
#st-passing .lead { color: #141414; }
.eq i, .eq i:nth-child(n) { background: #141414; }
.parcel { filter: none; }
.parcel-wrap.away { opacity: 0.3; }
.hint-box { color: var(--ink); background: var(--accent-2); border: var(--line); }
#st-stop.active { background: var(--accent-2); border: var(--line); border-radius: 32px; box-shadow: 0 6px 0 #141414; padding: 28px 16px; box-sizing: border-box; }
#st-stop h2 { color: var(--ink); font-size: 72px; font-weight: 900; letter-spacing: -1px; }
#st-stop .lead { color: var(--ink); font-weight: 700; }
.task-card { background: var(--mint); color: var(--ink); border: var(--line); box-shadow: 0 6px 0 #141414; }
.task-for { color: var(--ink); font-weight: 800; }
.task-text { background: #FFFFFF; border: var(--line); border-radius: 20px; padding: 14px; font-weight: 800; }
.task-cat { color: var(--ink); background: #FFFFFF; border: 2px solid #141414; }
/* ההבהוב שחור: על מסך "עצור!" הצהוב רואים אותו (חשוב באייפון, שאין בו רטט) */
#flash { background: #141414; }
.sheet { background: #FFFFFF; color: var(--ink); border-top: var(--line); box-shadow: none; }
.sheet-text { color: var(--muted); }
.backdrop { background: rgba(20, 20, 20, 0.4); }

/* הדמות של החבילה (SVG במקום אימוג'י) */
.parcel svg, .logo svg { display: block; margin-inline: auto; }

/* ===================== המסכים לפי קנבס העיצוב ===================== */
::selection { background: var(--accent-2); color: var(--ink); }
input { caret-color: var(--ink); }
h1, h2 { text-wrap: balance; }

/* מסך הבית */
.choice-icon { width: 52px; height: 52px; flex: 0 0 auto; border-radius: 999px; background: #FFFFFF; border: var(--line); display: flex; align-items: center; justify-content: center; }
.choice-host .choice-icon { background: var(--accent); }
.choice-text b { font-weight: 900; }
.home-hero h1 { font-size: 44px; line-height: 1.02; letter-spacing: -1px; margin-top: 10px; }
.join-logo { width: 96px; height: 96px; margin: 0 auto; border-radius: 999px; background: var(--accent-2); border: var(--line); box-shadow: var(--lift); display: flex; align-items: center; justify-content: center; }

/* מסך "מארחים משחק": כפתור החזרה למעלה וכפתור "פותחים משחק" למטה נשארים במקום בזמן גלילה.
   השוליים השליליים מבטלים את הריפוד של המסך, כדי שהרקע של הפס יגיע עד הקצה */
#screen-setup .topbar {
  position: sticky; top: 0; z-index: 5;
  margin: calc(-14px - env(safe-area-inset-top, 0px)) -16px 0;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 10px;
  background: var(--bg);
}
#screen-setup .setup-footer {
  position: sticky; bottom: 0; z-index: 5;
  margin: auto -16px calc(-24px - env(safe-area-inset-bottom, 0px));
  padding: 12px 16px calc(16px + env(safe-area-inset-bottom, 0px));
  background: var(--bg);
  display: flex; flex-direction: column; gap: 10px;
}
/* מעבר רך: התוכן "נעלם" מתחת לפסים במקום להיחתך בקו חד */
#screen-setup .topbar::after, #screen-setup .setup-footer::before {
  content: ''; position: absolute; inset-inline: 0; height: 18px; pointer-events: none;
}
#screen-setup .topbar::after { top: 100%; background: linear-gradient(var(--bg), rgba(245, 240, 228, 0)); }
#screen-setup .setup-footer::before { bottom: 100%; background: linear-gradient(rgba(245, 240, 228, 0), var(--bg)); }

/* פס עליון: מספר הסיבוב בגלולה לבנה */
#round-label { background: #FFFFFF; border: var(--line); border-radius: 999px; padding: 8px 14px; font-size: 15px; font-variant-numeric: tabular-nums; }
.me-badge { font-size: 24px; }

/* חדר המשחק: כל ספרה בקופסה */
.code-box { border-radius: 28px; padding: 18px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.code { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; width: 100%; margin: 0; letter-spacing: 0; font-size: 0; }
.code .digit { height: 76px; border-radius: 18px; background: #FFFFFF; border: var(--line); display: flex; align-items: center; justify-content: center; font-size: 46px; font-weight: 900; font-variant-numeric: tabular-nums; }
#lobby-players { flex-direction: column; flex-wrap: nowrap; align-items: stretch; }
#lobby-players .chip.player { display: flex; align-items: center; gap: 10px; min-height: 56px; padding: 8px 14px; border-radius: 20px; font-size: 18px; font-weight: 800; text-align: start; box-shadow: none; }
#lobby-players .chip.player.on { background: var(--accent-2); }

/* החבילה בתנועה */
#st-passing.active { min-height: 62vh; gap: 6px; }
#st-passing h2 { font-size: 40px; letter-spacing: -1px; margin: 10px 0 4px; }
#pass-sub:not(:empty) { background: #FFFFFF; border: var(--line); border-radius: 20px; padding: 12px 16px; font-size: 16px; font-weight: 700; margin: 10px 0 0; }
.eq i { width: 8px; }

/* עצור! – כל המסך צהוב עם קרניים */
body:has(#screen-game.active #st-stop.active) {
  background-color: var(--accent-2);
  background-image: repeating-conic-gradient(from 0deg at 50% 45%, #FFC21F 0deg 14deg, transparent 14deg 40deg);
  background-attachment: fixed;
}
#st-stop.active { display: flex; flex-direction: column; align-items: center; gap: 18px; }
/* הכרטיס הצהוב מתבטל רק כשהדפדפן יודע לצבוע את כל המסך (:has). בדפדפן ישן נשאר כרטיס צהוב */
@supports selector(:has(*)) {
  #st-stop.active { background: none; border: 0; box-shadow: none; padding: 0; }
}
.hand-disc { width: 230px; height: 230px; border-radius: 999px; background: #FFFFFF; border: 3px solid #141414; box-shadow: 0 7px 0 #141414; display: flex; align-items: center; justify-content: center; }
.hand { animation: shake 0.45s ease-in-out infinite; transform-origin: 50% 80%; }
#st-stop h2 { font-size: 88px; letter-spacing: -2px; line-height: 1; margin: 0; }
#st-stop .lead { background: #141414; color: #FFFFFF; border-radius: 999px; padding: 12px 22px; font-size: 18px; font-weight: 800; margin: 0; }
body:has(#screen-game.active #st-stop.active) #round-label, body:has(#screen-game.active #st-stop.active) .icon-btn { background: #FFFFFF; }

/* משימה */
#st-task.active { display: flex; flex-direction: column; gap: 14px; text-align: start; }
.task-for { font-size: 40px; font-weight: 900; line-height: 1.05; letter-spacing: -1px; margin: 0; }
.task-card { border-radius: 32px; padding: 20px; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.task-cat { align-self: flex-start; background: #FFFFFF; border: var(--line); border-radius: 999px; padding: 6px 14px; font-size: 15px; font-weight: 800; color: var(--ink); }
.task-emoji { width: 140px; height: 140px; border-radius: 999px; background: #FFFFFF; border: 3px solid #141414; box-shadow: 0 5px 0 #141414; display: flex; align-items: center; justify-content: center; font-size: 0; line-height: 1; }
.task-emoji svg { display: block; width: 58%; height: 58%; }
/* צבע הכרטיס לפי הקטגוריה, כמו בצ'יפים במסך ההגדרות */
.task-card[data-cat="kids"] { background: var(--sky); }
.task-card[data-cat="family"] { background: var(--mint); }
.task-card[data-cat="party"] { background: var(--pink); }
.task-card[data-cat="bold"] { background: var(--accent); }
.task-card[data-cat="quick"] { background: var(--accent-2); }
.task-text { align-self: stretch; margin: 0; border-radius: 22px; padding: 18px; font-size: clamp(20px, 6vw, 24px); line-height: 1.3; text-align: center; }
.task-actions { margin-top: 0; }
.task-actions .btn-ghost { min-height: 52px; font-weight: 800; }

/* סיום – רקע סגול */
body:has(#screen-end.active) { background-color: var(--sky); }
#screen-end .hero { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; }
#screen-end .hero h1 { font-size: 52px; line-height: 1; }
#end-summary { background: #FFFFFF; border: var(--line); border-radius: 22px; padding: 14px 18px; margin-top: 16px; color: var(--ink); font-weight: 700; font-size: 17px; }
#screen-end .lead { color: var(--ink); }

/* הדמות מגיבה: מנומנמת בחדר ההמתנה, בפאניקה ב"עצור!" */
.lobby-parcel { display: flex; justify-content: center; margin-bottom: -6px; }
.lobby-parcel svg { animation: doze 2.6s ease-in-out infinite; transform-origin: 50% 90%; }
@keyframes doze { 0%, 100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg) translateY(2px); } }
.hand-disc { position: relative; }
.stop-parcel { position: absolute; inset-inline-end: -26px; bottom: -22px; }
.stop-parcel svg { display: block; animation: jitter 0.22s steps(2, end) infinite; }
@keyframes jitter { 0% { transform: translate(-1.5px, 0) rotate(-4deg); } 100% { transform: translate(1.5px, -1px) rotate(4deg); } }

/* ===================== קריאוּת: טקסט גדול יותר ויעדי מגע של 44px ===================== */
.hint, .hint-inline { font-size: 15px; }
.code-label { font-size: 16px; }
.hero .sub { font-size: 17px; }
.chip { font-size: 17px; padding: 10px 16px; min-height: 44px; }
.setting label, .switch { font-size: 17px; }
input[type="range"] { height: 44px; margin: 0; }
details.card > summary { min-height: 44px; font-size: 18px; }
.switch input { width: 26px; height: 26px; }

/* מסכים נמוכים: כפתור "דילוג" לא יורד מתחת לקצה המסך */
@media (max-height: 820px) {
  .task-emoji { width: 104px; height: 104px; }
  .task-for { font-size: 34px; }
  .task-card { gap: 12px; padding: 16px; }
}
@media (max-height: 700px) {
  .hand-disc { width: 170px; height: 170px; }
  .hand { width: 110px; height: 110px; }
  .stop-parcel svg { width: 72px; height: 72px; }
  #st-stop h2 { font-size: 68px; }
  .task-emoji { width: 88px; height: 88px; }
  .task-for { font-size: 30px; }
  .lobby-parcel svg { width: 72px; height: 72px; }
}
@media (prefers-reduced-motion: reduce) { .hand, .stop-parcel svg, .lobby-parcel svg { animation: none !important; } }
