:root {
  --bg1: #fff4e6;
  --bg2: #e8f0ff;
  --ink: #2b2350;
  --muted: #6b648f;
  --purple: #7c5cff;
  --indigo: #4b3bb5;
  --pink: #ff5c93;
  --teal: #19b7a6;
  --yellow: #ffc83d;
  --red: #e5484d;
  --card: #ffffff;
  --radius: 24px;
  --shadow: 0 10px 30px rgba(60, 40, 140, 0.15);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Rubik", "Heebo", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  color: var(--ink);
  background: linear-gradient(160deg, var(--bg1), var(--bg2));
  background-attachment: fixed;
  min-height: 100dvh;
  padding-bottom: env(safe-area-inset-bottom, 0);

}

.trial-banner {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--red);
  color: #fff;
  text-align: center;
  font-weight: 800;
  font-size: 1.05rem;
  padding: calc(8px + env(safe-area-inset-top, 0)) 12px 8px;
  letter-spacing: 0.3px;
  box-shadow: 0 2px 10px rgba(229, 72, 77, 0.4);
}

.app {
  max-width: 520px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - 44px);
}

.view {
  display: flex;
  flex-direction: column;
  gap: 16px;
  flex: 1;
}


.panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1;
}

.panel-title {
  margin: 0;
  font-size: 1.7rem;
  font-weight: 800;
  text-align: center;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* ---------- Date card ---------- */
.date-card {
  background: linear-gradient(135deg, var(--purple), var(--pink));
  color: #fff;
  border-radius: var(--radius);
  padding: 18px 20px;
  text-align: center;
  box-shadow: var(--shadow);
}

.weekday { font-size: 1rem; opacity: 0.9; }

.hebrew-date { font-size: 1.8rem; font-weight: 800; margin: 4px 0; line-height: 1.25; }
.gregorian-date { font-size: 0.85rem; opacity: 0.85; direction: ltr; unicode-bidi: isolate; }

/* ---------- Step card ---------- */
.step-card {
  position: relative;
  flex: 1;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px 20px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 10px;
  border: 4px solid var(--yellow);
  min-height: 200px;
}

.step-emoji { font-size: 4.5rem; line-height: 1; }
.step-title { font-size: 1.7rem; margin: 0; font-weight: 800; }
.step-sub { margin: 0; color: var(--muted); font-size: 1.05rem; }

.badges { display: flex; gap: 8px; margin-top: 10px; opacity: 0.45; }
.badge {
  font-size: 0.85rem;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 999px;
  color: #fff;

}
.badge-mandatory { background: var(--red); }
.badge-chumra { background: var(--teal); }

.help-btn {
  position: absolute;
  top: 12px;
  inset-inline-start: 12px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: var(--purple);
  color: #fff;
  font-size: 1.2rem;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(124, 92, 255, 0.4);
}
.help-btn.inline { position: static; flex: none; }

/* ---------- Zmanim (display only) ---------- */
.zmanim-card {
  background: var(--card);
  border: 3px solid #cfe3ff;
  border-radius: var(--radius);
  box-shadow: 0 4px 14px rgba(60, 40, 140, 0.1);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.zm-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.zm-title { font-weight: 800; font-size: 1.05rem; }
.zm-source { font-size: 0.78rem; color: var(--muted); }
.zm-grid {
  display: flex;
  gap: 8px;
}
.zm-tile {
  flex: 1;
  min-width: 0;
  background: #f1f6ff;
  border-radius: 16px;
  padding: 8px 6px;
  text-align: center;
}
.zm-k { font-size: 0.8rem; color: var(--muted); }
.zm-v { font-size: 1.15rem; font-weight: 800; margin-top: 2px; }
.zm-v.is-time { direction: ltr; unicode-bidi: isolate; font-variant-numeric: tabular-nums; }
.zm-v.is-missing { font-size: 0.95rem; color: var(--muted); }
.zm-sub { font-size: 0.7rem; color: var(--muted); margin-top: 2px; line-height: 1.3; }

.zm-select {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.8rem;

  color: var(--muted);
}
.zm-select select {
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  background: #fff;
  border: 2px solid #cfe3ff;
  border-radius: 12px;
  padding: 8px 10px;
  max-width: 100%;
}
.zm-select select:disabled { opacity: 0.5; }
.zm-note { margin: 0; font-size: 0.74rem; color: var(--muted); text-align: center; }

/* ---------- Placeholder cards (inactive) ---------- */
.ph-cards {
  display: flex;
  gap: 10px;
}
.ph-card {
  position: relative;
  flex: 1;
  background: #ececf2;
  border: 2px dashed #b9b2dd;
  border-radius: 18px;
  padding: 22px 10px 12px;
  text-align: center;
  color: #8a86a3;
  filter: grayscale(1);
  cursor: not-allowed;
  user-select: none;

}
.ph-tag {
  position: absolute;
  top: 6px;
  inset-inline-start: 8px;
  font-size: 0.7rem;
  font-weight: 800;
  background: #d5d2e3;
  color: #6b648f;
  padding: 2px 8px;
  border-radius: 999px;
}
.ph-name { font-weight: 800; font-size: 1.1rem; }
.ph-state { font-size: 0.78rem; margin-top: 2px; }

/* ---------- Buttons ---------- */
.actions { display: flex; flex-direction: column; gap: 10px; }
.secondary-actions { display: flex; gap: 10px; }
.secondary-actions > * { flex: 1; }

.btn {
  font: inherit;
  font-weight: 800;
  border: none;
  border-radius: 18px;
  padding: 16px 20px;
  font-size: 1.25rem;
  cursor: pointer;
  transition: transform 0.08s ease;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; transform: none; }


.btn-next {
  background: linear-gradient(135deg, var(--teal), #0fa0d8);
  color: #fff;
  box-shadow: 0 8px 18px rgba(25, 183, 166, 0.4);
  width: 100%;
}
.btn-pink {
  background: linear-gradient(135deg, var(--pink), #ff8a5c);
  color: #fff;
  font-size: 1rem;
  padding: 12px;
  box-shadow: 0 6px 14px rgba(255, 92, 147, 0.35);
}
.btn-ghost {
  background: #fff;
  color: var(--purple);
  font-size: 1rem;
  padding: 12px;
  box-shadow: 0 3px 10px rgba(60, 40, 140, 0.12);
}
.btn-small { padding: 8px 16px; flex: none; }
.btn-danger { color: var(--red); }

.foot { text-align: center; padding: 6px 0 12px; }
.link-btn {
  background: none;
  border: none;
  color: var(--muted);
  font: inherit;
  font-size: 0.85rem;
  text-decoration: underline;

  cursor: pointer;
}
.privacy { margin: 4px 0 0; font-size: 0.78rem; color: var(--muted); text-align: center; }

/* ---------- Entry ---------- */
.date-pick {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: #fff;
  border-radius: 18px;
  padding: 6px 12px;
  box-shadow: 0 3px 10px rgba(60, 40, 140, 0.12);
  font-size: 0.78rem;
  color: var(--muted);
}
.date-pick input {
  font: inherit;
  font-size: 1rem;
  color: var(--ink);
  border: none;
  background: transparent;
  direction: ltr;
  min-width: 0;
}

.chosen-date {
  background: #fff;
  border-radius: 18px;
  padding: 10px 16px;
  text-align: center;
  box-shadow: 0 3px 10px rgba(60, 40, 140, 0.12);

}
.chosen-heb { font-weight: 800; font-size: 1.2rem; }
.chosen-greg { font-size: 0.8rem; color: var(--muted); direction: ltr; unicode-bidi: isolate; }

.choices { display: grid; gap: 12px; }
.choice {
  font: inherit;
  font-weight: 800;
  font-size: 1.6rem;
  color: #fff;
  border: 4px solid transparent;
  border-radius: 20px;
  padding: 20px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: transform 0.08s ease;
}
.choice:active { transform: scale(0.98); }
.choice-day { background: var(--yellow); color: var(--ink); }
.choice-night { background: var(--indigo); }
.choice-doubt { background: var(--pink); }
.choice[aria-pressed="true"] {
  border-color: var(--ink);
  box-shadow: 0 0 0 4px #fff inset, var(--shadow);
  transform: scale(1.03);
}
.choice[aria-pressed="true"]::after { content: " ✓"; }

.small-note {
  margin: 0;
  font-size: 0.8rem;
  color: var(--muted);

  text-align: center;
  line-height: 1.5;
}

/* ---------- Summary + log ---------- */
.summary-card {
  background: var(--card);
  border: 4px solid var(--teal);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.event-list { display: flex; flex-direction: column; gap: 10px; }

.event-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border-radius: 18px;
  padding: 12px 14px;
  box-shadow: 0 3px 10px rgba(60, 40, 140, 0.12);
}
.summary-card .event-row { background: #f6f4ff; box-shadow: none; }
.ev-main { flex: 1; min-width: 0; }
.ev-heb { font-weight: 800; font-size: 1.1rem; }
.ev-meta { font-size: 0.8rem; color: var(--muted); }
.ltr { direction: ltr; unicode-bidi: isolate; display: inline-block; }


.chip {
  font-weight: 800;
  font-size: 0.9rem;
  padding: 6px 12px;
  border-radius: 999px;
  white-space: nowrap;
}
.chip-day { background: var(--yellow); color: var(--ink); }
.chip-night { background: var(--indigo); color: #fff; }
.chip-doubt { background: var(--pink); color: #fff; }

.icon-btn {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: #fff0f1;
  font-size: 1.1rem;
  cursor: pointer;
}

.empty { text-align: center; color: var(--muted); font-size: 1.1rem; margin: 20px 0; }

.toast {
  margin: 0;
  min-height: 1.3em;
  text-align: center;
  color: var(--teal);
  font-weight: 800;
}


.summary-text {
  width: 100%;
  min-height: 170px;
  font: inherit;
  font-size: 0.95rem;
  color: var(--ink);
  border: 2px solid var(--purple);
  border-radius: 14px;
  padding: 10px;
  direction: rtl;
}

/* ---------- Dialog ---------- */
dialog {
  border: none;
  border-radius: var(--radius);
  padding: 0;
  max-width: 420px;
  width: calc(100% - 32px);
  color: var(--ink);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}
dialog::backdrop { background: rgba(43, 35, 80, 0.55); }
.dialog-body { padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.dialog-body h2 { margin: 0; color: var(--purple); }
.dialog-body p { margin: 0; line-height: 1.5; }

button:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid var(--ink);
  outline-offset: 2px;
}


@media (prefers-reduced-motion: reduce) {
  .btn, .choice { transition: none; }
}