/* ============================================================
   Spectate.gg — editorial match archive
   Engraved gold on midnight ink. Angular hex framing, gold
   hairlines, grain, and a single orchestrated load reveal.
   ============================================================ */

:root {
  /* ink field */
  --ink-900: #060a14;
  --ink-800: #091020;
  --ink-700: #0d1628;
  --ink-600: #122036;
  --ink-line: #1b2c47;

  /* signature gold */
  --gold-100: #f4ecd6;
  --gold-200: #e6d2a2;
  --gold-300: #c8aa6e;   /* signature */
  --gold-400: #9b7d44;
  --gold-deep: #5c4a28;

  /* signals */
  --teal: #2ad6c4;        /* victory / signature energy */
  --teal-deep: #0f5d57;
  --crimson: #d64550;     /* defeat */
  --crimson-deep: #5a1f24;

  --txt: #cdd6e6;
  --txt-dim: #7e8aa0;
  --txt-faint: #50607a;

  --font-display: "Cinzel", Georgia, serif;
  --font-body: "Hanken Grotesk", system-ui, sans-serif;
  --font-mono: "DM Mono", ui-monospace, monospace;

  --frame: polygon(0 8px, 8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%);
  --maxw: 1080px;
}

* { box-sizing: border-box; }

/* The `hidden` attribute must always win over a component's own display rule
   (.archive/.codex/.archive__more set display:flex, which otherwise beats it). */
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(1200px 700px at 50% -10%, #11203a 0%, transparent 60%),
    radial-gradient(900px 500px at 90% 20%, #0c1a2e 0%, transparent 55%),
    var(--ink-900);
  color: var(--txt);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---- atmosphere ---- */
.grain {
  position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: .045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}
.vignette {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(120% 90% at 50% 0%, transparent 55%, rgba(3,6,13,.7) 100%);
}

/* ---- masthead ---- */
.masthead {
  position: relative; z-index: 2;
  max-width: var(--maxw); margin: 0 auto; padding: 30px 28px 0;
  display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap;
}
.masthead__mark { display: flex; align-items: center; gap: 13px; }
.hex {
  width: 17px; height: 19px; display: inline-block;
  background: linear-gradient(150deg, var(--gold-200), var(--gold-400));
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  box-shadow: 0 0 14px rgba(200,170,110,.5);
}
.masthead__wordmark {
  font-family: var(--font-display); font-weight: 700; letter-spacing: .42em;
  text-transform: uppercase; font-size: 18px;
  color: var(--gold-100);
}
.masthead__tag {
  font-size: 11px; letter-spacing: .34em; text-transform: uppercase;
  color: var(--txt-faint);
}

.shell { position: relative; z-index: 2; max-width: var(--maxw); margin: 0 auto; padding: 26px 28px 80px; }

/* ============================================================
   Summoner crest
   ============================================================ */
.crest {
  position: relative;
  border: 1px solid var(--ink-line);
  background: linear-gradient(180deg, rgba(18,32,54,.6), rgba(9,16,32,.6));
  clip-path: var(--frame);
  padding: 26px 28px 24px;
  overflow: hidden;
}
.crest::before { /* top gold hairline */
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-300), transparent);
  opacity: .6;
}
.crest__glow {
  position: absolute; top: -160px; left: 50%; transform: translateX(-50%);
  width: 620px; height: 360px; pointer-events: none;
  background: radial-gradient(closest-side, rgba(42,214,196,.16), transparent 70%);
  filter: blur(8px);
}

.crest__body { display: flex; flex-wrap: wrap; align-items: center; gap: 28px; justify-content: space-between; position: relative; }
.crest__identity { display: flex; align-items: center; gap: 20px; min-width: 0; }
.crest__avatar {
  width: 78px; height: 86px; flex-shrink: 0;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  background: linear-gradient(160deg, var(--ink-600), var(--ink-800));
  border: 0; position: relative;
  display: grid; place-items: center;
  box-shadow: 0 0 0 1px var(--gold-400), 0 0 28px rgba(200,170,110,.18);
}
.crest__avatar img { width: 100%; height: 100%; object-fit: cover;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
.crest__avatar span { font-family: var(--font-display); font-size: 30px; color: var(--gold-300); }

.crest__name {
  font-family: var(--font-display); font-weight: 700; font-size: clamp(26px, 4vw, 40px);
  letter-spacing: .02em; margin: 0; color: var(--gold-100);
  text-shadow: 0 2px 30px rgba(0,0,0,.5); line-height: 1.05;
}
.crest__sub { font-size: 12px; letter-spacing: .22em; text-transform: uppercase; color: var(--txt-dim); margin-top: 7px; }

.crest__metrics { display: flex; align-items: flex-end; gap: 26px; flex-wrap: wrap; }
.metric { display: flex; flex-direction: column; gap: 4px; }
.metric__val { font-family: var(--font-mono); font-size: 26px; color: var(--gold-100); line-height: 1; font-weight: 500; }
.metric__lab { font-size: 10px; letter-spacing: .2em; text-transform: uppercase; color: var(--txt-faint); }
.metric--wide { min-width: 200px; }

/* recent-form ribbon */
.ribbon { display: flex; gap: 3px; align-items: flex-end; height: 26px; margin-bottom: 6px; }
.ribbon i {
  width: 7px; border-radius: 1px; display: block;
  transition: height .5s cubic-bezier(.2,.7,.2,1);
}
.ribbon i.w { background: linear-gradient(180deg, var(--teal), var(--teal-deep)); box-shadow: 0 0 8px rgba(42,214,196,.4); }
.ribbon i.l { background: linear-gradient(180deg, #8a3038, var(--crimson-deep)); }

/* ============================================================
   Queue filter rail
   ============================================================ */
.rail { display: flex; align-items: center; gap: 14px; margin: 22px 2px 6px; flex-wrap: wrap; }
.rail__label { font-size: 10px; letter-spacing: .28em; text-transform: uppercase; color: var(--txt-faint); }
.rail__chips { display: flex; gap: 7px; flex-wrap: wrap; }
.qchip {
  background: transparent; border: 1px solid var(--ink-line); color: var(--txt-dim);
  font-family: var(--font-mono); font-size: 12px; padding: 5px 12px; cursor: pointer; transition: .2s;
}
.qchip:hover { color: var(--gold-100); border-color: var(--gold-400); }
.qchip[aria-pressed="true"] { color: var(--gold-200); border-color: var(--gold-300); background: rgba(200,170,110,.08); }

/* ============================================================
   Match archive
   ============================================================ */
.archive { margin-top: 12px; display: flex; flex-direction: column; gap: 11px; }

.empty {
  text-align: center; padding: 70px 20px; border: 1px dashed var(--ink-line);
  display: flex; flex-direction: column; align-items: center; gap: 10px;
}
.empty__sigil {
  width: 46px; height: 52px; margin-bottom: 8px;
  background: conic-gradient(from 30deg, var(--gold-400), var(--gold-deep), var(--gold-300), var(--gold-deep), var(--gold-400));
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  opacity: .5;
}
.empty__lead { font-family: var(--font-display); font-size: 18px; color: var(--gold-200); margin: 0; }
.empty__hint { color: var(--txt-dim); font-size: 13px; margin: 0; max-width: 320px; }

/* --- match row --- */
.match {
  position: relative; border: 1px solid var(--ink-line);
  background: linear-gradient(100deg, rgba(13,22,40,.85), rgba(9,16,32,.7));
  clip-path: var(--frame);
  display: grid;
  grid-template-columns: 6px 132px 1fr auto;
  align-items: stretch;
  overflow: hidden;
  opacity: 0; transform: translateY(14px);
  animation: rise .6s cubic-bezier(.2,.7,.2,1) forwards;
}
@keyframes rise { to { opacity: 1; transform: none; } }

.match__accent { width: 6px; }
.match.win  .match__accent { background: linear-gradient(180deg, var(--teal), var(--teal-deep)); box-shadow: 0 0 18px rgba(42,214,196,.35); }
.match.loss .match__accent { background: linear-gradient(180deg, #8a3038, var(--crimson-deep)); }
.match.win::after, .match.loss::after { /* faint result wash */
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .5;
}
.match.win::after  { background: linear-gradient(100deg, rgba(42,214,196,.06), transparent 38%); }
.match.loss::after { background: linear-gradient(100deg, rgba(214,69,80,.06), transparent 38%); }

.match__head { display: contents; cursor: pointer; }

/* champion column */
.champ {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 16px 6px; position: relative; z-index: 1;
}
.champ__portrait {
  width: 64px; height: 70px; position: relative;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  background: linear-gradient(160deg, var(--ink-600), var(--ink-800));
  display: grid; place-items: center;
  box-shadow: 0 0 0 1px var(--gold-400);
}
.champ__portrait img { width: 100%; height: 100%; object-fit: cover;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
.champ__portrait .lvl {
  position: absolute; bottom: -6px; left: 50%; transform: translateX(-50%);
  font-family: var(--font-mono); font-size: 10px; color: var(--ink-900);
  background: var(--gold-300); padding: 1px 6px; border-radius: 8px; z-index: 2;
}
.champ__portrait .fallback { font-family: var(--font-display); font-size: 22px; color: var(--gold-300); }
.champ__name { font-size: 11.5px; color: var(--txt); letter-spacing: .03em; text-align: center;
  max-width: 110px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* center: result + kda + meta */
.body { padding: 15px 18px; display: flex; flex-direction: column; justify-content: center; gap: 8px; min-width: 0; z-index: 1; }
.body__top { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.result { font-family: var(--font-display); font-size: 14px; letter-spacing: .14em; text-transform: uppercase; font-weight: 600; }
.match.win  .result { color: var(--teal); }
.match.loss .result { color: var(--crimson); }
.queue { font-size: 12px; color: var(--txt-dim); letter-spacing: .04em; }
.ago { font-size: 11px; color: var(--txt-faint); margin-left: auto; letter-spacing: .05em; }

.kda { display: flex; align-items: baseline; gap: 9px; }
.kda__nums { font-family: var(--font-mono); font-size: 19px; color: var(--gold-100); letter-spacing: .02em; }
.kda__nums .sep { color: var(--txt-faint); margin: 0 1px; }
.kda__nums .d { color: var(--crimson); }
.kda__ratio { font-size: 12px; color: var(--txt-dim); }
.kda__ratio b { color: var(--gold-200); font-weight: 600; }

.tags { display: flex; gap: 7px; flex-wrap: wrap; }
.tag { font-family: var(--font-mono); font-size: 11px; color: var(--txt-dim); display: inline-flex; gap: 5px; align-items: center; }
.tag b { color: var(--txt); font-weight: 500; }
.tag .pip { width: 4px; height: 4px; background: var(--gold-400); transform: rotate(45deg); display: inline-block; }

/* right: items + spells */
.kit { padding: 15px 18px 15px 6px; display: flex; align-items: center; gap: 14px; z-index: 1; }
.spells { display: grid; grid-template-rows: 1fr 1fr; gap: 4px; }
.spell { width: 24px; height: 24px; border: 1px solid var(--ink-line); background: var(--ink-700);
  display: grid; place-items: center; font-size: 9px; color: var(--txt-faint); overflow: hidden; }
.spell img { width: 100%; height: 100%; }
.items { display: grid; grid-template-columns: repeat(4, 30px); grid-auto-rows: 30px; gap: 4px; }
.slot { border: 1px solid var(--ink-line); background: rgba(6,10,20,.6); overflow: hidden;
  display: grid; place-items: center; }
.slot.filled { box-shadow: inset 0 0 0 1px rgba(200,170,110,.25); }
.slot img { width: 100%; height: 100%; }
.slot.trinket { border-color: var(--gold-deep); }

.chev { align-self: center; color: var(--txt-faint); padding-right: 14px; transition: transform .3s, color .2s; font-size: 12px; }
.match.open .chev { transform: rotate(90deg); color: var(--gold-200); }
.match:hover .chev { color: var(--gold-300); }

/* --- expanded scoreboard --- */
.detail { grid-column: 1 / -1; display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows .42s cubic-bezier(.3,.8,.25,1); }
.match.open .detail { grid-template-rows: 1fr; }
.detail__inner { overflow: hidden; }
.board { border-top: 1px solid var(--ink-line); padding: 18px 20px 22px; display: grid; gap: 16px; }
.board__loading { color: var(--txt-dim); font-size: 13px; padding: 8px 2px; font-family: var(--font-mono); }

.team { }
.team__head { display: flex; align-items: center; gap: 12px; margin-bottom: 9px; }
.team__title { font-family: var(--font-display); font-size: 13px; letter-spacing: .12em; text-transform: uppercase; }
.team.win .team__title { color: var(--teal); }
.team.loss .team__title { color: var(--crimson); }
.team__objs { display: flex; gap: 12px; margin-left: auto; }
.obj { font-family: var(--font-mono); font-size: 11px; color: var(--txt-dim); display: inline-flex; gap: 4px; align-items: center; }
.obj b { color: var(--gold-200); }

.scoretable { width: 100%; border-collapse: collapse; }
.scoretable th { font-size: 9px; letter-spacing: .16em; text-transform: uppercase; color: var(--txt-faint);
  text-align: right; padding: 4px 8px; font-weight: 500; }
.scoretable th:first-child { text-align: left; }
.row {
  border-top: 1px solid rgba(27,44,71,.5); transition: background .18s;
}
.row:hover { background: rgba(200,170,110,.04); }
.row.me { background: rgba(200,170,110,.07); box-shadow: inset 3px 0 0 var(--gold-300); }
.row td { padding: 7px 8px; font-family: var(--font-mono); font-size: 12px; text-align: right; color: var(--txt); white-space: nowrap; }
.row td.player { text-align: left; }
.pcell { display: flex; align-items: center; gap: 9px; }
.pcell__port { width: 30px; height: 33px; flex-shrink: 0;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  background: var(--ink-700); display: grid; place-items: center; box-shadow: 0 0 0 1px var(--gold-deep); }
.pcell__port img { width: 100%; height: 100%; object-fit: cover;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
.pcell__port .fb { font-family: var(--font-display); font-size: 12px; color: var(--gold-400); }
.pcell__meta { display: flex; flex-direction: column; min-width: 0; }
.pcell__name { font-family: var(--font-body); font-size: 12.5px; color: var(--txt); max-width: 150px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcell__name.me { color: var(--gold-100); font-weight: 600; }
.pcell__champ { font-size: 10px; color: var(--txt-faint); letter-spacing: .04em; }
.miniitems { display: inline-flex; gap: 2px; justify-content: flex-end; }
.miniitems span { width: 18px; height: 18px; border: 1px solid var(--ink-line); background: rgba(6,10,20,.6); overflow: hidden; display: inline-block; }
.miniitems span img { width: 100%; height: 100%; }
.dmgbar { position: relative; width: 78px; height: 14px; background: rgba(6,10,20,.6); display: inline-block; vertical-align: middle; }
.dmgbar i { position: absolute; left: 0; top: 0; bottom: 0; background: linear-gradient(90deg, var(--gold-400), var(--gold-200)); }
.dmgbar em { position: absolute; right: 4px; top: 0; font-style: normal; font-size: 10px; color: var(--ink-900); line-height: 14px; mix-blend-mode: screen; }

/* load more */
.archive__more { display: flex; justify-content: center; margin-top: 26px; }
.more {
  font-family: var(--font-display); letter-spacing: .2em; text-transform: uppercase; font-size: 12px;
  color: var(--gold-200); background: transparent; border: 1px solid var(--gold-400);
  padding: 13px 32px; cursor: pointer; transition: .25s;
  clip-path: polygon(0 6px, 6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%);
}
.more:hover { background: rgba(200,170,110,.1); color: var(--gold-100); box-shadow: 0 0 26px rgba(200,170,110,.18); }
.more:disabled { opacity: .4; cursor: default; }

/* colophon */
.colophon {
  position: relative; z-index: 2; text-align: center; padding: 18px 0 34px;
  font-family: var(--font-mono); color: var(--txt-faint);
  display: flex; flex-direction: column; gap: 10px; align-items: center;
}
.colophon__line {
  display: flex; gap: 12px; justify-content: center; align-items: center; flex-wrap: wrap;
  font-size: 11px; letter-spacing: .14em; text-transform: uppercase;
}
.colophon .dot { color: var(--gold-deep); }
.colophon__nav { color: var(--gold-300); text-decoration: none; }
.colophon__nav:hover { color: var(--gold-100); }
.colophon__legal {
  max-width: 720px; margin: 0 auto; padding: 0 18px;
  font-family: var(--font-body); font-size: 11px; line-height: 1.55;
  letter-spacing: .01em; text-transform: none; color: var(--txt-faint); opacity: .82;
}

/* loading shimmer for rows */
.skeleton { height: 104px; border: 1px solid var(--ink-line); position: relative; overflow: hidden;
  clip-path: var(--frame); background: var(--ink-700); }
.skeleton::after { content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent, rgba(200,170,110,.07), transparent);
  transform: translateX(-100%); animation: shimmer 1.3s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }

/* toast for errors */
.toast {
  position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%) translateY(20px);
  z-index: 10; background: var(--ink-700); border: 1px solid var(--crimson);
  color: var(--txt); padding: 12px 20px; font-size: 13px; opacity: 0; transition: .3s;
  clip-path: polygon(0 5px, 5px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%);
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============================================================
   View tabs (Archive / Codex)
   ============================================================ */
.viewtabs { display: flex; gap: 0; margin: 26px 2px 2px; border-bottom: 1px solid var(--ink-line); }
.vtab {
  font-family: var(--font-display); letter-spacing: .16em; text-transform: uppercase; font-size: 12px;
  color: var(--txt-dim); background: transparent; border: 0; border-bottom: 2px solid transparent;
  padding: 11px 20px; cursor: pointer; transition: .22s; margin-bottom: -1px;
}
.vtab:hover { color: var(--gold-100); }
.vtab[aria-selected="true"] { color: var(--gold-200); border-bottom-color: var(--gold-300); }

.qchip__n { font-size: 10px; opacity: .6; margin-left: 2px; }

/* ============================================================
   Champion Codex (analytics)
   ============================================================ */
.codex { margin-top: 16px; display: flex; flex-direction: column; gap: 18px;
  opacity: 0; transform: translateY(10px); animation: rise .55s cubic-bezier(.2,.7,.2,1) forwards; }

/* stat cards */
.codex__cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 11px; }
.card {
  position: relative; border: 1px solid var(--ink-line);
  background: linear-gradient(160deg, rgba(18,32,54,.5), rgba(9,16,32,.6));
  clip-path: polygon(0 6px, 6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%);
  padding: 16px 18px; display: flex; flex-direction: column; gap: 7px;
}
.card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--gold-deep); }
.card--win::before  { background: linear-gradient(180deg, var(--teal), var(--teal-deep)); }
.card--loss::before { background: linear-gradient(180deg, #8a3038, var(--crimson-deep)); }
.card--gold::before { background: linear-gradient(180deg, var(--gold-200), var(--gold-400)); }
.card__val { font-family: var(--font-mono); font-size: 26px; color: var(--gold-100); line-height: 1; }
.card--win .card__val  { color: var(--teal); }
.card--loss .card__val { color: var(--crimson); }
.card__lab { font-size: 10px; letter-spacing: .16em; text-transform: uppercase; color: var(--txt-faint); }

/* split: champion table + role bars */
.codex__split { display: grid; grid-template-columns: 1.7fr 1fr; gap: 16px; align-items: start; }
.panel {
  border: 1px solid var(--ink-line);
  background: linear-gradient(180deg, rgba(13,22,40,.5), rgba(9,16,32,.5));
  clip-path: var(--frame); padding: 18px 20px 20px;
}
.panel__head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  margin-bottom: 14px; padding-bottom: 11px; border-bottom: 1px solid var(--ink-line); }
.panel__title { font-family: var(--font-display); font-size: 14px; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-200); }
.panel__hint { font-size: 11px; color: var(--txt-faint); font-family: var(--font-mono); }

/* champion rows */
.champtable { display: flex; flex-direction: column; gap: 4px; }
.crow {
  display: grid; grid-template-columns: 40px 1.3fr 1.4fr repeat(3, 56px); align-items: center; gap: 10px;
  padding: 7px 6px; border-bottom: 1px solid rgba(27,44,71,.5);
  opacity: 0; transform: translateY(8px); animation: rise .5s cubic-bezier(.2,.7,.2,1) forwards;
}
.crow:last-child { border-bottom: 0; }
.crow__port {
  width: 36px; height: 40px; position: relative;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  background: linear-gradient(160deg, var(--ink-600), var(--ink-800));
  display: grid; place-items: center; box-shadow: 0 0 0 1px var(--gold-400);
}
.crow__port img { width: 100%; height: 100%; object-fit: cover;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); }
.crow__port .fb { font-family: var(--font-display); font-size: 12px; color: var(--gold-300); }
.crow__name { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.crow__champ { font-size: 13.5px; color: var(--txt); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.crow__games { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--txt-faint); }
.crow__wr { display: flex; align-items: center; gap: 9px; }
.wrbar { flex: 1; height: 6px; background: rgba(6,10,20,.7); overflow: hidden; }
.wrbar i { display: block; height: 100%; }
.crow__wr.win .wrbar i  { background: linear-gradient(90deg, var(--teal-deep), var(--teal)); }
.crow__wr.loss .wrbar i { background: linear-gradient(90deg, var(--crimson-deep), #b3434c); }
.wrnum { font-family: var(--font-mono); font-size: 12px; width: 40px; text-align: right; }
.crow__wr.win .wrnum  { color: var(--teal); }
.crow__wr.loss .wrnum { color: var(--crimson); }
.crow__stat { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.crow__stat b { font-family: var(--font-mono); font-size: 12.5px; color: var(--gold-100); font-weight: 500; }
.crow__stat span { font-size: 9px; letter-spacing: .12em; text-transform: uppercase; color: var(--txt-faint); }
.champ-empty { color: var(--txt-dim); font-size: 13px; padding: 20px 4px; text-align: center; }

/* role bars */
.rolebars { display: flex; flex-direction: column; gap: 14px; }
.role { display: grid; grid-template-columns: 64px 1fr auto; align-items: center; gap: 10px; }
.role__name { font-size: 12px; letter-spacing: .08em; color: var(--txt-dim); text-transform: uppercase; }
.role__track { height: 8px; background: rgba(6,10,20,.7); overflow: hidden; }
.role__track i { display: block; height: 100%; }
.role__track i.win  { background: linear-gradient(90deg, var(--teal-deep), var(--teal)); }
.role__track i.loss { background: linear-gradient(90deg, var(--crimson-deep), #b3434c); }
.role__meta { font-family: var(--font-mono); font-size: 11px; color: var(--txt-dim); white-space: nowrap; }
.role__meta b.win  { color: var(--teal); }
.role__meta b.loss { color: var(--crimson); }

/* full-width champion table when the role split is hidden (ARAM / Arena) */
.codex__split.solo { grid-template-columns: 1fr; }

/* ============================================================
   Search console (masthead)
   ============================================================ */
.search {
  display: flex; align-items: stretch; gap: 0;
  border: 1px solid var(--ink-line); background: rgba(6,10,20,.55);
  clip-path: polygon(0 6px, 6px 0, 100% 0, 100% calc(100% - 6px), calc(100% - 6px) 100%, 0 100%);
  box-shadow: inset 0 0 0 1px rgba(200,170,110,.05);
}
.search:focus-within { border-color: var(--gold-400); box-shadow: 0 0 22px rgba(200,170,110,.14); }
.search__region {
  appearance: none; -webkit-appearance: none;
  background: rgba(13,22,40,.9); color: var(--gold-200); border: 0;
  border-right: 1px solid var(--ink-line);
  font-family: var(--font-mono); font-size: 12px; letter-spacing: .08em;
  padding: 0 26px 0 12px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--gold-400) 50%), linear-gradient(135deg, var(--gold-400) 50%, transparent 50%);
  background-position: right 13px center, right 8px center; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat;
}
.search__region:focus { outline: none; color: var(--gold-100); }
.search__name, .search__tag {
  background: transparent; border: 0; color: var(--txt);
  font-family: var(--font-body); font-size: 13.5px; padding: 9px 10px;
}
.search__name { width: 150px; }
.search__tag { width: 56px; }
.search__name::placeholder, .search__tag::placeholder { color: var(--txt-faint); }
.search__name:focus, .search__tag:focus { outline: none; }
.search__hash { display: grid; place-items: center; color: var(--gold-400); font-family: var(--font-mono); font-size: 13px; padding: 0 2px; }
.search__go {
  font-family: var(--font-display); letter-spacing: .18em; text-transform: uppercase; font-size: 11px;
  color: var(--ink-900); border: 0; cursor: pointer; padding: 0 18px;
  background: linear-gradient(150deg, var(--gold-200), var(--gold-400));
  transition: filter .2s;
}
.search__go:hover { filter: brightness(1.12); }
.search__go:disabled { filter: grayscale(.6) brightness(.8); cursor: default; }

/* ============================================================
   Crawl progress banner
   ============================================================ */
.crawl {
  display: flex; align-items: center; gap: 12px; margin: 18px 2px 2px;
  border: 1px solid var(--gold-deep); background: linear-gradient(100deg, rgba(200,170,110,.08), transparent 70%);
  padding: 10px 16px;
  clip-path: polygon(0 5px, 5px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%);
}
.crawl__spin {
  width: 14px; height: 16px; flex-shrink: 0;
  background: linear-gradient(150deg, var(--gold-200), var(--gold-400));
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  animation: hexpulse 1.1s ease-in-out infinite;
}
@keyframes hexpulse { 0%,100% { opacity: .35; transform: scale(.82) rotate(0deg); } 50% { opacity: 1; transform: scale(1) rotate(180deg); } }
.crawl__text { font-family: var(--font-mono); font-size: 12.5px; letter-spacing: .04em; color: var(--gold-200); }

/* ============================================================
   Mode tabs (primary filter)
   ============================================================ */
.modetabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 22px 2px 4px; }
.mtab {
  font-family: var(--font-body); font-size: 12.5px; letter-spacing: .06em;
  color: var(--txt-dim); background: transparent; border: 1px solid var(--ink-line);
  padding: 8px 16px; cursor: pointer; transition: .2s;
  clip-path: polygon(0 5px, 5px 0, 100% 0, 100% calc(100% - 5px), calc(100% - 5px) 100%, 0 100%);
}
.mtab:hover { color: var(--gold-100); border-color: var(--gold-400); background: rgba(200,170,110,.06); }
.mtab[aria-selected="true"] {
  color: var(--ink-900); font-weight: 600; border-color: var(--gold-200);
  background: linear-gradient(150deg, var(--gold-200), var(--gold-300));
  box-shadow: 0 3px 18px rgba(200,170,110,.2);
}

/* ============================================================
   Arena augments panel
   ============================================================ */
.panel--augments { margin-top: 16px; }
.auggrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.aug {
  display: flex; align-items: center; gap: 11px; padding: 9px 11px;
  border: 1px solid var(--ink-line); background: rgba(9,16,32,.5);
  opacity: 0; transform: translateY(8px); animation: rise .5s cubic-bezier(.2,.7,.2,1) forwards;
}
.aug__icon {
  width: 38px; height: 38px; flex-shrink: 0; position: relative;
  display: grid; place-items: center;
  background: radial-gradient(closest-side, rgba(200,170,110,.18), transparent);
  border: 1px solid var(--gold-deep);
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);   /* diamond — Arena motif */
}
.aug__icon img { width: 80%; height: 80%; object-fit: contain; }
.aug__icon .fb { color: var(--gold-300); font-size: 14px; }
.aug__meta { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.aug__name { font-size: 12.5px; color: var(--txt); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.aug__sub { font-family: var(--font-mono); font-size: 10.5px; color: var(--txt-dim); }
.aug__sub b.win  { color: var(--teal); }
.aug__sub b.loss { color: var(--crimson); }

/* clickable summoner name in the scoreboard */
.pcell__name.link {
  background: none; border: 0; padding: 0; cursor: pointer; text-align: left;
  font-family: var(--font-body); font-size: 12.5px; color: var(--txt);
  border-bottom: 1px solid transparent; transition: .18s; align-self: flex-start;
}
.pcell__name.link:hover { color: var(--gold-100); border-bottom-color: var(--gold-400); }
.pcell__name.link.me { color: var(--gold-200); }

/* ============================================================
   Homepage — the Summoning Gate
   ============================================================ */
.masthead__mark {
  background: none; border: 0; padding: 0; cursor: pointer;
  -webkit-tap-highlight-color: transparent; transition: filter .2s;
}
.masthead__mark:hover { filter: brightness(1.12); }
.masthead__mark:hover .masthead__wordmark { color: #fff; }
.masthead__mark:hover .hex { box-shadow: 0 0 20px rgba(200,170,110,.75); }
.masthead__search { display: flex; }

.home { position: relative; }
.home__hero {
  position: relative; text-align: center; isolation: isolate;
  padding: clamp(36px, 8vh, 92px) 16px clamp(30px, 5vh, 58px);
  overflow: hidden;
}
.home__hero::before {  /* signature aura */
  content: ""; position: absolute; top: -14%; left: 50%; transform: translateX(-50%);
  width: min(700px, 92vw); height: 440px; pointer-events: none; z-index: -2;
  background: radial-gradient(closest-side, rgba(42,214,196,.11), transparent 70%);
  filter: blur(10px);
}
.home__rings {
  position: absolute; inset: 0; display: grid; place-items: center;
  pointer-events: none; z-index: -1;
}
.home__rings i {
  position: absolute;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  border: 1px solid var(--ink-line); opacity: .55;
}
.home__rings i:nth-child(1) { width: 300px; height: 330px; animation: ringspin 46s linear infinite; }
.home__rings i:nth-child(2) { width: 470px; height: 510px; border-color: rgba(27,44,71,.55); animation: ringspin 78s linear infinite reverse; }
.home__rings i:nth-child(3) { width: 660px; height: 720px; border-color: rgba(27,44,71,.3); animation: ringspin 120s linear infinite; }
@keyframes ringspin { to { transform: rotate(360deg); } }

.home__eyebrow {
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .4em;
  text-transform: uppercase; color: var(--gold-400); margin: 0 0 18px;
  animation: homeRise .7s both;
}
.home__title {
  font-family: var(--font-display); font-weight: 700;
  font-size: clamp(34px, 6.6vw, 74px); line-height: 1.04; letter-spacing: .01em;
  color: var(--gold-100); margin: 0 0 22px;
  text-shadow: 0 2px 44px rgba(200,170,110,.12);
  animation: homeRise .7s .05s both;
}
.home__title em {
  font-style: italic; font-weight: 600;
  background: linear-gradient(110deg, var(--teal), var(--gold-200) 70%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.home__lede {
  max-width: 540px; margin: 0 auto 30px; color: var(--txt-dim);
  font-size: 15.5px; line-height: 1.65; animation: homeRise .7s .1s both;
}
.home__searchslot { animation: homeRise .7s .16s both; }
@keyframes homeRise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* hero variant of the (relocated) search console */
.search--hero {
  margin: 0 auto; width: 100%; max-width: 560px;
  clip-path: polygon(0 9px, 9px 0, 100% 0, 100% calc(100% - 9px), calc(100% - 9px) 100%, 0 100%);
  box-shadow: inset 0 0 0 1px rgba(200,170,110,.06), 0 22px 56px -26px rgba(0,0,0,.85);
}
.search--hero .search__region { font-size: 13px; padding: 0 30px 0 16px; }
.search--hero .search__name, .search--hero .search__tag { font-size: 16px; padding: 16px 12px; }
.search--hero .search__name { width: auto; flex: 1; min-width: 0; }
.search--hero .search__tag { width: 74px; }
.search--hero .search__hash { font-size: 15px; }
.search--hero .search__go { font-size: 12.5px; padding: 0 28px; letter-spacing: .2em; }
.search__go.is-busy { filter: grayscale(.45) brightness(.82); cursor: progress; }

/* Recent Summons */
.recents { margin-top: clamp(18px, 4vh, 44px); }
.recents__head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.recents__rune {
  width: 13px; height: 15px; flex-shrink: 0;
  background: linear-gradient(150deg, var(--gold-300), var(--gold-deep));
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}
.recents__title {
  font-family: var(--font-display); font-size: 13.5px; letter-spacing: .26em;
  text-transform: uppercase; color: var(--gold-200); white-space: nowrap;
}
.recents__line { flex: 1; height: 1px; background: linear-gradient(90deg, var(--ink-line), transparent); }
.recents__clear {
  background: none; border: 1px solid var(--ink-line); color: var(--txt-dim);
  font-family: var(--font-mono); font-size: 11px; letter-spacing: .05em;
  padding: 5px 12px; cursor: pointer; transition: .2s; white-space: nowrap;
  clip-path: polygon(0 4px, 4px 0, 100% 0, 100% calc(100% - 4px), calc(100% - 4px) 100%, 0 100%);
}
.recents__clear:hover { color: var(--crimson); border-color: var(--crimson-deep); }

.recents__grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr)); gap: 12px; }

.recent {
  position: relative; display: flex; align-items: center; gap: 14px; text-align: left;
  cursor: pointer; padding: 14px 16px; transition: transform .22s ease, border-color .22s, background .22s, box-shadow .22s;
  border: 1px solid var(--ink-line);
  background: linear-gradient(160deg, rgba(18,32,54,.55), rgba(9,16,32,.55));
  clip-path: polygon(0 7px, 7px 0, 100% 0, 100% calc(100% - 7px), calc(100% - 7px) 100%, 0 100%);
  animation: cardRise .5s both;
}
.recent::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px;
  background: linear-gradient(180deg, var(--gold-300), transparent); opacity: 0; transition: .22s;
}
.recent:hover {
  border-color: var(--gold-400); transform: translateY(-2px);
  background: linear-gradient(160deg, rgba(26,42,68,.7), rgba(12,20,38,.7));
  box-shadow: 0 16px 32px -20px rgba(0,0,0,.85);
}
.recent:hover::before { opacity: 1; }
@keyframes cardRise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.recent__avatar {
  width: 44px; height: 50px; flex-shrink: 0; display: grid; place-items: center;
  background: linear-gradient(160deg, var(--ink-600), var(--ink-800));
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  box-shadow: 0 0 0 1px var(--gold-400); transition: box-shadow .22s;
}
.recent__avatar span { font-family: var(--font-display); font-size: 16px; color: var(--gold-300); text-transform: uppercase; }
.recent:hover .recent__avatar { box-shadow: 0 0 0 1px var(--gold-200), 0 0 18px rgba(200,170,110,.28); }

.recent__body { min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.recent__id { display: flex; align-items: baseline; gap: 5px; min-width: 0; }
.recent__name {
  font-family: var(--font-display); font-size: 16px; color: var(--gold-100); font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.recent__tag { font-family: var(--font-mono); font-size: 11px; color: var(--txt-faint); flex-shrink: 0; }
.recent__meta { display: flex; align-items: center; gap: 8px; }
.recent__region {
  font-family: var(--font-mono); font-size: 10px; letter-spacing: .1em; color: var(--gold-300);
  border: 1px solid var(--gold-deep); padding: 1px 7px;
  clip-path: polygon(0 3px, 3px 0, 100% 0, 100% calc(100% - 3px), calc(100% - 3px) 100%, 0 100%);
}
.recent__when { font-family: var(--font-mono); font-size: 11px; color: var(--txt-dim); }
.recent__x {
  position: absolute; top: 7px; right: 8px; width: 18px; height: 18px;
  display: grid; place-items: center; border-radius: 2px;
  color: var(--txt-faint); font-size: 16px; line-height: 1; opacity: 0; transition: .18s;
}
.recent:hover .recent__x { opacity: 1; }
.recent__x:hover { color: var(--crimson); background: rgba(214,69,80,.12); }

.recents__empty {
  grid-column: 1 / -1; display: flex; flex-direction: column; align-items: center; gap: 14px;
  text-align: center; padding: 46px 20px; border: 1px dashed var(--ink-line); color: var(--txt-dim);
  clip-path: var(--frame);
}
.recents__empty p { margin: 0; max-width: 360px; font-size: 13.5px; line-height: 1.6; }
.recents__emptysigil {
  width: 40px; height: 46px; opacity: .5;
  background: conic-gradient(from 30deg, var(--gold-400), var(--gold-deep), var(--gold-300), var(--gold-deep), var(--gold-400));
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  animation: ringspin 26s linear infinite;
}

/* ============================================================
   Game Balance — the win-probability state curve (A1.4)
   A neutral, per-game read of which side the game favored. Teal
   above the 50% baseline (your team), crimson below (enemy). Gold
   glyphs mark observed swings tied to factual, team-level events.
   ============================================================ */
.balance {
  margin-top: 16px;
  border: 1px solid var(--ink-line);
  clip-path: var(--frame);
  background: linear-gradient(180deg, rgba(13,22,40,.6), rgba(9,16,32,.4));
  padding: 16px 18px 18px;
  position: relative;
  animation: balReveal .6s cubic-bezier(.2,.8,.2,1) both;
}
.balance::before {  /* top gold hairline, matches .crest */
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-300), transparent);
  opacity: .5;
}
@keyframes balReveal { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.balance__head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.balance__title {
  font-family: var(--font-display); font-weight: 700; letter-spacing: .2em;
  text-transform: uppercase; font-size: 13px; color: var(--gold-100);
}
.balance__sub { font-size: 11px; letter-spacing: .04em; color: var(--txt-faint); }
.balance__sub--muted { color: var(--crimson); opacity: .8; }
.balance__final {
  margin-left: auto; font-family: var(--font-mono); font-size: 20px; font-weight: 500;
  display: flex; align-items: baseline; gap: 6px;
}
.balance__final i { font-size: 9px; letter-spacing: .18em; text-transform: uppercase; color: var(--txt-faint); font-style: normal; }
.balance__final.win { color: var(--teal); }
.balance__final.loss { color: var(--crimson); }
.balance__empty { color: var(--txt-dim); font-size: 12.5px; font-family: var(--font-mono); padding: 6px 0 2px; }

/* chart frame */
.balance__chart { position: relative; }
.balance__svg { width: 100%; height: 200px; display: block; overflow: visible; }
.balance__cap {
  position: absolute; right: 4px; font-size: 9px; letter-spacing: .14em;
  text-transform: uppercase; pointer-events: none; opacity: .7;
}
.balance__cap--top { top: 2px; color: var(--teal); }
.balance__cap--bot { bottom: 24px; color: var(--crimson); }

/* svg primitives */
.bal-base { stroke: var(--gold-300); stroke-width: 1; stroke-dasharray: 4 5; opacity: .55; }
.bal-grid { stroke: var(--ink-line); stroke-width: 1; opacity: .5; }
.bal-mlabel { fill: var(--txt-faint); font-family: var(--font-mono); font-size: 9px; }
.bal-area { opacity: .9; }
.bal-line {
  stroke-width: 2.2; stroke-linejoin: round; stroke-linecap: round;
  stroke-dasharray: 2600; stroke-dashoffset: 2600;
  animation: balDraw 1.25s cubic-bezier(.3,.7,.2,1) .1s forwards;
}
@keyframes balDraw { to { stroke-dashoffset: 0; } }
.bal-decided { fill: rgba(6,10,20,.5); }   /* veils the decided / garbage-time tail */

/* swing markers */
.bal-swing { opacity: 0; animation: balPop .4s ease 1s forwards; }
@keyframes balPop { from { opacity: 0; } to { opacity: 1; } }
.bal-stem { stroke: var(--gold-400); stroke-width: 1; opacity: .4; }
.bal-node { fill: var(--gold-200); stroke: var(--ink-900); stroke-width: 1.5; }
.bal-swing.up .bal-node { fill: var(--teal); }
.bal-swing.down .bal-node { fill: var(--crimson); }
.bal-glyph { fill: var(--gold-200); font-size: 12px; }

/* observed-swing legend */
.swings { list-style: none; margin: 16px 0 0; padding: 0; display: grid; gap: 1px; }
.swing {
  display: grid; grid-template-columns: 22px 38px 1fr auto; align-items: center; gap: 10px;
  padding: 8px 10px; background: rgba(18,32,54,.25);
  border-left: 2px solid var(--ink-line);
  animation: swingIn .45s cubic-bezier(.2,.8,.2,1) both;
}
.swing:nth-child(1) { animation-delay: .15s; } .swing:nth-child(2) { animation-delay: .22s; }
.swing:nth-child(3) { animation-delay: .29s; } .swing:nth-child(4) { animation-delay: .36s; }
.swing:nth-child(5) { animation-delay: .43s; }
@keyframes swingIn { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }
.swing.win { border-left-color: var(--teal-deep); }
.swing.loss { border-left-color: var(--crimson-deep); }
.swing__glyph { text-align: center; color: var(--gold-200); font-size: 13px; }
.swing.win .swing__glyph { color: var(--teal); }
.swing.loss .swing__glyph { color: var(--crimson); }
.swing__min { font-family: var(--font-mono); font-size: 12px; color: var(--txt-dim); }
.swing__label { font-size: 12.5px; color: var(--txt); }
.swing__delta { font-family: var(--font-mono); font-size: 12px; font-weight: 500; }
.swing.win .swing__delta { color: var(--teal); }
.swing.loss .swing__delta { color: var(--crimson); }

.balance__note {
  margin: 14px 0 0; padding-top: 12px; border-top: 1px dashed var(--ink-line);
  font-size: 10.5px; line-height: 1.5; color: var(--txt-faint); font-style: italic;
}

@media (max-width: 720px) {
  .masthead { justify-content: center; }
  .home__title { font-size: clamp(30px, 9vw, 48px); }
  .match { grid-template-columns: 5px 96px 1fr; }
  .kit { grid-column: 2 / -1; padding: 0 18px 16px; }
  .champ { padding: 14px 4px 4px; }
  .chev { display: none; }
  .crest__body { flex-direction: column; align-items: flex-start; }
  .codex__split { grid-template-columns: 1fr; }
  .crow { grid-template-columns: 34px 1fr 1.2fr 48px; }
  .crow__stat:nth-child(5), .crow__stat:nth-child(6) { display: none; }
  .balance__svg { height: 150px; }
  .swing { grid-template-columns: 18px 30px 1fr auto; gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
