:root {
  color-scheme: light;
  --ink: #18312d;
  --muted: #60716e;
  --green-950: #102f2a;
  --green-800: #1b5046;
  --green-700: #24695a;
  --green-100: #e5f1ed;
  --green-50: #f1f7f5;
  --sand: #f5f0e6;
  --gold: #bd852f;
  --white: #fffefb;
  --border: #d9e2df;
  --shadow: 0 18px 50px rgba(20, 57, 50, 0.1);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; background: var(--green-50); }
body { margin: 0; color: var(--ink); background: linear-gradient(180deg, #f9fbfa 0, var(--green-50) 38rem); min-height: 100vh; }
button, select, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, select:focus-visible, input:focus-visible, a:focus-visible, summary:focus-visible { outline: 3px solid rgba(189, 133, 47, 0.45); outline-offset: 3px; }

.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; justify-content: space-between; align-items: center;
  min-height: 72px; padding: 10px max(18px, env(safe-area-inset-left));
  background: rgba(255, 254, 251, 0.92); backdrop-filter: blur(14px); border-bottom: 1px solid rgba(217, 226, 223, 0.75);
}
.brand { display: flex; align-items: center; gap: 11px; color: inherit; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 15px; background: var(--green-950); color: white; font-family: Georgia, serif; font-size: 15px; box-shadow: 0 8px 20px rgba(16, 47, 42, 0.2); }
.brand strong, .brand small { display: block; }
.brand strong { font-family: Georgia, "Times New Roman", serif; font-size: 18px; letter-spacing: -0.01em; }
.brand small { margin-top: 2px; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }

main { width: min(760px, calc(100% - 28px)); margin: 0 auto; padding: 52px 0 calc(60px + env(safe-area-inset-bottom)); }
.intro { margin-bottom: 28px; }
.eyebrow { margin: 0 0 8px; color: var(--green-700); font-size: 12px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
h1, h2 { font-family: Georgia, "Times New Roman", serif; font-weight: 600; letter-spacing: -0.025em; }
h1 { max-width: 680px; margin: 0; font-size: clamp(38px, 8vw, 62px); line-height: 1.02; }
h2 { margin: 0; font-size: clamp(24px, 5vw, 32px); }
.intro > p:not(.eyebrow) { max-width: 610px; margin: 19px 0 24px; color: var(--muted); font-size: 17px; line-height: 1.65; }
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 16px 18px; border: 1px solid #dfd3b8; border-radius: 17px; background: #fbf7ee; color: #63563e; }
.notice > span { color: var(--gold); font-size: 18px; line-height: 1.4; }
.notice p { margin: 0; line-height: 1.5; }

.control-card, .verse-stage, .about-card, .credits { margin-top: 18px; border: 1px solid var(--border); border-radius: 24px; background: var(--white); box-shadow: var(--shadow); }
.control-card { padding: 22px; }
.section-heading, .verse-stage-header { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.step-label { display: grid; place-items: center; width: 25px; height: 25px; margin: 0 0 6px; border-radius: 999px; background: var(--green-100); color: var(--green-800); font-size: 12px; font-weight: 800; }
.online-pill { display: flex; align-items: center; gap: 7px; padding: 7px 10px; border-radius: 999px; background: var(--green-50); color: var(--green-700); font-size: 12px; font-weight: 700; }
.online-pill i { width: 7px; height: 7px; border-radius: 50%; background: #3da579; box-shadow: 0 0 0 3px rgba(61, 165, 121, 0.13); }

.passage-options, .pattern-options { display: grid; grid-template-columns: repeat(2, 1fr); gap: 11px; margin-top: 18px; }
.passage-option, .pattern-option { min-width: 0; border: 1px solid var(--border); border-radius: 17px; background: white; color: var(--ink); cursor: pointer; text-align: left; transition: 160ms ease; }
.passage-option { position: relative; padding: 17px; }
.passage-option:hover, .pattern-option:hover { border-color: #9db7b0; transform: translateY(-1px); }
.passage-option[data-selected="true"], .pattern-option[data-selected="true"] { border-color: var(--green-700); background: var(--green-50); box-shadow: 0 0 0 2px rgba(36, 105, 90, 0.12); }
.passage-option[data-selected="true"]::after { content: "✓"; position: absolute; top: 12px; right: 13px; display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--green-700); color: white; font-size: 12px; font-weight: 900; }
.passage-option strong, .passage-option small { display: block; }
.passage-option strong { margin-top: 15px; font-family: Georgia, serif; font-size: 21px; }
.passage-option small { margin-top: 4px; color: var(--muted); }
.passage-language { color: var(--green-700); font-size: 11px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.pattern-option { min-height: 62px; padding: 13px 15px; text-align: center; }
.pattern-option:last-child { grid-column: 1 / -1; }
.pattern-flow { display: flex; justify-content: center; align-items: center; gap: 8px; flex-wrap: wrap; }
.pattern-flow b { font-size: 14px; }
.pattern-flow i { color: var(--gold); font-style: normal; }

.verse-stage { margin-top: 30px; padding: clamp(18px, 4vw, 30px); background: #fffefb; }
.speed-control { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; font-weight: 700; }
.speed-control select { padding: 8px 28px 8px 9px; border: 1px solid var(--border); border-radius: 10px; background: white; color: var(--ink); }
.text-card { position: relative; overflow: hidden; margin-top: 15px; padding: 19px 20px; border: 1px solid var(--border); border-radius: 19px; transition: 180ms ease; }
.original-card { margin-top: 25px; background: linear-gradient(135deg, #f7f2e8, #fdfbf6); }
.english-card { background: #f7faf9; }
.text-card[data-active="true"] { border-color: var(--green-700); box-shadow: 0 0 0 3px rgba(36, 105, 90, 0.1); transform: translateY(-1px); }
.text-card[data-active="true"]::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--green-700); }
.text-card-meta { display: flex; justify-content: space-between; gap: 15px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.reading-status { color: var(--green-700); }
.original-text { margin: 15px 0 0; font-family: "Noto Serif Hebrew", "Times New Roman", serif; font-size: clamp(25px, 5.5vw, 34px); line-height: 1.65; }
.original-text[lang="grc"] { font-family: Georgia, "Times New Roman", serif; font-size: clamp(23px, 5vw, 31px); line-height: 1.55; }
.english-text { margin: 14px 0 2px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(20px, 4.5vw, 26px); line-height: 1.48; }
.source-note { margin: 10px 0 0; color: var(--muted); font-size: 12px; line-height: 1.4; }
.queue-panel { margin: 22px 0 16px; }
.queue-label { margin: 0 0 9px; color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: 0.09em; text-transform: uppercase; }
.queue-steps { display: flex; gap: 8px; flex-wrap: wrap; }
.queue-step { display: flex; align-items: center; gap: 7px; padding: 7px 11px 7px 7px; border-radius: 999px; background: #f0f3f2; color: var(--muted); font-size: 12px; font-weight: 700; }
.queue-step i { display: grid; place-items: center; width: 21px; height: 21px; border-radius: 50%; background: white; color: var(--muted); font-style: normal; }
.queue-step[data-state="current"] { background: var(--green-100); color: var(--green-800); }
.queue-step[data-state="current"] i { background: var(--green-700); color: white; }
.queue-step[data-state="done"] { opacity: 0.58; }
.queue-step[data-state="done"] i::after { content: "✓"; }
.queue-step[data-state="done"] i { font-size: 0; }

.player { overflow: hidden; margin-top: 18px; border-radius: 20px; background: var(--green-950); color: white; box-shadow: 0 15px 34px rgba(16, 47, 42, 0.24); }
.progress-track { height: 4px; background: rgba(255,255,255,0.12); }
.progress-track span { display: block; width: 0; height: 100%; background: #e6b866; transition: width 160ms linear; }
.player-controls { display: grid; grid-template-columns: 50px 1fr 50px; gap: 12px; align-items: center; padding: 18px 19px 9px; }
.play-button, .round-button { border: 0; cursor: pointer; }
.play-button { display: flex; justify-content: center; align-items: center; gap: 10px; min-height: 54px; padding: 0 20px; border-radius: 16px; background: #f6c66f; color: #25332f; font-weight: 850; }
.play-button:disabled { cursor: wait; opacity: 0.7; }
.round-button { width: 48px; height: 48px; border-radius: 50%; background: rgba(255,255,255,0.11); color: white; font-size: 29px; }
.player-message { min-height: 35px; margin: 0; padding: 0 20px 17px; color: #c8d9d5; font-size: 12px; text-align: center; line-height: 1.4; }
.player-message[data-error="true"] { color: #ffd1c9; }

.timing-panel { margin-top: 20px; border-top: 1px solid var(--border); padding-top: 17px; color: var(--muted); font-size: 13px; }
.timing-panel summary, .credits summary { cursor: pointer; color: var(--ink); font-weight: 800; }
.timing-panel p { line-height: 1.55; }
.timing-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 11px; }
.timing-grid fieldset { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 0; padding: 13px; border: 1px solid var(--border); border-radius: 14px; }
.timing-grid legend { color: var(--ink); font-weight: 800; }
.timing-grid label { display: grid; gap: 4px; }
.timing-grid input { min-width: 0; width: 100%; padding: 8px; border: 1px solid var(--border); border-radius: 9px; }
.timing-grid a { grid-column: 1 / -1; color: var(--green-700); line-height: 1.3; }
.quiet-button { padding: 9px 13px; border: 1px solid #b9cbc6; border-radius: 11px; background: transparent; color: var(--green-800); cursor: pointer; font-weight: 750; }
.timing-panel .quiet-button { margin-top: 12px; }

.about-card { padding: clamp(22px, 4vw, 30px); }
.about-card ul { margin: 20px 0; padding-left: 22px; color: var(--muted); line-height: 1.8; }
.caveat { margin: 0; padding: 15px 17px; border-left: 4px solid var(--gold); border-radius: 4px 13px 13px 4px; background: var(--sand); color: #5e543f; line-height: 1.55; }
.credits { padding: 18px 21px; box-shadow: none; color: var(--muted); }
.credits div { padding-top: 8px; font-size: 13px; line-height: 1.55; }

@media (max-width: 560px) {
  main { width: min(100% - 20px, 760px); padding-top: 34px; }
  .topbar { min-height: 66px; }
  .brand-mark { width: 42px; height: 42px; border-radius: 13px; }
  .brand small { display: none; }
  .passage-options { grid-template-columns: 1fr; }
  .timing-grid { grid-template-columns: 1fr; }
  .verse-stage-header { align-items: flex-end; }
  .online-pill { display: none; }
}

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