/* Hineni Parade — "Candlelight" theme. One dark look on purpose: it is used in cars at night.
   Layout: a phone column; screens stack full-height; floating glass cards over the map. */
:root {
  --ground: #0C0907;
  --ground-2: #14100C;
  --surface: rgba(255, 240, 220, 0.05);
  --surface-2: rgba(255, 240, 220, 0.09);
  --glass: rgba(18, 14, 10, 0.86);
  --line: rgba(255, 240, 220, 0.10);
  --line-gold: rgba(233, 180, 76, 0.40);
  --ink: #F4EADB;
  --ink-strong: #FBF4E8;
  --muted: #BCAB91;
  --muted-2: #A8977E;
  --gold: #E9B44C;
  --gold-soft: #F4D48C;
  --gold-ink: #1A1206;
  --me: #8FB8FF;
  --ok: #7BD88F;
  --ok-ink: #CFEBD6;
  --warn: #F2B35B;
  --bad: #F07A6A;
  --bad-ink: #FFD6CF;
  --font-display: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  --font-body: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  --r-sm: 12px;
  --r-md: 18px;
  --r-lg: 26px;
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
a { color: var(--gold); }
a:hover { color: var(--gold-soft); }
h1, h2, h3 { text-wrap: balance; }
:focus-visible { outline: 2px solid var(--gold-soft); outline-offset: 3px; }
.tabular { font-variant-numeric: tabular-nums; }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.display { font-family: var(--font-display); font-weight: 400; letter-spacing: -0.01em; line-height: 1; color: var(--ink-strong); }
.glow-bg { position: absolute; pointer-events: none; border-radius: 50%; background: radial-gradient(closest-side, rgba(233, 180, 76, .17), rgba(12, 9, 7, 0)); }

/* ───────── buttons & inputs ───────── */
.btn {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px; border-radius: 999px;
  border: 1px solid transparent; background: var(--surface-2); color: var(--ink);
  font: 600 16px/1 var(--font-body); cursor: pointer; text-decoration: none;
  transition: transform .15s var(--ease-out), background .2s, opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn[disabled] { opacity: .45; cursor: default; transform: none; }
.btn-gold { background: var(--gold); color: var(--gold-ink); box-shadow: 0 10px 36px rgba(233, 180, 76, .26); }
.btn-gold:hover { background: #F0C163; color: var(--gold-ink); }
.btn-line { background: transparent; border-color: rgba(233, 180, 76, .55); color: var(--gold-soft); }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-danger { background: transparent; border-color: rgba(240, 122, 106, .5); color: var(--bad-ink); }
.btn-big { min-height: 60px; font-size: 17px; width: 100%; }
.btn-sm { min-height: 38px; padding: 0 14px; font-size: 14px; }
.btn-icon { width: 52px; min-height: 52px; padding: 0; border-radius: 50%; background: var(--surface); border-color: var(--line); }
.btn .shine {
  position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(100deg, rgba(255,255,255,0) 30%, rgba(255,255,255,.45) 50%, rgba(255,255,255,0) 70%);
  transform: translateX(-120%); animation: shine 4.5s ease-in-out 2.5s infinite;
}
@keyframes shine { 0% { transform: translateX(-120%); } 35%, 100% { transform: translateX(120%); } }

.field { display: flex; flex-direction: column; gap: 6px; }
.field label, .label { font-size: 13px; font-weight: 500; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; min-height: 50px; padding: 12px 14px; border-radius: var(--r-sm);
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-strong);
  font: 500 16px/1.3 var(--font-body);
}
.input:focus { border-color: var(--line-gold); outline: none; box-shadow: 0 0 0 3px rgba(233, 180, 76, .16); }
textarea.input { min-height: 90px; resize: vertical; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 22px, calc(100% - 15px) 22px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.row { display: flex; gap: 10px; align-items: center; }
.row-wrap { display: flex; flex-wrap: wrap; gap: 10px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.stack-sm { display: flex; flex-direction: column; gap: 8px; }
.spacer { flex: 1 1 auto; }

/* code boxes */
.code-boxes { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; position: relative; }
.code-box {
  height: 56px; border-radius: 14px; border: 1px solid rgba(233, 180, 76, .32); background: var(--surface);
  display: flex; align-items: center; justify-content: center; font-size: 22px; font-weight: 600; color: var(--ink-strong);
  transition: border-color .2s, background .2s;
}
.code-box.active { border-color: var(--gold); background: rgba(233, 180, 76, .08); }
.code-input { position: absolute; inset: 0; opacity: 0; font-size: 16px; text-transform: uppercase; caret-color: transparent; }

/* chips & pills */
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; font-size: 13px; font-weight: 600; border: 1px solid var(--line); color: var(--ink); background: var(--surface); }
.chip-gold { color: var(--gold); border-color: rgba(233, 180, 76, .45); background: transparent; }
.chip-ok { color: var(--ok-ink); border-color: rgba(123, 216, 143, .35); background: rgba(123, 216, 143, .08); }
.chip-warn { color: #FBE0B4; border-color: rgba(242, 179, 91, .4); background: rgba(242, 179, 91, .08); }
.chip-bad { color: var(--bad-ink); border-color: rgba(240, 122, 106, .4); background: rgba(240, 122, 106, .08); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: 0 0 auto; }
.dot.pulse { animation: dotPulse 1.6s ease-in-out infinite; }
@keyframes dotPulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }

/* cards */
.card { border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); padding: 16px; }
.card-gold { border-color: rgba(233, 180, 76, .35); background: rgba(233, 180, 76, .05); }
.glass { background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translate(-50%, 30px);
  max-width: min(92vw, 420px); padding: 12px 18px; border-radius: 14px; z-index: 9999;
  background: #241B12; color: var(--ink-strong); border: 1px solid var(--line-gold);
  font-size: 15px; opacity: 0; pointer-events: none; transition: opacity .25s, transform .3s var(--ease-out);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.bad { border-color: rgba(240, 122, 106, .6); }

/* ───────── menorah ───────── */
.menorah { width: 100%; height: auto; display: block; overflow: visible; }
.menorah .m-candle { fill: #F1E3C6; }
.menorah .m-wick { stroke: #3A2A18; stroke-width: 1.6; stroke-linecap: round; }
.menorah .m-bloom { opacity: 0; transition: opacity 1.2s ease-out; }
.menorah .m-flame { transform-box: fill-box; transform-origin: 50% 100%; transform: scale(0); opacity: 0; }
.menorah .m-flame.on { animation: mIgnite .7s cubic-bezier(.2, .9, .25, 1.25) forwards; }
.menorah .m-flick { transform-box: fill-box; transform-origin: 50% 92%; animation: mFlick 1.8s ease-in-out infinite; }
.menorah .m-glow { animation: mGlow 2.6s ease-in-out infinite; }
@keyframes mIgnite { 0% { transform: scale(0); opacity: 0; } 50% { transform: scale(1.18, 1.32); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
@keyframes mFlick { 0%, 100% { transform: scale(1, 1) skewX(0deg); } 22% { transform: scale(.96, 1.06) skewX(1.6deg); } 48% { transform: scale(1.03, .96) skewX(-1.2deg); } 74% { transform: scale(.98, 1.03) skewX(.8deg); } }
@keyframes mGlow { 0%, 100% { opacity: .65; } 50% { opacity: 1; } }

/* ───────── entrance motion ───────── */
.rise { animation: rise .9s var(--ease-out) both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

/* ───────── participant app ───────── */
.app { position: relative; height: 100%; max-width: 520px; margin: 0 auto; overflow: hidden; }
.screen { position: absolute; inset: 0; display: flex; flex-direction: column; }
.join {
  overflow-y: auto; padding-top: calc(26px + env(safe-area-inset-top, 0px)); padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
  padding-left: max(22px, env(safe-area-inset-left, 0px)); padding-right: max(22px, env(safe-area-inset-right, 0px));
}
.join-head { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.wordmark { font-size: 12px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: #E9DCC6; }
.join-menorah { position: relative; margin: 30px auto 0; width: min(100%, 360px); }
.join-title { margin: 0; font-size: clamp(38px, 11vw, 48px); }
.progress-line { height: 4px; border-radius: 2px; background: rgba(255, 240, 220, .12); position: relative; overflow: hidden; }
.progress-line > i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--gold); border-radius: 2px; transition: width .25s linear; }
.note { font-size: 13px; line-height: 1.45; color: var(--muted-2); text-align: center; }
.alert { padding: 12px 14px; border-radius: var(--r-sm); font-size: 14px; border: 1px solid rgba(240, 122, 106, .45); background: rgba(240, 122, 106, .08); color: var(--bad-ink); }
.alert.alert-ok { border-color: rgba(123, 216, 143, .4); background: rgba(123, 216, 143, .08); color: var(--ok-ink); }

.parade { background: var(--ground); }
#map { position: absolute; inset: 0; background: #0E0B09; }
.leaflet-container { background: #0E0B09; font-family: var(--font-body); }
.leaflet-control-attribution { background: rgba(12, 9, 7, .7) !important; color: var(--muted-2) !important; font-size: 10px !important; }
.leaflet-control-attribution a { color: var(--muted) !important; }
.tiles-dark { filter: invert(100%) hue-rotate(180deg) brightness(88%) contrast(88%) saturate(45%) sepia(22%); }
.route-flow { stroke-dasharray: 2 16; animation: flow 1.4s linear infinite; }
@keyframes flow { to { stroke-dashoffset: -36; } }

.mk-lead { position: relative; width: 46px; height: 46px; }
.mk-lead .mk-core { position: absolute; inset: 2px; border-radius: 50%; background: #1A130B; border: 2px solid var(--gold); display: flex; align-items: center; justify-content: center; box-shadow: 0 0 18px rgba(233, 180, 76, .5); }
.mk-lead .mk-pulse { position: absolute; inset: 2px; border-radius: 50%; border: 2px solid var(--gold); animation: pulse 2.2s ease-out infinite; }
@keyframes pulse { 0% { transform: scale(.7); opacity: .8; } 100% { transform: scale(2.2); opacity: 0; } }
.mk-tail { width: 14px; height: 14px; border-radius: 50%; background: #6E6152; border: 2px solid var(--ground); margin: 2px; }
.mk-me { position: relative; width: 40px; height: 40px; border-radius: 50%; background: rgba(143, 184, 255, .16); display: flex; align-items: center; justify-content: center; }
.mk-me span { width: 15px; height: 15px; border-radius: 50%; background: var(--me); border: 2.5px solid var(--ink); }
.mk-stop { width: 14px; height: 14px; border-radius: 50%; background: var(--ground); border: 3px solid var(--gold); position: relative; }
.mk-stop-label { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); white-space: nowrap; padding: 4px 9px; border-radius: 999px; background: rgba(20, 15, 10, .88); border: 1px solid rgba(233, 180, 76, .35); color: var(--ink); font-size: 11px; font-weight: 600; }
.mk-way { width: 26px; height: 26px; border-radius: 50%; background: var(--gold); color: var(--gold-ink); font: 700 12px/26px var(--font-body); text-align: center; border: 2px solid var(--ground); }

.turn-card {
  position: absolute; z-index: 500; left: max(14px, env(safe-area-inset-left, 0px)); right: max(14px, env(safe-area-inset-right, 0px)); top: calc(14px + env(safe-area-inset-top, 0px));
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 22px;
  animation: dropIn .7s var(--ease-out) both;
}
.turn-icon { flex: 0 0 52px; height: 52px; border-radius: 16px; background: var(--gold); display: flex; align-items: center; justify-content: center; }
.turn-dist { font-size: 28px; font-weight: 600; letter-spacing: -.02em; color: var(--ink-strong); font-variant-numeric: tabular-nums; }
.turn-name { font-size: 15px; color: #CDBEA6; }
.map-chip { position: absolute; z-index: 500; top: calc(14px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); }
.recenter { position: absolute; z-index: 500; right: max(14px, env(safe-area-inset-right, 0px)); width: 46px; min-height: 46px; }
.banner {
  position: absolute; z-index: 600; left: max(14px, env(safe-area-inset-left, 0px)); right: max(14px, env(safe-area-inset-right, 0px));
  padding: 14px 16px; border-radius: 18px; background: #2A1F12; border: 1px solid var(--gold); color: var(--ink-strong);
  display: flex; gap: 12px; align-items: flex-start; animation: dropIn .5s var(--ease-out) both; box-shadow: 0 20px 40px rgba(0, 0, 0, .45);
}
@keyframes dropIn { from { opacity: 0; transform: translateY(-16px); } to { opacity: 1; transform: none; } }

.sheet {
  position: absolute; z-index: 550; left: 0; right: 0; bottom: 0;
  padding: 10px max(22px, env(safe-area-inset-right, 0px)) calc(24px + env(safe-area-inset-bottom, 0px)) max(22px, env(safe-area-inset-left, 0px));
  border-radius: 28px 28px 0 0; display: flex; flex-direction: column; gap: 16px;
  animation: upIn .8s var(--ease-out) both;
}
@keyframes upIn { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.handle { align-self: center; width: 40px; height: 5px; border-radius: 3px; background: rgba(255, 240, 220, .18); }
.big-time { font-family: var(--font-display); font-size: 56px; line-height: .9; color: var(--ink-strong); font-variant-numeric: tabular-nums; }
.scrub { position: relative; height: 4px; border-radius: 2px; background: rgba(255, 240, 220, .12); }
.scrub > i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: 2px; background: var(--gold); }
.scrub > b { position: absolute; top: 50%; left: 0; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: #FFE3A3; box-shadow: 0 0 12px rgba(233, 180, 76, .9); }
.next-stop { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: 18px; background: var(--surface); }
.status-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 28px; }
.status { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: var(--ok-ink); }
.status.wait { color: var(--gold-soft); }
.status.off { color: var(--bad-ink); }

.overlay { position: fixed; inset: 0; z-index: 2000; background: rgba(6, 4, 3, .6); display: flex; align-items: flex-end; justify-content: center; animation: fade .2s ease-out; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.overlay-card {
  width: min(100%, 520px); border-radius: 28px 28px 0 0; background: #17120D; border: 1px solid var(--line);
  padding: 22px max(22px, env(safe-area-inset-right, 0px)) calc(26px + env(safe-area-inset-bottom, 0px)) max(22px, env(safe-area-inset-left, 0px));
  display: flex; flex-direction: column; gap: 14px; animation: upIn .35s var(--ease-out) both;
}
.overlay-card h2 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 32px; color: var(--ink-strong); }
.nudge-val { font-size: 34px; font-weight: 600; text-align: center; font-variant-numeric: tabular-nums; color: var(--ink-strong); min-width: 120px; }

.countdown-ring { position: relative; width: 160px; height: 160px; margin: 0 auto; }
.countdown-num { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--font-display); font-size: 72px; color: var(--ink-strong); }

.ios-guard { position: fixed; inset: 0; z-index: 5000; background: var(--ground); display: flex; align-items: center; justify-content: center; padding: 24px; }
.ios-guard-card { max-width: 420px; display: flex; flex-direction: column; gap: 14px; }
.ios-guard-card h2 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 40px; }
.ios-guard-card p, .ios-guard-card ol { margin: 0; color: var(--muted); }
.ios-guard-link { word-break: break-all; padding: 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); font-size: 14px; }

/* ───────── organizer & admin shells ───────── */
.page { max-width: 760px; margin: 0 auto; padding: calc(20px + env(safe-area-inset-top, 0px)) max(18px, env(safe-area-inset-right, 0px)) calc(110px + env(safe-area-inset-bottom, 0px)) max(18px, env(safe-area-inset-left, 0px)); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.page-title { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 40px; line-height: 1; color: var(--ink-strong); }
.section-title { margin: 0; font-size: 13px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.tabbar {
  position: fixed; z-index: 900; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: center; gap: 4px; padding: 8px max(10px, env(safe-area-inset-right, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)) max(10px, env(safe-area-inset-left, 0px));
  background: rgba(12, 9, 7, .92); border-top: 1px solid var(--line); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
}
.tabbar a { flex: 1 1 0; max-width: 150px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 4px; border-radius: 14px; color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 600; }
.tabbar a[aria-current="page"] { color: var(--gold); background: rgba(233, 180, 76, .08); }
.seg { display: inline-flex; padding: 4px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); gap: 4px; }
.seg button { min-height: 38px; padding: 0 16px; border-radius: 999px; border: none; background: transparent; color: var(--muted); font: 600 14px var(--font-body); cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--gold); color: var(--gold-ink); }
.kv { display: grid; grid-template-columns: minmax(110px, auto) minmax(0, 1fr); gap: 8px 14px; font-size: 15px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.linkbox { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 14px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.linkbox code { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: 13px var(--font-mono); color: var(--ink); }
.plan { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); cursor: pointer; text-align: left; color: var(--ink); font: inherit; width: 100%; }
.plan[aria-pressed="true"] { border-color: var(--gold); background: rgba(233, 180, 76, .07); }
.plan .price { margin-left: auto; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--gold-soft); }
.radio { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--muted-2); flex: 0 0 auto; }
.plan[aria-pressed="true"] .radio { border-color: var(--gold); background: radial-gradient(circle, var(--gold) 45%, transparent 50%); }
.map-box { position: relative; height: min(62vh, 560px); border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line); }
.map-box .leaflet-container { height: 100%; }
.map-tools { position: absolute; z-index: 500; left: 10px; right: 10px; top: 10px; display: flex; flex-wrap: wrap; gap: 8px; }
.live-time { font-family: var(--font-display); font-size: 72px; line-height: .9; color: var(--ink-strong); font-variant-numeric: tabular-nums; }
input[type="range"] { width: 100%; accent-color: var(--gold); }
.qr { background: #fff; padding: 12px; border-radius: 14px; width: 172px; height: 172px; }
.qr img, .qr canvas { width: 148px !important; height: 148px !important; }
.list { display: flex; flex-direction: column; gap: 10px; }
.empty { padding: 28px 18px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--r-md); }
.stat { display: flex; flex-direction: column; gap: 4px; padding: 14px 16px; border-radius: var(--r-md); background: var(--surface); border: 1px solid var(--line); min-width: 0; }
.stat b { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink-strong); }
.stat span { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .menorah .m-flame.on { transform: none; opacity: 1; }
}
