:root {
  color-scheme: dark;
  --bg: #050606;
  --panel: #0b0c0e;
  --card: #202b3b;
  --card-2: #3a4659;
  --line: #202225;
  --text: #f7f7f7;
  --muted: #aab0ba;
  --link: #4b93ff;
  --gold: #ffc861;
  --accent: #ffbd71;
  --red: #e36e4d;
  --blue: #6faad8;
}

* { box-sizing: border-box; }

/* Real-link anchors (a[data-soc-nav]) replace former buttons/spans on every
   navigable surface; zero-specificity reset so the existing class rules
   (.keyword underline, .name-link color, tile/button looks) stay in charge. */
a:where([data-soc-nav]) {
  color: inherit;
  font: inherit;
  text-decoration: none;
  cursor: pointer;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) minmax(620px, auto);
  align-items: center;
  height: 64px;
  border-bottom: 1px solid var(--line);
  background: rgba(7, 8, 9, 0.95);
  backdrop-filter: blur(8px);
}

.topbar h1 {
  /* Pinned to the middle column: the back button (col 1) is display:none on
     list views, which would otherwise slide the title into its 120px cell. */
  grid-column: 2;
  grid-row: 1;
  margin: 0;
  text-align: center;
  font-size: 30px;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-actions {
  grid-column: 3;
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding-right: 14px;
  min-width: 0;
}

.nav-button,
.text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.nav-button.active,
.text-button:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: #111;
}

.text-button:disabled {
  opacity: .45;
  cursor: default;
}

.text-button:disabled:hover {
  border-color: var(--line);
  background: var(--panel);
  color: var(--text);
}

.icon-button, input {
  border: 1px solid #303238;
  background: #151617;
  color: var(--text);
  min-height: 44px;
  border-radius: 8px;
  font: inherit;
}

.icon-button {
  width: 52px;
  font-size: 22px;
  cursor: pointer;
}

#backButton {
  width: auto;
  margin-left: 16px;
  padding: 0 14px;
  color: var(--link);
  border-color: transparent;
  background: transparent;
}

main {
  padding: 54px 36px 28px;
}

.hidden { display: none !important; }

.intro h2 {
  margin: 12px 0 24px;
  font-size: 36px;
}

.intro p {
  margin: 0 0 18px;
  font-size: 24px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(230px, 360px) 122px;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}

#searchInput,
#catalogSearchInput,
#termGraphSearchInput {
  padding: 0 18px;
  font-size: 21px;
}

.faction-filter-panel {
  margin-bottom: 22px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #090a0b;
}

.filter-panel-grid {
  display: grid;
  grid-template-columns: minmax(520px, 1.15fr) minmax(420px, .85fr);
  gap: 18px;
  align-items: start;
}

.equipment-filter-grid {
  grid-template-columns: minmax(420px, .75fr) minmax(560px, 1.25fr);
}

.filter-panel-column {
  display: grid;
  gap: 8px;
}

.faction-filter-row {
  display: grid;
  grid-template-columns: 92px 1fr;
  align-items: center;
  gap: 10px;
  min-height: 46px;
}

.faction-filter-label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.faction-filter-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.faction-filter-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 46px;
  height: 42px;
  padding: 3px 8px;
  border: 1px solid #303238;
  border-radius: 7px;
  background: #151617;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.faction-filter-button.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #101010;
}

/* Faction buttons: icon on top, lock control underneath. Icon click toggles
   chosen (OR); the lock toggles AND-required. */
.faction-filter-button.faction-tri {
  flex-direction: column;
  gap: 1px;
  height: auto;
  min-height: 58px;
  padding: 4px 6px 3px;
}

.faction-filter-button.locked {
  border-color: var(--accent);
  background: #2b2410;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06), 0 0 6px rgba(230, 180, 60, 0.35);
}

.faction-filter-button .filter-icon-area {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.faction-filter-button .filter-lock-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: 1px 0;
  border-radius: 4px;
  color: #5b5e66;
}

.faction-filter-button .filter-lock-toggle:hover {
  color: var(--accent);
  background: rgba(255, 255, 255, 0.07);
}

.faction-filter-button.active .filter-lock-toggle {
  color: rgba(16, 16, 16, 0.65);
}

.faction-filter-button.active .filter-lock-toggle:hover {
  color: #101010;
  background: rgba(0, 0, 0, 0.12);
}

.faction-filter-button .filter-lock-toggle.is-locked {
  color: var(--accent);
}

.faction-filter-button .filter-lock-toggle svg {
  width: 14px;
  height: 14px;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.7));
}

.faction-filter-button.faction-all {
  min-height: 58px;
}

.faction-filter-button .mini-icon {
  width: 34px;
  height: 34px;
}

.summon-tag-group {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 8px;
}

/* Generic stylized tag for icon-less / icon-borrowing unit tags. */
.mini-icon.generic-tag {
  color: #b9a86a;
}

/* Unreleased placeholder units (TW-released, kit pre-shipped in global). */
.source-badge.placeholder-source {
  border: 1px dashed #6b5d2e;
  background: rgba(107, 93, 46, 0.18);
  color: #c9b977;
}

/* Unit traits surfaced in the skills catalog. */
.source-badge.trait-source {
  border-color: #8c7a3f;
  background: rgba(185, 168, 106, 0.14);
  color: #d8c98a;
}

/* Provenance chips (docs/effect-family-design.md §5): entries that are not
   plain game data rows. Synthetic = naming-heuristic construct;
   Augmented = real game rows whose grouping/page text the site composes. */
.source-badge.synthetic-source {
  border-color: #6d5d8c;
  background: rgba(151, 125, 205, 0.14);
  color: #c4b2ec;
}

.source-badge.augmented-source {
  border-color: #3f7a74;
  background: rgba(96, 185, 173, 0.13);
  color: #8fd8cd;
}

/* Inside the tooltip title row the chip must stay subordinate to the title. */
.keyword-tooltip-header .source-badge {
  min-height: 18px;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 11px;
  flex-shrink: 0;
}

/* Plaque replacing the kit of unreleased placeholder units. */
.placeholder-kit-plaque {
  padding: 22px 26px;
  border: 1px dashed #6b5d2e;
  border-radius: 10px;
  background: rgba(107, 93, 46, 0.12);
  color: #c9b977;
}

.placeholder-kit-plaque strong {
  display: block;
  margin-bottom: 6px;
  font-size: 18px;
}

.placeholder-kit-plaque p {
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

/* Equipment whose effect rows clone another item's (unreleased placeholder). */
.placeholder-effect-note {
  margin-bottom: 8px;
  padding: 6px 10px;
  border: 1px dashed #6b5d2e;
  border-radius: 6px;
  color: #c9b977;
  font-size: 13px;
}

.table-wrap {
  position: relative;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.unit-table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
  background: #060707;
}

.unit-table th {
  position: sticky;
  top: 0;
  background: #0b0b0c;
  color: #dedede;
  text-align: left;
  height: 58px;
  padding: 0 14px;
  font-size: 20px;
  border-bottom: 1px solid var(--line);
  cursor: default;
}

.unit-table th[data-sort] { cursor: pointer; }

.unit-table td {
  height: 150px;
  padding: 14px;
  border-bottom: 1px solid #1a1b1d;
  font-size: 20px;
  vertical-align: middle;
}

.unit-table tr { cursor: pointer; }
.unit-table tr:hover { background: #11151c; }

.head-img {
  width: 104px;
  height: 104px;
  border-radius: 18px;
  object-fit: contain;
  background: #17191e;
}

.sprite-img {
  width: 84px;
  height: 84px;
  object-fit: contain;
  image-rendering: auto;
}

.name-link { color: var(--link); font-weight: 500; }

/* Catalog rows are not one big click target: only the name, the icon cell,
   and related-unit heads navigate. */
.catalog-table tr { cursor: default; }

.catalog-table .name-link,
.catalog-table .catalog-icon-cell {
  cursor: pointer;
}

.catalog-table .name-link:hover {
  text-decoration: underline;
}

.related-mini-link {
  display: inline-flex;
  cursor: pointer;
  border-radius: 6px;
}

.related-mini-link:hover {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.source-badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  margin-left: 8px;
  padding: 2px 7px;
  border: 1px solid #5e758c;
  border-radius: 6px;
  background: rgba(117, 166, 205, .12);
  color: #a9d7ff;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  vertical-align: middle;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
}

.unit-graph-actions {
  flex-basis: 100%;
  margin-top: 8px;
}

.mini-icon {
  width: 34px;
  height: 34px;
  object-fit: contain;
  vertical-align: middle;
}

.rarity-stars,
.rarity-label {
  color: #ffd21a;
  font-size: 18px;
  white-space: nowrap;
}

.icon-text {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.icon-text .mini-icon {
  flex: 0 0 auto;
}

.unit-tags {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.tag-group {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 38px;
  padding: 4px 7px;
  border: 1px solid #3b4350;
  border-radius: 7px;
  background: rgba(255, 255, 255, .035);
}

.tag-group .mini-icon {
  width: 30px;
  height: 30px;
}

.rarity-icon {
  width: 32px;
  height: 32px;
}

.weapon-type-icon {
  width: 28px;
  height: 28px;
}

.source-tag {
  font-size: 13px;
  min-height: 30px;
}

.source-link-tag {
  color: var(--text);
  cursor: pointer;
  font: inherit;
}

.source-link-tag:hover,
.source-link-tag:focus {
  border-color: var(--accent);
}

.detail-grid {
  display: grid;
  grid-template-columns: minmax(320px, 34vw) minmax(620px, 1fr);
  gap: 44px;
  align-items: start;
}

.unit-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.controls-row {
  display: grid;
  grid-template-columns: minmax(160px, 270px);
  justify-content: center;
  gap: 12px;
  width: 100%;
  max-width: 320px;
  margin-bottom: 34px;
}

.unit-title {
  text-align: center;
  min-height: 150px;
}

.unit-title h2 {
  max-width: 420px;
  margin: 24px auto 24px;
  font-size: 38px;
  line-height: 1.15;
}

.portrait {
  width: min(390px, 80vw);
  aspect-ratio: 1;
  object-fit: contain;
  margin: 20px 0 24px;
}

.role-line {
  margin: 0 0 12px;
  font-size: 28px;
}

.speed-chip {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 36px;
  margin-bottom: 22px;
  padding: 4px 14px;
  border-radius: 6px;
  background: var(--card-2);
  color: var(--text);
  font-size: 20px;
}

.speed-chip strong {
  font-size: 24px;
}

.engraving-summary {
  flex-basis: 100%;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  max-width: 420px;
  margin: -6px auto 4px;
}

.engraving-summary-stat {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 30px;
  padding: 3px 7px;
  border: 1px solid #3a4050;
  border-radius: 6px;
  background: rgba(255, 255, 255, .045);
  color: #dfe6ef;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}

.engraving-stat-icon {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.unit-engrave-actions {
  flex-basis: 100%;
  display: flex;
  justify-content: center;
  margin: 4px 0 2px;
}

.engrave-calculator-toggle {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid #596678;
  border-radius: 8px;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, .18), transparent 34%),
    #202632;
  color: var(--text);
  cursor: pointer;
}

.engrave-calculator-toggle:hover,
.engrave-calculator-toggle:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 0 18px rgba(255, 189, 113, .24);
  outline: none;
}

.engrave-button-gem {
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-radius: 3px;
  transform: rotate(45deg);
  background: linear-gradient(135deg, rgba(255, 200, 97, .85), rgba(111, 170, 216, .35));
  box-shadow: inset 0 0 0 2px rgba(5, 6, 6, .38);
}

.stats-and-skills {
  display: grid;
  gap: 16px;
}

.skill-column {
  display: grid;
  gap: 12px;
}

.skill-card {
  position: relative;
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  padding: 28px 24px 22px;
  border-radius: 12px;
  background: var(--card);
}

.skill-card > div {
  min-width: 0;
}

.skill-title,
.skill-desc {
  overflow-wrap: anywhere;
  word-break: normal;
}

.skill-card.compact { grid-template-columns: 56px minmax(0, 1fr); padding: 22px; }

.skill-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: contain;
  background: #111;
}

.skill-card.compact .skill-icon {
  width: 54px;
  height: 54px;
}

.skill-title {
  margin: 0 0 10px;
  font-size: 30px;
  line-height: 1.1;
}

.skill-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.upgrade-tag {
  display: inline-flex;
  align-items: center;
  width: max-content;
  min-height: 26px;
  margin: 0 0 8px;
  padding: 2px 10px;
  border: 1px solid #f3cc65;
  border-radius: 6px;
  background: #3b3422;
  color: #f6d57b;
  font-size: 16px;
  font-weight: 900;
  text-transform: uppercase;
}

.trait-view-tabs,
.level-view-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0 0 12px;
  padding-right: 72px;
}

.trait-view-button,
.level-view-button {
  min-height: 30px;
  padding: 3px 10px;
  border: 1px solid #596678;
  border-radius: 6px;
  background: #303a4d;
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}

.trait-view-button.active,
.level-view-button.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #111;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 2px 12px;
  border-radius: 7px;
  background: #42506a;
  color: white;
  font-size: 18px;
}

.corner-label {
  position: absolute;
  right: 0;
  top: 0;
  max-width: calc(100% - 24px);
  padding: 8px 14px;
  border-radius: 0 12px 0 10px;
  background: var(--accent);
  color: #111;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.skill-desc {
  font-size: 21px;
  line-height: 1.42;
}

.skill-desc .red { color: var(--red); }
.skill-desc .c4 { color: var(--gold); }
.skill-desc .c5 { color: var(--blue); }
.skill-desc .purple { color: #a970ff; }
.skill-desc .green { color: #49d26d; }

.effect-icon {
  position: relative;
  display: inline-block;
  width: .86em;
  height: .86em;
  margin-right: .12em;
  vertical-align: -.08em;
}

.effect-icon-image {
  background-position: center;
  background-repeat: no-repeat;
  background-size: contain;
}

/* Inline text sprites use the optimized WebP twins directly: assets/ (source
   PNGs) is build input only and never ships to the deployed site, while
   assets_webp/ is copied by scripts/build_site.mjs. CSS cannot consult
   images-manifest.json, so these URLs must live in the shipped folder. */
.effect-icon-text_sprite_blocked {
  background-image: url("assets_webp/text_sprite/text_sprite_blocked.webp");
}

.effect-icon-text_sprite_buff {
  background-image: url("assets_webp/text_sprite/text_sprite_buff.webp");
}

.effect-icon-text_sprite_debuff {
  background-image: url("assets_webp/text_sprite/text_sprite_debuff.webp");
}

.effect-icon-image::before,
.effect-icon-image::after {
  display: none;
}

.effect-icon::before,
.effect-icon::after {
  content: "";
  position: absolute;
  inset: 0;
  box-sizing: border-box;
}

.effect-icon-buff::before {
  border-left: .43em solid transparent;
  border-right: .43em solid transparent;
  border-bottom: .78em solid #72d36f;
}

.effect-icon-buff::after {
  inset: .2em .28em .16em;
  border-left: .15em solid transparent;
  border-right: .15em solid transparent;
  border-bottom: .34em solid var(--card);
}

.effect-icon-debuff::before {
  border-left: .43em solid transparent;
  border-right: .43em solid transparent;
  border-top: .78em solid #e47a52;
  top: .08em;
}

.effect-icon-debuff::after {
  inset: .16em .28em .2em;
  border-left: .15em solid transparent;
  border-right: .15em solid transparent;
  border-top: .34em solid var(--card);
}

.effect-icon-blocked {
  border: .14em solid #d98561;
  border-radius: 50%;
}

.effect-icon-blocked::before {
  inset: auto;
  top: 50%;
  left: 50%;
  width: .92em;
  height: .16em;
  transform: translate(-50%, -50%) rotate(45deg);
  border-radius: 999px;
  background: #d98561;
}

.effect-icon-blocked::after {
  display: none;
}

.effect-icon-generic {
  border: .12em solid currentColor;
  border-radius: 50%;
}

.paragraph-break {
  display: block;
  height: .42em;
}

.skill-desc > .paragraph-break:first-child {
  display: none;
}

.paragraph-icon {
  position: relative;
  display: inline-block;
  width: 1em;
  height: 1em;
  margin-right: .18em;
  vertical-align: -.12em;
}

.paragraph-icon::before,
.paragraph-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: .82em;
  height: .18em;
  border-radius: 999px;
  background: linear-gradient(90deg, transparent, #9c8b59 18%, #d2bd75 50%, #9c8b59 82%, transparent);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 7px rgba(210, 189, 117, .35);
}

.paragraph-icon::after {
  transform: translate(-50%, -50%) rotate(90deg);
}

.trait-line {
  position: relative;
  display: block;
  margin-top: 10px;
  padding: 8px 0 0 66px;
}

.trait-line:first-child {
  margin-top: 0;
}

.trait-line .paragraph-break {
  display: none;
}

.trait-line .paragraph-icon {
  position: absolute;
  left: 32px;
  top: 14px;
}

.trait-line-stars {
  position: absolute;
  left: 0;
  top: 10px;
  min-width: 26px;
  padding: 1px 5px;
  border: 1px solid #6a7180;
  border-radius: 5px;
  color: #e6d28c;
  background: rgba(255,255,255,.05);
  font-size: 12px;
  line-height: 1.2;
  text-align: center;
}

.trait-inline-fragment {
  display: inline;
}

.trait-inline-option {
  padding: 1px 6px 2px;
  margin: 0 3px;
  border: 1px solid rgba(230, 210, 140, .35);
  border-radius: 6px;
  background: rgba(255, 255, 255, .035);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.trait-inline-option .trait-stars {
  display: inline-block;
  margin-right: .4em;
  color: #e6d28c;
  font-size: .62em;
  line-height: 1;
  vertical-align: .18em;
  white-space: nowrap;
  pointer-events: none;
}

.trait-value-set {
  display: inline-flex;
  align-items: flex-start;
  flex-wrap: nowrap;
  gap: 5px;
  margin: 0 4px;
  vertical-align: -.2em;
  line-height: inherit;
}

.trait-value-option {
  display: inline-flex;
  flex-direction: column-reverse;
  align-items: center;
  min-width: 2.2em;
  padding: 2px 6px 3px;
  border: 1px solid rgba(230, 210, 140, .35);
  border-radius: 6px;
  background: rgba(255, 255, 255, .035);
  line-height: 1;
}

.trait-value-option.wide {
  align-items: flex-start;
  max-width: min(34em, 100%);
  line-height: 1.15;
}

.trait-value-option .trait-stars {
  color: #e6d28c;
  font-size: .52em;
  line-height: 1;
  margin-top: 2px;
  white-space: nowrap;
  pointer-events: none;
}

.trait-slash {
  color: var(--muted);
  line-height: 1;
  padding-top: .12em;
}

.keyword {
  position: relative;
  color: var(--gold);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  cursor: help;
}

.keyword-tooltip {
  position: fixed;
  z-index: 100;
  width: min(460px, calc(100vw - 20px));
  max-height: min(360px, calc(100vh - 20px));
  overflow: auto;
  padding: 18px 22px;
  border-radius: 8px;
  background: #151515;
  color: var(--text);
  box-shadow: 0 18px 42px rgba(0,0,0,.45);
  border: 1px solid #2c2c2c;
  font-size: 20px;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.keyword-tooltip.pinned {
  border-color: var(--accent);
  box-shadow: 0 18px 42px rgba(0,0,0,.5), 0 0 0 1px rgba(255,190,112,.25);
}

.keyword-tooltip.hidden {
  display: none;
}

.keyword-tooltip strong {
  display: block;
  color: var(--blue);
  font-size: 21px;
}

.keyword-tooltip-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 22px;
}

.keyword-tooltip-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 28px;
  border: 1px solid #596678;
  border-radius: 6px;
  background: #303a4d;
  color: var(--text);
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
}

.keyword-tooltip-go {
  margin-left: auto;
  min-height: 28px;
  padding: 3px 9px;
  border: 1px solid #596678;
  border-radius: 6px;
  background: #303a4d;
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.keyword-tooltip-tabs {
  margin: -12px 0 12px;
  padding-right: 0;
}

.keyword-tooltip-tabs .level-view-button {
  min-height: 26px;
  padding: 2px 9px;
  font-size: 14px;
}

.keyword-tooltip-body {
  margin: 0;
}

.keyword-tooltip-body .keyword {
  color: var(--gold);
}

.skill-range-panel {
  display: inline-grid;
  grid-template-columns: auto auto;
  gap: 16px;
  align-items: center;
  margin-top: 18px;
  padding: 10px 12px;
  border: 1px solid #56647c;
  border-radius: 7px;
  background: #2d374a;
}

.range-grid {
  display: grid;
  grid-template-columns: repeat(var(--range-grid-size, 11), 1fr);
  width: var(--range-grid-px, 126px);
  height: var(--range-grid-px, 126px);
  gap: 2px;
  padding: 8px;
  border-radius: 6px;
  background: #263246;
}

.range-cell {
  border-radius: 2px;
  background: #3a465b;
}

.range-cell.range {
  background: #f15a5f;
}

.range-cell.effect {
  background: #d4c56a;
}

.range-cell.target {
  background: #f59a45;
}

.range-cell.self {
  background: #397fe6;
}

.skill-range-info {
  display: grid;
  grid-template-columns: auto auto;
  gap: 4px 30px;
  font-size: 20px;
  line-height: 1.25;
}

.range-label-row {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  gap: 8px;
  flex-wrap: wrap;
}

.target-method-pill {
  justify-self: center;
  min-width: 72px;
  padding: 2px 10px;
  border-radius: 7px;
  background: #e8ecef;
  color: #111;
  text-align: center;
  font-weight: 800;
}

.rank-section {
  margin-top: 60px;
}

.catalog-table td:nth-child(3) {
  min-width: 520px;
}

.catalog-table.keyword-mode td:nth-child(3) {
  min-width: min(980px, 62vw);
}

.catalog-icon-cell {
  width: 72px;
}

.related-mini {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.term-detail-card {
  margin-top: 22px;
  grid-template-columns: 72px minmax(0, 1fr);
}

.term-detail-card.no-icon {
  grid-template-columns: minmax(0, 1fr);
}

.term-icon-slot {
  width: 64px;
  min-height: 64px;
}

.term-detail-content {
  min-width: 0;
}

.term-tabs {
  display: flex;
  gap: 8px;
  margin: 28px 0 16px;
}

.term-tab {
  min-height: 34px;
  padding: 5px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
}

.term-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #111;
}

.term-panel {
  margin-top: 14px;
}

.muted {
  color: var(--muted);
}

.graph-toolbar {
  grid-template-columns: minmax(280px, 560px);
}

.term-graph-layout {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.term-graph-results,
.term-graph-node {
  min-width: 0;
}

.term-graph-results {
  position: sticky;
  top: 84px;
  max-height: calc(100vh - 110px);
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #08090a;
}

.graph-results-summary {
  margin: 2px 4px 10px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 800;
}

.graph-result-list,
.graph-node-chip-list,
.graph-edge-list {
  display: grid;
  gap: 8px;
}

.graph-node-chip-list {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.graph-node-chip-list.compact {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  width: 100%;
}

.graph-node-link {
  display: grid;
  gap: 3px;
  min-width: 0;
  padding: 8px 10px;
  border: 1px solid #303238;
  border-radius: 7px;
  background: #111315;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.graph-node-link:hover,
.graph-node-link.active {
  border-color: var(--accent);
}

.graph-node-link.active {
  background: #2a241b;
}

.graph-node-label {
  min-width: 0;
  color: var(--accent);
  font-size: 16px;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.graph-node-kind {
  min-width: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.graph-history {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.graph-history .text-button {
  min-width: 44px;
}

.graph-history span {
  color: var(--muted);
  font-weight: 800;
}

.graph-node-card {
  grid-template-columns: minmax(0, 1fr);
  margin-bottom: 14px;
}

.graph-raw-name {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin: 8px 0 14px;
  color: var(--muted);
}

.graph-raw-name code,
.graph-alias-list code,
.graph-term-key code {
  padding: 2px 6px;
  border: 1px solid #3a4050;
  border-radius: 5px;
  background: #111722;
  color: #d7dce7;
  font-size: 13px;
}

.graph-usage {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 16px;
}

.graph-section {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #08090a;
}

.graph-section h3 {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 0 0 12px;
  font-size: 20px;
}

.graph-section h3 span,
.graph-section-note {
  color: var(--muted);
}

.graph-section-note {
  margin: -4px 0 12px;
  font-size: 14px;
}

.graph-alias-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.graph-edge-row {
  display: grid;
  grid-template-columns: minmax(120px, 190px) minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 10px;
  border: 1px solid #1d2026;
  border-radius: 7px;
  background: #0d0f12;
}

.graph-edge-relation {
  color: var(--blue);
  font-weight: 900;
}

.graph-edge-targets {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.graph-term-key {
  color: var(--muted);
  font-weight: 800;
}

.graph-more {
  padding: 8px 10px;
  color: var(--muted);
  font-weight: 800;
}

.mention-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.mention-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.mention-tab {
  min-height: 34px;
  padding: 5px 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
}

.mention-tab span {
  margin-left: 6px;
  color: var(--muted);
}

.mention-tab.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #111;
}

.mention-tab.active span {
  color: #111;
}

.mention-action-button {
  min-height: 32px;
  padding: 4px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #101010;
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
}

.term-text-card {
  grid-template-columns: 1fr;
}

.box-detail-grid {
  display: grid;
  gap: 18px;
}

.box-detail-section {
  display: grid;
  gap: 10px;
}

.box-detail-section h3 {
  margin: 0;
  font-size: 22px;
}

.source-list {
  display: grid;
  gap: 8px;
}

.source-row {
  display: grid;
  grid-template-columns: minmax(170px, 320px) minmax(0, 1fr);
  gap: 14px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, .035);
}

.source-row strong {
  color: var(--accent);
}

.source-box-card {
  display: grid;
  justify-items: center;
  gap: 8px;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
}

.related-units {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 14px;
}

.related-unit-card {
  display: grid;
  gap: 8px;
  align-content: start;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 10px;
}

.related-unit,
.related-summon {
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
}

.related-summon-card .equipment-card-tags {
  text-align: center;
  color: var(--muted);
}

.owned-summons {
  display: grid;
  gap: 12px;
}

.owned-summons h3 {
  margin: 0;
}

.inline-link {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--link);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.related-unit-skills-toggle,
.related-unit-paths-toggle,
.related-unit-graph-toggle {
  min-height: 32px;
  padding: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #101010;
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
}

.related-card-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  min-width: 0;
}

.related-card-actions .related-card-icon-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  border: 1px solid #2c3038;
  border-radius: 8px;
  background: #0d0f12;
  color: #d8e0ed;
  cursor: pointer;
  overflow: visible;
  transition: transform .14s ease, border-color .14s ease, color .14s ease, box-shadow .14s ease, background .14s ease;
}

.related-card-actions .related-card-icon-button::before {
  content: "";
  position: absolute;
  inset: 3px;
  z-index: 0;
  border-radius: 6px;
  background:
    radial-gradient(circle at 35% 25%, rgba(255, 196, 118, .28), transparent 42%),
    linear-gradient(135deg, rgba(91, 151, 255, .18), rgba(255, 193, 111, .12));
  opacity: 0;
  transform: scale(.78);
  transition: opacity .14s ease, transform .14s ease;
}

.related-card-actions .related-card-icon-button::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 9px);
  z-index: 4;
  max-width: 210px;
  padding: 5px 8px;
  border: 1px solid rgba(255, 194, 116, .52);
  border-radius: 6px;
  background: #131518;
  color: var(--text);
  font-size: 12px;
  line-height: 1.15;
  font-weight: 900;
  white-space: nowrap;
  box-shadow: 0 12px 24px rgba(0, 0, 0, .42);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px) scale(.96);
  transition: opacity .12s ease, transform .12s ease;
  /* display-gated: an opacity-0 box is still laid out, and these 100-210px
     tooltips widened the page past the viewport on phones (term pages). */
  display: none;
}

.related-card-actions .related-card-icon-button svg {
  position: relative;
  z-index: 1;
  width: 23px;
  height: 23px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: transform .16s ease, filter .16s ease;
  pointer-events: none;
}

.related-card-actions .related-card-icon-button svg * {
  pointer-events: none;
}

.related-card-actions .related-action-icon-fill {
  fill: rgba(255, 255, 255, .045);
}

.related-card-actions .related-action-spark {
  fill: rgba(255, 196, 118, .2);
}

.related-card-actions .related-action-merge,
.related-card-actions .related-action-dash {
  stroke: var(--accent);
}

.related-card-actions .related-card-icon-button:hover,
.related-card-actions .related-card-icon-button:focus-visible,
.related-card-actions .related-card-icon-button.active {
  border-color: rgba(255, 194, 116, .78);
  background: #15181f;
  color: var(--accent);
  box-shadow: 0 0 0 1px rgba(255, 194, 116, .18), 0 8px 18px rgba(0, 0, 0, .34);
  transform: translateY(-1px);
}

.related-card-actions .related-card-icon-button:hover::before,
.related-card-actions .related-card-icon-button:focus-visible::before,
.related-card-actions .related-card-icon-button.active::before {
  opacity: 1;
  transform: scale(1);
}

.related-card-actions .related-card-icon-button:hover::after,
.related-card-actions .related-card-icon-button:focus-visible::after {
  display: block;
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

/* Keeps the pop-in fade now that the tooltip is display-gated (browsers
   without @starting-style simply show it instantly). */
@starting-style {
  .related-card-actions .related-card-icon-button:hover::after,
  .related-card-actions .related-card-icon-button:focus-visible::after {
    opacity: 0;
    transform: translate(-50%, 4px) scale(.96);
  }
}

.related-card-actions .related-card-icon-button:hover svg,
.related-card-actions .related-card-icon-button:focus-visible svg,
.related-card-actions .related-card-icon-button.active svg {
  transform: scale(1.08);
  filter: drop-shadow(0 0 6px rgba(255, 193, 111, .34));
}

.related-card-actions .related-unit-skills-toggle:hover .related-action-spark,
.related-card-actions .related-unit-skills-toggle:focus-visible .related-action-spark,
.related-card-actions .related-unit-skills-toggle.active .related-action-spark {
  fill: rgba(255, 196, 118, .65);
}

.related-card-actions .related-unit-paths-toggle:hover .related-action-dash,
.related-card-actions .related-unit-paths-toggle:focus-visible .related-action-dash,
.related-card-actions .related-unit-paths-toggle.active .related-action-dash {
  stroke-dasharray: 2 2;
}

.related-unit-skills,
.related-unit-paths {
  margin-top: 4px;
}

.mention-path-list {
  display: grid;
  gap: 8px;
}

.mention-path {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, .035);
  font-size: 13px;
  line-height: 1.35;
}

.mention-path.secondary {
  border-color: rgba(255, 195, 122, .42);
}

.mention-path-node {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-height: 24px;
  max-width: 100%;
  padding: 2px 5px;
  border: 1px solid #4f5b6d;
  border-radius: 6px;
  background: rgba(255, 255, 255, .045);
}

.mention-path-source {
  padding: 2px 6px 2px 2px;
  color: var(--link);
  font-weight: 800;
}

.mention-path-source .mini-icon {
  width: 24px;
  height: 24px;
}

.mention-path-source-label {
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mention-path-keyword {
  color: var(--accent);
}

.mention-path-arrow {
  color: var(--muted);
  font-weight: 800;
}

.mention-graph-backdrop {
  position: fixed;
  inset: 0;
  z-index: 86;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(0, 0, 0, .72);
  backdrop-filter: blur(5px);
}

.mention-graph-window {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  width: min(1560px, calc(100vw - 36px));
  height: min(930px, calc(100vh - 36px));
  min-height: 420px;
  border: 1px solid rgba(255, 197, 118, .38);
  border-radius: 8px;
  background: #08090a;
  box-shadow: 0 28px 70px rgba(0, 0, 0, .62);
  overflow: hidden;
}

.mention-graph-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-width: 0;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  background: #0e1012;
}

.mention-graph-header h2 {
  margin: 0 0 8px;
  font-size: 23px;
  line-height: 1.15;
}

.mention-graph-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.mention-graph-meta span {
  min-height: 24px;
  padding: 3px 8px;
  border: 1px solid #2f3540;
  border-radius: 6px;
  background: #141821;
}

.mention-graph-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.mention-graph-distance {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  min-height: 34px;
  padding: 3px 7px;
  border: 1px solid #36404e;
  border-radius: 6px;
  background: #151a22;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.mention-graph-distance strong {
  min-width: 32px;
  color: var(--accent);
  text-align: center;
}

.mention-graph-scale,
.mention-graph-distance-step,
.mention-graph-close {
  min-height: 34px;
  border: 1px solid #596678;
  border-radius: 6px;
  background: #202632;
  color: var(--text);
  font-weight: 900;
  cursor: pointer;
}

.mention-graph-scale {
  width: 36px;
  padding: 4px;
  font-size: 20px;
  line-height: 1;
}

.mention-graph-distance-step {
  width: 28px;
  min-height: 26px;
  padding: 2px;
  font-size: 13px;
  line-height: 1;
}

.mention-graph-close {
  padding: 5px 13px;
}

.mention-graph-close:hover,
.mention-graph-scale:hover,
.mention-graph-distance-step:hover,
.related-unit-graph-toggle:hover {
  border-color: var(--accent);
}

.mention-graph-scroller {
  min-height: 0;
  overflow: auto;
  cursor: grab;
  touch-action: none;
  scrollbar-width: none;
  padding: 22px;
  background:
    linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px),
    #050606;
  background-size: 34px 34px;
}

.mention-graph-canvas {
  position: relative;
  min-width: 760px;
  min-height: 760px;
  margin: 0 auto;
}

.mention-graph-rings,
.mention-graph-nodes {
  position: absolute;
  inset: 0;
}

.mention-graph-rings {
  z-index: 0;
  pointer-events: none;
}

.mention-graph-ring {
  position: absolute;
  border: 1px solid rgba(255, 197, 118, .2);
  border-radius: 9999px;
  box-shadow:
    inset 0 0 42px rgba(255, 197, 118, .025),
    0 0 0 1px rgba(98, 146, 255, .06);
}

.mention-graph-nodes {
  z-index: 2;
  pointer-events: none;
}

.mention-graph-node {
  position: absolute;
  width: 132px;
  min-width: 0;
  padding: 0;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  --mention-graph-node-color: rgba(126, 174, 218, .72);
  /* No opacity transition: dim flips are instant so rapid hover moves
     never animate dozens of box-shadowed cards per frame. */
}

.mention-graph-node-source {
  --mention-graph-node-color: rgba(98, 146, 255, .74);
}

.mention-graph-node-keyword {
  --mention-graph-node-color: rgba(255, 195, 122, .78);
}

.mention-graph-node-skill {
  --mention-graph-node-color: rgba(126, 174, 218, .74);
}

.mention-graph-node-buff {
  --mention-graph-node-color: rgba(235, 112, 104, .72);
}

.mention-graph-node-category {
  --mention-graph-node-color: rgba(186, 142, 240, .76);
}

.mention-graph-node-meta {
  --mention-graph-node-color: rgba(150, 160, 172, .6);
}

.term-graph-action {
  min-height: 34px;
  padding: 5px 13px;
  border: 1px solid #596678;
  border-radius: 6px;
  background: #202632;
  color: var(--text);
  font-weight: 900;
  cursor: pointer;
}

.term-graph-action:hover {
  border-color: var(--accent);
}

.term-graph-action.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #111;
}

.engrave-calculator-window {
  width: min(1120px, calc(100vw - 36px));
  height: min(780px, calc(100vh - 36px));
  min-height: 420px;
}

.engrave-calculator-content {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  min-height: 0;
  overflow: hidden;
  background: #050606;
}

.engrave-main {
  min-width: 0;
  overflow: auto;
  padding: 18px;
}

.engrave-stat-list {
  display: grid;
  gap: 10px;
}

.engrave-stat-row {
  display: grid;
  grid-template-columns: 38px 78px minmax(150px, 1fr) 52px minmax(160px, auto);
  gap: 10px;
  align-items: center;
  min-height: 60px;
  padding: 10px 12px;
  border: 1px solid #202733;
  border-radius: 8px;
  background: #101317;
}

.engrave-stat-icon-cell {
  display: grid;
  place-items: center;
}

.engrave-stat-name {
  color: #e6ebf3;
  font-weight: 900;
}

.engrave-slider {
  width: 100%;
  min-height: 40px;
  accent-color: var(--accent);
  cursor: pointer;
}

.engrave-percent-value {
  color: var(--accent);
  font-weight: 900;
  text-align: right;
}

.engrave-result-value {
  color: #eef3fb;
  font-weight: 900;
  text-align: right;
  white-space: nowrap;
}

.engrave-sidebar {
  min-width: 0;
  overflow: auto;
  border-left: 1px solid var(--line);
  background: #0b0d10;
}

.engrave-sidebar summary {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  color: var(--accent);
  font-size: 18px;
  font-weight: 900;
  cursor: pointer;
}

.engrave-sidebar-body {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.engrave-field-label {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.engrave-select {
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid #303844;
  border-radius: 7px;
  background: #151a20;
  color: var(--text);
  font: inherit;
  font-weight: 900;
}

.engrave-pinned-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.engrave-pinned-grid span {
  display: grid;
  gap: 3px;
  min-height: 46px;
  padding: 7px 8px;
  border: 1px solid #27303d;
  border-radius: 7px;
  background: #11161d;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.engrave-pinned-grid strong {
  color: var(--text);
  font-size: 15px;
}

.engrave-tree-list {
  display: grid;
  gap: 10px;
}

.engrave-tree-rank {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 8px;
  align-items: start;
}

.engrave-tree-rank-label {
  display: inline-grid;
  place-items: center;
  min-height: 36px;
  border: 1px solid #27303d;
  border-radius: 7px;
  background: #151a20;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.engrave-tree-rank-nodes {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
  gap: 7px;
  min-width: 0;
}

.engrave-tree-node {
  position: relative;
  min-width: 0;
  cursor: pointer;
}

.engrave-tree-node input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.engrave-tree-node-face {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 7px;
  align-items: center;
  min-height: 42px;
  padding: 5px 7px;
  border: 1px solid #27303d;
  border-radius: 8px;
  background: #11161d;
  color: #eaf0f8;
}

.engrave-tree-node.active .engrave-tree-node-face {
  border-color: var(--accent);
  background: #222018;
}

.engrave-level-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.engrave-level-row .engrave-level-slider {
  flex: 1;
  min-width: 0;
}

.engrave-level-row .engrave-percent-value {
  min-width: 2ch;
  text-align: right;
}

.engrave-tree-node.locked {
  cursor: not-allowed;
}

.engrave-tree-node.locked input {
  cursor: not-allowed;
}

.engrave-tree-node.locked .engrave-tree-node-face {
  opacity: 0.38;
  filter: grayscale(0.8);
  border-style: dashed;
}

.engrave-tree-node input:focus-visible + .engrave-tree-node-face {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.engrave-tree-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  object-fit: contain;
  background: #090b0f;
}

.engrave-tree-bonus {
  min-width: 0;
  color: #eef3fb;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.engrave-empty {
  padding: 12px;
  border: 1px dashed #394151;
  border-radius: 8px;
  color: var(--muted);
  font-size: 13px;
}

.engrave-base-section h3 {
  margin: 4px 0 8px;
  font-size: 17px;
}

.engrave-base-explainer {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.engrave-base-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.engrave-base-table th,
.engrave-base-table td {
  padding: 8px 6px;
  border-bottom: 1px solid #232934;
  color: #dfe6ef;
  font-size: 12px;
  text-align: right;
}

.engrave-base-table th:first-child,
.engrave-base-table td:first-child {
  text-align: left;
}

.engrave-base-table td:first-child {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.engrave-base-table .engraving-stat-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.term-graph-token {
  position: relative;
}

.term-graph-hidden-badge {
  position: absolute;
  right: 8px;
  top: -8px;
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 6px;
  border: 1px solid rgba(186, 142, 240, .7);
  border-radius: 999px;
  background: #1d1426;
  color: rgba(222, 198, 255, .95);
  font-size: 12px;
  font-weight: 800;
}

.term-graph-dup-badge {
  position: absolute;
  left: 8px;
  top: -8px;
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 0 6px;
  border: 1px solid rgba(126, 174, 218, .7);
  border-radius: 999px;
  background: #101a26;
  color: rgba(178, 212, 247, .95);
  font-size: 12px;
  font-weight: 800;
}

.graph-playable-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.mention-graph-token {
  display: grid;
  justify-items: center;
  gap: 6px;
  color: var(--text);
  text-decoration: none;
}

.mention-graph-icon-circle {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border: 2px solid var(--mention-graph-node-color);
  border-radius: 999px;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, .12), transparent 36%),
    rgba(18, 21, 26, .96);
  box-shadow:
    0 0 0 4px rgba(0, 0, 0, .3),
    0 12px 24px rgba(0, 0, 0, .34);
  overflow: hidden;
  transition: border-color .14s ease, box-shadow .14s ease, transform .14s ease;
}

.mention-graph-label {
  display: block;
  width: 132px;
  min-width: 0;
  overflow: hidden;
  color: #d9e2f0;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.2;
  text-align: center;
  text-overflow: ellipsis;
  text-shadow: 0 2px 7px #000;
  white-space: nowrap;
}

.mention-graph-label.keyword {
  cursor: help;
}

.mention-graph-token:hover .mention-graph-icon-circle,
.mention-graph-token:focus-within .mention-graph-icon-circle {
  border-color: var(--accent);
  box-shadow:
    0 0 0 4px rgba(0, 0, 0, .34),
    0 0 22px rgba(255, 197, 118, .28),
    0 14px 26px rgba(0, 0, 0, .38);
  transform: translateY(-1px) scale(1.04);
}

.mention-graph-token:hover .mention-graph-label,
.mention-graph-token:focus-within .mention-graph-label {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.mention-graph-node .mini-icon {
  width: 40px;
  height: 40px;
}

.mention-graph-node-count {
  position: absolute;
  right: 20px;
  top: -8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border: 1px solid rgba(255, 198, 116, .7);
  border-radius: 999px;
  background: #261b10;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
}

.mention-graph-node-distance {
  position: absolute;
  left: 50%;
  top: 18px;
  z-index: 4;
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 6px;
  border: 1px solid rgba(255, 238, 196, .46);
  border-radius: 999px;
  background: rgba(10, 13, 18, .48);
  box-shadow: 0 2px 10px rgba(0, 0, 0, .26);
  color: rgba(255, 235, 190, .9);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  pointer-events: none;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .82);
  transform: translate(-50%, -50%);
}

.mention-graph-scroller::-webkit-scrollbar {
  display: none;
}

.mention-graph-scroller.is-panning {
  cursor: grabbing;
  user-select: none;
}

.mention-graph-edges {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: visible;
  pointer-events: none;
}

/* Paint-cost note: edge paths deliberately carry NO filter and NO
   transition. A drop-shadow makes every path a filtered layer, and
   animating opacity/filter on hundreds of them (every hover enter/leave
   flips the canvas highlight class) re-rasterizes the whole edge layer
   per frame — the source of the large-graph hover stutter. */
.mention-graph-edge-path {
  fill: none;
  stroke: var(--mention-edge-color, rgba(235, 112, 104, .82));
  stroke-linecap: round;
  stroke-linejoin: round;
  opacity: .92;
  pointer-events: none;
}

/* Edge hit paths are kept as data carriers for node-hover traversal only;
   edges are not pointer targets (no hover/pin on lines). */
.mention-graph-edge-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 14px;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

.mention-graph-edge-path.secondary {
  stroke: var(--mention-edge-color, rgba(250, 202, 99, .86));
}

.mention-graph-canvas.has-edge-highlight .mention-graph-edge-path {
  opacity: .18;
}

.mention-graph-canvas.has-edge-highlight .mention-graph-edge-path.is-edge-highlight {
  opacity: 1;
  stroke: var(--mention-edge-active-color, var(--mention-edge-color, rgba(255, 214, 144, .98)));
}

.mention-graph-canvas.has-edge-highlight .mention-graph-node:not(.is-edge-connected) {
  opacity: .38;
}

.mention-graph-node.is-edge-connected {
  z-index: 3;
  opacity: 1;
}

.mention-graph-node.is-edge-connected .mention-graph-icon-circle {
  border-color: var(--accent);
  box-shadow:
    0 0 0 4px rgba(0, 0, 0, .34),
    0 0 24px rgba(255, 197, 118, .34),
    0 14px 28px rgba(0, 0, 0, .42);
  transform: translateY(-1px) scale(1.05);
}

.mention-graph-node.is-edge-connected .mention-graph-label {
  color: var(--accent);
}

.mention-graph-node.is-edge-focus-node .mention-graph-icon-circle {
  border-color: #fff1bc;
}

.mention-graph-edge-data {
  display: none;
}

.keyword-member-list {
  display: grid;
  gap: 10px;
}

.keyword-member {
  display: grid;
  grid-template-columns: minmax(160px, 260px) 1fr;
  gap: 18px;
  align-items: start;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.keyword-member strong {
  color: var(--link);
  font-size: 18px;
}

.keyword-member span {
  line-height: 1.45;
}

/* Buff/Debuff polarity + "N units" labels on effect-family member rows. */
.keyword-member strong .pill.keyword-member-polarity,
.keyword-member strong .pill.keyword-member-units {
  margin-left: 8px;
  min-height: 20px;
  padding: 1px 8px;
  font-size: 12px;
  vertical-align: middle;
  color: var(--text);
}

.keyword-member strong .pill.keyword-member-units {
  color: var(--muted);
  white-space: nowrap;
}

.skill-member-list {
  display: grid;
  gap: 10px;
}

.skill-member {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 14px;
  align-items: start;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.skill-member strong {
  color: var(--link);
  font-size: 18px;
}

.skill-member span {
  grid-column: 1 / -1;
  line-height: 1.45;
}

.rank-toolbar {
  text-align: left;
  font-size: 22px;
  margin-bottom: 28px;
}

.rank-toolbar h2 {
  margin: 0;
  font-size: 30px;
}

.rank-tree {
  display: grid;
  gap: 12px;
}

.rank-row {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) 270px minmax(280px, 1fr);
  gap: 24px;
  align-items: start;
  min-height: 150px;
}

.rank-row.skills-right {
  grid-template-columns: 270px minmax(320px, 1fr);
}

.rank-row.skills-right .rank-cell.left {
  display: none;
}

.rank-cell {
  display: grid;
  gap: 12px;
}

.rank-cell.left .skill-card { justify-self: stretch; }
.rank-cell.right .skill-card { justify-self: stretch; }

.level-tabs {
  display: flex;
  gap: 6px;
  margin: 0 0 8px;
}

.level-tab {
  min-width: 34px;
  min-height: 28px;
  border: 1px solid #5a6475;
  border-radius: 6px;
  background: #111722;
  color: var(--text);
  font-weight: 800;
  cursor: pointer;
}

.level-tab.active {
  background: var(--accent);
  color: #111;
  border-color: var(--accent);
}

.level-view-tabs .level-view-button {
  min-width: auto;
}

.module-choice-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 0 0 10px;
  padding-right: 72px;
}

.module-choice {
  min-height: 30px;
  max-width: 210px;
  padding: 3px 10px;
  border: 1px solid #596678;
  border-radius: 6px;
  background: #303a4d;
  color: var(--text);
  font-size: 17px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.module-choice.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #111;
}

.rank-node {
  min-height: 132px;
  padding: 20px;
  border-radius: 12px;
  background: var(--card);
  text-align: center;
  font-size: 22px;
}

.rank-node strong {
  display: block;
  margin-bottom: 16px;
  font-size: 26px;
}

.empty-state {
  padding: 40px;
  color: var(--muted);
  font-size: 22px;
}

/* Tile view modes (density button cycles table -> large tiles -> small). */
.tile-grid {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.tile-grid.tiles-lg { grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); }
.tile-grid.tiles-sm { grid-template-columns: repeat(auto-fill, minmax(116px, 1fr)); }

.unit-tile,
.catalog-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  text-align: center;
}

.unit-tile { cursor: pointer; }
.unit-tile:hover, .catalog-tile:hover { border-color: var(--accent); }

.tile-sprite {
  width: 96px;
  height: 96px;
  border-radius: 12px;
  object-fit: cover;
  background: #111;
}

.tiles-sm .tile-sprite { width: 60px; height: 60px; }

.unit-tile .unit-tags { justify-content: center; flex-wrap: wrap; }
.tiles-sm .unit-tile .unit-tags .tag-group img { width: 20px; height: 20px; }

.catalog-tile .tile-face {
  display: grid;
  place-items: center;
  min-height: 48px;
  padding: 4px;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  cursor: pointer;
}

.catalog-tile .tile-face:hover { color: var(--accent); }

.catalog-tile .tile-face .mini-icon,
.catalog-tile .tile-icon {
  width: 64px;
  height: 64px;
  border-radius: 10px;
  background: #111;
}

.tiles-sm .catalog-tile .tile-face .mini-icon,
.tiles-sm .catalog-tile .tile-icon { width: 44px; height: 44px; }

.tile-name {
  font-weight: 800;
  font-size: 17px;
  line-height: 1.25;
  word-break: break-word;
}

.tiles-sm .tile-name { font-size: 14px; }

.catalog-tile .related-mini { justify-content: center; }
/* Related-unit heads in skills/keywords catalogs render at double size;
   .related-mini exists only there (equipment + term detail are untouched). */
.catalog-table .related-mini .mini-icon,
.catalog-tile .related-mini .mini-icon { width: 68px; height: 68px; }
.tiles-sm .catalog-tile .related-mini .mini-icon { width: 44px; height: 44px; }

.tile-tags { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; }

.tile-help {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1px solid #596678;
  border-radius: 999px;
  background: #202632;
  color: var(--gold);
  font-weight: 900;
  cursor: help;
}

.tile-help:hover { border-color: var(--accent); }

@media (max-width: 1380px) {
  .topbar {
    grid-template-columns: 90px minmax(0, 1fr) minmax(520px, auto);
  }
  .top-actions {
    gap: 8px;
  }
  .nav-button {
    padding: 6px 10px;
    font-size: 14px;
  }
}

@media (max-width: 1050px) {
  .topbar { grid-template-columns: 70px minmax(0, 1fr); height: auto; min-height: 64px; }
  .top-actions { grid-column: 1 / -1; justify-content: center; padding: 0 8px 8px; flex-wrap: wrap; }
  main { padding: 32px 16px; }
  .toolbar { grid-template-columns: 1fr 1fr; }
  .filter-panel-grid { grid-template-columns: 1fr; }
  .term-graph-layout { grid-template-columns: 1fr; }
  .term-graph-results { position: static; max-height: 360px; }
  .graph-edge-row { grid-template-columns: 1fr; }
  .mention-graph-backdrop { padding: 10px; }
  .mention-graph-window {
    width: calc(100vw - 20px);
    height: calc(100vh - 20px);
  }
  .mention-graph-scroller { padding: 14px; }
  .mention-graph-canvas { min-width: 700px; min-height: 700px; }
  .mention-graph-node,
  .mention-graph-label { width: 122px; }
  .mention-graph-icon-circle { width: 52px; height: 52px; }
  #searchInput { grid-column: auto; }
  .detail-grid { grid-template-columns: 1fr; }
  .rank-row { grid-template-columns: 1fr; }
  .rank-row.skills-right { grid-template-columns: 1fr; }
  .controls-row { grid-template-columns: 1fr; }
}

/* Touch-first phones (375-430px target). Lists default to tile mode there
   (views/prefs.ts); the table variant stays reachable and horizontally
   scrollable via .table-wrap. Touch targets >= 40px. */
@media (max-width: 700px) {
  .topbar { min-height: 56px; }
  .topbar h1 { font-size: 19px; }
  #backButton { margin-left: 4px; padding: 0 10px; min-height: 44px; }
  .top-actions { gap: 6px; padding: 0 6px 6px; }
  .nav-button { min-height: 40px; padding: 4px 9px; font-size: 13px; }
  .icon-button { width: 44px; }
  main { padding: 16px 10px 22px; }
  .intro h2 { margin: 6px 0 10px; font-size: 23px; }
  .intro p { margin: 0 0 10px; font-size: 15px; }
  .toolbar { grid-template-columns: 1fr; gap: 8px; margin-bottom: 10px; }
  #searchInput, #catalogSearchInput, #termGraphSearchInput { font-size: 17px; padding: 0 12px; }

  /* Filter panel: label above its buttons, one column, comfy targets. */
  .faction-filter-panel { padding: 8px; margin-bottom: 14px; }
  .filter-panel-grid, .equipment-filter-grid { grid-template-columns: 1fr; gap: 10px; }
  .faction-filter-row { grid-template-columns: 1fr; gap: 4px; min-height: 0; }
  .faction-filter-button { min-width: 42px; min-height: 42px; }
  /* The lock strip is its own tap target: >= 40px tall, bleeding over the
     button padding so its hit width spans the full button. */
  .faction-filter-button .filter-lock-toggle { min-height: 40px; width: calc(100% + 16px); margin: 0 -8px -3px; }

  /* Table fallback: scrolls horizontally inside .table-wrap; tighter cells. */
  .unit-table { min-width: 720px; }
  .unit-table th { height: 42px; padding: 0 8px; font-size: 14px; }
  .unit-table td { height: auto; padding: 8px; font-size: 14px; }
  .sprite-img { width: 52px; height: 52px; }
  .catalog-table td:nth-child(3) { min-width: 320px; }
  .catalog-table.keyword-mode td:nth-child(3) { min-width: 320px; }
  .catalog-table .related-mini .mini-icon { width: 40px; height: 40px; }
  .tag-group { min-height: 30px; padding: 2px 5px; gap: 3px; }
  .tag-group .mini-icon { width: 22px; height: 22px; }
  .rarity-icon { width: 24px; height: 24px; }
  .weapon-type-icon { width: 22px; height: 22px; }
  .source-badge { margin-left: 5px; font-size: 11px; }

  /* Tiles (the small-screen default). */
  .tile-grid { gap: 8px; }
  .tile-grid.tiles-lg { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
  .tile-grid.tiles-sm { grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); }
  .tile-sprite { width: 76px; height: 76px; }

  /* Unit detail. */
  .unit-title { min-height: 0; }
  .unit-title h2 { margin: 12px auto; font-size: 26px; }
  .portrait { margin: 8px 0 12px; }
  .role-line { font-size: 19px; }
  .speed-chip { font-size: 16px; margin-bottom: 12px; }
  .speed-chip strong { font-size: 19px; }
  .engraving-summary { max-width: 340px; gap: 5px; margin-top: 0; }
  .engraving-summary-stat { min-height: 28px; padding: 2px 6px; font-size: 12px; }
  .engraving-stat-icon { width: 21px; height: 21px; }
  .engrave-calculator-toggle { width: 44px; height: 44px; }
  .detail-grid { gap: 18px; }
  .rank-section { margin-top: 28px; }
  .rank-toolbar { margin-bottom: 14px; }
  .rank-toolbar h2 { font-size: 22px; }
  .rank-node { min-height: 0; padding: 10px; font-size: 16px; }
  .rank-node strong { margin-bottom: 6px; font-size: 18px; }
  .rank-row { min-height: 0; gap: 10px; }

  /* Skill / term cards. */
  .skill-card { grid-template-columns: 48px minmax(0, 1fr); gap: 12px; padding: 14px 12px; }
  .skill-card.compact { grid-template-columns: 44px minmax(0, 1fr); padding: 12px; }
  .skill-icon, .skill-card.compact .skill-icon { width: 44px; height: 44px; }
  .skill-title { font-size: 20px; margin-bottom: 6px; }
  .skill-desc { font-size: 15px; }
  .pill { font-size: 13px; min-height: 22px; padding: 1px 8px; }
  .corner-label { padding: 5px 9px; font-size: 13px; }
  .trait-view-tabs, .level-view-tabs, .module-choice-tabs { padding-right: 52px; }
  .trait-line { padding-left: 44px; }
  .trait-line .paragraph-icon { left: 26px; }
  /* Unified trait star-chips: allow wrapping instead of horizontal overflow. */
  .trait-value-set { flex-wrap: wrap; }
  .skill-range-panel { grid-template-columns: auto; gap: 10px; }
  .skill-range-info { font-size: 15px; gap: 4px 14px; }
  .term-detail-card { grid-template-columns: 48px minmax(0, 1fr); }
  .term-icon-slot { width: 48px; min-height: 48px; }
  .empty-state { padding: 18px 10px; font-size: 16px; }

  /* Term pages: tabs wrap, related grids go 2-up, panels single column. */
  .term-tabs { flex-wrap: wrap; margin: 16px 0 10px; }
  .term-tab, .mention-tab, .mention-action-button { min-height: 40px; }
  .related-units, .related-equipment-grid { grid-template-columns: repeat(auto-fill, minmax(138px, 1fr)); gap: 8px; }
  .head-img { width: 84px; height: 84px; }
  .keyword-member { grid-template-columns: 1fr; gap: 6px; }
  .source-row { grid-template-columns: 1fr; gap: 4px; }
  .mention-path { font-size: 12px; }
  .mention-path-source-label { max-width: 110px; }

  /* Term graph page lists. */
  .graph-node-chip-list, .graph-node-chip-list.compact { grid-template-columns: 1fr; }

  /* Graph dialog: header controls wrap within the narrow window. */
  .mention-graph-backdrop { padding: 4px; }
  .mention-graph-window { width: calc(100vw - 8px); height: calc(100vh - 8px); }
  .mention-graph-header { flex-wrap: wrap; gap: 6px; padding: 8px 10px; }
  .mention-graph-header h2 { font-size: 16px; margin-bottom: 2px; }
  /* Diagnostic badges (node/edge counts, fold notes) cost too much height
     on phones; the controls matter more than the meta. */
  .mention-graph-meta { display: none; }
  .mention-graph-actions { justify-content: flex-start; gap: 6px; }
  .mention-graph-scale, .mention-graph-close, .term-graph-action { min-height: 40px; }
  .mention-graph-scroller { padding: 8px; }
  .mention-graph-canvas { min-width: 560px; min-height: 560px; }

  .engrave-calculator-backdrop { padding: 4px; }
  .engrave-calculator-window {
    width: calc(100vw - 8px);
    height: calc(100vh - 8px);
    min-height: 0;
  }
  .engrave-calculator-content {
    grid-template-columns: minmax(0, 1fr);
    overflow: auto;
  }
  .engrave-main { padding: 10px; overflow: visible; }
  .engrave-stat-row {
    grid-template-columns: 32px minmax(0, 1fr);
    grid-template-areas:
      "icon name"
      "slider slider"
      "percent value";
    gap: 7px 9px;
    min-height: 116px;
    padding: 10px;
  }
  .engrave-stat-icon-cell { grid-area: icon; justify-self: center; }
  .engrave-stat-name { grid-area: name; }
  .engrave-slider { grid-area: slider; }
  .engrave-percent-value { grid-area: percent; text-align: left; }
  .engrave-result-value {
    grid-area: value;
    min-width: 0;
    overflow-wrap: anywhere;
    white-space: normal;
  }
  .engrave-sidebar {
    border-left: 0;
    border-top: 1px solid var(--line);
    overflow: visible;
  }
  .engrave-sidebar summary {
    min-height: 44px;
    padding: 10px 12px;
    font-size: 16px;
  }
  .engrave-sidebar-body { padding: 12px 10px 14px; }
  .engrave-pinned-grid { grid-template-columns: 1fr; }
  .engrave-tree-rank {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 6px;
  }
  .engrave-tree-rank-label { min-height: 34px; font-size: 11px; }
  .engrave-tree-rank-nodes { grid-template-columns: minmax(0, 1fr); }
  .engrave-tree-node-face {
    grid-template-columns: 30px minmax(0, 1fr);
    min-height: 40px;
    padding: 5px 6px;
  }
  .engrave-tree-icon { width: 30px; height: 30px; }
  .engrave-tree-bonus { font-size: 12px; }
  .engrave-base-table th,
  .engrave-base-table td {
    padding: 7px 4px;
    font-size: 10px;
  }
  .engrave-base-table .engraving-stat-icon { width: 18px; height: 18px; }
}

/* Honest route skeletons (views/skeleton.ts): shimmer placeholder blocks
   sized like the real content (sprite/tile/portrait dimensions mirror the
   real classes above so the skeleton -> real swap does not shift layout). */
.sk {
  display: inline-block;
  border-radius: 6px;
  background: linear-gradient(100deg,
    rgba(120, 130, 152, 0.16) 30%,
    rgba(160, 170, 195, 0.30) 50%,
    rgba(120, 130, 152, 0.16) 70%);
  background-size: 220% 100%;
  animation: sk-shimmer 1.3s ease-in-out infinite;
}
@keyframes sk-shimmer {
  from { background-position: 130% 0; }
  to { background-position: -90% 0; }
}
.sk-bar { height: 14px; max-width: 100%; margin: 3px 6px 3px 0; vertical-align: middle; }
.sk-sprite { width: 84px; height: 84px; border-radius: 10px; }
.sk-mini-icon { width: 40px; height: 40px; border-radius: 8px; }
.sk-related { width: 68px; height: 68px; border-radius: 8px; margin-right: 6px; }
.sk-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(120, 130, 152, 0.25);
  border-radius: 12px;
}
.sk-tile-sprite { width: 96px; height: 96px; border-radius: 12px; }
.tiles-sm .sk-tile-sprite { width: 60px; height: 60px; }
.sk-card {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px;
  margin-bottom: 12px;
  border: 1px solid rgba(120, 130, 152, 0.25);
  border-radius: 12px;
}
.sk-card-lines { flex: 1; }
.sk-card-lines .sk-bar { display: block; }
img.portrait.sk { min-height: 200px; }
@media (max-width: 700px) {
  .sk-sprite { width: 52px; height: 52px; }
  .sk-tile-sprite { width: 76px; height: 76px; }
}

/* Term page related-panel filter chip (views/termDetail.ts): active filters
   narrow the related lists by default; the chip toggles show-all per visit. */
.term-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 10px;
  padding: 3px 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(66, 80, 106, 0.35);
  color: inherit;
  font-size: 15px;
  cursor: pointer;
}
.term-filter-chip:hover { background: rgba(66, 80, 106, 0.6); }
