/* ==========================================================================
   2KHUB shared styles: clean dark UI with pixel-art accents.
   - Rubik for text, Pixelify Sans for headings
   - flat panels, 2px borders, hard offset shadows
   - portraits, logos and tiles are pixel art (images/px/*)
   ========================================================================== */
:root {
  --bg: #0e0e16;
  --surface: #161622;
  --surface-2: #1d1d2c;
  --surface-3: #292940;
  --border: #33334b;
  --border-2: #54546f;
  --text: #f3f3f8;
  --text-2: #bdbdcf;
  --muted: #84849c;
  --red: #dd2230;
  --red-dark: #7a1019;
  --red-hover: #f03a48;
  --yellow: #ffd400;
  --accent: #ff6a74;
  --blue: #3f6fff;
  --green: #4cd964;
  --font: 'Rubik', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-d: 'Jersey 15', 'Rubik', sans-serif;
  --shadow: 4px 4px 0 #000;
}

*, *::before, *::after { box-sizing: border-box; }
html { background: var(--bg); }
body.hc { margin: 0; min-height: 100vh; background: var(--bg); color: var(--text); font: 400 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
img { max-width: 100%; }
img[src*="/px/"] { image-rendering: pixelated; }
button { font-family: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
::selection { background: var(--yellow); color: #000; }

/* ---------- header ---------- */
.hc-header { position: relative; z-index: 50; height: 60px; display: flex; align-items: center; gap: 24px; padding: 0 24px; background: #0a0a11; border-bottom: 2px solid var(--red); }
.hc-logo { display: flex; align-items: center; height: 100%; flex: 0 0 auto; }
.hc-logo img { height: 36px; width: auto; }
.hc-nav { display: flex; gap: 2px; margin-right: auto; }
.hc-nav a { font: 500 14px var(--font); color: var(--text-2); text-decoration: none; padding: 8px 12px; white-space: nowrap; }
.hc-nav a:hover { color: #fff; background: var(--surface-2); }
.hc-nav a.on { color: #fff; background: var(--surface-3); box-shadow: inset 0 -2px 0 var(--red); }
.hc-header .page-title { font: 400 25px var(--font-d); margin: 0; }
.hc-header-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }

/* ---------- headings ---------- */
.page-h1 { font: 400 clamp(35px, 4.5vw, 50px)/1.15 var(--font-d); margin: 0; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 14px/1 var(--font); padding: 11px 18px; color: #fff; text-decoration: none; white-space: nowrap; cursor: pointer;
  background: var(--surface-3); border: 2px solid var(--border-2); box-shadow: 3px 3px 0 #000;
  transition: transform .08s, box-shadow .08s, background .12s;
}
.btn:hover { background: #34344f; border-color: #8a8aa8; transform: translate(-1px, -1px); box-shadow: 4px 4px 0 #000; }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 #000; }
.btn:focus-visible { outline: 2px solid var(--yellow); outline-offset: 2px; }
.btn[disabled], .btn.disabled { opacity: .4; cursor: not-allowed; transform: none; box-shadow: 3px 3px 0 #000; }
.btn[disabled]:hover { background: var(--surface-3); border-color: var(--border-2); }
.btn-primary { background: var(--red); border-color: #ff6a74; }
.btn-primary:hover { background: var(--red-hover); border-color: #ff9aa2; }
.btn-primary[disabled]:hover { background: var(--red); border-color: #ff6a74; }
.btn-danger { background: transparent; border-color: #8a3a42; color: #ff9aa2; }
.btn-danger:hover { background: var(--red); border-color: var(--red); color: #fff; }
.btn-lg { font-size: 16px; padding: 14px 26px; }
.btn-sm { font-size: 13px; padding: 8px 13px; box-shadow: 2px 2px 0 #000; }
.btn-support { background: var(--yellow); border-color: #fff1a0; color: #1a1400; }
.btn-support:hover { background: #ffe14d; border-color: #fff; }

/* ---------- panels ---------- */
.panel { position: relative; min-height: 0; background: var(--surface); border: 2px solid var(--border); box-shadow: var(--shadow); }
.ph { display: flex; align-items: center; gap: 10px; flex: 0 0 auto; min-height: 44px; padding: 0 14px; background: var(--surface-2); border-bottom: 2px solid var(--border); font: 400 24px var(--font-d); }
.ph .grow { flex: 1; }
.ph .count { font: 600 13px var(--font); color: var(--text-2); }

/* ---------- form controls ---------- */
.field, .hc-select, .hc-input { width: 100%; background: var(--bg); color: #fff; border: 2px solid var(--border); padding: 8px 12px; font: 400 14px var(--font); outline: none; }
.field:focus, .hc-select:focus, .hc-input:focus { border-color: #fff; }
.hc-select { appearance: none; cursor: pointer; padding-right: 34px;
  background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' shape-rendering='crispEdges'%3E%3Cpath fill='%23fff' d='M0 0h10v2H0zM2 2h6v2H2zM4 4h2v2H4z'/%3E%3C/svg%3E") no-repeat right 12px center; background-size: 10px 6px; }
.hc-select option, .hc-select optgroup { background: #161622; color: #fff; }
.field::placeholder { color: #6c6c88; }
label.lbl { display: block; font: 500 13px var(--font); color: var(--text-2); margin-bottom: 6px; }

.seg { display: inline-flex; border: 2px solid var(--border); }
.seg button { font: 500 13px var(--font); color: var(--text-2); background: transparent; border: 0; border-right: 2px solid var(--border); padding: 8px 14px; cursor: pointer; }
.seg button:last-child { border-right: 0; }
.seg button:hover { background: var(--surface-3); color: #fff; }
.seg button.on { background: var(--red); color: #fff; }

.tag { display: inline-block; font: 600 11px/1 var(--font); padding: 4px 6px; background: var(--surface-3); color: var(--text-2); }
.tag.t-high { background: var(--red); color: #fff; }
.tag.t-mid { background: #4a4a68; color: #fff; }
.tag.t-low { background: transparent; box-shadow: inset 0 0 0 2px var(--border); color: var(--muted); }

.link-btn { background: none; border: 0; padding: 0; color: var(--text-2); font: 500 13px var(--font); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover { color: #fff; }

/* ---------- bottom action bar ---------- */
.prompts { flex: 0 0 auto; display: flex; align-items: center; gap: 8px 10px; flex-wrap: wrap; padding: 10px 24px; background: #0a0a11; border-top: 2px solid var(--border); }
.prompts .gap { flex: 1; }
.prompts .stat { font: 500 14px var(--font); color: var(--text-2); }
.prompts .stat b { color: #fff; font-weight: 700; }

/* ---------- modal ---------- */
.hc-modal { position: fixed; inset: 0; z-index: 9000; display: flex; align-items: center; justify-content: center; padding: 18px; }
.hc-modal-back { position: absolute; inset: 0; background: rgba(5, 5, 10, .8); }
.hc-modal-box { position: relative; width: min(100%, 560px); max-height: calc(100vh - 36px); display: flex; flex-direction: column; background: var(--surface); border: 2px solid var(--border-2); box-shadow: 6px 6px 0 #000; }
.hc-modal-box.wide { width: min(100%, 940px); }
.hc-modal-head { display: flex; align-items: center; gap: 12px; padding: 12px 18px; flex: 0 0 auto; border-bottom: 2px solid var(--border); background: var(--surface-2); }
.hc-modal-head h3 { margin: 0; font: 400 25px var(--font-d); }
.hc-modal-head .x { margin-left: auto; background: none; border: 0; color: var(--text-2); font-size: 26px; line-height: 1; cursor: pointer; padding: 0 4px; }
.hc-modal-head .x:hover { color: #fff; }
.hc-modal-body { padding: 16px 18px; overflow: auto; flex: 1 1 auto; }
.hc-modal-body p { margin: 0 0 11px; color: var(--text-2); }
.hc-modal-body p b { color: #fff; font-weight: 600; }
.hc-modal-foot { display: flex; gap: 10px; justify-content: flex-end; padding: 12px 18px 16px; border-top: 2px solid var(--border); }
.form-grid { display: grid; gap: 14px; }
.form-grid.two { grid-template-columns: 1fr 1fr; }

/* ---------- toasts ---------- */
#hc-toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: 76px; z-index: 9500; display: flex; flex-direction: column; gap: 8px; pointer-events: none; width: min(92vw, 380px); }
.hc-toast { background: #000; border: 2px solid var(--border-2); border-left: 6px solid var(--red); padding: 10px 14px; font: 500 14px var(--font); box-shadow: 3px 3px 0 rgba(0,0,0,.6); }
.hc-toast.success { border-left-color: var(--green); }
.hc-toast.warning { border-left-color: var(--yellow); }

/* ---------- tag team builder + team rows (shared) ---------- */
.tt-name-row { margin-bottom: 14px; }
.tt-members { display: flex; flex-wrap: wrap; gap: 8px; align-items: stretch; margin-bottom: 6px; min-height: 120px; padding: 10px; background: var(--bg); border: 2px dashed var(--border-2); }
.tt-members.ready { border-style: solid; }
.tt-empty-hint { margin: auto; color: var(--muted); font-size: 14px; text-align: center; }
.tt-member { position: relative; width: 100px; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 8px 4px 6px; background: var(--surface-2); border: 2px solid var(--border-2); cursor: pointer; }
.tt-member:hover { border-color: var(--red-hover); }
.tt-member img { width: 48px; height: 48px; background: #181828; }
.tt-member .nm { font: 500 12px/1.15 var(--font); text-align: center; }
.tt-member .x { position: absolute; top: 0; right: 5px; color: var(--muted); font-size: 16px; line-height: 1.2; }
.tt-count { margin-bottom: 12px; font: 400 13px var(--font); color: var(--text-2); }
.tt-count b { color: #fff; }
.tt-tools { display: flex; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.tt-tools .field { flex: 1 1 180px; width: auto; }
.tt-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; max-height: 250px; overflow: auto; padding-right: 4px; }
.tt-card { display: flex; align-items: center; gap: 8px; padding: 3px 8px 3px 3px; cursor: pointer; min-width: 0; text-align: left; color: #fff; background: var(--surface-2); border: 2px solid var(--border); font: 500 13px var(--font); }
.tt-card:hover { border-color: var(--border-2); background: var(--surface-3); }
.tt-card.picked { background: var(--red); border-color: #ff6a74; }
.tt-card img { width: 36px; height: 36px; background: #181828; flex: 0 0 auto; }
.tt-card span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tt-none { color: var(--muted); padding: 14px; text-align: center; grid-column: 1 / -1; }

.team-row { display: flex; align-items: center; gap: 10px; padding: 6px 10px; cursor: pointer; background: var(--surface-2); border: 2px solid var(--border); margin: 0 0 6px; }
.team-row:hover { border-color: var(--border-2); }
.team-row.sel { background: var(--surface-3); border-color: #fff; }
.team-row.broken { opacity: .45; }
.team-faces { display: flex; flex: 0 0 auto; }
.team-faces img { width: 44px; height: 44px; background: #181828; margin-left: -8px; position: relative; box-shadow: 0 0 0 2px var(--surface-2); }
.team-faces img:first-child { margin-left: 0; }
.team-info { flex: 1; min-width: 0; }
.team-name { font: 700 14px/1.2 var(--font); }
.team-members { font-size: 13px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { background: var(--surface-3); border: 2px solid var(--border); color: var(--text-2); width: 28px; height: 28px; cursor: pointer; font-size: 15px; line-height: 1; flex: 0 0 auto; padding: 0; }
.icon-btn:hover { background: var(--red); border-color: var(--red); color: #fff; }

/* ---------- site footer ---------- */
.hc-footer { background: #0a0a11; border-top: 2px solid var(--border); padding: 40px 24px 22px; margin-top: 56px; }
.hc-footer-in { max-width: 1100px; margin: 0 auto; }
.hc-footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 32px; margin-bottom: 28px; }
.hc-footer img.fl { height: 36px; margin-bottom: 10px; }
.hc-footer h4 { font: 700 15px var(--font); margin: 0 0 12px; color: #fff; }
.hc-footer ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.hc-footer a.fk { color: var(--text-2); text-decoration: none; font-size: 14px; }
.hc-footer a.fk:hover { color: #fff; text-decoration: underline; }
.hc-footer-bottom { border-top: 2px solid var(--border); padding-top: 18px; text-align: center; color: var(--muted); font-size: 12px; }
.hc-footer-bottom p { margin: 0 0 6px; }

/* ---------- misc ---------- */
body.hc.enter { animation: pageIn .2s ease-out both; }
@keyframes pageIn { from { opacity: 0; } to { opacity: 1; } }
body.page-exit { opacity: 0; transition: opacity .15s ease-in; pointer-events: none; }

* { scrollbar-width: thin; scrollbar-color: var(--border-2) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-2); }
::-webkit-scrollbar-thumb:hover { background: #7a7a98; }

@media (max-width: 900px) { #hc-toasts { bottom: 104px; } }
@media (max-width: 760px) {
  .hc-header { padding: 0 12px; gap: 8px; height: 54px; }
  .hc-logo img { height: 30px; }
  .hc-footer-grid { grid-template-columns: 1fr 1fr; gap: 24px; }
  .form-grid.two { grid-template-columns: 1fr; }
  .prompts { padding: 8px 12px; }
}
@media (max-width: 640px) { .hc-nav { display: none; } }
@media (max-width: 460px) { .hc-footer-grid { grid-template-columns: 1fr; } }
@media (prefers-reduced-motion: reduce) { * { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
