/* Dwarf Builds website. The look follows the game's menus and the mod's window:
   translucent black panels with an orange rule on top, orange accents, white-on-dark text,
   buttons with side bars like the game's CLOSE button. Colours of game items come from
   game.json (set as variables on :root by js/game.js). */

:root {
  --orange: #FF9C00;
  --orange-l: #FFD200;
  --orange-press: #E78200;
  --brown: #5B412D;
  --brown-hover: #6F4F39;
  --brown-vd: #31261F;
  --bar-dim: #7C5D42;
  --ink: #17140D;
  --dim: #A3977A;
  --light: #F4EBD0;
  --light-text: #EDE2C3;
  --panel: rgba(0, 0, 0, 0.42);
  --panel-solid: #15110d;
  --sel: rgba(89, 63, 44, 0.8);
  --good: #54E200;
  --bad: #EC0000;
  --clean: #379C5D;
  --balanced: #E9CA37;
  --unstable: #D33600;
  --passive: #B92E4E;
  --active: #4BBFA5;
  --prof: #FF9C00;
  --text-h: #FFF390;
  --c-driller: #FFDA00;
  --c-engineer: #FF2A1A;
  --c-gunner: #55AB00;
  --c-scout: #0077FF;

  --cw: 44px;  /* upgrade hexagon cell */
  --ch: 29px;
  --cgx: 5px;
  --cgy: 4px;

  --f-title: "Saira Condensed", "Arial Narrow", Arial, sans-serif;
  --f-body: "Archivo Narrow", "Arial Narrow", Arial, sans-serif;
  --f-num: "Chakra Petch", "Consolas", monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  color: var(--light);
  font-family: var(--f-body);
  font-size: 16px;
  line-height: 1.35;
  background-color: #17120e;
  background-image:
    radial-gradient(ellipse at 50% -10%, rgba(120, 72, 28, 0.35), rgba(0, 0, 0, 0) 60%),
    repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.012) 0 2px, rgba(0, 0, 0, 0) 2px 9px),
    linear-gradient(180deg, #241b14 0%, #16120e 45%, #0f0c0a 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}
a { color: var(--orange); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
::selection { background: var(--orange); color: var(--ink); }

/* ---------------------------------------------------------------- top bar */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(10, 8, 6, 0.92);
  border-bottom: 3px solid var(--orange);
}
.topbar-in {
  max-width: 1240px; margin: 0 auto; padding: 0 20px;
  height: 56px; display: flex; align-items: center; gap: 24px;
}
.logo { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none !important; flex: none; }
.logo-hex {
  width: 30px; height: 30px; background: var(--orange);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  position: relative;
}
.logo-hex::after {
  content: ""; position: absolute; inset: 7px; background: var(--ink);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}
.logo-text { font-family: var(--f-title); font-weight: 700; font-size: 25px; letter-spacing: 0.02em; line-height: 1; }
.logo-text b { color: var(--orange); font-weight: 700; margin-left: 4px; }
.nav { display: flex; gap: 4px; flex: 1; min-width: 0; }
.nav-link {
  font-family: var(--f-title); font-weight: 600; font-size: 19px; letter-spacing: 0.03em;
  color: var(--light-text); padding: 6px 12px; text-decoration: none !important; white-space: nowrap;
  border-bottom: 3px solid transparent;
}
.nav-link:hover { color: #fff; }
.nav-link.on { color: var(--orange); border-bottom-color: var(--orange); }
.account { flex: none; display: flex; align-items: center; position: relative; }

.user-btn {
  display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 4px 6px; cursor: pointer;
  color: #fff; max-width: 240px;
}
.user-btn:hover .user-name { color: var(--orange); }
.user-name { font-family: var(--f-title); font-weight: 600; font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar {
  width: 32px; height: 32px; flex: none; background: var(--brown); object-fit: cover;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--f-title); font-weight: 700; color: var(--light-text); font-size: 16px;
}
.avatar.big { width: 72px; height: 72px; font-size: 32px; }
.caret { width: 10px; height: 6px; background: var(--dim); clip-path: polygon(0 0, 100% 0, 50% 100%); flex: none; }
.menu {
  position: absolute; right: 0; top: calc(100% + 10px); min-width: 200px; z-index: 40;
  background: rgba(8, 6, 5, 0.97); border-top: 3px solid var(--orange); padding: 6px 0;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}
.menu a, .menu button {
  display: block; width: 100%; text-align: left; padding: 9px 16px; background: none; border: 0; cursor: pointer;
  font-family: var(--f-title); font-weight: 600; font-size: 18px; color: var(--light-text); text-decoration: none;
}
.menu a:hover, .menu button:hover { background: var(--sel); color: var(--orange); text-decoration: none; }

.notice-bar {
  position: fixed; z-index: 80; left: 50%; bottom: 16px; transform: translateX(-50%);
  max-width: 640px; padding: 12px 16px; width: calc(100% - 24px); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
  background: rgba(8, 6, 5, 0.97); border-left: 4px solid var(--bad); color: #fff;
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
}
.notice-bar.ok { border-left-color: var(--good); }

/* ---------------------------------------------------------------- page */
.app { flex: 1; width: 100%; max-width: 1240px; margin: 0 auto; padding: 20px 20px 40px; outline: none; }
.foot { border-top: 1px solid rgba(255, 156, 0, 0.18); background: rgba(0, 0, 0, 0.35); }
.foot-in {
  max-width: 1240px; margin: 0 auto; padding: 14px 20px; display: flex; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; color: var(--dim); font-size: 13px;
}
#data-version { font-family: var(--f-num); }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.page-title {
  font-family: var(--f-title); font-weight: 700; font-size: 40px; line-height: 1; margin: 0; color: #fff;
  letter-spacing: 0.01em; text-transform: uppercase;
}
.page-sub { font-family: var(--f-num); font-size: 14px; color: var(--dim); letter-spacing: 0.06em; text-transform: uppercase; margin-top: 6px; }

.panel { background: var(--panel); border-top: 3px solid var(--orange); padding: 14px 16px; }
.panel + .panel { margin-top: 12px; }
.panel-title {
  font-family: var(--f-title); font-weight: 700; font-size: 22px; color: #fff; margin: 0 0 10px;
  text-transform: uppercase; letter-spacing: 0.02em; line-height: 1.1;
}
.label {
  font-family: var(--f-num); font-weight: 600; font-size: 12px; letter-spacing: 0.08em; color: var(--dim);
  text-transform: uppercase;
}

/* ---------------------------------------------------------------- buttons (the game's CLOSE button) */
.btn {
  --bar: var(--orange); --fill: var(--orange); --hover: var(--orange-l); --press: var(--orange-press); --ink: #050403;
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  height: 44px; padding: 0 8px; border: 0; cursor: pointer; user-select: none; -webkit-user-select: none;
  font-family: var(--f-title); font-weight: 700; font-size: 22px; letter-spacing: 0.02em; line-height: 1;
  color: var(--ink); background: none; text-transform: uppercase; white-space: nowrap;
  text-decoration: none !important;
}
.btn > span {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 100%;
  padding: 2px 18px 0; background: var(--fill);
}
.btn::before, .btn::after {
  content: ""; position: absolute; top: 0; bottom: 0; width: 4px; background: var(--bar);
}
.btn::before { left: 0; }
.btn::after { right: 0; }
.btn:hover > span { background: var(--hover); }
.btn:active > span { background: var(--press); }
.btn.sec { --bar: var(--bar-dim); --fill: var(--brown); --hover: var(--brown-hover); --press: var(--orange); --ink: var(--light-text); }
.btn.sec:active { --bar: var(--orange); --ink: #050403; }
.btn.sec.on { --bar: var(--orange); --fill: var(--orange); --hover: var(--orange-l); --ink: #050403; }
.btn.danger { --bar: #7a1d10; --fill: #4a1a12; --hover: #64231a; --press: var(--bad); --ink: #ffd9d0; }
.btn.small { height: 34px; font-size: 18px; }
.btn.small > span { padding: 1px 12px 0; }
.btn.big { height: 60px; font-size: 32px; }
.btn.block { display: flex; width: 100%; }
.btn[disabled], .btn.disabled { opacity: 0.45; cursor: default; pointer-events: none; }
.btn.copied { --bar: var(--good); --fill: var(--good); --hover: var(--good); }
.btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.link-btn {
  background: none; border: 0; padding: 0; cursor: pointer; color: var(--orange);
  font-family: var(--f-num); font-weight: 600; font-size: 13px; letter-spacing: 0.06em; text-transform: uppercase;
}
.link-btn:hover { text-decoration: underline; }
.link-btn.dim { color: var(--dim); }

/* tabs (class tabs) */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab {
  display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 16px; cursor: pointer;
  background: rgba(0, 0, 0, 0.45); border: 0; border-bottom: 3px solid var(--brown);
  font-family: var(--f-title); font-weight: 700; font-size: 20px; letter-spacing: 0.03em; color: var(--light-text);
  text-decoration: none !important; white-space: nowrap;
}
.tab:hover { background: var(--sel); color: #fff; }
.tab.on { background: var(--orange); color: #050403; border-bottom-color: var(--orange-l); }
.tab.on .cls-icon { background: #050403 !important; }

/* inputs */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.count { font-family: var(--f-num); font-size: 12px; color: var(--dim); }
.count.over { color: var(--bad); }
.input, .select, .textarea {
  width: 100%; background: rgba(0, 0, 0, 0.55); border: 1px solid var(--brown); border-bottom: 2px solid var(--bar-dim);
  color: #fff; padding: 9px 12px; font-size: 17px; border-radius: 0; outline: none;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--orange); }
.textarea { min-height: 150px; resize: vertical; line-height: 1.4; }
.select {
  -webkit-appearance: none; appearance: none; padding-right: 34px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--orange) 50%), linear-gradient(135deg, var(--orange) 50%, transparent 50%);
  background-position: calc(100% - 18px) 55%, calc(100% - 12px) 55%;
  background-size: 6px 6px, 6px 6px; background-repeat: no-repeat;
}
.select option, .select optgroup { background: #1b1510; color: #fff; }
.code-input { font-family: var(--f-num); text-transform: uppercase; letter-spacing: 0.03em; }

/* ---------------------------------------------------------------- states */
.state {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; text-align: center;
  padding: 60px 20px; color: var(--dim); font-family: var(--f-title); font-size: 22px; font-weight: 600; letter-spacing: 0.04em;
}
.state-loading { flex-direction: row; }
.state h2 { margin: 0; font-family: var(--f-title); font-size: 34px; color: #fff; font-weight: 700; text-transform: uppercase; }
.state p { margin: 0; font-family: var(--f-body); font-size: 17px; font-weight: 400; letter-spacing: 0; color: var(--light); max-width: 520px; }
.state .big-code { font-family: var(--f-num); font-size: 80px; line-height: 1; color: var(--orange); font-weight: 700; }
.spinner {
  width: 26px; height: 26px; background: var(--orange); flex: none;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  animation: spin 1.1s linear infinite;
}
@keyframes spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }
.msg { padding: 10px 14px; background: rgba(0, 0, 0, 0.5); border-left: 4px solid var(--orange); color: var(--light); font-size: 15px; }
.msg.err { border-left-color: var(--bad); }
.msg.ok { border-left-color: var(--good); }
.msg ul { margin: 6px 0 0; padding-left: 18px; }

/* ---------------------------------------------------------------- icons (white PNGs tinted with a mask) */
.mask {
  display: block; background-color: var(--c, #fff);
  -webkit-mask-image: var(--m); mask-image: var(--m);
  -webkit-mask-size: contain; mask-size: contain;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-position: center; mask-position: center;
}
.cls-icon { width: 24px; height: 24px; flex: none; }
.cls-icon.lg { width: 40px; height: 40px; }
.sil { width: 100%; height: 100%; }

/* upgrade hexagon: background + outline + glyph */
.hex { position: relative; width: var(--cw); height: var(--ch); flex: none; }
.hex > .bg, .hex > .ol, .hex > .gl { position: absolute; }
.hex > .bg { inset: 0; --m: var(--f-upg-bg); --c: rgba(0, 0, 0, 0.72); }
.hex > .ol { inset: 0; --m: var(--f-upg-ol); --c: var(--brown); }
.hex > .gl { top: 15%; bottom: 15%; left: 0; right: 0; --c: #8f8166; }
.hex.on > .bg { --c: var(--orange); }
.hex.on > .ol { --c: var(--orange-l); }
.hex.on > .gl { --c: #050403; }
.hex.void > .bg { --c: rgba(0, 0, 0, 0.35); }
.hex.void > .ol { --c: rgba(91, 65, 45, 0.45); }

/* tier grid: rows of up to 3 hexagons joined by a thin line */
.grid { display: flex; flex-direction: column; gap: var(--cgy); flex: none; }
.grid-row { position: relative; display: flex; gap: var(--cgx); }
.grid-row::before {
  content: ""; position: absolute; left: 8px; right: 8px; top: 50%; height: 3px; margin-top: -1.5px; background: var(--brown-vd);
}
.grid-row.n2::before { right: calc(var(--cw) + var(--cgx) + 8px); }
.grid-row.n1::before, .grid-row.n0::before { display: none; }
.grid-row > .hex { z-index: 1; }
.grid-row > .hex.pad { visibility: hidden; }

/* overclock icon: dark fill, frame in the type colour, white glyph */
.oc { position: relative; width: 44px; height: 44px; flex: none; }
.oc > .bg, .oc > .ol { position: absolute; inset: 0; }
.oc > .bg { --c: rgba(0, 0, 0, 0.85); }
.oc > .gl { position: absolute; inset: 27%; --c: #fff; }
.oc.none > .bg { --c: rgba(91, 65, 45, 0.45); -webkit-mask-image: none; mask-image: none; }
.oc.none { width: 44px; height: 44px; }
.oc.sm { width: 30px; height: 30px; }
.oc.lg { width: 60px; height: 60px; }

/* perk tiles: passive square, active cut corners, proficiency frame */
.perk { position: relative; width: 40px; height: 40px; flex: none; }
.perk > .bg { position: absolute; inset: 0; }
.perk > .gl { position: absolute; inset: 15%; --c: #050403; }
.perk.passive > .bg { --c: var(--passive); -webkit-mask-image: none; mask-image: none; }
.perk.active > .bg { --c: var(--active); --m: var(--f-perk-active); }
.perk.proficiency > .bg { --c: var(--prof); --m: var(--f-prof); }
.perk.proficiency > .gl { inset: 20%; }
.perk.empty > .bg { background: rgba(0, 0, 0, 0.7); box-shadow: inset 0 0 0 1px var(--brown); -webkit-mask-image: none; mask-image: none; }
.perk.lg { width: 56px; height: 56px; }

/* ---------------------------------------------------------------- tooltip (the game's DB_Tip) */
.tip {
  position: fixed; z-index: 100; left: 0; top: 0; width: 440px; max-width: calc(100vw - 16px);
  background: rgba(0, 0, 0, 0.92); border-top: 3px solid var(--orange); border-bottom: 3px solid var(--orange);
  padding: 12px 16px 14px; pointer-events: none; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
}
.tip.sheet { left: 8px !important; right: 8px; top: auto !important; bottom: 8px; width: auto; pointer-events: auto; }
.tip-head { display: flex; gap: 14px; align-items: center; }
.tip-tile { width: 64px; height: 64px; flex: none; background: var(--orange); display: flex; align-items: center; justify-content: center; }
.tip-tile.plain { background: none; }
.tip-tile > .mask { width: 44px; height: 44px; --c: var(--ink); }
.tip-tile > .item-pic { width: 64px; height: 32px; --c: var(--ink); }
.tip-tile > .oc { width: 64px; height: 64px; }
.tip-tile > .perk { width: 56px; height: 56px; }
.tip-title { font-family: var(--f-title); font-weight: 700; font-size: 26px; line-height: 1.05; color: var(--orange); }
.tip-type { font-family: var(--f-num); font-weight: 600; font-size: 13px; letter-spacing: 0.06em; color: #fff; text-transform: uppercase; margin-top: 3px; }
.tip-body { margin-top: 10px; font-size: 16px; line-height: 1.38; color: var(--light); white-space: pre-line; }
.tip-stats { margin-top: 10px; display: flex; flex-direction: column; gap: 3px; }
.stat { display: flex; align-items: center; gap: 8px; font-size: 16px; color: #fff; }
.stat .arrow { width: 14px; height: 7px; --m: var(--f-arrow); --c: var(--good); flex: none; }
.stat.bad .arrow { --c: var(--bad); transform: rotate(180deg); }
.tip-extra { margin-top: 10px; padding: 8px 10px; background: rgba(91, 65, 45, 0.5); font-family: var(--f-num); font-size: 13px; color: var(--light-text); letter-spacing: 0.03em; }

/* rich text of perk descriptions */
.rt-h { color: var(--text-h); }
.rt-hi { font-style: italic; color: #fff; }
.rt-active { color: var(--active); font-weight: 700; }
.rt-passive { color: var(--passive); font-weight: 700; }

/* ---------------------------------------------------------------- build column (like the mod's column) */
.col { width: 100%; max-width: 440px; display: flex; flex-direction: column; gap: 6px; }
.col-head { display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--panel); border-top: 3px solid var(--cls, var(--orange)); }
.col-head .cls-icon { width: 40px; height: 40px; }
.col-name { font-family: var(--f-title); font-weight: 700; font-size: 28px; color: #fff; line-height: 1; text-transform: uppercase; }
.col-sub { font-family: var(--f-num); font-size: 13px; color: var(--dim); letter-spacing: 0.06em; margin-top: 3px; text-transform: uppercase; }

.wcard { background: var(--panel); border-top: 3px solid var(--orange); padding: 6px 12px 10px; }
.wcard-name { font-family: var(--f-title); font-weight: 700; font-size: 25px; color: #fff; line-height: 30px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wcard-main { display: flex; gap: 12px; align-items: flex-end; margin-top: 2px; }
.wcard-left { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.wcard-cat { font-family: var(--f-num); font-weight: 600; font-size: 13px; color: var(--dim); letter-spacing: 0.06em; text-transform: uppercase; line-height: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wcard-sil { height: 92px; margin: 4px 0 8px; display: flex; align-items: center; }
.wcard-sil .sil { --c: var(--light); max-width: 230px; }
.ocrow { display: flex; align-items: center; gap: 10px; min-height: 44px; min-width: 0; }
.ocrow-text { min-width: 0; }
.oc-name { font-family: var(--f-title); font-weight: 700; font-size: 19px; color: #fff; line-height: 1.05; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.oc-type { font-family: var(--f-num); font-weight: 600; font-size: 12px; letter-spacing: 0.06em; text-transform: uppercase; }
.oc-type.clean { color: var(--clean); }
.oc-type.balanced { color: var(--balanced); }
.oc-type.unstable { color: var(--unstable); }
.none-text { color: var(--dim); font-family: var(--f-num); font-size: 13px; letter-spacing: 0.06em; }
.wcard.empty .wcard-name { color: var(--dim); }

.gear { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.gcard { background: var(--panel); border-top: 3px solid var(--orange); padding: 6px 12px 12px; min-width: 0; }
.gcard-label { font-family: var(--f-num); font-weight: 600; font-size: 11px; letter-spacing: 0.08em; color: var(--dim); text-transform: uppercase; line-height: 17px; }
.gcard-name { font-family: var(--f-title); font-weight: 700; font-size: 19px; color: #fff; line-height: 24px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px; }
.gcard-pic { height: calc(4 * var(--ch) + 3 * var(--cgy)); display: flex; align-items: center; max-width: 160px; }
.gcard-pic .sil { --c: var(--light); }

.perks { background: var(--panel); border-top: 3px solid var(--orange); padding: 8px 12px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.perks .label { margin-right: 8px; }
.perks .kind-gap { width: 8px; }
.perks-none { color: var(--dim); font-size: 14px; }

/* hover targets */
[data-tip] { cursor: help; }
button[data-tip], a[data-tip] { cursor: pointer; }

/* ---------------------------------------------------------------- browse */
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin: 12px 0 16px; }
.filters .select { width: auto; min-width: 220px; max-width: 100%; }
.filters .search { flex: 1; min-width: 200px; }
.sortbox { display: flex; gap: 0; }
.sortbox .btn { padding-left: 4px; padding-right: 4px; }

.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.card {
  display: flex; flex-direction: column; background: var(--panel); border-top: 3px solid var(--cls, var(--orange));
  color: var(--light); text-decoration: none !important; min-width: 0; transition: background 0.12s;
}
.card:hover { background: var(--sel); }
.card:hover .card-title { color: var(--orange); }
.card-top { display: flex; gap: 10px; align-items: center; padding: 10px 12px 6px; min-width: 0; }
.card-top .cls-icon { width: 34px; height: 34px; }
.card-titles { min-width: 0; flex: 1; }
.card-title { font-family: var(--f-title); font-weight: 700; font-size: 22px; line-height: 1.1; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-by { font-size: 14px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-by b { color: var(--light-text); font-weight: 600; }
.card-weps { display: flex; flex-direction: column; gap: 2px; padding: 4px 12px 8px; }
.cw { display: flex; align-items: center; gap: 10px; min-width: 0; height: 52px; }
.cw-pic { width: 104px; height: 46px; flex: none; }
.cw-pic .sil { --c: var(--light); }
.cw-text { flex: 1; min-width: 0; }
.cw-name { font-family: var(--f-title); font-weight: 600; font-size: 17px; color: #fff; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cw-oc { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--dim); }
.card-foot {
  display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: auto;
  padding: 7px 12px; background: rgba(0, 0, 0, 0.35); font-family: var(--f-num); font-size: 13px; color: var(--dim); letter-spacing: 0.04em;
}
.likes { display: inline-flex; align-items: center; gap: 6px; color: var(--light-text); font-weight: 600; }
.likes .arrow { width: 14px; height: 7px; --m: var(--f-arrow); --c: var(--orange); }
.hidden-tag { color: #fff; background: var(--bad); padding: 0 6px; font-weight: 700; }

.pager { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 22px; }
.pager-num { font-family: var(--f-num); color: var(--dim); font-size: 15px; letter-spacing: 0.06em; }

/* ---------------------------------------------------------------- build page */
.bhead { display: flex; gap: 16px; align-items: center; margin-bottom: 16px; min-width: 0; }
.bhead .cls-icon { width: 54px; height: 54px; }
.bhead-text { min-width: 0; flex: 1; }
.btitle { font-family: var(--f-title); font-weight: 700; font-size: 42px; line-height: 1.02; color: #fff; margin: 0; overflow-wrap: anywhere; }
.bmeta { margin-top: 6px; font-size: 15px; color: var(--dim); display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.bmeta a { color: var(--light-text); font-weight: 600; }
.bmeta .avatar { width: 22px; height: 22px; font-size: 12px; vertical-align: middle; margin-right: 6px; }
.blayout { display: grid; grid-template-columns: 440px minmax(0, 1fr); gap: 20px; align-items: start; }
.bside { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.codebox {
  font-family: var(--f-num); font-weight: 600; font-size: 17px; color: #fff; background: rgba(0, 0, 0, 0.6);
  padding: 10px 12px; border-left: 3px solid var(--orange); word-break: break-all; letter-spacing: 0.03em; user-select: all; -webkit-user-select: all;
}
.howto ol { margin: 0; padding-left: 22px; }
.howto li { margin: 4px 0; }
.howto b { color: var(--orange); font-family: var(--f-title); font-size: 18px; letter-spacing: 0.02em; }
.kbd {
  display: inline-block; min-width: 22px; padding: 0 6px; background: #fff; color: #050403; text-align: center;
  font-family: var(--f-num); font-weight: 700; font-size: 14px; line-height: 20px;
}
.desc { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 17px; line-height: 1.45; color: var(--light); }
.desc.empty { color: var(--dim); font-style: italic; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.like-btn .arrow { width: 14px; height: 7px; --m: var(--f-arrow); --c: currentColor; }

/* ---------------------------------------------------------------- editor */
.ed-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: end; margin-bottom: 14px; }
.import { display: flex; gap: 10px; align-items: flex-end; }
.import .field { flex: 1; min-width: 0; }
.ed { display: grid; grid-template-columns: 240px minmax(0, 1fr) 330px; gap: 16px; align-items: start; }
.slots { display: flex; flex-direction: column; gap: 4px; }
.slot-btn {
  display: flex; flex-direction: column; align-items: stretch; gap: 2px; text-align: left; cursor: pointer; border: 0;
  background: var(--panel); border-left: 4px solid var(--brown); padding: 8px 10px; min-width: 0; color: var(--light);
}
.slot-btn:hover { background: var(--sel); }
.slot-btn.on { background: var(--sel); border-left-color: var(--orange); }
.slot-btn .label { font-size: 11px; }
.slot-btn.on .label { color: var(--orange); }
.slot-item { font-family: var(--f-title); font-weight: 700; font-size: 19px; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.15; }
.slot-item.none { color: var(--dim); }
.slot-meta { display: flex; align-items: center; gap: 6px; min-height: 18px; }
.slot-meta .oc.sm { width: 20px; height: 20px; }
.slot-meta .perk { width: 18px; height: 18px; }
.tiermini { font-family: var(--f-num); font-size: 13px; color: var(--dim); letter-spacing: 0.15em; }
.tiermini b { color: var(--orange); font-weight: 700; }
.ed-main { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.ed-side { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 72px; }

.classes { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.cls-card {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer; border: 0;
  padding: 0 0 12px; background: var(--panel); border-top: 3px solid var(--cls); color: #fff; overflow: hidden;
}
.cls-card:hover { background: var(--sel); }
.cls-card img { width: 100%; aspect-ratio: 1 / 1; height: auto; object-fit: cover; display: block; opacity: 0.92; }
.cls-card .cls-row { display: flex; align-items: center; gap: 8px; }
.cls-card .cls-name { font-family: var(--f-title); font-weight: 700; font-size: 26px; text-transform: uppercase; }
.cls-chooser .classes { margin-top: 6px; }

.items { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.item-btn {
  display: flex; flex-direction: column; gap: 4px; text-align: left; cursor: pointer; border: 0; padding: 8px 10px 10px;
  background: rgba(0, 0, 0, 0.45); border-bottom: 3px solid var(--brown); color: #fff; min-width: 0;
}
.item-btn:hover { background: var(--sel); }
.item-btn.on { background: var(--sel); border-bottom-color: var(--orange); }
.item-btn .item-pic { height: 54px; width: 100%; }
.item-btn .item-pic .sil { --c: var(--light); }
.item-btn.on .item-pic .sil { --c: var(--orange); }
.item-btn .nm { font-family: var(--f-title); font-weight: 700; font-size: 18px; line-height: 1.1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-btn .ct { font-family: var(--f-num); font-size: 11px; color: var(--dim); letter-spacing: 0.06em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.tiers { display: flex; flex-direction: column; gap: 8px; }
.tier { display: grid; grid-template-columns: 54px minmax(0, 1fr); gap: 8px; align-items: center; }
.tier-label { font-family: var(--f-num); font-weight: 700; font-size: 13px; color: var(--dim); letter-spacing: 0.06em; text-align: center; line-height: 1.1; }
.tier-label b { display: block; font-size: 22px; color: var(--light-text); }
.tier-opts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.opt {
  display: flex; align-items: center; gap: 10px; text-align: left; cursor: pointer; border: 0; padding: 6px 8px;
  background: rgba(0, 0, 0, 0.45); color: var(--light); min-width: 0; min-height: 52px;
}
.opt:hover { background: var(--sel); }
.opt:hover .hex > .ol { --c: var(--orange); }
.opt.on { background: var(--sel); }
.opt .hex { --cw: 48px; --ch: 32px; }
.opt-text { min-width: 0; display: block; }
.opt-text > span, .slot-btn > .label, .slot-btn > .slot-item, .item-btn > span { display: block; }
.opt-name { font-family: var(--f-title); font-weight: 600; font-size: 16px; line-height: 1.1; color: #fff; }
.opt.on .opt-name { color: var(--orange); }
.opt-cat { font-family: var(--f-num); font-size: 11px; color: var(--dim); letter-spacing: 0.05em; text-transform: uppercase; margin-top: 1px; }

.ocgroups { display: flex; flex-direction: column; gap: 10px; }
.ocgroup-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-family: var(--f-num); font-weight: 700; font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; }
.ocgroup-head::after { content: ""; flex: 1; height: 2px; background: currentColor; opacity: 0.35; }
.ocgroup-head.clean { color: var(--clean); }
.ocgroup-head.balanced { color: var(--balanced); }
.ocgroup-head.unstable { color: var(--unstable); }
.oc-opts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.oc-opt { display: flex; align-items: center; gap: 10px; text-align: left; cursor: pointer; border: 0; padding: 6px 8px; background: rgba(0, 0, 0, 0.45); color: #fff; min-width: 0; border-left: 3px solid transparent; }
.oc-opt:hover { background: var(--sel); }
.oc-opt.on { background: var(--sel); border-left-color: var(--orange); }
.oc-opt.on .opt-name { color: var(--orange); }

.perkpick { display: flex; flex-direction: column; gap: 14px; }
.perkgroup-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px; }
.perkgroup-head .t { font-family: var(--f-title); font-weight: 700; font-size: 20px; text-transform: uppercase; }
.perkgroup-head .t.passive { color: var(--passive); }
.perkgroup-head .t.active { color: var(--active); }
.perkgroup-head .t.proficiency { color: var(--prof); }
.perk-opts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.perk-opt { display: flex; align-items: center; gap: 10px; text-align: left; cursor: pointer; border: 0; padding: 6px 8px; background: rgba(0, 0, 0, 0.45); color: #fff; min-width: 0; border-left: 3px solid transparent; }
.perk-opt:hover { background: var(--sel); }
.perk-opt.on { background: var(--sel); border-left-color: var(--orange); }
.perk-opt.on .opt-name { color: var(--orange); }
.perk-opt.off { opacity: 0.4; }
.perk-opt .perk { width: 36px; height: 36px; }
.perk-opt .ord { margin-left: auto; font-family: var(--f-num); font-weight: 700; color: var(--orange); font-size: 14px; }

.sec-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.sec-head .panel-title { margin: 0; }

.code-preview { font-family: var(--f-num); font-weight: 600; font-size: 14px; color: #fff; background: rgba(0, 0, 0, 0.6); padding: 8px 10px; border-left: 3px solid var(--orange); word-break: break-all; min-height: 38px; user-select: all; -webkit-user-select: all; }
.code-preview.bad { border-left-color: var(--bad); color: var(--dim); user-select: none; -webkit-user-select: none; }

/* ---------------------------------------------------------------- user page */
.uhead { display: flex; gap: 16px; align-items: center; margin-bottom: 18px; }
.uhead .avatar.big { border-top: 3px solid var(--orange); }

/* ---------------------------------------------------------------- modal */
.modal-back { position: fixed; inset: 0; z-index: 90; background: rgba(0, 0, 0, 0.7); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { width: 100%; max-width: 480px; background: rgba(12, 9, 7, 0.98); border-top: 3px solid var(--orange); border-bottom: 3px solid var(--orange); padding: 18px 20px; }
.modal h3 { margin: 0 0 10px; font-family: var(--f-title); font-size: 28px; color: var(--orange); text-transform: uppercase; line-height: 1.1; }
.modal p { margin: 0 0 12px; }
.modal .actions { justify-content: flex-end; margin-top: 14px; }

/* ---------------------------------------------------------------- narrow screens */
@media (max-width: 1100px) {
  .ed { grid-template-columns: 220px minmax(0, 1fr); }
  .ed-side { grid-column: 1 / -1; position: static; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .blayout { grid-template-columns: minmax(0, 1fr); }
  .blayout .col { margin: 0 auto; }
  .blayout .bside { order: -1; }
  .ed { grid-template-columns: minmax(0, 1fr); }
  .slots { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 4px; }
  .slots > .panel { grid-column: 1 / -1; }
  .slot-btn { border-left: 0; border-bottom: 3px solid var(--brown); padding: 6px 8px; }
  .slot-btn.on { border-bottom-color: var(--orange); }
  .slot-item { font-size: 15px; }
  .slot-meta { display: none; }
  .ed-side { grid-template-columns: minmax(0, 1fr); }
  .items, .tier-opts, .oc-opts, .perk-opts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .classes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 700px) {
  .topbar-in { height: auto; flex-wrap: wrap; gap: 0 12px; padding: 8px 12px 0; }
  .logo { height: 40px; }
  .account { margin-left: auto; height: 40px; }
  .nav { order: 3; flex-basis: 100%; justify-content: space-between; }
  .nav-link { font-size: 17px; padding: 6px 6px 8px; }
  .user-name { display: none; }
  .wide { display: none; }
  .account .btn.small { height: 32px; font-size: 16px; }
  .app { padding: 14px 12px 30px; }
  .foot-in { padding: 12px; }
  .page-title { font-size: 32px; }
  .cards { grid-template-columns: minmax(0, 1fr); }
  .tab { padding: 0 10px; font-size: 17px; height: 38px; gap: 6px; }
  .tab .cls-icon { width: 20px; height: 20px; }
  .tabs { gap: 4px; }
  .filters .select, .filters .search { flex: 1 1 100%; min-width: 0; }
  .sortbox { flex: 1 1 100%; }
  .sortbox .btn { flex: 1; }
  .btitle { font-size: 32px; }
  .bhead .cls-icon { width: 40px; height: 40px; }
  .ed-top { grid-template-columns: minmax(0, 1fr); }
  .import { flex-wrap: wrap; }
  .tier { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .tier-label { text-align: left; }
  .tier-label b { display: inline; font-size: 13px; margin-left: 4px; }
  .tier-opts, .oc-opts, .perk-opts { grid-template-columns: minmax(0, 1fr); }
  .opt { min-height: 46px; }
  .btn.big { height: 54px; font-size: 28px; }
}
@media (max-width: 420px) {
  :root { --cw: 36px; --ch: 24px; --cgx: 4px; --cgy: 3px; }
  .wcard-main { gap: 8px; }
  .wcard-sil { height: 70px; }
  .wcard-name { font-size: 22px; }
  .gcard { padding: 6px 8px 10px; }
  .gcard-name { font-size: 17px; }
  .perk { width: 34px; height: 34px; }
  .perks { padding: 8px; gap: 3px; }
  .perks .kind-gap { width: 4px; }
  .perks .label { flex-basis: 100%; margin: 0 0 4px; }
  .oc { width: 38px; height: 38px; }
  .oc-name { font-size: 17px; }
  .col-name { font-size: 24px; }
  .slots { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .items { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .tab { padding: 0 8px; font-size: 16px; }
}
.sec-head > span { display: flex; gap: 12px; align-items: baseline; }
