/* ============================================================================
   Drag(*)nBall Z: Fighter's Edition - PLAYER ENCYCLOPEDIA styles (ency.css)
   ----------------------------------------------------------------------------
   Design-system base for the encyclopedia views (bestiary / skills / items /
   atlas ...). Component markup is built by js/util/ency.js (window.Ency).
   Palette + fonts come from the site tokens in app.css (--line-hot, --bg-bar,
   --fg, --mono, --pad, ...). Terminal chrome, compact paddings, readable at a
   glance.

   OWNERSHIP: the design-system lane owns everything above the PAGE-SPECIFIC
   marker at the bottom. Page lanes APPEND their rules below it, each under a
   clearly-commented section header. Do not edit the base.
   ========================================================================= */

/* ---- page intro strip - one-line title + one plain sentence -------------- */
.ency-hero {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.4rem 1.2ch;
  margin: 0 0 var(--pad);
  padding: 0.5rem 0.8rem;
  border: 1px solid var(--line-hot);
  border-left: 3px solid var(--orange);
  background: linear-gradient(180deg, var(--bg-bar), var(--bg-pane));
}
.ency-hero-t {
  font-family: var(--ui); font-weight: 700;
  font-size: 1.05em; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--orange);
}
.ency-hero-d { color: var(--fg-dim); font-size: 0.95em; }

/* ---- toolbar (page lanes drop search + chips in here) --------------------- */
.ency-tools {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 0.5rem 1rem;
  margin: 0 0 var(--pad);
}

/* ---- search bar ----------------------------------------------------------- */
.ency-search {
  display: inline-flex; align-items: center; gap: 0.8ch;
  border: 1px solid var(--line-hot);
  background: var(--bg-well);
  padding: 0.25rem 0.6rem;
  min-width: 14rem; flex: 1 1 14rem; max-width: 26rem;
}
.ency-search:focus-within { border-color: var(--line-lock); box-shadow: var(--glow-grn); }
.ency-search-k { color: var(--green-dim); font-size: 0.85em; letter-spacing: 0.1em; text-transform: uppercase; }
.ency-search-k::after { content: '>'; margin-left: 0.3ch; color: var(--green); }
.ency-search-in {
  flex: 1 1 auto; min-width: 6rem;
  background: transparent; border: none; outline: none;
  color: var(--fg); font-family: var(--mono); font-size: 0.95em;
  caret-color: var(--green);
}
.ency-search-in::placeholder { color: var(--fg-faint); }
.ency-search-in::-webkit-search-cancel-button { filter: grayscale(1) brightness(1.6); }

/* ---- filter chips ---------------------------------------------------------- */
.ency-chips { display: inline-flex; flex-wrap: wrap; gap: 0.35rem; }
.ency-chip {
  appearance: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: 0.6ch;
  font-family: var(--mono); font-size: 0.82em; letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-dim);
  background: transparent;
  border: 1px solid var(--line-hot);
  padding: 0.18rem 0.6rem;
  transition: color 100ms ease, border-color 100ms ease, background 100ms ease;
}
.ency-chip:hover { color: var(--gold); border-color: var(--gold); }
.ency-chip.on {
  color: var(--green);
  border-color: var(--green-dim);
  background: rgba(77, 242, 162, 0.07);
  box-shadow: inset 0 0 0.6em rgba(77, 242, 162, 0.12);
}
.ency-chip:focus-visible { outline: 1px dashed var(--green); outline-offset: 2px; }
.ency-chip-dot {
  width: 0.6em; height: 0.6em; border-radius: 50%;
  display: inline-block; flex: none;
}

/* ---- responsive card grid --------------------------------------------------- */
.ency-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(15.5rem, 1fr));
  gap: calc(var(--pad) * 0.8);
  align-items: stretch;
  margin: 0 0 var(--pad);
}
@media (max-width: 480px) {
  .ency-grid { grid-template-columns: 1fr; }
}

/* ---- entry card - terminal box chrome ---------------------------------------- */
.ency-card {
  display: flex; flex-direction: column;
  border: 1px solid var(--line-hot);
  background: var(--bg-pane);
  min-width: 0;
  transition: border-color 120ms ease, background 120ms ease;
}
.ency-card:hover { border-color: var(--line-lock); background: var(--bg-raise); }
.ency-card-hd {
  display: flex; align-items: center; gap: 0.6ch;
  padding: 0.3rem 0.6rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--bg-bar), var(--bg-pane));
  color: var(--amber);
  font-family: var(--ui); font-weight: 600;
  font-size: 0.9em; letter-spacing: 0.1em; text-transform: uppercase;
  min-width: 0;
}
.ency-card-hd::before { content: '\25B8'; color: var(--hd-tick, var(--orange)); flex: none; }
.ency-card-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ency-card-tags {
  display: flex; flex-wrap: wrap; gap: 0.3rem;
  padding: 0.35rem 0.6rem 0;
}
.ency-card-bd { padding: 0.45rem 0.6rem 0.5rem; flex: 1 1 auto; }
.ency-card-ft {
  padding: 0.32rem 0.6rem;
  border-top: 1px solid var(--line);
  color: var(--fg-dim); font-size: 0.85em;
}

/* ---- small info tags on cards ---- */
.ency-tag {
  display: inline-block;
  font-family: var(--mono); font-size: 0.74em; letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-dim);
  border: 1px solid var(--line-hot);
  background: var(--bg-bar);
  padding: 0.06rem 0.45rem;
  white-space: nowrap;
}
.ency-tag.hot   { color: var(--orange); border-color: var(--orange-dk); }
.ency-tag.gold  { color: var(--gold);   border-color: var(--gold); }
.ency-tag.grn   { color: var(--green);  border-color: var(--green-dim); }
.ency-tag.red   { color: var(--red);    border-color: var(--red); }

/* ---- label/value rows inside a card ---- */
.ency-row {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1.2ch;
  padding: 0.14rem 0;
  border-bottom: 1px dashed var(--line);
  font-size: 0.92em;
  min-width: 0;
}
.ency-row:last-child { border-bottom: none; }
.ency-row-k {
  color: var(--fg-faint);
  font-size: 0.88em; letter-spacing: 0.08em; text-transform: uppercase;
  flex: none;
}
.ency-row-v {
  color: var(--fg); text-align: right;
  min-width: 0; overflow: hidden; text-overflow: ellipsis;
  display: inline-flex; align-items: center; justify-content: flex-end; gap: 0.8ch;
  flex: 1 1 auto;
}

/* ---- stat bar --------------------------------------------------------------- */
.ency-bar {
  display: inline-block; vertical-align: middle;
  width: 6.5rem; max-width: 40vw; height: 0.55em;
  background: var(--bg-well);
  border: 1px solid var(--line);
  overflow: hidden; flex: none;
}
.ency-bar-fill { display: block; height: 100%; }

/* ---- map panel (canvas + legend + tooltip) ------------------------------------ */
.ency-map { margin: 0 0 var(--pad); min-width: 0; }
.ency-map-frame {
  position: relative;
  border: 1px solid var(--line-hot);
  background: #06070a;
  padding: 4px;
  overflow: hidden;
}
.ency-map-cv { display: block; width: 100%; height: auto; image-rendering: pixelated; }
.ency-map-tip {
  position: absolute; z-index: 5;
  pointer-events: none;
  max-width: 18rem;
  padding: 0.3rem 0.55rem;
  border: 1px solid var(--line-lock);
  background: rgba(4, 6, 5, 0.94);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
  font-family: var(--mono); font-size: 0.82em; line-height: 1.35;
  color: var(--fg);
  white-space: nowrap;
}
.ency-tip-name { font-weight: 700; letter-spacing: 0.04em; }
.ency-tip-name.bad  { color: var(--red); }
.ency-tip-name.good { color: var(--green); }
.ency-tip-line  { color: var(--fg-dim); }
.ency-tip-teach { color: var(--gold); }
.ency-tip-tele  { color: #6fe9f0; }
.ency-tip-turf  { color: var(--fg-faint); font-size: 0.9em; }

.ency-map-legend {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 0.25rem 1.1rem;
  padding: 0.3rem 0.2rem 0;
  font-family: var(--mono); font-size: 0.8em;
  color: var(--fg-dim);
}
.ency-lg { display: inline-flex; align-items: center; gap: 0.6ch; white-space: nowrap; }
.ency-lg-dot {
  width: 0.65em; height: 0.65em; border-radius: 50%;
  display: inline-block; flex: none;
  border: 1px solid rgba(0, 0, 0, 0.55);
}
.ency-lg-dot.bad  { background: #ff4d4d; }
.ency-lg-dot.good { background: #3ad07a; }
.ency-lg-ring {
  width: 0.65em; height: 0.65em; border-radius: 50%;
  display: inline-block; flex: none;
  background: #3ad07a;
  border: 2px solid #ffd166;
}
.ency-lg-sq {
  width: 0.65em; height: 0.65em;
  display: inline-block; flex: none;
  background: #22d3ee;
}
.ency-lg-hint { margin-left: auto; color: var(--fg-faint); }

/* ---- muted placeholder --------------------------------------------------------- */
.ency-empty {
  padding: 1.2rem 0.8rem;
  text-align: center;
  color: var(--fg-faint);
  font-family: var(--mono);
  border: 1px dashed var(--line-hot);
}

/* =================================================================================
   PAGE-SPECIFIC SECTIONS - page lanes APPEND below this line ONLY, each under a
   clearly-commented header, e.g.:  /* ---- bestiary ---- * /
   ============================================================================== */

/* ---- bestiary (js/views/bestiary.js) -------------------------------------------
   Page-lane section: the live result count, the power bar + number pairing, and
   the DROPS / TEACHES footer lists on creature cards. */
.bst-count {
  margin-left: auto;
  color: var(--fg-faint);
  font-family: var(--mono);
  font-size: 0.82em;
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.bst-pow {
  display: inline-flex; align-items: center; gap: 0.6ch;
  min-width: 0;
}
.bst-pow-n { color: var(--fg); white-space: nowrap; }
.bst-foot { display: flex; flex-direction: column; gap: 0.15rem; min-width: 0; }
.bst-sec { display: flex; align-items: baseline; gap: 0.8ch; min-width: 0; }
.bst-sec-k {
  flex: none;
  color: var(--fg-faint);
  font-size: 0.82em; letter-spacing: 0.08em; text-transform: uppercase;
}
.bst-sec-v { min-width: 0; overflow-wrap: anywhere; }
.bst-sec.drop  .bst-sec-v { color: var(--fg-dim); }
.bst-sec.teach .bst-sec-v { color: var(--gold); }

/* ---- atlas (js/views/planets.js) ------------------------------------------------
   Page-lane section: index cards are whole-card links into a world's live-map
   page; small value helpers keep bars + figures on one line and let the no-air
   warning / teaches lists wrap. */
.atlas-link { display: block; text-decoration: none; color: inherit; min-width: 0; }
.atlas-link[hidden] { display: none; }
.atlas-link .ency-card { height: 100%; cursor: pointer; }
.atlas-link:hover .ency-card { border-color: var(--line-lock); background: var(--bg-raise); }
.atlas-link:focus-visible { outline: 1px dashed var(--green); outline-offset: 2px; }

.atlas-back {
  display: inline-block; margin: 0 0 0.6rem;
  font-family: var(--mono); font-size: 0.9em;
  color: var(--green); text-decoration: none;
}
.atlas-back:hover { color: var(--gold); text-decoration: underline; }

.atlas-vwrap { display: inline-flex; align-items: center; gap: 0.7ch; min-width: 0; }
.atlas-good  { color: var(--green); }
.atlas-warn  { color: var(--red);  white-space: normal; text-align: right; }
.atlas-teach { color: var(--gold); white-space: normal; text-align: right; }

/* ---- skills (js/views/skills-ency.js) --------------------------------------------
   Page-lane section: the compact grouped move LIST - one row per move (kind-colored
   left rule, name / plain sentence / stat tags, a +/- marker), expanding into the
   "how you get it" panel. Rows are real <button>s for keyboard use. */
.skl-groups { min-width: 0; }
.skl-intro {
  margin: 0 0 0.45rem;
  color: var(--fg-dim);
  font-size: 0.92em;
}
.skl-list { display: flex; flex-direction: column; min-width: 0; }
.skl-item { border-bottom: 1px solid var(--line); min-width: 0; }
.skl-item:last-child { border-bottom: 0; }
.skl-item[hidden] { display: none; }

.skl-row {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.3rem 1ch;
  width: 100%; padding: 0.42rem 0.5rem 0.42rem 0.7rem;
  background: none; border: 0; border-left: 3px solid var(--line-hot);
  font: inherit; color: var(--fg); text-align: left; cursor: pointer;
}
.skl-row:hover, .skl-item.open .skl-row { background: var(--bg-raise); }
.skl-row:focus-visible { outline: 1px dashed var(--green); outline-offset: 1px; }

.skl-name {
  flex: 0 0 auto; min-width: 11rem;
  font-family: var(--mono); color: var(--fg);
}
.skl-desc { flex: 1 1 16rem; min-width: 0; color: var(--fg-dim); font-size: 0.92em; }
.skl-tags { flex: 0 0 auto; margin-left: auto; display: flex; gap: 0.6ch; }
.skl-tag {
  font-family: var(--mono); font-size: 0.78em; white-space: nowrap;
  color: var(--fg-dim); border: 1px solid var(--line-hot);
  padding: 0 0.6ch; border-radius: 2px;
}
.skl-tag.cost { color: var(--amber); }
.skl-x { flex: 0 0 auto; width: 1.4ch; font-family: var(--mono); color: var(--fg-faint); }
.skl-item.open .skl-x { color: var(--green); }

.skl-how {
  margin: 0 0 0.5rem 0.7rem;
  padding: 0.35rem 0.7rem 0.5rem;
  border-left: 1px dashed var(--line-hot);
  color: var(--fg-dim); font-size: 0.92em;
}
.skl-how[hidden] { display: none; }
.skl-how-k {
  display: block; margin-bottom: 0.2rem;
  color: var(--fg-faint); font-size: 0.8em;
  letter-spacing: 0.08em; text-transform: uppercase;
}
.skl-get { margin: 0.1rem 0; }
.skl-mob { color: var(--gold); font-weight: 600; }
.skl-pl  { color: var(--green); font-weight: 600; }
.skl-know { color: var(--green); margin: 0.1rem 0; }
.skl-ask  { color: var(--fg-dim); margin: 0.1rem 0; }
.skl-hint { margin-top: 0.25rem; color: var(--fg-faint); font-size: 0.9em; }
.skl-hint a { color: var(--gold); }

/* ---- races (js/views/races.js) ---------------------------------------------------
   Page-lane section: race cards pick up their race-channel color (--race-c from
   app.css tokens) on the header, a one-line identity blurb sits under the name,
   and the footer stacks the starting-skill chips over the how-you-get-it line. */
.ency-card[hidden] { display: none; }               /* the search filter hides cards */
.races-card .ency-card-hd { box-shadow: inset 3px 0 0 var(--race-c, var(--line-hot)); }
.races-card .ency-card-hd .ency-card-t { color: var(--race-c, var(--amber)); }
.races-blurb {
  padding: 0.4rem 0.6rem 0;
  color: var(--fg-dim);
  font-size: 0.88em; line-height: 1.45;
}
.races-vwrap { display: inline-flex; align-items: center; gap: 0.7ch; min-width: 0; }
.races-good    { color: var(--green); }
.races-evil    { color: var(--red); }
.races-neutral { color: var(--gold); }
.races-ft { display: flex; flex-direction: column; gap: 0.3rem; min-width: 0; }
.races-sec { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.3rem 0.5ch; min-width: 0; }
.races-sec-k {
  flex: none;
  color: var(--fg-faint);
  font-size: 0.82em; letter-spacing: 0.08em; text-transform: uppercase;
}
.races-how { color: var(--fg-dim); }

/* ---- forms ladders (js/views/forms.js) --------------------------------------------
   Page-lane section: one bordered section per race - a race-colored header strip
   (inset tick from --race-c, like the race cards) over a wrapping chain of small
   form boxes joined by '->'. Dashed boxes mark base/starting forms. */
.fml-sec {
  margin: 0 0 var(--pad);
  border: 1px solid var(--line-hot);
  background: var(--bg-pane);
  min-width: 0;
}
.fml-hd {
  display: flex; align-items: baseline; gap: 1ch;
  padding: 0.3rem 0.6rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--bg-bar), var(--bg-pane));
  box-shadow: inset 3px 0 0 var(--race-c, var(--green));
}
.fml-race {
  font-family: var(--ui); font-weight: 600;
  font-size: 0.9em; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--race-c, var(--amber));
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fml-n {
  margin-left: auto; flex: none;
  color: var(--fg-faint);
  font-family: var(--mono); font-size: 0.8em; letter-spacing: 0.06em;
}
.fml-row {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: 0.45rem 0.35rem;
  padding: 0.55rem 0.6rem;
}
.fml-box {
  display: flex; flex-direction: column; gap: 0.24rem;
  border: 1px solid var(--line-hot);
  background: var(--bg-bar);
  padding: 0.32rem 0.55rem;
  min-width: 8.5rem; max-width: 14rem;
  transition: border-color 120ms ease, background 120ms ease;
}
.fml-box:hover { border-color: var(--line-lock); background: var(--bg-raise); }
.fml-box .ency-bar { width: 100%; max-width: none; }
.fml-name {
  font-family: var(--mono); font-size: 0.9em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.fml-pow { color: var(--fg-dim); font-family: var(--mono); font-size: 0.8em; }
.fml-base { border-style: dashed; }
.fml-base .fml-pow { color: var(--fg-faint); }
.fml-arr { flex: none; color: var(--fg-faint); font-family: var(--mono); }

/* ---- items (js/views/items-ency.js) -----------------------------------------------
   Page-lane section: the colored +N stat-bonus tags on item cards and the
   "drops from <mob> (<planet>)" footer line. */
.ency-tag.itm-b { text-transform: none; letter-spacing: 0.04em; }
.ency-tag.itm-str { color: var(--red);   border-color: #6e2a2a; }
.ency-tag.itm-ki  { color: #5cd3e8;      border-color: #2b5a63; }
.ency-tag.itm-sta { color: var(--green); border-color: var(--green-dim); }
.ency-tag.itm-arm { color: #8fb8ff;      border-color: #38507a; }
.ency-tag.itm-mf  { color: var(--gold);  border-color: #7a5c22; }
.ency-tag.itm-neg { color: var(--red);   border-color: var(--red); }

.itm-drop { color: var(--fg-dim); overflow-wrap: anywhere; }
.itm-mob  { color: var(--gold); font-weight: 600; }
.itm-pl   { color: var(--green); }
.itm-where { color: var(--fg-faint); }

/* ---- guide (js/views/guide.js) ------------------------------------------------------
   Page-lane section: the handbook's section grid, plain paragraphs with inline
   command chips, the "born knowing" move keys, and the where-to-next links. */
.gd-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(21rem, 1fr));
  gap: calc(var(--pad) * 0.8);
  align-items: stretch;
  margin: 0 0 var(--pad);
}
@media (max-width: 480px) {
  .gd-grid { grid-template-columns: 1fr; }
}
.gd-grid .box { margin: 0; height: 100%; }

.gd-p { margin: 0 0 0.55rem; color: var(--fg-dim); font-size: 0.95em; line-height: 1.5; }
.gd-p:last-child { margin-bottom: 0; }
.gd-c {
  font-family: var(--mono); font-size: 0.92em;
  color: var(--green);
  background: var(--bg-well);
  border: 1px solid var(--line-hot);
  padding: 0 0.5ch;
  white-space: nowrap;
}
.gd-a { color: var(--gold); }
.gd-a:hover { color: var(--orange); }

.gd-born {
  margin-top: 0.6rem; padding-top: 0.5rem;
  border-top: 1px dashed var(--line);
}
.gd-born-k {
  display: block; margin-bottom: 0.3rem;
  color: var(--fg-faint); font-size: 0.8em;
  letter-spacing: 0.1em; text-transform: uppercase;
}
.gd-kbd { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.gd-k {
  font-family: var(--mono); font-size: 0.82em;
  color: var(--fg);
  background: var(--bg-bar);
  border: 1px solid var(--line-hot);
  border-bottom-width: 2px;
  padding: 0.05rem 0.55ch;
}
.gd-born-more { display: block; margin-top: 0.4rem; color: var(--fg-dim); font-size: 0.88em; }

.gd-links { display: flex; flex-direction: column; margin: 0 0 0.7rem; }
.gd-link {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 1.2ch;
  padding: 0.3rem 0.4rem;
  border-bottom: 1px dashed var(--line);
  text-decoration: none;
}
.gd-link:last-child { border-bottom: none; }
.gd-link:hover { background: var(--bg-raise); }
.gd-link-k {
  flex: 0 0 auto; min-width: 7rem;
  font-family: var(--mono); color: var(--gold);
}
.gd-link:hover .gd-link-k { color: var(--orange); }
.gd-link-d { flex: 1 1 14rem; min-width: 0; color: var(--fg-dim); font-size: 0.9em; }

.gd-cta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1.2rem; }
.gd-help { color: var(--fg-dim); font-size: 0.92em; }

/* ---- pager (Ency.pager - owner request: paginate the long grids) ---- */
.ency-pager { display: flex; align-items: center; gap: .6rem; margin: .5rem 0; flex-wrap: wrap; }
.ency-pg-btn { font-family: var(--mono); background: var(--bg-bar); color: var(--fg);
  border: 1px solid var(--line-hot); padding: .15rem .6rem; cursor: pointer; font-size: .8rem; }
.ency-pg-btn:hover:not(:disabled) { color: var(--amber); border-color: var(--amber); }
.ency-pg-btn:disabled { opacity: .35; cursor: default; }
.ency-pg-info { font-family: var(--mono); font-size: .8rem; color: var(--amber); }
.ency-pg-count { font-family: var(--mono); font-size: .75rem; opacity: .7; }
