/* The two prayer apps (app/mosque and app/home). Loads after style.css. */
body.app { background: var(--night); color: #fff; min-height: 100vh; min-height: 100svh; }
body.app.has-announce { padding-top: 0; }
.app-wrap { max-width: 520px; margin: 0 auto; padding: calc(env(safe-area-inset-top, 0px) + .9rem) 1.1rem calc(env(safe-area-inset-bottom, 0px) + 2rem); }

/* announcement from the sheet: an inline gold strip instead of the site's fixed bar */
body.app .announce { position: relative; -webkit-transform: none; transform: none; padding-top: env(safe-area-inset-top, 0px); }
body.app .announce + .app-wrap { padding-top: 1rem; }
body.app .announce .container-xl { max-width: 520px; }

.app-top { display: flex; align-items: center; gap: .7rem; margin-bottom: 1.1rem; }
.app-top img { flex: none; }
.app-title { flex: 1; min-width: 0; line-height: 1.2; }
.app-title b { display: block; font-family: var(--display); font-size: 1.12rem; letter-spacing: -.01em; }
.app-title span { font-size: .8rem; color: var(--muted-dark); }
.app-icon-btn { flex: none; width: 42px; height: 42px; border-radius: 50%; border: 1px solid var(--line-dark); background: rgba(255,255,255,.05); color: #fff; display: grid; place-items: center; }
.app-icon-btn:active { background: rgba(255,255,255,.12); }

/* next prayer card */
.app-hero { border-radius: 24px; padding: 1.15rem 1.25rem 1.1rem; background: radial-gradient(120% 90% at 85% 0%, rgba(240,194,123,.22), transparent 55%), linear-gradient(160deg, #0f4a3b, #0a3328); border: 1px solid rgba(255,255,255,.1); }
.app-hero-head { display: flex; justify-content: space-between; align-items: baseline; gap: .5rem; }
.app-kicker { margin: 0; font-size: .7rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--dawn); }
.app-date { margin: 0; font-size: .8rem; color: var(--muted-dark); }
body.app .next-block { display: block; margin: .35rem 0 0; padding: 0; border: 0; }
body.app .next-block .next-label { display: none; }
body.app .next-name { font-size: 1.45rem; font-weight: 600; margin: 0; }
body.app .next-time { font-size: clamp(3.4rem, 17vw, 4.4rem); margin: .1rem 0 0; line-height: 1; }
body.app .next-countdown { text-align: left; margin-top: .45rem; color: rgba(255,255,255,.78); }

.leave-line { display: flex; align-items: center; gap: .65rem; margin: .95rem 0 0; padding: .7rem .85rem; border-radius: 14px; background: rgba(7,42,34,.45); border: 1px solid rgba(240,194,123,.25); font-size: .92rem; line-height: 1.3; }
.leave-line[hidden] { display: none; }
.leave-line b { color: var(--dawn); }
.leave-line small { display: block; color: var(--muted-dark); font-size: .76rem; margin-top: 2px; }
.leave-ico { flex: none; width: 30px; height: 30px; border-radius: 9px; background: rgba(240,194,123,.15); color: var(--dawn); display: grid; place-items: center; }
.leave-set { border: 0; background: none; color: var(--dawn); font: inherit; font-weight: 600; padding: 0; text-align: left; text-decoration: underline; text-underline-offset: 3px; }

body.app .today-notice { margin: .9rem 0 0; font-size: .9rem; }
.app-card { margin-top: .9rem; border-radius: 22px; background: rgba(255,255,255,.045); border: 1px solid var(--line-dark); padding: .25rem 1.1rem; }
.app-card .today-list { padding-top: 0; }
body.app .prayer-row { padding: .8rem 0; }
body.app .day-line { display: none !important; }
.app-week { padding: 1rem .45rem .4rem; }
.app-h2 { font-family: var(--display); font-size: 1rem; font-weight: 600; margin: 0 .5rem .4rem; }
body.app .times-table { --bs-table-bg: transparent; margin-bottom: 0; color: #fff; }
/* the app is always phone-width: the whole week fits, even with the Tahajjud column (AM/PM drops) */
body.app .times-table thead th { padding: .55rem .2rem; font-size: .7rem; text-align: center; }
body.app .times-table thead th:first-child { text-align: left; padding-left: .45rem; }
body.app .times-table td, body.app .times-table tbody th { padding: .7rem .2rem; font-size: .9rem; text-align: center; }
body.app .times-table tbody th { text-align: left; padding-left: .45rem; line-height: 1.15; position: static; box-shadow: none; background: var(--bs-table-bg); }
body.app .times-table td .ampm { display: none; }
body.app .wk-date { display: block; font-size: .72rem; font-weight: 500; opacity: .7; }
body.app .times-table .cell-tag { left: 0; right: 0; text-align: center; -webkit-transform: none; transform: none; bottom: .3rem; font-size: .5rem; letter-spacing: .03em; opacity: .9; }

/* pray at home */
.app-find { display: flex; gap: .6rem; margin-bottom: .9rem; }
.app-find .home-search { flex: 1; height: 50px; border-radius: 16px; background: rgba(255,255,255,.05); border-color: var(--line-dark); }
.app-find .home-search input { width: 100%; }
.app-gps { flex: none; width: 50px; height: 50px; border-radius: 16px; border: 0; background: var(--dawn); color: var(--ink); display: grid; place-items: center; }
body.app-home .home-card { margin-top: 0; padding: 1.1rem 1.1rem .9rem; border-radius: 22px; }
body.app-home .home-tools { flex-wrap: wrap; gap: .6rem; }
body.app-home .home-body { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "next qibla" "grid grid"; gap: 1.5rem; }
body.app-home .home-qibla { padding-left: 0; border-left: 0; }
body.app-home .home-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); row-gap: 1rem; }
@media (max-width: 480px) {
  body.app-home .home-body { grid-template-columns: minmax(0, 1fr); grid-template-areas: "next" "grid" "qibla"; }
}
body.app .home-fine { color: var(--muted-dark); font-size: .78rem; margin: .8rem .2rem 0; }

/* add to home screen + links */
.app-a2hs { margin-top: 1rem; border-top: 0; padding: .9rem 1rem; border-radius: 18px; background: rgba(240,194,123,.08); border: 1px solid rgba(240,194,123,.22); }
.app-links { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-top: 1rem; }
.app-links > * { min-width: 0; }
.app-links a { display: block; padding: .85rem 1rem; border-radius: 16px; background: rgba(255,255,255,.04); border: 1px solid var(--line-dark); color: #fff; text-decoration: none; font-weight: 600; font-size: .95rem; }
.app-links a span { display: block; font-weight: 500; font-size: .78rem; color: var(--muted-dark); margin-top: 2px; }

/* settings sheet */
.app-sheet-back { position: fixed; inset: 0; z-index: 2000; background: rgba(2,14,11,.55); opacity: 0; transition: opacity .25s; }
.app-sheet-back.open { opacity: 1; }
.app-sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 2001; max-width: 560px; max-height: 88vh; overflow-y: auto; margin: 0 auto; padding: .6rem 1.25rem calc(1.5rem + env(safe-area-inset-bottom, 0px)); border-radius: 22px 22px 0 0; background: #0d3a2f; color: #fff; transform: translateY(105%); transition: transform .32s cubic-bezier(.2,.8,.2,1); box-shadow: 0 -20px 60px rgba(0,0,0,.5); }
.app-sheet.open { transform: none; }
.app-sheet[hidden], .app-sheet-back[hidden] { display: none; }
.app-sheet-grab { width: 40px; height: 5px; margin: 0 auto .8rem; border-radius: 3px; background: rgba(255,255,255,.25); }
.app-sheet-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: .4rem; }
.app-sheet-head h2 { font-family: var(--display); font-size: 1.3rem; margin: 0; }
.app-done { border: 0; background: none; color: var(--dawn); font-weight: 700; font-size: 1rem; }
.set-h { font-size: .72rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted-dark); margin: 1.1rem .2rem .45rem; }
.set-group { border-radius: 16px; background: rgba(255,255,255,.05); border: 1px solid var(--line-dark); padding: 0 1rem; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem 0; border-top: 1px solid var(--line-dark); margin: 0; font-weight: 600; font-size: .95rem; }
.set-group > :first-child { border-top: 0; }
.set-row small { display: block; font-weight: 500; font-size: .76rem; color: var(--muted-dark); margin-top: 2px; }
.set-row.is-off { opacity: .55; }
.switch { -webkit-appearance: none; appearance: none; flex: none; width: 50px; height: 30px; border-radius: 999px; background: rgba(255,255,255,.18); position: relative; transition: background .2s; cursor: pointer; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; transition: transform .2s; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.switch:checked { background: var(--dawn); }
.switch:checked::after { transform: translateX(20px); }
.switch:focus-visible { outline: 2px solid var(--dawn); outline-offset: 2px; }
.switch:disabled { cursor: default; }
.stepper { display: flex; align-items: center; gap: .5rem; flex: none; }
.stepper button { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line-dark); background: rgba(255,255,255,.06); color: #fff; font-size: 1.2rem; line-height: 1; }
.stepper b { min-width: 4.4rem; text-align: center; font-family: var(--nums); font-size: .95rem; }
.set-btn { display: flex; align-items: center; justify-content: center; gap: .5rem; width: 100%; margin: 0 0 .8rem; padding: .7rem; border-radius: 12px; border: 1px solid rgba(240,194,123,.35); background: rgba(240,194,123,.1); color: var(--dawn); font-weight: 600; font-size: .9rem; }
.chips { display: flex; gap: .35rem; flex: none; }
.chips button { min-width: 38px; height: 34px; border-radius: 10px; border: 1px solid var(--line-dark); background: rgba(255,255,255,.05); color: #fff; font-family: var(--nums); font-weight: 600; }
.chips button.is-active { background: var(--dawn); color: var(--ink); border-color: var(--dawn); }
.set-fine { font-size: .76rem; color: var(--muted-dark); margin: .9rem .2rem 0; }

/* toast for alerts */
.app-toast { position: fixed; left: 50%; top: calc(env(safe-area-inset-top, 0px) + 12px); z-index: 3000; transform: translate(-50%, -150%); max-width: min(92vw, 440px); padding: .85rem 1.1rem; border-radius: 16px; background: var(--dawn); color: var(--ink); font-weight: 700; font-size: .95rem; box-shadow: 0 12px 30px rgba(0,0,0,.35); transition: transform .35s cubic-bezier(.2,.8,.2,1); }
.app-toast.in { transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { .app-sheet, .app-sheet-back, .app-toast { transition: none; } }
body.app-home .home-slot { padding-left: .8rem; padding-right: .4rem; }
body.app-home .home-slot-time { font-size: 1.18rem; }
@media (max-width: 480px) {
  body.app-home .home-slot { padding-left: .55rem; padding-right: .25rem; }
  body.app-home .home-slot-time { font-size: 1.02rem; }
}
/* smallest phones (320px): squeeze the week table a little more so Isha still fits */
@media (max-width: 359.98px) {
  body.app .app-week { padding-left: .25rem; padding-right: .25rem; }
  body.app .times-table thead th { padding: .5rem .1rem; font-size: .6rem; }
  body.app .times-table td, body.app .times-table tbody th { padding: .65rem .1rem; font-size: .8rem; }
  body.app .times-table tbody th, body.app .times-table thead th:first-child { padding-left: .3rem; }
  body.app .wk-date { font-size: .64rem; }
}
