/* ===================================================================
   BEYBLADE X JOURNEY — theme
   Angular cuts, lime/cyan split, speedlines, industrial display type.
   Accent colours taken from the BEYBLADE X logo streaks.
   =================================================================== */
:root {
  --bg: #06080d;
  --bg-2: #0c111b;
  --panel: #111927;
  --panel-2: #182234;
  --line: #26344a;
  --line-bright: #3a5273;

  --text: #eef2f8;
  --muted: #8a99b0;

  --accent: #bdec3f;   /* logo lime-green streak */
  --accent-2: #38c6e8; /* logo cyan streak */
  --blue: var(--accent);   /* legacy names — existing rules still resolve through these */
  --red: var(--accent-2);
  --danger: #ff3860;   /* destructive actions & alerts only, never decoration */
  --gold: #ffc42e;
  --win: #24d17a;
  --loss: #ff4d63;

  --split: linear-gradient(115deg, var(--accent) 0%, var(--accent) 44%, var(--accent-2) 56%, var(--accent-2) 100%);
  --speedlines: repeating-linear-gradient(115deg, rgba(255,255,255,.04) 0 1px, transparent 1px 7px);

  --font-display: "Chakra Petch", "Segoe UI", system-ui, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;

  --cut: 10px;
  --radius: 3px;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.5);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { overflow-x: hidden; }
img { max-width: 100%; height: auto; }
select, input, textarea { min-width: 0; }

/* angular corner notch — top-left + bottom-right, echoing the X */
.notch {
  clip-path: polygon(
    var(--cut) 0, 100% 0, 100% calc(100% - var(--cut)),
    calc(100% - var(--cut)) 100%, 0 100%, 0 var(--cut)
  );
}
/* parallelogram — angled left/right edges, text stays upright */
.shear { clip-path: polygon(9px 0, 100% 0, calc(100% - 9px) 100%, 0 100%); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  font: 15px/1.55 var(--font-body);
  background:
    var(--speedlines),
    radial-gradient(1100px 640px at 82% -12%, #16223a 0%, transparent 60%),
    radial-gradient(900px 520px at 0% 0%, rgba(189,236,63,.09) 0%, transparent 55%),
    radial-gradient(1000px 600px at 100% 10%, rgba(56,198,232,.10) 0%, transparent 55%),
    var(--bg);
  background-attachment: fixed;
}

h1, h2, h3 {
  margin: 0 0 .4em;
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}
h1 { font-size: 1.5rem; }
h2 { font-size: 1rem; letter-spacing: .08em; }
p { margin: 0 0 .6em; }
a { color: var(--blue); }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* section-title tick */
h2::before {
  content: "";
  display: inline-block;
  width: 10px; height: 10px;
  margin-right: .55em;
  background: var(--split);
  clip-path: polygon(40% 0, 100% 0, 60% 100%, 0 100%);
  transform: translateY(1px);
}

/* ---------- buttons ---------- */
.btn {
  --cut: 7px;
  display: inline-flex; align-items: center; justify-content: center; gap: .4em;
  padding: .58em 1.15em;
  border: 1px solid var(--line-bright);
  background: var(--panel-2);
  color: var(--text);
  font-family: var(--font-display); font-weight: 600; font-size: .92rem;
  letter-spacing: .06em; text-transform: uppercase;
  cursor: pointer;
  clip-path: polygon(7px 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%, 0 7px);
  transition: transform .06s ease, filter .15s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { border-color: var(--blue); filter: brightness(1.12); }
.btn:active { transform: translateY(1px); }
.btn-primary {
  border: none;
  background: var(--split);
  background-size: 160% 100%;
  background-position: 30% 0;
  color: #06080d;
  text-shadow: 0 1px 0 rgba(255,255,255,.18);
}
.btn-primary:hover { background-position: 55% 0; filter: brightness(1.06); }
.btn-danger { border: none; background: linear-gradient(115deg, var(--danger), #b0121f); color: #fff; }
.btn-ghost { background: transparent; }
.btn-sm { --cut: 5px; padding: .38em .8em; font-size: .8rem; clip-path: polygon(5px 0,100% 0,100% calc(100% - 5px),calc(100% - 5px) 100%,0 100%,0 5px); }
.btn-block { width: 100%; }
.btn.danger, .btn-ghost.danger { color: var(--loss); }
.btn.danger:hover { border-color: var(--loss); }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; }
.btn.is-loading { opacity: 1; cursor: progress; }
.btn.is-loading > span:last-child { opacity: .85; }
.btn-spinner {
  width: 14px; height: 14px; flex: none; display: inline-block;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%;
  animation: spin .6s linear infinite;
}
.btn-link {
  background: none; border: none; color: var(--blue); cursor: pointer;
  font: inherit; padding: 0; text-decoration: underline; text-underline-offset: 3px;
}
.btn-link.danger { color: var(--loss); }

/* ---------- loading ---------- */
.app-loading { position: fixed; inset: 0; display: grid; place-content: center; justify-items: center; gap: 1rem; color: var(--muted); }
.spinner {
  width: 40px; height: 40px;
  background: conic-gradient(from 0deg, var(--blue), var(--red), var(--blue));
  clip-path: polygon(50% 0,100% 0,100% 100%,0 100%,0 12%,50% 12%,50% 0);
  -webkit-mask: radial-gradient(circle 14px at 50% 50%, transparent 98%, #000);
          mask: radial-gradient(circle 14px at 50% 50%, transparent 98%, #000);
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- brand mark ---------- */
.brand { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.5rem; }
.brand h1 { font-size: 1.35rem; letter-spacing: .06em; margin: 0; }
.tagline { color: var(--muted); margin: .3rem 0 0; font-size: .88rem; text-transform: none; }
.brand-x {
  position: relative;
  display: grid; place-content: center;
  width: 58px; height: 58px; flex: none;
  font-family: var(--font-display); font-weight: 700; font-style: italic;
  font-size: 2rem; color: #06080d;
  background: var(--split);
  clip-path: polygon(18% 0, 100% 0, 82% 100%, 0 100%);
  box-shadow: 0 8px 22px rgba(189, 236, 63, .28), 0 8px 22px rgba(56, 198, 232, .22);
}
.brand-x--sm { width: 34px; height: 34px; font-size: 1.15rem; }
.brand-x--xl { width: 84px; height: 84px; font-size: 3rem; }

/* ---------- landing ---------- */
.landing {
  min-height: 100vh; position: relative; overflow: hidden;
  background: var(--speedlines), var(--bg);
}
.landing::before {
  content: "X"; position: absolute; right: -6rem; bottom: -14rem;
  font-family: var(--font-display); font-weight: 700; font-style: italic;
  font-size: 60vh; line-height: 1; color: rgba(255,255,255,.02);
  pointer-events: none; user-select: none;
}
.landing-nav {
  position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 1rem 1.3rem;
  border-bottom: 1px solid var(--line);
}
.landing-nav .topbar-brand strong { font-family: var(--font-display); font-weight: 700; letter-spacing: .1em; font-size: .95rem; }

.landing-hero {
  position: relative; z-index: 1;
  max-width: 720px; margin: 0 auto; padding: 3.5rem 1.3rem 2rem;
  text-align: center; display: grid; justify-items: center; gap: 1rem;
}
.landing-hero h1 {
  font-size: clamp(1.8rem, 6vw, 2.9rem); line-height: 1.1; margin: .3rem 0 0;
  text-transform: none; letter-spacing: -.01em;
}
.landing-sub { color: var(--muted); font-size: 1.05rem; max-width: 40rem; margin: 0; }
.landing-cta { display: flex; gap: .7rem; flex-wrap: wrap; justify-content: center; margin-top: .3rem; }
.landing-cta .btn { padding: .7em 1.4em; font-size: 1rem; }

.landing-features {
  position: relative; z-index: 1;
  max-width: 960px; margin: 0 auto; padding: 1.5rem 1.3rem;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .8rem;
}
.lf {
  display: grid; gap: .3rem; padding: 1.1rem;
  background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--blue);
  clip-path: polygon(0 0,100% 0,100% calc(100% - 10px),calc(100% - 10px) 100%,0 100%);
}
.lf-i { font-size: 1.5rem; }
.lf b { font-family: var(--font-display); letter-spacing: .02em; }
.lf span:last-child { color: var(--muted); font-size: .88rem; }

.landing-meta {
  position: relative; z-index: 1;
  max-width: 640px; margin: 1rem auto 0; padding: 0 1.3rem;
}
.landing-meta h2 { text-align: center; }
.landing-combos { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.landing-combos li {
  display: flex; align-items: center; gap: .6rem;
  padding: .7rem .9rem; background: var(--bg-2); border: 1px solid var(--line);
  clip-path: polygon(0 0,100% 0,100% calc(100% - 8px),calc(100% - 8px) 100%,0 100%);
  font-family: var(--font-display);
}
.landing-combos li > span:nth-child(2) { flex: 1; }

.landing-foot {
  position: relative; z-index: 1;
  text-align: center; padding: 2.5rem 1.3rem 3.5rem; display: grid; justify-items: center; gap: .8rem;
}
.landing-foot .btn { padding: .7em 1.4em; }
.landing-foot a { color: var(--blue); }

/* ---------- auth ---------- */
.auth-view { min-height: 100vh; display: grid; place-content: center; padding: 1.5rem; position: relative; overflow: hidden; }
.auth-view::before {
  content: "X";
  position: absolute; right: -4rem; bottom: -8rem;
  font-family: var(--font-display); font-weight: 700; font-style: italic;
  font-size: 48vh; line-height: 1; color: rgba(255,255,255,.025);
  pointer-events: none; user-select: none;
}
.auth-card {
  position: relative;
  width: min(430px, 92vw);
  background: linear-gradient(180deg, var(--panel), var(--bg-2));
  border: 1px solid var(--line);
  border-top: 3px solid transparent;
  border-image: var(--split) 1;
  padding: 2rem;
  box-shadow: var(--shadow);
  clip-path: polygon(0 0, 100% 0, 100% calc(100% - 18px), calc(100% - 18px) 100%, 0 100%);
}
.auth-card { padding-top: 2.7rem; }
#auth-back { position: absolute; top: 1rem; left: 1.3rem; }
.auth-tabs { display: flex; gap: .3rem; background: var(--bg); padding: .3rem; margin-bottom: 1.3rem; }
.auth-tab {
  flex: 1; padding: .6em; border: none; background: transparent;
  color: var(--muted); font-family: var(--font-display); font-weight: 600;
  letter-spacing: .05em; text-transform: uppercase; font-size: .82rem; cursor: pointer;
  clip-path: polygon(6px 0,100% 0,calc(100% - 6px) 100%,0 100%);
}
.auth-tab.is-active { background: var(--panel-2); color: var(--text); box-shadow: inset 0 -2px 0 var(--blue); }
.auth-form { display: grid; gap: .95rem; }
.field { display: grid; gap: .35rem; }
.field > span {
  font-family: var(--font-display); font-size: .74rem; color: var(--muted);
  font-weight: 600; letter-spacing: .09em; text-transform: uppercase;
}
input, select, textarea {
  width: 100%; padding: .62em .7em;
  border: 1px solid var(--line); background: var(--bg);
  color: var(--text); font: inherit; border-radius: var(--radius);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--blue); outline-offset: 0; border-color: transparent; }
textarea { resize: vertical; }
.form-error { color: var(--loss); font-size: .88rem; margin: 0; }
.config-warning {
  margin-top: 1.2rem; padding: .8rem; font-size: .85rem;
  background: rgba(255, 196, 46, .1); border: 1px solid rgba(255, 196, 46, .3); color: var(--gold);
}
.config-warning code { background: rgba(0,0,0,.35); padding: .1em .35em; }
#auth-reset { justify-self: start; }

/* ---------- shell / topbar ---------- */
.topbar {
  display: flex; align-items: center; gap: 1.2rem; flex-wrap: wrap;
  padding: .7rem 1.3rem;
  background: linear-gradient(180deg, rgba(17,25,39,.96), rgba(12,17,27,.92)), var(--speedlines);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 3px 0 rgba(189,236,63,.22), 0 4px 18px rgba(0,0,0,.4);
  position: sticky; top: 0; z-index: 20;
}
.topbar-brand { display: flex; align-items: center; gap: .7rem; }
.topbar-brand strong { font-family: var(--font-display); font-weight: 700; letter-spacing: .1em; font-size: .95rem; }
.brand-sub { color: var(--muted); margin-left: .45em; font-weight: 500; }

.tabs { display: flex; gap: .15rem; flex: 1; flex-wrap: wrap; }
.tab {
  position: relative;
  padding: .55em .95em; border: none; background: transparent;
  color: var(--muted); font-family: var(--font-display); font-weight: 600;
  letter-spacing: .05em; text-transform: uppercase; font-size: .82rem; cursor: pointer;
}
.tab:hover { color: var(--text); }
.tab.is-active { color: var(--text); }
.tab.is-active::after {
  content: ""; position: absolute; left: .5em; right: .5em; bottom: 0; height: 3px;
  background: var(--split);
  clip-path: polygon(4px 0, 100% 0, calc(100% - 4px) 100%, 0 100%);
}
.tab.has-badge::before {
  content: attr(data-badge);
  position: absolute; top: 2px; right: -2px;
  min-width: 15px; height: 15px; padding: 0 3px;
  display: grid; place-content: center;
  font-family: var(--font-body); font-size: 10px; font-weight: 700;
  color: #fff; background: var(--danger); border-radius: 999px;
}

/* ---------- meta / tier list ---------- */
.tier {
  display: inline-grid; place-content: center;
  width: 26px; height: 24px; flex: none;
  font-family: var(--font-display); font-weight: 800; font-size: .85rem; color: #06080d;
  clip-path: polygon(5px 0,100% 0,calc(100% - 5px) 100%,0 100%);
}
.tier--S { background: linear-gradient(135deg, #ffd24a, #ff9d2e); }
.tier--A { background: linear-gradient(135deg, #7fe08a, #35c06a); }
.tier--B { background: linear-gradient(135deg, #6fb6ff, #2b7dff); color: #fff; }
.tier--C { background: linear-gradient(135deg, #b6a2ff, #8b6dff); color: #fff; }
.tier--D { background: var(--line-bright); color: var(--text); }

.tier-vote { display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; margin-top: .6rem; }
.tier-btn {
  width: 30px; height: 28px; border: 1px solid var(--line); background: var(--bg-2);
  color: var(--muted); font-family: var(--font-display); font-weight: 700; cursor: pointer;
  clip-path: polygon(4px 0,100% 0,calc(100% - 4px) 100%,0 100%);
}
.tier-btn:hover { border-color: var(--blue); color: var(--text); }
.tier-btn.is-mine { background: var(--split); border-color: transparent; color: #06080d; }
.trend { font-size: .75rem; font-weight: 700; flex: none; }
.trend--up { color: var(--win); }
.trend--down { color: var(--loss); }
.trend--new { color: var(--gold); }

/* ---------- achievements ---------- */
.achv-row { display: flex; flex-wrap: wrap; gap: .4rem; }
.achv-chip {
  width: 34px; height: 34px; display: grid; place-content: center;
  font-size: 1.1rem; background: var(--bg-2); border: 1px solid var(--line);
  clip-path: polygon(6px 0,100% 0,100% calc(100% - 6px),calc(100% - 6px) 100%,0 100%,0 6px);
}
.achv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: .7rem; }
.achv {
  position: relative; display: flex; gap: .7rem; align-items: flex-start;
  padding: .8rem; background: var(--bg-2); border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  clip-path: polygon(0 0,100% 0,100% calc(100% - 8px),calc(100% - 8px) 100%,0 100%);
}
.achv--locked { border-left-color: var(--line-bright); opacity: .6; }
.achv--locked .achv-icon { filter: grayscale(1); opacity: .5; }
.achv-icon { font-size: 1.5rem; flex: none; line-height: 1.1; }
.achv-body { min-width: 0; flex: 1; }
.achv-name { font-family: var(--font-display); font-weight: 700; letter-spacing: .02em; }
.achv-bar { height: 6px; background: var(--bg); margin: .35rem 0 .15rem; overflow: hidden; clip-path: polygon(3px 0,100% 0,calc(100% - 3px) 100%,0 100%); }
.achv-bar > span { display: block; height: 100%; background: var(--split); }
.achv-tick { position: absolute; top: .6rem; right: .7rem; color: var(--gold); font-weight: 800; }

/* ---------- filter bar ---------- */
.filter-bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: .5rem;
  margin-bottom: .9rem;
}
.filter-bar input { flex: 1 1 200px; }
.filter-bar select { flex: 0 1 auto; width: auto; }
.filter-bar .btn-link { flex: none; }

/* ---------- onboarding ---------- */
.ob-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.ob-step { display: flex; align-items: center; gap: .6rem; }
.ob-check {
  width: 18px; height: 18px; flex: none; display: grid; place-content: center;
  border: 1px solid var(--line-bright); font-size: .7rem; color: var(--win);
  clip-path: polygon(3px 0,100% 0,calc(100% - 3px) 100%,0 100%);
}
.ob-step.is-done .ob-check { background: rgba(36,209,122,.15); border-color: var(--win); }
.ob-step.is-done .btn-link { color: var(--muted); text-decoration: line-through; }

/* ---------- profile menu ---------- */
.topbar-user { position: relative; }
.profile-btn {
  display: flex; align-items: center; gap: .55rem;
  padding: .3rem .6rem .3rem .3rem;
  background: var(--panel-2); border: 1px solid var(--line);
  color: var(--text); cursor: pointer; font: inherit;
  clip-path: polygon(6px 0,100% 0,100% calc(100% - 6px),calc(100% - 6px) 100%,0 100%,0 6px);
}
.profile-btn:hover { border-color: var(--blue); }
.profile-btn-name { font-family: var(--font-display); font-weight: 600; font-size: .85rem; letter-spacing: .03em; max-width: 16ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.caret { color: var(--muted); font-size: .7rem; }
.avatar {
  width: 30px; height: 30px; flex: none;
  display: grid; place-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: .8rem; color: #06080d;
  background: var(--split);
  clip-path: polygon(14% 0, 100% 0, 86% 100%, 0 100%);
}
.avatar--img { background-size: cover; background-position: center; background-repeat: no-repeat; color: transparent; }
.avatar--sm { width: 22px; height: 22px; font-size: .62rem; }
.avatar--lg { width: 44px; height: 44px; font-size: 1.05rem; }
.avatar--xl { width: 72px; height: 72px; min-width: 72px; font-size: 1.5rem; }

.photo-field { display: grid; gap: .4rem; }
.field-span, .photo-field .field-span {
  font-family: var(--font-display); font-size: .74rem; color: var(--muted);
  font-weight: 600; letter-spacing: .09em; text-transform: uppercase;
}
.photo-field-row { display: flex; align-items: center; flex-wrap: wrap; gap: .8rem 1rem; }
.photo-field-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; flex: 1 1 60%; min-width: 0; }
.photo-field-actions .muted { width: 100%; margin: 0; }
.roster-name { display: inline-flex; align-items: center; gap: .5rem; vertical-align: middle; }

.profile-menu {
  position: absolute; right: 0; top: calc(100% + .5rem);
  width: 260px; z-index: 40;
  background: var(--panel); border: 1px solid var(--line-bright);
  box-shadow: var(--shadow);
  clip-path: polygon(0 0,100% 0,100% calc(100% - 12px),calc(100% - 12px) 100%,0 100%);
}
.profile-menu-head { display: flex; align-items: center; gap: .7rem; padding: .9rem 1rem; border-bottom: 1px solid var(--line); }
.profile-menu-head strong { display: block; font-family: var(--font-display); letter-spacing: .03em; }
.profile-menu-head span { display: block; font-size: .78rem; overflow: hidden; text-overflow: ellipsis; }
.profile-menu-list, .profile-menu-foot { padding: .4rem; }
.profile-menu-foot { border-top: 1px solid var(--line); }
.profile-menu button {
  width: 100%; text-align: left;
  padding: .55em .7em; border: none; background: transparent;
  color: var(--text); font-family: var(--font-display); font-weight: 500;
  font-size: .85rem; letter-spacing: .03em; cursor: pointer;
}
.profile-menu button:hover { background: var(--panel-2); color: #fff; }
.profile-menu button.danger { color: var(--loss); }

/* ---------- main / identity ---------- */
.main { max-width: 980px; margin: 0 auto; padding: 1.7rem 1.3rem 4rem; }
.view-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.4rem; flex-wrap: wrap; }
.head-actions { display: flex; gap: .5rem; }
.view-head h1 { margin: 0; position: relative; padding-left: .9rem; }
.view-head h1::before { content: ""; position: absolute; left: 0; top: .1em; bottom: .1em; width: 5px; background: var(--split); clip-path: polygon(0 0,100% 12%,100% 100%,0 88%); }

.identity {
  display: flex; align-items: center; gap: 1rem;
  padding: 1rem 1.2rem; margin-bottom: 1.4rem;
  background: linear-gradient(115deg, rgba(189,236,63,.14), rgba(56,198,232,.13)), var(--panel);
  border: 1px solid var(--line);
  clip-path: polygon(0 0,100% 0,100% calc(100% - 12px),calc(100% - 12px) 100%,0 100%);
}
.identity .avatar { width: 46px; height: 46px; font-size: 1.1rem; }
.identity-name { font-family: var(--font-display); font-weight: 700; font-size: 1.15rem; letter-spacing: .04em; text-transform: uppercase; }
.identity-meta { color: var(--muted); font-size: .85rem; }
.identity-main { margin-left: auto; text-align: right; }
.identity-main span { display: block; font-size: .72rem; color: var(--muted); letter-spacing: .08em; text-transform: uppercase; font-family: var(--font-display); }
.identity-main b { font-family: var(--font-display); letter-spacing: .03em; }

/* ---------- stat cards ---------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(165px, 1fr)); gap: .85rem; margin-bottom: 1.6rem; }
.stat-card {
  --cut: 12px;
  position: relative;
  background: linear-gradient(180deg, var(--panel-2), var(--bg-2));
  border: 1px solid var(--line);
  padding: 1rem 1.1rem; display: grid; gap: .15rem;
  clip-path: polygon(var(--cut) 0,100% 0,100% calc(100% - var(--cut)),calc(100% - var(--cut)) 100%,0 100%,0 var(--cut));
}
.stat-card::after { content: ""; position: absolute; left: 0; top: 0; width: 3px; height: 34px; background: var(--split); }
.stat-label { font-family: var(--font-display); font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .09em; }
.stat-value { font-family: var(--font-display); font-size: 2rem; font-weight: 700; font-style: italic; letter-spacing: -.01em; line-height: 1.1; }
.stat-sub { font-size: .8rem; color: var(--muted); }

/* ---------- panels ---------- */
.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-left: 3px solid var(--blue);
  padding: 1.2rem; margin-bottom: 1.2rem;
  clip-path: polygon(0 0,100% 0,100% calc(100% - 12px),calc(100% - 12px) 100%,0 100%);
}
.panel-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1.2rem; }
@media (max-width: 700px) { .panel-row { grid-template-columns: 1fr; } }

.bars { display: grid; gap: .55rem; }
.bar-row { display: grid; grid-template-columns: 120px 1fr 28px; align-items: center; gap: .6rem; font-size: .86rem; }
.bar-label { color: var(--muted); }
.bar { height: 12px; background: var(--bg); overflow: hidden; clip-path: polygon(4px 0,100% 0,calc(100% - 4px) 100%,0 100%); }
.bar > span { display: block; height: 100%; background: var(--split); background-size: 300% 100%; }
.bar-num { text-align: right; font-family: var(--font-display); font-variant-numeric: tabular-nums; }
.mini-bar { display: inline-block; width: 90px; height: 9px; background: var(--bg); overflow: hidden; vertical-align: middle; clip-path: polygon(3px 0,100% 0,calc(100% - 3px) 100%,0 100%); }
.mini-bar > span { display: block; height: 100%; background: var(--split); background-size: 300% 100%; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 0 -.25rem; }
.data-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.data-table th { text-align: left; font-family: var(--font-display); color: var(--muted); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; font-size: .76rem; padding: .5em .6em; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table td { padding: .55em .6em; border-bottom: 1px solid var(--bg-2); white-space: nowrap; }
.data-table td .mini-bar { margin-right: .4em; }
.data-table tr.is-clickable { transition: background .12s ease; }
.data-table tr.is-clickable:hover, .data-table tr.is-clickable:focus-visible { background: var(--panel-2); outline: none; }
.row-chevron { color: var(--muted); margin-left: .3em; }

/* bey detail modal */
.bey-detail { display: grid; gap: .8rem; }
.bey-detail h3 { margin: .6rem 0 0; font-size: .95rem; }
.bey-detail .stat-grid { margin-bottom: 0; grid-template-columns: 1fr 1fr; }
.bey-detail-parts { display: flex; justify-content: center; gap: 1.2rem; flex-wrap: wrap; }
.bey-detail-part { display: grid; justify-items: center; gap: .15rem; text-align: center; min-width: 84px; }
.bey-detail-matches { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.bey-detail-matches li { display: flex; gap: .6rem; align-items: flex-start; padding-bottom: .6rem; border-bottom: 1px solid var(--bg-2); }
.bey-detail-matches li:last-child { border-bottom: none; padding-bottom: 0; }

/* ---------- recent form pills ---------- */
.form-pills { display: flex; gap: .35rem; flex-wrap: wrap; }
.pill {
  width: 32px; height: 30px; display: grid; place-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: .82rem;
  clip-path: polygon(6px 0,100% 0,calc(100% - 6px) 100%,0 100%);
}
.pill--w { background: rgba(36, 209, 122, .16); color: var(--win); border-left: 2px solid var(--win); }
.pill--l { background: rgba(255, 77, 99, .16); color: var(--loss); border-left: 2px solid var(--loss); }

/* ---------- cards ---------- */
.card-list { display: grid; gap: .8rem; }
.card {
  display: flex; gap: 1rem; justify-content: space-between;
  background: var(--panel); border: 1px solid var(--line);
  border-left: 3px solid var(--line-bright);
  padding: 1rem 1.1rem;
  clip-path: polygon(0 0,100% 0,100% calc(100% - 11px),calc(100% - 11px) 100%,0 100%);
  transition: border-color .15s ease;
}
.card:hover { border-left-color: var(--blue); }
.card-main { min-width: 0; flex: 1; }
.card-main h3 { margin: 0 0 .25rem; font-size: 1rem; letter-spacing: .03em; text-transform: none; }
.card-actions { display: flex; flex-direction: column; gap: .4rem; flex: none; }
.card-notes { margin: .5rem 0 0; font-size: .87rem; color: var(--muted); white-space: pre-wrap; }

.chips { display: flex; gap: .4rem; flex-wrap: wrap; margin-top: .55rem; }
.chip {
  font-family: var(--font-display); font-size: .74rem; font-weight: 600;
  letter-spacing: .04em; padding: .22em .7em;
  background: var(--bg-2); border: 1px solid var(--line); color: var(--muted);
  clip-path: polygon(6px 0,100% 0,calc(100% - 6px) 100%,0 100%);
}
.chip--accent { color: var(--gold); border-color: rgba(255, 196, 46, .4); background: rgba(255, 196, 46, .1); }

.match-top { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.match-top h3 { margin: 0; }
.score { font-family: var(--font-display); font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 700; }
.result-badge {
  width: 28px; height: 26px; display: grid; place-content: center;
  font-family: var(--font-display); font-weight: 700; font-size: .82rem; flex: none;
  clip-path: polygon(5px 0,100% 0,calc(100% - 5px) 100%,0 100%);
}
.result-badge--w { background: rgba(36, 209, 122, .18); color: var(--win); }
.result-badge--l { background: rgba(255, 77, 99, .18); color: var(--loss); }
.result-badge--x { background: var(--bg-2); color: var(--muted); }

.game-line { display: flex; gap: .35rem; flex-wrap: wrap; margin-top: .5rem; }
.game-tag {
  font-family: var(--font-display); font-size: .74rem; padding: .18em .55em;
  background: var(--bg-2); border: 1px solid var(--line);
  clip-path: polygon(5px 0,100% 0,calc(100% - 5px) 100%,0 100%);
}
.game-tag--w { border-color: rgba(36, 209, 122, .4); }
.game-tag--l { border-color: rgba(255, 77, 99, .4); }

/* ---------- collection ---------- */
.collection-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1.2rem; }
.rank-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .55rem; }
.rank-list li { display: flex; align-items: center; gap: .7rem; padding-bottom: .55rem; border-bottom: 1px solid var(--bg-2); font-size: .9rem; }
.rank-list li:last-child { border-bottom: none; padding-bottom: 0; }
.rank-num { font-family: var(--font-display); font-weight: 700; color: var(--muted); width: 2.2em; flex: none; }
.rank-main { flex: 1; min-width: 0; display: grid; gap: .3rem; }
.rank-main .bar { height: 6px; }
.rank-score { font-family: var(--font-display); font-weight: 700; font-size: 1.1rem; width: 2.2em; text-align: right; flex: none; }
.rank-list .trend { width: 1em; text-align: center; }
.part-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.part-list li { display: flex; justify-content: space-between; gap: .6rem; align-items: center; padding-bottom: .5rem; border-bottom: 1px solid var(--bg-2); font-size: .9rem; }
.part-row-main { display: flex; align-items: center; gap: .5rem; min-width: 0; }
.part-row-main > span { min-width: 0; }
.row-actions { display: flex; gap: .6rem; flex: none; }
.combo-list { margin: .3rem 0 0; padding-left: 1.2rem; font-size: .9rem; }
.combo-list li { margin: .1rem 0; }

/* ---------- parts catalog picker ---------- */
.part-icon { display: block; flex: none; }
.part-vis { position: relative; display: inline-block; flex: none; }
.part-vis-svg { position: absolute; inset: 0; }
.part-vis-svg svg { width: 100%; height: 100%; display: block; }
.part-vis-img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; background: var(--bg-2); border-radius: 3px;
  transition: opacity .2s ease;
}
@media (hover: hover) and (pointer: fine) {
  .part-vis-img { cursor: zoom-in; }
}

/* ---------- floating part-photo preview (hover) ---------- */
.img-preview { display: none; }
@media (hover: hover) and (pointer: fine) {
  .img-preview:not([hidden]) {
    display: block;
    position: fixed; z-index: 200; pointer-events: none;
    width: 240px; height: 240px;
    background-color: var(--panel); background-repeat: no-repeat;
    background-position: center; background-size: contain;
    border: 1px solid var(--line-bright);
    border-top: 3px solid transparent; border-image: var(--split) 1;
    box-shadow: var(--shadow);
    clip-path: polygon(0 0,100% 0,100% calc(100% - 16px),calc(100% - 16px) 100%,0 100%);
  }
}
.catalog-picker { display: grid; gap: .9rem; }
.catalog-controls { display: grid; gap: .55rem; position: sticky; top: 0; background: var(--panel); padding-bottom: .35rem; z-index: 1; }
.catalog-controls input[type="search"] { width: 100%; }
.catalog-chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.catalog-chips[hidden] { display: none; }
.chip-btn {
  border: 1px solid var(--line); background: var(--bg-2); color: var(--muted);
  font-family: var(--font-display); font-size: .72rem; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; padding: .32em .7em; cursor: pointer;
  clip-path: polygon(4px 0,100% 0,100% calc(100% - 4px),calc(100% - 4px) 100%,0 100%,0 4px);
}
.chip-btn:hover { color: var(--text); border-color: var(--line-bright); }
.chip-btn.is-active { background: var(--split); color: #06080d; border-color: transparent; }
.catalog-results {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: .5rem;
  max-height: 46vh; overflow-y: auto; padding: .1rem;
}
.catalog-card {
  display: flex; align-items: center; gap: .6rem; text-align: left; width: 100%;
  border: 1px solid var(--line); background: var(--bg-2); color: var(--text);
  padding: .5rem .6rem; cursor: pointer;
  clip-path: polygon(6px 0,100% 0,100% calc(100% - 6px),calc(100% - 6px) 100%,0 100%,0 6px);
  transition: border-color .12s ease, background .12s ease;
}
.catalog-card:hover { border-color: var(--line-bright); }
.catalog-card.is-picked { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 13%, var(--bg-2)); }
.catalog-card.is-owned { opacity: .5; cursor: default; }
.catalog-card-main { display: grid; gap: .05rem; min-width: 0; flex: 1; }
.catalog-card-main b { font-size: .88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.catalog-card-tag {
  flex: none; font-family: var(--font-display); font-weight: 700; font-size: .82rem;
  color: var(--muted); min-width: 1.4em; text-align: center;
}
.catalog-card.is-picked .catalog-card-tag { color: var(--accent); }
.catalog-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding-top: .3rem; border-top: 1px solid var(--line); }
.modal-card:has(.catalog-picker) { width: min(760px, 96vw); }
@media (max-width: 560px) { .catalog-results { grid-template-columns: 1fr; max-height: 52vh; } }

/* ---------- empty ---------- */
.empty {
  background: var(--panel); border: 1px dashed var(--line);
  padding: 2rem 1.2rem; text-align: center; color: var(--muted);
  clip-path: polygon(0 0,100% 0,100% calc(100% - 12px),calc(100% - 12px) 100%,0 100%);
}

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 1rem; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(3, 5, 9, .74); backdrop-filter: blur(3px); }
.modal-card {
  position: relative; width: min(520px, 96vw); max-height: 90vh; overflow: auto;
  background: var(--panel); border: 1px solid var(--line-bright);
  border-top: 3px solid transparent; border-image: var(--split) 1;
  box-shadow: var(--shadow);
  clip-path: polygon(0 0,100% 0,100% calc(100% - 16px),calc(100% - 16px) 100%,0 100%);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 1rem 1.2rem; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; background: var(--panel); }
.modal-head h2 { margin: 0; }
.modal-head h2::before { display: none; }
.modal-close { background: none; border: none; color: var(--muted); font-size: 1.6rem; line-height: 1; cursor: pointer; }
.modal-body { padding: 1.2rem; }

.entry-form { display: grid; gap: .95rem; }
.form-actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: .4rem; }
.import-box { display: grid; gap: .9rem; }
.import-box #import-summary { display: grid; gap: .7rem; }
.import-box input[type="file"] { font: inherit; color: var(--muted); }
.challonge-import input[type="file"] { font: inherit; color: var(--muted); }
.ch-steps { margin: 0 0 .2rem; padding-left: 1.2rem; display: grid; gap: .35rem; font-size: .92rem; }
.ch-steps li { line-height: 1.4; }
.ch-match-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; max-height: 240px; overflow-y: auto; }
.ch-match-list li { display: flex; align-items: center; gap: .5rem; font-size: .88rem; }
.ch-match-list .pill { width: 26px; height: 24px; font-size: .7rem; flex: none; }
kbd { background: var(--bg-2); border: 1px solid var(--line-bright); border-radius: 3px; padding: .05em .45em; font-family: var(--font-display); font-size: .85em; }

/* ---------- share stats card ---------- */
.share-card-modal { display: grid; gap: 1rem; }
.share-card-preview {
  border: 1px solid var(--line); background: var(--bg-2);
  clip-path: polygon(0 0,100% 0,100% calc(100% - 14px),calc(100% - 14px) 100%,0 100%);
}
.share-card-preview img { display: block; width: 100%; height: auto; }
.share-card-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.share-card-links { border-top: 1px solid var(--line); padding-top: .9rem; }
.share-card-chips { display: flex; flex-wrap: wrap; gap: 1rem .9rem; margin-top: .3rem; }
.field--check { display: flex; align-items: center; gap: .55rem; cursor: pointer; }
.field--check input { width: auto; flex: none; accent-color: var(--blue); }
.field--check span { font-size: .9rem; color: var(--text); text-transform: none; letter-spacing: 0; }
.games-editor, .combo-editor { display: grid; gap: .5rem; padding: .8rem; background: var(--bg-2); border-left: 2px solid var(--blue); }
.game-edit-row { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; }
.game-edit-row select { flex: 1 1 130px; min-width: 0; }
.game-edit-row [data-rm] { flex: none; margin-left: auto; }
.combo-edit-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .4rem; }
@media (max-width: 480px) { .combo-edit-row { grid-template-columns: 1fr; } }

/* ---------- custom autocomplete (replaces native <datalist>) ---------- */
.autocomplete-list {
  position: fixed; z-index: 150; max-height: 240px; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line-bright);
  box-shadow: var(--shadow);
}
.autocomplete-item {
  display: block; width: 100%; text-align: left;
  background: none; border: none; border-bottom: 1px solid var(--line);
  color: var(--text); font: inherit; padding: .5em .8em; cursor: pointer;
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover, .autocomplete-item.is-active { background: var(--panel-2); color: var(--accent); }

/* ---------- team ---------- */
.row-between { display: flex; align-items: center; justify-content: space-between; gap: .8rem; flex-wrap: wrap; margin-bottom: .9rem; }
.team-banner {
  --team: var(--accent-2);
  display: flex; align-items: center; gap: 1rem;
  padding: 1rem 1.2rem; margin-bottom: 1.3rem;
  background: linear-gradient(115deg, color-mix(in srgb, var(--team) 22%, transparent), rgba(189,236,63,.1)), var(--panel);
  border: 1px solid var(--line); border-left: 4px solid var(--team);
  clip-path: polygon(0 0,100% 0,100% calc(100% - 12px),calc(100% - 12px) 100%,0 100%);
}
.team-crest {
  width: 52px; height: 52px; flex: none; display: grid; place-content: center;
  font-family: var(--font-display); font-weight: 700; font-style: italic; font-size: 1rem; color: #fff;
  text-shadow: 0 1px 3px rgba(0,0,0,.45);
  background: linear-gradient(135deg, var(--team), color-mix(in srgb, var(--team) 40%, var(--accent)));
  clip-path: polygon(16% 0, 100% 0, 84% 100%, 0 100%);
}
.team-banner .identity-main { margin-left: auto; }

.seg { display: flex; gap: .2rem; background: var(--bg); padding: .3rem; margin-bottom: 1.1rem; flex-wrap: wrap; }
.seg-btn {
  padding: .5em .9em; border: none; background: transparent; color: var(--muted);
  font-family: var(--font-display); font-weight: 600; letter-spacing: .04em; text-transform: uppercase;
  font-size: .78rem; cursor: pointer;
  clip-path: polygon(6px 0,100% 0,calc(100% - 6px) 100%,0 100%);
}
.seg-btn:hover { color: var(--text); }
.seg-btn.is-active { background: var(--panel-2); color: var(--text); box-shadow: inset 0 -2px 0 var(--blue); }

.kv { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1rem; margin: 0 0 .6rem; font-size: .9rem; }
.kv dt { color: var(--muted); font-family: var(--font-display); font-size: .8rem; letter-spacing: .04em; text-transform: uppercase; }
.kv dd { margin: 0; }
.kv code { background: var(--bg); padding: .1em .5em; border: 1px solid var(--line); letter-spacing: .12em; }

.lineup-edit-row { display: grid; grid-template-columns: 1fr .8fr 1fr auto; gap: .4rem; }
@media (max-width: 520px) { .lineup-edit-row { grid-template-columns: 1fr; } }

/* ---------- activity feed ---------- */
.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: .1rem; }
.feed-item {
  display: flex; align-items: center; gap: .7rem;
  padding: .6rem .2rem; border-bottom: 1px solid var(--bg-2);
}
.feed-item:last-child { border-bottom: none; }
.is-clickable { cursor: pointer; }
.feed-item.is-clickable { border-radius: 4px; transition: background .12s ease; }
.feed-item.is-clickable:hover { background: var(--panel-2); }
.friend-card.is-clickable { transition: border-color .15s ease, background .12s ease; }
.friend-card.is-clickable:hover { border-left-color: var(--blue); background: var(--panel); }
.friend-card [data-unfriend] { align-self: flex-start; }
.feed-body { flex: 1; min-width: 0; }
.feed-text { font-size: .9rem; line-height: 1.35; }
.feed-text b { font-family: var(--font-display); font-weight: 700; letter-spacing: .01em; }

/* ---------- friends ---------- */
.friend-code {
  font-family: var(--font-display); font-size: 1.5rem; font-weight: 700;
  letter-spacing: .32em; padding: .5em .7em .5em 1em; width: 100%;
}
.req-list { display: grid; gap: .55rem; }
.req-row { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.req-name { font-family: var(--font-display); font-weight: 600; letter-spacing: .02em; }
.req-actions { margin-left: auto; display: flex; gap: .4rem; }
.friend-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: .8rem; }
.friend-card {
  display: flex; align-items: center; gap: .8rem;
  background: var(--bg-2); border: 1px solid var(--line); border-left: 3px solid var(--blue);
  padding: .8rem .9rem;
  clip-path: polygon(0 0,100% 0,100% calc(100% - 9px),calc(100% - 9px) 100%,0 100%);
}
.friend-main { flex: 1; min-width: 0; }
.friend-name { font-family: var(--font-display); font-weight: 700; letter-spacing: .02em; }
.friend-rec { display: flex; align-items: center; gap: .5rem; margin-top: .3rem; font-family: var(--font-display); font-size: .85rem; color: var(--muted); }
.friend-rec .mini-bar { width: 70px; }
@media (max-width: 460px) {
  .friend-grid { grid-template-columns: 1fr; }
  .friend-code { font-size: 1.15rem; letter-spacing: .18em; padding: .5em; }
}

input[type="color"] { padding: .2em; height: 2.4em; cursor: pointer; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 1.5rem; transform: translateX(-50%);
  background: var(--panel-2); border: 1px solid var(--line-bright); color: var(--text);
  padding: .7em 1.15em; box-shadow: var(--shadow); z-index: 100;
  font-family: var(--font-display); font-weight: 600; letter-spacing: .03em;
  clip-path: polygon(8px 0,100% 0,100% 100%,0 100%,0 8px);
}
.toast--ok { border-left: 3px solid var(--win); }
.toast--err { border-left: 3px solid var(--loss); }
.toast--warn { border-left: 3px solid var(--gold); }
.toast--action { display: flex; align-items: center; gap: 1rem; }
.toast-undo {
  background: none; border: none; color: var(--blue); cursor: pointer;
  font-family: var(--font-display); font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; font-size: .8rem; padding: .1em .2em;
}

/* ---------- live scoring ---------- */
.live {
  position: fixed; inset: 0; z-index: 120;
  background: var(--bg); background-image: var(--speedlines);
  overflow-y: auto;
}
.live-inner { max-width: 560px; margin: 0 auto; padding: 1.2rem 1.1rem 3rem; display: grid; gap: 1.1rem; }
.live-top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.live-top h2 { margin: 0; }

.live-score {
  display: flex; align-items: center; justify-content: center; gap: 1.2rem;
  padding: 1.4rem 1rem;
  background: linear-gradient(115deg, rgba(189,236,63,.14), rgba(56,198,232,.13)), var(--panel);
  border: 1px solid var(--line);
  clip-path: polygon(0 0,100% 0,100% calc(100% - 14px),calc(100% - 14px) 100%,0 100%);
}
.live-side { display: grid; justify-items: center; gap: .1rem; }
.live-side span { font-family: var(--font-display); font-size: .8rem; letter-spacing: .12em; color: var(--muted); }
.live-side b { font-family: var(--font-display); font-style: italic; font-size: 3.4rem; line-height: 1; }
.live-side--me b { color: var(--blue); }
.live-side--opp b { color: var(--red); }
.live-dash { font-size: 2rem; color: var(--muted); }

.live-hint { text-align: center; color: var(--muted); margin: 0; }
.live-zones { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
@media (max-width: 420px) { .live-zones { grid-template-columns: 1fr; } }
.live-zone {
  border: none; cursor: pointer; color: #06080d;
  font-family: var(--font-display); font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  font-size: 1rem; padding: 2rem 1rem; min-height: 120px;
  clip-path: polygon(10px 0,100% 0,100% calc(100% - 10px),calc(100% - 10px) 100%,0 100%,0 10px);
  transition: filter .1s ease, transform .06s ease;
}
.live-zone:active { transform: scale(.98); }
.live-zone--me { background: linear-gradient(160deg, #cdee5a, #9ec91f); }
.live-zone--opp { background: linear-gradient(160deg, #5fd2ec, #2ba6c8); }

.live-games { display: flex; flex-wrap: wrap; gap: .4rem; }
.live-game {
  border: 1px solid var(--line); background: var(--bg-2); color: var(--text);
  font-family: var(--font-display); font-size: .78rem; padding: .35em .7em; cursor: pointer;
  clip-path: polygon(5px 0,100% 0,calc(100% - 5px) 100%,0 100%);
}
.live-game--me { border-color: rgba(189,236,63,.55); }
.live-game--opp { border-color: rgba(56,198,232,.55); }

.live-result {
  text-align: center; font-family: var(--font-display); font-weight: 700; font-style: italic;
  font-size: 1.6rem; letter-spacing: .02em; padding: .6rem;
}
.live-result--w { color: var(--win); }
.live-result--l { color: var(--loss); }
.live-actions { display: grid; gap: .6rem; }

.live-picker {
  position: fixed; inset: 0; z-index: 130; display: grid; place-items: end center;
  background: rgba(3,5,9,.72); backdrop-filter: blur(3px);
}
.live-picker-card {
  width: min(560px, 100%); background: var(--panel); border-top: 3px solid transparent;
  border-image: var(--split) 1; padding: 1.2rem 1rem 1.6rem;
}
.live-picker-card h3 { margin: 0 0 .8rem; text-align: center; }
.live-picker-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.live-picker-grid .btn { padding: 1rem .6rem; font-size: .9rem; line-height: 1.3; }
.live-picker-grid .btn:last-child { grid-column: 1 / -1; }

/* ---------- offline banner ---------- */
.net-banner {
  position: sticky; top: 0; z-index: 19;
  padding: .5rem 1rem; text-align: center;
  font-family: var(--font-display); font-weight: 600; font-size: .82rem; letter-spacing: .02em;
  color: #0c0f16; background: var(--gold);
}

/* ---------- responsive ---------- */
@media (max-width: 768px) {
  .topbar {
    gap: .6rem .8rem;
    padding: .55rem .8rem;
  }
  .topbar-brand { flex: 1 1 auto; min-width: 0; }
  .topbar-brand strong { font-size: .82rem; letter-spacing: .06em; }
  .profile-btn-name { display: none; }
  .topbar-user { flex: none; }

  /* nav becomes a single scrollable strip on its own row */
  .tabs {
    order: 3;
    flex: 1 1 100%;
    width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    margin: .1rem -.8rem -.15rem;
    padding: .15rem .8rem 0;
  }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: none; white-space: nowrap; }

  .profile-menu { width: min(264px, calc(100vw - 1.4rem)); }

  .main { padding: 1.2rem .9rem 3rem; }
  .view-head { gap: .7rem; margin-bottom: 1.1rem; }
  .view-head h1 { font-size: 1.3rem; }
  .view-head > .btn { flex: 1 1 100%; }
  .view-head .head-actions { flex: 1 1 100%; }
  .head-actions .btn { flex: 1; }
  .row-between { gap: .6rem; }
  .row-between > .btn { flex: 1 1 100%; }

  .stat-grid { grid-template-columns: 1fr 1fr; gap: .55rem; }
  .stat-card { --cut: 9px; padding: .8rem .85rem; }
  .stat-value { font-size: 1.55rem; }

  .panel { padding: 1rem; }
  .identity { flex-wrap: wrap; padding: .9rem 1rem; gap: .8rem; }
  .identity-name { font-size: 1rem; }
  .identity-main, .team-banner .identity-main { margin-left: 0; flex-basis: 100%; text-align: left; }

  .team-banner { flex-wrap: wrap; }

  .card { flex-direction: column; gap: .7rem; }
  .card-actions { flex-direction: row; }
  .card-actions .btn { flex: 1; }

  .bar-row { grid-template-columns: 90px 1fr 24px; gap: .4rem; font-size: .8rem; }

  .modal { padding: 0; place-items: end center; overflow-y: auto; }
  .modal-card {
    width: 100%; max-width: none; max-height: 92vh;
    clip-path: none;
    border-left: none; border-right: none; border-bottom: none;
  }
  .modal-body { padding: 1rem; }
  .modal-head { padding: .9rem 1rem; }
}

@media (max-width: 460px) {
  .auth-card { padding: 1.5rem 1.25rem; }
  .brand-x { width: 48px; height: 48px; font-size: 1.6rem; }
  .brand h1 { font-size: 1.15rem; }
  h1 { font-size: 1.35rem; }
}

@media (max-width: 360px) {
  .stat-grid { grid-template-columns: 1fr; }
}

/* ---------- deck builder ---------- */
.chip--danger { color: var(--loss); border-color: rgba(255, 77, 99, .4); background: rgba(255, 77, 99, .1); }
.danger-text { color: var(--loss); }
.deck-mini { display: grid; gap: .3rem; margin: .4rem 0 .2rem; font-size: .9rem; }
.deck-mini-row { display: flex; align-items: center; gap: .55rem; min-width: 0; }
.deck-mini-icons { display: inline-flex; gap: .2rem; flex: none; }

.deck-setup { display: grid; grid-template-columns: 2fr auto 1fr; gap: .9rem 1.2rem; align-items: end; }
.deck-setup-desc { grid-column: 1 / -1; margin: 0; }
.stepper { display: flex; align-items: center; gap: .6rem; }
.stepper b { font-family: var(--font-display); font-size: 1.3rem; min-width: 1.2em; text-align: center; }
@media (max-width: 640px) { .deck-setup { grid-template-columns: 1fr auto; } .deck-setup-name { grid-column: 1 / -1; } }

.deck-combo-head { display: flex; align-items: center; gap: .8rem; margin-bottom: .8rem; }
.deck-combo-head h2 { margin: 0; }
.deck-combo-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deck-slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
@media (max-width: 640px) { .deck-slots { grid-template-columns: 1fr; } }
.deck-slot {
  display: flex; align-items: center; gap: .7rem; text-align: left; min-width: 0;
  background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
  padding: .65rem .75rem; cursor: pointer; font: inherit; transition: border-color .15s ease, background .12s ease;
}
.deck-slot:hover { border-color: var(--line-bright); background: var(--panel-2); }
.deck-slot.is-empty { border-style: dashed; color: var(--muted); }
.deck-slot.is-dupe { border-color: var(--loss); background: rgba(255, 77, 99, .08); }
.deck-slot-plus { width: 44px; height: 44px; display: grid; place-items: center; flex: none; font-size: 1.5rem; border: 1px dashed var(--line-bright); border-radius: 50%; }
.deck-slot-main { display: grid; gap: .05rem; min-width: 0; }
.deck-slot-main b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.deck-slot-type { font-family: var(--font-display); font-size: .7rem; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); }
.deck-stats { margin-top: .9rem; }

.deck-summary { display: grid; gap: .7rem; }
.deck-summary h2 { margin: 0; }
.deck-summary p { margin: 0; }
.deck-ok { color: var(--win); font-weight: 600; }
.deck-errors { margin: 0; padding-left: 1.2rem; color: var(--loss); display: grid; gap: .2rem; }
.deck-warnings { margin: 0; padding-left: 1.2rem; display: grid; gap: .15rem; }
.deck-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; }
.deck-actions-spacer { flex: 1; }
.deck-rand-src { display: inline-flex; align-items: center; gap: .4rem; }
.deck-rand-src select { width: auto; }
.catalog-card[disabled] { opacity: .45; cursor: not-allowed; }
.pp-custom { justify-self: start; }

.deck-preview-row { display: grid; grid-template-columns: 1.6rem repeat(3, 1fr); gap: .5rem; align-items: start; padding: .5rem 0; border-bottom: 1px solid var(--bg-2); }
.deck-preview-row:last-of-type { border-bottom: none; }
.deck-preview-part { display: grid; justify-items: center; gap: .25rem; text-align: center; min-width: 0; }
.deck-preview-part .small { overflow-wrap: anywhere; }
.deck-slot.is-integrated { cursor: default; border-style: dashed; color: var(--muted); }
.deck-slot.is-integrated:hover { border-color: var(--line); background: var(--bg-2); }
.deck-slot.is-integrated .deck-slot-plus { color: var(--win); border-color: rgba(36, 209, 122, .4); font-size: 1.1rem; }

/* deck builder: animated stat bars */
.deck-stats .bar > span { transition: width .45s cubic-bezier(.22, .8, .3, 1); }
.deck-stats .bar-num { position: relative; font-variant-numeric: tabular-nums; }
.stat-delta {
  position: absolute; right: calc(100% + .4rem); top: 50%; transform: translateY(-50%);
  font-family: var(--font-display); font-size: .75rem; font-weight: 700; white-space: nowrap;
  padding: .05em .4em; border-radius: 3px; pointer-events: none;
  animation: stat-delta 1.6s ease forwards;
}
.stat-delta.is-up { color: var(--win); background: rgba(36, 209, 122, .14); }
.stat-delta.is-down { color: var(--loss); background: rgba(255, 77, 99, .14); }
@keyframes stat-delta {
  0% { opacity: 0; transform: translate(4px, -50%); }
  12%, 70% { opacity: 1; transform: translate(0, -50%); }
  100% { opacity: 0; transform: translate(0, -50%); }
}
@media (prefers-reduced-motion: reduce) {
  .deck-stats .bar > span { transition: none; }
  .stat-delta { animation: stat-delta-still 1.6s step-end forwards; }
}
@keyframes stat-delta-still { 0%, 99% { opacity: 1; } 100% { opacity: 0; } }
