/* Prayer times – mobile-first, light/dark, LTR + RTL */
:root {
  --bg: #f6f4ee; --card: #ffffff; --ink: #14231c; --muted: #5b6b63; --line: #e3e0d6;
  --green: #0b4a33; --green-2: #12704d; --gold: #b8892b; --gold-soft: #f6ecd4; --next: #e8f3ec;
  --radius: 16px; --shadow: 0 1px 2px rgba(0,0,0,.04), 0 6px 20px rgba(11,74,51,.06);
  --font: "Segoe UI", system-ui, -apple-system, Roboto, "Noto Sans", "Noto Sans Arabic", Tahoma, Arial, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --bg: #0d1512; --card: #15201b; --ink: #e8efe9; --muted: #9db0a5; --line: #26352e; --green: #3fbf88; --green-2: #5fd3a0; --gold: #e2b65a; --gold-soft: #2a2516; --next: #1d3328; color-scheme: dark; }
}
:root[data-theme="dark"] { --bg: #0d1512; --card: #15201b; --ink: #e8efe9; --muted: #9db0a5; --line: #26352e; --green: #3fbf88; --green-2: #5fd3a0; --gold: #e2b65a; --gold-soft: #2a2516; --next: #1d3328; color-scheme: dark; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--ink); line-height: 1.55; font-size: 16px; padding-bottom: 72px; }
a { color: var(--green-2); }
a:hover { color: var(--gold); }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 6px; }
.wrap { width: 100%; max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.skip { position: absolute; inset-inline-start: 8px; top: -60px; background: var(--card); padding: 8px 12px; z-index: 50; }
.skip:focus { top: 8px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.small { font-size: .86rem; color: var(--muted); }

/* header */
.top { background: var(--green); color: #fff; position: sticky; top: 0; z-index: 20; }
:root[data-theme="dark"] .top { background: #0f2b20; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .top { background: #0f2b20; } }
.top-in { display: flex; align-items: center; gap: 12px; min-height: 58px; }
.brand { display: flex; align-items: center; gap: 8px; color: #fff; text-decoration: none; font-weight: 700; font-size: 1.1rem; }
.brand svg { width: 30px; height: 30px; }
.mainnav { display: none; gap: 4px; margin-inline-start: 12px; }
.mainnav a { color: #e9f3ee; text-decoration: none; padding: 8px 10px; border-radius: 10px; font-size: .95rem; }
.mainnav a:hover, .mainnav a[aria-current] { background: rgba(255,255,255,.12); color: #fff; }
.tools { margin-inline-start: auto; display: flex; align-items: center; gap: 6px; }
.lang { color: #fff; text-decoration: none; border: 1px solid rgba(255,255,255,.35); border-radius: 999px; padding: 4px 12px; font-size: .9rem; }
.icon-btn { background: transparent; border: 0; color: #fff; width: 40px; height: 40px; border-radius: 10px; display: none; place-items: center; cursor: pointer; }
.icon-btn svg { width: 22px; height: 22px; }

/* main */
main { padding-top: 14px; }
h1 { font-size: 1.55rem; line-height: 1.25; margin: 6px 0 12px; color: var(--green); }
h2 { font-size: 1.12rem; margin: 0 0 10px; }
.lead { color: var(--muted); margin-top: -4px; }
.crumbs ol { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 0; font-size: .85rem; color: var(--muted); }
.crumbs li + li::before { content: "›"; margin-inline-end: 6px; }
[dir="rtl"] .crumbs li + li::before { content: "‹"; }
.crumbs a { color: var(--muted); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 16px; margin: 0 0 14px; }
.grid2 { display: grid; gap: 14px; }
.grid2 .card { margin: 0; }
.grid2 { margin-bottom: 14px; }

/* times card – the most important block */
.times-card { background-image: linear-gradient(var(--card), var(--card)), url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60' viewBox='0 0 60 60'%3E%3Cpath d='M30 4l7 19 19 7-19 7-7 19-7-19-19-7 19-7z' fill='none' stroke='%23b8892b' stroke-opacity='.18'/%3E%3C/svg%3E"); background-clip: padding-box, border-box; border-top: 4px solid var(--gold); }
.dates { color: var(--muted); font-size: .92rem; display: flex; flex-wrap: wrap; gap: 6px; }
.dates .dot { opacity: .6; }
.next { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 10px; margin: 10px 0 12px; padding: 12px 14px; border-radius: 12px; background: var(--gold-soft); }
.next .lbl { font-size: .85rem; color: var(--muted); width: 100%; }
.next strong { font-size: 1.5rem; color: var(--green); }
.next [data-next-time] { font-size: 1.2rem; font-weight: 600; }
.next .cd { margin-inline-start: auto; font-variant-numeric: tabular-nums; font-weight: 600; color: var(--gold); }
.daynav { display: flex; gap: 8px; align-items: center; margin: 0 0 10px; flex-wrap: wrap; }
.daynav input { flex: 1 1 150px; min-width: 0; }
table { width: 100%; border-collapse: collapse; }
.times th, .times td { white-space: nowrap; padding: 11px 8px; border-bottom: 1px solid var(--line); text-align: start; font-variant-numeric: tabular-nums; }
.times thead th { font-size: .8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .02em; }
[dir="rtl"] .times thead th { text-transform: none; letter-spacing: 0; }
.times tbody th { font-weight: 600; white-space: normal; }
.times td.t { font-weight: 700; font-size: 1.08rem; }
.times tr.is-next { background: var(--next); }
.times tr.is-next th { color: var(--green); }
.times tr.is-next th::after { content: " ●"; color: var(--gold); font-size: .7em; vertical-align: middle; }
.times tr.row-sunrise { color: var(--muted); }
.times.wide td, .times.wide th { white-space: nowrap; }
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.meta { margin: 10px 0 0; color: var(--muted); font-size: .88rem; }
.kv th, .kv td { padding: 8px 4px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: top; }
.kv th { font-weight: 500; color: var(--muted); }
.kv td { font-weight: 700; white-space: nowrap; text-align: end; font-variant-numeric: tabular-nums; }
.pair { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.pair strong { font-size: 1.15rem; font-variant-numeric: tabular-nums; }

/* prayer page */
.hero-prayer .big { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 12px 0 6px; }
.hero-prayer .big > div { background: var(--gold-soft); border-radius: 12px; padding: 14px; text-align: center; }
.hero-prayer .big .lbl { display: block; color: var(--muted); font-size: .85rem; }
.hero-prayer .big strong { font-size: 2rem; color: var(--green); font-variant-numeric: tabular-nums; }
.cd-line { font-weight: 600; color: var(--gold); text-align: center; margin: 6px 0 0; }

/* chips, lists */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-block; padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg); color: var(--ink); text-decoration: none; font-size: .93rem; }
.chip:hover { border-color: var(--gold); color: var(--green); }
.chip.strong { background: var(--green); color: #fff; border-color: var(--green); }
.near { list-style: none; padding: 0; margin: 0 0 8px; display: grid; gap: 6px; }
.near li { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.near span { color: var(--muted); font-size: .9rem; font-variant-numeric: tabular-nums; }
details { border-bottom: 1px solid var(--line); padding: 10px 0; }
summary { cursor: pointer; font-weight: 600; }
details p { margin: 8px 0 0; color: var(--muted); }

/* home */
.pick { display: flex; gap: 8px; flex-wrap: wrap; }
.pick select { flex: 1 1 200px; }
.city-name { font-size: 1.35rem; margin: 10px 0 2px; color: var(--green); }
.loc-status { color: var(--muted); font-size: .9rem; margin: 6px 0 0; min-height: 0; }
.loc-status:empty { display: none; }
.countries { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.country { display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 10px; padding: 12px; border: 1px solid var(--line); border-radius: 12px; text-decoration: none; color: var(--ink); background: var(--bg); }
.country .flag { grid-row: span 2; font-size: 1.6rem; line-height: 1; align-self: center; }
.country small { color: var(--muted); }
.country:hover { border-color: var(--gold); }

/* qibla */
.compass-wrap { display: grid; place-items: center; margin: 14px 0 6px; }
.compass { width: min(280px, 80vw); height: auto; }
.needle { transform-origin: 100px 100px; transition: transform .4s ease; fill: var(--gold); }
.qibla-read { text-align: center; font-size: 1.05rem; }
.qibla-read strong { font-size: 2rem; color: var(--green); }

/* hijri */
.hijri-big { font-size: 2rem; font-weight: 700; color: var(--green); margin: 4px 0; }
.conv { display: grid; gap: 10px; }
.conv output { font-weight: 700; font-size: 1.15rem; color: var(--green); min-height: 1.4em; }
.row3 { display: grid; grid-template-columns: 1fr 1.6fr 1fr; gap: 8px; }
.months { columns: 2; padding-inline-start: 0; list-style: none; margin: 0; }
.months li { padding: 6px 0; break-inside: avoid; }
.months .n { display: inline-block; width: 1.8em; color: var(--gold); font-weight: 700; }
.months small { color: var(--muted); margin-inline-start: 6px; }

/* forms + buttons */
label { display: grid; gap: 4px; font-size: .92rem; color: var(--muted); }
select, input { font: inherit; color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 9px 10px; min-height: 42px; }
button { font: inherit; cursor: pointer; border-radius: 10px; padding: 9px 14px; min-height: 42px; border: 1px solid var(--line); background: var(--card); color: var(--ink); }
button.primary { background: var(--green); border-color: var(--green); color: #fff; font-weight: 600; }
:root[data-theme="dark"] button.primary { color: #08140f; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) button.primary { color: #08140f; } }
button.ghost { background: transparent; }
button:hover { border-color: var(--gold); }

/* settings dialog */
dialog { border: 0; border-radius: 18px; padding: 0; width: min(440px, 94vw); background: var(--card); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(0,0,0,.45); }
.settings { display: grid; gap: 12px; padding: 20px; }
.settings h2 { margin: 0; }
.row-btns { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }

/* footer */
.foot { margin-top: 24px; padding: 20px 0 30px; border-top: 1px solid var(--line); color: var(--muted); font-size: .9rem; }
.foot-countries { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-bottom: 10px; }
.foot a { color: var(--muted); }

/* bottom nav (phones) */
.bottom { position: fixed; bottom: 0; left: 0; right: 0; z-index: 30; display: grid; grid-template-columns: repeat(4, 1fr); background: var(--card); border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); }
.bottom a, .bottom button { display: grid; justify-items: center; gap: 2px; padding: 8px 4px; font-size: .72rem; color: var(--muted); text-decoration: none; background: none; border: 0; border-radius: 0; min-height: 56px; }
.bottom svg { width: 22px; height: 22px; }
.bottom [aria-current] { color: var(--green); }

/* tablets / desktop / Windows */
@media (min-width: 720px) {
  h1 { font-size: 2rem; }
  .card { padding: 22px; }
  .grid2 { grid-template-columns: 1fr 1fr; }
  .countries { grid-template-columns: repeat(4, 1fr); }
  .next .lbl { width: auto; }
}
@media (min-width: 900px) {
  body { padding-bottom: 0; }
  .bottom { display: none; }
  .mainnav { display: flex; }
  .icon-btn { display: grid; }
  .times-card .times td.t { font-size: 1.2rem; }
}
@media print {
  .top, .bottom, .foot, .daynav, dialog, .pick { display: none !important; }
  body { background: #fff; padding: 0; }
  .card { box-shadow: none; border: 1px solid #ccc; }
}
@media (prefers-reduced-motion: reduce) { .needle { transition: none; } }
