/* Root explorer */

.roots__intro { display: flex; flex-direction: column; gap: 0; max-width: 620px; }
.roots__intro .screen-header__sub { margin-top: 16px; }
.roots__pick { font-size: 22px; padding: 4px 16px; }

/* Desktop: root + legend on the left, words on the right.
   Phones: root, then words, then the legend. */
.roots__layout {
  display: grid;
  grid-template-columns: minmax(0, 320px) minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  grid-template-areas: "core main" "legend main";
  gap: 16px 24px;
  align-items: start;
}
.roots__core { grid-area: core; }
.roots__legend { grid-area: legend; }
.roots__main { grid-area: main; display: flex; flex-direction: column; gap: 20px; min-width: 0; }

.roots__core {
  border-radius: 20px;
  padding: 30px 26px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
  text-align: center;
}
.roots__letters { font-size: 72px; line-height: 1.2; letter-spacing: 12px; color: var(--peach); }
.roots__meaning { font-size: 28px; }
.roots__count { font-size: 14px; color: var(--text-on-dark-muted); }

.roots__legend { padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.roots__legend-title { font-size: 15px; font-weight: 600; margin: 0; }
.roots__legend dl { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.roots__legend-row {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  border-top: 1px solid var(--line-soft);
  padding-top: 8px;
}
.roots__legend-row dt { font-size: 20px; text-align: right; }
.roots__legend-row dd { margin: 0; font-size: 13px; line-height: 1.4; color: var(--text-body); }

.roots__selected {
  background: var(--clay-soft);
  border-radius: var(--radius-card);
  padding: 20px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}
.roots__selected-en { font-size: 28px; line-height: 1.1; }
.roots__selected-meta { font-size: 14px; color: var(--text-body); }
.roots__selected-meta .ar { font-size: 18px; }
.roots__lookup { font-size: 13px; font-weight: 600; }
.roots__selected-actions { --row-gap: 10px; }
.roots__selected-ar { font-size: 44px; line-height: 1.2; }
.roots__audio { background: var(--card); color: var(--ink); }
.roots__audio:hover { background: var(--paper); }

.roots__heading { margin: 0; }
.roots__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr));
  gap: 10px;
}
.roots__word {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  color: var(--ink);
  text-decoration: none;
  transition: border-color .15s ease;
}
.roots__word:hover { border-color: var(--ink); color: var(--ink); text-decoration: none; }
.roots__word[aria-current="true"] { background: var(--clay-soft); border-color: var(--clay); }
.roots__word-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 700;
}
.roots__word-pattern { font-size: 16px; font-weight: 400; }
.roots__word-ar { font-size: 30px; line-height: 1.4; text-align: right; }
.roots__word-en { font-size: 13px; line-height: 1.35; }

@media (max-width: 760px) {
  .roots__layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "core" "main" "legend"; grid-template-rows: none; }
  .roots__letters { font-size: 60px; }
  .roots__grid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 140px), 1fr)); }
  .roots__selected { padding: 18px; }
  .roots__selected-ar { font-size: 38px; }
}

/* Root finder */
.roots__finder { align-items: flex-end; }
.roots__search { display: flex; gap: 8px; }
.roots__search-input { width: 160px; font-family: var(--font-arabic); font-size: 18px; text-align: center; }
.roots__dict-link { color: var(--peach); font-size: 14px; font-weight: 600; margin-top: 4px; }
.roots__dict-link:hover { color: var(--paper); }

@media (max-width: 860px) {
  .roots__finder { align-items: stretch; width: 100%; min-width: 0; }
  .roots__search-input { flex: 1; width: auto; min-width: 0; }
}
