/* ============ קייטנת פליפר רעננה — עיצוב ============ */
/* עוגן המותג: כחול פליפר #1450B4 */

:root {
  --brand: #1450b4;
  --brand-deep: #0d3577;
  --brand-light: #3f7ad1;
  --ink: #16294a;
  --ink-soft: #52627e;
  --bg: #eef3fa;
  --card: #ffffff;
  --sun: #e8a83c;
  --coral: #e85d75;
  --line: #d8e2ef;
  --radius: 12px;
  --shadow: 0 6px 22px rgba(13, 53, 119, .10);
  --shadow-soft: 0 2px 9px rgba(13, 53, 119, .07);
  --min-px: 2.3;   /* פיקסלים לדקה בציר הזמן */
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Rubik', system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1100px 460px at 85% -100px, rgba(20, 80, 180, .10), transparent 60%),
    radial-gradient(850px 400px at 8% -80px, rgba(232, 168, 60, .09), transparent 60%),
    var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-weight: 700; letter-spacing: -.01em; }

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; -webkit-tap-highlight-color: transparent; }

svg { display: block; }

#gate[hidden], .ticker[hidden], .now-banner[hidden] { display: none; }

/* ============ שער כניסה ============ */

#gate {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 28px 20px 40px;
  text-align: center;
  background:
    radial-gradient(950px 560px at 50% -180px, rgba(20, 80, 180, .16), transparent 65%),
    linear-gradient(180deg, #e6eef9 0%, #eef3fa 100%);
}

.gate-logo { width: 104px; height: 104px; color: var(--brand); filter: drop-shadow(0 10px 22px rgba(13, 53, 119, .30)); animation: float 4s ease-in-out infinite; }
.gate-logo svg { width: 100%; height: 100%; }

@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-9px) rotate(2deg); }
}

.gate-title { font-size: 32px; margin-top: 18px; color: var(--brand); font-weight: 700; }
.gate-sub { font-size: 16.5px; color: var(--ink-soft); margin-top: 6px; max-width: 340px; }
.gate-question { margin-top: 30px; font-size: 20px; }
.gate-hint { color: var(--ink-soft); font-size: 14px; margin-top: 4px; }

.group-grid {
  display: grid; grid-template-columns: repeat(2, minmax(140px, 170px));
  gap: 12px; margin-top: 20px; width: 100%; max-width: 380px; justify-content: center;
}

.group-card {
  position: relative;
  background: var(--card);
  border: 2px solid transparent;
  border-radius: var(--radius);
  padding: 16px 10px 12px;
  box-shadow: var(--shadow-soft);
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.group-card:active { transform: scale(.96); }
.group-card .avatar { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; }
.group-card .avatar svg { width: 36px; height: 36px; }
.group-card .g-name { font-size: 18px; font-weight: 700; }
.group-card .g-ages { font-size: 12.5px; color: var(--ink-soft); }
.group-card .tick {
  position: absolute; top: 8px; inset-inline-start: 8px;
  width: 23px; height: 23px; border-radius: 50%;
  background: #e4ebf4; color: #fff; display: grid; place-items: center;
  font-size: 13px; transition: background .15s ease;
}
.group-card.selected { border-color: var(--gc, var(--brand)); box-shadow: var(--shadow); }
.group-card.selected .tick { background: var(--gc, var(--brand)); }

.gate-cta {
  margin-top: 28px;
  background: linear-gradient(135deg, var(--brand-light), var(--brand));
  color: #fff; font-size: 17px; font-weight: 600;
  padding: 13px 42px; border-radius: 14px;
  box-shadow: 0 8px 20px rgba(13, 53, 119, .32);
  transition: opacity .15s ease, transform .15s ease;
}
.gate-cta:disabled { opacity: .45; }
.gate-cta:not(:disabled):active { transform: scale(.97); }

/* ============ מבנה ראשי ============ */

#app[hidden] { display: none; }

.sticky-stack { position: sticky; top: 0; z-index: 50; }

.topbar {
  background: linear-gradient(135deg, var(--brand-deep) 0%, var(--brand) 60%, #2565c7 130%);
  color: #fff;
  padding: 10px 16px;
  display: flex; align-items: center; gap: 11px;
}
.topbar .logo { width: 38px; height: 38px; flex: 0 0 auto; color: #fff; }
.topbar .logo svg { width: 100%; height: 100%; }
.topbar .titles { flex: 1; min-width: 0; }
.topbar h1 { font-size: 18px; line-height: 1.15; font-weight: 700; }
.topbar .day-theme { font-size: 12.5px; opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .groups-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 10px; border-radius: 10px;
  background: rgba(255, 255, 255, .15);
  border: 1px solid rgba(255, 255, 255, .22);
  font-size: 12.5px; font-weight: 600; color: #fff;
  flex: 0 0 auto;
}
.groups-btn .g-avatars { display: flex; }
.groups-btn .g-mini {
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1.5px solid #fff;
  margin-inline-start: -7px;
}
.groups-btn .g-mini:first-child { margin-inline-start: 0; }
.groups-btn .g-mini svg { width: 15px; height: 15px; }
.groups-btn .g-plus {
  width: 24px; height: 24px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1.5px dashed rgba(255, 255, 255, .7);
  margin-inline-start: -7px;
  font-size: 14px; font-weight: 700; color: #fff;
  background: rgba(255, 255, 255, .12);
}

/* ============ טיקר הודעות ============ */

.ticker {
  background: #0a2a5e;
  color: #f3f6ee;
  overflow: hidden; position: relative;
  border-bottom: 2px solid rgba(63, 122, 209, .45);
}
.ticker-track {
  display: inline-flex; gap: 44px; align-items: center;
  padding: 8px 0;
  white-space: nowrap;
  animation: ticker var(--ticker-dur, 30s) linear infinite;
  will-change: transform;
}
.ticker:active .ticker-track, .ticker:hover .ticker-track { animation-play-state: paused; }
@keyframes ticker { from { transform: translateX(0); } to { transform: translateX(50%); } }

.ticker-item { display: inline-flex; align-items: center; gap: 8px; font-size: 14.5px; }
.ticker-item .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--sun); flex: 0 0 auto; }
.ticker-item.important { color: #ffd98f; font-weight: 600; }
.ticker-item.important .dot { background: var(--coral); box-shadow: 0 0 0 3px rgba(232, 93, 117, .3); }

/* ============ ניווט ימים ============ */

.days {
  background: rgba(238, 243, 250, .93);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  display: flex; gap: 8px; padding: 9px 14px;
  overflow-x: auto; scrollbar-width: none;
}
.days::-webkit-scrollbar { display: none; }

.day-chip {
  flex: 0 0 auto;
  display: flex; flex-direction: column; align-items: center;
  padding: 6px 15px; border-radius: 10px;
  background: #fff; border: 1.5px solid var(--line);
  color: var(--ink-soft);
  transition: all .15s ease;
}
.day-chip .d-letter { font-weight: 700; font-size: 14.5px; color: var(--ink); }
.day-chip .d-date { font-size: 11.5px; }
.day-chip.active {
  background: linear-gradient(135deg, var(--brand-light), var(--brand));
  border-color: transparent; color: rgba(255, 255, 255, .85);
  box-shadow: 0 4px 12px rgba(13, 53, 119, .28);
}
.day-chip.active .d-letter { color: #fff; }
.day-chip.today:not(.active) { border-color: var(--sun); }
.day-chip.today .d-letter::after { content: '●'; font-size: 7px; color: var(--sun); vertical-align: super; margin-inline-start: 3px; }

/* ============ באנר "עכשיו" ============ */

.now-banner {
  margin: 14px 14px 0;
  border-radius: var(--radius);
  background: linear-gradient(120deg, #fdf6e6, #ffffff 70%);
  border: 1.5px solid #f3ddb0;
  box-shadow: var(--shadow-soft);
  padding: 12px 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.now-banner .nb-head { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; color: #a8721e; }
.now-banner .pulse {
  width: 10px; height: 10px; border-radius: 50%; background: var(--coral);
  animation: pulse 1.6s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(232, 93, 117, .5); }
  100% { box-shadow: 0 0 0 12px rgba(232, 93, 117, 0); }
}
.nb-row { display: flex; align-items: center; gap: 10px; }
.nb-row .nb-icon {
  width: 40px; height: 40px; border-radius: 10px; flex: 0 0 auto;
  display: grid; place-items: center;
}
.nb-row .nb-icon svg { width: 24px; height: 24px; }
.nb-row .nb-info { flex: 1; min-width: 0; }
.nb-row .nb-group { font-size: 12px; font-weight: 600; }
.nb-row .nb-label { font-size: 15px; font-weight: 500; line-height: 1.25; }
.nb-row .nb-time { font-size: 12px; color: var(--ink-soft); direction: ltr; text-align: right; }
.nb-progress { height: 5px; border-radius: 99px; background: #edf1f6; overflow: hidden; margin-top: 5px; }
.nb-progress > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--brand-light), var(--brand)); }

/* ============ ציר זמן ============ */

.tl-scroll { overflow-x: auto; scroll-snap-type: x proximity; }
.timeline {
  display: flex; gap: 10px;
  padding: 16px 6px 30px 14px;
  min-width: min-content;
}

.tl-gutter {
  flex: 0 0 40px;
  position: relative;
}
.tl-mark {
  position: absolute; inset-inline-start: 0; width: 100%;
  font-size: 11px; color: var(--ink-soft);
  transform: translateY(-50%);
  text-align: center;
}
.tl-mark::after {
  content: ''; position: absolute; top: 50%; inset-inline-end: -8px;
  width: 6px; height: 1px; background: var(--line);
}
.tl-mark.hour { font-weight: 600; color: var(--ink); }

.tl-col { flex: 1 1 0; min-width: 0; position: relative; }
.timeline.multi .tl-col { min-width: min(39vw, 300px); }
.timeline.multi3 .tl-col { min-width: min(56vw, 300px); scroll-snap-align: center; }

.tl-col-head {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 6px 10px; margin-bottom: 8px;
  border-radius: 10px;
  background: var(--gsoft); color: var(--gcol);
  font-size: 14px;
  border: 1.5px solid color-mix(in srgb, var(--gcol) 28%, transparent);
}
.tl-col-head svg { width: 22px; height: 22px; flex: 0 0 auto; }
.tl-col-head .head-txt { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; }
.tl-col-head .head-name { font-weight: 700; line-height: 1.15; }
.tl-col-head .head-sub { font-size: 11px; opacity: .8; line-height: 1.2; }
.tl-col-head.ghost { visibility: hidden; }

.tl-canvas { position: relative; }

.tl-line {
  position: absolute; inset-inline: 0; height: 1px;
  background: var(--line); opacity: .55;
}

.act {
  position: absolute; inset-inline: 2px;
  border-radius: 10px;
  background: var(--soft);
  border: 1px solid color-mix(in srgb, var(--col) 26%, transparent);
  border-inline-start: 4px solid var(--col);
  padding: 6px 9px;
  display: flex; gap: 8px; align-items: flex-start;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  transition: box-shadow .2s ease;
}
.act .a-icon {
  color: var(--col); flex: 0 0 auto;
  width: 27px; height: 27px; border-radius: 8px;
  background: color-mix(in srgb, var(--col) 11%, #fff);
  display: grid; place-items: center;
  margin-top: 1px;
}
.act .a-icon svg { width: 18px; height: 18px; }
.act .a-body { min-width: 0; }
.act .a-time { font-size: 11px; font-weight: 600; color: var(--col); letter-spacing: .2px; direction: ltr; text-align: right; }
.act .a-label { font-size: 13.5px; font-weight: 500; line-height: 1.22; color: var(--ink); }
.act.compact { padding-top: 4px; padding-bottom: 4px; align-items: center; }
.act.compact .a-icon { width: 21px; height: 21px; }
.act.compact .a-icon svg { width: 14px; height: 14px; }
.act.compact .a-label { font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.act.compact .a-time { font-size: 10px; }

.act.now-active {
  box-shadow: 0 0 0 2px var(--col), 0 8px 20px color-mix(in srgb, var(--col) 32%, transparent);
  animation: glow 2.4s ease-in-out infinite;
  z-index: 3;
}
@keyframes glow {
  0%, 100% { box-shadow: 0 0 0 2px var(--col), 0 7px 18px color-mix(in srgb, var(--col) 28%, transparent); }
  50% { box-shadow: 0 0 0 3px var(--col), 0 9px 26px color-mix(in srgb, var(--col) 46%, transparent); }
}
.act .now-tag {
  position: absolute; bottom: 5px; inset-inline-end: 7px;
  background: var(--coral); color: #fff;
  font-size: 9.5px; font-weight: 700;
  padding: 2px 7px; border-radius: 99px;
  letter-spacing: .3px;
}

/* קו "עכשיו" רוחבי */
.now-line {
  position: absolute; inset-inline: 0; height: 0;
  border-top: 2px dashed var(--coral);
  z-index: 4; pointer-events: none;
}
.now-line::before {
  content: '';
  position: absolute; inset-inline-start: -7px; top: -6px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 0 0 3px rgba(232, 93, 117, .3);
}

/* קו איסוף */
.pickup-line {
  position: absolute; inset-inline: 0;
  border-top: 1.5px dashed #94a3b8;
  z-index: 2; pointer-events: none;
}
.pickup-line span {
  position: absolute; top: -9px; inset-inline-start: 50%; transform: translateX(50%);
  background: #f1f5f9; color: #475569;
  font-size: 10px; font-weight: 600;
  padding: 1px 9px; border-radius: 99px;
  border: 1px solid #cbd5e1;
  white-space: nowrap;
}

/* ============ תחתית ============ */

.legend {
  margin: 6px 14px 20px;
  background: #fff; border-radius: var(--radius);
  box-shadow: var(--shadow-soft);
  padding: 14px 16px;
}
.legend h3 { font-size: 15px; margin-bottom: 10px; }
.legend-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-soft); }
.legend-item .sw {
  width: 25px; height: 25px; border-radius: 7px; flex: 0 0 auto;
  display: grid; place-items: center;
}
.legend-item .sw svg { width: 16px; height: 16px; }

.hours-note {
  margin: 0 14px 16px;
  display: flex; gap: 10px; justify-content: center;
  font-size: 12.5px; color: var(--ink-soft);
}
.hours-note b { color: var(--ink); }
.hours-note .pill { background: #fff; border: 1px solid var(--line); border-radius: 99px; padding: 5px 14px; }

footer.credit {
  text-align: center; font-size: 11.5px; color: #8199b8;
  padding: 0 14px 26px;
}
footer.credit a { color: inherit; }

.sync-note { text-align: center; font-size: 11px; color: #91a7c4; padding-bottom: 10px; }
.sync-note.stale { color: #c9871f; }

/* ============ תפריט הגדרות (bottom sheet) ============ */

.sheet-backdrop {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(10, 30, 66, .45);
  opacity: 0; pointer-events: none; transition: opacity .2s ease;
}
.sheet-backdrop.open { opacity: 1; pointer-events: auto; }

.settings-sheet {
  position: fixed; inset-inline: 0; bottom: 0; z-index: 95;
  background: #fff; border-radius: 18px 18px 0 0;
  padding: 10px 18px calc(20px + env(safe-area-inset-bottom));
  transform: translateY(105%); transition: transform .25s cubic-bezier(.3, .9, .3, 1);
  box-shadow: 0 -10px 40px rgba(10, 30, 66, .25);
  max-height: 82vh; overflow-y: auto;
}
.settings-sheet.open { transform: translateY(0); }
.sheet-handle { width: 44px; height: 5px; border-radius: 99px; background: #dbe4ee; margin: 4px auto 14px; }
.settings-sheet h2 { font-size: 19px; margin-bottom: 4px; }
.settings-sheet .s-sub { font-size: 13.5px; color: var(--ink-soft); margin-bottom: 14px; }
.settings-sheet .group-grid { max-width: none; margin-top: 4px; }
.sheet-save {
  width: 100%; margin-top: 18px;
  background: linear-gradient(135deg, var(--brand-light), var(--brand));
  color: #fff; font-size: 16px; font-weight: 600;
  padding: 13px; border-radius: 12px;
}
.sheet-links { margin-top: 14px; text-align: center; font-size: 12.5px; }
.sheet-links a { color: var(--ink-soft); }

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

@media (min-width: 760px) {
  .topbar { padding-inline: max(24px, calc((100vw - 1060px) / 2)); }
  .days { padding-inline: max(24px, calc((100vw - 1060px) / 2)); justify-content: center; }
  .now-banner, .legend, .hours-note { max-width: 1060px; margin-inline: auto; }
  .now-banner { margin-top: 18px; }
  .now-banner .nb-rows { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 10px 22px; }
  .timeline { max-width: 1080px; margin-inline: auto; padding-inline: 24px; }
  .timeline.multi .tl-col, .timeline.multi3 .tl-col { min-width: 0; }
  .group-grid { grid-template-columns: repeat(4, 150px); max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  .gate-logo, .now-banner .pulse, .act.now-active { animation: none; }
  .ticker-track { animation-duration: 60s; }
}
