@import url("https://fonts.googleapis.com/css2?family=Amiri+Quran&family=Noto+Naskh+Arabic:wght@400;500;600;700&display=swap");

:root {
  --deep-pine: #1A4314;
  --pine-2: #245C1B;
  --ivory: #FDFBF7;
  --ivory-2: #F6F0E4;
  --gold: #D4AF37;
  --gold-soft: rgba(212, 175, 55, .22);
  --ink: #162111;
  --muted: #6d7667;
  --border: rgba(26, 67, 20, .14);
  --shadow: 0 12px 30px rgba(26, 67, 20, .12);
  --radius-lg: 24px;
  --radius-md: 18px;
  --font-arabic-size: 1.75rem;
  --font-arabic: "Amiri Quran", "Noto Naskh Arabic", "Traditional Arabic", "Scheherazade New", serif;
}

* { box-sizing: border-box; }
html { background: var(--deep-pine); }
body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: radial-gradient(circle at top, rgba(212, 175, 55, .20), transparent 34%), var(--deep-pine);
}
button, input, select { font: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }

.splash {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  color: var(--ivory);
  background: linear-gradient(160deg, #0f2b0c, var(--deep-pine));
  transition: opacity .55s ease, visibility .55s ease;
}
.splash.hide { opacity: 0; visibility: hidden; }
.splash-logo {
  width: 132px;
  height: 132px;
  object-fit: contain;
  border-radius: 50%;
  background: white;
  padding: 8px;
  box-shadow: 0 16px 40px rgba(0,0,0,.22);
}
.splash-title { font-size: 1.45rem; font-weight: 800; letter-spacing: .02em; }
.splash-subtitle { opacity: .82; font-size: .92rem; }

.app-shell {
  position: relative;
  max-width: 720px;
  min-height: 100vh;
  margin: 0 auto;
  background: var(--ivory);
  overflow-x: hidden;
  box-shadow: 0 0 0 1px rgba(255,255,255,.10), 0 0 60px rgba(0,0,0,.26);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 98px;
  padding: calc(12px + env(safe-area-inset-top)) 20px 14px;
  background: rgba(253, 251, 247, .94);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-logo { width: 80px; height: 80px; border-radius: 50%; object-fit: contain; background: transparent; border: 0; }
.brand h1 { margin: 0; font-size: 0.6rem; line-height: 1.1; color: var(--deep-pine); }
.brand p { margin: 3px 0 0; font-size: .74rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.content {
  min-height: calc(100vh - 128px);
  padding: 16px 16px calc(86px + env(safe-area-inset-bottom));
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  z-index: 30;
  width: min(720px, 100%);
  height: calc(56px + env(safe-area-inset-bottom));
  padding: 4px 10px calc(4px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  background: rgba(253, 251, 247, .96);
  border-top: 1px solid var(--border);
  backdrop-filter: blur(14px);
}
.nav-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 16px;
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 48px;
  font-size: .70rem;
  line-height: 1.1;
}
.nav-icon { font-size: 1.05rem; line-height: 1; }
.nav-btn.active { background: rgba(26, 67, 20, .10); color: var(--deep-pine); font-weight: 750; }

.card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.hero {
  position: relative;
  overflow: hidden;
  padding: 20px;
  color: var(--ivory);
  background: linear-gradient(145deg, var(--deep-pine), #2d6a23);
}
.hero:after {
  content: "";
  position: absolute;
  right: -70px;
  top: -70px;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  border: 34px solid rgba(212, 175, 55, .17);
}
.hero h2 { margin: 0 0 8px; font-size: 1.35rem; }
.hero p { margin: 0; opacity: .86; line-height: 1.55; }
.clock-row { margin-top: 14px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.clock { font-size: 1.45rem; font-weight: 800; letter-spacing: .02em; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: max-content;
  max-width: 100%;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: var(--deep-pine);
  font-size: .78rem;
  font-weight: 700;
}
.hero .badge { background: rgba(255,255,255,.14); color: var(--ivory); border: 1px solid rgba(255,255,255,.18); }

.primary-btn, .secondary-btn, .ghost-btn, .chip, .icon-btn {
  border: 0;
  border-radius: 999px;
  min-height: 36px;
  padding: 10px 16px;
  font-weight: 760;
}
.primary-btn { color: var(--ivory); background: var(--deep-pine); box-shadow: 0 10px 20px rgba(26, 67, 20, .20); }
.secondary-btn { color: var(--deep-pine); background: var(--ivory-2); border: 1px solid var(--border); }
.ghost-btn { color: var(--deep-pine); background: rgba(26, 67, 20, .08); }
.icon-btn { color: var(--deep-pine); background: rgba(212, 175, 55, .20); min-width: 36px; padding-inline: 12px; }
.hero .primary-btn { background: var(--gold); color: #1b250d; }

.section-title { margin: 22px 2px 12px; color: var(--deep-pine); font-size: 1.05rem; }
.grid { display: grid; gap: 12px; }
.two-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.category-strip { display: flex; gap: 8px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: none; }
.category-strip::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; background: white; color: var(--deep-pine); border: 1px solid var(--border); box-shadow: 0 4px 10px rgba(26,67,20,.07); }
.chip.active { background: var(--deep-pine); color: var(--ivory); }

.menu-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px;
  text-align: left;
  width: 100%;
  color: var(--ink);
  background: white;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 8px 18px rgba(26, 67, 20, .08);
}
.menu-card .mark {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  color: var(--deep-pine);
  background: var(--gold-soft);
  font-weight: 400;
}
.menu-card h3 { margin: 0; font-size: .95rem; color: var(--deep-pine); line-height: 1.3; }
.menu-card p { margin: 4px 0 0; color: var(--muted); font-size: .80rem; line-height: 1.4; }

.toolbar, .reader-head {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}
.reader-head { position: sticky; top: 73px; z-index: 10; padding: 12px; background: rgba(253,251,247,.96); border: 1px solid var(--border); border-radius: var(--radius-lg); backdrop-filter: blur(12px); }
.field { display: grid; gap: 6px; }
.field label { color: var(--deep-pine); font-size: 1rem; font-weight: 800; line-height: 1.4; }
.field input, .field select {
  width: 100%;
  min-height: 22px;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 10px 12px;
  background: #fff;
  color: var(--ink);
}
.font-row { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px; }
input[type="range"] { accent-color: var(--deep-pine); }

.prayer-card { padding: 16px; }
.prayer-card + .prayer-card { margin-top: 12px; }
.prayer-meta { display: flex; justify-content: space-between; gap: 8px; align-items: center; margin-bottom: 10px; }
.prayer-num {
  min-width: 30px;
  height: 30px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--gold-soft);
  color: var(--deep-pine);
  font-weight: 400;
}
.arabic {
  direction: rtl;
  text-align: right;
  font-family: var(--font-arabic);
  font-size: var(--font-arabic-size);
  line-height: 2.25;
  color: var(--deep-pine);
  margin: 0;
  white-space: pre-line;
  word-break: normal;
  overflow-wrap: normal;
  letter-spacing: 0;
  font-weight: 400;
  font-kerning: normal;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
.translation {
  margin: 10px 0 0;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  color: #3d4637;
  font-size: .96rem;
  line-height: 1.65;
}
.repeat-tools { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px; }

.tasbih-wrap { display: grid; gap: 16px; }
.counter-card { padding: 22px; text-align: center; }
.counter-label { color: var(--muted); font-weight: 700; margin-bottom: 8px; }
.counter-value { font-size: clamp(4.5rem, 26vw, 8rem); font-weight: 900; color: var(--deep-pine); line-height: 1; }
.counter-target { color: var(--muted); margin-top: 6px; }
.tap-button {
  width: min(260px, 74vw);
  height: min(260px, 74vw);
  min-width: 80px;
  min-height: 80px;
  border-radius: 50%;
  border: 12px solid rgba(212,175,55,.38);
  background: radial-gradient(circle, #317229, var(--deep-pine));
  color: var(--ivory);
  display: grid;
  place-content: center;
  margin: 8px auto;
  box-shadow: 0 20px 50px rgba(26,67,20,.25);
  user-select: none;
}
.tap-button strong { font-size: 1.7rem; }
.tap-button span { opacity: .82; font-size: .85rem; }
.tasbih-controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
}
.switch-row input { width: 22px; height: 22px; accent-color: var(--deep-pine); }

.empty-state { text-align: center; padding: 42px 18px; color: var(--muted); }
.info-list { display: grid; gap: 12px; }
.info-card { padding: 16px; }
.info-card h3 { margin: 0 0 8px; color: var(--deep-pine); }
.info-card p { margin: 0; color: var(--muted); line-height: 1.6; }
a { color: var(--deep-pine); font-weight: 800; }

@media (max-width: 390px) {
  .content { padding-inline: 12px; }
  .two-col { grid-template-columns: 1fr; }
  .brand h1 { font-size: .94rem; }
  .brand p { max-width: 210px; }
  .arabic { line-height: 2.05; }
}

/* Revisi PPSA - header Arab, mode baca, dan jadwal shalat */
.arabic-brand-title,
.arabic-brand-subtitle {
  font-family: var(--font-arabic);
  letter-spacing: 0;
  text-align: right;
}
.splash .arabic-brand-title {
  font-size: clamp(1.8rem, 8vw, 2.6rem);
  line-height: 1.5;
  font-weight: 900;
}
.splash .arabic-brand-subtitle {
  font-size: clamp(1rem, 4.5vw, 1.35rem);
  line-height: 1.7;
  font-weight: 400;
  opacity: .92;
  max-width: min(86vw, 560px);
}
.brand > div { min-width: 0; }
.brand .arabic-brand-title {
  font-size: clamp(1.7rem, 4.8vw, 2.6rem);
  font-weight: 900;
  line-height: 1.15;
  white-space: nowrap;
}

.brand .arabic-brand-subtitle {
  font-size: clamp(1rem, 2.8vw, 1.4rem);
  font-weight: 400;
  line-height: 1.15;
  max-width: 430px;
}

.hero h2 { margin-bottom: 10px; }
.prayer-next {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
  font-size: clamp(1.6rem, 7vw, 2.25rem);
  letter-spacing: .01em;
  line-height: 1.15;
}
.prayer-next-label {
  font-weight: 900;
}
.prayer-next-time {
  font-weight: 400;
}
.prayer-countdown {
  margin-top: 6px !important;
  opacity: .94 !important;
  font-weight: 760;
}
.prayer-location {
  margin-top: 10px !important;
  font-size: .84rem;
  opacity: .82 !important;
}
.hero-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}
.hero .secondary-btn {
  color: var(--ivory);
  background: rgba(255,255,255,.12);
  border: 1px solid rgba(255,255,255,.22);
}
.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: #fff;
}
.segmented button {
  border: 0;
  min-height: 40px;
  border-radius: 14px;
  background: transparent;
  color: var(--deep-pine);
  font-weight: 800;
}
.segmented button.active {
  color: var(--ivory);
  background: var(--deep-pine);
  box-shadow: 0 8px 18px rgba(26, 67, 20, .16);
}
.subsection-label {
  margin: 18px 2px 10px;
  padding: 10px 12px;
  border-right: 4px solid var(--gold);
  border-radius: 16px;
  background: rgba(212,175,55,.12);
  color: var(--deep-pine);
  line-height: 1.45;
}
.subsection-label-split {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}
.subsection-label-id {
  font-size: clamp(1rem, 3.8vw, 1.2rem);
  font-weight: 400;
}
.subsection-label-ar {
  direction: rtl;
  text-align: right;
  font-family: var(--font-arabic);
  font-size: clamp(1.2rem, 5vw, 1.6rem);
  font-weight: 900;
  line-height: 1.6;
}
.prayer-card.arabic-only .translation { display: none; }
.location-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}
.status-line {
  margin-top: 8px !important;
  font-size: .84rem;
  color: var(--muted);
}
.reader-title {
  color: var(--deep-pine);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.4;
}
.reader-subtitle {
  margin-top: -4px;
  color: var(--muted);
  font-size: .82rem;
}
@media (max-width: 390px) {
  .brand-logo { width: 64px; height: 64px; }
  .brand .arabic-brand-title { font-size: 1.45rem; }
  .brand .arabic-brand-subtitle { max-width: 245px; font-size: .9rem; }
  .clock-row { align-items: flex-start; }
  .hero-actions { justify-content: flex-start; }
}

.menu-copy { min-width: 0; display: grid; gap: 4px; text-align: left; }
.menu-arabic {
  font-family: var(--font-arabic);
  font-size: clamp(1.35rem, 4vw, 1.95rem);
  line-height: 1.6;
  color: var(--deep-pine);
}
.menu-meta { margin-top: 2px !important; font-size: .78rem !important; }
.brand-showcase { text-align: center; display: grid; justify-items: center; }
.brand-showcase img { width: 124px !important; height: 124px !important; background: transparent !important; border: 0 !important; padding: 0 !important; }
.showcase-title, .showcase-subtitle { width: 100%; text-align: center !important; color: var(--deep-pine); }
.showcase-title { margin: 14px 0 4px; font-size: clamp(1.9rem, 6vw, 2.9rem); line-height: 1.25; }
.showcase-subtitle { margin: 0; font-size: clamp(1rem, 3vw, 1.35rem); line-height: 1.4; }


/* Revisi v4 */
body.settings-view .topbar { display: none; }
body.settings-view .content { min-height: calc(100vh - 56px); padding-top: 16px; }
.menu-card h3 { font-weight: 400; }
.menu-arabic, .arabic, .arabic-brand-title, .arabic-brand-subtitle {
  font-family: var(--font-arabic);
  font-kerning: normal;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}
.menu-arabic {
  direction: rtl;
  text-align: right;
  font-size: clamp(1.55rem, 4.6vw, 2.2rem);
  line-height: 1.9;
  font-weight: 400;
  color: var(--deep-pine);
  white-space: pre-line;
}
.arabic { font-weight: 400; }
.location-btn {
  position: absolute;
  top: 18px;
  right: 18px;
  z-index: 2;
  width: 46px;
  height: 46px;
  padding: 0;
  border: 1px solid rgba(255,255,255,.28);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--ivory);
  background: rgba(255,255,255,.12);
  font-size: 1.25rem;
  font-weight: 900;
  aspect-ratio: 1 / 1;
}
.suggestion-row {
  margin-top: 18px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--ivory);
  font-size: 1rem;
  line-height: 1.45;
}
.suggestion-row strong { font-weight: 900; }
.mini-open-btn {
  min-height: 34px;
  padding: 6px 14px;
  font-size: .88rem;
  box-shadow: none;
}
.hero .mini-open-btn { background: var(--gold); color: #1b250d; }
@media (max-width: 390px) {
  .location-btn { width: 42px; height: 42px; top: 14px; right: 14px; }
  .suggestion-row { align-items: flex-start; }
}


/* Revisi v6 - samakan rendering Arab dengan cakgup/pagipetang */
.arabic,
.menu-arabic {
  font-family: "Amiri Quran", "Noto Naskh Arabic", "Traditional Arabic", "Scheherazade New", serif !important;
  direction: rtl;
  text-align: right;
  color: var(--deep-pine);
  letter-spacing: 0;
  font-weight: 400 !important;
  font-kerning: normal;
  font-feature-settings: "kern" 1, "liga" 1, "calt" 1;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  white-space: pre-line;
}
.arabic {
  font-size: var(--font-arabic-size);
  line-height: 2.25;
}
.menu-arabic {
  font-size: clamp(1.55rem, 4.6vw, 2.2rem);
  line-height: 1.9;
}
.arabic-brand-title,
.arabic-brand-subtitle {
  font-family: "Amiri Quran", "Noto Naskh Arabic", "Traditional Arabic", "Scheherazade New", serif !important;
}
@media (max-width: 390px) {
  .arabic { line-height: 2.25; }
}

/* Revisi v7 - header, daftar doa, dan footer info */
.topbar {
  min-height: 128px;
  padding: calc(16px + env(safe-area-inset-top)) 22px 18px;
  overflow: visible;
}
.brand {
  align-items: center;
  gap: 18px;
  overflow: visible;
}
.brand-logo {
  width: 96px;
  height: 96px;
  flex: 0 0 96px;
}
.brand > div {
  min-width: 0;
  overflow: visible;
}
.brand .arabic-brand-title {
  font-size: clamp(2.15rem, 5vw, 3rem);
  line-height: 1.25;
  margin-bottom: 2px;
}
.brand .arabic-brand-subtitle {
  font-size: clamp(.82rem, 2.05vw, 1.08rem);
  line-height: 1.9;
  max-width: 100%;
  overflow: visible;
  white-space: normal;
  text-overflow: clip;
  color: var(--muted);
}
.menu-card {
  align-items: flex-start;
}
.menu-copy {
  width: 100%;
  min-width: 0;
  text-align: left;
}
.menu-arabic {
  display: block;
  width: 100%;
  direction: rtl;
  unicode-bidi: plaintext;
  text-align: left !important;
  margin: 0 0 2px;
  padding: 0;
  font-size: clamp(1.65rem, 4.4vw, 2.25rem);
  line-height: 1.85;
  white-space: normal;
}
.menu-card h3 {
  font-weight: 400;
  font-size: .95rem;
  line-height: 1.35;
}
.menu-meta {
  font-size: .76rem !important;
}
.app-credit {
  margin: 4px 0 16px;
  text-align: center;
  font-size: 12px;
  line-height: 1.4;
  font-weight: 400;
  color: rgba(109, 118, 103, .72);
}
@media (max-width: 390px) {
  .topbar { min-height: 112px; padding-inline: 16px; }
  .brand { gap: 12px; }
  .brand-logo { width: 76px; height: 76px; flex-basis: 76px; }
  .brand .arabic-brand-title { font-size: 1.9rem; line-height: 1.25; }
  .brand .arabic-brand-subtitle { font-size: .76rem; line-height: 1.85; }
  .menu-arabic { font-size: 1.55rem; line-height: 1.85; }
}

/* Revisi v8 - profil, donasi, dan tombol info */
.profile-hero {
  position: relative;
}
.info-bubble-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--deep-pine);
  color: var(--ivory);
  font-size: 0.6rem;
  font-weight: 400;
  box-shadow: 0 6px 14px rgba(26,67,20,.16);
  line-height: 1;
}
.donation-card p + .donation-row { margin-top: 12px; }
.donation-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.donation-account {
  display: inline-flex;
  align-items: center;
  padding: 10px 14px;
  border-radius: 16px;
  background: var(--ivory-2);
  color: var(--deep-pine);
  font-size: 1rem;
  letter-spacing: .03em;
  word-break: break-all;
}
.profile-page {
  display: grid;
  gap: 12px;
}
.profile-card {
  padding: 16px;
}
.profile-card h2,
.profile-card h3 {
  margin: 0 0 8px;
  color: var(--deep-pine);
}
.profile-card p {
  margin: 0;
  color: #3d4637;
  line-height: 1.7;
}
.profile-card p + p { margin-top: 10px; }
.profile-header {
  display: grid;
  gap: 12px;
}
.back-btn {
  justify-self: start;
}
@media (min-width: 480px) {
  .profile-header {
    grid-template-columns: auto 1fr;
    align-items: start;
  }
}
