@font-face { font-family: 'Cinzel'; font-weight: 500; font-display: swap; src: url('/fonts/cinzel-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Cinzel'; font-weight: 600; font-display: swap; src: url('/fonts/cinzel-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Cinzel'; font-weight: 700; font-display: swap; src: url('/fonts/cinzel-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-weight: 500; font-display: swap; src: url('/fonts/ibm-plex-mono-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-weight: 600; font-display: swap; src: url('/fonts/ibm-plex-mono-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-weight: 700; font-display: swap; src: url('/fonts/ibm-plex-mono-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 400; font-display: swap; src: url('/fonts/inter-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 500; font-display: swap; src: url('/fonts/inter-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 600; font-display: swap; src: url('/fonts/inter-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 700; font-display: swap; src: url('/fonts/inter-latin-700-normal.woff2') format('woff2'); }

:root {
  --navy-1: #0a0e18;
  --navy-2: #12172a;
  --navy-3: #1e2440;
  --gold: #c9a659;
  --gold-hi: #f1c96b;
  --gold-glow: rgba(241,201,107,.55);
  --gold-deep: #6b5324;
  --gold-line: rgba(201,166,89,.22);
  --gold-line-strong: rgba(201,166,89,.55);
  --jade: #5cbf67;
  --garnet: #e35b6a;
  --pearl: #eadfc0;
  --pearl-dim: #b5ad8e;
  --ash: #7a8098;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  background: transparent;
  color: var(--pearl);
  font: 12px/1.2 'Inter', 'Segoe UI', sans-serif;
  font-variant-numeric: tabular-nums;
}

.widget {
  position: relative;
  width: 460px; height: 160px;
  background:
    radial-gradient(140% 200% at 50% -30%, rgba(201,166,89,.09) 0%, transparent 45%),
    linear-gradient(180deg, #171c31 0%, var(--navy-2) 55%, var(--navy-1) 100%);
  border: 1px solid var(--gold-deep);
  border-radius: 3px;
  box-shadow:
    inset 0 0 0 1px rgba(201,166,89,.06),
    inset 0 1px 0 rgba(255,255,255,.03),
    0 6px 20px rgba(0,0,0,.6),
    0 0 0 1px rgba(0,0,0,.4);
  display: grid;
  grid-template-columns: 116px 1fr 100px;
  align-items: center;
  padding: 10px 10px 10px 4px;
  overflow: hidden;
  isolation: isolate;
}

/* Heraldic corner brackets — the signature device */
.bracket {
  position: absolute; width: 10px; height: 10px;
  border: 1px solid var(--gold);
  opacity: 0.9;
  pointer-events: none;
  z-index: 3;
}
.bracket--tl { top: 4px;    left: 4px;    border-right: none; border-bottom: none; }
.bracket--tr { top: 4px;    right: 4px;   border-left:  none; border-bottom: none; }
.bracket--bl { bottom: 4px; left: 4px;    border-right: none; border-top:    none; }
.bracket--br { bottom: 4px; right: 4px;   border-left:  none; border-top:    none; }

/* Faint horizontal hairline behind everything — heraldic scroll line */
.widget::before {
  content: '';
  position: absolute; inset: 0;
  background:
    linear-gradient(180deg, transparent 0, transparent calc(50% - 1px),
      var(--gold-line) calc(50% - 1px), var(--gold-line) calc(50% + 0px),
      transparent calc(50% + 1px)) no-repeat;
  opacity: .35;
  pointer-events: none;
  z-index: 0;
}
.widget::after {
  content: '';
  position: absolute; inset: 0;
  background:
    radial-gradient(60% 90% at 50% 110%, rgba(0,0,0,.45), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

/* Status corner-dots (offline/key-invalid/throttled) */
.widget--offline .session-lp .arrow { color: var(--garnet); }
.widget--offline > .status-dot,
.widget--key-invalid > .status-dot,
.widget--throttled > .status-dot { display: block; }
.widget > .status-dot { display: none; position: absolute; top: 3px; right: 18px;
  width: 5px; height: 5px; border-radius: 50%; z-index: 4; }
.widget--offline .status-dot     { background: var(--garnet); box-shadow: 0 0 6px var(--garnet); }
.widget--key-invalid .status-dot { background: #f0a5d4; box-shadow: 0 0 6px #f0a5d4; }
.widget--throttled .status-dot   { background: #fbbf24; box-shadow: 0 0 6px #fbbf24; }

/* Rank column */
.rank-col {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  position: relative; z-index: 2;
}
.rank-col img {
  width: 108px; height: 108px;
  object-fit: cover;
  filter:
    drop-shadow(0 0 14px var(--gold-glow))
    drop-shadow(0 3px 6px rgba(0,0,0,.75));
}
.rank-label {
  font-family: 'Cinzel', serif;
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--gold-hi);
  font-weight: 600;
  text-transform: uppercase;
  text-shadow: 0 0 8px rgba(201,166,89,.4);
  margin-top: -1px;
}

/* Views container */
.views {
  position: relative; height: 100%;
  padding: 0 12px 0 6px;
  z-index: 2;
}
.view {
  position: absolute; inset: 0; padding: 6px 4px;
  opacity: 0; transform: translateY(6px);
  transition: opacity 320ms ease, transform 320ms ease;
  pointer-events: none;
}
.view--active { opacity: 1; transform: none; }
/* Hidden by URL param ?views=…  — kept out of both the rotation cycle and layout. */
.view--hidden { display: none; }

/* URL param ?size=compact | ?size=full — layered as body classes.
   Compact halves the width for streamers who want a tighter overlay. */
body.size-compact .widget { width: 280px; height: 130px; }
body.size-compact .rank-col { transform: scale(0.85); transform-origin: left center; }

/* View 1: name, LP, last-5 mini portraits */
.view1-header {
  display: flex; justify-content: center; align-items: baseline;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--gold-line);
}
.view1-header .name {
  font-family: 'Cinzel', serif;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--pearl);
  text-shadow: 0 1px 2px rgba(0,0,0,.6);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 100%;
}
.view1-header .lp {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 15px;
  font-weight: 600;
  color: var(--pearl);
}
.view1-header .lp b { font-weight: 600; color: var(--gold-hi); }
.view1-header .lp em {
  font-style: normal;
  font-family: 'Cinzel', serif;
  font-size: 8px;
  letter-spacing: 0.14em;
  color: var(--pearl-dim);
  margin-left: 3px;
  vertical-align: 2px;
}

.item-row { display: flex; gap: 4px; }
.item-row .item {
  width: 32px; height: 32px; background: #0a0d18;
  border-radius: 2px; overflow: hidden; flex-shrink: 0;
  border: 1px solid rgba(201,166,89,.15);
}
.item-row .item img { width: 100%; height: 100%; object-fit: cover; }

/* Mini match portraits (view 1) */
.mini-match {
  width: 36px; height: 36px; border-radius: 2px; overflow: hidden;
  background: #0a0d18; flex-shrink: 0;
  border: 1px solid rgba(201,166,89,.2);
  position: relative;
  box-shadow: 0 2px 4px rgba(0,0,0,.5);
}
.mini-match img { width: 100%; height: 100%; object-fit: cover; display: block; }
.mini-match::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0;
  height: 2px; background: transparent;
}
.mini-match.win::after  { background: var(--jade);   box-shadow: 0 0 6px var(--jade); }
.mini-match.loss::after { background: var(--garnet); box-shadow: 0 0 6px var(--garnet); }
.mini-match.remake      { filter: grayscale(1) brightness(0.55); border-color: rgba(255,255,255,.15); }
.mini-match.remake::after { background: var(--ash); box-shadow: none; }

/* Aegis of Valor accent — hairline gold stripe at top matching W/L stripe at bottom */
.mini-match.has-aegis {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px var(--gold-glow), 0 2px 4px rgba(0,0,0,.5);
}
.mini-match.has-aegis::before {
  content: '';
  position: absolute; left: 0; right: 0; top: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold-hi), transparent);
  box-shadow: 0 0 6px var(--gold-glow);
}

.last5-list li.has-aegis {
  border-left: 2px solid var(--gold-hi);
  padding-left: 6px;
  margin-left: -8px;
  border-bottom-color: rgba(201,166,89,.2);
}
.last5-list li.has-aegis .name { color: var(--gold-hi); }
.mini-match.empty {
  background: rgba(255,255,255,.02);
  border-style: dashed;
  border-color: rgba(201,166,89,.1);
  opacity: 0.35;
}

/* View 2: tier progress bar */
.tier-row {
  display: flex; align-items: center; gap: 12px;
  margin-top: 42px;
  margin-bottom: 8px;
}
.tier-side {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.06em;
  flex: 0 0 auto;
  color: var(--pearl);
  text-shadow: 0 1px 2px rgba(0,0,0,.7);
}
#v2-lo { color: var(--gold-hi); }
#v2-hi { color: var(--garnet); }

.tier-bar {
  position: relative; flex: 1 1 auto; height: 8px;
  border-radius: 4px;
  background: rgba(0,0,0,.35);
  border: 1px solid rgba(201,166,89,.25);
  box-shadow: inset 0 1px 2px rgba(0,0,0,.6);
  overflow: hidden;
}
.tier-fill {
  position: absolute; top: 0; left: 0; height: 100%;
  width: 0%;
  border-radius: 4px 0 0 4px;
  background: linear-gradient(90deg, var(--gold-deep) 0%, var(--gold) 60%, var(--gold-hi) 100%);
  box-shadow: 0 0 8px var(--gold-glow), inset 0 -1px 0 rgba(0,0,0,.3);
  transition: width 400ms ease;
}
.tier-marker {
  position: absolute; top: -18px; left: 0%;
  transform: translateX(-50%);
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600; font-size: 12px;
  color: var(--gold-hi);
  white-space: nowrap; padding: 0 4px;
  text-shadow: 0 1px 3px rgba(0,0,0,.85);
  pointer-events: none;
}
.tier-marker::after {
  /* Diamond marker instead of vertical line */
  content: '';
  position: absolute; top: 20px; left: 50%;
  width: 10px; height: 10px;
  background: linear-gradient(135deg, #ffe8a3, var(--gold-hi));
  transform: translate(-50%, 0) rotate(45deg);
  box-shadow: 0 0 10px var(--gold-hi), 0 0 0 1px rgba(0,0,0,.5);
  border-radius: 1px;
}
.tier-bar { overflow: visible; }
.tier-fill { border-radius: 4px 0 0 4px; }
.tier-bounds {
  display: flex; justify-content: space-between;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 9px;
  color: var(--pearl-dim);
  letter-spacing: 0.05em;
  padding: 0 22px;
}

/* View 3: last match detail */
.champ-portrait {
  width: 52px; height: 52px; border-radius: 3px;
  float: left; margin-right: 10px;
  border: 1px solid rgba(201,166,89,.3);
  box-shadow: 0 2px 6px rgba(0,0,0,.6);
}
.champ-details { overflow: hidden; }
.kda {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 15px; font-weight: 700;
  margin-bottom: 4px;
  letter-spacing: 0.02em;
  text-shadow: 0 1px 2px rgba(0,0,0,.7);
}
.kda.win  { color: var(--jade);   }
.kda.loss { color: var(--garnet); }
.micro-row { display: flex; align-items: flex-start; gap: 3px; flex-wrap: wrap; }
.micro { width: 22px; height: 22px; border-radius: 2px; flex-shrink: 0;
  border: 1px solid rgba(201,166,89,.15); }
.micro-items {
  display: grid;
  grid-template-columns: repeat(3, 26px) 30px;
  grid-template-rows: repeat(2, 26px);
  column-gap: 3px;
  row-gap: 3px;
  flex-basis: 100%;
  margin-top: 4px; margin-left: 0;
}
.micro-items .item { width: 26px; height: 26px; }
.micro-items .item.trinket {
  width: 26px; height: 26px;
  grid-column: 4;
  grid-row: 1 / 3;
  align-self: center;
  justify-self: end;
  margin-left: 4px;
  border-color: var(--gold);
  box-shadow: 0 0 6px var(--gold-glow);
}
.micro-items:has(.item.role-quest) .item.trinket {
  grid-row: 1;
  align-self: end;
}
.micro-items .item.role-quest {
  width: 26px; height: 26px;
  grid-column: 4;
  grid-row: 2;
  align-self: start;
  justify-self: end;
  margin-left: 4px;
  border-color: var(--jade);
  box-shadow: 0 0 6px rgba(92,191,103,.5);
}

/* View 4: last 5 list */
.last5-list {
  list-style: none;
  display: flex; flex-direction: column;
  gap: 4px;
  height: 100%;
  justify-content: center;
  padding-top: 2px;
}
.last5-list li {
  display: grid;
  grid-template-columns: 24px 1fr 72px 22px;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  padding-bottom: 3px;
  border-bottom: 1px solid rgba(201,166,89,.06);
}
.last5-list li:last-child { border-bottom: none; }
.last5-list img { width: 24px; height: 24px; border-radius: 2px;
  border: 1px solid rgba(201,166,89,.15); }
.last5-list .name {
  font-family: 'Cinzel', serif;
  font-weight: 500;
  letter-spacing: 0.03em;
  color: var(--pearl);
  font-size: 11px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.last5-list .kda {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 11px; font-weight: 500;
  color: var(--pearl-dim);
  margin-bottom: 0;
  text-shadow: none;
}
.last5-list .result {
  font-family: 'Cinzel', serif;
  font-size: 12px; font-weight: 700;
  text-align: center;
}
.last5-list .result.win  { color: var(--jade);   text-shadow: 0 0 6px rgba(92,191,103,.4); }
.last5-list .result.loss { color: var(--garnet); text-shadow: 0 0 6px rgba(227,91,106,.4); }
.last5-list .result.remake { color: var(--ash); }
.last5-list li.is-remake { opacity: 0.5; }
.last5-list li.is-remake img { filter: grayscale(1); }
.last5-list li.is-remake .name, .last5-list li.is-remake .kda { color: var(--ash); }

.last5-list .last5-placeholder { opacity: 0.22; }
.last5-list .last5-placeholder .placeholder-dot {
  width: 18px; height: 18px; border-radius: 2px;
  background: rgba(201,166,89,.08);
  border: 1px dashed rgba(201,166,89,.15);
  justify-self: center;
}
.last5-list .last5-placeholder .placeholder-bar {
  height: 5px; width: 60%; border-radius: 3px;
  background: rgba(201,166,89,.08);
}

/* Session column */
.session-col {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  height: 100%;
  gap: 4px;
  position: relative;
  z-index: 2;
}
.session-col::before {
  /* thin gold hairline as divider instead of border-left */
  content: '';
  position: absolute;
  left: 0; top: 12px; bottom: 12px;
  width: 1px;
  background: linear-gradient(180deg,
    transparent 0,
    var(--gold-line-strong) 20%,
    var(--gold-line-strong) 80%,
    transparent 100%);
}
.session-label {
  font-family: 'Cinzel', serif;
  font-size: 9px;
  color: var(--gold);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 600;
}
.session-wl {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 16px; font-weight: 700;
  display: flex; align-items: baseline; gap: 2px;
  text-shadow: 0 1px 2px rgba(0,0,0,.6);
}
.session-wl .win  { color: var(--jade);   }
.session-wl .loss { color: var(--garnet); }
.session-wl .wl-sep {
  font-family: 'Cinzel', serif;
  font-style: normal;
  font-size: 9px;
  color: var(--pearl-dim);
  letter-spacing: 0.1em;
  margin-left: 1px;
  margin-right: 4px;
}
.session-wl .wl-dot {
  font-style: normal;
  color: var(--gold);
  margin: 0 2px;
  font-size: 12px;
  align-self: center;
}
.session-lp {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 12px;
  color: var(--pearl-dim);
  display: flex; align-items: baseline; gap: 3px;
}
.session-lp .arrow {
  color: var(--gold-hi);
  font-size: 11px;
  transform: translateY(1px);
  display: inline-block;
}
.session-lp .wl-sep {
  font-family: 'Cinzel', serif;
  font-style: normal;
  font-size: 8px;
  color: var(--pearl-dim);
  letter-spacing: 0.1em;
  margin-left: 2px;
}
.session-lp.gain #s-arrow { color: var(--jade); }
.session-lp.gain #s-lp    { color: var(--jade); }
.session-lp.loss #s-arrow { color: var(--garnet); }
.session-lp.loss #s-lp    { color: var(--garnet); }
