:root {
  --bg: #071510;
  --bg-2: #0c241c;
  --panel: rgba(243, 239, 228, 0.045);
  --panel-strong: rgba(243, 239, 228, 0.08);
  --line: rgba(232, 197, 71, 0.18);
  --gold: #e8c547;
  --gold-2: #c9a227;
  --cream: #f3efe4;
  --muted: rgba(243, 239, 228, 0.64);
  --teal: #1f7a64;
  --danger: #e07a5f;
  --ok: #7dce82;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --radius: 22px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--cream);
  font-family: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
}

body {
  background:
    radial-gradient(900px 420px at 10% -10%, rgba(31, 122, 100, 0.28), transparent 55%),
    radial-gradient(700px 360px at 110% 10%, rgba(232, 197, 71, 0.12), transparent 50%),
    var(--bg);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg width='80' height='80' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M40 4 L44 36 L76 40 L44 44 L40 76 L36 44 L4 40 L36 36 Z' fill='none' stroke='%23e8c547' stroke-width='1'/%3E%3C/svg%3E");
}

.app {
  width: min(460px, 100%);
  margin: 0 auto;
  min-height: 100vh;
  padding: 18px 16px 36px;
  position: relative;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(160deg, #1a4a3c, #071510);
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 22px;
}

.brand h1 {
  margin: 0;
  font-family: Fraunces, Georgia, serif;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.brand small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.icon-btn, .city-btn, .ghost-btn, .primary-btn {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--cream);
  border-radius: 14px;
  cursor: pointer;
  font: inherit;
}

.icon-btn {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  font-size: 18px;
}

.city-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 16px;
  text-align: left;
}

.city-btn strong { display: block; font-size: 15px; }
.city-btn span { color: var(--muted); font-size: 12px; }

.hero {
  background: linear-gradient(180deg, rgba(232, 197, 71, 0.1), var(--panel));
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 22px 20px 20px;
  box-shadow: var(--shadow);
  text-align: center;
  margin-bottom: 16px;
}

.dates {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 10px;
}

.hero .label {
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 11px;
  color: var(--gold);
  font-weight: 700;
}

.hero h2 {
  margin: 4px 0 6px;
  font-family: Fraunces, Georgia, serif;
  font-size: 34px;
  font-weight: 650;
}

.countdown {
  font-variant-numeric: tabular-nums;
  font-size: 42px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--gold);
}

.countdown small {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0;
}

.clock {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.prayers {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.prayer {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px;
  padding: 13px 14px;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid transparent;
}

.prayer .name { font-weight: 650; }
.prayer .time {
  font-variant-numeric: tabular-nums;
  font-size: 20px;
  font-weight: 700;
}
.prayer .bell {
  width: 36px;
  height: 36px;
  border-radius: 12px;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
}

.prayer.is-current {
  background: linear-gradient(90deg, rgba(31, 122, 100, 0.28), rgba(232, 197, 71, 0.08));
  border-color: var(--line);
}

.prayer.is-next {
  border-color: rgba(232, 197, 71, 0.45);
  box-shadow: 0 0 0 1px rgba(232, 197, 71, 0.12);
}

.prayer.is-past { opacity: 0.55; }
.prayer .bell.is-on { color: var(--gold); }

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.ghost-btn, .primary-btn {
  padding: 12px 14px;
  font-weight: 650;
}

.primary-btn {
  background: linear-gradient(90deg, #e8c547, #c9a227);
  color: #1a1404;
  border: 0;
}

.notice, .status {
  border-radius: 16px;
  padding: 12px 14px;
  font-size: 13px;
  line-height: 1.45;
  margin-bottom: 12px;
}

.notice {
  background: rgba(232, 197, 71, 0.1);
  border: 1px solid var(--line);
  color: var(--cream);
}

.status.error {
  background: rgba(224, 122, 95, 0.12);
  color: #ffd4c8;
}

.sheet {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: none;
  align-items: flex-end;
  justify-content: center;
  z-index: 20;
  padding: 12px;
}

.sheet.is-open { display: flex; }

.sheet-card {
  width: min(460px, 100%);
  max-height: min(86vh, 720px);
  overflow: auto;
  background: #10251e;
  border: 1px solid var(--line);
  border-radius: 24px 24px 18px 18px;
  padding: 18px;
  box-shadow: var(--shadow);
}

.sheet-card h3 {
  margin: 0 0 12px;
  font-family: Fraunces, Georgia, serif;
}

.search, select, input[type="text"] {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: var(--cream);
  font: inherit;
  margin-bottom: 10px;
}

.city-list {
  display: grid;
  gap: 6px;
  max-height: 360px;
  overflow: auto;
}

.city-item {
  text-align: left;
  padding: 11px 12px;
  border-radius: 12px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
}

.city-item:hover, .city-item.is-active { background: var(--panel-strong); }

.city-item small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.remind-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(243, 239, 228, 0.06);
}

.remind-row select {
  width: auto;
  margin: 0;
  padding: 8px 10px;
}

.toggle {
  appearance: none;
  width: 42px;
  height: 24px;
  border-radius: 99px;
  background: #31443d;
  position: relative;
  cursor: pointer;
  border: 0;
}

.toggle:checked { background: var(--gold-2); }
.toggle::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  transition: left 0.15s ease;
}
.toggle:checked::after { left: 21px; }

.cal-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.cal-table th, .cal-table td {
  padding: 7px 4px;
  text-align: center;
  border-bottom: 1px solid rgba(243, 239, 228, 0.06);
}

.cal-table th { color: var(--gold); font-weight: 650; }
.cal-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.qibla-wrap {
  display: grid;
  place-items: center;
  padding: 10px 0 16px;
}

.qibla-turn {
  text-align: center;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--cream);
  margin: 0 0 8px;
}

.qibla-compass {
  width: 260px;
  height: 260px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: radial-gradient(circle at 50% 50%, rgba(232, 197, 71, 0.12), transparent 55%), #0b1d17;
  position: relative;
  overflow: hidden;
}

.qibla-compass.is-aligned {
  border-color: var(--gold);
  box-shadow: 0 0 24px rgba(232, 197, 71, 0.35);
}

.qibla-turn.is-on { color: var(--gold); }

.qibla-aim {
  position: absolute;
  top: 4px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  color: var(--cream);
  font-size: 18px;
}

.qibla-rose {
  position: absolute;
  inset: 0;
  transition: transform 0.08s linear;
}

.qibla-cardinal {
  position: absolute;
  font-weight: 700;
  font-size: 14px;
}

.qibla-k { top: 14px; left: 50%; transform: translateX(-50%); color: var(--gold); }
.qibla-g { bottom: 14px; left: 50%; transform: translateX(-50%); }
.qibla-d { right: 16px; top: 50%; transform: translateY(-50%); }
.qibla-b { left: 16px; top: 50%; transform: translateY(-50%); }

.qibla-kaaba {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 18px;
  height: 92px;
  margin-left: -9px;
  margin-top: -92px;
  transform-origin: 50% 92px;
  color: var(--gold);
  font-size: 18px;
  text-align: center;
  line-height: 18px;
}

.qibla-you {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  font-size: 12px;
  color: var(--muted);
}

.qibla, .qibla-needle { display: none; }

.footer {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  margin-top: 8px;
}

.footer a { color: var(--gold); text-decoration: none; }

.hidden { display: none !important; }

@media (min-width: 900px) {
  .app { padding-top: 28px; }
}
