/* רקע כהה, טקסט לבן, צהוב להאזנה, ירוק להצלחה. בלי תמונות ובלי קישוטים. */
:root {
  --bg: #09090d;
  --surface: rgba(255, 255, 255, 0.06);
  --surface-pressed: rgba(255, 255, 255, 0.12);
  --border: rgba(255, 255, 255, 0.10);
  --text: #ffffff;
  --text-2: rgba(255, 255, 255, 0.64);
  --text-3: rgba(255, 255, 255, 0.44);
  --listening: #ffcc38;
  --success: #4dd675;
  --warning: #ffa861;
  --recognized: #ffcf40;
  --radius: 18px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, system-ui, "Segoe UI", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

[hidden] { display: none !important; }

button { font: inherit; color: inherit; cursor: pointer; }

h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 2rem; font-weight: 700; }
h2 { font-size: 1.15rem; font-weight: 600; margin-bottom: 8px; }
h3 { font-size: 1rem; font-weight: 600; margin: 18px 0 6px; }
p { margin: 0 0 10px; }

.page {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  padding: calc(var(--safe-top) + 20px) 20px calc(var(--safe-bottom) + 32px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.page-header { padding-top: 8px; }
.page-header.with-back { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.subtitle { color: var(--text-2); font-size: 1.15rem; margin: 2px 0 0; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  margin: 0;
}

.muted { color: var(--text-2); }
.note { color: var(--text-2); font-size: 0.95rem; }
.fine { color: var(--text-3); font-size: 0.85rem; margin: 0; }
.warning { color: var(--warning); }
.today.done { color: var(--success); }

.big-time {
  font-size: 3.6rem;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  margin: 0;
  text-align: right;
}

.primary, .quiet {
  display: block;
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  border-radius: 16px;
  font-weight: 600;
  text-align: center;
}
.primary { background: var(--text); color: #000; border: 0; }
.primary:active { background: #dcdcdc; }
.quiet { background: var(--surface); border: 1px solid var(--border); }
.quiet:active { background: var(--surface-pressed); }
.links { display: flex; flex-direction: column; gap: 10px; }

.back {
  background: none;
  border: 0;
  color: var(--text-2);
  padding: 8px 0;
  min-height: 44px;
}
.back::before { content: "→"; margin-inline-end: 6px; }

.link {
  background: none;
  border: 0;
  color: var(--text);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 4px;
  padding: 8px;
  min-height: 44px;
}

.steps { margin: 0; padding-inline-start: 22px; }
.steps li { margin-bottom: 10px; }
.plain-list { margin: 0 0 12px; padding-inline-start: 20px; color: var(--text-2); }
.plain-list li { margin-bottom: 8px; }
details { margin-top: 10px; color: var(--text-2); }
summary { color: var(--text); cursor: pointer; padding: 6px 0; }

/* הגדרות */
.field-label { display: block; font-weight: 600; margin-bottom: 8px; }
.time-input {
  width: 100%;
  font: inherit;
  font-size: 2rem;
  padding: 10px 14px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  margin-bottom: 18px;
}
.days-field { border: 0; padding: 0; margin: 0 0 8px; }
.days { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.day {
  aspect-ratio: 1;
  min-height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  font-weight: 600;
}
.day[aria-pressed="true"] { background: var(--text); color: #000; border-color: var(--text); }

/* בדיקת תמיכה */
.check-list { display: grid; grid-template-columns: 1fr auto; gap: 10px 12px; }
.check-list dt { color: var(--text); }
.check-list dd { margin: 0; color: var(--text-2); text-align: left; }
.check-list dd.yes { color: var(--success); }
.check-list dd.no { color: var(--warning); }

/* מסך התפילה */
.prayer {
  position: fixed;
  inset: 0;
  display: grid;
  grid-template-rows: auto 1fr auto auto auto;
  padding: calc(var(--safe-top) + 6px) 22px calc(var(--safe-bottom) + 12px);
  background: var(--bg);
  overflow-y: auto;
}

.prayer-header { display: flex; align-items: center; justify-content: space-between; }
.prayer-title { color: var(--text-3); font-size: 0.95rem; font-weight: 500; }
.icon-button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  background: none;
  border: 0;
  padding: 0;
}
.icon-button svg { width: 22px; height: 22px; stroke: var(--text-2); stroke-width: 2; stroke-linecap: round; fill: none; }

.prayer-body { display: grid; place-items: center; padding: 12px 0; }

.prayer-text {
  margin: 0;
  text-align: center;
  font-size: clamp(26px, 7.6vw, 36px);
  line-height: 1.75;
  font-weight: 400;
}
.prayer-text .word { transition: color 0.25s ease; }
/* בזמן האזנה המילים שעוד לא זוהו מעט עמומות, ומילים שזוהו צהובות. */
.prayer-text.highlighting .word { color: rgba(255, 255, 255, 0.78); }
.prayer-text.highlighting .word.recognized { color: var(--recognized); }

.success { text-align: center; }
.success-mark { width: 104px; height: 104px; margin-bottom: 14px; }
.success-mark circle { fill: var(--success); }
.success-mark path { fill: none; stroke: #000; stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; }
.success h2 { font-size: 2.1rem; font-weight: 700; margin-bottom: 8px; }
.success p { color: var(--text-2); }

.status {
  min-height: 112px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  color: var(--text-2);
  font-size: 0.98rem;
}
.status .headline { font-weight: 600; font-size: 1.1rem; margin: 0; }
.status .headline.listening { color: var(--listening); }
.status .headline.warn { color: var(--warning); }
.status p { margin: 0; }
.status .row { display: flex; gap: 10px; width: 100%; }
.status .row > * { flex: 1; }

.controls { display: grid; place-items: center; padding: 14px 0 10px; }
.done { max-width: 240px; }

.mic {
  position: relative;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 1.5px solid rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.10);
  display: grid;
  place-items: center;
  padding: 0;
  touch-action: manipulation;
}
.mic svg { width: 38px; height: 38px; fill: none; stroke: var(--text); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.mic .icon-wave, .mic .spinner { display: none; }
.mic:active { background: rgba(255, 255, 255, 0.16); }

.mic[data-state="listening"] { background: var(--listening); border-color: var(--listening); }
.mic[data-state="listening"] .icon-mic { display: none; }
.mic[data-state="listening"] .icon-wave { display: block; stroke: #000; }
.mic[data-state="listening"]::after {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  border: 2px solid var(--listening);
  animation: pulse 1.5s ease-out infinite;
}
.mic[data-state="busy"] .icon-mic { display: none; }
.mic[data-state="busy"] .spinner {
  display: block;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.25);
  border-top-color: var(--text);
  animation: spin 0.9s linear infinite;
}
.mic[data-state="disabled"] { opacity: 0.35; }

@keyframes pulse {
  from { transform: scale(1); opacity: 0.9; }
  to { transform: scale(1.45); opacity: 0; }
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .mic[data-state="listening"]::after { animation: none; opacity: 0.6; }
  .mic[data-state="busy"] .spinner { animation-duration: 3s; }
  .prayer-text .word { transition: none; }
}

.prayer-footer { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }

/* חלון הקלדה */
.sheet {
  width: min(560px, 100%);
  max-height: 92dvh;
  margin: auto auto 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 22px 22px 0 0;
  background: #121218;
  color: var(--text);
}
.sheet::backdrop { background: rgba(0, 0, 0, 0.6); }
.sheet-body { padding: 22px 20px calc(var(--safe-bottom) + 20px); display: flex; flex-direction: column; gap: 10px; }
.reference { font-size: 1.2rem; background: var(--surface); border-radius: 14px; padding: 12px 14px; margin: 0; }
textarea {
  width: 100%;
  font: inherit;
  font-size: 1.15rem;
  color: var(--text);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  resize: vertical;
}
.sheet-actions { display: flex; flex-direction: column; gap: 10px; }

:focus-visible { outline: 2px solid var(--listening); outline-offset: 3px; }
