/* Indo-Pak highlights and original scan share one proportional surface. */
.tr-indo-sheet {
  position: relative;
  width: calc(min(100%, var(--tr-indo-render-width, 100%)) * var(--ap-study-zoom, 1));
  aspect-ratio: var(--ap-indo-ratio, .714);
  margin-inline: auto;
}
.ap-android-reader .tr-indo-sheet > .tr-indo-page {
  display: block;
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
}
.tr-indo-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.tr-indo-overlay .tr-focus-polygon {
  fill: #53aa742f;
  stroke: #3884608a;
  stroke-width: 1;
  filter: none;
}
.tr-indo-overlay .tr-focus-neutral { fill: transparent; stroke: #9a762e; }
.tr-indo-overlay .tr-indo-line-focus { stroke-dasharray: 3 2; }
.tr-indo-overlay .tr-indo-current-word {
  fill: #eab73550;
  stroke: #b4811b;
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
}

.ap-transport-icon { display: none; }
.ap-reader-selectors .ap-edition-selector {
  display: grid;
  gap: 4px;
  min-width: 0;
  color: #476b58;
  font-size: 11px;
  font-weight: 800;
}
@media (max-width: 720px) {
  .ap-reader-selectors .ap-edition-selector { grid-column: 1 / -1; }
}
@media (max-width: 450px) {
  .ap-reader-selectors .ap-edition-selector { font-size: 10px; }
}

@media (min-width: 1280px) {
  html:has(.ap-desktop-reader) { overflow: hidden; }

  .shell:has(.ap-desktop-reader) {
    --ap-desktop-gutter: clamp(18px, 1.55vw, 27px);
    --ap-desktop-sidebar: 234px;
    grid-template-columns: var(--ap-desktop-sidebar) minmax(0, 1fr);
    height: 100dvh;
    min-height: 0;
    overflow: hidden;
    background: #f7f7f1;
  }
  .shell:has(.ap-desktop-reader) { grid-template-rows: minmax(0, 1fr); }
  .shell.desktop-sidebar-closed:has(.ap-desktop-reader) { grid-template-columns: 0 minmax(0, 1fr); }
  .ap-quran-focus .shell:has(.ap-desktop-reader) { grid-template-columns: minmax(0, 1fr) !important; }
  .shell:has(.ap-desktop-reader) > .sidebar { grid-area: 1 / 1; }
  .shell:has(.ap-desktop-reader) > .main-area { grid-area: 1 / 2; }
  .ap-quran-focus .shell:has(.ap-desktop-reader) > .main-area { grid-column: 1; }

  .shell:has(.ap-desktop-reader) .sidebar {
    height: 100%;
    padding: 27px 19px 18px;
    background: linear-gradient(159deg, #103e33, #102e27);
  }
  .shell:has(.ap-desktop-reader) .sidebar::after,
  .shell:has(.ap-desktop-reader) .sidebar-label,
  .shell:has(.ap-desktop-reader) .sidebar-bottom,
  .shell:has(.ap-desktop-reader) .studio-read-settings,
  .shell:has(.ap-desktop-reader) .brand small { display: none; }

  .shell:has(.ap-desktop-reader) .brand {
    margin: 0 0 17px;
    padding: 0 1px 28px;
    border-bottom: 1px solid #dbe9df25;
  }
  .shell:has(.ap-desktop-reader) .brand img { width: 47px; height: 47px; }
  .shell:has(.ap-desktop-reader) .brand strong { font-size: 23px; line-height: 1.02; letter-spacing: -.45px; }
  .shell:has(.ap-desktop-reader) .nav-group { gap: 6px; margin-bottom: 6px; }
  .shell:has(.ap-desktop-reader) .nav-item { min-height: 48px; padding: 9px 13px; line-height: 1.25; }
  .shell:has(.ap-desktop-reader) .nav-item.active { color: #19382e; background: #e5c984; box-shadow: none; }
  .shell:has(.ap-desktop-reader) .sidebar .tr-drawer-close {
    order: 1;
    margin: auto 0 0;
    padding: 13px 9px 4px;
    border: 0;
    border-top: 1px solid #dbe9df25;
    border-radius: 0;
    text-align: left;
    background: transparent;
    color: #d1e2d7;
    box-shadow: none;
  }

  .shell:has(.ap-desktop-reader) .main-area {
    min-width: 0;
    min-height: 0;
    display: grid;
    grid-template-rows: 70px minmax(0, 1fr);
  }
  .ap-quran-focus .shell:has(.ap-desktop-reader) .main-area { grid-template-rows: minmax(0, 1fr); }
  .shell:has(.ap-desktop-reader) .topbar {
    height: 70px;
    gap: 12px;
    padding-inline: var(--ap-desktop-gutter);
    border-color: #dee4d9;
    background: #fffefa;
    box-shadow: none;
  }
  .shell:has(.ap-desktop-reader) .breadcrumb { font-size: 0; }
  .shell:has(.ap-desktop-reader) .breadcrumb strong {
    color: #19382f;
    font-size: 23px;
    font-weight: 750;
    letter-spacing: -.55px;
  }
  .shell:has(.ap-desktop-reader) .topbar .status-chip { display: none; }
  .shell:has(.ap-desktop-reader) .topbar .menu-button { width: 38px; height: 38px; border-radius: 8px; }
  .shell:has(.ap-desktop-reader) .topbar .search-spot,
  .shell:has(.ap-desktop-reader) .topbar .btn.small {
    min-height: 38px;
    border-radius: 8px;
  }
  .shell:has(.ap-desktop-reader) .topbar .btn.small {
    color: #19382f;
    background: #fffefa;
    border: 1px solid #cddbd2;
    box-shadow: none;
  }
  body:has(.ap-desktop-reader) .main-area > .content {
    display: flex;
    flex-direction: column;
    width: 100%;
    min-width: 0;
    min-height: 0;
    max-width: none !important;
    margin: 0;
    padding: 0 !important;
  }
  .content:has(> .ap-desktop-reader) > .app-footer { display: none; }

  .ap-desktop-reader {
    display: grid;
    flex: 1;
    grid-template-rows: 67px minmax(0, 1fr) auto;
    min-height: 0;
  }
  .ap-desktop-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding-inline: var(--ap-desktop-gutter);
  }
  .ap-desktop-selection, .ap-desktop-view {
    display: flex;
    align-items: center;
    min-width: 0;
    gap: 10px;
  }
  .ap-desktop-toolbar .ap-btn, .ap-desktop-toolbar .ap-surah-selector {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 38px;
    padding: 0 10px;
    border: 1px solid #d8e2d8;
    border-radius: 8px;
    background: #fffefa;
    color: #244439;
    font-weight: 650;
    white-space: nowrap;
  }
  .ap-desktop-toolbar .ap-surah-selector { font-size: 12px; }
  .ap-surah-selector select {
    width: min(160px, 14vw);
    min-width: 0;
    padding: 4px 2px;
    border: none;
    background: transparent;
    color: #19382f;
    font-weight: 700;
  }
  .ap-desktop-toolbar .ap-choices {
    gap: 2px;
    padding: 3px;
    background: #ebf0e9;
    border: 1px solid #dce6dc;
    border-radius: 8px;
  }
  .ap-desktop-toolbar .ap-choices .ap-btn {
    min-height: 29px;
    padding-inline: 9px;
    border: none;
    border-radius: 5px;
    background: transparent;
    color: #526b5f;
  }
  .ap-desktop-toolbar .ap-choices .ap-btn.active {
    background: #fffefa;
    color: #174e3c;
    box-shadow: 0 1px 3px #24443920;
  }
  .ap-desktop-toolbar .ap-page-arrows { margin: 0; gap: 4px; }
  .ap-desktop-toolbar .ap-page-state { padding: 0 5px; }
  .ap-desktop-toolbar .ap-page-arrow {
    min-width: 32px;
    height: 33px;
    line-height: 1;
    border-radius: 7px;
  }
  .ap-desktop-toolbar [data-ap="toggle-qfocus"] {
    background: #e8f0e8;
    border-color: #cddfcf;
    color: #1f5b45;
  }
  .ap-focus-icon {
    width: 17px;
    height: 17px;
    stroke: currentColor;
    stroke-width: 1.7;
    stroke-linecap: round;
    fill: none;
  }

  .ap-desktop-reader .ap-study-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) clamp(257px, 19vw, 315px);
    gap: 18px;
    min-height: 0;
    padding: 0 var(--ap-desktop-gutter) 19px;
    align-items: stretch;
  }
  .ap-desktop-reader.ap-focus-mode .ap-study-grid,
  .ap-desktop-reader.ap-study-hidden .ap-study-grid { grid-template-columns: minmax(0, 1fr); }
  .ap-desktop-reader.ap-focus-mode .ap-study-aside,
  .ap-desktop-reader.ap-study-hidden .ap-study-aside { display: none; }
  .ap-desktop-reader .ap-study-center { min-height: 0; }
  .ap-desktop-reader .ap-reader-region {
    --ap-stage-padding: 20px;
    --ap-paper-padding: 18px;
    container-type: size;
    height: 100%;
    min-height: 0;
    padding: 0 !important;
    background: radial-gradient(ellipse at 50% 45%, #f5f2e8, #eeeadd) !important;
    border: 1px solid #e5dfce !important;
    box-shadow: none !important;
  }
  .ap-desktop-reader .ap-reader-region .tr-page,
  body.ap-quran-focus .ap-desktop-reader .ap-reader-region .tr-page {
    box-sizing: border-box;
    display: flex;
    position: relative;
    width: 100%;
    height: 100% !important;
    max-height: none;
    min-height: 0 !important;
    margin: 0;
    padding: var(--ap-stage-padding) !important;
    background: transparent !important;
    border: 0 !important;
    overflow: auto !important;
    scrollbar-gutter: auto;
  }
  .ap-desktop-reader .tr-page > :is(.tr-original-book, .tr-indo-mushaf) {
    --ap-available-width: calc(100cqw - 2 * (var(--ap-stage-padding) + var(--ap-paper-padding) + 1px));
    --ap-available-height: calc(100cqh - 2 * (var(--ap-stage-padding) + var(--ap-paper-padding) + 1px));
    flex: none;
    margin: auto;
    min-width: 0;
    max-width: none;
  }
  .ap-desktop-reader .tr-page > .tr-original-book {
    --ap-art-ratio: .627273;
    width: max-content;
    display: block;
    padding: var(--ap-paper-padding);
    border: 1px solid #dacfad;
    border-radius: 4px;
    outline: 1px solid #e9dfc5;
    outline-offset: -7px;
    background: #fffaf0;
    box-shadow: 0 10px 31px #48391d14, 0 2px 5px #48391d16;
  }
  .ap-desktop-reader .tr-original-book:is([data-tr-mushaf-page="1"], [data-tr-mushaf-page="2"]) { --ap-art-ratio: 1; }
  .ap-desktop-reader .ap-reader-region .tr-original-vp {
    width: calc(min(var(--ap-available-width), var(--ap-available-height) * var(--ap-art-ratio), 720px) * var(--ap-study-zoom)) !important;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }
  .ap-desktop-reader .tr-original-overlay { height: 100%; }
  .ap-desktop-reader .tr-focus-polygon {
    fill: #53aa7428;
    stroke: #3884608a;
    stroke-width: 1;
    filter: none;
  }
  .ap-desktop-reader .tr-page > .tr-indo-mushaf { width: 100%; }
  .ap-desktop-reader .tr-indo-mushaf .tr-pdf-page {
    width: max-content;
    max-width: none;
    min-height: 0;
    margin: 0 auto;
    padding: 0;
    border: 0;
    background: transparent;
    box-shadow: none;
  }
  .ap-desktop-reader .tr-indo-sheet {
    width: calc(min(var(--ap-available-width), 680px) * var(--ap-study-zoom));
    box-shadow: 0 6px 28px #48391d22;
  }
  .ap-desktop-reader.ap-indo-fit .tr-indo-sheet {
    width: min(var(--ap-available-width), var(--ap-available-height) * var(--ap-indo-ratio, .67), 720px);
  }
  .ap-desktop-reader .ap-indo-fit-button[aria-pressed="true"] {
    background: #e8f0e8;
    border-color: #cddfcf;
  }
  .ap-desktop-reader .tr-page:has(.tr-original-book, .tr-indo-mushaf) > .tr-audio-follow,
  .ap-desktop-reader .tr-original-book .tr-mushaf-caption,
  .ap-desktop-reader .tr-indo-mushaf:has(.tr-indo-page.ready) .tr-mushaf-caption { display: none; }

  .ap-desktop-reader .ap-study-aside {
    position: static;
    height: 100%;
    min-height: 0;
    max-height: none;
    border: 1px solid #dce5db;
    border-radius: 15px;
    background: #fffefa;
    box-shadow: none;
  }
  .ap-desktop-reader .ap-study-header {
    align-items: flex-start;
    padding: 16px 16px 12px;
    background: transparent;
    border-bottom: 0;
  }
  .ap-desktop-reader .ap-study-header h2 { margin: 0 0 4px; color: #19382f; font-size: 20px; }
  .ap-desktop-reader .ap-study-dismiss {
    display: block;
    width: 28px;
    height: 28px;
    border: 0;
    color: #547266;
    background: transparent;
    font-size: 22px;
  }
  .ap-desktop-reader .ap-study-tabs {
    padding: 0 12px;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
    background: transparent;
  }
  .ap-desktop-reader .ap-study-tabs button {
    min-height: 38px;
    padding: 3px 0;
    white-space: nowrap;
    border: 0;
    border-bottom: 2px solid transparent;
    border-radius: 0;
    background: transparent;
    color: #546d60;
    font-size: 11px;
  }
  .ap-desktop-reader .ap-study-tabs button.is-active {
    color: #17614b;
    border-bottom-color: #237259;
  }
  .ap-desktop-reader .ap-study-content {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    overflow: auto;
    padding: 13px 14px 9px;
  }
  .ap-desktop-reader .ap-translation-choice {
    display: flex;
    width: max-content;
    margin-bottom: 12px;
    padding: 3px;
    border: 1px solid #dce6dc;
    border-radius: 8px;
    background: #ebf0e9;
  }
  .ap-desktop-reader .ap-translation-choice button {
    flex: none;
    min-width: 61px;
    min-height: 26px;
    white-space: nowrap;
    line-height: 1.2;
    padding: 0 8px;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: #3f5e50;
    font-size: 12px;
  }
  .ap-desktop-reader .ap-translation-choice button.on {
    background: #fffefa;
    color: #174e3c;
    box-shadow: 0 1px 3px #24443920;
  }
  .ap-study-translation { flex: 1; display: flex; flex-direction: column; }
  .ap-study-ayah {
    padding: 9px 10px;
    border-bottom: 1px solid #e7ebe3;
  }
  .ap-study-ayah.is-current {
    border: 1px solid #dde9db;
    border-radius: 8px;
    background: #edf4eb;
  }
  .ap-study-ayah small {
    display: block;
    text-align: left;
    color: #486659;
    font: 700 11px/1.4 Inter, "Segoe UI", system-ui, sans-serif;
  }
  .ap-study-ayah p { margin: 6px 0 2px !important; }
  .ap-study-ayah details { font-size: 12px; color: #486659; }
  .ap-desktop-reader .ap-study-source {
    margin: auto 0 0;
    padding: 9px 0 0;
    background: transparent;
    border: 0;
    border-top: 1px solid #e4e9df;
    border-radius: 0;
    direction: ltr;
    text-align: left;
    font: 500 11px/1.45 Inter, "Segoe UI", system-ui, sans-serif;
  }
  .ap-desktop-reader .ap-study-source span { display: none; }
  .ap-desktop-reader .ap-study-settings-button {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 43px;
    padding: 0 15px;
    border: 0;
    border-top: 1px solid #e4e9df;
    background: #fffefa;
    color: #36594b;
    text-align: left;
    font-size: 12px;
    font-weight: 700;
  }
  .ap-desktop-reader .ap-study-settings-button.is-active { background: #edf4eb; }
  .ap-study-settings-button span { margin-left: auto; }

  .ap-desktop-reader > .ap-bottom-player,
  body.ap-quran-focus .ap-desktop-reader > .ap-bottom-player {
    position: relative !important;
    z-index: 1 !important;
    inset: auto !important;
    display: flex !important;
    flex-direction: column;
    width: 100% !important;
    min-width: 0 !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 0 !important;
    margin: 0 !important;
    gap: 0 !important;
    border: 0 !important;
    border-top: 2px solid #caa762 !important;
    border-radius: 0 !important;
    background: linear-gradient(90deg, #103a31, #133c32 55%, #11372d) !important;
    color: #eff5ed;
    box-shadow: 0 -3px 14px #19382f15 !important;
  }
  .ap-desktop-dock {
    display: grid;
    grid-template-columns: clamp(147px, 12vw, 195px) auto minmax(105px, 1fr) auto;
    gap: clamp(10px, 1.25vw, 22px);
    align-items: center;
    min-height: 88px;
    padding: 0 var(--ap-desktop-gutter);
  }
  .ap-dock-sheikh {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
  }
  .ap-dock-headphones {
    display: grid;
    flex: none;
    place-items: center;
    width: 36px;
    height: 36px;
    border: 1px solid #e2c4774d;
    border-radius: 8px;
    background: #e2c47714;
    color: #efd38e;
  }
  .ap-dock-select { min-width: 0; color: #b2d2c0; font-size: 11px; }
  .ap-dock-select select {
    display: block;
    width: 100%;
    min-height: 28px;
    border: 0;
    padding: 0 5px 0 0;
    color: #fffefa;
    background: transparent;
    text-overflow: ellipsis;
    font-size: 13px;
    font-weight: 700;
  }
  .ap-dock-select option, .ap-dock-actions option { color: #19382f; background: #fffefa; }
  .ap-desktop-reader .ap-player-row {
    gap: 6px;
    min-width: 0;
    padding-left: 10px;
    border-left: 1px solid #c5dbcd33;
  }
  .ap-desktop-reader .ap-player-row .ap-ico {
    width: 32px;
    min-width: 32px;
    height: 38px;
    border-radius: 7px;
    color: #e9f2e9;
    background: transparent;
    border: 0;
  }
  .ap-desktop-reader .ap-player-row .ap-stop-audio {
    color: #e9f2e9 !important;
    background: transparent !important;
    border: 1px solid #c5dbcd45 !important;
    border-radius: 7px !important;
  }
  .ap-desktop-reader .ap-player-row .ap-play {
    width: 79px;
    padding-inline: 3px;
    color: #19352a;
    background: #e5c984;
    font-size: 13px;
    white-space: nowrap;
  }
  .ap-desktop-reader .ap-player-row .ap-mobile-glyph { display: none; }
  .ap-desktop-reader .ap-transport-icon {
    display: block;
    width: 17px;
    height: 17px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.65;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .ap-dock-progress { position: relative; min-width: 0; }
  .ap-dock-timeline {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 7px;
    align-items: center;
    font-size: 11px;
    color: #d0dfd6;
    font-variant-numeric: tabular-nums;
  }
  .ap-dock-timeline input[type="range"] {
    width: 100%;
    min-width: 0;
    accent-color: #e5c984;
    cursor: pointer;
  }
  .ap-dock-status {
    position: absolute;
    clip-path: inset(50%);
    width: 1px;
    height: 1px;
    overflow: hidden;
  }
  .ap-dock-status.ap-dock-notice {
    clip-path: none;
    top: calc(100% + 3px);
    left: 0;
    right: 0;
    width: auto;
    height: auto;
    color: #ffdea5;
    white-space: nowrap;
    text-overflow: ellipsis;
    font-size: 10px;
  }

  .ap-dock-actions, .ap-dock-modes { display: flex; align-items: center; gap: 6px; }
  .ap-dock-modes {
    min-width: 0;
    gap: 2px;
    padding: 3px;
    border: 1px solid #c8e0cf36;
    border-radius: 8px;
    background: #cadae415;
  }
  .ap-dock-modes button {
    min-height: 29px;
    padding: 0 7px;
    border: 0;
    border-radius: 5px;
    color: #e9f2e9;
    background: transparent;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 680;
  }
  .ap-dock-modes button:first-child {
    color: #25473a;
    background: #d7e7db;
  }
  .ap-dock-actions select, .ap-dock-tools {
    min-height: 36px;
    padding: 0 6px;
    border: 1px solid #c5dbcd45;
    border-radius: 7px;
    background: transparent;
    color: #eff5ed;
    font-size: 12px;
  }
  .ap-dock-tools { min-width: 35px; display: grid; place-items: center; }
  .ap-dock-tools[aria-expanded="true"] { background: #ffffff1b; }
  .ap-desktop-reader .ap-bottom-player .ap-expanded {
    max-height: 19dvh;
    overflow: auto;
    padding: 8px var(--ap-desktop-gutter) 11px;
    border-top: 1px solid #c5dbcd45;
  }
  .ap-desktop-reader .ap-expanded :is(.ap-small, span) { color: #d9e9df; }
}
