* { box-sizing: border-box; }
html { background: var(--bg); scroll-behavior: smooth; }
body { margin: 0; min-width: 320px; background: var(--bg); color: var(--ink); font-size: var(--text-body); font-weight: var(--weight-regular); line-height: var(--line-height); }
button, input { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.app-shell { min-height: 100dvh; background: var(--bg); }
.content { width: min(100%, 520px); margin: 0 auto; padding: calc(100px + env(safe-area-inset-top)) 18px 0; }
.floating-top { position: fixed; z-index: 30; left: 50%; top: calc(8px + env(safe-area-inset-top)); transform: translateX(-50%); width: min(100%, 520px); display: flex; align-items: center; justify-content: space-between; padding: 0 18px; pointer-events: none; }
.floating-top button { pointer-events: auto; }
.module-pill, .account-button { border: 1px solid var(--floating-border); background: var(--floating-surface); box-shadow: var(--shadow-floating); }
.module-pill { height: 46px; border-radius: 999px; padding: 0 10px 0 8px; display: flex; align-items: center; gap: 5px; color: var(--ink); font-size: var(--text-display); font-weight: var(--weight-bold); }
.module-pill img { width: 22px; height: 22px; object-fit: contain; }
.module-pill img.switcher { width: 14px; height: 20px; margin-left: 1px; }
.account-button { width: 46px; height: 46px; padding: 11px; border-radius: 50%; }
.account-button img { width: 100%; height: 100%; object-fit: contain; }

.top-fade, .bottom-fade { position: fixed; z-index: 20; left: 0; right: 0; pointer-events: none; }
.top-fade { top: 0; height: calc(100px + env(safe-area-inset-top)); background: linear-gradient(to bottom, var(--bg) 35%, var(--bg-fade-strong) 57%, var(--bg-fade-clear)); backdrop-filter: blur(1.5px); -webkit-backdrop-filter: blur(1.5px); mask-image: linear-gradient(to bottom,var(--mask-solid) 35%,transparent); }
.bottom-fade { bottom: 0; height: calc(112px + env(safe-area-inset-bottom)); background: linear-gradient(to bottom, var(--bg-fade-clear), var(--bg-fade-strong) 44%, var(--bg) 75%); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); mask-image: linear-gradient(to bottom,transparent,var(--mask-solid) 67%); }

.location-row { display: flex; justify-content: flex-start; align-items: center; color: var(--secondary); font-size: var(--text-body); margin: 0 3px 12px; }
.location-row span { display: inline-flex; align-items: center; gap: 5px; }
.location-row img { width: 14px; height: 14px; object-fit: contain; }

.hero-card { color: var(--white); min-height: 184px; border-radius: 26px; padding: 18px; text-align: center; background: var(--brand-gradient); box-shadow: var(--shadow-hero); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.hero-hebrew-date { margin-bottom: 5px; border: 0; border-radius: 9px; padding: 3px 8px; color: var(--white); background: none; font-size: var(--text-main-date); font-weight: var(--weight-medium); }
.hero-hebrew-date, .date-display strong { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
.hero-hebrew-date.today { color: var(--today); }
.hero-card.today, .hero-card.today .hero-hebrew-date, .hero-card.today .hero-study, .hero-card.today .hero-study strong { color: var(--today); }
.hero-card.today .hero-study span { opacity: 1; }
.hero-card.today .hero-study { border-bottom-color: var(--today-divider); }
.hero-hebrew-date:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.hero-card h1 { font-size: var(--text-display); font-weight: var(--weight-bold); line-height: var(--line-height); margin: 2px 0 9px; }
.hero-card h1 span { display: block; }
.hero-card h1 span + span { margin-top: 2px; }
.hero-learning { width: 100%; padding: 4px 10px; border-radius: 14px; background: var(--glass-surface); }
.hero-study { width: 100%; min-height: 29px; border: 0; border-bottom: 1px solid var(--glass-separator); padding: 4px 2px; color: var(--white); background: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; text-align: left; font-size: var(--text-body); font-weight: var(--weight-regular); }
.hero-study:last-child { border-bottom: 0; }
.hero-study span { opacity: .8; }
.hero-study strong { min-width: 0; color: var(--white); font-size: inherit; font-weight: var(--weight-medium); text-align: right; }

.card { background: var(--white); border-radius: 18px; box-shadow: var(--shadow); }
.content > .card, .content > .two-column { margin-top: 20px; }
.week-card { padding: 14px; }
.card-title-row { min-height: 26px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-title-row h2 { margin: 0; color: var(--blue); font-size: var(--text-display); font-weight: var(--weight-medium); }
.week-card h3, .mini-card h3 { margin: 2px 0 0; font-size: var(--text-body); line-height: var(--line-height); font-weight: var(--weight-bold); }
.muted { color: var(--secondary); }
.small { font-size: var(--text-small); }
.week-card p { margin: 2px 0 0; }
.badge { flex: 0 0 auto; min-width: 42px; min-height: 20px; padding: 2px 6px; border-radius: 999px; background: var(--countdown-bg); color: var(--countdown-text); text-align: center; font-size: var(--text-small); font-weight: var(--weight-medium); line-height: var(--line-height); font-variant-numeric: tabular-nums; }
.badge.is-empty { visibility: hidden; }
.badge-blue { color: var(--countdown-text); background: var(--countdown-bg); }
.time-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.time-tile { height: 46px; padding: 7px 10px; border-radius: 12px; background: var(--soft-blue); display: flex; flex-direction: column; align-items: flex-start; justify-content: center; }
.time-tile span { font-size: var(--text-small); font-weight: var(--weight-medium); }
.time-tile strong { color: var(--blue); font-size: var(--text-body); font-weight: var(--weight-medium); font-variant-numeric: tabular-nums; margin-top: 2px; }
.week-events { margin-top: 7px; display: grid; gap: 8px; }
.week-event { padding: 10px; border-radius: 13px; background: var(--soft-blue); }
.week-event.active { background: var(--active); box-shadow: var(--shadow-active-soft); }
.week-event h3 { margin: 0; color: var(--ink); }
.week-title-line { display: block; }
.week-title-line + .week-title-line { margin-top: 2px; }
.week-special { color: var(--blue); }
.week-meta { margin-top: 3px; display: flex; align-items: center; gap: 7px; }
.week-hebrew-date { margin: 0; color: var(--secondary); font-size: var(--text-body); }
.week-countdown { min-width: 0; min-height: 0; padding: 1px 6px; color: var(--countdown-text); background: var(--countdown-bg); }
.week-time-grid { margin-top: 8px; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 7px; }
.week-time-tile { min-width: 0; min-height: 48px; padding: 7px 9px; border-radius: 11px; background: var(--active-inset); display: flex; flex-direction: column; justify-content: center; }
.week-time-tile span { font-size: var(--text-body); }
.week-time-tile strong { margin-top: 2px; color: var(--blue); font-size: var(--text-body); font-weight: var(--weight-medium); font-variant-numeric: tabular-nums; white-space: nowrap; }
.week-event.active .week-time-tile strong { color: var(--green); }
.week-time-tile:last-child:nth-child(odd) { grid-column: 1 / -1; align-items: center; text-align: center; }

.list-card { padding: 12px 16px; }
.text-action { border: 0; padding: 5px 0 5px 10px; color: var(--blue); background: none; font-size: var(--text-small); font-weight: var(--weight-medium); }
#holidays-list { display: grid; gap: 8px; margin-top: 12px; }
.appointment-tabs { min-width: 0; margin-top: 10px; overflow: hidden; display: flex; align-items: stretch; justify-content: flex-start; gap: 7px; }
.appointment-tabs.is-spread { justify-content: space-between; }
.appointment-tab { flex: 0 0 auto; min-height: 34px; border: 0; border-radius: 999px; padding: 6px 9px; color: var(--blue); background: var(--soft-blue); font-size: var(--text-body); font-weight: var(--weight-medium); line-height: var(--line-height); white-space: nowrap; display: flex; align-items: center; justify-content: center; gap: 3px; }
.appointment-tab-label { min-width: 0; }
.appointment-tab-countdown { flex: 0 0 auto; }
.appointment-tab[aria-selected="true"] { color: var(--white); background: var(--brand-gradient); box-shadow: var(--shadow-brand-soft); }
.appointment-tab.is-current { color: var(--active); background: var(--green); box-shadow: var(--shadow-active); }
.appointment-tab[hidden] { display: none; }
.appointment-see-all { flex: 0 0 auto; padding: 3px 0 1px 8px; white-space: nowrap; text-decoration: underline; text-underline-offset: 3px; }
.appointment-more { flex: 0 0 auto; align-self: center; white-space: nowrap; }
.appointment-more-text { border: 0; padding: 5px 0; color: var(--blue); background: none; font-size: var(--text-small); font-weight: var(--weight-medium); text-decoration: underline; text-underline-offset: 3px; }
.appointment-more-plus { width: 34px; height: 34px; border: 0; border-radius: 999px; padding: 0; color: var(--blue); background: var(--soft-blue); font-size: var(--text-display); font-weight: var(--weight-medium); }
.appointment-more.is-measuring { position: absolute; visibility: hidden; pointer-events: none; }
.holiday-detail { min-width: 0; }
.holiday-compact-shell { display: grid; grid-template-rows: 1fr; opacity: 1; transition: grid-template-rows .3s ease, opacity .2s ease; }
.holiday-compact-inner { min-height: 0; overflow: hidden; }
.holiday-expanded-shell { display: grid; grid-template-rows: 0fr; opacity: 0; transition: grid-template-rows .34s ease, opacity .22s ease; }
.holiday-expanded-inner { min-height: 0; overflow: hidden; }
.holiday-detail.is-expanded .holiday-compact-shell { grid-template-rows: 0fr; opacity: 0; }
.holiday-detail.is-expanded .holiday-expanded-shell { grid-template-rows: 1fr; opacity: 1; }
.holiday-item { min-height: 56px; padding: 7px 8px; border-radius: 12px; background: var(--soft-blue); }
.holiday-item.active { background: var(--active); }
.holiday-compact-range { min-height: 42px; padding: 7px 6px; display: grid; place-items: center; color: var(--secondary); font-size: var(--text-body); font-weight: var(--weight-medium); line-height: var(--line-height); text-align: center; font-variant-numeric: tabular-nums; }
.holiday-item.active .holiday-compact-range { color: var(--green); }
.holiday-date-rows { display: grid; gap: 2px; }
.holiday-date-row { min-width: 0; min-height: 30px; padding: 5px 9px; border-radius: 8px; display: grid; grid-template-columns: minmax(0,46%) 1fr; align-items: start; gap: 12px; }
.holiday-date-row:nth-child(odd) { background: var(--stripe); }
.holiday-date-rows.single .holiday-date-row { background: transparent; }
.holiday-date-row > strong { min-width: 0; font-size: var(--text-body); font-weight: var(--weight-medium); line-height: var(--line-height); }
.holiday-dates { min-width: 0; justify-self: end; display: flex; flex-direction: column; align-items: flex-end; color: var(--secondary); font-size: var(--text-body); line-height: var(--line-height); font-variant-numeric: tabular-nums; }
.holiday-date-line { margin: 0; padding: 1px 4px; border-radius: 7px; display: inline-flex; align-items: baseline; column-gap: 4px; white-space: nowrap; }
.holiday-date-line > span:first-child { text-align: left; }
.holiday-date-line > span:nth-child(2) { text-align: right; }
.holiday-date-line small { font-size: inherit; text-align: right; }
.holiday-date-line.is-yom-tov { color: var(--blue); }
.holiday-date-line.is-current { background: var(--active); color: var(--green); }
.holiday-item.active .holiday-date-line { color: var(--green); }
.holiday-item.active .holiday-date-line.is-current { background: var(--green); color: var(--active); }
.holiday-info-line { margin: 6px 10px 0; display: flex; align-items: center; gap: 7px; color: var(--secondary); font-size: var(--text-body); }
.holiday-info-copy { min-width: 0; display: flex; flex: 1 1 auto; flex-wrap: wrap; align-items: baseline; gap: 3px 5px; }
.holiday-info-copy span:last-child { min-width: 0; }
.holiday-duration { color: var(--ink); }
.holiday-detail-toggle { margin: 7px 10px 0; border: 0; padding: 2px 0; color: var(--blue); background: none; font-size: var(--text-body); font-weight: var(--weight-medium); text-decoration: underline; text-underline-offset: 3px; }

.two-column { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: stretch; }
.mini-card { min-width: 0; min-height: 150px; padding: 14px; display: flex; flex-direction: column; align-items: stretch; }
.mini-card > strong { display: block; font-size: var(--text-body); font-weight: var(--weight-medium); margin-top: 8px; }
.mini-card > strong + strong { margin-top: 4px; }
.mini-bottom { display: flex; gap: 5px; align-items: flex-end; justify-content: space-between; margin-top: auto; padding-top: 6px; }
.rosh-heading-row h2 { white-space: nowrap; letter-spacing: -.2px; }
.rosh-meta { min-height: 22px; margin-top: 9px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
#rosh-duration, #birkat-duration { color: var(--ink); }
#rosh-card .date-lines { margin-top: 8px; }
.date-lines { min-width: 0; min-height: 69px; padding: 7px 5px; border-radius: 10px; background: var(--soft-blue); color: var(--secondary); font-size: var(--text-body); font-weight: var(--weight-medium); line-height: var(--line-height); font-variant-numeric: tabular-nums; }
.date-lines span { display: block; white-space: nowrap; }
.birkat-dates { margin-top: 8px; }
.birkat-note { margin-top: 0; }
#rosh-card.active, #birkat-card.active { background: var(--active); }
#rosh-card.active .date-lines, #birkat-card.active .date-lines { background: var(--active-inset); }

.zmanim-card { overflow: hidden; padding: 8px 0 10px; background: var(--soft-warm); }
.zmanim-head { height: 36px; padding: 0 16px; }
#zmanim-list { display: grid; gap: 2px; padding: 0 8px; }
.zman-row { min-height: 32px; margin: 0; padding: 0 10px; border-radius: 8px; display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--ink); font-size: var(--text-body); }
.zman-row:nth-child(odd) { background: var(--stripe); }
.zman-row strong { flex: 0 0 auto; min-width: 44px; color: var(--blue); text-align: right; font-weight: var(--weight-medium); font-variant-numeric: tabular-nums; }
.zman-row.current { min-height: 34px; background: var(--active); color: var(--green); box-shadow: var(--shadow-zman-active); }
.zman-row.current strong { color: var(--green); }
.brand-lockup { display: flex; justify-content: center; align-items: center; margin: 18px auto 0; }
.brand-lockup img { display: block; width: 100%; max-width: 100%; height: auto; object-fit: contain; }
.bottom-spacer { height: calc(98px + env(safe-area-inset-bottom)); }

.date-bar { position: fixed; z-index: 40; left: 50%; bottom: calc(8px + env(safe-area-inset-bottom)); transform: translateX(-50%); width: min(calc(100% - 24px),496px); height: 56px; padding: 0 6px; border: 1px solid var(--brand-border); border-radius: 999px; background: var(--brand-gradient); box-shadow: var(--shadow-datebar); display: grid; grid-template-columns: 42px 42px 1fr 42px 42px; align-items: center; gap: 0; }
.date-bar > button { border: 0; background: none; padding: 0; }
.date-bar > button:not(.date-display) { width: 38px; height: 38px; border-radius: 50%; background: var(--brand-control); display: grid; place-items: center; }
.date-bar img { width: 24px; height: 22px; object-fit: contain; }
.date-display { min-width: 0; height: 48px; display: flex; flex-direction: column; justify-content: center; align-items: center; }
.date-display strong { max-width: 100%; color: var(--white); font-size: var(--text-main-date); font-weight: var(--weight-medium); font-variant-numeric: tabular-nums; text-shadow: var(--shadow-date-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.date-display strong.today { color: var(--today); }
.date-bar.changed .date-display { animation: date-confirm .38s ease-out; }
.hero-hebrew-date.changed { animation: date-confirm .38s ease-out; }
@keyframes date-confirm { 0% { transform: scale(.92); opacity: .45; } 65% { transform: scale(1.035); opacity: 1; } 100% { transform: scale(1); } }

dialog { width: min(calc(100% - 20px),500px); padding: 0; border: 0; border-radius: 26px; background: var(--white); box-shadow: var(--shadow-dialog); }
dialog::backdrop { background: var(--dialog-backdrop); backdrop-filter: blur(5px); -webkit-backdrop-filter: blur(5px); }
.date-sheet { padding: 10px 16px calc(16px + env(safe-area-inset-bottom)); }
.sheet-handle { width: 38px; height: 5px; margin: 0 auto 12px; border-radius: 999px; background: var(--sheet-handle); }
.sheet-title { min-height: 36px; display: grid; grid-template-columns: 42px 1fr 42px; align-items: center; gap: 6px; }
.sheet-title h2 { margin: 0; font-size: var(--text-display); font-weight: var(--weight-bold); line-height: var(--line-height); text-align: center; }
.sheet-title button { height: 34px; border: 0; color: var(--blue); background: var(--badge); font-size: var(--text-body); font-weight: var(--weight-medium); }
.sheet-close { width: 34px; border-radius: 50%; color: var(--secondary) !important; font-size: var(--text-display); line-height: 1; }
.calendar-toggle { width: min(280px,100%); margin: 14px auto 10px; padding: 3px; border-radius: 12px; background: var(--toggle-surface); display: grid; grid-template-columns: 1fr 1fr; }
.calendar-toggle button { min-height: 34px; border: 0; border-radius: 9px; color: var(--secondary); background: transparent; font-size: var(--text-body); font-weight: var(--weight-medium); }
.calendar-toggle button[aria-selected="true"] { color: var(--blue); background: var(--white); box-shadow: var(--shadow-control); }
.wheel-picker { position: relative; height: 220px; margin: 4px 0 14px; overflow: hidden; border: 1px solid var(--separator); border-radius: 18px; background: var(--picker-surface); display: grid; grid-template-columns: .8fr 1.45fr 1fr; }
.wheel-picker::before, .wheel-picker::after { content: ""; position: absolute; z-index: 4; left: 0; right: 0; height: 78px; pointer-events: none; }
.wheel-picker::before { top: 0; background: linear-gradient(to bottom,var(--picker-surface) 18%,var(--picker-fade-clear)); }
.wheel-picker::after { bottom: 0; background: linear-gradient(to top,var(--picker-surface) 18%,var(--picker-fade-clear)); }
.wheel-selection { position: absolute; z-index: 1; left: 10px; right: 10px; top: 88px; height: 44px; border-radius: 12px; background: var(--picker-selection); pointer-events: none; }
.wheel { position: relative; z-index: 2; height: 220px; overflow-x: hidden; overflow-y: auto; padding: 88px 0; scrollbar-width: none; scroll-snap-type: y mandatory; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.wheel::-webkit-scrollbar { display: none; }
.wheel-item { width: 100%; height: 44px; display: block; scroll-snap-align: center; border: 0; padding: 0 5px; color: var(--picker-muted); background: transparent; font-size: var(--text-body); line-height: 44px; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; opacity: .52; }
.wheel-item.selected { color: var(--ink); font-size: var(--text-display); font-weight: var(--weight-medium); opacity: 1; }
.sheet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.sheet-actions button { min-height: 44px; border: 0; border-radius: 12px; background: var(--soft-blue); color: var(--blue); font-size: var(--text-body); font-weight: var(--weight-medium); }
.sheet-actions button:last-child { background: var(--blue); color: var(--white); }
.sheet-actions button:disabled { opacity: .42; }
.toast { position: fixed; z-index: 80; left: 50%; bottom: calc(82px + env(safe-area-inset-bottom)); transform: translate(-50%,16px); padding: 10px 16px; border-radius: 999px; background: var(--toast-surface); color: var(--white); font-size: var(--text-body); font-weight: var(--weight-medium); opacity: 0; pointer-events: none; transition: .22s ease; }
.toast.show { opacity: 1; transform: translate(-50%,0); }

@media (min-width: 700px) {
  body { background: linear-gradient(135deg,var(--desktop-bg-start),var(--desktop-bg-end)); }
  .app-shell { width: 520px; margin: 0 auto; box-shadow: var(--shadow-shell); }
}

@media (max-width: 430px) {
  .card-title-row h2 { font-size: var(--text-title-phone); }
  .rosh-heading-row h2 { letter-spacing: -.25px; }
  .holiday-date-row { grid-template-columns: minmax(0,42%) 1fr; gap: 8px; padding-left: 6px; padding-right: 6px; }
}

@media (max-width: 365px) {
  .content { padding-left: 12px; padding-right: 12px; }
  .floating-top { padding-left: 12px; padding-right: 12px; }
  .card-title-row h2 { font-size: var(--text-title-compact); }
  .two-column { gap: 8px; }
  .mini-card { padding: 11px; }
  .holiday-item { padding-left: 9px; padding-right: 8px; }
  .holiday-date-row { grid-template-columns: minmax(0,44%) 1fr; gap: 7px; padding-left: 6px; padding-right: 6px; }
  .holiday-date-line { column-gap: 4px; }
  .date-bar { width: calc(100% - 12px); grid-template-columns: 38px 38px 1fr 38px 38px; }
  .sheet-title { grid-template-columns: 42px 1fr 42px; }
}

@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; } }
