:root{
    --bg:#F7F8F3; --bg-elevated:#FFFFFF; --ink:#151C18; --ink-soft:#5B6A61;
    --line:#DDE3D6; --brand:#0F6B5C; --brand-soft:#E3EFE9; --gold:#A9782C; --gold-soft:#A9782C22;
    --shadow: 0 1px 2px rgba(15,25,20,.04), 0 10px 26px rgba(15,25,20,.06);
    --radius:18px; --arabic-size:26px; --trans-size:14px;
  }
  html[data-theme="dark"]{
    --bg:#0C1512; --bg-elevated:#121E19; --ink:#EDEFE9; --ink-soft:#8FA79B;
    --line:#1E2C26; --brand:#3FB89B; --brand-soft:#16332A; --gold:#D8B45C; --gold-soft:#D8B45C22;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 14px 30px rgba(0,0,0,.45);
  }
  html[data-theme="amoled"]{
    --bg:#000; --bg-elevated:#000; --ink:#F2F4EF; --ink-soft:#7C9186;
    --line:#242424; --brand:#3FB89B; --brand-soft:#0A1512; --gold:#E0C06B; --gold-soft:#E0C06B22;
    --shadow:none;
  }
  *{box-sizing:border-box;} ::selection{ background:var(--gold-soft); }
  html{ scrollbar-width:none; -ms-overflow-style:none; }
  html::-webkit-scrollbar{ display:none; }
  body{ margin:0; background:var(--bg); color:var(--ink); font-family:'Plus Jakarta Sans',sans-serif; transition:background .3s ease,color .3s ease; min-height:100vh; overflow-x:hidden; }
  body::-webkit-scrollbar{ display:none; }
  .display{ font-family:'Fraunces',serif; }
  button{ font-family:inherit; margin:0; padding:0; border:none; background:none; color:inherit; }

  @keyframes fadeUp{ from{ opacity:0; transform:translateY(8px);} to{ opacity:1; transform:translateY(0);} }
  .fade-in{ animation:fadeUp .35s ease both; }

  .star-mark{ width:1em; height:1em; display:inline-block; }
  .star-mark rect{ fill:currentColor; }

  header{ position:sticky; top:0; z-index:20; background:color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter:blur(10px); border-bottom:1px solid var(--line); }
  .header-inner{ max-width:840px; margin:0 auto; padding:14px 20px; display:flex; align-items:center; justify-content:space-between; gap:10px; }
  .brand{ display:flex; align-items:center; gap:11px; cursor:pointer; background:none; border:none; padding:0; color:var(--ink); }
  .brand-mark{ width:36px; height:36px; color:var(--gold); flex:0 0 auto; }
  .brand-name{ font-family:'Fraunces',serif; font-size:18.5px; font-weight:600; letter-spacing:.2px; text-align:left; }
  .brand-sub{ font-size:10.5px; color:var(--ink-soft); margin-top:-2px; text-align:left; }

  .header-actions{ display:flex; align-items:center; gap:7px; position:relative; }
  .icon-btn{ height:36px; padding:0 11px; border-radius:11px; border:1px solid var(--line); background:var(--bg-elevated); color:var(--ink); display:flex; align-items:center; justify-content:center; gap:6px; cursor:pointer; transition:border-color .2s ease,transform .15s ease; font-size:12px; font-weight:600; }
  .icon-btn:hover{ border-color:var(--gold); }
  .icon-btn svg{ width:16px; height:16px; }
  #themeToggle, #settingsToggle{ width:36px; padding:0; }

  .status-btn{ width:36px; padding:0; position:relative; color:var(--brand); }
  .status-btn.offline{ color:#E5484D; border-color:rgba(229,72,77,.4); background:rgba(229,72,77,.08); }
  .status-popup{
    position:absolute; top:46px; right:0; width:220px; max-width:calc(100vw - 40px); background:var(--bg-elevated);
    border:1px solid var(--line); border-radius:14px; padding:14px; box-shadow:var(--shadow);
    display:none; z-index:30;
  }
  .status-popup.open{ display:block; }
  .status-popup .sp-title{ display:flex; align-items:center; gap:6px; font-weight:700; font-size:13px; margin-bottom:6px; }
  .status-popup .sp-title svg{ width:14px; height:14px; flex-shrink:0; }
  .status-popup.online .sp-title{ color:var(--brand); }
  .status-popup.offline .sp-title{ color:#E5484D; }
  .status-popup .sp-desc{ font-size:12px; color:var(--ink-soft); line-height:1.55; }

  .settings-panel{
    position:absolute; top:46px; right:0; width:250px; background:var(--bg-elevated);
    border:1px solid var(--line); border-radius:16px; padding:16px; box-shadow:var(--shadow);
    display:none; z-index:30;
  }
  .settings-panel.open{ display:block; }
  .settings-row{ margin-bottom:14px; }
  .settings-row:last-child{ margin-bottom:0; }
  .settings-row label{ font-size:11.5px; color:var(--ink-soft); font-weight:600; text-transform:uppercase; letter-spacing:.05em; display:block; margin-bottom:7px; }
  .settings-row select{ width:100%; padding:9px 10px; border-radius:10px; border:1px solid var(--line); background:var(--bg); color:var(--ink); font-family:inherit; font-size:13px; }
  .font-stepper{ display:flex; align-items:center; justify-content:space-between; gap:8px; }
  .font-stepper button{ width:32px; height:32px; border-radius:9px; border:1px solid var(--line); background:var(--bg); color:var(--ink); cursor:pointer; font-size:15px; }
  .settings-row.settings-row-toggle{ display:flex; align-items:center; justify-content:space-between; gap:10px; }
  .settings-row.settings-row-toggle label{ margin-bottom:0; }
  .toggle-switch{ width:42px; height:24px; border-radius:999px; background:var(--line); border:none; position:relative; cursor:pointer; flex:0 0 auto; transition:background .2s ease; }
  .toggle-switch .toggle-knob{ position:absolute; top:3px; left:3px; width:18px; height:18px; border-radius:50%; background:var(--bg-elevated); transition:transform .2s ease; box-shadow:0 1px 2px rgba(0,0,0,.25); }
  .toggle-switch.on{ background:var(--brand); }
  .toggle-switch.on .toggle-knob{ transform:translateX(18px); }
  .font-stepper button:hover{ border-color:var(--gold); }
  .font-stepper span{ font-size:13px; color:var(--ink-soft); }

  main{ max-width:840px; margin:0 auto; padding:26px 20px 90px; }

  .tabs{ display:flex; gap:8px; margin-top:20px; }
  .tab-btn{ border:1px solid var(--line); background:var(--bg-elevated); color:var(--ink-soft); padding:8px 16px; border-radius:999px; font-size:13px; font-weight:600; cursor:pointer; transition:all .15s ease; }
  .tab-btn.active{ background:var(--brand); border-color:var(--brand); color:#fff; }

  .hero{ padding:10px 2px 2px; }
  .hero-eyebrow{ display:inline-flex; align-items:center; gap:8px; font-size:11px; letter-spacing:.14em; text-transform:uppercase; color:var(--gold); font-weight:600; margin-bottom:6px; }
  .hero h1{ font-family:'Fraunces',serif; font-weight:600; font-size:clamp(20px,4.5vw,26px); margin:0 0 5px; line-height:1.15; }
  .hero p{ color:var(--ink-soft); font-size:13px; max-width:48ch; margin:0; }

  .continue-card{ margin-top:18px; display:flex; align-items:center; gap:12px; background:var(--brand-soft); border:1px solid var(--line); border-radius:16px; padding:13px 15px; text-align:left; width:100%; }
  .continue-card button.cc-main-btn{ display:flex; align-items:center; gap:12px; background:none; border:none; padding:0; flex:1; min-width:0; text-align:left; color:var(--ink); cursor:pointer; }
  .continue-card svg{ width:20px; height:20px; color:var(--brand); flex:0 0 auto; }
  .continue-card .cc-text{ flex:1; min-width:0; }
  .continue-card .cc-label{ font-size:10.5px; color:var(--ink-soft); text-transform:uppercase; letter-spacing:.05em; font-weight:600; }
  .continue-card .cc-main{ font-size:14px; font-weight:600; margin-top:1px; }
  .cc-all-link{ background:none; border:none; color:var(--gold); font-size:11.5px; font-weight:600; cursor:pointer; padding:6px; flex:0 0 auto; }

  .prayer-card{ margin-top:18px; background:var(--bg-elevated); border:1px solid var(--line); border-radius:16px; padding:16px; }
  .prayer-head{ display:flex; align-items:center; justify-content:space-between; margin-bottom:10px; }
  .prayer-head-label{ display:flex; align-items:center; gap:7px; font-size:12.5px; font-weight:600; color:var(--ink-soft); text-transform:uppercase; letter-spacing:.04em; }
  .prayer-head-label svg{ width:15px; height:15px; color:var(--gold); }
  .prayer-change{ background:none; border:none; color:var(--gold); font-size:11.5px; font-weight:600; cursor:pointer; padding:0; }
  .prayer-next{ font-size:14.5px; margin-bottom:12px; }
  .prayer-next b{ color:var(--gold); }
  .prayer-times-row{ display:flex; gap:8px; overflow-x:auto; padding-bottom:2px; scrollbar-width:none; -ms-overflow-style:none; }
  .prayer-times-row::-webkit-scrollbar{ display:none; }
  .prayer-pill{ flex:0 0 auto; background:var(--bg); border:1px solid var(--line); border-radius:12px; padding:9px 13px; text-align:center; min-width:64px; }
  .prayer-pill.active{ border-color:var(--gold); background:var(--gold-soft); }
  .prayer-pill .pn{ font-size:10.5px; color:var(--ink-soft); text-transform:uppercase; letter-spacing:.03em; }
  .prayer-pill .pt{ font-size:14px; font-weight:600; margin-top:2px; }
  .location-btn{ width:100%; text-align:center; padding:12px; border-radius:12px; border:1px solid var(--gold); background:var(--gold-soft); color:var(--ink); font-size:13px; font-weight:600; cursor:pointer; margin-bottom:10px; }
  .prayer-manual{ display:flex; gap:8px; }
  .prayer-manual input{ flex:1; padding:11px 13px; border-radius:11px; border:1px solid var(--line); background:var(--bg); color:var(--ink); font-family:inherit; font-size:13px; outline:none; }
  .prayer-manual input:focus{ border-color:var(--brand); }
  .prayer-manual button{ width:42px; border-radius:11px; border:none; background:var(--brand); color:#fff; cursor:pointer; font-size:16px; }
  .prayer-err{ font-size:12.5px; color:var(--ink-soft); text-align:center; padding:6px 0; }

  .search-wrap{ margin-top:18px; position:relative; }
  .search-wrap input{ width:100%; padding:15px 18px 15px 46px; border-radius:15px; border:1px solid var(--line); background:var(--bg-elevated); color:var(--ink); font-size:15px; font-family:inherit; outline:none; transition:border-color .2s ease,box-shadow .2s ease; }
  .search-wrap input:focus{ border-color:var(--brand); box-shadow:0 0 0 4px var(--brand-soft); }
  .search-wrap svg{ position:absolute; left:16px; top:50%; transform:translateY(-50%); width:18px; height:18px; color:var(--ink-soft); }

  .search-ayat-cta{ margin-top:12px; width:100%; text-align:left; padding:13px 15px; border-radius:14px; border:1px dashed var(--gold); background:var(--gold-soft); color:var(--ink); font-size:13.5px; cursor:pointer; }

  .surat-grid, .juz-grid{ display:grid; grid-template-columns:1fr; gap:10px; margin-top:20px; }
  .surat-card, .juz-card, .result-card{ display:flex; align-items:center; gap:14px; background:var(--bg-elevated); border:1px solid var(--line); border-radius:var(--radius); padding:14px 16px; cursor:pointer; box-shadow:var(--shadow); transition:transform .15s ease,border-color .2s ease; text-align:left; color:var(--ink); width:100%; }
  .surat-card:hover, .juz-card:hover, .result-card:hover{ transform:translateY(-2px); border-color:var(--gold); }
  .surat-num, .juz-num{ flex:0 0 auto; width:38px; height:38px; border-radius:50%; border:1px solid var(--line); display:flex; align-items:center; justify-content:center; font-size:13px; font-weight:600; color:var(--brand); }
  .surat-main{ flex:1; min-width:0; }
  .surat-main .nl{ font-weight:600; font-size:15.5px; }
  .surat-main .meta{ font-size:12.5px; color:var(--ink-soft); margin-top:2px; }
  .surat-ar{ font-family:'Amiri',serif; font-size:22px; color:var(--ink); flex:0 0 auto; }
  .juz-grid{ grid-template-columns:repeat(3,1fr); gap:8px; }
  .juz-card{ flex-direction:column; align-items:flex-start; gap:6px; padding:14px; }

  .result-card{ align-items:flex-start; flex-direction:column; gap:6px; }
  .result-meta{ font-size:11.5px; color:var(--gold); font-weight:700; text-transform:uppercase; letter-spacing:.04em; }
  .result-tr{ font-size:13px; color:var(--ink-soft); line-height:1.6; }

  .empty, .loading, .err{ text-align:center; color:var(--ink-soft); padding:50px 10px; font-size:14px; }
  .spinner{ width:34px; height:34px; margin:0 auto 12px; color:var(--gold); animation:spin 1s linear infinite; }
  @keyframes spin{ to{ transform:rotate(360deg); } }

  .back-btn{ display:inline-flex; align-items:center; gap:6px; background:none; border:none; color:var(--ink-soft); font-size:13.5px; cursor:pointer; padding:6px 0; margin-bottom:14px; }
  .back-btn:hover{ color:var(--ink); }
  .back-btn svg{ width:15px; height:15px; }

  .detail-hero{ background:var(--bg-elevated); border:1px solid var(--line); border-radius:22px; padding:26px 22px; text-align:center; position:relative; overflow:hidden; }
  .detail-hero::before, .detail-hero::after{ content:''; position:absolute; width:24px; height:24px; border:1.5px solid var(--gold-soft); opacity:.7; }
  .detail-hero::before{ top:12px; left:12px; border-right:none; border-bottom:none; }
  .detail-hero::after{ bottom:12px; right:12px; border-left:none; border-top:none; }
  .detail-hero .ring{ width:54px; height:54px; margin:0 auto 12px; border-radius:50%; border:1.5px solid var(--gold); display:flex; align-items:center; justify-content:center; font-family:'Fraunces',serif; font-weight:600; color:var(--gold); font-size:17px; }
  .detail-hero h2{ font-family:'Amiri',serif; font-size:32px; margin:0 0 4px; }
  .detail-hero h3{ font-family:'Fraunces',serif; font-weight:600; font-size:18px; margin:0 0 6px; }
  .detail-hero p{ color:var(--ink-soft); font-size:12.5px; margin:0; }
  .detail-hero .desc{ margin-top:12px; font-size:12.5px; color:var(--ink-soft); line-height:1.6; max-width:56ch; margin-left:auto; margin-right:auto; }

  .play-all-btn{ margin-top:16px; display:inline-flex; align-items:center; gap:8px; background:var(--brand); color:#fff; border:none; border-radius:999px; padding:11px 20px; font-size:13.5px; font-weight:600; cursor:pointer; }
  .play-all-btn svg{ width:15px; height:15px; }
  .play-all-btn.stopping{ background:var(--gold); }
  .download-offline-btn{ margin-top:16px; margin-left:8px; display:inline-flex; align-items:center; gap:8px; background:none; color:var(--brand); border:1px solid var(--line); border-radius:999px; padding:11px 20px; font-size:13.5px; font-weight:600; cursor:pointer; }
  .download-offline-btn svg{ width:15px; height:15px; }
  .download-offline-btn.downloading{ opacity:.7; cursor:default; }
  .download-offline-btn.saved{ color:var(--gold); border-color:var(--gold); background:var(--gold-soft); }

  .ayat-list{ margin-top:22px; display:flex; flex-direction:column; gap:14px; }
  .ayat-card{ background:var(--bg-elevated); border:1px solid var(--line); border-radius:18px; padding:20px; box-shadow:var(--shadow); scroll-margin-top:70px; transition:border-color .4s ease; }
  .ayat-card.highlight{ border-color:var(--gold); }
  .ayat-card.now-playing{ border-color:var(--brand); background:var(--brand-soft); }
  .ayat-top{ display:flex; align-items:center; justify-content:space-between; margin-bottom:22px; gap:8px; }
  .ayat-top-left{ display:flex; align-items:center; gap:8px; }
  .ayat-badge{ width:30px; height:30px; border-radius:9px; background:var(--brand-soft); color:var(--brand); font-size:12.5px; font-weight:700; display:flex; align-items:center; justify-content:center; }
  .ayat-actions{ display:flex; gap:5px; }
  .mini-btn{ width:31px; height:31px; border-radius:50%; border:1px solid var(--line); background:var(--bg); color:var(--brand); cursor:pointer; display:flex; align-items:center; justify-content:center; transition:background .2s ease; flex:0 0 auto; }
  .mini-btn:hover{ background:var(--brand-soft); }
  .mini-btn svg{ width:13px; height:13px; }
  .mini-btn.playing{ background:var(--gold-soft); border-color:var(--gold); color:var(--gold); }
  .mini-btn.bookmarked{ background:var(--gold-soft); border-color:var(--gold); color:var(--gold); }

  .ayat-arabic{ font-family:'Amiri',serif; font-size:var(--arabic-size); line-height:2.1; text-align:right; margin-bottom:12px; }
  .ayat-latin{ font-style:italic; color:var(--ink-soft); font-size:calc(var(--trans-size) - 0.5px); line-height:1.7; margin-bottom:8px; }
  .ayat-trans{ font-size:var(--trans-size); line-height:1.7; }
  .tafsir-toggle{ margin-top:12px; background:none; border:none; color:var(--gold); font-size:12.5px; font-weight:600; cursor:pointer; padding:0; display:inline-flex; align-items:center; gap:5px; }
  .tafsir-box{ display:none; margin-top:10px; padding-top:12px; border-top:1px dashed var(--line); font-size:13px; color:var(--ink-soft); line-height:1.75; }
  .tafsir-box.open{ display:block; }

  .surat-nav{ display:flex; gap:10px; margin-top:20px; }
  .surat-nav button{ flex:1; display:flex; align-items:center; gap:8px; background:var(--bg-elevated); border:1px solid var(--line); border-radius:14px; padding:13px 15px; cursor:pointer; color:var(--ink); font-size:12.5px; }
  .surat-nav button:hover{ border-color:var(--gold); }
  .surat-nav .nav-label{ font-size:10px; color:var(--ink-soft); text-transform:uppercase; letter-spacing:.04em; display:block; }
  .surat-nav .nav-name{ font-weight:600; font-size:13.5px; }
  .surat-nav .next{ text-align:right; justify-content:flex-end; margin-left:auto; }
  .surat-nav svg{ width:15px; height:15px; flex:0 0 auto; }

  .juz-ayat{ padding:16px 0; border-bottom:1px solid var(--line); }
  .juz-ayat:last-child{ border-bottom:none; }
  .juz-surah-label{ font-size:11px; color:var(--gold); font-weight:700; text-transform:uppercase; letter-spacing:.05em; margin-bottom:8px; }

  .settings-panel .info-trigger{ background:none; border:none; border-top:1px solid var(--line); color:var(--ink-soft); font-size:12px; cursor:pointer; font-family:inherit; padding:14px 0 0; margin-top:14px; width:100%; text-align:center; }
  .info-trigger{ background:none; border:none; color:var(--ink-soft); font-size:12px; cursor:pointer; font-family:inherit; padding:8px; }
  .info-trigger:hover{ color:var(--gold); }

  .modal-backdrop{ position:fixed; inset:0; background:rgba(0,0,0,.55); backdrop-filter:blur(3px); display:none; align-items:center; justify-content:center; z-index:50; padding:20px; }
  .modal-backdrop.open{ display:flex; }
  .modal-card{ background:var(--bg-elevated); border:1px solid var(--line); border-radius:22px; padding:26px 22px; max-width:380px; width:100%; position:relative; box-shadow:var(--shadow); max-height:80vh; overflow-y:auto; }
  html[data-theme="amoled"] .modal-card{ border-color:var(--gold-soft); }
  .modal-close{ position:absolute; top:14px; right:16px; background:none; border:none; color:var(--ink-soft); font-size:22px; cursor:pointer; line-height:1; }
  .modal-close:hover{ color:var(--ink); }
  .info-sources a{ color:var(--brand); text-decoration:none; }
  .info-sources .credit{ margin-top:10px; padding-top:10px; border-top:1px solid var(--line); }

  .bm-row{ display:flex; align-items:center; gap:10px; padding:11px 0; border-bottom:1px solid var(--line); }
  .bm-row:last-child{ border-bottom:none; }
  .bm-row button.bm-jump{ flex:1; text-align:left; background:none; border:none; color:var(--ink); font-size:13.5px; cursor:pointer; padding:0; }
  .bm-row .bm-jump b{ display:block; font-size:13.5px; }
  .bm-row .bm-jump span{ font-size:11.5px; color:var(--ink-soft); }
  .bm-row .bm-remove{ background:none; border:none; color:var(--ink-soft); cursor:pointer; font-size:18px; padding:4px 8px; }
  .bm-row .bm-remove:hover{ color:#c0392b; }

  .bottom-nav{
    position:fixed; left:0; right:0; bottom:0; z-index:22;
    display:flex; max-width:480px; margin:0 auto;
    background:color-mix(in srgb, var(--bg-elevated) 94%, transparent);
    backdrop-filter:blur(14px);
    border-top:1px solid var(--line); border-left:1px solid var(--line); border-right:1px solid var(--line);
    border-radius:18px 18px 0 0;
    padding-bottom:env(safe-area-inset-bottom, 0px);
  }
  html[data-theme="amoled"] .bottom-nav{ border-color:var(--gold-soft); }
  .bn-item{
    flex:1; display:flex; flex-direction:column; align-items:center; gap:3px; border:none; background:none; cursor:pointer;
    padding:9px 0 8px; color:var(--ink-soft); font-size:10.5px; font-weight:600;
    transition:color .18s ease;
  }
  .bn-item svg{ width:19px; height:19px; flex:0 0 auto; }
  .bn-item.active{ color:var(--brand); }

  .fab-group{ position:fixed; left:50%; transform:translateX(-50%); bottom:64px; display:flex; flex-direction:column; align-items:center; gap:10px; z-index:15; }
  .fab{ width:44px; height:44px; padding:0; margin:0; border-radius:50%; background:var(--bg-elevated); border:1px solid var(--line); box-shadow:0 4px 14px rgba(0,0,0,.18); color:var(--brand); display:flex; align-items:center; justify-content:center; line-height:0; cursor:pointer; opacity:0; pointer-events:none; transform:translateY(8px); transition:opacity .2s ease, transform .2s ease; }
  .fab.show{ opacity:1; pointer-events:auto; transform:translateY(0); }
  .fab svg{ width:18px; height:18px; display:block; flex-shrink:0; }
  .fab svg path{ transform:translateY(1px); }
  .install-fab{ background:var(--gold); border-color:var(--gold); color:#1a1206; width:auto; padding:0 15px; border-radius:999px; font-size:12px; font-weight:600; gap:7px; }
  .install-fab svg{ width:15px; height:15px; }

  .toast{ position:fixed; left:50%; bottom:74px; transform:translateX(-50%) translateY(20px); background:var(--ink); color:var(--bg); font-size:12.5px; font-weight:600; padding:10px 18px; border-radius:999px; opacity:0; pointer-events:none; transition:opacity .2s ease, transform .2s ease; z-index:60; }
  .toast.show{ opacity:1; transform:translateX(-50%) translateY(0); }

  @media (min-width:600px){ .surat-grid{ grid-template-columns:1fr 1fr; } .juz-grid{ grid-template-columns:repeat(5,1fr); } }
