/* =========================================================================
   Demand Radar - Apple-style design system
   System fonts, system colours, automatic light/dark, precise spacing.
   ========================================================================= */

:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text",
          "Helvetica Neue", "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;

  --bg: #f5f5f7;
  --bg-elevated: #ffffff;
  --bg-sunken: #ebebed;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --text-3: #86868b;
  --sep: rgba(0, 0, 0, .10);
  --sep-soft: rgba(0, 0, 0, .06);

  --blue: #0071e3;
  --blue-hover: #0077ed;
  --green: #30a46c;
  --orange: #f5a623;
  --red: #e5484d;

  --tier-s: #ff375f;
  --tier-a: #ff9f0a;
  --tier-b: #0a84ff;
  --tier-c: #8e8e93;

  --radius: 18px;
  --radius-sm: 11px;
  --radius-pill: 980px;
  --shadow-1: 0 1px 2px rgba(0,0,0,.04), 0 4px 14px rgba(0,0,0,.06);
  --shadow-2: 0 2px 6px rgba(0,0,0,.06), 0 18px 48px rgba(0,0,0,.12);
  --sheet-w: 720px;
  --ease: cubic-bezier(.32, .72, 0, 1);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #000000;
    --bg-elevated: #1c1c1e;
    --bg-sunken: #141416;
    --text: #f5f5f7;
    --text-2: #a1a1a6;
    --text-3: #86868b;
    --sep: rgba(255, 255, 255, .14);
    --sep-soft: rgba(255, 255, 255, .08);
    --blue: #0a84ff;
    --blue-hover: #3d9bff;
    --green: #30d158;
    --orange: #ff9f0a;
    --red: #ff453a;
    --shadow-1: 0 1px 2px rgba(0,0,0,.5), 0 4px 14px rgba(0,0,0,.4);
    --shadow-2: 0 2px 6px rgba(0,0,0,.6), 0 20px 50px rgba(0,0,0,.6);
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: 15px;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { margin: 0; letter-spacing: -.022em; font-weight: 700; }
img { display: block; }
button { font-family: inherit; cursor: pointer; }

/* ---------------------------------------------------------------- nav ---- */
.nav {
  position: sticky; top: 0; z-index: 60;
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--sep-soft);
}
.nav-inner {
  max-width: 1240px; margin: 0 auto; padding: 0 24px;
  height: 52px; display: flex; align-items: center; gap: 26px;
}
.brand { display: flex; align-items: center; gap: 9px; flex-shrink: 0; }
.brand-mark { color: var(--blue); display: flex; }
.brand-text { font-size: 17px; font-weight: 500; letter-spacing: -.02em; }
.brand-text b { font-weight: 700; }

.tabs { display: flex; gap: 4px; flex: 1; }
.tabs a {
  font-size: 13.5px; font-weight: 500; color: var(--text-2);
  padding: 6px 13px; border-radius: var(--radius-pill);
  transition: color .18s, background .18s;
}
.tabs a:hover { color: var(--text); background: var(--sep-soft); }
.tabs a.active { color: var(--text); background: var(--bg-elevated); box-shadow: var(--shadow-1); }

.nav-meta { display: flex; align-items: center; gap: 10px; }
.pill {
  font-size: 12px; font-weight: 500; color: var(--text-2);
  background: var(--bg-elevated); border: 1px solid var(--sep-soft);
  padding: 4px 11px; border-radius: var(--radius-pill); white-space: nowrap;
}
.icon-btn {
  width: 30px; height: 30px; display: grid; place-items: center;
  border: 1px solid var(--sep-soft); background: var(--bg-elevated);
  color: var(--text-2); border-radius: 50%; transition: .18s;
}
.icon-btn:hover { color: var(--text); transform: scale(1.06); }
.icon-btn.spinning svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* -------------------------------------------------------------- layout ---- */
main { max-width: 1240px; margin: 0 auto; padding: 0 24px 80px; }
.view { animation: fade .32s var(--ease); }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }

.hero { padding: 52px 0 26px; max-width: 760px; }
.eyebrow {
  font-size: 12px; font-weight: 600; letter-spacing: .09em; text-transform: uppercase;
  color: var(--blue); margin: 0 0 10px;
}
.hero h1 { font-size: clamp(34px, 5.4vw, 50px); line-height: 1.06; letter-spacing: -.03em; }
.lede { font-size: 17px; color: var(--text-2); margin: 16px 0 0; line-height: 1.5; }
.lede em { font-style: normal; color: var(--text); font-weight: 500; }

/* ------------------------------------------------------------ controls ---- */
.controls {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  padding: 14px 0 20px;
}
.segmented {
  display: inline-flex; background: var(--bg-sunken); border-radius: var(--radius-sm);
  padding: 2px; gap: 2px;
}
.seg {
  border: 0; background: transparent; color: var(--text-2);
  font-size: 12.5px; font-weight: 500; padding: 6px 12px; border-radius: 9px;
  transition: .2s var(--ease); white-space: nowrap;
}
.seg:hover { color: var(--text); }
.seg.active { background: var(--bg-elevated); color: var(--text); box-shadow: var(--shadow-1); }

.field {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--bg-elevated); border: 1px solid var(--sep-soft);
  border-radius: var(--radius-sm); padding: 5px 10px 5px 12px;
}
.field > span { font-size: 12px; color: var(--text-3); font-weight: 500; white-space: nowrap; }
.field select {
  border: 0; background: transparent; color: var(--text); font-family: inherit;
  font-size: 13px; font-weight: 500; padding: 3px 2px; outline: none; cursor: pointer;
  appearance: none; -webkit-appearance: none;
}
.field select option { background: var(--bg-elevated); color: var(--text); }

.switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .track {
  width: 38px; height: 23px; border-radius: var(--radius-pill);
  background: var(--bg-sunken); border: 1px solid var(--sep);
  position: relative; transition: .25s var(--ease); flex-shrink: 0;
}
.switch .track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 17px; height: 17px;
  border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.3);
  transition: .25s var(--ease);
}
.switch input:checked + .track { background: var(--green); border-color: transparent; }
.switch input:checked + .track::after { transform: translateX(15px); }
.switch-label { font-size: 12.5px; color: var(--text-2); font-weight: 500; }

.result-meta { font-size: 13px; color: var(--text-3); padding: 4px 0 18px; }
.result-meta b { color: var(--text-2); font-weight: 600; }

/* ---------------------------------------------------------------- grid ---- */
.grid {
  display: grid; gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(336px, 1fr));
}

.card {
  background: var(--bg-elevated); border: 1px solid var(--sep-soft);
  border-radius: var(--radius); padding: 18px 18px 15px;
  box-shadow: var(--shadow-1); cursor: pointer;
  transition: transform .28s var(--ease), box-shadow .28s var(--ease);
  display: flex; flex-direction: column; gap: 14px; position: relative; overflow: hidden;
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); }
.card::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 3px;
  background: var(--tier-c); opacity: .9;
}
.card.tier-S::before { background: var(--tier-s); }
.card.tier-A::before { background: var(--tier-a); }
.card.tier-B::before { background: var(--tier-b); }

.card-top { display: flex; gap: 13px; align-items: flex-start; }
.app-icon {
  width: 54px; height: 54px; border-radius: 13px; flex-shrink: 0;
  background: var(--bg-sunken); object-fit: cover;
  box-shadow: 0 2px 8px rgba(0,0,0,.14); border: 1px solid var(--sep-soft);
}
.app-icon.lg { width: 68px; height: 68px; border-radius: 16px; }
.card-id { min-width: 0; flex: 1; }
.card-name {
  font-size: 15.5px; font-weight: 600; letter-spacing: -.015em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-dev {
  font-size: 12.5px; color: var(--text-3); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.card-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 8px; }
.tag {
  font-size: 11px; font-weight: 500; color: var(--text-2);
  background: var(--bg-sunken); padding: 2.5px 8px; border-radius: 6px;
}
.tag.warn { color: var(--orange); background: color-mix(in srgb, var(--orange) 14%, transparent); }
.tag.good { color: var(--green); background: color-mix(in srgb, var(--green) 14%, transparent); }

.score-badge {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  border-radius: 12px; padding: 7px 11px; min-width: 58px; flex-shrink: 0;
  background: var(--bg-sunken);
}
.score-badge .num { font-size: 20px; font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.score-badge .tier { font-size: 9.5px; font-weight: 700; letter-spacing: .08em; color: var(--text-3); }
.tier-S .score-badge .num { color: var(--tier-s); }
.tier-A .score-badge .num { color: var(--tier-a); }
.tier-B .score-badge .num { color: var(--tier-b); }

.metrics { display: flex; gap: 16px; }
.metric { flex: 1; min-width: 0; }
.metric-label {
  font-size: 10.5px; font-weight: 600; color: var(--text-3);
  letter-spacing: .05em; text-transform: uppercase;
}
.metric-value { font-size: 15px; font-weight: 600; letter-spacing: -.01em; margin-top: 1px; }
.metric-value .unit { font-size: 11.5px; color: var(--text-3); font-weight: 500; }

.bar { height: 5px; border-radius: 3px; background: var(--bg-sunken); overflow: hidden; margin-top: 6px; }
.bar > i { display: block; height: 100%; border-radius: 3px; background: var(--blue); transition: width .5s var(--ease); }
.bar.demand > i { background: var(--blue); }
.bar.diss > i { background: var(--orange); }
.bar.diss.hot > i { background: var(--tier-s); }
.bar.paying > i { background: var(--green); }

.card-theme {
  font-size: 13px; color: var(--text-2); line-height: 1.45;
  padding-block-start: 12px; border-block-start: 1px solid var(--sep-soft);
  margin-top: auto;      /* push footer down so rows align */
}
.card-foot { margin-top: auto; }
.card-theme + .card-foot { margin-top: 0; }
.card-theme b { color: var(--text); font-weight: 600; }
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.verdict {
  font-size: 12px; font-weight: 600; display: inline-flex; align-items: center; gap: 5px;
}
.verdict.proven, .verdict.promising { color: var(--green); }
.verdict.unproven, .verdict.no-signal { color: var(--text-3); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.ghost-btn {
  border: 1px solid var(--sep); background: transparent; color: var(--text-2);
  font-size: 12px; font-weight: 500; padding: 5px 12px; border-radius: var(--radius-pill);
  transition: .18s;
}
.ghost-btn:hover { background: var(--bg-sunken); color: var(--text); }
.ghost-btn.on { background: var(--blue); border-color: transparent; color: #fff; }

/* --------------------------------------------------------------- sheet ---- */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.34); z-index: 80;
  backdrop-filter: blur(2px); animation: fade .24s var(--ease);
}
.sheet {
  position: fixed; inset-block: 0; inset-inline-end: 0; width: min(var(--sheet-w), 100%);
  background: var(--bg); z-index: 90; overflow-y: auto;
  box-shadow: -20px 0 60px rgba(0,0,0,.22);
  animation: slideIn .38s var(--ease);
  overscroll-behavior: contain;
}
@keyframes slideIn { from { transform: translateX(100%); } }
html[dir="rtl"] .sheet { animation-name: slideInRtl; }
@keyframes slideInRtl { from { transform: translateX(-100%); } }

.sheet-head {
  position: sticky; top: 0; z-index: 2; padding: 20px 26px 16px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--sep-soft);
}
.close-btn {
  position: absolute; inset-block-start: 18px; inset-inline-end: 22px;
  width: 30px; height: 30px; border-radius: 50%; border: 0;
  background: var(--bg-sunken); color: var(--text-2); font-size: 14px;
  transition: .18s;
}
.close-btn:hover { background: var(--sep); color: var(--text); }
.sheet-ident { display: flex; gap: 15px; align-items: center; padding-inline-end: 44px; }
.sheet-ident h2 { font-size: 21px; letter-spacing: -.02em; }
.muted { color: var(--text-3); font-size: 13px; margin: 3px 0 0; }
.sheet-score { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.chip {
  font-size: 12px; font-weight: 600; padding: 5px 11px; border-radius: var(--radius-pill);
  background: var(--bg-sunken); color: var(--text-2);
}
.chip.s { background: color-mix(in srgb, var(--tier-s) 16%, transparent); color: var(--tier-s); }
.chip.a { background: color-mix(in srgb, var(--tier-a) 16%, transparent); color: var(--tier-a); }
.chip.b { background: color-mix(in srgb, var(--tier-b) 16%, transparent); color: var(--tier-b); }
.chip.good { background: color-mix(in srgb, var(--green) 16%, transparent); color: var(--green); }

.sheet-body { padding: 22px 26px 60px; }
.block { margin-bottom: 30px; }
.block > h3 {
  font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--text-3); margin-bottom: 13px;
}
.note-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; }
.note-list li {
  font-size: 13.5px; color: var(--text-2); line-height: 1.5;
  padding-inline-start: 18px; position: relative;
}
.note-list li::before {
  content: ""; position: absolute; inset-inline-start: 4px; inset-block-start: 8px;
  width: 5px; height: 5px; border-radius: 50%; background: var(--blue);
}

.comp-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 11px; }
.comp {
  background: var(--bg-elevated); border: 1px solid var(--sep-soft);
  border-radius: var(--radius-sm); padding: 12px 14px;
}
.comp-label { font-size: 11px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .05em; }
.comp-value { font-size: 22px; font-weight: 700; letter-spacing: -.03em; margin: 3px 0 6px; }
.comp-note { font-size: 11.5px; color: var(--text-3); margin-top: 7px; line-height: 1.4; }

.theme-row {
  background: var(--bg-elevated); border: 1px solid var(--sep-soft);
  border-radius: var(--radius-sm); padding: 14px 15px; margin-bottom: 10px;
}
.theme-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.theme-name { font-size: 14.5px; font-weight: 600; }
.theme-share { font-size: 12.5px; color: var(--text-3); white-space: nowrap; }
.theme-why { font-size: 13px; color: var(--text-2); margin-top: 6px; line-height: 1.5; }
.theme-wedge {
  font-size: 12.5px; color: var(--blue); margin-block-start: 8px; font-weight: 500;
  padding-inline-start: 12px; border-inline-start: 2px solid var(--blue);
}
.quote {
  font-size: 12.5px; color: var(--text-2); font-style: italic;
  padding-block-start: 8px; padding-inline-start: 11px;
  border-inline-start: 2px solid var(--sep); margin-block-start: 9px; line-height: 1.5;
}

.repo {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--bg-elevated); border: 1px solid var(--sep-soft);
  border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 9px;
}
.repo-main { flex: 1; min-width: 0; }
.repo-name { font-size: 13.5px; font-weight: 600; font-family: var(--mono); }
.repo-desc { font-size: 12.5px; color: var(--text-2); margin-top: 3px; line-height: 1.45; }
.repo-meta { display: flex; gap: 10px; margin-top: 7px; font-size: 11.5px; color: var(--text-3); }
.lic { font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 6px; white-space: nowrap; }
.lic.safe { color: var(--green); background: color-mix(in srgb, var(--green) 14%, transparent); }
.lic.risk { color: var(--red); background: color-mix(in srgb, var(--red) 14%, transparent); }
.lic.unknown { color: var(--text-3); background: var(--bg-sunken); }

.prompt-box {
  font-family: var(--mono); font-size: 11.5px; line-height: 1.6;
  background: var(--bg-sunken); border: 1px solid var(--sep-soft); border-radius: var(--radius-sm);
  padding: 15px; white-space: pre-wrap; word-break: break-word;
  max-height: 340px; overflow-y: auto; color: var(--text-2);
}
.row-actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 12px; }
.btn {
  border: 0; background: var(--blue); color: #fff; font-size: 13px; font-weight: 600;
  padding: 9px 17px; border-radius: var(--radius-pill); transition: .18s;
}
.btn:hover { background: var(--blue-hover); }
.btn.sec { background: var(--bg-elevated); color: var(--text); border: 1px solid var(--sep); }
.btn.sec:hover { background: var(--bg-sunken); }

.skeleton {
  height: 190px; border-radius: var(--radius); background: var(--bg-elevated);
  border: 1px solid var(--sep-soft); position: relative; overflow: hidden;
}
.skeleton::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, var(--sep-soft), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

.empty {
  grid-column: 1 / -1; text-align: center; padding: 64px 20px;
  color: var(--text-3); font-size: 14.5px;
}
.empty strong { display: block; color: var(--text); font-size: 17px; margin-bottom: 7px; }

/* -------------------------------------------------------------- method ---- */
.method-body { display: flex; flex-direction: column; gap: 34px; padding-bottom: 40px; }
.mcard {
  background: var(--bg-elevated); border: 1px solid var(--sep-soft);
  border-radius: var(--radius); padding: 24px 26px; box-shadow: var(--shadow-1);
}
.mcard h2 { font-size: 20px; margin-bottom: 12px; }
.mcard h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin: 20px 0 9px; }
.mcard p { color: var(--text-2); font-size: 14px; line-height: 1.62; margin: 0 0 10px; }
.formula {
  font-family: var(--mono); font-size: 12.5px; background: var(--bg-sunken);
  padding: 13px 15px; border-radius: var(--radius-sm); color: var(--text); margin: 12px 0;
  overflow-x: auto; white-space: nowrap;
}
table.mtable { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 8px; }
table.mtable th {
  text-align: start; font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-3); font-weight: 600; padding-block: 0 8px; padding-inline: 0 10px; border-bottom: 1px solid var(--sep);
}
table.mtable td { padding-block: 10px; padding-inline: 0 10px; border-bottom: 1px solid var(--sep-soft); color: var(--text-2); vertical-align: top; }
table.mtable td:first-child { color: var(--text); font-weight: 500; white-space: nowrap; }
.limits { margin: 0; padding-inline-start: 18px; color: var(--text-2); font-size: 13.5px; line-height: 1.7; }

/* --------------------------------------------------------------- foot ---- */
.foot {
  max-width: 1240px; margin: 0 auto; padding: 26px 24px 44px;
  display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  font-size: 12px; color: var(--text-3); border-top: 1px solid var(--sep-soft);
}

/* -------------------------------------------------------------- toast ---- */
.toast {
  position: fixed; bottom: 26px; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg); font-size: 13px; font-weight: 500;
  padding-block: 11px; padding-inline: 20px; border-radius: var(--radius-pill); z-index: 200;
  box-shadow: var(--shadow-2); animation: fade .25s var(--ease);
}

@media (max-width: 820px) {
  .nav-inner { gap: 14px; padding: 0 16px; height: auto; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
  .tabs { order: 3; width: 100%; overflow-x: auto; }
  .tabs a { white-space: nowrap; }
  main { padding: 0 16px 60px; }
  .hero { padding: 34px 0 20px; }
  .grid { grid-template-columns: 1fr; }
  .comp-grid { grid-template-columns: 1fr; }
  .sheet { width: 100%; }
  .foot { padding: 22px 16px 40px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}


/* ------------------------------------------------------------ language ---- */
.lang { position: relative; }
.lang-menu {
  position: absolute; inset-block-start: calc(100% + 8px); inset-inline-end: 0;
  min-width: 232px; max-height: 62vh; overflow-y: auto;
  background: color-mix(in srgb, var(--bg-elevated) 94%, transparent);
  backdrop-filter: saturate(180%) blur(22px);
  -webkit-backdrop-filter: saturate(180%) blur(22px);
  border: 1px solid var(--sep); border-radius: 13px;
  box-shadow: var(--shadow-2); padding: 5px; z-index: 120;
  animation: fade .18s var(--ease);
}
.lang-item {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  width: 100%; border: 0; background: transparent; color: var(--text);
  font-size: 13.5px; text-align: start; padding-block: 8px; padding-inline: 11px;
  border-radius: 9px; cursor: pointer; transition: background .14s;
}
.lang-item:hover { background: var(--sep-soft); }
.lang-item[aria-selected="true"] { background: var(--blue); color: #fff; }
.lang-item .native { font-weight: 500; font-size: 14px; }
.lang-check { font-size: 12px; opacity: 0; }
.lang-item[aria-selected="true"] .lang-check { opacity: 1; }

/* ---------------------------------------------------------------- rtl ---- */
html[dir="rtl"] body { font-family: var(--font); }
html[dir="rtl"] .hero h1,
html[dir="rtl"] .card-name,
html[dir="rtl"] .brand-text { letter-spacing: normal; }
html[dir="rtl"] .eyebrow { letter-spacing: .04em; }
html[dir="rtl"] .metric-label,
html[dir="rtl"] .block > h3,
html[dir="rtl"] .comp-label { letter-spacing: .02em; }
/* Numeric bars intentionally keep filling from the start edge in every script:
   a 26/100 score is a scalar, not a direction, and mirroring it made the
   comparison between cards harder. (An earlier rule tried to mirror them but
   never applied, so the behaviour is unchanged — this just documents it.) */

/* ------------------------------------------------ mixed-direction text ---- */
/* An English app name inside an RTL layout must still read left-to-right and
   truncate from its own end, not the page's. `plaintext` lets the content's
   first strong character decide, which is the correct bidi behaviour. */
.card-name, .card-dev, .repo-name, .repo-desc, .app-name-ltr,
.sheet-ident h2, .quote, .prompt-box, .formula, code {
  unicode-bidi: plaintext;
}
html[dir="rtl"] .card-name,
html[dir="rtl"] .card-dev,
html[dir="rtl"] .repo-name,
html[dir="rtl"] .repo-desc { text-align: start; }

/* ---------------------------------------------------- text elasticity ---- */
/* German/Russian run 30%+ longer than English: never clip a label.
   (The old `max-width: 12ch` here contradicted this comment and truncated
   "Mindestanzahl" to "Mindestanzah…". Labels now wrap instead.) */
.card-tags .tag { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
.field > span { white-space: nowrap; }
.metric-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.theme-head { flex-wrap: wrap; }
