:root {
  --ink: #2a1237;
  --ink-2: #6b4f7a;
  --paper: #fffaf3;
  --text: #fff7fb;
  --lime: #d4ff4a;
  --pink: #ff4fd8;
  --cyan: #5ad8ff;
  --red: #ff3d6e;
  --stone: #f6ecd6;
  --gold: #a8751c;
  --font: "Fredoka", "Space Grotesk", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --shadow: 0 5px 0 var(--ink);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; height: 100%; }
body { background: #3a1a6e url("assets/sky.jpg") center / cover no-repeat; color: var(--text); font-family: var(--font); overflow: hidden; -webkit-font-smoothing: antialiased; }
#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; pointer-events: none; }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; }
#scene.dragging { cursor: grabbing; }

/* ---------- top bar ---------- */
.hud-top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 5;
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) 16px 0; pointer-events: none;
}
.hud-top > * { pointer-events: auto; }
.brand { display: flex; align-items: center; gap: 10px; line-height: 1; }
.brand-face { width: 44px; height: 44px; object-fit: contain; filter: drop-shadow(0 3px 0 var(--ink)); }
.brand-text { display: flex; flex-direction: column; }
.brand-name { font-weight: 700; font-size: 24px; letter-spacing: 0.14em; text-shadow: 0 3px 0 var(--ink); }
.brand-sub { margin-top: 5px; font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: rgba(255,247,251,.85); text-shadow: 0 1px 0 var(--ink); }
.top-right { display: flex; align-items: center; gap: 8px; }
.ticker {
  display: flex; align-items: center; gap: 8px;
  background: var(--paper); color: var(--ink); border: 2px solid var(--ink); border-radius: 999px;
  padding: 7px 12px; font-family: var(--mono); font-size: 13px; white-space: nowrap; box-shadow: var(--shadow);
}
.ticker-sym { color: var(--ink-2); }
.ticker-mc { font-weight: 700; }
.ticker-src { color: var(--ink-2); font-size: 11px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: #b9a9c4; }
.live-dot.on { background: #22c55e; animation: ping 1.6s infinite; }
.live-dot.err { background: var(--red); }

.hint {
  position: fixed; z-index: 4; left: 50%; transform: translateX(-50%);
  top: calc(env(safe-area-inset-top) + 66px);
  background: rgba(42,18,55,.55); color: #fff; border: 1px solid rgba(255,255,255,.25); border-radius: 999px;
  padding: 6px 14px; font-size: 12px; font-weight: 600; backdrop-filter: blur(8px); white-space: nowrap;
  transition: opacity .6s; pointer-events: none;
}
.hint.fade { opacity: 0; }
.hint-short { display: none; }

/* ---------- speech bubble + tooltip ---------- */
.bubble {
  position: fixed; z-index: 4; left: 50%; transform: translateX(-50%);
  top: calc(env(safe-area-inset-top) + 104px);
  background: #fff; color: var(--ink); font-weight: 600; font-size: 15px;
  padding: 10px 16px; border-radius: 18px; border: 3px solid var(--ink); box-shadow: var(--shadow);
  max-width: min(92vw, 520px); text-align: center; pointer-events: none; transition: opacity .3s;
}
.bubble:empty, .bubble.off { opacity: 0; }
body[data-layout="landscape"] .bubble { left: auto; transform: translateY(-50%); max-width: 280px; }
body[data-layout="landscape"] .bubble::after { content: ""; position: absolute; right: -14px; top: 50%; transform: translateY(-50%); border: 8px solid transparent; border-left: 10px solid var(--ink); border-right: 0; }
body[data-layout="landscape"] .bubble::before { content: ""; position: absolute; right: -9px; top: 50%; transform: translateY(-50%); z-index: 1; border: 6px solid transparent; border-left: 8px solid #fff; border-right: 0; }
.tip {
  position: fixed; z-index: 7; pointer-events: none; transform: translate(-50%, calc(-100% - 14px));
  background: var(--ink); color: #fff; font-size: 13px; font-weight: 600; padding: 6px 10px; border-radius: 10px;
  white-space: nowrap; box-shadow: 0 4px 14px rgba(0,0,0,.35);
}
.tip::after { content: ""; position: absolute; left: 50%; bottom: -6px; transform: translateX(-50%); border: 6px solid transparent; border-top-color: var(--ink); border-bottom: 0; }

/* ---------- globe controls ---------- */
.globe-controls { position: fixed; left: 14px; top: 50%; transform: translateY(-50%); z-index: 5; display: flex; flex-direction: column; gap: 8px; }
.ctl {
  width: 42px; height: 42px; border-radius: 14px; border: 2px solid var(--ink); background: var(--paper); color: var(--ink);
  font-family: var(--font); font-size: 22px; font-weight: 700; cursor: pointer; box-shadow: var(--shadow); line-height: 1;
  transition: transform .1s, box-shadow .1s;
}
.ctl:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--ink); }
.ctl-follow { background: var(--lime); font-size: 18px; animation: pop .4s cubic-bezier(.2,1.4,.4,1); }

/* ---------- arrival ---------- */
.arrived {
  position: fixed; inset: 0; z-index: 45; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: radial-gradient(ellipse at center, rgba(255,214,140,.28), rgba(30,14,40,.78)); backdrop-filter: blur(6px);
  animation: fadein 1.2s ease;
}
.arrived-card {
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); width: min(860px, 100%); max-height: calc(100dvh - 32px);
  background: var(--stone); color: var(--ink); border: 3px solid var(--ink); border-radius: 28px; overflow: hidden;
  box-shadow: 0 10px 0 var(--ink), 0 40px 120px -20px rgba(0,0,0,.6); animation: rise 1s cubic-bezier(.2,.8,.2,1);
}
.arrived-img { width: 100%; height: 100%; min-height: 0; object-fit: cover; display: block; border-right: 3px solid var(--ink); }
.arrived-body { padding: 26px 26px 22px; display: flex; flex-direction: column; justify-content: center; overflow-y: auto; }
.arrived-kicker { font-size: 12px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--gold); }
.arrived-title { margin: 6px 0 10px; font-size: clamp(28px, 4vw, 40px); line-height: 1.05; }
.arrived-sub { margin: 0 0 16px; color: var(--ink-2); font-size: 16px; line-height: 1.45; }
.arrived-note { background: #fffdf7; border: 2px dashed var(--gold); border-radius: 14px; padding: 10px 14px; margin-bottom: 16px; transform: rotate(-1deg); }
.arrived-note span { display: block; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); }
.arrived-note p { margin: 6px 0 0; font-size: 17px; font-style: italic; overflow-wrap: anywhere; }
.arrived-actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 700px) {
  .arrived-card { grid-template-columns: 1fr; grid-template-rows: minmax(0, 46vh) auto; }
  .arrived-img { border-right: 0; border-bottom: 3px solid var(--ink); }
  .arrived-body { padding: 18px; }
}

/* ---------- bottom panel ---------- */
.hud-bottom {
  position: fixed; left: 50%; bottom: max(12px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 5; width: min(calc(100vw - 24px), 620px);
  background: var(--paper); color: var(--ink); border: 3px solid var(--ink); border-radius: 24px;
  padding: 16px 16px 12px; box-shadow: 0 8px 0 var(--ink), 0 30px 60px -20px rgba(0,0,0,.5);
  transition: transform .35s cubic-bezier(.2,.8,.2,1);
}
.hud-bottom.collapsed { transform: translate(-50%, calc(100% - 58px)); }
.hud-toggle {
  position: absolute; top: -16px; left: 50%; transform: translateX(-50%);
  width: 44px; height: 28px; border-radius: 999px; border: 2px solid var(--ink); background: var(--paper); color: var(--ink);
  font-size: 18px; line-height: 1; cursor: pointer; box-shadow: 0 3px 0 var(--ink);
}
.hud-bottom.collapsed .hud-toggle { transform: translateX(-50%) rotate(180deg); }
.route { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 15px; }
.chip { background: #fff; border: 2px solid var(--ink); border-radius: 999px; padding: 5px 12px; white-space: nowrap; max-width: 44%; overflow: hidden; text-overflow: ellipsis; }
.chip-to { background: #ffe3f7; }
.route-line { position: relative; flex: 1; height: 12px; border-radius: 999px; background: #e9dcf0; border: 2px solid var(--ink); }
.route-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 999px; background: linear-gradient(90deg, var(--cyan), var(--lime)); transition: width .6s cubic-bezier(.2,.8,.2,1); }
.route-marker {
  position: absolute; top: 50%; left: 0; width: 30px; height: 30px; transform: translate(-50%, -52%);
  background: var(--face, url("assets/walky-face.webp")) center / contain no-repeat; transition: left .6s cubic-bezier(.2,.8,.2,1);
  filter: drop-shadow(0 2px 0 var(--ink));
}
.tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 12px; }
.tile { background: #fff; border: 2px solid var(--ink); border-radius: 14px; padding: 8px 6px; text-align: center; min-width: 0; }
.tile b { display: block; font-family: var(--mono); font-size: 15px; font-weight: 700; overflow-wrap: anywhere; }
.tile span { display: block; color: var(--ink-2); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; margin-top: 3px; }
.tile-accent { background: #fff5c2; }
.tile-pct { background: #eaffb0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 12px; }
.btn {
  appearance: none; border: 2px solid var(--ink); background: #fff; color: var(--ink);
  font-family: var(--font); font-weight: 700; font-size: 14px; padding: 9px 14px; border-radius: 999px;
  cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
  box-shadow: 0 4px 0 var(--ink); transition: transform .1s ease, box-shadow .1s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 5px 0 var(--ink); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.btn-primary { background: var(--lime); }
.btn-ghost { background: var(--paper); }
.btn-block { width: 100%; justify-content: center; }
.btn-sm { padding: 7px 14px; font-size: 13px; }
.fineprint { margin-top: 10px; text-align: center; color: var(--ink-2); font-size: 11px; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; background: rgba(20, 6, 40, .72); backdrop-filter: blur(8px); padding: 16px; }
.modal-card {
  width: 100%; max-width: 440px; max-height: calc(100dvh - 24px); overflow-y: auto; background: var(--paper); color: var(--ink); border: 3px solid var(--ink); border-radius: 28px;
  padding: 18px 22px 24px; text-align: center; box-shadow: 0 10px 0 var(--ink), 0 40px 120px -30px rgba(0,0,0,.6);
  animation: pop .5s cubic-bezier(.2,1.4,.4,1);
}
.modal-mascot { width: 130px; height: 130px; object-fit: contain; margin-bottom: 4px; filter: drop-shadow(0 6px 0 rgba(42,18,55,.25)); animation: bounce 1.6s ease-in-out infinite; }
.modal-card h2 { margin: 0 0 10px; font-size: 26px; }
.picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.pick {
  appearance: none; cursor: pointer; font-family: var(--font); color: var(--ink);
  background: #fff; border: 2px solid var(--ink); border-radius: 18px; padding: 8px 4px 8px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  box-shadow: 0 4px 0 var(--ink); transition: transform .12s, box-shadow .12s, background .12s;
}
.pick img { width: 56px; height: 56px; object-fit: contain; transition: transform .2s cubic-bezier(.2,1.6,.4,1); }
.pick b { font-size: 15px; }
.pick small { font-size: 11px; color: var(--ink-2); }
.pick:hover img { transform: scale(1.08) rotate(-4deg); }
.pick[aria-checked="true"] { background: var(--lime); transform: translateY(-2px); box-shadow: 0 6px 0 var(--ink); }
.pick[aria-checked="true"] img { transform: scale(1.12); }
.pick:focus-visible { outline: 3px solid var(--pink); outline-offset: 2px; }
.btn-face { width: 20px; height: 20px; object-fit: contain; margin: -2px 0; }
.modal-card p { color: var(--ink-2); margin: 0 0 16px; }
.field { display: block; text-align: left; margin-bottom: 12px; }
.field span { display: block; color: var(--ink-2); font-size: 12px; text-transform: uppercase; letter-spacing: .1em; margin-bottom: 6px; }
select, textarea, input[type="text"], input[type="number"] { width: 100%; font-family: var(--font); font-size: 16px; color: var(--ink); background: #fff; border: 2px solid var(--ink); border-radius: 14px; padding: 11px 12px; }
select:focus, input:focus { outline: 3px solid rgba(255,79,216,.5); outline-offset: 1px; }
textarea { resize: none; line-height: 1.35; }
.field em { text-transform: none; letter-spacing: 0; font-style: normal; opacity: .8; }
.field-hint { display: block; margin-top: 6px; color: var(--ink-2); font-size: 12px; line-height: 1.35; text-align: left; }
.about-card { text-align: left; }
.about-card p { color: var(--ink); line-height: 1.5; margin: 0 0 12px; font-size: 15px; }
.about-kicker { font-size: 12px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; color: var(--gold); }
.about-visit { background: var(--stone); border-radius: 12px; padding: 10px 12px; font-size: 14px !important; }
.geo-status { color: var(--ink-2); font-size: 13px; min-height: 18px; margin: 8px 0 12px; font-family: var(--mono); }

/* ---------- dev panel ---------- */
.dev { position: fixed; left: 12px; top: 90px; z-index: 30; width: min(320px, calc(100vw - 24px)); background: var(--paper); color: var(--ink); border: 3px solid var(--ink); border-radius: 16px; padding: 12px; font-size: 13px; box-shadow: 0 6px 0 var(--ink); }
.dev-head { display: flex; justify-content: space-between; align-items: center; font-weight: 700; margin-bottom: 8px; }
.dev-x { background: none; border: none; color: var(--ink); font-size: 18px; cursor: pointer; }
.dev label { display: block; color: var(--ink-2); margin-bottom: 8px; }
.dev input[type="text"], .dev input[type="number"] { margin-top: 4px; padding: 7px 10px; font-size: 14px; }
.dev input[type="range"] { width: 100%; margin: 0 0 10px; accent-color: var(--pink); }
.dev-row { display: flex; gap: 8px; }
.dev-row label { flex: 1; }
.dev-row .btn { flex: 1; justify-content: center; padding: 8px; font-size: 13px; }
.dev-check { display: flex !important; align-items: center; gap: 8px; }
.dev-check input { width: auto; }
.dev-note { color: var(--ink-2); font-size: 11px; margin-top: 8px; }
.dev code { color: var(--pink); }

@keyframes ping { 0% { box-shadow: 0 0 0 0 rgba(34,197,94,.6); } 100% { box-shadow: 0 0 0 10px rgba(34,197,94,0); } }
@keyframes pop { from { transform: scale(.7); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes bounce { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }

@media (max-width: 560px) {
  .brand-name { font-size: 19px; }
  .brand-sub { display: none; }
  .brand-face { width: 34px; height: 34px; }
  .ticker { font-size: 12px; padding: 6px 10px; }
  .ticker-src { display: none; }
  .hint { font-size: 11px; top: calc(env(safe-area-inset-top) + 54px); }
  .hint-long { display: none; }
  .hint-short { display: inline; }
  .bubble { font-size: 13px; top: calc(env(safe-area-inset-top) + 88px); padding: 8px 12px; }
  .globe-controls { left: 10px; top: auto; bottom: 46%; transform: none; }
  .ctl { width: 38px; height: 38px; font-size: 20px; }
  .hud-bottom { padding: 14px 12px 10px; border-radius: 20px; }
  .route { font-size: 13px; gap: 6px; }
  .chip { padding: 4px 9px; }
  .tiles { gap: 6px; }
  .tile b { font-size: 12px; }
  .tile span { font-size: 9px; }
  .btn { font-size: 13px; padding: 8px 12px; }
  .hud-bottom.collapsed { transform: translate(-50%, calc(100% - 54px)); }
}

/* ---- Israeli & Jewish culture ---- */
.flag-ico { display: inline-block; width: 1.45em; height: 1em; vertical-align: -0.12em; background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 220 160'%3E%3Crect width='220' height='160' fill='%23fff'/%3E%3Crect y='14' width='220' height='22' fill='%230038b8'/%3E%3Crect y='124' width='220' height='22' fill='%230038b8'/%3E%3Cg fill='none' stroke='%230038b8' stroke-width='7'%3E%3Cpath d='M110 49 L141 103 H79 Z'/%3E%3Cpath d='M110 111 L141 57 H79 Z'/%3E%3C/g%3E%3C/svg%3E") center / 100% 100% no-repeat; border-radius: 3px; box-shadow: 0 0 0 1.5px var(--ink); font-style: normal; }
.israel-edge { position: fixed; left: 0; right: 0; top: 0; height: 9px; z-index: 60; pointer-events: none; background: linear-gradient(#0038b8 0 3px, #fff 3px 6px, #0038b8 6px 9px); box-shadow: 0 2px 0 var(--ink); }
.heb { font-family: "Noto Sans Hebrew", "Arial Hebrew", "Segoe UI", sans-serif; direction: rtl; unicode-bidi: isolate; }
.shalom { display: table; margin: 0 auto 10px; padding: 5px 14px; border-radius: 999px; background: #fff; color: #0038b8; border: 2px solid #0038b8; font-weight: 700; font-size: 15px; letter-spacing: .04em; }
.arrived-body .heb { color: #0038b8; font-weight: 700; font-size: 18px; margin: -2px 0 12px; direction: ltr; }
.about-h { margin: 14px 0 8px; font-size: 18px; color: #0038b8; border-top: 3px double #0038b8; padding-top: 12px; }
.about-card p b, .arrived-sub b { color: #0038b8; }
.brand-name .flag-ico { font-size: 15px; margin-left: 4px; letter-spacing: 0; }

/* ---- start button: big, and always on screen (no scrolling to begin) ---- */
#onboard .modal-card { padding-bottom: 0; }
#btnStart {
  position: sticky; bottom: 14px; z-index: 2; width: 100%; margin: 6px 0 16px;
  padding: 18px 20px; font-size: 24px; font-weight: 700; letter-spacing: .02em; border-radius: 22px;
  box-shadow: 0 6px 0 var(--ink), 0 -14px 16px 6px var(--paper); animation: startPulse 1.8s ease-in-out infinite;
}
#btnStart::after { content: " →"; }
@keyframes startPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.025); } }
@media (max-height: 700px) { #onboard .modal-mascot { width: 84px; height: 84px; } #onboard .modal-card h2 { font-size: 22px; margin-bottom: 6px; } }
@media (prefers-reduced-motion: reduce) { #btnStart { animation: none; } }
#btnStart { white-space: nowrap; gap: 8px; justify-content: center; }
#btnStart::after { content: "→"; }
@media (max-width: 420px) { #btnStart { font-size: 20px; padding: 17px 12px; } }
