:root {
  color-scheme: light;
  --ink: #10231f;
  --muted: #62736d;
  --paper: #f5f2ea;
  --surface: #fffdf8;
  --surface-strong: #eef6f0;
  --deep: #0b3b33;
  --deep-2: #0f5147;
  --mint: #bfe8cf;
  --gold: #e8b85b;
  --coral: #d86f58;
  --line: rgba(16, 35, 31, 0.1);
  --shadow: 0 20px 60px rgba(12, 48, 42, 0.18);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--paper);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(11, 59, 51, 0.1), transparent 38%),
    var(--paper);
}

button,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  width: min(100%, 620px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 16px calc(140px + env(safe-area-inset-bottom));
}

.hero {
  position: relative;
  overflow: hidden;
  min-height: 470px;
  padding: 18px;
  color: #fbfff9;
  background:
    radial-gradient(circle at 18% 18%, rgba(191, 232, 207, 0.35), transparent 24%),
    linear-gradient(145deg, var(--deep), #12261f 58%, #261b14);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.compact-hero {
  min-height: auto;
}

.ambient-grid {
  position: absolute;
  inset: 0;
  opacity: 0.16;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.2) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.2) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(180deg, #000, transparent 72%);
}

.topbar,
.brand,
.actions,
.hero-footer,
.now-strip,
.time-row,
.sync-state {
  display: flex;
  align-items: center;
}

.topbar {
  position: relative;
  z-index: 1;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  min-width: 0;
  gap: 10px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--deep);
  background: linear-gradient(145deg, #ffffff, var(--mint));
  border-radius: 8px;
  font-weight: 900;
}

.brand p,
.brand span,
.eyebrow,
.hero-copy p,
.zone-picker span,
.time-row p,
.now-strip span,
.sync-state,
.countdown-ring span,
.message {
  margin: 0;
}

.brand p {
  font-size: 0.94rem;
  font-weight: 800;
}

.brand span,
.eyebrow,
.hero-copy p,
.zone-picker span,
.time-row p,
.now-strip span,
.sync-state,
.countdown-ring span {
  color: rgba(251, 255, 249, 0.72);
  font-size: 0.78rem;
}

.actions {
  gap: 8px;
}

.icon-button {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  color: #fbfff9;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  font-size: 1.1rem;
}

.icon-button:active {
  transform: translateY(1px);
}

.hero-copy {
  position: relative;
  z-index: 1;
  margin-top: 38px;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0;
}

.hijri-date {
  margin-top: 4px;
  color: var(--mint);
  font-weight: 800;
}

.hero-copy h1,
.compact-hero h1 {
  margin: 6px 0 4px;
  font-size: clamp(3.5rem, 18vw, 6.5rem);
  line-height: 0.9;
  letter-spacing: 0;
}

.hero-copy p:last-child {
  color: #ffffff;
  font-size: 1.45rem;
  font-weight: 800;
}

.countdown-wrap {
  position: absolute;
  right: 18px;
  bottom: 94px;
  z-index: 1;
}

.countdown-ring {
  display: grid;
  width: clamp(150px, 42vw, 190px);
  aspect-ratio: 1;
  place-items: center;
  background:
    radial-gradient(circle, rgba(11, 59, 51, 0.9) 58%, transparent 59%),
    conic-gradient(var(--gold) var(--progress), rgba(255, 255, 255, 0.18) 0);
  border-radius: 50%;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

.countdown-ring div {
  display: grid;
  gap: 2px;
  place-items: center;
}

.countdown-ring strong {
  font-size: clamp(1.45rem, 7vw, 2rem);
  letter-spacing: 0;
}

.hero-footer {
  position: absolute;
  right: 18px;
  bottom: 18px;
  left: 18px;
  z-index: 2;
  justify-content: space-between;
  gap: 12px;
}

.zone-picker {
  position: relative;
  display: grid;
  min-width: 0;
  flex: 1;
  gap: 6px;
}

.zone-display {
  display: grid;
  min-height: 46px;
  align-content: center;
  gap: 1px;
  padding: 7px 36px 7px 12px;
  color: #fbfff9;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
}

.zone-display::after {
  content: '⌄';
  position: absolute;
  right: 13px;
  bottom: 12px;
  color: rgba(251, 255, 249, 0.78);
  font-size: 1.1rem;
  line-height: 1;
}

.zone-display strong {
  font-size: 0.82rem;
  line-height: 1;
}

.zone-display span {
  overflow: hidden;
  color: rgba(251, 255, 249, 0.78);
  font-size: 0.76rem;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.zone-picker select {
  position: absolute;
  inset: 22px 0 0;
  width: 100%;
  min-height: 46px;
  opacity: 0;
  outline: none;
}

.zone-picker:focus-within .zone-display {
  border-color: rgba(191, 232, 207, 0.72);
  box-shadow: 0 0 0 3px rgba(191, 232, 207, 0.14);
}

.zone-picker option,
.zone-picker optgroup {
  color: var(--ink);
  background: var(--surface);
}

.sync-state {
  flex: 0 0 auto;
  gap: 8px;
  white-space: nowrap;
}

.sync-state span {
  width: 9px;
  height: 9px;
  background: var(--mint);
  border-radius: 999px;
  box-shadow: 0 0 0 5px rgba(191, 232, 207, 0.14);
}

.sync-state.offline span {
  background: var(--coral);
}

.now-strip {
  justify-content: space-between;
  gap: 10px;
  margin: 14px 0;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.now-strip div {
  display: grid;
  gap: 2px;
}

.now-strip div:last-child {
  text-align: right;
}

.now-strip span,
.time-row p {
  color: var(--muted);
}

.now-strip strong {
  font-size: 1rem;
}

.tool-card,
.qibla-card {
  margin-bottom: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.tool-sheet .tool-card,
.tool-sheet .qibla-card {
  margin-bottom: 0;
}

.tool-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px;
}

.tool-card div,
.qibla-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.tool-card span,
.qibla-copy span,
.qibla-actions span {
  color: var(--muted);
  font-size: 0.78rem;
}

.tool-card strong,
.qibla-copy strong {
  color: var(--deep);
  font-size: 1rem;
}

.tool-card p,
.qibla-copy p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.toggle-button,
.tool-button {
  min-height: 42px;
  color: #fbfff9;
  background: var(--deep);
  border: 0;
  border-radius: 8px;
  font-weight: 900;
}

.toggle-button {
  width: 58px;
  flex: 0 0 auto;
}

.toggle-button.active {
  color: var(--deep);
  background: var(--mint);
}

.qibla-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  padding: 14px;
}

.qibla-copy {
  align-self: center;
}

.qibla-compass {
  position: relative;
  display: grid;
  place-items: center;
}

.qibla-compass::after {
  content: 'Kiblat';
  position: absolute;
  top: -12px;
  left: 50%;
  padding: 3px 8px;
  transform: translateX(-50%);
  color: #fbfff9;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  background: var(--deep);
  border-radius: 999px;
  box-shadow: 0 6px 16px rgba(12, 48, 42, 0.2);
}

.compass-ring {
  position: relative;
  width: 126px;
  aspect-ratio: 1;
  color: var(--deep);
  background:
    radial-gradient(circle, var(--surface) 54%, transparent 55%),
    conic-gradient(from 45deg, rgba(191, 232, 207, 0.72), rgba(232, 184, 91, 0.85), rgba(216, 111, 88, 0.62), rgba(191, 232, 207, 0.72));
  border: 1px solid var(--line);
  border-radius: 50%;
}

.compass-ring span {
  position: absolute;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
}

.compass-ring span:nth-child(1) {
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
}

.compass-ring span:nth-child(2) {
  top: 50%;
  right: 10px;
  transform: translateY(-50%);
}

.compass-ring span:nth-child(3) {
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
}

.compass-ring span:nth-child(4) {
  top: 50%;
  left: 10px;
  transform: translateY(-50%);
}

.qibla-needle {
  position: absolute;
  inset: 12px;
  transform: rotate(var(--qibla));
  transition: transform 180ms ease-out;
  filter: drop-shadow(0 10px 14px rgba(12, 48, 42, 0.16));
}

.qibla-needle::before {
  content: '';
  position: absolute;
  top: 2px;
  left: 50%;
  width: 18px;
  height: 74px;
  transform: translateX(-50%);
  clip-path: polygon(50% 0, 100% 30%, 70% 30%, 70% 100%, 30% 100%, 30% 30%, 0 30%);
  background: linear-gradient(180deg, #ff9e7d 0%, var(--coral) 48%, #b24f3f 100%);
}

.qibla-needle::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  transform: translate(-50%, -50%);
  background: var(--deep);
  border: 3px solid var(--surface);
  border-radius: 50%;
}

.qibla-actions {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(120px, 1fr) auto;
  align-items: center;
  gap: 10px;
}

.tool-button {
  padding: 0 16px;
}

.tasbih-panel,
.tasbih-list {
  display: grid;
  gap: 12px;
}

.tasbih-panel {
  min-height: min(72vh, 720px);
  grid-template-rows: minmax(0, 1fr) auto auto;
}

.tasbih-counter-wrap {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 18px;
}

.tasbih-copy {
  display: grid;
  gap: 4px;
  justify-items: center;
  text-align: center;
}

.tasbih-copy span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.tasbih-copy strong {
  color: var(--deep);
  font-size: clamp(1.5rem, 5vw, 2rem);
}

.tasbih-copy p {
  margin: 0;
  color: var(--muted);
}

.tasbih-create {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  margin-bottom: 14px;
}

.tasbih-field {
  display: grid;
  gap: 6px;
}

.tasbih-field span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.tasbih-field input {
  min-height: 46px;
  padding: 0 14px;
  color: var(--ink);
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.tasbih-submit {
  min-width: 108px;
}

.tasbih-empty {
  align-self: center;
  margin: auto 0;
}

.tasbih-count-button {
  display: grid;
  width: min(100%, 320px);
  aspect-ratio: 1;
  place-items: center;
  padding: 24px;
  color: #fbfff9;
  background:
    radial-gradient(circle at 30% 30%, rgba(255, 255, 255, 0.22), transparent 28%),
    linear-gradient(180deg, var(--deep), var(--deep-2));
  border: 0;
  border-radius: 50%;
  box-shadow: 0 24px 48px rgba(12, 48, 42, 0.22);
}

.tasbih-count-button span {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.tasbih-count-button strong {
  font-size: clamp(3rem, 14vw, 5.5rem);
  line-height: 1;
}

.tasbih-bottom-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 10px;
}

.tasbih-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
}

.tasbih-item.active {
  border-color: rgba(11, 59, 51, 0.28);
  background: linear-gradient(135deg, #fffdf8, #ecf8ef);
  box-shadow: 0 10px 24px rgba(16, 35, 31, 0.08);
}

.tasbih-select,
.tasbih-delete {
  border: 0;
  border-radius: 10px;
}

.tasbih-select {
  display: grid;
  justify-items: start;
  gap: 4px;
  padding: 10px 12px;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.tasbih-select strong {
  font-size: 0.98rem;
}

.tasbih-select span {
  color: var(--muted);
  font-size: 0.82rem;
}

.tasbih-delete {
  align-self: center;
  min-height: 42px;
  padding: 0 12px;
  color: var(--coral);
  background: rgba(216, 111, 88, 0.12);
  font-weight: 700;
}

.tasbih-settings-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.tasbih-settings-title {
  margin-bottom: 0;
}

.tasbih-settings-title h3 {
  margin: 0;
  color: var(--deep);
  font-size: 1rem;
}

.bottom-dock {
  position: fixed;
  left: 50%;
  bottom: 0;
  width: min(100%, 620px);
  transform: translateX(-50%);
  z-index: 8;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 8px 12px calc(10px + env(safe-area-inset-bottom));
  background: rgba(255, 253, 248, 0.98);
  border: 1px solid rgba(16, 35, 31, 0.08);
  border-bottom: 0;
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -8px 30px rgba(12, 48, 42, 0.12);
  backdrop-filter: blur(16px);
}

.dock-button {
  display: grid;
  min-height: 62px;
  justify-items: center;
  place-items: center;
  gap: 5px;
  padding: 8px 6px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 14px;
  transition: background-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.dock-button.active,
.dock-button:focus-visible {
  color: var(--deep);
  background: rgba(191, 232, 207, 0.34);
  outline: none;
}

.dock-button:active {
  transform: translateY(1px);
}

.dock-icon {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
}

.dock-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.dock-button strong {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.tool-overlay {
  position: fixed;
  inset: 0;
  z-index: 12;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(16, 35, 31, 0.42);
}

.tool-sheet {
  width: min(100%, 560px);
  margin: 0 auto;
  padding: 12px 14px 14px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  max-height: min(80vh, 720px);
  overflow: auto;
}

.sheet-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.sheet-title-row h2 {
  margin: 0;
  color: var(--deep);
  font-size: 1.12rem;
}

.sheet-icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: var(--deep);
  background: var(--surface-strong);
  border: 0;
  border-radius: 8px;
  font-size: 1.3rem;
  line-height: 1;
}

.schedule-list {
  display: grid;
  gap: 10px;
}

.time-row {
  min-height: 76px;
  gap: 13px;
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.time-row.active {
  background: linear-gradient(135deg, #fffdf8, #ecf8ef);
  border-color: rgba(11, 59, 51, 0.28);
  box-shadow: 0 12px 30px rgba(16, 35, 31, 0.08);
}

.time-row.past:not(.active) {
  opacity: 0.58;
}

.time-code {
  display: grid;
  width: 45px;
  height: 45px;
  flex: 0 0 auto;
  place-items: center;
  color: var(--deep);
  background: var(--surface-strong);
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 900;
}

.time-row h2 {
  margin: 0 0 3px;
  font-size: 1.05rem;
  letter-spacing: 0;
}

.time-row time {
  margin-left: auto;
  color: var(--deep);
  font-size: 1.18rem;
  font-weight: 900;
}

.message {
  margin-top: 16px;
  color: rgba(251, 255, 249, 0.76);
}

.install-overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  align-items: end;
  padding: 16px;
  background: rgba(16, 35, 31, 0.42);
}

.install-sheet {
  width: min(100%, 520px);
  margin: 0 auto;
  padding: 12px 16px 16px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.sheet-handle {
  width: 42px;
  height: 4px;
  margin: 0 auto 14px;
  background: rgba(16, 35, 31, 0.18);
  border-radius: 999px;
}

.install-sheet h2 {
  margin: 0 0 10px;
  font-size: 1.15rem;
}

.install-sheet ol {
  display: grid;
  gap: 8px;
  margin: 0 0 16px;
  padding-left: 22px;
  color: var(--muted);
}

.sheet-button {
  width: 100%;
  min-height: 46px;
  color: #fbfff9;
  background: var(--deep);
  border: 0;
  border-radius: 8px;
  font-weight: 800;
}

.skeleton {
  overflow: hidden;
  position: relative;
  background: rgba(255, 255, 255, 0.14);
  border-radius: 8px;
}

.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  animation: shimmer 1.4s infinite;
}

.hero-loading .title {
  width: 72%;
  height: 88px;
  margin-top: 62px;
}

.hero-loading .ring {
  width: 170px;
  height: 170px;
  margin: 36px 0 0 auto;
  border-radius: 50%;
}

.hero-loading .row,
.loading-list .list-item {
  height: 64px;
}

.hero-loading .row {
  margin-top: 22px;
}

.loading-list {
  margin-top: 14px;
}

.loading-list .list-item {
  background: rgba(16, 35, 31, 0.08);
}

@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}

@media (min-width: 720px) {
  .shell {
    padding-top: 28px;
  }

  .hero {
    min-height: 520px;
    padding: 22px;
  }

  .countdown-wrap {
    bottom: 106px;
  }
}

@media (max-width: 390px) {
  .shell {
    padding-inline: 10px;
  }

  .hero {
    min-height: 455px;
    padding: 14px;
  }

  .brand p {
    font-size: 0.86rem;
  }

  .countdown-wrap {
    bottom: 104px;
  }

  .hero-footer {
    align-items: stretch;
    flex-direction: column;
  }

  .sync-state {
    justify-content: flex-end;
  }

  .tasbih-create,
  .tasbih-item {
    grid-template-columns: 1fr;
  }

  .tasbih-bottom-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .tasbih-count-button,
  .tasbih-submit,
  .tasbih-delete {
    width: 100%;
  }
}