/* فونت اختصاصی نام سوره‌ها */
@font-face {
  font-family: 'surah-name-v1-icon';
  src: url('../surah-name-v1.ttf') format('truetype');
  font-display: swap;
  font-weight: normal;
  font-style: normal;
}
.surah-name-font {
    font-family: 'surah-name-v1-icon', serif;
    font-size: 48px !important; /* اندازه دلخواه */
    line-height: 1.4;
    display: inline-block;
}

@font-face {
  font-family: "Neirizi";
  src: url("../fonts/Neirizi.ttf") format("truetype");
}

@font-face {
  font-family: "Nabi";
  src: url("../fonts/Nabi.ttf") format("truetype");
}

@font-face {
  font-family: "Dana";
  src: url("../fonts/dana-regular.ttf") format("truetype");
}

@font-face {
  font-family: "DIGI RASTIN PLUS CIRCLE";
  src: url("../fonts/DIGI RASTIN PLUS CIRCLE.OTF") format("opentype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IRANYekan";
  src: local("IRANYekan");
}

@font-face {
  font-family: "Vazir";
  src: local("Vazir");
}

@font-face {
  font-family: "IRANSansX";
  src: local("IRANSansX");
}

@font-face {
  font-family: "Moshaf"  
  src: url("../fonts/1771056438Moshaf.ttf") format("truetype");
}

* {
  transition: all 0.2s;
}

:root {
  --background-color: #ffffff;
  --navbar: #d9e6e4;
  --button-hover: #b8d1ce;
  --surah-header: #008775;
  --primary: #abc9c4;
  --text: #000000;
  --divider: #d1e1df;
  --zed: #910013;
  --quran-font: "Neirizi", serif;
  --translation-font: "Nabi", "Dana", sans-serif;
  --verse-size: 20px;
  --side-text: #111111;
  --sidebar-width: 82px;
  --sidebar-height: 100%;
  --note-drawer-width: 380px;
  --nav-height: 80px;
  --content-gap: 10px;
  --content-gutter: calc((var(--sidebar-width) * 2) + (var(--content-gap) * 2));
}

* {
  box-sizing: border-box;
  
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background: var(--background-color);
  color: var(--text);
  font-family: var(--translation-font);
  overflow: hidden;
}

.app-shell {
  width: %100;
  height: 100dvh;
  background: var(--background-color);
  padding: 0 max(10px, env(safe-area-inset-right)) calc(10px + env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  gap: 0;
  overflow: hidden;
  transition: padding-right 0.28s ease;
}

.app-shell.note-open {
  padding-right: calc(var(--note-drawer-width) + 18px);
}

.app-shell.focus-mode {
  padding-right: 10px;
}

.card {
  background: var(--navbar);
  border-radius: 15px;
}

.hidden {
  display: none !important;
}

.search-input {
  flex: 1;
  min-width: 260px;
  min-height: 50%;
  border: none;
  outline: none;
  border-radius: 14px;
  background: transparent;
  color: var(--text);
  font-family: var(--translation-font);
  font-size: 20px;
  padding: 10px 16px;
  pointer-events: auto;
  z-index: 2;
  
}

.search-input:focus {
  border: 1px solid var(--primary);
  border-color: var(--surah-header);
  background: color-mix(in oklab, var(--navbar) 86%, transparent);
}

.icon-btn,
.text-btn,
.primary-btn,
.round-btn {
  border: none;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

.icon-btn {
  width: 60px;
  height: 60px;
  border-radius: 10px;
  background: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-btn img {
  width: 30px;
  height: 30px;
  object-fit: contain;
}

.icon-btn:hover,
.text-btn:hover,
.round-btn:hover {
  background: var(--button-hover);
}

.text-btn {
  border-radius: 12px;
  background: transparent;
  min-width: 80px;
  min-height: 50px;
  color: var(--surah-header);
  font-weight: 700;
  font-family: var(--translation-font);
  font-size: clamp(16px, 1.2vw, 22px);
  padding: 8px 16px;
}
.text-btn img {
  width: 30px;
  height: 30px;
  object-fit: contain;
  vertical-align: middle;
}

.primary-btn {
  border-radius: 12px;
  background: var(--surah-header);
  color: var(--background-color);
  min-height: 44px;
  padding: 8px 22px;
  font-family: var(--translation-font);
  font-size: 16px;
  font-weight: 700;
}

.primary-btn:hover {
  background: var(--primary);
  color: var(--text);
}

.content-main {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr) var(--sidebar-width);
  gap: var(--content-gap);
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

.side-nav {
  padding: 10%;
  height: 100%;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--surah-header) transparent;
}

.side-nav button {
  width: 100%;
  border: none;
  margin-bottom: 4px;
  border-radius: 7px;
  min-height: 30px;
  padding: 5px 4px;
  background: var(--primary);
  color: var(--side-text);
  font-weight: 700;
  font-size: 11px;
  cursor: pointer;
  font-family: var(--translation-font);
  line-height: 1.2;
}

.side-nav button:hover {
  background: var(--button-hover);
}

.center-panel {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.center-tab-bar {
  display: flex;
  gap: 8px;
  align-self: stretch;
}

.tab-btn {
  border: none;
  border-radius: 12px;
  padding: 8px 18px;
  background: color-mix(in srgb, var(--navbar) 70%, transparent);
  color: var(--text);
  font-weight: 700;
  font-family: var(--translation-font);
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.tab-btn.active {
  background: var(--surah-header);
  color: var(--background-color);
}

.center-tab-panels {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tab-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.translation-window-header {
  padding: 12px 14px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--navbar) 82%, transparent);
  border: 1px solid color-mix(in srgb, var(--surah-header) 35%, transparent);
  backdrop-filter: blur(14px);

}

#translationVerseInfo {
  font-size: 15px;
  padding-bottom: 5%;
  font-family: var(--quran-font);
  color: var(--text);
  opacity: 0.85;
}

.translation-window-search {
  background: var(--navbar);
  padding: 8px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.translation-window-search .search-input {
  background: var(--background-color);
  border-radius: 12px;
  font-size: 16px;
}

.translation-window-nav {
  display: flex;
  align-items: center;
  gap: 8px;
  order: -1;
  flex-shrink: 0; 
  padding-left: 10px;
  border-left: 1px dashed var(--divider);
}

.translation-window-nav .text-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--primary) 55%, transparent);
  font-size: 14px;
  font-weight: 700;
  transition:
    transform 0.16s ease,
    box-shadow 0.18s ease;
      min-width: auto;
  padding: 6px 14px;
  font-size: 14px;
}

.translation-window-nav .text-btn:hover {
  background: var(--surah-header);
  color: var(--background-color);
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.18);
}

.translation-window-nav .text-btn:active {
  transform: translateY(0) scale(0.97);
  box-shadow: none;
}

#translationPrevBtn::before {
  content: "";
  width: 0.65em;
  height: 0.65em;
  border-top: 0.12em solid currentColor;
  border-right: 0.12em solid currentColor;
  transform: rotate(45deg);
  margin-left: 0.5em;
  transition: transform 0.18s ease;
}

#translationNextBtn::before {
  content: "";
  width: 0.65em;
  height: 0.65em;
  border-top: 0.12em solid currentColor;
  border-left: 0.12em solid currentColor;
  transform: rotate(-45deg);
  margin-left: 0.5em;
  transition: transform 0.18s ease;
}

#translationPrevBtn:hover::before {
  transform: translateX(0.25em) rotate(45deg);
}

#translationNextBtn:hover::before {
  transform: translateX(-0.25em) rotate(-45deg);
}

.translation-item {
  background: var(--background-color);
  border-radius: 12px;
  padding: 14px 12px;
  margin-bottom: 10px;
  border: 1px solid var(--divider);
}

.translation-header-row {
  padding-bottom: 6px;
  border-bottom: 1px dashed var(--divider);
}

.translation-text {
  font-size: 16px;
  line-height: 2;
  color: var(--text);
}

.translation-window-card {
  background: color-mix(in srgb, var(--navbar) 88%, transparent);
  backdrop-filter: blur(18px);
  border: 1px solid color-mix(in srgb, var(--surah-header) 30%, transparent);
}


.translation-tab-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  background: var(--navbar);
  border-radius: 12px;
}

.translation-tab-verse-info {
  flex: 1;
  font-family: var(--translation-font);
  font-size: 18px;
  line-height: 1.5;
  text-align: right;
}

.translation-tab-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.translation-tab-controls .text-btn,
.translation-tab-controls .primary-btn {
  font-size: 15px;
}

.translation-tab-search {
  width: 100%;
}

.translation-tab-search .search-input {
  width: 100%;
}

.verse-toolbar {
  border-radius: 18px;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  background: rgba(255, 255, 255, 0.22);
  background: color-mix(in srgb, var(--navbar) 85%, transparent);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border: 1px solid color-mix(in srgb, var(--surah-header) 40%, transparent);
  box-shadow: 0 18px 36px -28px rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(16px);
}

.verse-toolbar .toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.verse-toolbar .toolbar-search {
  flex: 1 1 320px;
  min-width: 0;
}

.verse-list-container {
  background: var(--background-color);
  flex: 1;
  position: relative;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}

.verse-scroll-indicator {
  position: absolute;
  top: 8px;
  right: 12px;
  width: 160px;
  padding: 8px 12px;
  background: color-mix(in srgb, var(--navbar) 80%, white);
  border-radius: 14px;
  box-shadow: 0 15px 32px rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-size: 14px;
  font-weight: 700;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.verse-scroll-indicator:not(.hidden) {
  opacity: 1;
  transform: translateY(0);
}

.verse-scroll-indicator.hidden {
  transform: translateY(-4px);
}

.verse-scroll-indicator span {
  display: block;
  text-align: right;
  direction: rtl;
}

.verse-list {
  margin: 0;
  list-style: none;
  padding: 8px clamp(14px, 3vw, 42px);
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--surah-header) var(--navbar);
  position: relative;
}

.verse-list::-webkit-scrollbar {
  width: 18px;
}
.verse-list::-webkit-scrollbar-track {
  background: color-mix(in srgb, var(--navbar) 80%, transparent);
  border-radius: 12px;
  margin: 4px 0;
}
.verse-list::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--surah-header) 60%, var(--navbar));
  border-radius: 12px;
  border: 4px solid var(--background-color);
}
.verse-list::-webkit-scrollbar-thumb:hover {
  background: var(--surah-header);
}

.verse-item,
.header-item {
  margin: 8px 0;
  border-radius: 8px;
}

.verse-item {
  background: var(--background-color);
  color: var(--surah-header);
  padding: 8px 10px;
  font-family: var(--quran-font);
  font-size: var(--verse-size);
  line-height: 1.9;
  cursor: pointer;
  overflow-wrap: anywhere;
  max-width: 100%;
  transition: all 0.2s;
}

.verse-item:hover {
  background: var(--divider);
}

.verse-main-text {
  display: block;
}

.verse-preferred-translation {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--divider);
  color: var(--text);
  font-family: var(--translation-font);
  font-size: clamp(13px, calc(var(--verse-size) * 0.58), 20px);
  line-height: 1.8;
}

.verse-item.selected {
  margin: 0;
  border-radius: 0 0 8px 8px;
  border-right: 3px solid var(--zed);
  padding-right: 24px;
}

.verse-item.rank-top {
  background: #e8f5e8;
}

.verse-item.rank-mid {
  background: #fff9c4;
}

.verse-item.rank-low {
  background: #e3f2fd;
}

.header-item {
  text-align: center;
  pointer-events: none;
}

.header-item[data-type="juz_header"],
.header-item[data-type="page_header"] {
  font-family: "Vazir", "IRANYekan", sans-serif;
  font-size: 12px;
  letter-spacing: 0.16em;
  color: var(--text);
  opacity: 0.85;
}

.header-item[data-type="page_header"] {
  font-size: 13px;
  letter-spacing: 0.08em;
}

.header-item.sura {
  position: sticky;
  top: 0;
  z-index: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Nabi", sans-serif;
  font-size: clamp(20px, 2vw, 26px);
  font-weight: 700;
  min-height: 50px;
  padding: 10px 16px;
  line-height: 1.2;
  color: var(--background-color);
  background: var(--primary);
  border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--primary) 70%, transparent);
  box-shadow: none;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: background 0.24s ease, box-shadow 0.24s ease, border-color 0.24s ease;
  isolation: isolate;
}

.header-item.sura[data-stuck] {
  z-index: 5;
  border-color: color-mix(in srgb, var(--primary) 50%, transparent);
  box-shadow: 0 18px 32px -20px rgba(0, 0, 0, 0.35);
}

.header-item.divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--surah-header);
  font-family: "Vazir", "IRANSansX", sans-serif;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.1em;
}

.header-item.divider::before,
.header-item.divider::after {
  content: "";
  height: 1px;
  background: var(--divider);
  flex: 1;
}

.bottom-nav {
  margin: 0 0 10px;
  min-height: var(--nav-height);
  height: var(--nav-height);
  padding: 6px 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2px;
  margin-inline: auto;
  box-sizing: border-box;
}

.audio-progress {
  height: 6px;
  background: rgba(255, 255, 255, 0.65);
  border-radius: 9px;
  overflow: hidden;
}

.audio-progress span {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--surah-header), var(--primary));
}

.bottom-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.audio-info {
  flex: 1;
  border: 1px solid var(--primary);
  border-radius: 10px;
  padding: 8px 12px;
  color: var(--surah-header);
  text-align: center;
  font-family: "Neirizi", serif;
  font-size: 20px;
  min-height: 50px;
  line-height: 32px;
}

.note-drawer {
  position: fixed;
  top: 10px;
  right: 10px;
  width: var(--note-drawer-width);
  min-width: 300px;
  height: calc(100dvh - 20px);
  background: var(--navbar);
  border-left: 2px solid var(--primary);
  border-radius: 15px;
  padding: 12px;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 8px;
  box-shadow: 0 10px 35px rgba(0, 0, 0, 0.22);
}

.note-header {
  text-align: center;
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
}

.note-verse-info,
.note-selected-translation,
.note-input {
  border-radius: 8px;
  background: var(--background-color);
  color: var(--text);
  border: none;
  padding: 8px;
}

.note-verse-info,
.note-selected-translation {
  font-size: 14px;
  line-height: 1.8;
}

.note-input {
  flex: 1;
  resize: none;
  font-family: var(--translation-font);
  font-size: 15px;
}

.note-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  z-index: 25;
}

.app-shell.focus-mode .content-main {
  grid-template-columns: 1fr;
}

.app-shell.focus-mode .verse-toolbar {
  display: none;
}

.app-shell.focus-mode #juzSidebar,
.app-shell.focus-mode #surahSidebar {
  display: none !important;
}

.app-shell.focus-mode .verse-list {
  padding-inline: clamp(22px, 8vw, 160px);
}

.app-shell.focus-mode .verse-item,
.app-shell.focus-mode .header-item {
  max-width: 1200px;
  margin-inline: auto;
}

.app-shell.focus-mode .verse-item {
  text-align: right;
  pointer-events: auto;
}

.app-shell.focus-mode .header-item.sura {
  text-align: center;
}

.app-shell.focus-mode .verse-list {
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.focus-floating {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 20px;
  display: flex;
  gap: 12px;
  z-index: 45;
}

.round-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--primary);
  display: inline-flex;
  justify-content: center;
  align-items: center;
}

.round-btn img {
  width: 30px;
  height: 30px;
}

.popup-menu {
  position: fixed;
  z-index: 70;
  min-width: 220px;
  max-height: 80vh;
  overflow-y: auto;
  border-radius: 12px;
  background: var(--primary);
  padding: 8px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
}

.popup-menu button {
  width: 100%;
  border: none;
  border-radius: 9px;
  padding: 10px;
  margin-bottom: 6px;
  background: transparent;
  color: var(--text);
  text-align: right;
  cursor: pointer;
  font-family: var(--translation-font);
  font-size: 15px;
  font-weight: 700;
}

.popup-menu button:hover,
.popup-menu button.active {
  background: var(--surah-header);
  color: var(--background-color);
}

.popup-section {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--divider);
}

.popup-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--surah-header);
  text-align: right;
  margin-bottom: 6px;
}

.popup-section-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
  padding-bottom: 6px;
}

.popup-section-grid--surahs {
  max-height: 260px;
}

.popup-section-grid button {
  width: auto;
  flex: 0 0 auto;
  min-width: 92px;
  padding: 6px 10px;
  font-size: 13px;
  border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--surah-header) 40%, transparent);
  background: color-mix(in srgb, var(--navbar) 65%, transparent);
  margin: 0;
  color: var(--text);
}

.popup-section-grid button:hover {
  background: var(--button-hover);
}

.modal {
  border: none;
  border-radius: 14px;
  width: min(980px, 94vw);
  max-height: 90vh;
  overflow: auto;
  background: var(--background-color);
  color: var(--text);
}

.modal::backdrop {
  background: rgba(0, 0, 0, 0.45);
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.settings-grid label {
  display: block;
  font-size: 14px;
  line-height: 1.6;
}

.settings-preview {
  margin-top: 8px;
}

.settings-preview-card {
  border: 1px solid var(--primary);
  border-radius: 16px;
  padding: 16px;
  background: var(--navbar);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settings-preview-label {
  font-weight: 700;
  color: var(--surah-header);
  font-size: 14px;
}

.settings-preview-verse {
  font-family: "Neirizi", serif;
  font-size: 22px;
  line-height: 1.6;
  text-align: center;
}

.settings-preview-translation {
  font-family: var(--translation-font);
  font-size: 16px;
  line-height: 1.6;
  text-align: center;
}

.settings-preview-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 13px;
  color: var(--text);
  justify-content: center;
}

.settings-preview-meta span {
  background: color-mix(in srgb, var(--surah-header) 30%, transparent);
  padding: 4px 8px;
  border-radius: 10px;
}

.modal-content {
  padding: 20px;
}

.modal-content h2 {
  margin-top: 0;
  color: var(--surah-header);
}

.help-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.help-grid section {
  background: var(--navbar);
  border-radius: 12px;
  padding: 12px;
}

.help-grid h3 {
  margin: 0 0 8px;
  color: var(--surah-header);
}

.modal-actions {
  margin-top: 16px;
  display: flex;
  justify-content: flex-end;
}

.image-dialog {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: min(96vw, 1120px);
  min-width: 0;
}

.image-dialog-body {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
  width: 100%;
  min-height: 0;
  min-width: 0;
}

.image-settings,
.image-preview {
  min-width: 0;
}

.image-settings {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.img-group {
  background: var(--navbar);
  border: 1px solid var(--primary);
  border-radius: 12px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.img-group-title {
  font-weight: 700;
  color: var(--surah-header);
}

.img-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
}

.img-row.split {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}

.img-row input,
.img-row select,
.img-textarea {
  border: 1px solid var(--primary);
  border-radius: 10px;
  padding: 8px 10px;
  font-family: var(--translation-font);
  background: var(--background-color);
  color: var(--text);
}

.img-row.checkbox {
  flex-direction: row;
  align-items: center;
  gap: 10px;
}

.img-row.checkbox input {
  width: 18px;
  height: 18px;
}

.img-textarea {
  resize: vertical;
  min-height: 90px;
}

.image-preview {
  background: var(--navbar);
  border-radius: 12px;
  padding: 12px;
  border: 1px solid var(--primary);
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 420px;
}

.image-preview-header {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.preview-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.zoom-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--background-color);
  border: 1px solid var(--primary);
  border-radius: 10px;
  padding: 6px 10px;
}

.zoom-wrap input[type="range"] {
  width: 140px;
}

.image-info {
  background: var(--background-color);
  border: 1px solid var(--primary);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 13px;
  line-height: 1.6;
}

.image-preview-stage {
  flex: 1;
  background: var(--background-color);
  border-radius: 12px;
  border: 1px dashed var(--divider);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: auto;
  padding: 14px;
  min-height: 280px;
}

.image-preview-stage canvas {
  transform-origin: center;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.18);
  border-radius: 6px;
  background: #fff;
}

.image-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.image-actions .primary-btn {
  flex: 1 1 auto;
  min-width: 120px;
}

.toast {
  position: fixed;
  z-index: 90;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surah-header);
  color: var(--background-color);
  border-radius: 10px;
  padding: 10px 16px;
  font-weight: 700;
}

.translation-list,
.ai-result-list {
  max-height: 58vh;
  overflow: auto;
  padding: 8px;
  text-align: right;
  direction: rtl;
}

.translation-window {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 85;
}
.translation-window:not(.hidden) {
  display: flex;
}
.translation-window-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
  z-index: 0;
}
.translation-window-card {
  position: relative;
  z-index: 1;
  width: min(980px, 94vw);
  max-height: 90vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  border-radius: 18px;
  box-shadow: 0 30px 60px rgba(0, 0, 0, 0.35);
}
.translation-window-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.translation-window-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--surah-header);
  margin-bottom: 4px;
}
.translation-window-search .search-input {
  flex: 1;
  min-width: 0;
}

.translation-window-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.translation-window-header-actions .icon-btn {
  width: 44px;
  height: 44px;
}

.translation-window-card .translation-list {
  flex: 1;
  max-height: 100%;
  padding: 0;
}

@media (max-width: 780px) {
  .translation-window-card {
    width: min(96vw, 480px);
    max-height: 90vh;
    padding: 12px;
  }
}

.translation-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.verse-display {
  background: var(--navbar);
  border-radius: 10px;
  padding: 12px;
  line-height: 2;
  font-family: var(--quran-font);
  font-size: 18px;
  text-align: right;
}

.translation-controls {
  display: flex;
  gap: 12px;
  align-items: center;
}

.translation-controls .search-input {
  flex: 1;
  font-size: 16px;
}

.translation-controls .primary-btn {
  white-space: nowrap;
  padding: 10px 16px;
}

.translation-item,
.ai-result-item {
  border-bottom: 1px solid var(--divider);
  padding: 12px 8px;
  line-height: 1.9;
  text-align: right;
  direction: rtl;
  unicode-bidi: plaintext;
}

.translation-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.copy-single-btn {
  background: none;
  border: 1px solid var(--divider);
  border-radius: 6px;
  padding: 4px 8px;
  cursor: pointer;
  color: var(--text);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 4px;
}

.copy-single-btn:hover {
  background: var(--button-hover);
  border-color: var(--primary);
}

.copy-single-btn svg {
  width: 14px;
  height: 14px;
}

.translation-text {
  font-size: 16px;
  line-height: 1.8;
  margin-top: 4px;
  text-align: right;
  direction: rtl;
  unicode-bidi: plaintext;
  font-family: var(--translation-font);
  min-height: 64px;
  white-space: pre-line;
  word-break: break-word;
}

.translation-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.translation-expand-btn {
  align-self: flex-start;
  border: none;
  background: transparent;
  color: var(--surah-header);
  cursor: pointer;
  font-weight: 700;
  padding: 0;
  font-size: 13px;
}

.translation-expand-btn:hover {
  text-decoration: underline;
}

.translation-text:lang(en),
.translation-text:lang(de),
.translation-text:lang(fr),
.translation-text:lang(es),
.translation-text:lang(pt),
.translation-text:lang(it),
.translation-text:lang(ru) {
  text-align: left;
  direction: ltr;
}

.translation-item:last-child,
.ai-result-item:last-child {
  border-bottom: none;
}

.canvas-wrapper {
  background: #fff;
  border: 1px solid var(--divider);
  border-radius: 10px;
  overflow: auto;
  max-height: 55vh;
}

@media (max-width: 980px) {
  .image-dialog-body {
    grid-template-columns: 1fr;
  }

  .image-actions {
    justify-content: stretch;
    flex-direction: column;
  }
}

@media (max-width: 1100px) {
  :root {
    --sidebar-width: 68px;
    --note-drawer-width: min(46vw, 360px);
  }

  .content-main {
    grid-template-columns: var(--sidebar-width) minmax(0, 1fr) var(--sidebar-width);
  }

  .verse-list {
    padding-inline: clamp(10px, 2.6vw, 30px);
  }

  .audio-info {
    font-size: 16px;
  }

  .image-dialog-body {
    grid-template-columns: 1fr;
  }

  .image-preview {
    order: -1;
  }
}

@media (max-width: 980px) {
  :root {
    --sidebar-width: 62px;
    --nav-height: 74px;
  }

  .icon-btn {
    width: 52px;
    height: 52px;
  }

  .icon-btn img {
    width: 26px;
    height: 26px;
  }

  .search-input {
    font-size: 24px;
  }
}

@media (max-width: 820px) {
  :root {
    --sidebar-width: 0;
    --note-drawer-width: min(96vw, 420px);
    --nav-height: 72px;
    --content-gutter: 0;
  }

  .search-input {
    order: 0;
    width: 100%;
    min-width: 0;
    font-size: 20px;
    padding: 8px 12px;
  }

  .icon-btn {
    width: 48px;
    height: 48px;
    border-radius: 10px;
  }

  .icon-btn img {
    width: 24px;
    height: 24px;
  }

  .text-btn {
    min-height: 44px;
    min-width: 68px;
    padding: 6px 10px;
    font-size: 15px;
  }

  .content-main {
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: 1fr;
    grid-template-areas: "center";
    gap: 8px;
    min-height: 0;
    height: 100%;
  }

  #juzSidebar,
  #surahSidebar {
    display: none;
  }

  .center-panel {
    grid-area: center;
    flex: 1;
    min-height: 0;
  }

  .verse-list-container {
    height: 100%;
  }

  .verse-list {
    padding: 8px 12px;
  }

  .verse-toolbar {
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 6px 12px;
    gap: 6px;
    align-items: center;
  }

  .verse-toolbar .toolbar-group {
    flex: 0 0 auto;
    gap: 4px;
  }

  .verse-toolbar .toolbar-group:first-child {
    gap: 6px;
  }

  .verse-toolbar .toolbar-search {
    flex: 1 1 220px;
    min-width: 140px;
    order: 0;
  }

  .verse-toolbar .toolbar-search .search-input {
    width: 100%;
    min-width: 0;
  }

  .verse-toolbar #fontPlusBtn,
  .verse-toolbar #fontMinusBtn {
    display: none;
  }

  .verse-toolbar::-webkit-scrollbar {
    height: 4px;
  }

  .verse-toolbar::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--surah-header) 60%, transparent);
    border-radius: 999px;
  }

  .bottom-nav {
    min-height: auto;
    height: auto;
    padding: 6px 8px;
    gap: 4px;
  }

  .bottom-row {
    flex-wrap: nowrap;
    gap: 6px;
    overflow-x: auto;
    align-items: center;
    justify-content: flex-start;
  }

  .bottom-row #qariBtn,
  .bottom-row #audioInfo {
    display: none;
  }

  .bottom-row .icon-btn,
  .bottom-row .text-btn {
    min-width: 40px;
    min-height: 40px;
  }

  .bottom-row .text-btn {
    font-size: 14px;
  }

  .audio-info {
    order: 2;
    flex: 1 1 180px;
    min-width: 140px;
    font-size: 15px;
    line-height: 1.8;
  }

  .bottom-nav {
    width: 100%;
    margin-inline: 0;
  }

  .help-grid {
    grid-template-columns: 1fr;
  }

  .app-shell.note-open {
    padding-right: 10px;
  }

  .note-drawer {
    right: 0;
    top: 0;
    height: 100dvh;
    width: min(96vw, 480px);
    min-width: min(96vw, 480px);
    border-radius: 0;
  }
}

@media (max-width: 560px) {
  :root {
    --nav-height: 66px;
  }

  .text-btn {
    min-height: 40px;
    min-width: 64px;
    font-size: 14px;
    padding: 6px 8px;
  }

  .audio-info {
    font-size: 14px;
  }

  .verse-item {
    line-height: 1.85;
  }
}
