/* The 도감 (/db), the 조합 page (/builder) and a build shown in a post. The site's look (site.css): near-black ground,
   white letters, one gold accent, pictures rounded without frames, the page itself out of the way. So here: no
   boxed cards, no colour bars or glows; a list is rows on the ground parted by space or a hairline. The only other
   colours are the six affiliations' own, and only on a hero's label and a trait's name.

   One scale for everything on these pages (web/gate.md 27판):
     letters  13 (labels, notes) / 15 (controls, secondary) / 17 (reading) / 20 (a block's name)
     space    4 / 8 / 12 / 16 / 24 / 32 / 48
     corners  8 (small things) / 12 (squares, controls) / 18 (a large picture)
     --col    the left column every row's name sits in (소속, 역할, 1코스트), so what follows starts on one line */

.tool { --col: 64px; }
/* only the 조합 page is wider than the site (nine squares a row with roomy labels need it); its header and footer
   stay the site's width, so the logo and menu do not move between pages */
.wide main .wrap { max-width: 1376px; }
.grow { flex: 1; }
.chips.left { justify-content: flex-start; }
.tool .chip { min-height: 38px; padding: 0 16px; font-size: 15px; }
.tchip { display: inline-flex; align-items: center; gap: 8px; }
.tchip img { width: 16px; height: 16px; object-fit: contain; }
.tchip[aria-pressed="true"] img { filter: brightness(0); }

/* ---- the page's own tabs --------------------------------------------------------------------------------- */
.db-tabs { display: flex; gap: 8px; margin: 0 0 32px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.db-tabs [role="tab"] {
  padding: 12px 16px; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; background: none; cursor: pointer;
  color: var(--muted); font-size: 17px; font-weight: 700; white-space: nowrap;
}
.db-tabs [role="tab"]:hover { color: var(--text); text-decoration: none; }
.db-tabs [role="tab"][aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.db-body { min-height: 60vh; padding-bottom: 96px; }
.db-h { margin: 48px 0 24px; font-size: 20px; font-weight: 800; }
.db-h:first-child { margin-top: 0; }
.db-note { margin: 0; color: var(--muted); font-size: 15px; }
.db-back { display: inline-block; margin-bottom: 24px; color: var(--soft); font-size: 15px; font-weight: 600; }
.db-lines { max-width: 44em; }
.db-lines p { margin: 0; }
.db-lines p + p { margin-top: 4px; }

/* ---- shared pieces ---------------------------------------------------------------------------------------- */
/* a hero's square: its card cut square, the name on the picture's foot; under it (where asked) one label as wide as
   the square, split at the same place into the affiliation (its colour) and the role */
.gtile { display: grid; gap: 8px; justify-items: center; align-content: start; min-width: 0; padding: 0; border: 0; background: none; cursor: pointer; color: var(--text); text-decoration: none !important; }
span.gtile { cursor: default; }
.gtile .pic { position: relative; display: block; width: 100%; aspect-ratio: 1; border-radius: 12px; overflow: hidden; box-shadow: 0 0 0 1px var(--line-2); }
.gtile .pic > img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 18%; }
.gtile .nm {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 20px 4px 8px; background: linear-gradient(transparent, rgba(8, 7, 11, 0.94) 60%);
  font-size: 15px; font-weight: 700; line-height: 1.2; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.gtile .lb { display: grid; grid-template-columns: 54fr 46fr; gap: 1px; width: 100%; height: 24px; border-radius: 8px; overflow: hidden; font-size: 13px; font-weight: 700; line-height: 24px; text-align: center; white-space: nowrap; }
.gtile .lb b { background: var(--c, var(--soft)); color: #16121c; font-weight: 800; }
.gtile .lb i { background: rgba(255, 255, 255, 0.14); font-style: normal; }
a.gtile:hover .pic, button.gtile:hover .pic { box-shadow: 0 0 0 2px var(--text); }
.gtile.on .pic { box-shadow: 0 0 0 2px var(--accent); }
.gtile.on .nm { padding: 8px 4px; background: var(--accent); color: var(--accent-ink); }
.gtile.wip .pic > img { filter: grayscale(0.6) brightness(0.8); }
.gtile.mini { width: 72px; flex: none; }
.gtile.mini .nm { padding: 16px 2px 4px; font-size: 13px; }

/* the heroes a row a cost: the cost in the left column, the squares after it */
.gcost { display: grid; grid-template-columns: var(--col) minmax(0, 1fr); align-items: start; }
.gcost > b { padding-top: 4px; color: var(--muted); font-size: 13px; font-weight: 700; }
.gtiles { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 16px 10px; }

/* a small face (the table, an item's heroes) */
.gface { position: relative; display: inline-flex; flex: none; padding: 0; border: 0; background: none; }
.gface img { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; object-position: 50% 22%; box-shadow: 0 0 0 1px var(--line-2); }
.gface i, .gface span { display: none; }
.gface.wip img { filter: grayscale(0.7) brightness(0.75); }
a.gface:hover img { box-shadow: 0 0 0 2px var(--text); }

.gitem { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 56px; height: 56px; padding: 0; border: 0; border-radius: 12px; background: var(--surface-2); overflow: hidden; }
button.gitem { cursor: pointer; }
button.gitem:hover { box-shadow: 0 0 0 2px var(--text); }
.gitem img { width: 100%; height: 100%; object-fit: contain; }
.gitem b { color: var(--muted); font-size: 17px; }
.gitem.small { width: 40px; height: 40px; border-radius: 8px; }
.gitem.tiny, .gitem.mini { width: 24px; height: 24px; border-radius: 6px; }
.gitem.empty { box-shadow: inset 0 0 0 1px var(--line-2); background: none; }

.gtrait { display: inline-flex; align-items: center; gap: 8px; font-size: 15px; white-space: nowrap; color: var(--text); }
a.gtrait:hover { text-decoration: none; }
a.gtrait:hover b { text-decoration: underline; }
.gtrait img { width: 20px; height: 20px; object-fit: contain; }
.gtrait b { font-weight: 700; color: var(--c, var(--text)); }
.gtrait.big { gap: 12px; font-size: 20px; }
.gtrait.big img { width: 28px; height: 28px; }
.gtrait i { color: var(--muted); font-size: 13px; font-style: normal; font-weight: 700; }

/* ---- 도감: heroes ------------------------------------------------------------------------------------------ */
.db-filters { display: grid; gap: 12px; }
.db-frow { display: grid; grid-template-columns: var(--col) minmax(0, 1fr) auto; align-items: center; }
.db-flabel { color: var(--muted); font-size: 13px; font-weight: 700; }
.db-view { margin: 0; }
.db-search { width: 200px; min-height: 38px; padding: 0 16px; border-radius: 999px; border: 1px solid var(--line-2); background: none; font-size: 15px; }
.db-search::placeholder { color: var(--muted); }
.db-empty { margin-top: 32px; padding-left: var(--col); }
.db-grid { display: grid; gap: 24px; margin-top: 32px; }
.db-grid .gtiles { grid-template-columns: repeat(auto-fill, minmax(104px, 120px)); }

.db-table { margin-top: 32px; border-top: 1px solid var(--line); }
.db-table .row {
  display: grid; grid-template-columns: minmax(180px, 1.5fr) 1fr 1fr 96px 96px 96px minmax(120px, 1.2fr); gap: 16px; align-items: center;
  padding: 8px 0; border-bottom: 1px solid var(--line); color: var(--soft); font-size: 15px;
}
.db-table a.row:hover { background: rgba(255, 255, 255, 0.04); text-decoration: none; }
.db-table .head { padding: 12px 0; color: var(--muted); font-size: 13px; font-weight: 700; }
.db-table .who { display: flex; align-items: center; gap: 16px; min-width: 0; }
.db-table .who b { color: var(--text); font-size: 17px; }
.db-table .who em { color: var(--muted); font-size: 13px; font-style: normal; font-weight: 700; }
.db-table .num { font-variant-numeric: tabular-nums; }
.db-table .skill { color: var(--text); font-weight: 600; }
.db-table .row.wip .num, .db-table .row.wip .skill { color: var(--muted); }

.db-hero { display: grid; grid-template-columns: minmax(0, 360px) minmax(0, 720px); gap: 64px; align-items: start; }
.db-hero-card img { width: 100%; border-radius: var(--radius); }
.db-hero-info .who { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.db-hero-info h2 { margin: 0; font-size: clamp(34px, 4vw, 52px); font-weight: 800; line-height: 1.1; }
.db-hero-info .cost, .db-hero-info .state { color: var(--muted); font-size: 15px; font-weight: 700; }
.db-hero-traits { display: flex; gap: 24px; margin: 16px 0 32px; }
.db-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px 24px; margin: 0; padding: 24px 0; border-top: 1px solid var(--line); }
.db-stats dt { color: var(--muted); font-size: 13px; font-weight: 700; }
.db-stats dd { margin: 4px 0 0; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }
.db-star-note { margin: 0 0 24px; font-size: 13px; }
.db-move { padding: 24px 0; border-top: 1px solid var(--line); }
.db-move h3 { display: flex; align-items: baseline; gap: 12px; margin: 0 0 8px; color: var(--muted); font-size: 13px; font-weight: 700; }
.db-move h3 b { color: var(--text); font-size: 20px; font-weight: 800; }
.db-move h3 em { color: var(--soft); font-size: 15px; font-style: normal; }
.db-skill { display: flex; gap: 16px; align-items: flex-start; }
.db-skill img { width: 56px; height: 56px; border-radius: 12px; flex: none; }
.db-values { display: flex; flex-wrap: wrap; gap: 8px 24px; margin: 12px 0 0; padding: 0; list-style: none; font-size: 15px; }
.db-values span { color: var(--muted); margin-right: 8px; }
.db-values b { font-variant-numeric: tabular-nums; }
.db-items-row { display: flex; flex-wrap: wrap; gap: 12px 24px; }
.db-item-link { display: inline-flex; align-items: center; gap: 12px; color: var(--soft); font-size: 15px; font-weight: 600; }
.db-item-link .gitem { width: 40px; height: 40px; border-radius: 8px; }
.db-hero-next { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding-top: 24px; border-top: 1px solid var(--line); font-size: 15px; font-weight: 600; }
.db-hero-next > a:not(.btn) { color: var(--soft); }

/* ---- 도감: traits ------------------------------------------------------------------------------------------ */
.db-traits { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 64px; }
.db-trait { padding: 32px 0; border-top: 1px solid var(--line); }
.db-trait.lit .gtrait b { text-decoration: underline; text-underline-offset: 6px; }
.db-trait header p { margin: 8px 0 0; color: var(--soft); font-size: 15px; }
.db-steps { display: grid; gap: 4px; margin: 16px 0 24px; padding: 0; list-style: none; font-size: 15px; }
.db-steps li { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 8px; color: var(--soft); }
.db-steps b { color: var(--text); font-variant-numeric: tabular-nums; }
.db-members { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---- 도감: items, augments, relics ---------------------------------------------------------------------------- */
.db-two { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 48px; align-items: start; }
.db-two .db-note { margin-bottom: 16px; }
.db-cards { margin-top: 32px; }
.db-combine > p { margin: 0 0 16px; color: var(--soft); font-size: 15px; }
.db-mats { display: flex; flex-wrap: wrap; gap: 16px; }
.db-mat { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--soft); font-size: 13px; font-weight: 600; }
.db-mat.on .gitem { box-shadow: 0 0 0 2px var(--accent); }
.db-result { margin-top: 24px; min-height: 80px; }
.db-matrix { display: inline-grid; gap: 8px; max-width: 100%; overflow-x: auto; }
.db-matrix .mrow { display: grid; grid-template-columns: repeat(7, 48px); gap: 8px; align-items: center; justify-items: center; }
.db-matrix .mcell { width: 48px; height: 48px; display: flex; align-items: center; justify-content: center; }
.db-matrix .mcell a { display: flex; }
.db-cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px 48px; }
.db-card { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 16px; align-items: start; }
.db-card.lit h3 { color: var(--accent); }
.db-card h3 { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; margin: 0 0 4px; font-size: 17px; font-weight: 800; }
.db-card p { margin: 0; color: var(--soft); font-size: 15px; line-height: 1.6; }
.db-recipe { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-bottom: 8px; color: var(--muted); font-size: 13px; font-weight: 600; }
.db-recipe span { display: inline-flex; align-items: center; gap: 8px; }
.db-fans { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-top: 12px; color: var(--muted); font-size: 13px; font-weight: 600; }
.db-fans .gface img { width: 32px; height: 32px; border-radius: 6px; }
.tier { font-size: 13px; font-style: normal; font-weight: 700; color: var(--muted); }
.tier.gold { color: var(--accent); }
.tier.prism { color: #c9a8ff; }

/* ---- 조합 -------------------------------------------------------------------------------------------------- */
.bd { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 40px; align-items: start; padding-bottom: 96px; }
.bd-traits { position: sticky; top: 96px; display: grid; gap: 24px; max-height: calc(100vh - 112px); overflow-y: auto; }
.bd-kind { display: grid; gap: 4px; }
.bd-kind h3 { margin: 0 0 4px; padding-bottom: 8px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 13px; font-weight: 700; }
.bd-trait {
  display: grid; grid-template-columns: 20px minmax(0, 1fr) auto 16px; gap: 0 8px; align-items: center; width: 100%; min-height: 32px; padding: 4px 8px; margin: 0 -8px;
  border: 0; border-radius: 8px; background: none; cursor: pointer; text-align: left; color: var(--muted); box-sizing: content-box;
}
.bd-trait:hover { background: rgba(255, 255, 255, 0.05); }
.bd-trait.picked { background: rgba(255, 255, 255, 0.1); }
.bd-trait .ic { display: flex; }
.bd-trait .ic img { width: 20px; height: 20px; object-fit: contain; opacity: 0.4; }
.bd-trait b { font-size: 15px; font-weight: 700; }
.bd-trait .cnt { display: flex; gap: 4px; }
.bd-trait .cnt i { min-width: 20px; border-radius: 6px; color: var(--muted); font-size: 13px; font-style: normal; font-weight: 700; text-align: center; line-height: 20px; opacity: 0.5; }
.bd-trait .have { font-size: 15px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; opacity: 0.4; }
.bd-trait .gives { grid-column: 2 / -1; padding-bottom: 4px; color: var(--soft); font-size: 13px; line-height: 1.5; }
.bd-trait.some { color: var(--soft); }
.bd-trait.some .ic img { opacity: 0.7; }
.bd-trait.some .have { opacity: 1; }
.bd-trait.lit { color: var(--text); }
.bd-trait.lit b { color: var(--c, var(--text)); }
.bd-trait.lit .ic img, .bd-trait.lit .cnt i, .bd-trait.lit .have { opacity: 1; }
.bd-trait.lit .cnt i.on { background: var(--c, var(--accent)); color: #16121c; }

.bd-bar { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; }
.bd-bar .btn { align-self: center; }
.bd-level { font-size: 20px; font-weight: 800; }
.bd-count { color: var(--muted); font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }
.bd-main .form-msg { margin: 8px 0 0; }
#bd-hint { margin-top: 8px; min-height: 24px; }
.bd-field { display: grid; grid-template-columns: repeat(10, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.bd-unit { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; box-shadow: 0 0 0 1px var(--line-2); }
.bd-unit .body { display: block; width: 100%; height: 100%; padding: 0; border: 0; background: none; cursor: pointer; }
.bd-unit img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 18%; }
.bd-unit.empty { box-shadow: inset 0 0 0 1px var(--line); }
.bd-unit:not(.empty):hover { box-shadow: 0 0 0 2px var(--text); }
.bd-unit.takes { box-shadow: 0 0 0 2px var(--accent); }
.bd-unit .name { position: absolute; left: 0; right: 0; bottom: 0; padding: 20px 4px 8px; background: linear-gradient(transparent, rgba(8, 7, 11, 0.94) 60%); font-size: 15px; font-weight: 700; line-height: 1.2; text-align: center; pointer-events: none; }
.bd-unit .its { position: absolute; left: 4px; right: 4px; top: 4px; display: flex; justify-content: center; gap: 4px; }
/* the lit traits under the field: only where the trait box is not beside it; it stays in sight as the list scrolls */
.bd-sum { display: none; }
.bd-pool { margin-top: 48px; }
.bd-pool .tabs { margin: 0 0 24px; }
.bd-narrow { margin: 0 0 16px; padding-left: var(--col); color: var(--soft); font-size: 15px; }
.bd-list.heroes { display: grid; gap: 24px; }
/* the list's own cost and trait chips only where the trait box is not beside it (a narrow window) */
.bd-filters { display: none; gap: 12px; margin-bottom: 24px; }
.bd-frow { display: grid; grid-template-columns: var(--col, 48px) minmax(0, 1fr); align-items: center; }
.bd-frow .lb { color: var(--muted); font-size: 13px; font-weight: 700; }
.bd-list.items { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 48px; }
.bd-item { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 16px; align-items: start; }
.bd-item.held .gitem { box-shadow: 0 0 0 2px var(--accent); }
.bd-item.held b { color: var(--accent); }
.bd-item b { font-size: 17px; font-weight: 800; }
.bd-item p { margin: 4px 0 0; color: var(--soft); font-size: 15px; line-height: 1.6; }

/* 추천 조합: rows parted by a hairline */
.bd-meta { display: grid; padding-bottom: 96px; }
.bd-sample { margin: 0 0 8px; color: var(--muted); font-size: 15px; }
.bd-comp { display: grid; grid-template-columns: 32px minmax(0, 1fr) auto auto; gap: 32px; align-items: center; padding: 24px 0; border-top: 1px solid var(--line); }
.bd-comp .rank { color: var(--muted); font-size: 20px; font-weight: 800; }
.bd-comp h3 { margin: 0 0 8px; font-size: 20px; font-weight: 800; }
.bd-comp .lit { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-bottom: 16px; }
.bd-comp .faces { display: flex; flex-wrap: wrap; gap: 8px; }
.bd-comp .nums { display: grid; grid-template-columns: repeat(4, 64px); gap: 16px; margin: 0; }
.bd-comp .nums dt { color: var(--muted); font-size: 13px; font-weight: 700; }
.bd-comp .nums dd { margin: 4px 0 0; font-size: 20px; font-weight: 700; font-variant-numeric: tabular-nums; }

/* ---- a build in a post (the board, the write page): set apart from the text as one quiet block ---------------- */
.gbuild { display: grid; gap: 16px; margin: 16px 0; padding: 24px; border-radius: 12px; background: var(--surface-2); white-space: normal; }
.gbuild .top { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; font-size: 17px; }
.gbuild .lit { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.gbuild .units { display: flex; flex-wrap: wrap; gap: 12px 8px; }
.gbuild .unit { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 72px; }
.gbuild .unit .its { display: flex; gap: 4px; }
.post-body .text, .clist .body .text { white-space: pre-wrap; }
#w-build .label { display: flex; align-items: center; gap: 12px; }

/* ---- narrower windows -------------------------------------------------------------------------------------- */
@media (max-width: 1340px) {
  .gtiles { grid-template-columns: repeat(8, minmax(0, 1fr)); }   /* nine squares would squeeze the labels */
}
@media (max-width: 1000px) {
  .db-table .row { grid-template-columns: minmax(150px, 1.4fr) 1fr 1fr minmax(100px, 1fr); }
  .db-table .row > :nth-child(4), .db-table .row > :nth-child(5), .db-table .row > :nth-child(6) { display: none; }
  .db-hero { grid-template-columns: 1fr; gap: 32px; }
  .db-hero-card { max-width: 320px; }
  .db-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .db-traits { gap: 0 32px; }
  .bd { grid-template-columns: 1fr; gap: 32px; }
  .bd-traits { position: static; order: 2; max-height: none; }   /* the field first, what it lights after it */
  .bd-sum { display: flex; flex-wrap: wrap; gap: 4px 16px; position: sticky; top: 72px; z-index: 2; margin: 16px -16px 0; padding: 12px 16px; background: var(--bg); min-height: 48px; }
  .db-two { grid-template-columns: 1fr; gap: 32px; }
  .bd-filters { display: grid; }
  .gtiles { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .bd-comp { grid-template-columns: 32px minmax(0, 1fr); gap: 16px; }
  .bd-comp .nums, .bd-comp .btn { grid-column: 2; justify-self: start; }
}
@media (max-width: 640px) {
  .tool { --col: 100%; }
  .bd-traits { display: none; }   /* a phone: the lit traits are said under the field, the chips narrow the list */
  .gcost, .db-frow, .bd-frow { grid-template-columns: 1fr; gap: 8px; }
  .db-frow > :last-child { justify-self: start; }
  .db-search { width: 100%; }
  .db-empty, .bd-narrow { padding-left: 0; }
  .gtiles, .db-grid .gtiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px 8px; }
  .db-table .row { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); }
  .db-table .row > :nth-child(3), .db-table .row > :nth-child(7) { display: none; }
  .db-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .db-traits, .db-cards, .bd-list.items { grid-template-columns: 1fr; }
  .db-matrix .mrow { grid-template-columns: repeat(7, 40px); gap: 4px; }
  .db-matrix .mcell { width: 40px; height: 40px; }
  .db-matrix .gitem.small { width: 32px; height: 32px; }
  .bd-field { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
  .bd-unit .name { font-size: 13px; padding: 16px 2px 4px; }
  .bd-comp .nums { grid-template-columns: repeat(4, auto); }
}
