/* פרדס חסה: שפה של עירייה ישראלית משנות ה-50, תוויות ארגזי פרדס, שלטי דרכים וחותמות גומי */
:root {
  --paper: #f4ead0;
  --paper-2: #e9dbb3;
  --ink: #22301e;
  --ink-soft: #4d5a44;
  --leaf: #6aa842;
  --leaf-dark: #2f6a2a;
  --sign: #1d6a3c;
  --tomato: #d8452f;
  --mustard: #e9a920;
  --sky: #bfe0e8;
  --display: "Karantina", "Assistant", sans-serif;
  --body: "Assistant", system-ui, sans-serif;
  /* מרקם נייר עדין */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .28 0 0 0 0 .15 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--sky);
  color: var(--ink);
  font-family: var(--body);
  -webkit-tap-highlight-color: transparent;
}
button { font-family: inherit; }

#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }

.paper {
  background-color: var(--paper);
  background-image: var(--grain);
}

/* ---------- טעינה: תווית ארגז ---------- */
#loader {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center;
  padding: 16px;
  background: var(--sign) var(--grain);
  transition: opacity .7s, visibility .7s;
}
#loader.done { opacity: 0; visibility: hidden; }
.crate {
  width: min(360px, 100%);
  padding: 22px 22px 18px;
  text-align: center;
  background: var(--paper) var(--grain);
  border: 3px solid var(--ink);
  outline: 2px solid var(--paper); outline-offset: -10px;
  border-radius: 14px;
  box-shadow: 0 0 0 6px var(--mustard), 0 0 0 9px var(--ink), 0 18px 40px rgba(0,0,0,.35);
}
.crate-top {
  font: 600 12px var(--body); letter-spacing: .08em;
  border-bottom: 1.5px solid var(--ink); padding-bottom: 8px; margin: 0 6px 10px;
}
.crate-emblem { width: 92px; height: 92px; color: var(--ink); animation: bob 2.4s ease-in-out infinite; }
.crate-muni {
  margin-top: 6px;
  font: 700 30px/1 var(--display); color: var(--ink);
  letter-spacing: .04em;
}
.crate h1 {
  margin: 0;
  font: 700 64px/0.9 var(--display);
  color: var(--tomato);
  text-shadow: 2px 2px 0 var(--ink);
}
.crate-sub { margin: 6px 0 14px; font: 600 15px var(--body); color: var(--ink-soft); }
.ruler {
  position: relative; height: 18px; margin: 0 8px;
  border: 2px solid var(--ink); border-radius: 3px;
  background:
    repeating-linear-gradient(to left, var(--ink) 0 1.5px, transparent 1.5px 10%) bottom / 100% 7px no-repeat,
    repeating-linear-gradient(to left, var(--ink) 0 1px, transparent 1px 2%) bottom / 100% 4px no-repeat,
    #fff8e6;
  overflow: hidden;
}
#bar-fill { position: absolute; inset-block: 0; right: 0; width: 0; background: var(--leaf); mix-blend-mode: multiply; transition: width .3s; }
#loader-msg { margin: 10px 0 0; min-height: 1.4em; font: 600 14px var(--body); color: var(--ink-soft); }
@keyframes bob { 50% { transform: translateY(-5px) rotate(-4deg); } }

/* ---------- שלט הכניסה לעיר ---------- */
#hud {
  position: fixed; z-index: 10;
  top: calc(12px + env(safe-area-inset-top)); inset-inline: 12px;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
  pointer-events: none;
}
.sign {
  pointer-events: auto;
  padding: 7px 16px 8px;
  background: var(--sign);
  color: #fff;
  border-radius: 9px;
  box-shadow: inset 0 0 0 2.5px var(--sign), inset 0 0 0 4.5px #fff, 0 3px 0 #123f24, 0 8px 18px rgba(0,0,0,.25);
  text-align: center;
}
.sign-name { font: 700 34px/1 var(--display); letter-spacing: .02em; }
.sign-meta { display: flex; gap: 6px; justify-content: center; font: 600 13px var(--body); opacity: .95; }
.sign-meta b { font-weight: 800; font-variant-numeric: tabular-nums; }
.sign-dot { opacity: .6; }

.badges { display: flex; gap: 8px; pointer-events: auto; }
.badge {
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--paper) var(--grain);
  border: 2.5px solid var(--ink);
  box-shadow: inset 0 0 0 3px var(--paper), inset 0 0 0 4.5px var(--ink), 0 3px 0 var(--ink);
  font: 700 24px var(--display); color: var(--ink);
  cursor: pointer;
}
.badge:active { transform: translateY(2px); box-shadow: inset 0 0 0 3px var(--paper), inset 0 0 0 4.5px var(--ink), 0 1px 0 var(--ink); }
#time-btn { font-size: 19px; }

/* ---------- טופס חיפוש ---------- */
#search {
  position: fixed; z-index: 10; left: 50%; transform: translateX(-50%);
  bottom: calc(14px + env(safe-area-inset-bottom));
  width: min(500px, calc(100vw - 24px));
  padding: 12px 14px 12px;
  background: var(--paper) var(--grain);
  border: 2.5px solid var(--ink); border-radius: 4px;
  box-shadow: 0 4px 0 var(--ink), 0 12px 26px rgba(0,0,0,.25);
}
/* שוליים מחוררים כמו טופס שנתלש מפנקס */
#search::before {
  content: ""; position: absolute; top: -9px; left: 6px; right: 6px; height: 12px;
  background: radial-gradient(circle at 6px 0, transparent 5px, var(--paper) 5.5px) 0 0 / 14px 12px repeat-x;
}
.form-label { display: block; font: 600 11.5px var(--body); color: var(--ink-soft); letter-spacing: .05em; margin-bottom: 4px; }
.form-row { display: flex; gap: 10px; align-items: center; }
#search input {
  flex: 1; min-width: 0;
  padding: 6px 2px;
  border: none; border-bottom: 2px dotted var(--ink);
  background: transparent; outline: none;
  font: 600 18px var(--body); color: var(--ink);
}
#search input:focus { border-bottom-style: solid; }
#search input::placeholder { color: #9a9378; }

.stamp-btn {
  flex: none;
  padding: 6px 14px 4px;
  font: 700 25px/1 var(--display); color: var(--tomato);
  background: transparent;
  border: 3px solid var(--tomato); border-radius: 6px;
  box-shadow: inset 0 0 0 2px var(--paper), inset 0 0 0 3.5px var(--tomato);
  transform: rotate(-3deg);
  cursor: pointer;
  transition: transform .1s;
}
.stamp-btn:hover { transform: rotate(-1deg) scale(1.03); }
.stamp-btn:active { transform: rotate(-3deg) scale(.94); }

/* ---------- תעודת בעלות ---------- */
/* גיליון שעולה מלמטה כשלוחצים על בית: כרטיס נכס. כותרת עם אייקון וכתובת, שלושה נתונים, מי גר בבית, ושיתוף */
#tag {
  position: fixed; z-index: 12; left: 50%; bottom: 0;
  transform: translateX(-50%);
  width: min(460px, 100vw);
  max-height: 64vh; overflow-y: auto; overscroll-behavior: contain;
  padding: 8px 16px calc(16px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, #fffdf6 0%, var(--paper) 120px);
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -1px 0 rgba(0,0,0,.06), 0 -18px 50px rgba(0,0,0,.32);
  transition: transform .18s ease-out;
  touch-action: pan-x;
}
#tag .tag-grip { display: block; width: 38px; height: 5px; margin: 0 auto 14px; border-radius: 3px; background: var(--ink); opacity: .16; }
/* פס צבע עליון בגוון של גג הבית: לכל בית כרטיס קצת אחר */
#tag::before {
  content: ''; position: absolute; inset: 0 0 auto; height: 5px; border-radius: 24px 24px 0 0;
  background: linear-gradient(90deg, var(--accent, #2f6a2a), color-mix(in srgb, var(--accent, #2f6a2a) 55%, #fff));
}
#tag .tag-head { display: flex; align-items: center; gap: 12px; }
#tag .tag-icon {
  flex: none; width: 56px; height: 56px; display: grid; place-items: center; font-size: 30px;
  border-radius: 18px; background: linear-gradient(150deg, #fff 0%, #f1ead6 100%);
  box-shadow: 0 6px 14px rgba(0,0,0,.12), inset 0 0 0 1px rgba(0,0,0,.05);
}
#tag .tag-addr { flex: 1; min-width: 0; text-align: start; }
#tag .tag-sign { display: flex; align-items: center; gap: 6px; min-width: 0; }
/* שלט רחוב ושלט מספר, כמו בישראל: כחול, מסגרת לבנה */
#tag .tag-street, #tag .tag-num {
  background: #1f4f8f; color: #fff; border-radius: 7px;
  box-shadow: inset 0 0 0 1.5px #fff, 0 0 0 1.5px #1f4f8f, 0 3px 6px rgba(31,79,143,.25);
}
#tag .tag-street { display: inline-block; min-width: 0; padding: 4px 11px 5px; font: 800 17px/1.2 var(--body); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#tag .tag-num { flex: none; min-width: 36px; height: 31px; padding: 0 7px; display: grid; place-items: center; font: 800 18px var(--body); }
#tag .tag-hood { display: block; margin-top: 6px; font: 600 13px var(--body); color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#tag .tag-close {
  flex: none; align-self: flex-start; width: 40px; height: 40px; padding: 0; border: 0; border-radius: 50%;
  background: rgba(0,0,0,.06); color: var(--ink); font: 700 15px/40px var(--body); cursor: pointer;
}
#tag .tag-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0 12px; }
#tag .tag-stat {
  display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 9px 4px 8px; border-radius: 14px;
  background: #fff; box-shadow: inset 0 0 0 1px rgba(0,0,0,.06);
  animation: tag-rise .45s var(--d, 0s) cubic-bezier(.2,1.3,.4,1) both;
}
#tag .tag-stat b { font: 800 19px/1.1 var(--body); color: var(--ink); font-variant-numeric: tabular-nums; }
#tag .tag-stat:first-child b { color: #1f4f8f; }
#tag .tag-stat span { font: 600 11.5px var(--body); color: var(--ink-soft); }
#tag .tag-state { margin: 2px 0; padding: 12px; border-radius: 14px; background: #fff; font: 700 15px/1.4 var(--body); color: var(--ink); text-align: center; box-shadow: inset 0 0 0 1px rgba(0,0,0,.06); }
#tag .tag-state b { font-variant-numeric: tabular-nums; color: var(--tomato); }
#tag .tag-people { display: grid; gap: 8px; }
#tag .tag-person {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 16px; background: #fff;
  color: var(--ink); text-decoration: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.06);
  animation: tag-rise .45s .16s ease-out both;
}
#tag .tag-person:active { transform: scale(.98); }
#tag .tag-avatar {
  flex: none; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, hsl(var(--h) 70% 62%), hsl(calc(var(--h) + 40) 70% 46%));
  color: #fff; font: 800 18px var(--body); box-shadow: 0 0 0 2px #fff, 0 0 0 3.5px hsl(var(--h) 60% 55%);
}
#tag .tag-avatar.sm { width: 24px; height: 24px; font-size: 12px; box-shadow: none; }
#tag .tag-who { flex: 1; display: flex; flex-direction: column; min-width: 0; }
#tag .tag-user { align-self: flex-start; font: 800 17px/1.2 var(--body); color: var(--ink); }
#tag .tag-role { align-self: flex-start; font: 600 12px var(--body); color: var(--ink-soft); }
#tag .tag-go { flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: rgba(0,0,0,.05); font-size: 15px; color: var(--ink-soft); }
#tag .tag-label { margin: 12px 2px 6px; font: 700 12px var(--body); color: var(--ink-soft); text-align: start; }
#tag .tag-mates { display: flex; flex-wrap: wrap; gap: 6px; }
#tag .tag-mate {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 4px; border-radius: 999px;
  background: #fff; box-shadow: inset 0 0 0 1px rgba(0,0,0,.07); color: var(--ink); text-decoration: none; font: 700 13px var(--body);
}
#tag .tag-share {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; margin-top: 12px; padding: 14px;
  border: 0; border-radius: 16px; cursor: pointer; color: #fff; font: 800 16px var(--body);
  background: linear-gradient(180deg, #3f8a3a, var(--leaf-dark)); box-shadow: 0 6px 16px rgba(47,106,42,.35);
  position: relative; overflow: hidden;
}
#tag .tag-share::after { /* ברק שעובר על הכפתור */
  content: ''; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.28) 50%, transparent 70%);
  transform: translateX(-120%); animation: share-shine 3.2s 1s ease-in-out infinite;
}
@keyframes share-shine { 0%, 60% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }
#tag .tag-share:active { transform: translateY(1px) scale(.99); }
@keyframes tag-rise { from { transform: translateY(12px); opacity: 0; } }
#tag:not([hidden]) .tag-icon { animation: icon-in .55s cubic-bezier(.2,1.5,.4,1) both; }
@keyframes icon-in { from { transform: scale(.4) rotate(15deg); opacity: 0; } }
#tag:not([hidden]) .tag-num { animation: num-pop .5s .15s cubic-bezier(.2,1.6,.4,1) both; }
@keyframes num-pop { from { transform: scale(0) rotate(-20deg); } }

/* ---------- הודעה לתושב ---------- */
#toast {
  position: fixed; z-index: 11; left: 50%; transform: translateX(-50%);
  bottom: calc(110px + env(safe-area-inset-bottom));
  max-width: min(460px, calc(100vw - 24px));
  padding: 9px 16px;
  background: var(--ink); color: var(--paper);
  border-inline-start: 6px solid var(--mustard);
  font: 600 15px var(--body);
  box-shadow: 0 8px 20px rgba(0,0,0,.3);
}

/* ---------- מעקב ---------- */
#tracker {
  position: fixed; z-index: 10; left: 50%; transform: translateX(-50%);
  bottom: calc(108px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 8px;
  max-width: calc(100vw - 24px);
  padding: 6px 14px;
  background: var(--mustard);
  border: 2px solid var(--ink); border-radius: 3px;
  box-shadow: 0 3px 0 var(--ink);
  font: 700 14px var(--body); color: var(--ink);
  cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#tracker b { font-variant-numeric: tabular-nums; }

/* ---------- טופס עירוני ---------- */
#modal {
  position: fixed; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
  background: rgba(20, 30, 18, .45);
}
.card {
  position: relative;
  width: min(440px, 100%); max-height: 86vh; max-height: 86dvh; overflow: auto;
  background:
    repeating-linear-gradient(to bottom, transparent 0 27px, rgba(34,48,30,.07) 27px 28px),
    var(--grain), var(--paper);
  border: 2.5px solid var(--ink); border-radius: 4px;
  box-shadow: 0 5px 0 var(--ink), 0 20px 40px rgba(0,0,0,.35);
}
.card-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px 10px;
  border-bottom: 2.5px double var(--ink);
  /* הכותרת נשארת בראש גם כשהתוכן ארוך וגולל (למשל בדפדפן של אינסטגרם, שבו המסך נמוך יותר) */
  position: sticky; top: 0; z-index: 3;
  background: var(--paper);
}
.seal { flex: none; width: 46px; height: 46px; color: var(--ink); }
.card-org { flex: 1; min-width: 0; }
.card-org small { display: block; font: 600 12px var(--body); color: var(--ink-soft); letter-spacing: .04em; }
.card-head h2 { margin: 0; font: 700 32px/1 var(--display); }
.close { align-self: flex-start; background: none; border: none; font-size: 18px; cursor: pointer; color: var(--ink); padding: 4px; }
#modal-body { padding: 14px 18px 4px; font-size: 16px; line-height: 1.6; }
#modal-body p { margin: 0 0 10px; }
#modal-body ul { margin: 0 0 10px; padding-inline-start: 20px; }
#modal-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; padding: 6px 18px 18px; }
.fine { font-size: 13px; color: var(--ink-soft); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 18px;
  background: var(--leaf-dark); color: #fff;
  border: 2.5px solid var(--ink); border-radius: 4px;
  box-shadow: 0 3px 0 var(--ink);
  font: 800 16px var(--body); text-decoration: none;
  cursor: pointer;
}
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.btn-link { background: none; border: none; font: 600 15px var(--body); text-decoration: underline; cursor: pointer; color: var(--ink); }
a.btn-link { color: var(--ink); }

.steps { margin: 4px 0 10px; padding: 0; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; position: relative; padding-inline-start: 38px; margin-bottom: 12px; }
.steps li::before {
  content: counter(s); position: absolute; inset-inline-start: 0; top: -2px;
  width: 28px; height: 28px; border-radius: 50%;
  display: grid; place-items: center;
  border: 2px solid var(--ink); background: var(--mustard);
  font: 700 20px/1 var(--display);
}
.status {
  display: flex; align-items: center; gap: 8px;
  margin-top: 6px; padding: 8px 12px;
  border: 1.5px dashed var(--ink-soft);
  font-size: 15px;
}
.status b { font-variant-numeric: tabular-nums; }

/* חותמת "אושר" שננחתת על הטופס */
.approved {
  float: left; margin: 2px 4px 8px 12px;
  padding: 4px 16px 2px;
  font: 700 44px/1 var(--display); color: var(--leaf-dark);
  border: 4px solid var(--leaf-dark); border-radius: 8px;
  box-shadow: inset 0 0 0 3px var(--paper), inset 0 0 0 5px var(--leaf-dark);
  transform: rotate(-12deg);
  opacity: .9; mix-blend-mode: multiply;
  animation: slam .45s cubic-bezier(.2, 1.6, .4, 1) both;
}
@keyframes slam { from { transform: rotate(-12deg) scale(2.4); opacity: 0; } }

.spinner {
  flex: none; display: inline-block; width: 14px; height: 14px;
  border: 2.5px solid currentColor; border-top-color: transparent; border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.confetti { position: fixed; inset: 0; z-index: 30; pointer-events: none; overflow: hidden; }
.confetti span { position: absolute; top: -40px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(540deg); } }

/* ---------- שונות ---------- */
#demo-badge {
  position: fixed; z-index: 10; left: 12px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  padding: 3px 10px;
  background: #fff; border: 2px dashed var(--tomato);
  font: 700 12px var(--body); color: var(--tomato);
}
#credit { position: fixed; bottom: 2px; left: 6px; z-index: 5; font-size: 10px; color: rgba(34,48,30,.55); }

/* ---------- טלפון ---------- */
@media (max-width: 640px) {
  #hud { inset-inline: 10px; }
  .sign { padding: 5px 12px 6px; }
  .sign-name { font-size: 28px; }
  .sign-meta { font-size: 12px; }
  .badge { width: 40px; height: 40px; }
  #search { padding: 10px 12px; }
  .stamp-btn { font-size: 22px; padding: 5px 10px 3px; }
  #demo-badge { bottom: auto; top: calc(80px + env(safe-area-inset-top)); left: auto; right: 10px; }
  #modal { align-items: flex-end; padding: 0; }
  #modal .card {
    width: 100%; max-height: 84vh; max-height: 84dvh;
    border-radius: 10px 10px 0 0; border-bottom: none;
    padding-bottom: env(safe-area-inset-bottom);
    animation: sheet .28s ease-out;
  }
  #modal-actions .btn { flex: 1 1 100%; }
  .approved { font-size: 36px; }
}
@keyframes sheet { from { transform: translateY(100%); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition: none !important; }
}

/* ---------- העירייה ---------- */
.hall-poi {
  position: fixed; z-index: 8; left: 0; top: 0;
  transform: translate(-50%, -100%);
  display: flex; align-items: center; gap: 6px;
  padding: 5px 12px 6px;
  background: var(--sign); color: #fff;
  border: none; border-radius: 7px;
  box-shadow: inset 0 0 0 2px var(--sign), inset 0 0 0 3.5px #fff, 0 3px 0 #123f24;
  font: 700 19px/1 var(--display); white-space: nowrap; cursor: pointer;
}
.hall-poi::after {
  content: ""; position: absolute; left: 50%; bottom: -7px; transform: translateX(-50%);
  border: 7px solid transparent; border-bottom: none; border-top-color: #123f24;
}
.hall-loading { display: flex; gap: 10px; align-items: center; padding: 14px 0; }
.hall-top {
  display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap;
  font-size: 14px; padding-bottom: 8px; border-bottom: 1.5px dashed var(--ink-soft); margin-bottom: 10px;
}
.hall-top .queue { color: var(--ink-soft); }
.hall-tabs { display: grid; grid-template-columns: repeat(5, 1fr); gap: 5px; margin-bottom: 12px; }
.hall-tabs button {
  padding: 6px 4px 5px;
  background: var(--paper-2); color: var(--ink);
  border: 2px solid var(--ink); border-radius: 4px 4px 0 0;
  font: 700 18px/1.05 var(--display); cursor: pointer;
}
.hall-tabs button small { display: block; font: 600 10.5px var(--body); color: var(--ink-soft); }
.hall-tabs button.on { background: var(--mustard); box-shadow: 0 3px 0 var(--ink); }
.hall-pane { min-height: 160px; }
.hall-card { padding: 10px 12px; margin-bottom: 10px; background: #fff8e4; border: 1.5px solid var(--ink); }
.hall-card p { margin: 0 0 8px; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.hall-form label { display: block; font-weight: 700; margin-bottom: 4px; }
.hall-form input {
  flex: 1; min-width: 0; padding: 8px 4px;
  border: none; border-bottom: 2px dotted var(--ink); background: transparent; outline: none;
  font: 600 17px var(--body); color: var(--ink);
}
.kinds { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 8px 0 12px; }
.kind {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 2px; background: #fff8e4; border: 2px solid var(--ink-soft); border-radius: 6px;
  font: 700 13px var(--body); color: var(--ink); cursor: pointer;
}
.kind span { font-size: 24px; }
.kind.on { border-color: var(--leaf-dark); background: #e5f0d6; box-shadow: 0 0 0 2px var(--leaf-dark); }
.sw-label { margin: 6px 0 4px; font-weight: 700; font-size: 14px; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.swatches button {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--c); border: 2px solid var(--ink); cursor: pointer;
}
.swatches button.on { box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--leaf-dark); }
.btn.wide { width: 100%; margin-top: 8px; }
.book { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.book h3 { margin: 0 0 6px; font: 700 22px var(--display); }
.book ol { margin: 0; padding-inline-start: 22px; font-size: 14px; }
.book li { margin-bottom: 3px; }
.lettuce-box { text-align: center; padding: 6px 0; }
.lettuce-box .big { font-size: 64px; line-height: 1.1; animation: bob 2.4s ease-in-out infinite; }
#clock { font-variant-numeric: tabular-nums; }
@media (max-width: 640px) {
  .hall-tabs button { font-size: 13.5px; padding-inline: 2px; }
  .hall-tabs button small { display: none; }
  .kinds { grid-template-columns: repeat(2, 1fr); }
  .hall-poi { font-size: 17px; }
}

/* ================================================================
   אנימציות ותנועה
   ================================================================ */

/* מסך הטעינה: התווית מתרוממת ומתעופפת למעלה כשהעיר מוכנה */
#loader.done .crate { transform: translateY(-40vh) rotate(-6deg) scale(.9); opacity: 0; transition: transform .8s cubic-bezier(.6,-0.3,.7,1), opacity .6s .2s; }

/* השלט הירוק נכנס כמו שלט שתלוי על עמוד: נופל ומתנדנד */
#hud:not([hidden]) .sign { animation: sign-drop 1.1s cubic-bezier(.3,1.5,.5,1) both; transform-origin: 50% -40px; }
@keyframes sign-drop {
  0% { transform: translateY(-140%) rotate(-8deg); }
  55% { transform: translateY(0) rotate(4deg); }
  75% { transform: rotate(-2deg); }
  100% { transform: rotate(0); }
}
/* הברקה שעוברת על השלט כמו צבע מחזיר אור */
.sign { position: relative; overflow: hidden; }
.sign::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(105deg, transparent 35%, rgba(255,255,255,.28) 50%, transparent 65%);
  transform: translateX(-120%); animation: sheen 7s 2.2s ease-in-out infinite;
}
@keyframes sheen { 0%, 70% { transform: translateX(-120%); } 85%, 100% { transform: translateX(120%); } }

/* העיגולים קופצים אחד אחרי השני */
#hud:not([hidden]) .badges { animation: pop .5s .1s cubic-bezier(.3,1.8,.5,1) both; }
.badge:hover { transform: translateY(-2px) rotate(-6deg); }
.badge { transition: transform .15s; }
@keyframes pop { from { transform: scale(0) rotate(-40deg); } }

/* טופס החיפוש עולה מלמטה */
#search:not([hidden]) { animation: rise .7s .25s cubic-bezier(.2,1.3,.4,1) both; }
@keyframes rise { from { transform: translate(-50%, 140%); } to { transform: translate(-50%, 0); } }

/* החלון העירוני "נוחת" על השולחן */
#modal:not([hidden]) { animation: fade .2s both; }
#modal:not([hidden]) .card { animation: paper .45s cubic-bezier(.25,1.4,.45,1) both; }
@keyframes fade { from { background: transparent; } }
@keyframes paper { from { transform: translateY(30px) rotate(-2.5deg) scale(.96); opacity: 0; } }
@media (max-width: 640px) { #modal:not([hidden]) .card { animation: sheet .3s ease-out both; } }

/* הודעה לתושב מחליקה פנימה */
#toast:not([hidden]) { animation: toast-in .35s cubic-bezier(.2,1.4,.4,1) both; }
@keyframes toast-in { from { transform: translate(-50%, 20px); opacity: 0; } }

/* תעודת הבעלות קופצת */
#tag:not([hidden]) { animation: tag-up .32s cubic-bezier(.2,1.2,.4,1) backwards; }
@keyframes tag-up { from { transform: translate(-50%, 100%); } }
/* כשהגיליון פתוח, טופס החיפוש מתחתיו מוסתר */
body:has(#tag:not([hidden])) #search { visibility: hidden; }

/* כפתור החותמת: נלחץ כמו חותמת גומי אמיתית */
.stamp-btn:active { animation: thump .25s; }
@keyframes thump { 50% { transform: rotate(-3deg) scale(.88); filter: brightness(.9); } }
.btn { transition: transform .12s, box-shadow .12s; }
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 0 var(--ink); }

/* התווית של העירייה מרחפת קלות */
.hall-poi { animation: hover-bob 3s ease-in-out infinite; }
@keyframes hover-bob { 50% { margin-top: -5px; } }

/* פרימיום: כרטיס מוזהב */
.kind.premium {
  position: relative;
  background: linear-gradient(135deg, #fff3c4, #f2cf6b 55%, #fff3c4);
  border-color: #b8860b;
}
.kind.premium em {
  position: absolute; top: -9px; left: 50%; transform: translateX(-50%);
  padding: 1px 8px; background: #b8860b; color: #fff; border-radius: 99px;
  font: 700 10.5px var(--body); font-style: normal;
}
.kinds { grid-template-columns: repeat(3, 1fr); }
.winners-title { margin: 14px 0 6px; font: 700 22px var(--display); }
.winners { margin: 0; padding-inline-start: 18px; font-size: 14px; }
.lottery { text-align: center; }
.lottery .big { font-size: 72px; line-height: 1.1; animation: pop .7s cubic-bezier(.3,1.8,.5,1) both, bob 2.4s 1s ease-in-out infinite; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ================================================================
   הסרטון היומי (9:16). שומרים מרווח למעלה ולמטה בשביל הממשק של אינסטגרם
   ================================================================ */
body.reel #hud, body.reel #search, body.reel #credit, body.reel #demo-badge, body.reel #tag,
body.reel #toast, body.reel #tracker, body.reel #modal, body.reel .hall-poi, body.reel #loader { display: none !important; }
#reel { position: fixed; inset: 0; z-index: 40; pointer-events: none; font-family: var(--body); color: var(--ink); }
#reel > * { position: absolute; left: 50%; translate: -50% 0; opacity: 0; text-align: center; }
.r-title {
  top: 20%;
  padding: 26px 70px 30px;
  background: var(--sign); color: #fff; border-radius: 22px;
  box-shadow: inset 0 0 0 7px var(--sign), inset 0 0 0 12px #fff, 0 12px 0 #123f24, 0 30px 60px rgba(0,0,0,.35);
  font: 700 190px/0.9 var(--display);
}
.r-title small { display: block; font: 700 64px/1.1 var(--display); opacity: .9; }
.r-card {
  top: 18%;
  padding: 28px 56px;
  background: var(--paper) var(--grain);
  border: 6px solid var(--ink); border-radius: 10px;
  box-shadow: 0 12px 0 var(--ink), 0 30px 60px rgba(0,0,0,.3);
  font: 700 92px/1.05 var(--display); white-space: nowrap;
}
.r-card b { color: var(--tomato); }
.r-card small { display: block; font: 700 44px var(--body); color: var(--ink-soft); }
.r-plus { display: block; font: 800 50px var(--body); color: var(--leaf-dark); }
.r-welcome { font: 800 60px/1.35 var(--body); }
.r-win { background: linear-gradient(135deg, #fff3c4, #f2cf6b 55%, #fff3c4); border-color: #8a6400; font: 800 64px/1.3 var(--body); }
.r-prize { display: block; font: 700 70px var(--display); color: #6b4a00; }
.r-end {
  top: 30%; width: 86%;
  padding: 50px 30px 56px;
  background: var(--paper) var(--grain);
  border: 6px solid var(--ink); border-radius: 12px;
  box-shadow: 0 14px 0 var(--ink), 0 30px 70px rgba(0,0,0,.35);
}
.r-stamp {
  display: inline-block; padding: 10px 40px 4px;
  color: var(--tomato); border: 9px solid var(--tomato); border-radius: 14px;
  box-shadow: inset 0 0 0 5px var(--paper), inset 0 0 0 9px var(--tomato);
  font: 700 150px/1 var(--display); rotate: -5deg;
}
.r-end p { margin: 36px 0 18px; font: 800 62px/1.35 var(--body); }
.r-end b { display: block; font: 800 74px var(--body); color: var(--leaf-dark); }


/* קוד האימות: כמו חותמת על הטופס, לוחצים כדי להעתיק */
.code {
  display: block; margin: 8px 0 2px; padding: 6px 18px 4px;
  background: #fff; color: var(--ink); cursor: pointer;
  border: 2px dashed var(--ink); border-radius: 10px;
  font: 700 46px/1 var(--display); letter-spacing: .12em; direction: ltr;
}
.code:hover { background: #fffbe8; }
.ask input {
  width: 100%; box-sizing: border-box; padding: 10px 14px;
  border: 2px solid var(--ink); border-radius: 10px; background: #fff;
  font: 700 18px var(--body); text-align: left;
}

/* ---------- סרטון הפתיחה (reel-intro.js): גרפיקה בסגנון תל בטטה ---------- */
#reel > [class^="ri-"] { translate: none; }
#reel > .ri-label, #reel > .ri-pin { left: 0; }
#reel > .ri-hook, #reel > .ri-counter { left: 0; right: 0; }
#reel > .ri-comment { left: 6%; right: 6%; }
#reel > .ri-say { left: 6%; right: 6%; opacity: 1; }
#reel .ri-hook { direction: ltr; }
#reel .ri-hook {
  position: absolute; top: 15%; left: 0; right: 0; margin: auto; width: max-content;
  display: flex; align-items: center; gap: 26px; padding: 28px 54px;
  background: linear-gradient(160deg, #ffe58a, #f2b705 55%, #d99a00);
  border: 7px solid #fff; border-radius: 48px;
  box-shadow: 0 14px 0 #a86f00, 0 30px 80px rgba(0,0,0,.35);
  font-size: 150px; line-height: 1;
}
#reel .ri-hook b { font: 700 170px/1 var(--display); color: #fff; text-shadow: 0 6px 0 #a86f00; }
#reel .ri-counter {
  position: absolute; top: 5%; left: 0; right: 0; margin: auto; width: max-content;
  display: flex; flex-direction: column; align-items: center;
  padding: 16px 60px 18px; background: rgba(20, 40, 28, .78); color: #fff;
  border: 4px solid rgba(255,255,255,.85); border-radius: 30px;
}
#reel .ri-counter b { font: 700 150px/1 var(--display); color: #ffd84a; }
#reel .ri-counter span { font: 800 44px var(--body); }
#reel .ri-label, #reel .ri-pin {
  position: absolute; left: 0; top: 0; transform-origin: 50% 100%;
  padding: 16px 40px 18px; background: #fff; color: #17201a;
  border: 5px solid #17201a; border-radius: 28px; text-align: center; white-space: nowrap;
  box-shadow: 0 8px 0 #17201a;
}
#reel .ri-label bdi { display: block; font: 800 58px var(--body); }
#reel .ri-label small { display: block; font: 800 40px var(--body); color: var(--tomato); }
#reel .ri-pin { background: var(--tomato); color: #fff; font: 800 64px var(--body); border-color: #fff; box-shadow: 0 8px 0 #7a1d10, 0 20px 50px rgba(0,0,0,.3); }
#reel .ri-comment {
  position: absolute; top: 20%; left: 6%; right: 6%;
  display: flex; align-items: center; gap: 26px; padding: 30px 34px;
  background: #fff; color: #111; border-radius: 34px; direction: rtl;
  box-shadow: 0 24px 60px rgba(0,0,0,.35);
}
#reel .ri-avatar { flex: none; width: 110px; height: 110px; border-radius: 50%; display: grid; place-items: center; font-size: 66px; background: linear-gradient(135deg, #f9ce34, #ee2a7b, #6228d7); }
#reel .ri-comment b { font: 800 40px var(--body); color: #333; }
#reel .ri-comment p { margin: 6px 0 0; font: 700 54px/1.25 var(--body); }
#reel .ri-heart { margin-inline-start: auto; display: flex; flex-direction: column; align-items: center; font-size: 60px; color: #ed4956; }
#reel .ri-heart span { font: 800 34px var(--body); color: #555; }
/* כתוביות קריוקי: לבן עם קו מתאר שחור, המילה הנאמרת בצהוב */
#reel .ri-say {
  position: absolute; left: 7%; right: 7%; top: 58%;
  text-align: center; direction: rtl;
  font: 900 92px/1.18 var(--body); color: #fff;
  -webkit-text-stroke: 14px #000; paint-order: stroke fill;
  text-shadow: 0 8px 16px rgba(0,0,0,.35);
}
#reel .ri-say span { display: inline-block; margin: 0 .1em; } /* בין המילים יש גם רווח אמיתי, כדי שהמילה המודגשת (שגדלה) לא תידבק לשכנות */
#reel .ri-say span.on { color: #ffd400; transform: scale(1.12); }

/* ---------- בריכת הבתים (עירייה) ---------- */
.pool-box { text-align: center; }
.pool-box .big { font-size: 64px; }
.pool-box .lead { margin: 0 0 10px; font-size: 18px; }
.pool-odds { list-style: none; margin: 0 0 12px; padding: 0; text-align: start; }
.pool-odds li { display: grid; grid-template-columns: 1fr auto 70px 38px; gap: 8px; align-items: center; padding: 5px 0; border-bottom: 1px dashed rgba(23,32,26,.25); font-size: 15px; }
.pool-tier { font: 700 12px var(--body); color: var(--ink-soft); }
.pool-bar { display: block; height: 8px; border-radius: 4px; background: rgba(23,32,26,.12); overflow: hidden; }
.pool-bar i { display: block; height: 100%; background: var(--leaf); }
.pool-me { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 8px 0; }
.pool-me > div { padding: 8px 6px; background: rgba(29,106,60,.1); border: 2px solid var(--ink); border-radius: 10px; }
.pool-me small { display: block; font: 600 11px var(--body); color: var(--ink-soft); }
.pool-me b { display: block; font: 700 38px/1.05 var(--display); color: var(--tomato); }
.pool-won { margin: 8px 0 0; padding: 6px 10px; background: #fff3c4; border: 2px solid #8a6400; border-radius: 10px; font-weight: 800; }

/* ---------- סרטון יומי וסטוריז (reel-daily.js, reel-story.js) ---------- */
#reel > .rd-title, #reel > .rd-end { translate: none; left: 0; right: 0; }
.rd-title { top: 14%; margin: auto; width: max-content; text-align: center; font: 700 330px/.85 var(--display); color: #ffd400; -webkit-text-stroke: 16px #000; paint-order: stroke fill; text-shadow: 0 12px 0 rgba(0,0,0,.28); }
.rd-title small { display: block; font: 800 74px var(--body); color: #fff; -webkit-text-stroke: 12px #000; margin-bottom: 18px; }
.rd-chip { display: block; margin-top: 4px; font: 800 40px var(--body); font-style: normal; color: #7dff9a; }
.rd-win { background: linear-gradient(135deg, #fff3c4, #f2cf6b 55%, #fff3c4) !important; border-color: #8a6400 !important; }
.rd-win small:first-child { font-size: 36px; color: #6b4a00; }
.rd-end { bottom: 12%; top: auto; margin: auto; width: max-content; max-width: 90%; padding: 34px 60px 38px; background: var(--tomato); color: #fff; border: 8px solid #fff; border-radius: 40px; text-align: center; box-shadow: 0 14px 0 #7a1d10, 0 30px 70px rgba(0,0,0,.4); }
.rd-end b { display: block; font: 700 130px/1 var(--display); }
.rd-end span { display: block; font: 800 62px var(--body); }
.rd-end small { display: block; margin-top: 12px; font: 700 40px var(--body); opacity: .9; }

#story { position: fixed; inset: 0; z-index: 40; pointer-events: none; font-family: var(--body); color: #fff; text-align: center; direction: rtl; }
#story .rs-hello { position: absolute; top: 9%; left: 0; right: 0; font: 900 84px/1.1 var(--body); -webkit-text-stroke: 16px #000; paint-order: stroke fill; }
#story .rs-big { position: absolute; top: 17%; left: 0; right: 0; font: 700 520px/.8 var(--display); color: #ffd400; -webkit-text-stroke: 24px #000; paint-order: stroke fill; text-shadow: 0 16px 0 rgba(0,0,0,.25); }
#story .rs-big small { display: block; font: 800 90px var(--body); color: #fff; -webkit-text-stroke: 16px #000; margin-bottom: 20px; }
#story .rs-q { font-size: 300px; line-height: .9; top: 22%; }
#story .rs-pill { position: absolute; bottom: 14%; left: 50%; transform: translateX(-50%); width: max-content; max-width: 92%; padding: 26px 56px 30px; background: rgba(20,40,28,.85); border: 6px solid rgba(255,255,255,.9); border-radius: 36px; font: 800 62px var(--body); }
#story .rs-pill b { font: 700 150px/1 var(--display); color: #ffd84a; display: block; }
#story .rs-pill em { display: block; font: 800 44px var(--body); font-style: normal; color: #7dff9a; margin-top: 6px; }
#story .rs-list { position: absolute; top: 20%; left: 8%; right: 8%; display: grid; gap: 22px; }
#story .rs-list > div { padding: 22px 30px 24px; background: #fff; color: #111; border: 6px solid #111; border-radius: 28px; box-shadow: 0 8px 0 #111; font: 800 70px var(--body); }
#story .rs-list small { display: block; font: 800 40px var(--body); color: var(--tomato); }
#story .rs-gold > div { background: linear-gradient(135deg, #fff3c4, #f2cf6b 55%, #fff3c4); border-color: #8a6400; box-shadow: 0 8px 0 #8a6400; }
#story .rs-foot { position: absolute; bottom: 5%; left: 0; right: 0; font: 800 46px var(--body); -webkit-text-stroke: 10px #000; paint-order: stroke fill; }
body.reel #story ~ #hud, body.reel #story ~ #search { display: none; }

/* ---------- שכבת אפקטים לסרטונים (reel-fx.js): צבע, עומק ותנועה ---------- */
body.reel #scene { filter: saturate(1.3) contrast(1.09) brightness(1.04); transform-origin: 50% 55%; will-change: transform; }
body.reel { overflow: hidden; background: #0b2414; }
#fx { position: fixed; inset: 0; z-index: 30; pointer-events: none; overflow: hidden; }
.fx-vig { position: absolute; inset: 0; background: radial-gradient(ellipse 80% 70% at 50% 46%, transparent 52%, rgba(6, 22, 12, .62) 100%); }
.fx-tilt { position: absolute; left: 0; right: 0; height: 24%; backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); }
.fx-tilt.top { top: 0; -webkit-mask-image: linear-gradient(to bottom, #000 0%, transparent 100%); mask-image: linear-gradient(to bottom, #000 0%, transparent 100%); }
.fx-tilt.bottom { bottom: 0; -webkit-mask-image: linear-gradient(to top, #000 0%, transparent 100%); mask-image: linear-gradient(to top, #000 0%, transparent 100%); }
.fx-flare { position: absolute; width: 150%; height: 65%; left: -25%; top: -18%; mix-blend-mode: screen;
  background: radial-gradient(ellipse at 30% 35%, rgba(255, 214, 140, .6), rgba(255, 165, 90, .2) 42%, transparent 72%); }
.fx-flash { position: absolute; inset: 0; background: #fff; opacity: 0; }
.fx-rays { position: absolute; left: 50%; top: 32%; width: 260vmax; height: 260vmax; margin: -130vmax 0 0 -130vmax; border-radius: 50%; opacity: 0;
  background: repeating-conic-gradient(from 0deg, rgba(255, 232, 130, 0) 0 9deg, rgba(255, 232, 130, .3) 9deg 18deg);
  -webkit-mask-image: radial-gradient(circle, #000 4%, transparent 38%); mask-image: radial-gradient(circle, #000 4%, transparent 38%); }
.fx-spark { position: absolute; width: 46px; height: 46px; opacity: 0; background: #fff8d0;
  clip-path: polygon(50% 0, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0 50%, 39% 39%); filter: drop-shadow(0 0 10px #ffe27a); }
.fx-conf { position: absolute; left: 0; top: 0; width: 22px; height: 34px; opacity: 0; border-radius: 4px; }

/* כתוביות: הקופצת מקבלת נצנוץ, והשורה כולה צל קשיח */
#reel .ri-say { filter: drop-shadow(0 10px 0 rgba(0, 0, 0, .38)); will-change: transform; }
#reel .ri-say span { transform-origin: 50% 70%; }
#reel .ri-say span.on { color: #ffe000; text-shadow: 0 0 36px rgba(255, 190, 0, .85); }
#reel .ri-hook { transform-origin: 50% 50%; rotate: -3deg; box-shadow: 0 14px 0 #a86f00, 0 0 90px rgba(255, 200, 0, .75), 0 30px 80px rgba(0, 0, 0, .35); }
#reel .ri-counter b, #reel .rd-title { text-shadow: 0 0 34px rgba(255, 216, 74, .65), 0 8px 0 rgba(0, 0, 0, .3); }
#reel .ri-counter { box-shadow: 0 0 60px rgba(0, 0, 0, .35); }

/* פתיחה שעוצרת גלילה: שאלה פתוחה בפריים הראשון, ובסוף קריאה לשליחה */
#reel > .ri-open, #reel > .ri-share { left: 0; right: 0; }
#reel .ri-open, #reel .ri-share {
  position: absolute; margin: auto; width: max-content; max-width: 90%; text-align: center;
  border: 5px solid #fff; border-radius: 999px; color: #fff; font: 800 62px/1.1 var(--body);
  box-shadow: 0 8px 0 rgba(0,0,0,.35), 0 20px 50px rgba(0,0,0,.3);
}
#reel .ri-open { top: 42%; padding: 20px 46px; background: var(--tomato, #e0432b); }
#reel .ri-share { bottom: 18%; padding: 22px 50px; background: #1d7a46; }

/* ---------- לוח הבנייה (הבית שלי בבנייה) ---------- */
#build {
  position: fixed; z-index: 11; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 70px);
  transform: translateX(-50%); width: min(420px, calc(100vw - 24px));
  display: flex; align-items: center; gap: 12px; padding: 12px 14px 12px 12px;
  background: var(--paper) var(--grain); border-radius: 18px; cursor: pointer;
  box-shadow: 0 10px 30px rgba(0,0,0,.28), inset 0 0 0 1.5px rgba(0,0,0,.06);
  animation: b-drop .55s cubic-bezier(.2,1.3,.4,1) both;
}
#build[hidden] { display: none; }
@keyframes b-drop { from { transform: translate(-50%, -140%); opacity: 0; } }
#build .b-icon {
  flex: none; width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center;
  background: linear-gradient(160deg, #ffd66b, #f2a33a); box-shadow: inset 0 -3px 0 rgba(0,0,0,.15);
}
#build .b-emoji { font-size: 30px; display: inline-block; animation: b-swing 1.6s ease-in-out infinite; transform-origin: 50% 10%; }
@keyframes b-swing { 0%, 100% { transform: rotate(-8deg); } 50% { transform: rotate(8deg) translateY(-2px); } }
#build .b-body { flex: 1; min-width: 0; }
#build .b-title { font: 700 14px var(--body); color: var(--ink); }
#build .b-stage { margin: 2px 0 7px; font: 800 17px var(--body); color: var(--ink); }
#build .b-stage.flash { animation: b-flash .6s ease-out; }
@keyframes b-flash { 0% { transform: translateY(6px); opacity: 0; } 100% { transform: none; opacity: 1; } }
#build .b-bar { height: 12px; border-radius: 99px; background: rgba(0,0,0,.08); overflow: hidden; }
#build .b-bar i {
  display: block; height: 100%; width: 0; border-radius: 99px; transition: width .5s linear;
  background: repeating-linear-gradient(-45deg, #f2a33a 0 10px, #ffd66b 10px 20px);
  background-size: 28px 28px; animation: b-stripes .8s linear infinite;
  box-shadow: 0 0 12px rgba(242,163,58,.6);
}
@keyframes b-stripes { to { background-position: 28px 0; } }
#build .b-meta { display: flex; justify-content: space-between; margin-top: 5px; font: 700 13px var(--body); color: var(--ink-soft); }
#build .b-meta b { color: var(--tomato); font-variant-numeric: tabular-nums; }
#build .b-close {
  position: absolute; top: 6px; inset-inline-end: 6px; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 50%;
  background: rgba(0,0,0,.06); color: var(--ink); font: 700 12px/26px var(--body); cursor: pointer;
}
#build.ready { animation: b-pop .6s cubic-bezier(.2,1.6,.4,1) both; }
#build.ready .b-icon { background: linear-gradient(160deg, #9be36b, #3f9a3a); }
#build.ready .b-emoji { animation: b-key 1s ease-in-out infinite; }
@keyframes b-pop { 0% { transform: translateX(-50%) scale(.85); } 100% { transform: translateX(-50%) scale(1); } }
@keyframes b-key { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-25deg); } 75% { transform: rotate(25deg); } }
#build .b-permit { display: flex; align-items: center; gap: 10px; margin-top: 8px; text-decoration: none; color: var(--ink); font: 800 14px var(--body); }
#build .b-permit img { width: 64px; height: 64px; object-fit: cover; border-radius: 8px; box-shadow: 0 2px 8px rgba(0,0,0,.25); animation: b-shine 2.4s ease-in-out infinite; }
@keyframes b-shine { 50% { filter: brightness(1.15); transform: rotate(-2deg) scale(1.04); } }
body.reel #build { display: none !important; }

/* היתר הבנייה שמופיע מיד אחרי האימות: נכנס מסתובב, כמו מסמך שמונח על השולחן */
.permit-img { display: block; margin: 0 auto 10px; width: min(300px, 80%); }
.permit-img img {
  display: block; width: 100%; border-radius: 6px; box-shadow: 0 10px 28px rgba(0,0,0,.3);
  animation: permit-in .7s cubic-bezier(.2,1.3,.4,1) both;
}
@keyframes permit-in { from { transform: translateY(40px) rotate(-12deg) scale(.7); opacity: 0; } to { transform: rotate(-2deg); } }

/* מסך הטעינה: הארגז נכנס בקפיצה קלה (backwards: לא חוסם את היציאה כשהטעינה נגמרת) */
#loader .crate { animation: crate-in .6s cubic-bezier(.2,.9,.3,1.15) backwards; }
@keyframes crate-in { from { transform: translateY(24px) scale(.9) rotate(1.5deg); opacity: 0; } }
