/* Prayer ticket: a boarding-pass card. Mobile-first; light and dark from prefers-color-scheme. System fonts only (no
   third-party font host, W2). Semantic tokens; components never use raw colours. */
:root {
  --bg: #eef2f7; --card: #ffffff; --ink: #0f1b2d; --muted: #4a5568; --line: #d5dce6; --soft: #f5f7fa;
  --head: #12355b; --on-head: #ffffff; --on-head-muted: #c9d7ea;
  --accent: #8a5a00; --primary: #12355b; --on-primary: #ffffff; --focus: #1d4ed8;
  --warn-bg: #fff4e5; --warn-line: #b45309; --warn-ink: #6b3600;
  --info-bg: #eaf2ff; --info-line: #3b64c4; --info-ink: #1e3a8a;
  --err: #b42318;
  --r: 14px; --gap: 1rem;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1220; --card: #121c2e; --ink: #e8eef7; --muted: #a9b6c9; --line: #2a3a55; --soft: #17233a;
    --head: #0e2a4a; --on-head: #f2f6fb; --on-head-muted: #b7c7dd;
    --accent: #f2c46d; --primary: #f2c46d; --on-primary: #0b1220; --focus: #93b4ff;
    --warn-bg: #2a1e0b; --warn-line: #d98a2b; --warn-ink: #ffd8a3;
    --info-bg: #0f2240; --info-line: #6f95e6; --info-ink: #cfe0ff;
    --err: #ff9b8f;
  }
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 1rem/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
p { margin: 0 0 .75rem; }
a { color: inherit; text-underline-offset: 2px; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }

.skip { position: absolute; left: -999px; top: .5rem; background: var(--card); color: var(--ink); padding: .5rem .75rem; z-index: 2; border-radius: 8px; }
.skip:focus { left: .5rem; }

.bar { display: flex; align-items: center; justify-content: space-between; gap: .75rem; padding: .75rem 1rem; max-width: 40rem; margin: 0 auto; }
.brand { margin: 0; font-weight: 700; letter-spacing: .01em; }
.net { margin: 0; font-size: .875rem; font-weight: 600; }
.net:not(:empty) { padding: .2rem .65rem; border-radius: 999px; background: var(--info-bg); color: var(--info-ink); border: 1px solid var(--info-line); }

main { max-width: 40rem; margin: 0 auto; padding: .25rem 1rem 2rem; outline: none; }
.lead { color: var(--muted); }

/* ---- setup form ---- */
.group { border: 1px solid var(--line); background: var(--card); border-radius: var(--r); padding: 1rem; margin: 0 0 var(--gap); min-width: 0; }
.group > legend { font-weight: 700; font-size: 1.05rem; padding: 0 .35rem; }
.field { margin: 0 0 .9rem; min-width: 0; }
.field:last-child { margin-bottom: 0; }
label { display: block; font-weight: 600; margin-bottom: .3rem; }
.opt, .sub { font-weight: 400; color: var(--muted); }
input, select {
  width: 100%; min-height: 48px; font: inherit; color: var(--ink); background: var(--soft);
  border: 1.5px solid var(--line); border-radius: 10px; padding: .55rem .75rem;
}
input.code { text-transform: uppercase; letter-spacing: .12em; font-weight: 700; max-width: 9rem; }
input[aria-invalid="true"] { border-color: var(--err); }
.hint { color: var(--muted); font-size: .9rem; margin: .3rem 0 0; }
.hint.airport:not(:empty) { overflow-wrap: anywhere; }
.err { color: var(--err); font-weight: 600; font-size: .9rem; margin: .3rem 0 0; }
.err:empty { display: none; }
.row2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 0 .75rem; }
.choice { border: 0; padding: 0; margin: 0 0 .9rem; min-width: 0; }
.choice > legend { font-weight: 600; margin-bottom: .3rem; padding: 0; }
.radio { display: flex; align-items: center; gap: .6rem; min-height: 48px; padding: .35rem .75rem; border: 1.5px solid var(--line); border-radius: 10px; margin-bottom: .5rem; background: var(--soft); }
.radio:has(input:checked) { border-color: var(--primary); }
.radio input { width: 1.35rem; height: 1.35rem; min-height: 0; margin: 0; accent-color: var(--primary); flex: none; }
.radio label { margin: 0; font-weight: 600; flex: 1; cursor: pointer; }
.radio .sub { display: block; font-size: .875rem; }
output { display: block; font-weight: 600; overflow-wrap: anywhere; }
.status { margin: .6rem 0 0; font-weight: 600; }
.status:empty { display: none; }
.error-summary { border: 2px solid var(--err); border-radius: var(--r); background: var(--card); padding: .75rem 1rem; margin-bottom: var(--gap); }
.error-summary ul { margin: .25rem 0 0; padding-left: 1.2rem; }

.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; padding: .6rem 1.1rem; border-radius: 12px; font: inherit; font-weight: 700; cursor: pointer; border: 2px solid transparent; transition: background-color .15s, border-color .15s; }
.btn-primary { width: 100%; background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { filter: brightness(1.08); }
.btn-quiet { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-quiet:hover { border-color: var(--muted); }
.btn + .btn { margin-left: .5rem; }

/* ---- ticket ---- (A24: overflow-wrap on the card, so no word in it can be clipped by its rounded-corner overflow at 200%) */
.ticket { overflow-wrap: anywhere; background: var(--card); border-radius: 18px; overflow: hidden; box-shadow: 0 1px 2px rgb(0 0 0 / .08), 0 8px 24px rgb(15 27 45 / .08); margin-bottom: var(--gap); }
.ticket-head { background: var(--head); color: var(--on-head); padding: 1rem 1rem .9rem; }
.eyebrow { text-transform: uppercase; letter-spacing: .14em; font-size: .75rem; font-weight: 700; color: var(--on-head-muted); margin: 0 0 .2rem; }
.ticket-title { font-size: 1.3rem; margin-bottom: .75rem; }
/* A24: the route reflows (wraps) instead of squeezing the airport codes past the card edge at 200% */
.route { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; margin-bottom: .6rem; }
.ap { flex: 1 0 auto; max-width: 100%; }
.ap p { margin: 0; }
.ap-to { text-align: right; }
.ap-role { font-size: .75rem; text-transform: uppercase; letter-spacing: .12em; color: var(--on-head-muted); }
.ap-code { font-size: 2rem; font-weight: 800; letter-spacing: .06em; line-height: 1.1; }
.ap-time { font-size: 1.05rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.ap-city { font-size: .85rem; color: var(--on-head-muted); overflow-wrap: anywhere; }
.route-line { flex: none; width: 3.5rem; height: 2px; background: repeating-linear-gradient(90deg, var(--on-head-muted) 0 6px, transparent 6px 11px); position: relative; }
.route-line::after { content: ""; position: absolute; right: -4px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--on-head); }
.ticket-head .meta { font-size: .85rem; color: var(--on-head-muted); margin: 0; overflow-wrap: anywhere; }
.ticket-head .meta a { color: var(--on-head); }
.perf { height: 18px; position: relative; background: radial-gradient(circle at 0 50%, var(--bg) 9px, transparent 10px) left / 50% 100% no-repeat,
  radial-gradient(circle at 100% 50%, var(--bg) 9px, transparent 10px) right / 50% 100% no-repeat; }
.perf::before { content: ""; position: absolute; left: 14px; right: 14px; top: 50%; border-top: 2px dashed var(--line); }

.rows { list-style: none; margin: 0; padding: 0 1rem; }
.row { padding: 1rem 0; border-bottom: 1px dashed var(--line); }
.row:last-child { border-bottom: 0; }
/* W7 (owner ruling 28 Oct 23:0x): a row is two lines, the prayer name and its window in the chosen clock */
.row-name { font-size: 1.15rem; margin: 0 0 .2rem; }
.pray { margin: 0; font-size: 1rem; font-weight: 600; line-height: 1.25; }
.pray .t { font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: -.01em; white-space: nowrap; }
.pray [data-end="end"] { color: var(--accent); }
/* the clock selector: native radios, drawn as a two-segment switch; the focus ring stays visible */
.clock-pick { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; border: 0; margin: 0; padding: .8rem 1rem 0; }
.clock-pick legend { grid-column: 1 / -1; padding: 0; margin-bottom: .4rem; font-size: .875rem; font-weight: 700; color: var(--muted); }
.clock-pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.clock-pick label { min-height: 44px; min-width: 44px; padding: .5rem 1rem; border: 2px solid var(--primary); border-radius: 999px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; text-align: center; cursor: pointer; color: var(--primary); overflow-wrap: anywhere; }
.clock-pick input:checked + label { background: var(--primary); color: var(--on-primary); }
.clock-pick input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 2px; }
/* owner ruling 29 Oct 17:0x: the small Asr toggle under the Asr row; same segment idiom as the clock selector, smaller */
.asr-pick { display: inline-flex; gap: .4rem; border: 0; margin: .6rem 0 0; padding: 0; min-width: 0; }
.asr-pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.asr-pick label { min-height: 44px; min-width: 44px; padding: .3rem .9rem; border: 1.5px solid var(--primary); border-radius: 999px; font-size: .875rem;
  font-weight: 700; display: flex; align-items: center; justify-content: center; cursor: pointer; color: var(--primary); }
.asr-pick input:checked + label { background: var(--primary); color: var(--on-primary); }
.asr-pick input:focus-visible + label { outline: 3px solid var(--focus); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.msg { border-radius: 10px; padding: .6rem .75rem; font-weight: 700; border-left: 4px solid; margin: 0; }
.msg-warn { background: var(--warn-bg); color: var(--warn-ink); border-color: var(--warn-line); }
.msg-info { background: var(--info-bg); color: var(--info-ink); border-color: var(--info-line); }

.notes { margin: 0 1rem 1rem; padding: .5rem .75rem; border-radius: 10px; background: var(--soft); font-size: .875rem; }
.notes-title { font-weight: 700; margin: 0 0 .2rem; }
.notes ul { margin: 0 0 .4rem; padding-left: 1.1rem; }
.notes .src { font-size: .8rem; }
.notes .status { color: var(--muted); font-weight: 600; margin: 0; }
.ticket-foot { background: var(--soft); padding: .9rem 1rem; font-size: .8rem; color: var(--muted); }
.ticket-foot p:last-child { margin-bottom: 0; }
.foot-method { color: var(--ink); font-weight: 600; }
.disclaimer { font-style: italic; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem; margin-bottom: var(--gap); }
.note { background: var(--info-bg); color: var(--info-ink); border-radius: 10px; padding: .6rem .75rem; font-size: .9rem; }
.note:empty { display: none; }
#companions:not(:empty) { margin: .5rem 0; }
#app-error:focus { outline: none; }
.banner { border-radius: var(--r); background: var(--warn-bg); color: var(--warn-ink); border: 2px solid var(--warn-line); padding: .75rem 1rem; font-weight: 700; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: var(--gap); }
.actions .btn + .btn { margin-left: 0; }
.install { text-align: center; }

.about { max-width: 40rem; margin: 0 auto; padding: 0 1rem 2rem; color: var(--muted); font-size: .875rem; }
.about h2 { font-size: 1rem; color: var(--ink); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
.trip-details { margin-top: var(--gap); border-top: 1px solid var(--line); padding-top: .75rem; }
.trip-details summary { cursor: pointer; font-weight: 600; }
.trip-details ul { padding-left: 1.2rem; overflow-wrap: anywhere; }
