@charset "UTF-8";

:root {
  --poetry-naskh-font: "Noto Naskh Arabic", "Times New Roman", serif;
  --arabic-text-page: var(--color-surface);
  --arabic-text-card: var(--color-surface);
  --arabic-text-muted-card: var(--color-surface-muted);
  --arabic-text-border: var(--color-border);
  --arabic-text-ink: var(--color-ink);
  --arabic-text-muted: var(--color-muted);
  --arabic-text-primary: var(--color-primary);
  --arabic-text-accent: var(--color-accent);
  --arabic-text-danger: var(--color-danger);
  --arabic-text-success: var(--color-success);
  --arabic-text-shadow: 0 14px 34px rgba(var(--color-primary-rgb), .07);
}

body {
  margin: 0;
  background: var(--arabic-text-page) !important;
  background-image: none !important;
  color: var(--arabic-text-ink);
  font-family: var(--font-body);
  line-height: 1.9;
}

.page {
  width: min(1120px, calc(100% - 32px));
  margin: clamp(18px, 3vw, 34px) auto clamp(38px, 5vw, 68px);
}

.hero,
.tool-card,
.results {
  border: 1px solid var(--arabic-text-border);
  border-radius: 18px;
  background: var(--arabic-text-card);
  box-shadow: var(--arabic-text-shadow);
}

.hero {
  display: grid;
  gap: 10px;
  padding: clamp(22px, 3vw, 34px);
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--color-accent-dark);
  font-family: var(--font-heading);
  font-size: .86rem;
  font-weight: 800;
}

.hero h1 {
  margin: 0;
  color: var(--arabic-text-primary);
  font-family: var(--font-heading);
  font-size: clamp(1.45rem, 3vw, 2.25rem);
  line-height: 1.45;
}

.hero p {
  max-width: 780px;
  margin: 0;
  color: var(--arabic-text-muted);
  font-size: 1.03rem;
}

.tool-card,
.results {
  padding: clamp(18px, 2.5vw, 26px);
  margin-bottom: 16px;
}

label {
  display: block;
  margin-bottom: 8px;
  color: var(--arabic-text-primary);
  font-family: var(--font-heading);
  font-weight: 800;
}

.input-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.input-heading label {
  margin: 0;
}

.character-counter {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 6px 10px;
  border: 1px solid rgba(var(--color-primary-rgb), .16);
  border-radius: 999px;
  padding: 5px 11px;
  background: var(--arabic-text-muted-card);
  color: var(--arabic-text-muted);
  font-family: var(--font-heading);
  font-size: .82rem;
  font-weight: 800;
  line-height: 1.5;
}

.character-counter strong {
  color: var(--arabic-text-primary);
}

.character-counter[data-state="warning"] {
  border-color: rgba(var(--color-accent-rgb), .38);
  background: rgba(var(--color-accent-rgb), .08);
  color: var(--color-accent-dark);
}

.character-counter[data-state="full"] {
  border-color: rgba(var(--color-danger-rgb), .38);
  background: rgba(var(--color-danger-rgb), .07);
  color: var(--arabic-text-danger);
}

.character-counter[data-state="full"] strong {
  color: var(--arabic-text-danger);
}

textarea,
.output-text {
  width: 100%;
  min-height: 230px;
  resize: vertical;
  border: 1px solid var(--arabic-text-border);
  border-radius: 14px;
  padding: 15px 16px;
  outline: none;
  background: var(--arabic-text-card);
  color: var(--arabic-text-ink);
  font: inherit;
  line-height: 1.95;
}

textarea:focus,
.output-text:focus {
  border-color: rgba(var(--color-primary-rgb), .42);
  box-shadow: 0 0 0 4px rgba(var(--color-primary-rgb), .09);
}

.output-text {
  position: relative;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.output-plain {
  display: none;
}

.options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 10px;
  margin: 16px 0;
}

.options label {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 8px;
  margin: 0;
  border: 1px solid var(--arabic-text-border);
  border-radius: 12px;
  padding: 8px 11px;
  background: var(--arabic-text-muted-card);
  color: var(--arabic-text-ink);
  font-family: var(--font-heading);
  font-size: .9rem;
  font-weight: 700;
}

.options input {
  width: 18px;
  height: 18px;
  accent-color: var(--arabic-text-primary);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

button {
  min-height: 42px;
  border: 1px solid var(--arabic-text-primary);
  border-radius: 12px;
  padding: 9px 16px;
  background: var(--arabic-text-primary);
  color: var(--color-surface);
  font: inherit;
  font-family: var(--font-heading);
  font-weight: 800;
  cursor: pointer;
  transition: transform .18s ease, border-color .18s ease, background .18s ease, color .18s ease, box-shadow .18s ease;
}

button:hover,
button:focus-visible {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(var(--color-primary-rgb), .12);
}

button:disabled {
  cursor: progress;
  opacity: .72;
  transform: none;
}

button.secondary {
  border-color: var(--arabic-text-border);
  background: var(--arabic-text-card);
  color: var(--arabic-text-primary);
}

.status {
  min-height: 28px;
  margin: 14px 0 0;
  color: var(--arabic-text-muted);
  font-weight: 700;
}

.status.error {
  color: var(--arabic-text-danger);
}

.status.ok {
  color: var(--arabic-text-success);
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.stats div {
  border: 1px solid var(--arabic-text-border);
  border-radius: 14px;
  padding: 14px;
  background: var(--arabic-text-muted-card);
}

.stats span {
  display: block;
  color: var(--arabic-text-primary);
  font-family: var(--font-heading);
  font-size: clamp(1.55rem, 3vw, 2.05rem);
  font-weight: 900;
  line-height: 1.2;
}

.stats small {
  color: var(--arabic-text-muted);
  font-weight: 700;
}

.result-block {
  margin-bottom: 20px;
}

.result-block h2,
.suggestions-block h2 {
  margin: 0 0 12px;
  color: var(--arabic-text-primary);
  font-family: var(--font-heading);
  font-size: 1.16rem;
  line-height: 1.45;
}

.suggestions-block {
  display: grid;
  gap: 10px;
}

.inline-suggestion {
  position: relative;
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  margin-inline: 1px;
  white-space: nowrap;
}

.inline-word {
  text-decoration-line: underline;
  text-decoration-style: wavy;
  text-decoration-color: var(--arabic-text-danger);
  text-decoration-thickness: 1.5px;
  text-underline-offset: 4px;
}

.inline-trigger {
  min-width: 16px;
  min-height: 16px;
  width: 16px;
  height: 16px;
  border: 0;
  border-radius: 50%;
  padding: 0;
  background: transparent;
  color: var(--arabic-text-danger);
  font-size: .72rem;
  line-height: 1;
  box-shadow: none;
  transform: none;
}

.inline-trigger:hover,
.inline-trigger:focus-visible {
  background: rgba(var(--color-danger-rgb), .08);
  box-shadow: none;
  transform: none;
}

.inline-menu {
  position: absolute;
  z-index: 5;
  top: calc(100% + 6px);
  right: 0;
  display: grid;
  gap: 5px;
  min-width: 110px;
  border: 1px solid #72c49f;
  border-radius: 12px;
  padding: 6px;
  background: #dff4e9;
  background-color: #dff4e9;
  background-clip: padding-box;
  box-shadow: 0 14px 30px rgba(var(--color-success-rgb), .24);
  opacity: 1;
}

.inline-menu[hidden] {
  display: none;
}

.inline-option {
  display: flex;
  width: 100%;
  min-height: 32px;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid #8ad0b0;
  border-radius: 9px;
  padding: 5px 10px;
  background: #ffffff;
  background-color: #ffffff;
  color: #074d38;
  font-size: .86rem;
  font-weight: 800;
}

.inline-option small {
  color: var(--arabic-text-muted);
  font-size: .72rem;
  font-weight: 800;
  opacity: 1;
}

.inline-option:hover,
.inline-option:focus-visible {
  background: #c9ecd9;
  box-shadow: none;
  color: #063c2c;
}

#suggestions {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr));
  align-items: stretch;
  gap: 10px;
}

.suggestion {
  display: grid;
  width: 100%;
  gap: 5px;
  min-height: 0;
  border: 1px solid var(--arabic-text-border);
  border-radius: 14px;
  padding: 12px 14px;
  background: var(--arabic-text-card);
  color: var(--arabic-text-ink);
  text-align: right;
  box-shadow: none;
}

button.suggestion {
  cursor: pointer;
}

button.suggestion:hover,
button.suggestion:focus-visible {
  border-color: rgba(var(--color-primary-rgb), .38);
  background: rgba(var(--color-primary-rgb), .035);
}

.suggestion-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
}

.suggestion-replace {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.suggestion strong {
  color: var(--arabic-text-primary);
  font-family: var(--font-heading);
  font-weight: 900;
}

.suggestion-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(var(--color-success-rgb), .22);
  border-radius: 999px;
  padding: 4px 9px;
  background: rgba(var(--color-success-rgb), .07);
  color: var(--arabic-text-success);
  font-family: var(--font-heading);
  font-size: .78rem;
  font-weight: 800;
}

.suggestion small {
  display: block;
  color: var(--arabic-text-muted);
  font-size: .86rem;
  line-height: 1.65;
}

.suggestion-context {
  color: var(--color-accent-dark) !important;
}

.suggestion.is-applied {
  border-color: rgba(var(--color-success-rgb), .34);
  background: rgba(var(--color-success-rgb), .055);
}

.suggestion.is-applied .suggestion-action {
  background: var(--arabic-text-success);
  color: var(--color-surface);
}

.empty {
  border: 1px dashed var(--arabic-text-border);
  border-radius: 14px;
  padding: 14px;
  background: var(--arabic-text-muted-card);
  color: var(--arabic-text-muted);
}

@media (max-width: 720px) {
  .page {
    width: min(100% - 22px, 1120px);
    margin-block: 14px 42px;
  }

  .hero,
  .tool-card,
  .results {
    border-radius: 14px;
    padding: 16px;
  }

  .input-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .character-counter {
    width: 100%;
    justify-content: space-between;
    border-radius: 12px;
  }

  .stats {
    grid-template-columns: 1fr;
  }

  .actions button {
    flex: 1 1 140px;
  }

  .suggestion-main {
    align-items: flex-start;
  }

  #suggestions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 430px) {
  .page {
    width: min(100% - 18px, 1120px);
  }

  .options,
  .actions {
    grid-template-columns: 1fr;
  }

  .actions button {
    width: 100%;
  }

  textarea,
  .output-text {
    min-height: 210px;
    padding: 13px;
  }
}

.mp-floating-search {
   

  
    margin: 0 0 0px;
    border: 1px solid rgba(120, 80, 40, .18);
    background: rgba(255, 255, 255, .96);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 20px rgba(0, 0, 0, .10);
}
.mp-floating-search .mp-search {
  margin: 0px;
}

@supports (padding: max(0px)) {
  .mp-floating-search {
    top: max(0px, env(safe-area-inset-top));
  }
}

@media (max-width: 640px) {
  .mp-floating-search {
    margin-bottom: 14px;
    padding: 10px;
  }
}


.mp-search-layout,
.mp-witness-layout {
    display: grid;
    gap: 18px;
    align-items: start;
}

.mp-search-panel,
.mp-search-results-pane,
.mp-witness-sidebar,
.mp-witness-content {
    min-width: 0;
}

.mp-witness-sidebar,
.mp-witness-content {
    display: grid;
    gap: 18px;
}

@media (min-width: 1000px) {
    .poetry-search-page .mp-page {
        width: min(1460px, calc(100% - 48px));
    }

    .mp-search-layout,
    .mp-witness-layout {
        grid-template-columns: minmax(400px, 500px) minmax(0, 1fr);
        gap: clamp(18px, 2vw, 28px);
        direction: rtl;
    }

    .mp-search-panel,
    .mp-witness-sidebar {
        grid-column: 1;
        position: sticky;
        top: 18px;
        max-height: calc(100vh - 36px);
        overflow-x: hidden;
        overflow-y: auto;
        scrollbar-width: thin;
    }

    .mp-search-panel .mp-hero,
    .mp-witness-sidebar .mp-card,
    .mp-witness-sidebar .mp-hero {
        max-width: 100%;
        overflow-x: hidden;
    }

    .mp-search-panel .mp-link-row a,
    .mp-search-panel .mp-theme-card,
    .mp-search-panel .mp-theme-card-meta span {
        min-width: 0;
        max-width: 100%;
        white-space: normal;
        overflow-wrap: anywhere;
    }

    .mp-search-results-pane,
    .mp-witness-content {
        grid-column: 2;
        align-self: start;
        margin-top: 0;
    }

    .mp-search-results-pane .mp-section-head {
        align-items: flex-start;
        margin-top: 0;
        padding-top: 0;
    }

    .mp-search-results-pane .mp-section-title,
    .mp-search-results-pane .mp-muted {
        margin-top: 0;
    }

    .mp-search-panel .mp-hero {
        padding: clamp(18px, 2vw, 24px);
    }

    .mp-search-panel .mp-hero h1 {
        font-size: clamp(1.35rem, 1.7vw, 1.75rem);
    }

    .mp-search-panel .mp-hero p {
        font-size: .96rem;
        line-height: 1.9;
    }

    .mp-search-panel .mp-search,
    .mp-witness-sidebar .mp-search {
        grid-template-columns: minmax(0, 1fr);
        max-width: none;
    }

    .mp-search-panel .mp-search button,
    .mp-witness-sidebar .mp-search button,
    .mp-witness-sidebar .mp-actions .mp-btn {
        width: 100%;
    }

    .mp-search-panel .mp-theme-cards {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .mp-witness-sidebar .mp-floating-search {
        margin: 0;
    }

    .mp-witness-sidebar .mp-detail-hero {
        padding: clamp(18px, 2vw, 24px);
    }

    .mp-witness-sidebar .mp-detail-hero .mp-bayt {
        font-size: clamp(21px, 1.7vw, 28px);
    }
}

@media (min-width: 1000px) and (max-width: 1180px) {
    .mp-search-panel .mp-theme-cards {
        grid-template-columns: 1fr;
    }
}


.mp-result-summary {
    margin: 0 4px 12px;
    color: var(--arabic-text-muted);
    font-size: .96rem;
    line-height: 1.9;
}


.mp-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    margin: 16px 0 0;
    padding: 14px 16px;
    direction: rtl;
    text-align: right;
    border: 1px solid rgba(120, 80, 40, .14);
    border-radius: 16px;
 
    font-size: 14px;
    line-height: 1.8;
}

.mp-active-filter {
    display: inline-flex;
    margin-inline-start: 8px;
}

.mp-filter-clear {
    display: inline-flex;
    margin-inline-start: 8px;
    color: #7d3529;
    font-weight: 800;
    text-decoration: none;
}

.mp-filter-clear:hover,
.mp-filter-clear:focus-visible {
    color: #2b2c34;
    text-decoration: underline;
    outline: none;
}

    .mp-meta span,
    .mp-meta a {
        display: inline-flex;
        align-items: center;
        gap: 6px;
        padding: 6px 11px;
        border: 1px solid rgba(120, 80, 40, .12);
        border-radius: 999px;
        background: rgba(255, 255, 255, .72);
        color: #5c4735;
        text-decoration: none;
        white-space: nowrap;
    }

        .mp-meta span::before,
        .mp-meta a::before {
            content: "";
            width: 6px;
            height: 6px;
            flex: 0 0 6px;
            border-radius: 50%;
            background: #a45d36;
            opacity: .75;
        }

        .mp-meta a:hover,
        .mp-meta a:focus-visible {
            border-color: rgba(154, 61, 45, .28);
            background: rgba(154, 61, 45, .07);
            color: #2b2c34;
            outline: none;
        }

        .mp-meta span:last-child,
        .mp-meta a:last-child,
        .mp-meta .mp-confidence-filter {
            border-color: rgba(20, 120, 70, .18);
            background: rgba(235, 250, 242, .75);
            color: #24563d;
            font-weight: 700;
        }

            .mp-meta span:last-child::before,
            .mp-meta a:last-child::before,
            .mp-meta .mp-confidence-filter::before {
                background: #1f8a55;
            }

@media (max-width: 640px) {
    .mp-meta {
        gap: 8px;
        padding: 12px;
        font-size: 13px;
    }

        .mp-meta span,
        .mp-meta a {
            width: 100%;
            justify-content: flex-start;
            white-space: normal;
        }
}



.mp-bayt {
    display: block;
    margin: 0 0 10px;
    padding: 14px 16px;
    direction: rtl;
    text-align: right;
    color: #3f2d22;
    text-decoration: none;
    font-family: var(--poetry-naskh-font);
    font-size: 22px;
    font-weight: 700;
    line-height: 2.1;
    border: 1px solid rgba(120, 80, 40, .13);
    border-radius: 18px;
   
  
    transition: color .2s ease, border-color .2s ease, box-shadow .2s ease, transform .2s ease, background .2s ease;
}

.mp-bayt-parts {
    display: grid;
    grid-template-columns: max-content clamp(1.5ch, 2vw, 4ch) max-content;
    justify-content: right;
    align-items: baseline;
    direction: rtl;
}

.mp-bayt-sadr,
.mp-bayt-ajz {
    min-width: 0;
    text-align: right;
    overflow-wrap: anywhere;
    white-space: nowrap;
}

.mp-bayt-gap {
    display: block;
    min-height: 1px;
}

    .mp-bayt:hover,
    .mp-bayt:focus {
        color: #2b2c34;
        border-color: rgba(154, 61, 45, .26);
  
        transform: translateY(-1px);
    }

    .mp-bayt:focus {
        outline: 3px solid rgba(154, 61, 45, .16);
        outline-offset: 3px;
    }
@media (max-width: 640px) {
    .mp-bayt {
        padding: 10px 12px;
        font-size: 16px;
        line-height: 1.85;
        border-radius: 12px;
    }

    .mp-bayt-parts {
        grid-template-columns: minmax(0, 1fr);
        gap: 3px;
    }

    .mp-bayt-sadr,
    .mp-bayt-ajz {
        white-space: normal;
        line-height: 1.8;
    }

    .mp-bayt-gap {
        display: none;
    }
}


.mp-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 120px;
    padding: 10px 18px;
    border: 1px solid rgba(120, 80, 40, .18);
    border-radius: 999px;
    background: rgba(255, 255, 255, .9);
    color: #2b2c34;
    text-decoration: none;
    font-size: 14px;
    font-weight: 700;
    box-shadow: 0 8px 18px rgba(60, 40, 20, .07);
    transition: .2s ease;
}

    .mp-btn:hover,
    .mp-btn:focus {
        background: rgba(255, 255, 255, .9);
        color: #fff;
        border-color: #2b2c34;
        box-shadow: 0 12px 24px rgba(154, 61, 45, .18);
        transform: translateY(-1px);
    }
@media (max-width: 640px) {
    .mp-btn {
        width: 100%;
        padding: 11px 16px;
        font-size: 14px;
    }
}


.mp-sources-card {
    margin-top: 22px;
    padding: 22px;
    direction: rtl;
    text-align: right;
    border: 1px solid rgba(120, 80, 40, .14);
    border-radius: 14px;
    
    box-shadow: 0 12px 34px rgba(60, 40, 20, .07);
}

    .mp-sources-card .mp-section-title {
        display: flex;
        align-items: center;
        gap: 10px;
        margin: 0 0 16px;
        padding-bottom: 12px;
        color: #3f2d22;
        font-size: 15px;
        font-weight: 800;
        line-height: 1.7;
        border-bottom: 1px solid rgba(120, 80, 40, .13);
    }

        .mp-sources-card .mp-section-title::before {
            content: "📚";
            display: inline-flex;
            align-items: center;
            justify-content: center;
            width: 34px;
            height: 34px;
            border-radius: 50%;
            background: rgba(154, 61, 45, .10);
            color: #2b2c34;
            font-size: 15px;
        }

    .mp-sources-card .mp-muted {
        margin: 0;
        padding: 16px;
        border: 1px dashed rgba(120, 80, 40, .22);
        border-radius: 16px;
        background: rgba(255, 255, 255, .65);
        color: #7a6858;
        font-size: 15px;
        line-height: 1.9;
    }

   
    .mp-sources-card .mp-table-wrap {
        overflow-x: auto;
        overflow-y: hidden;
        border: 1px solid rgba(120, 80, 40, .13);
        border-radius: 18px;
        background: #fff;
        box-shadow: inset 0 1px 0 rgba(255, 255, 255, .7);
    }


    .mp-sources-card .mp-table {
        width: 100%;
        min-width: 760px;
        border-collapse: separate;
        border-spacing: 0;
        direction: rtl;
        text-align: right;
        color: #4b3828;
        font-size: 14px;
        line-height: 1.8;
    }

        .mp-sources-card .mp-table thead th {
            position: sticky;
            top: 0;
            z-index: 2;
            padding: 13px 14px;
            background: linear-gradient(180deg, #f4eee6, #ede2d6);
            color: #3f2d22;
            font-weight: 800;
            white-space: nowrap;
            border-bottom: 1px solid rgba(120, 80, 40, .18);
        }

        .mp-sources-card .mp-table tbody td {
            padding: 13px 14px;
            vertical-align: top;
            border-bottom: 1px solid rgba(120, 80, 40, .09);
            background: rgba(255, 255, 255, .86);
        }

        .mp-sources-card .mp-table tbody tr:nth-child(even) td {
            background: rgba(250, 247, 241, .72);
        }

        .mp-sources-card .mp-table tbody tr:hover td {
            background: rgba(255, 247, 240, .95);
        }

   
        .mp-sources-card .mp-table td:first-child {
            color: #7d3529;
            font-weight: 800;
        }

        
        .mp-sources-card .mp-table td:nth-child(2) {
            color: #514235;
            font-weight: 600;
        }

       
        .mp-sources-card .mp-table td:nth-child(3) {
            color: #6e5b49;
            white-space: nowrap;
        }

      
        .mp-sources-card .mp-table td:nth-child(4) {
            text-align: center;
            font-weight: 800;
            color: #24563d;
            white-space: nowrap;
        }

     
        .mp-sources-card .mp-table td:last-child {
            color: #4d4036;
            line-height: 2;
        }

       
        .mp-sources-card .mp-table tbody tr:last-child td {
            border-bottom: 0;
        }
@media (max-width: 640px) {
    .mp-sources-card {
        padding: 16px;
        border-radius: 18px;
    }

        .mp-sources-card .mp-section-title {
            font-size: 15px;
        }

        .mp-sources-card .mp-table {
            min-width: 680px;
            font-size: 15px;
        }

            .mp-sources-card .mp-table thead th,
            .mp-sources-card .mp-table tbody td {
                padding: 10px 11px;
            }
}




.mp-sources-list {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.mp-source-item {
    width: 100%;
    padding: 28px;
    direction: rtl;
    text-align: right;
    border: 1px solid rgba(120, 80, 40, .18);
    border-radius: 14px;
    background: rgba(255, 255, 255, .94);
    box-shadow: 0 12px 34px rgba(60, 40, 20, .06);
}

.mp-source-fields {
    margin: 0;
    padding: 0;
}

.mp-source-row {
    display: grid;
    grid-template-columns: max-content minmax(0, 1fr);
    align-items: center;
    column-gap: 10px;
    row-gap: 6px;
  
    padding: 0 0;
    border-bottom: 1px solid rgba(120, 80, 40, .18);
}

    .mp-source-row:last-child {
        border-bottom: 0;
    }

    .mp-source-row dt {
        margin: 0;
        color: #1f1712;
        font-size: 15px;
        font-weight: 800;
        line-height: 1.8;
        white-space: nowrap;
    }

    .mp-source-row dd {
        justify-self: stretch;
        margin: 0;
        color: #1f1712;
        font-family: var(--poetry-naskh-font);
        font-size: 15px;
        font-weight: 500;
        line-height: 1.9;
        text-align: right;
        overflow-wrap: anywhere;
        word-break: break-word;
    }

   
    .mp-source-row:last-child dd {
        font-weight: 800;
    }

   
    .mp-source-row dd {
        max-width: 100%;
    }


@media (max-width: 640px) {
    .mp-source-item {
        padding: 5px;
        border-radius: 18px;
    }

    .mp-source-row {
        grid-template-columns: 1fr;
        gap: 4px;
        min-height: auto;
        padding: 3px 0;
    }

        .mp-source-row dt {
            font-size: 17px;
        }

        .mp-source-row dd {
            text-align: right;
            font-size: 18px;
            line-height: 1.8;
        }
}

.mp-source-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.mp-source-tag {
    display: inline-flex;
    align-items: center;
    padding: 5px 10px;

    color: #4b4034;
    font-size: 0.92rem;
    line-height: 1.6;
    white-space: nowrap;
}

.mp-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 28px;
    direction: rtl;
}

.mp-page-numbers {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 6px;
}

.mp-page-number,
.mp-page-arrow,
.mp-page-dots {
    min-width: 36px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid #e5e0d8;
    border-radius: 999px;
    background: #fff;
    color: #4b4034;
    font-size: 0.92rem;
    line-height: 36px;
    text-align: center;
    text-decoration: none;
    transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.mp-page-arrow {
    min-width: auto;
}

    .mp-page-number:hover,
    .mp-page-arrow:hover {
      
        border-color: #8f1d1d;
        color: #fff;
    }

.mp-page-number.is-current {
    background: #4b4034;
    border-color: #4b4034;
    color: #fff;
    font-weight: 700;
    cursor: default;
}

.mp-page-arrow.is-disabled {
    opacity: 0.4;
    cursor: not-allowed;
    pointer-events: none;
}

.mp-page-dots {
    border-color: transparent;
    background: transparent;
    color: #8a8178;
    padding: 0 4px;
    min-width: 24px;
}


.mp-theme-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 4px;
}

.mp-theme-card {
    display: grid;
    gap: 7px;
    min-height: 76px;
    align-content: center;
    border: 1px solid rgba(120, 80, 40, .16);
    border-radius: 8px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, .84);
    color: #3f2d22;
    text-decoration: none;
    box-shadow: 0 8px 18px rgba(60, 40, 20, .045);
    transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.mp-theme-card:hover,
.mp-theme-card:focus-visible {
    border-color: rgba(154, 61, 45, .3);
    background: rgba(255, 253, 249, .96);
    box-shadow: 0 12px 24px rgba(154, 61, 45, .1);
    color: #2d261f;
    text-decoration: none;
    outline: none;
    transform: translateY(-1px);
}

.mp-theme-card.is-active {
    border-color: rgba(20, 120, 70, .3);
    background: rgba(235, 250, 242, .84);
}

.mp-theme-card-title {
    font-family: var(--font-heading);
    font-size: .98rem;
    font-weight: 900;
    line-height: 1.5;
}

.mp-theme-card-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    color: #6d5a49;
    font-size: .82rem;
    font-weight: 700;
    line-height: 1.5;
}

.mp-theme-card-meta span {
    display: inline-flex;
    align-items: center;
    border: 1px solid rgba(120, 80, 40, .12);
    border-radius: 999px;
    padding: 2px 7px;
    background: rgba(250, 247, 241, .9);
}

@media (max-width: 640px) {
    .mp-theme-cards {
        grid-template-columns: 1fr;
    }
}


.mp-source-row {
    align-items: start;
    padding: 10px 0;
}

.mp-source-row dt {
    padding-top: 2px;
}

.mp-source-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.mp-source-tag {
    display: inline-flex;
    align-items: center;
    max-width: 100%;
    padding: 5px 11px;
    border: 1px solid rgba(120, 80, 40, .16);
    border-radius: 999px;
    background: rgba(250, 247, 241, .95);
    color: #4b4034;
    font-family: var(--poetry-naskh-font);
    font-size: .9rem;
    font-weight: 600;
    line-height: 1.6;
    white-space: normal;
}

.mp-source-place-tag {
    font-family: var(--poetry-naskh-font);
    font-size: 1rem;
    font-weight: 600;
    line-height: 1.8;
}

.mp-source-excerpts {
    display: grid;
    gap: 8px;
}

.mp-source-excerpt,
.mp-variant-text {
    padding: 10px 12px;
    border: 1px dashed rgba(120, 80, 40, .22);
    border-radius: 12px;
    background: rgba(255, 253, 249, .9);
    font-family: var(--poetry-naskh-font);
    line-height: 2;
}

.mp-source-group .mp-source-row:first-child dd {
    color: #2b2c34;
    font-weight: 800;
}

.mp-source-group .mp-source-row:last-child dd {
    color: #24563d;
}

.poetry-search-page .mp-detail-hero h1.mp-bayt,
.poetry-search-page .mp-detail-hero h1.mp-bayt .mp-main-bayt-parts,
.poetry-search-page .mp-detail-hero h1.mp-bayt .mp-bayt-sadr,
.poetry-search-page .mp-detail-hero h1.mp-bayt .mp-bayt-ajz {
    font-family: var(--poetry-naskh-font) !important;
}

.mp-detail-hero .mp-bayt {
    font-size: clamp(24px, 2.6vw, 34px);
    font-weight: 700;
    line-height: 2.05;
}

@media (max-width: 640px) {
    .mp-detail-hero .mp-bayt {
        font-size: 18px;
        line-height: 1.85;
    }
}

.mp-source-row dd.mp-variant-text {
    font-size: 18px;
    font-weight: 500;
    line-height: 1.9;
}

@media (max-width: 640px) {
    .mp-source-row dd.mp-variant-text {
        font-size: 16px;
        line-height: 1.75;
    }
}

@media (max-width: 640px) {
    .mp-source-row {
        padding: 7px 0;
    }

    .mp-source-tag {
        font-size: .86rem;
        line-height: 1.7;
    }
}

@media (max-width: 640px) {
    .poetry-search-page .mp-sources-card {
        --mp-mobile-card-text-size: 14px;
        --mp-mobile-card-title-size: 15px;
        padding: 14px;
        border-radius: 14px;
        font-size: var(--mp-mobile-card-text-size);
    }

    .poetry-search-page .mp-sources-card .mp-section-title {
        font-size: var(--mp-mobile-card-title-size);
        line-height: 1.6;
    }

    .poetry-search-page .mp-sources-card .mp-muted,
    .poetry-search-page .mp-sources-card .mp-table,
    .poetry-search-page .mp-source-row dt,
    .poetry-search-page .mp-source-row dd,
    .poetry-search-page .mp-source-row dd.mp-variant-text,
    .poetry-search-page .mp-source-excerpt,
    .poetry-search-page .mp-variant-text,
    .poetry-search-page .mp-source-tag,
    .poetry-search-page .mp-source-place-tag {
        font-size: var(--mp-mobile-card-text-size);
        line-height: 1.75;
    }

    .poetry-search-page .mp-source-item {
        padding: 12px;
        border-radius: 14px;
    }

    .poetry-search-page .mp-source-row {
        gap: 3px;
        padding: 6px 0;
    }

    .poetry-search-page .mp-source-row dt {
        line-height: 1.6;
    }

    .poetry-search-page .mp-source-row dd.mp-variant-text {
        line-height: 1.8;
    }

    .poetry-search-page .mp-source-tag {
        font-family: var(--poetry-naskh-font);
        font-weight: 600;
        padding: 4px 9px;
    }

    .poetry-search-page .mp-sources-card .mp-table {
        min-width: 640px;
    }
}

.mp-share-panel {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    margin: 14px 0 10px;
    padding: 10px 12px;
    border: 1px solid rgba(120, 80, 40, .14);
    border-radius: 999px;
    background: rgba(255, 255, 255, .86);
}

.mp-share-native,
.mp-share-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-width: 42px;
    height: 42px;
    border: 1px solid rgba(120, 80, 40, .14);
    border-radius: 999px;
    background: #fff;
    color: var(--arabic-text-primary);
    font-family: var(--font-heading);
    font-weight: 900;
    line-height: 1;
    text-decoration: none;
    box-shadow: 0 8px 18px rgba(0, 0, 0, .045);
    transition: transform .16s ease, border-color .16s ease;
}

.mp-share-native svg,
.mp-share-link svg {
    width: 20px;
    height: 20px;
    flex: 0 0 20px;
}

.mp-share-native svg,
.mp-share-mail svg {
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.mp-share-native {
    min-width: 82px;
    padding: 0 18px;
    cursor: pointer;
}

.mp-share-link:hover,
.mp-share-link:focus-visible,
.mp-share-native:hover,
.mp-share-native:focus-visible {
    border-color: rgba(var(--color-primary-rgb), .32);
    transform: translateY(-1px);
}

.mp-share-mail { color: #c89a17; }
.mp-share-whatsapp { color: #1fb653; }
.mp-share-x { color: #1d9bf0; }
.mp-share-facebook { color: #28559c; }
.mp-share-telegram { color: #2a93d5; }

.mp-share-status {
    flex: 1 1 100%;
    min-height: 1.2em;
    color: var(--arabic-text-muted);
    font-size: .82rem;
    text-align: center;
}

@media (max-width: 640px) {
    .mp-share-panel {
        border-radius: 18px;
    }
}

/* Compact search and witness cards */
.poetry-search-page .mp-main,
.poetry-search-page .mp-search-layout,
.poetry-search-page .mp-witness-layout,
.poetry-search-page .mp-witness-sidebar,
.poetry-search-page .mp-witness-content {
    gap: 12px;
}

.poetry-search-page .mp-hero,
.poetry-search-page .mp-card,
.poetry-search-page .mp-result {
    padding: 12px 14px;
}

.poetry-search-page .mp-results-list {
    gap: 8px;
}

.poetry-search-page .mp-result {
    gap: 6px;
}

.poetry-search-page .mp-result .mp-bayt,
.poetry-search-page .mp-detail-hero .mp-bayt {
    margin-bottom: 6px;
    padding: 7px 9px;
    border-radius: 10px;
    font-size: 15px;
    line-height: 1.7;
}

.poetry-search-page .mp-detail-hero .mp-bayt {
    font-size: 16px;
}

.poetry-search-page .mp-result-summary {
    margin: 0 2px 6px;
    font-size: .9rem;
    line-height: 1.75;
}

.poetry-search-page .mp-meta {
    gap: 6px;
    margin-top: 8px;
    padding: 8px 10px;
    border-radius: 10px;
}

.poetry-search-page .mp-meta span,
.poetry-search-page .mp-meta a {
    gap: 5px;
    padding: 3px 8px;
}

.poetry-search-page .mp-sources-card {
    margin-top: 12px;
    padding: 13px 14px;
}

.poetry-search-page .mp-sources-card .mp-section-title {
    gap: 7px;
    margin-bottom: 8px;
    padding-bottom: 7px;
}

.poetry-search-page .mp-sources-card .mp-section-title::before {
    width: 27px;
    height: 27px;
}

.poetry-search-page .mp-sources-list {
    gap: 10px;
}

.poetry-search-page .mp-source-item {
    padding: 12px;
}

.poetry-search-page .mp-source-excerpt,
.poetry-search-page .mp-variant-text {
    padding: 7px 9px;
    border-radius: 9px;
}

.poetry-search-page .mp-search input,
.poetry-search-page .mp-search button,
.poetry-search-page .mp-btn {
    min-height: 36px;
    padding: 6px 12px;
    border-radius: 9px;
    font-size: 13px;
}

.poetry-search-page .mp-btn {
    min-width: auto;
}

.poetry-search-page .mp-witness-sidebar .mp-actions .mp-btn {
    width: auto;
}

.poetry-search-page .mp-link-row,
.poetry-search-page .mp-actions {
    gap: 7px;
}

.poetry-search-page .mp-link-row a {
    min-height: 30px;
    padding: 3px 9px;
    font-size: .82rem;
}

.poetry-search-page .mp-theme-cards {
    gap: 7px;
}

.poetry-search-page .mp-theme-card {
    min-height: 60px;
    gap: 4px;
    padding: 7px 9px;
}

.poetry-search-page .mp-pagination {
    gap: 6px;
    margin-top: 16px;
}

.poetry-search-page .mp-page-number,
.poetry-search-page .mp-page-arrow,
.poetry-search-page .mp-page-dots {
    min-width: 32px;
    height: 32px;
    padding-inline: 9px;
    line-height: 32px;
}

.poetry-search-page .mp-share-panel {
    gap: 6px;
    margin: 8px 0 6px;
    padding: 6px 8px;
}

.poetry-search-page .mp-share-native,
.poetry-search-page .mp-share-link {
    min-width: 36px;
    height: 36px;
}

.poetry-search-page .mp-share-native {
    min-width: 70px;
    padding-inline: 12px;
}

.poetry-search-page .mp-share-native svg,
.poetry-search-page .mp-share-link svg {
    width: 18px;
    height: 18px;
    flex-basis: 18px;
}

.poetry-search-page .mp-detail-hero {
    gap: 8px;
    padding-bottom: 8px;
}

.poetry-search-page .mp-share-panel {
    margin: 4px 0 0;
    padding-block: 5px;
}

.poetry-search-page .mp-share-status {
    min-height: 0;
    margin: 0;
    line-height: 1.4;
}

.poetry-search-page .mp-share-status:empty {
    display: none;
}

.poetry-search-page .mp-detail-hero > .mp-actions {
    margin: 0;
}

@media (max-width: 640px) {
    .poetry-search-page .mp-main,
    .poetry-search-page .mp-search-layout,
    .poetry-search-page .mp-witness-layout,
    .poetry-search-page .mp-witness-sidebar,
    .poetry-search-page .mp-witness-content {
        gap: 9px;
    }

    .poetry-search-page .mp-hero,
    .poetry-search-page .mp-card,
    .poetry-search-page .mp-result,
    .poetry-search-page .mp-sources-card {
        padding: 10px;
    }

    .poetry-search-page .mp-result .mp-bayt {
        padding: 6px 8px;
        font-size: 14px;
        line-height: 1.68;
    }

    .poetry-search-page .mp-detail-hero .mp-bayt {
        padding: 6px 8px;
        font-size: 14px;
        line-height: 1.68;
    }

    .poetry-search-page .mp-detail-hero {
        padding-bottom: 7px;
    }

    .poetry-search-page .mp-share-panel {
        border-radius: 12px;
    }

    .poetry-search-page .mp-source-item {
        padding: 8px;
    }

    .poetry-search-page .mp-search button,
    .poetry-search-page .mp-btn {
        padding: 6px 10px;
        font-size: 13px;
    }
}
