/* Diwani v11 — automatic Arabic diacritization and dictionary workspace. */
.language-ai-modal {
  width: min(1180px, calc(100vw - 40px));
  max-width: 1180px;
  max-height: calc(100vh - 32px);
  overflow: auto;
}

.language-ai-studio {
  direction: rtl;
  color: var(--text, #2d2522);
}

.language-tool-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  padding: 7px;
  margin-bottom: 16px;
  border: 1px solid rgba(125, 83, 56, .16);
  border-radius: 15px;
  background: rgba(250, 246, 240, .82);
}

.language-tool-tabs button {
  min-height: 52px;
  border: 0;
  border-radius: 11px;
  padding: 11px 10px;
  background: transparent;
  color: #574942;
  font: 800 17px/1.45 "Cairo", "Noto Naskh Arabic", sans-serif;
  text-wrap: balance;
  cursor: pointer;
  transition: .18s ease;
}

.language-tool-tabs button.active {
  color: #fff;
  background: linear-gradient(135deg, var(--burgundy, #8b1a1a), #641416);
  box-shadow: 0 8px 20px rgba(91, 18, 22, .2);
  font-weight: 900;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .22);
}

.language-tool-panel { display: none; }
.language-tool-panel.active { display: block; }

.language-ai-intro,
.dictionary-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px 18px;
  margin-bottom: 14px;
  border: 1px solid rgba(139, 26, 26, .13);
  border-radius: 18px;
  background:
    radial-gradient(circle at 92% 10%, rgba(184, 139, 64, .16), transparent 34%),
    linear-gradient(135deg, rgba(139, 26, 26, .07), rgba(255, 255, 255, .88));
}

.language-ai-intro > div,
.dictionary-intro > div {
  display: grid;
  gap: 5px;
}

.language-ai-intro strong,
.dictionary-intro strong {
  color: var(--burgundy, #8b1a1a);
  font-size: 17px;
}

.language-ai-intro span,
.dictionary-intro span {
  color: var(--muted, #73665f);
  font-size: 12px;
  line-height: 1.7;
}

.language-model-badge,
.dictionary-intro > span {
  flex: 0 0 auto;
  padding: 7px 11px;
  border: 1px solid rgba(139, 26, 26, .16);
  border-radius: 999px;
  background: #fff;
  color: var(--burgundy, #8b1a1a) !important;
  font: 700 11px/1.2 ui-monospace, Consolas, monospace;
}

.language-ai-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(290px, .85fr);
  gap: 16px;
  align-items: start;
}

.language-ai-editor,
.language-side-card,
.dictionary-results {
  border: 1px solid rgba(125, 83, 56, .16);
  border-radius: 18px;
  background: rgba(255, 255, 255, .86);
  box-shadow: 0 10px 30px rgba(67, 44, 32, .05);
}

.language-ai-editor { padding: 16px; }

.language-ai-label {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 4px 2px 7px;
}

.language-ai-label span { font-weight: 800; color: #413630; }
.language-ai-label small { color: var(--muted, #7a706a); font-size: 11px; }

#languageAiSource,
#languageAiResult {
  width: 100%;
  min-height: 105px;
  resize: vertical;
  border: 1px solid rgba(104, 74, 55, .21);
  border-radius: 14px;
  padding: 14px 16px;
  color: #271f1b;
  background: #fffdfb;
  font: 600 21px/2.05 "Amiri", "Noto Naskh Arabic", serif;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease;
}

#languageAiResult {
  min-height: 130px;
  background: linear-gradient(180deg, #fff, #fffaf4);
}

#languageAiSource:focus,
#languageAiResult:focus,
.dictionary-search-bar input:focus {
  border-color: rgba(139, 26, 26, .58);
  box-shadow: 0 0 0 4px rgba(139, 26, 26, .08);
}

.language-auto-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 0 7px;
}

.language-auto-bar label {
  color: var(--muted, #726861);
  font-size: 12px;
  cursor: pointer;
}

.language-auto-bar input { accent-color: var(--burgundy, #8b1a1a); }

.language-auto-run {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 43px;
  border: 0;
  border-radius: 12px;
  padding: 9px 18px;
  color: #fff;
  background: linear-gradient(135deg, var(--burgundy, #8b1a1a), #5f1115);
  box-shadow: 0 9px 20px rgba(111, 22, 25, .2);
  font: 800 13px/1.2 inherit;
  cursor: pointer;
}

.language-auto-run span { color: #f6d492; font-size: 17px; }
.language-auto-run:disabled { opacity: .65; cursor: progress; }
.language-auto-run.loading span { animation: languageSpin 1s linear infinite; }

@keyframes languageSpin { to { transform: rotate(360deg); } }

.language-ai-feedback {
  min-height: 27px;
  margin: 0 2px 7px;
  color: #60725d;
  font-size: 11px;
  line-height: 1.65;
}

.language-ai-feedback[data-tone="warn"] { color: #a34331; }
.language-ai-feedback[data-tone="busy"] { color: #85631f; }

.language-review-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 2px 8px;
}

.language-review-head strong { font-size: 13px; }
.language-review-head > span { display: flex; align-items: center; gap: 5px; color: var(--muted, #746a63); font-size: 10px; }
.language-review-head i { width: 8px; height: 8px; margin-inline-start: 5px; border-radius: 50%; }
.language-review-head i.high { background: #5e9c70; }
.language-review-head i.medium { background: #d69a33; }
.language-review-head i.low { background: #c35348; }

.language-word-review {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  min-height: 49px;
  padding: 9px;
  border: 1px dashed rgba(111, 82, 64, .22);
  border-radius: 13px;
  background: #fbf8f4;
}

.language-word-token {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 5px 9px;
  background: #fff;
  font-family: "Amiri", serif;
  cursor: pointer;
}

.language-word-token span { font-size: 17px; font-weight: 700; }
.language-word-token small { direction: ltr; color: #81776f; font: 700 9px/1 sans-serif; }
.language-word-token.high { border-color: rgba(69, 139, 88, .28); background: rgba(90, 162, 108, .08); }
.language-word-token.medium { border-color: rgba(204, 140, 35, .34); background: rgba(222, 158, 52, .1); }
.language-word-token.low { border-color: rgba(183, 67, 57, .36); background: rgba(198, 74, 62, .1); }
.language-word-token.manual { border-color: rgba(108, 84, 66, .18); }
.language-word-token.selected { border-color: var(--burgundy, #8b1a1a); box-shadow: 0 0 0 3px rgba(139, 26, 26, .09); }

.language-correction-box {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid rgba(125, 83, 56, .14);
  border-radius: 14px;
  background: #fff;
}

.language-correction-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 9px;
}

.language-correction-title strong { font-size: 13px; }
.language-correction-title span { color: var(--burgundy, #8b1a1a); font: 700 16px/1.2 "Amiri", serif; }

.language-ending-pad {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.language-ending-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 39px;
  border: 1px solid rgba(117, 84, 63, .18);
  border-radius: 9px;
  background: #fcfaf7;
  color: #4e4038;
  cursor: pointer;
}

.language-ending-btn:hover { border-color: rgba(139, 26, 26, .35); background: rgba(139, 26, 26, .04); }
.language-ending-btn b { color: var(--burgundy, #8b1a1a); font: 700 20px/1 "Amiri", serif; }
.language-ending-btn span { font-size: 9px; }

.language-correction-box details { margin-top: 9px; }
.language-correction-box summary { color: #75675f; font-size: 11px; cursor: pointer; }
.language-correction-box .diacritic-pad { margin-top: 8px; }

.language-ai-side { display: grid; gap: 12px; }
.language-side-card { padding: 14px; }
.language-side-card > header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 9px;
  margin-bottom: 9px;
  border-bottom: 1px solid rgba(115, 83, 63, .12);
}
.language-side-card > header strong { color: var(--burgundy, #8b1a1a); font-size: 13px; }
.language-side-card > header small { color: #82766e; font-size: 9px; }

.language-grammar-hint {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 9px 0;
  border-bottom: 1px dashed rgba(105, 78, 61, .13);
}
.language-grammar-hint:last-child { border-bottom: 0; }
.language-grammar-hint > div { display: grid; gap: 2px; }
.language-grammar-hint strong { font: 700 17px/1.3 "Amiri", serif; }
.language-grammar-hint span { color: #776b63; font-size: 10px; line-height: 1.5; }
.language-grammar-hint button {
  flex: 0 0 auto;
  border: 1px solid rgba(139, 26, 26, .2);
  border-radius: 8px;
  padding: 5px 8px;
  color: var(--burgundy, #8b1a1a);
  background: rgba(139, 26, 26, .05);
  font: 700 10px/1.2 inherit;
  cursor: pointer;
}

.language-empty-note { margin: 0; color: #81766f; font-size: 11px; line-height: 1.7; }

.dictionary-security-note {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 15px;
  margin-bottom: 12px;
  border: 1px solid rgba(45, 122, 81, .2);
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(45, 122, 81, .08), rgba(255, 255, 255, .92));
  box-shadow: 0 8px 24px rgba(45, 122, 81, .05);
}
.dictionary-security-note > span {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  border-radius: 12px;
  background: #fff;
  font-size: 19px;
}
.dictionary-security-note > div { display: grid; gap: 3px; }
.dictionary-security-note strong { color: #236a48; font-size: 12px; }
.dictionary-security-note small { color: #64736a; font-size: 10px; line-height: 1.7; }
.dictionary-search-bar input {
  min-height: 43px;
  border: 1px solid rgba(104, 74, 55, .21);
  border-radius: 11px;
  padding: 8px 12px;
  color: #302621;
  background: #fff;
  outline: none;
}

.dictionary-search-bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-bottom: 8px; }
.dictionary-search-bar input { font: 700 18px/1.4 "Amiri", serif; }
.dictionary-search-bar button {
  border: 0;
  border-radius: 11px;
  padding: 8px 18px;
  color: #fff;
  background: var(--burgundy, #8b1a1a);
  font: 800 12px/1.2 inherit;
  cursor: pointer;
}
.dictionary-search-bar button:disabled { opacity: .6; cursor: progress; }
.dictionary-status { min-height: 28px; color: #756a63; font-size: 10px; line-height: 1.7; }
.dictionary-results { min-height: 180px; padding: 15px; }
.dictionary-result-header { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-bottom: 10px; border-bottom: 1px solid rgba(104, 74, 55, .13); }
.dictionary-result-header strong { color: var(--burgundy, #8b1a1a); font: 800 23px/1.3 "Amiri", serif; }
.dictionary-result-header span { color: #81766e; font-size: 10px; }
.dictionary-result-section { padding: 12px 0; border-bottom: 1px dashed rgba(104, 74, 55, .14); }
.dictionary-result-section:last-child { border-bottom: 0; }
.dictionary-result-section h4 { margin: 0 0 7px; color: #5a4438; font-size: 12px; }
.dictionary-result-section ul { display: grid; gap: 6px; margin: 0; padding: 0 18px 0 0; }
.dictionary-result-section li { color: #4c4039; font-size: 12px; line-height: 1.8; }
.dictionary-entry-list { display: grid; gap: 12px; padding-top: 14px; }
.dictionary-entry-card { overflow: hidden; border: 1px solid rgba(125, 83, 56, .14); border-radius: 16px; background: rgba(255, 253, 249, .88); }
.dictionary-entry-card > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding: 12px 14px; border-bottom: 1px solid rgba(125, 83, 56, .11); background: linear-gradient(135deg, rgba(139, 26, 26, .055), rgba(190, 137, 55, .045)); }
.dictionary-entry-card > header > div { display: grid; gap: 2px; }
.dictionary-entry-card > header strong { color: var(--burgundy, #8b1a1a); font: 800 21px/1.25 "Amiri", serif; }
.dictionary-entry-card > header span { color: #715f54; font-size: 10px; }
.dictionary-entry-card > header small { max-width: 48%; color: #776a62; font-size: 9px; line-height: 1.7; text-align: left; }
.dictionary-definitions { display: grid; gap: 8px; padding: 12px 14px; }
.dictionary-definitions p { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 8px; margin: 0; color: #3f352f; font-size: 12px; line-height: 1.9; }
.dictionary-definitions p b { display: grid; place-items: center; align-self: start; width: 22px; height: 22px; margin-top: 4px; border-radius: 50%; color: #fff; background: var(--burgundy, #8b1a1a); font-size: 9px; }
.dictionary-entry-extra { padding: 10px 14px 12px; border-top: 1px dashed rgba(125, 83, 56, .14); }
.dictionary-entry-extra > strong { color: #684e40; font-size: 10px; }
.dictionary-entry-extra ul { display: flex; flex-wrap: wrap; gap: 6px; margin: 7px 0 0; padding: 0; list-style: none; }
.dictionary-entry-extra li { padding: 4px 8px; border-radius: 999px; color: #5f4d42; background: rgba(139, 26, 26, .055); font-size: 9px; line-height: 1.55; }
.dictionary-entry-extra.examples ul { display: grid; }
.dictionary-entry-extra.examples li { border-radius: 9px; line-height: 1.8; }
.language-empty-note.error { color: #9e2e2e; }

.synonym-intro {
  background:
    radial-gradient(circle at 9% 10%, rgba(30, 58, 95, .14), transparent 36%),
    linear-gradient(135deg, rgba(30, 58, 95, .06), rgba(255, 255, 255, .9));
}
.synonym-intro > span {
  border-color: rgba(30, 58, 95, .18);
  color: #1e3a5f !important;
}
.synonym-precision-note {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 14px;
  margin-bottom: 12px;
  border: 1px solid rgba(30, 58, 95, .14);
  border-radius: 14px;
  background: rgba(30, 58, 95, .045);
}
.synonym-precision-note > b {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  place-items: center;
  border-radius: 10px;
  color: #fff;
  background: #1e3a5f;
  font-size: 12px;
}
.synonym-precision-note > div { display: grid; gap: 2px; }
.synonym-precision-note strong { color: #1e3a5f; font-size: 11px; }
.synonym-precision-note small { color: #69727b; font-size: 9px; line-height: 1.7; }
.synonym-search-bar button { background: linear-gradient(135deg, #1e3a5f, #315f8f); }
.dictionary-status[data-tone="success"] { color: #236a48; }
.dictionary-status[data-tone="warn"] { color: #9a691f; }
.dictionary-status[data-tone="error"] { color: #9e2e2e; }
.synonym-results { border-color: rgba(30, 58, 95, .13); }
.synonym-result-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(30, 58, 95, .12);
}
.synonym-result-header > div { display: grid; gap: 2px; }
.synonym-result-header strong { color: #1e3a5f; font: 800 25px/1.25 "Amiri", serif; }
.synonym-result-header span { color: #718092; font-size: 9px; }
.synonym-result-header p { margin: 5px 0 0; color: #687480; font-size: 10px; }
.synonym-result-header p b { color: var(--burgundy, #8b1a1a); font-size: 12px; }
.synonym-sense-list { display: grid; gap: 13px; padding-top: 14px; }
.synonym-sense-card {
  overflow: hidden;
  border: 1px solid rgba(30, 58, 95, .13);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .94), rgba(248, 250, 252, .88));
}
.synonym-sense-card > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(30, 58, 95, .1);
  background: linear-gradient(135deg, rgba(30, 58, 95, .07), rgba(184, 139, 64, .045));
}
.synonym-sense-card > header > div { display: grid; gap: 2px; }
.synonym-sense-card > header strong { color: #1e3a5f; font: 800 22px/1.25 "Amiri", serif; }
.synonym-sense-card > header span { color: #6c7782; font-size: 9px; }
.synonym-sense-card > header small { color: #7a6d64; font-size: 9px; }
.synonym-definitions { display: grid; gap: 6px; padding: 10px 14px 0; }
.synonym-definitions p { margin: 0; color: #4a4643; font-size: 10px; line-height: 1.8; }
.synonym-word-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 8px;
  padding: 12px 14px 14px;
}
.synonym-word-card {
  display: grid;
  gap: 7px;
  padding: 9px;
  border: 1px solid rgba(30, 58, 95, .11);
  border-radius: 13px;
  background: #fff;
  box-shadow: 0 5px 14px rgba(30, 58, 95, .045);
}
.synonym-word-main {
  width: 100%;
  min-height: 37px;
  border: 0;
  border-radius: 9px;
  color: #1e3a5f;
  background: rgba(30, 58, 95, .065);
  font: 800 19px/1.35 "Amiri", serif;
  cursor: pointer;
}
.synonym-word-main:hover { color: #fff; background: #1e3a5f; }
.synonym-word-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.synonym-word-actions button {
  min-height: 28px;
  padding: 4px 5px;
  border: 1px solid rgba(30, 58, 95, .12);
  border-radius: 8px;
  color: #5c6875;
  background: #fafbfd;
  font: 700 8px/1.2 inherit;
  cursor: pointer;
}
.synonym-word-actions button:hover { border-color: rgba(139, 26, 26, .25); color: var(--burgundy, #8b1a1a); background: rgba(139, 26, 26, .045); }
.synonym-empty { display: grid; min-height: 145px; place-items: center; align-content: center; gap: 5px; color: #7a746e; text-align: center; }
.synonym-empty > b { color: #9aa5b2; font-size: 28px; }
.synonym-empty strong { color: #505963; font-size: 12px; }
.synonym-empty p { max-width: 520px; margin: 0; font-size: 10px; line-height: 1.8; }

.heritage-intro {
  position: relative;
  overflow: hidden;
  border-color: rgba(46, 91, 70, .2);
  background:
    radial-gradient(circle at 8% 5%, rgba(184, 139, 64, .19), transparent 34%),
    linear-gradient(135deg, rgba(32, 82, 62, .1), rgba(255, 253, 246, .94));
}
.heritage-intro::after {
  position: absolute;
  inset-inline-end: 22px;
  bottom: -36px;
  color: rgba(32, 82, 62, .055);
  content: 'ض';
  font: 900 108px/1 "Aref Ruqaa", "Amiri", serif;
  pointer-events: none;
}
.heritage-intro strong { color: #20523e !important; }
.heritage-intro > span {
  z-index: 1;
  border-color: rgba(32, 82, 62, .18);
  color: #20523e !important;
  background: rgba(255, 255, 255, .72);
}
.heritage-intro > span b { color: #a87425; font-size: 14px; }
.heritage-coverage-note {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 10px 0;
  padding: 10px 13px;
  border: 1px solid rgba(32, 82, 62, .14);
  border-radius: 12px;
  color: #20523e;
  background: rgba(32, 82, 62, .045);
}
.heritage-coverage-note > span {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  place-items: center;
  border-radius: 9px;
  color: #fff;
  background: linear-gradient(135deg, #20523e, #39775c);
}
.heritage-coverage-note > div { display: grid; gap: 2px; }
.heritage-coverage-note strong { font-size: 11px; }
.heritage-coverage-note small { color: #67746c; font-size: 9px; line-height: 1.7; }
.heritage-search-bar button { background: linear-gradient(135deg, #20523e, #39775c); }
.heritage-search-options {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin: 8px 2px 2px;
  color: #4c5f55;
  cursor: pointer;
}
.heritage-search-options input { margin-top: 4px; accent-color: #20523e; }
.heritage-search-options span { display: grid; gap: 1px; }
.heritage-search-options strong { font-size: 10px; }
.heritage-search-options small { color: #7b837e; font-size: 8.5px; line-height: 1.7; }
.heritage-results {
  min-height: 230px;
  border-color: rgba(32, 82, 62, .14);
  background:
    linear-gradient(rgba(255, 255, 255, .86), rgba(255, 255, 255, .92)),
    repeating-linear-gradient(0deg, transparent 0 34px, rgba(32, 82, 62, .035) 35px);
}
.heritage-empty-state {
  display: grid;
  min-height: 210px;
  place-items: center;
  align-content: center;
  gap: 6px;
  padding: 20px;
  text-align: center;
}
.heritage-empty-state > span {
  display: grid;
  width: 55px;
  height: 55px;
  place-items: center;
  border: 1px solid rgba(168, 116, 37, .25);
  border-radius: 18px;
  color: #a87425;
  background: rgba(184, 139, 64, .08);
  font: 800 16px/1 "Aref Ruqaa", "Amiri", serif;
}
.heritage-empty-state strong { color: #20523e; font-size: 12px; }
.heritage-empty-state p { max-width: 560px; margin: 0; color: #77716b; font-size: 9.5px; line-height: 1.9; }
.heritage-loading { display: flex; min-height: 180px; align-items: center; justify-content: center; gap: 7px; }
.heritage-loading span { width: 8px; height: 8px; border-radius: 50%; background: #20523e; animation: heritagePulse .8s ease-in-out infinite alternate; }
.heritage-loading span:nth-child(2) { animation-delay: .15s; }
.heritage-loading span:nth-child(3) { animation-delay: .3s; }
@keyframes heritagePulse { to { opacity: .25; transform: translateY(-5px); } }
.heritage-result-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: -1px -1px 0;
  padding: 20px;
  border-radius: 14px;
  color: #f8f3e8;
  background:
    radial-gradient(circle at 5% 10%, rgba(218, 177, 102, .3), transparent 32%),
    linear-gradient(135deg, #173d2f, #2b664d);
  box-shadow: 0 12px 24px rgba(23, 61, 47, .14);
}
.heritage-result-hero small { color: rgba(255,255,255,.68); font-size: 8px; }
.heritage-result-hero h3 { margin: 2px 0 0; color: #fff9ed; font: 800 31px/1.25 "Amiri", serif; }
.heritage-result-hero p { margin: 4px 0 0; color: rgba(255,255,255,.78); font-size: 9px; }
.heritage-result-hero p b { color: #f0ce8a; }
.heritage-summary-grid { display: grid; grid-template-columns: repeat(3, minmax(62px, 1fr)); gap: 7px; }
.heritage-summary-grid > span { display: grid; min-width: 68px; padding: 8px; border: 1px solid rgba(255,255,255,.12); border-radius: 11px; text-align: center; background: rgba(255,255,255,.075); }
.heritage-summary-grid b { color: #f3d89d; font-size: 14px; }
.heritage-summary-grid small { color: rgba(255,255,255,.68); font-size: 7.5px; }
.heritage-variant-cloud { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 2px 2px; }
.heritage-variant-cloud button { display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px; border: 1px solid rgba(32,82,62,.14); border-radius: 999px; color: #20523e; background: rgba(32,82,62,.045); cursor: pointer; }
.heritage-variant-cloud button:hover { color: #fff; background: #20523e; }
.heritage-variant-cloud b { font: 700 15px/1.3 "Amiri", serif; }
.heritage-variant-cloud small { opacity: .7; font-size: 7px; }
.heritage-section { margin-top: 18px; padding-top: 15px; border-top: 1px solid rgba(32,82,62,.11); }
.heritage-section > header { display: flex; align-items: center; gap: 9px; margin-bottom: 10px; }
.heritage-section > header > span { display: grid; width: 27px; height: 27px; flex: 0 0 27px; place-items: center; border-radius: 8px; color: #fff; background: #20523e; font: 800 9px "Cairo", sans-serif; }
.heritage-section > header > div { display: grid; gap: 1px; }
.heritage-section > header strong { color: #274b3c; font-size: 11px; }
.heritage-section > header small { color: #848079; font-size: 8px; }
.heritage-meaning-list,
.heritage-witness-list,
.heritage-commentary-list { display: grid; gap: 9px; }
.heritage-meaning-card,
.heritage-witness-card,
.heritage-commentary-card { overflow: hidden; border: 1px solid rgba(32,82,62,.12); border-radius: 13px; background: rgba(255,255,255,.88); box-shadow: 0 5px 14px rgba(30,55,44,.04); }
.heritage-meaning-card > header,
.heritage-witness-card > header,
.heritage-commentary-card > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; padding: 10px 13px; background: linear-gradient(135deg, rgba(32,82,62,.065), rgba(184,139,64,.04)); }
.heritage-meaning-card > header > div,
.heritage-commentary-card > header > div { display: grid; gap: 1px; }
.heritage-meaning-card > header strong { color: #20523e; font: 800 20px/1.25 "Amiri", serif; }
.heritage-meaning-card > header span,
.heritage-witness-card > header span,
.heritage-commentary-card > header span { color: #737d77; font-size: 8px; line-height: 1.7; }
.heritage-meaning-card > header small { max-width: 48%; color: #786e64; font-size: 8px; text-align: end; }
.heritage-meaning-card ol { display: grid; gap: 6px; margin: 0; padding: 11px 31px 12px 13px; color: #494842; font-size: 9.5px; line-height: 1.8; }
.heritage-meaning-card > p { margin: 0; padding: 12px; color: #777; font-size: 9px; }
.heritage-synonym-cloud { display: flex; flex-wrap: wrap; gap: 7px; }
.heritage-synonym-cloud button { min-height: 35px; padding: 5px 13px; border: 1px solid rgba(168,116,37,.2); border-radius: 10px; color: #714e1f; background: rgba(184,139,64,.07); cursor: pointer; font: 700 16px "Amiri", serif; }
.heritage-synonym-cloud button:hover { color: #fff; background: #a87425; }
.heritage-witness-card > header strong { color: #20523e; font: 700 16px "Aref Ruqaa", "Amiri", serif; }
.heritage-witness-card > header span { text-align: end; }
.heritage-bayt { display: grid; grid-template-columns: minmax(0,1fr) auto minmax(0,1fr); align-items: center; gap: 12px; padding: 14px 16px; }
.heritage-bayt p { margin: 0; color: #292c29; text-align: center; font: 700 19px/1.9 "Amiri", serif; }
.heritage-bayt i { color: #b48a45; font-size: 7px; font-style: normal; }
.heritage-commentary-card > header strong { color: #20523e; font-size: 10px; }
.heritage-commentary-card > header a { flex: none; color: #8c6426; font-size: 8px; text-decoration: none; }
.heritage-commentary-card blockquote { margin: 0; padding: 11px 14px; border: 0; border-bottom: 1px solid rgba(32,82,62,.08); color: #3a493f; background: rgba(32,82,62,.025); font: 700 17px/1.9 "Amiri", serif; }
.heritage-commentary-card > p { margin: 0; padding: 11px 14px 13px; color: #514e49; font-size: 9.5px; line-height: 1.9; }
.heritage-source-note { margin-top: 18px; padding: 13px 15px; border: 1px dashed rgba(32,82,62,.22); border-radius: 13px; color: #68736c; background: rgba(32,82,62,.03); }
.heritage-source-note strong { color: #20523e; font-size: 10px; }
.heritage-source-note p { margin: 4px 0 8px; font-size: 8.5px; line-height: 1.8; }
.heritage-source-note > div { display: flex; flex-wrap: wrap; gap: 7px; }
.heritage-source-note a { padding: 3px 8px; border-radius: 999px; color: #20523e; background: rgba(32,82,62,.08); font-size: 8px; text-decoration: none; }

@media (max-width: 880px) {
  .language-ai-modal { width: min(760px, calc(100vw - 22px)); }
  .language-ai-grid { grid-template-columns: 1fr; }
  .language-ai-side { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .language-ai-modal {
    width: 100vw;
    max-width: none;
    max-height: calc(100vh - env(safe-area-inset-top, 0px));
    margin: 0;
    border-radius: 22px 22px 0 0;
  }
  .language-tool-tabs { position: sticky; top: 0; z-index: 3; gap: 4px; padding: 5px; background: #faf6f0; }
  .language-tool-tabs button { min-height: 58px; padding: 8px 3px; font-size: 13.5px; line-height: 1.5; }
  .language-ai-intro,
  .dictionary-intro { align-items: flex-start; flex-direction: column; padding: 13px; }
  .language-ai-intro strong,
  .dictionary-intro strong { font-size: 15px; }
  .language-source-switch { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .language-ai-editor { padding: 12px; }
  .language-ai-label { align-items: flex-start; flex-direction: column; gap: 2px; }
  #languageAiSource,
  #languageAiResult { min-height: 120px; font-size: 19px; }
  .language-auto-bar { align-items: stretch; flex-direction: column; }
  .language-auto-run { width: 100%; }
  .language-ending-pad { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .language-ai-side { grid-template-columns: 1fr; }
  .dictionary-search-bar { grid-template-columns: 1fr; }
  .dictionary-search-bar button { min-height: 43px; }
  .dictionary-result-header { align-items: flex-start; flex-direction: column; gap: 3px; }
  .dictionary-entry-card > header { flex-direction: column; }
  .dictionary-entry-card > header small { max-width: none; text-align: right; }
  .synonym-result-header,
  .synonym-sense-card > header { flex-direction: column; }
  .synonym-word-grid { grid-template-columns: 1fr; padding-inline: 10px; }
}

@media (max-width: 620px) {
  .heritage-result-hero { align-items: stretch; flex-direction: column; padding: 16px; }
  .heritage-summary-grid { width: 100%; }
  .heritage-summary-grid > span { min-width: 0; }
  .heritage-variant-cloud { gap: 5px; }
  .heritage-meaning-card > header,
  .heritage-witness-card > header,
  .heritage-commentary-card > header { align-items: flex-start; flex-direction: column; }
  .heritage-meaning-card > header small { max-width: none; text-align: start; }
  .heritage-witness-card > header span { text-align: start; }
  .heritage-bayt { grid-template-columns: 1fr; gap: 3px; padding: 12px 14px; }
  .heritage-bayt i { text-align: center; transform: rotate(45deg); }
  .heritage-bayt p { font-size: 18px; }
  .heritage-source-note { padding: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .language-tool-tabs button,
  #languageAiSource,
  #languageAiResult { transition: none; }
}

/* ================================================================
   Diwani v11.9.1 — result emphasis system
   Keep captions and provenance compact, while making the actual
   linguistic answer the strongest typographic layer in every tab.
   ================================================================ */
#languageAiResult {
  border-color: rgba(139, 26, 26, .3);
  border-inline-start: 4px solid #9f3342;
  color: #651f2a;
  background:
    linear-gradient(180deg, rgba(255,255,255,.98), rgba(255,247,240,.96));
  box-shadow: inset 0 0 0 1px rgba(159, 51, 66, .035);
  font: 700 clamp(25px, 2.35vw, 29px)/2.15 "Amiri", "Noto Naskh Arabic", serif;
}
.language-word-token span {
  color: #651f2a;
  font: 800 20px/1.5 "Amiri", "Noto Naskh Arabic", serif;
}
.language-grammar-hint strong {
  color: #652632;
  font: 800 19px/1.5 "Amiri", "Noto Naskh Arabic", serif;
}
.language-correction-title span {
  color: #8b1a1a;
  font: 800 20px/1.4 "Amiri", "Noto Naskh Arabic", serif;
}

.dictionary-result-header strong {
  color: #7e2431;
  font: 800 29px/1.35 "Amiri", "Noto Naskh Arabic", serif;
}
.dictionary-result-section h4 {
  color: #7e2431;
  font-size: 15px;
  font-weight: 800;
}
.dictionary-result-section li {
  color: #5f2b34;
  font: 700 17px/2 "Amiri", "Noto Naskh Arabic", serif;
}
.dictionary-entry-card > header strong {
  color: #7e2431;
  font: 800 26px/1.35 "Amiri", "Noto Naskh Arabic", serif;
}
.dictionary-definitions p {
  grid-template-columns: 30px minmax(0, 1fr);
  gap: 10px;
}
.dictionary-definitions p span {
  color: #562832;
  font: 700 18px/2.05 "Amiri", "Noto Naskh Arabic", serif;
}
.dictionary-definitions p b {
  width: 26px;
  height: 26px;
  margin-top: 6px;
  font-size: 11px;
}
.dictionary-entry-extra > strong {
  color: #7a3340;
  font-size: 13px;
  font-weight: 800;
}
.dictionary-entry-extra li {
  color: #65333d;
  font: 700 14px/1.8 "Amiri", "Noto Naskh Arabic", serif;
}
.dictionary-entry-extra.examples li {
  color: #553039;
  font-size: 16px;
  line-height: 1.95;
}

.synonym-result-header strong {
  color: #173d68;
  font: 800 29px/1.35 "Amiri", "Noto Naskh Arabic", serif;
}
.synonym-sense-card > header strong {
  color: #173d68;
  font: 800 26px/1.35 "Amiri", "Noto Naskh Arabic", serif;
}
.synonym-definitions p {
  color: #294b70;
  font: 700 17px/1.95 "Amiri", "Noto Naskh Arabic", serif;
}
.synonym-word-main {
  min-height: 43px;
  color: #173d68;
  font: 800 23px/1.45 "Amiri", "Noto Naskh Arabic", serif;
}
.synonym-empty strong {
  color: #294b70;
  font-size: 15px;
}
.synonym-empty p {
  color: #5f7184;
  font-size: 13px;
  line-height: 1.9;
}

.heritage-result-hero h3 {
  color: #fff9ed;
  font: 800 35px/1.3 "Amiri", "Noto Naskh Arabic", serif;
}
.heritage-section > header strong {
  color: #20523e;
  font-size: 14px;
  font-weight: 800;
}
.heritage-meaning-card > header strong {
  color: #1d5a42;
  font: 800 25px/1.35 "Amiri", "Noto Naskh Arabic", serif;
}
.heritage-meaning-card ol {
  color: #234e3c;
  font: 700 17px/2.05 "Amiri", "Noto Naskh Arabic", serif;
}
.heritage-synonym-cloud button {
  min-height: 41px;
  color: #75501e;
  font: 800 21px/1.45 "Amiri", "Noto Naskh Arabic", serif;
}
.heritage-witness-card > header strong {
  color: #1d5a42;
  font: 800 19px/1.5 "Aref Ruqaa", "Amiri", serif;
}
.heritage-bayt p {
  color: #183f31;
  font: 800 23px/2.05 "Amiri", "Noto Naskh Arabic", serif;
}
.heritage-commentary-card > header strong {
  color: #1d5a42;
  font-size: 14px;
  font-weight: 800;
}
.heritage-commentary-card blockquote {
  color: #244f3d;
  font: 800 21px/2 "Amiri", "Noto Naskh Arabic", serif;
}
.heritage-commentary-card > p {
  color: #4f3827;
  font: 700 17px/2 "Amiri", "Noto Naskh Arabic", serif;
}

@media (max-width: 620px) {
  #languageAiResult {
    min-height: 145px;
    padding: 14px;
    font-size: 24px;
    line-height: 2.1;
  }
  .language-word-token span { font-size: 19px; }
  .dictionary-results { padding: 11px; }
  .dictionary-result-header strong,
  .synonym-result-header strong { font-size: 26px; }
  .dictionary-entry-card > header strong,
  .synonym-sense-card > header strong { font-size: 23px; }
  .dictionary-definitions { padding-inline: 11px; }
  .dictionary-definitions p span { font-size: 17px; line-height: 2; }
  .dictionary-entry-extra.examples li { font-size: 15px; }
  .synonym-definitions p { font-size: 16px; }
  .synonym-word-main { font-size: 22px; }
  .heritage-result-hero h3 { font-size: 31px; }
  .heritage-meaning-card ol { padding-inline-start: 29px; font-size: 16.5px; }
  .heritage-synonym-cloud button { font-size: 20px; }
  .heritage-bayt p { font-size: 21px; line-height: 2; }
  .heritage-commentary-card blockquote { font-size: 19px; }
  .heritage-commentary-card > p { font-size: 16px; }
}


/* ================================================================
   Diwani v11.10.0 — synonyms + antonyms semantic evidence system
   ================================================================ */
.semantic-summary {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}
.semantic-summary > span {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid rgba(75, 91, 110, .12);
  border-radius: 11px;
  color: #647180;
  background: rgba(255,255,255,.74);
  font-size: 9px;
}
.semantic-summary > span b { color: #3d4c5d; font-size: 14px; }
.semantic-summary > span.synonyms { border-color: rgba(30,58,95,.18); color: #315d87; background: rgba(30,58,95,.055); }
.semantic-summary > span.synonyms b { color: #173d68; }
.semantic-summary > span.antonyms { border-color: rgba(158,54,50,.18); color: #98514b; background: rgba(158,54,50,.055); }
.semantic-summary > span.antonyms b { color: #8f2f2c; }
.semantic-source-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding-top: 11px;
}
.semantic-source-strip span {
  padding: 4px 9px;
  border: 1px solid rgba(83, 98, 113, .1);
  border-radius: 999px;
  color: #667686;
  background: rgba(241,245,248,.8);
  font-size: 8px;
}
.semantic-poetry-note {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 11px;
  padding: 10px 12px;
  border: 1px solid rgba(32,82,62,.14);
  border-radius: 12px;
  color: #315d49;
  background: rgba(32,82,62,.045);
}
.semantic-poetry-note > b {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  place-items: center;
  border-radius: 9px;
  color: #fff;
  background: #20523e;
}
.semantic-poetry-note > div { display: grid; gap: 2px; }
.semantic-poetry-note strong { color: #20523e; font-size: 11px; }
.semantic-poetry-note span { color: #617269; font-size: 9px; line-height: 1.75; }
.semantic-poetry-note span b { color: #a46f22; }
.semantic-relation-layout { display: grid; gap: 12px; padding: 12px 14px 14px; }
.semantic-relation-block {
  overflow: hidden;
  border: 1px solid rgba(30,58,95,.11);
  border-radius: 13px;
  background: rgba(246,249,252,.7);
}
.semantic-relation-block > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 11px;
  border-bottom: 1px solid rgba(30,58,95,.09);
  background: rgba(30,58,95,.055);
}
.semantic-relation-block > header > div { display: grid; gap: 1px; }
.semantic-relation-block > header strong { color: #173d68; font-size: 13px; font-weight: 800; }
.semantic-relation-block > header small { color: #718092; font-size: 8px; }
.semantic-relation-block > header > b {
  display: grid;
  min-width: 27px;
  height: 27px;
  padding-inline: 5px;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: #1e3a5f;
  font-size: 9px;
}
.semantic-relation-block .synonym-word-grid { padding: 10px; }
.semantic-relation-block.antonym {
  border-color: rgba(158,54,50,.14);
  background: rgba(255,249,248,.8);
}
.semantic-relation-block.antonym > header {
  border-color: rgba(158,54,50,.1);
  background: rgba(158,54,50,.055);
}
.semantic-relation-block.antonym > header strong { color: #8f2f2c; }
.semantic-relation-block.antonym > header small { color: #9a6a66; }
.semantic-relation-block.antonym > header > b { background: #9a3833; }
.semantic-word-card.is-antonym {
  border-color: rgba(158,54,50,.14);
  box-shadow: 0 5px 14px rgba(126,41,37,.045);
}
.semantic-word-card.is-antonym .synonym-word-main {
  color: #8f2f2c;
  background: rgba(158,54,50,.07);
}
.semantic-word-card.is-antonym .synonym-word-main:hover { color: #fff; background: #9a3833; }
.semantic-word-evidence { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; }
.semantic-word-evidence span {
  padding: 3px 6px;
  border-radius: 999px;
  color: #667687;
  background: #f1f5f8;
  font-size: 7px;
  line-height: 1.25;
}
.semantic-word-card.is-antonym .semantic-word-evidence span { color: #8b5b57; background: rgba(158,54,50,.07); }
.heritage-relation-groups { display: grid; gap: 11px; }
.heritage-relation-group {
  padding: 10px;
  border: 1px solid rgba(168,116,37,.14);
  border-radius: 12px;
  background: rgba(184,139,64,.035);
}
.heritage-relation-group > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.heritage-relation-group > header strong { color: #714e1f; font-size: 11px; }
.heritage-relation-group > header b {
  display: grid;
  min-width: 25px;
  height: 25px;
  padding-inline: 4px;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: #a87425;
  font-size: 8px;
}
.heritage-relation-group.antonym {
  border-color: rgba(158,54,50,.14);
  background: rgba(158,54,50,.035);
}
.heritage-relation-group.antonym > header strong { color: #8f2f2c; }
.heritage-relation-group.antonym > header b { background: #9a3833; }
.heritage-relation-group.antonym .heritage-synonym-cloud button {
  border-color: rgba(158,54,50,.18);
  color: #8f2f2c;
  background: rgba(158,54,50,.06);
}
.heritage-relation-group.antonym .heritage-synonym-cloud button:hover { color: #fff; background: #9a3833; }

@media (max-width: 620px) {
  .semantic-summary { width: 100%; justify-content: stretch; }
  .semantic-summary > span { flex: 1; justify-content: center; }
  .semantic-relation-layout { padding: 10px; }
  .semantic-relation-block .synonym-word-grid { padding: 8px; }
  .semantic-poetry-note { align-items: flex-start; }
}


/* Diwani v11.10.1 — prominent main language-service tab titles */
