:root {
  --bg: #f7f2ea;
  --surface: #fffdf9;
  --line: #e8dbc9;
  --text: #2f261f;
  --muted: #75685e;
  --accent: #8c5b2f;
  --accent2: #c18952;
  --ok: #1f7a4c;
  --warn: #8c2f2f;
  --radius: 24px;
  --shadow: 0 14px 40px rgba(70,45,20,.12);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top right, rgba(193,137,82,.18), transparent 28%),
    linear-gradient(180deg, #fbf7f1 0%, #f6efe6 100%);
  color: var(--text);
  font-family: "Alef", Arial, sans-serif;
}

body {
  padding: 14px 10px 24px;
}

.app {
  max-width: 980px;
  margin: 0 auto;
  display: grid;
  gap: 14px;
}

.card {
  background: rgba(255,255,255,.92);
  border: 1px solid rgba(232,219,201,.95);
  border-radius: 28px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.hero {
  position: relative;
  padding: 22px 16px 18px;
  background: linear-gradient(180deg, rgba(255,255,255,.97), rgba(248,241,231,.96));
}

.hero h1 {
  margin: 0;
  font-size: 1.65rem;
  line-height: 1.25;
}

.hero p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.7;
}

.top-tags {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  padding-inline-end: 88px;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: #f4eadf;
  border: 1px solid #ead8c1;
  color: var(--accent);
  font-weight: 700;
  font-size: .9rem;
}

.lang-switcher {
  position: absolute;
  top: 16px;
  inset-inline-end: 16px;
  z-index: 20;
}

.lang-switcher-btn {
  appearance: none;
  border: 1px solid #ead8c1;
  background: rgba(255,255,255,.95);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 12px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 10px 22px rgba(70,45,20,.08);
}

.lang-switcher-btn:hover {
  background: #fffaf4;
}

.lang-flag {
  font-size: 1.1rem;
  line-height: 1;
}

.lang-switcher-label {
  font-size: .93rem;
  line-height: 1;
}

.lang-switcher-caret {
  font-size: .78rem;
  color: var(--muted);
  line-height: 1;
}

.lang-menu {
  position: absolute;
  top: calc(100% + 8px);
  inset-inline-end: 0;
  min-width: 180px;
  background: #fffdf9;
  border: 1px solid #ead8c1;
  border-radius: 18px;
  box-shadow: 0 18px 36px rgba(70,45,20,.12);
  padding: 8px;
  display: none;
}

.lang-menu.open {
  display: block;
}

.lang-option {
  appearance: none;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: start;
}

.lang-option:hover,
.lang-option.active {
  background: #f7efe4;
}

.lang-option-main {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.lang-option-check {
  color: var(--accent);
  font-size: .9rem;
  visibility: hidden;
}

.lang-option.active .lang-option-check {
  visibility: visible;
}

.section {
  padding: 16px;
}

.grid2,
.grid3 {
  display: grid;
  gap: 12px;
}

.grid2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.box {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
}

.box strong {
  display: block;
  margin-bottom: 8px;
}

.muted {
  color: var(--muted);
  line-height: 1.7;
}

.segmented,
.phrase-grid {
  display: grid;
  gap: 8px;
}

.segmented.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.phrase-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.segmented button,
.phrase-grid button,
.btn {
  appearance: none;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 18px;
  padding: 12px 10px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: .18s ease;
}

.segmented button small,
.phrase-grid button small {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-weight: 500;
  line-height: 1.5;
}

.segmented button.active,
.phrase-grid button.active {
  background: linear-gradient(180deg, #f4e7d7, #fffaf4);
  border-color: #d9b38c;
  box-shadow: inset 0 0 0 1px rgba(193,137,82,.2);
}

.phrase-grid button {
  min-height: 86px;
  text-align: right;
}

.status {
  padding: 14px 16px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.status-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
  background: #faf5ee;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px 14px;
}

.hebrew-date-hero {
  font-size: 1.2rem;
  font-weight: 800;
  color: #5d4123;
  background: #fff7ee;
  border: 1px solid #ead8c1;
  border-radius: 16px;
  padding: 12px 14px;
  margin-top: 12px;
  text-align: center;
}

.alert {
  margin-top: 12px;
  border-radius: 18px;
  padding: 14px;
  font-weight: 700;
  line-height: 1.7;
}

.alert.warn {
  background: #fff1f1;
  color: #6f1f1f;
  border: 1px solid #f1cccc;
}

.alert.ok {
  background: #eef8f1;
  color: var(--ok);
  border: 1px solid #d0ead9;
}

.alert.info {
  background: #f7f3ec;
  color: #6a5139;
  border: 1px solid #e6d9ca;
}

.hidden {
  display: none !important;
}

.splash-actions {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.btn-primary {
  border: 0;
  color: #fff;
  background: linear-gradient(180deg, #a86d3a, #88572d);
  box-shadow: 0 12px 22px rgba(122,79,42,.2);
}

.btn-danger {
  background: #fff7f7;
  color: #a33a3a;
  border: 1px solid #e7b5b5;
}

.btn-danger:hover,
.btn-danger:focus {
  background: #fff0f0;
  border-color: #d99a9a;
}

.practice-card {
  background: linear-gradient(180deg, #fffdf9, #f7efe4);
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: 16px;
  display: grid;
  gap: 16px;
}

.practice-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.practice-head h3 {
  margin: 0;
  font-size: 1.16rem;
}

.practice-sub {
  margin-top: 6px;
  color: var(--muted);
  line-height: 1.6;
}

.pill {
  padding: 8px 12px;
  border-radius: 999px;
  font-size: .88rem;
  font-weight: 700;
  border: 1px solid #efd8be;
  background: #fff4e8;
  color: #8c5b2f;
  white-space: nowrap;
}

.phrase {
  background: rgba(255,255,255,.94);
  border: 1px solid #efdfcc;
  border-radius: 22px;
  padding: 18px 16px;
  text-align: center;
  font-weight: 700;
  font-size: clamp(1.2rem, 4.8vw, 1.72rem);
  line-height: 1.75;
  color: #33271c;
}

.counter-wrap {
  display: grid;
  gap: 14px;
  justify-items: center;
}

.counter {
  width: 170px;
  height: 170px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 12px;
  background: radial-gradient(circle at 30% 20%, #fffaf4, #f0dfcb);
  border: 8px solid #ead2b7;
  box-shadow: inset 0 6px 18px rgba(255,255,255,.85), 0 18px 26px rgba(104,69,35,.08);
}

.counter strong {
  display: block;
  font-size: 2.55rem;
  line-height: 1;
  margin-bottom: 6px;
}

.counter span {
  color: var(--muted);
  line-height: 1.35;
}

.progress {
  width: 100%;
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: #efe3d3;
  border: 1px solid #e4d0b9;
}

.progress > div {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
}

.progress-label {
  text-align: center;
  color: var(--muted);
  margin-top: 4px;
}

.actions {
  display: grid;
  justify-items: center;
  gap: 18px;
  margin-top: 8px;
  padding-top: 18px;
  border-top: 1px dashed rgba(140, 91, 47, 0.18);
}

.actions-main {
  width: 100%;
  max-width: 760px;
  margin-inline: auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(260px, 340px));
  justify-content: center;
  gap: 18px;
}

.actions-main .btn {
  width: 100%;
}

.actions-danger {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-top: 8px;
}

.actions-danger .btn {
  width: 260px;
  max-width: 100%;
}

details {
  border-top: 1px solid var(--line);
  padding: 14px 16px 16px;
  background: var(--surface);
}

summary {
  cursor: pointer;
  font-weight: 800;
}

.footer {
  padding: 0 16px 18px;
  color: var(--muted);
  line-height: 1.7;
  font-size: .92rem;
}

.lishmat {
  text-align: center;
  padding: 6px 16px 22px;
  font-weight: 700;
  color: #5b4632;
}

.contact-grid {
  display: grid;
  gap: 10px;
}

.contact-grid input,
.contact-grid textarea {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 16px;
  padding: 12px;
  font: inherit;
}

.contact-grid textarea {
  min-height: 130px;
  resize: vertical;
}

.toast-wrap {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 99999;
  display: grid;
  gap: 10px;
  width: min(92vw, 420px);
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  border-radius: 18px;
  padding: 14px 16px;
  font-weight: 700;
  line-height: 1.6;
  box-shadow: 0 16px 34px rgba(0,0,0,.16);
  border: 1px solid transparent;
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity .22s ease, transform .22s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.ok {
  background: #eef8f1;
  color: #1f7a4c;
  border-color: #d0ead9;
}

.toast.warn {
  background: #fff1f1;
  color: #6f1f1f;
  border-color: #f1cccc;
}

.toast.info {
  background: #f7f3ec;
  color: #6a5139;
  border-color: #e6d9ca;
}

.expanded-content {
  display: grid;
  gap: 18px;
  line-height: 1.9;
  color: var(--text);
}

.expanded-section {
  background: linear-gradient(180deg, #fffaf4 0%, #fffdf9 100%);
  border: 1px solid #ead8c1;
  border-radius: 20px;
  padding: 16px 18px;
  box-shadow: 0 8px 20px rgba(90,60,30,.05);
}

.expanded-section-title {
  margin: 0 0 12px;
  font-size: 1.06rem;
  font-weight: 800;
  color: #6b4826;
  line-height: 1.5;
  padding-bottom: 8px;
  border-bottom: 1px solid #efdfcc;
}

.expanded-section p {
  margin: 0 0 12px;
  color: #35281d;
}

.expanded-section p:last-child {
  margin-bottom: 0;
}

.expanded-list {
  margin: 0;
  padding-inline-start: 22px;
}

.expanded-list li {
  margin-bottom: 10px;
  line-height: 1.85;
  color: #35281d;
}

.expanded-list li:last-child {
  margin-bottom: 0;
}

.expanded-section:last-child {
  background: linear-gradient(180deg, #fdf7ef 0%, #fffaf4 100%);
  border-color: #e2c9ab;
}

.expanded-section:last-child .expanded-section-title {
  color: #8c5b2f;
}

.confirm-modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(28, 22, 16, 0.45);
  z-index: 9999;
}

.confirm-modal.open {
  display: flex;
}

.confirm-modal-card {
  width: min(100%, 420px);
  background: #fffdf9;
  border: 1px solid rgba(140, 91, 47, 0.15);
  border-radius: 20px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.18);
  overflow: hidden;
}

.confirm-modal-head {
  padding: 18px 20px 10px;
  font-size: 1.05rem;
  font-weight: 700;
  color: #5a3a1b;
}

.confirm-modal-body {
  padding: 0 20px 18px;
  color: #5f5a52;
  line-height: 1.6;
}

.confirm-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 14px 20px 20px;
  background: #fffaf3;
  border-top: 1px solid rgba(140, 91, 47, 0.08);
}

.confirm-modal-actions .btn {
  min-width: 110px;
}

@media (max-width: 760px) {
  .grid2,
  .grid3,
  .segmented.two,
  .phrase-grid {
    grid-template-columns: 1fr;
  }

  .counter {
    width: 154px;
    height: 154px;
  }

  .counter strong {
    font-size: 2.25rem;
  }

  .top-tags {
    padding-inline-end: 0;
    padding-top: 52px;
  }

  .lang-switcher {
    top: 12px;
    inset-inline-end: 12px;
  }

  .lang-switcher-btn {
    padding: 7px 10px;
    gap: 6px;
  }

  .lang-switcher-label {
    font-size: .88rem;
  }

  .expanded-section {
    padding: 14px 14px;
    border-radius: 18px;
  }

  .expanded-section-title {
    font-size: 1rem;
  }

  .actions {
    gap: 14px;
  }

  .actions-main {
    max-width: none;
    width: 100%;
    grid-template-columns: 1fr;
  }

  .actions-main .btn {
    width: 100%;
  }

  .actions-danger {
    width: 100%;
    justify-content: center;
  }

  .actions-danger .btn {
    width: 100%;
    max-width: none;
  }

  .confirm-modal-actions {
    flex-direction: column-reverse;
  }

  .confirm-modal-actions .btn {
    width: 100%;
  }
}