/* Full screens: title, champion pick, lobby, match intro, results. Tokens only. */
#ui { position: absolute; inset: 0; pointer-events: none; z-index: var(--z-hud); }
.screen { position: absolute; inset: 0; pointer-events: auto; overflow: hidden; background: var(--bg-0); }
.backdrop {
  position: absolute;
  inset: -20px;
  background: url('../content/ed8ba37a19d7304b00cd0fb959e53e127ea28092cfb9539283a053130a25e324.png') center / cover;
  filter: blur(5px) brightness(0.38) saturate(0.85);
}
.backdrop.dark { filter: blur(8px) brightness(0.2); }
.spr { display: block; flex: none; }

/* Front screens (title, champion select, lobby) share one scene and one visual language:
 * full-strength art, a shade only where text sits, words instead of boxes, one gold plate per screen. */
.front { background: var(--bg-0); }
/* Title scene: Pixel Studio layers at 480x270 scaled to cover (--u = screen px per scene px), cropped at the edges. */
.tscene { position: absolute; width: calc(480 * var(--u)); height: calc(270 * var(--u)); --px: 0; --py: 0; }
.tworld { position: absolute; inset: 0; }
.tworld > * { position: absolute; translate: calc(var(--px) * var(--d) * -16 * var(--u)) calc(var(--py) * var(--d) * -10 * var(--u)); transition: translate 700ms cubic-bezier(0.2, 0.7, 0.2, 1); }
.tl {
  left: calc(-16 * var(--u));
  top: calc(-16 * var(--u));
  width: calc(512 * var(--u));
  height: calc(302 * var(--u));
  background: center / 100% 100% no-repeat;
  image-rendering: pixelated;
}
.tl-sky { background-image: url('../content/3ffb590cab2431803387e2afc352165117abb95c59c535305b9e0dbc373e6e1a.png'); }
.tl-far { background-image: url('../content/149d898c3b3fbf6f2b783d171205e3f30f2c5da2a66f99b87c7eb87e4f7044b4.png'); }
.tl-gate { background-image: url('../content/996d5dfa158ec72975af70f62988f04549629aeb57c595ece00c67cef8521ce0.png'); }
.tl-firelight { background-image: url('../content/38afe169d35e532fabcef860935f6758a7516a654942cdb3d6dcfe83af5f6dbb.png'); animation: flicker 1.9s steps(1) infinite; }
.tl-fog { background-image: url('../content/920f0f3bf98c0677b36b5a1a91c52f4a2de9bf5cad0a59799aa5712b401a7609.png'); animation: fog-drift 16s ease-in-out infinite alternate; }
.tl-front { background-image: url('../content/675175c218321e9d7e3127015c1daef6591ac30fa781c836842343e4358f1113.png'); }
/* Six-frame fire strips stepped at 100 ms. */
.tl-gatefire, .tl-brazier { background-size: 600% 100%; background-position: 0 0; animation: fire 600ms steps(6) infinite; }
.tl-gatefire { background-image: url('../content/0fae5ef323817a90d19f580428f6d4d0854f6d087187520afcccef9b71377d26.png'); }
.tl-brazier { background-image: url('../content/6c90e2084a37ee51c7dcb6c29fe3d78944d206525bb85e959e5a252cdce45a16.png'); animation-duration: 660ms; }
@keyframes fire { to { background-position: 120% 0; } }
@keyframes flicker {
  0%, 100% { filter: brightness(1); }
  18% { filter: brightness(0.82); }
  31% { filter: brightness(1.08); }
  52% { filter: brightness(0.9); }
  71% { filter: brightness(1.04); }
  86% { filter: brightness(0.86); }
}
@keyframes fog-drift { from { transform: translateX(calc(-8 * var(--u))); } to { transform: translateX(calc(8 * var(--u))); } }
/* Warm bloom from the arch, breathing with the fire. */
.tglow {
  left: calc(210 * var(--u));
  top: calc(110 * var(--u));
  width: calc(240 * var(--u));
  height: calc(170 * var(--u));
  background: radial-gradient(ellipse 50% 50% at 50% 62%, color-mix(in srgb, var(--physical) 34%, transparent), transparent 70%);
  mix-blend-mode: screen;
  animation: breathe 2.6s ease-in-out infinite alternate;
}
@keyframes breathe { from { opacity: 0.55; } to { opacity: 0.8; } }
.twinkles { inset: 0; }
.twinkles i { position: absolute; width: var(--u); height: var(--u); background: var(--text); animation: twinkle 4.2s ease-in-out infinite; }
@keyframes twinkle { 0%, 100% { opacity: 0.2; } 50% { opacity: 1; box-shadow: 0 0 calc(var(--u) * 1.5) var(--text-dim); } }
/* The real champions, backlit by the gate fire: dark bodies with a hot rim. */
.champs { inset: 0; }
.champ { position: absolute; }
.tscene.loading > * { visibility: hidden; }
.tscene.loading > .tstart { visibility: visible; }
.tstart {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  margin: 0;
  text-align: center;
  font-family: var(--font-head);
  font-size: var(--t-l);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-dim);
  animation: beckon 1.6s ease-in-out infinite alternate;
}
@keyframes beckon { from { opacity: 0.35; } to { opacity: 1; } }
.champ .spr {
  filter: brightness(0.34) saturate(0.7) drop-shadow(0 calc(var(--u) * -0.5) 0 var(--you)) drop-shadow(calc(var(--u) * 0.5) 0 0 var(--physical))
    drop-shadow(calc(var(--u) * -0.5) 0 0 var(--physical));
}
.tembers { inset: 0; pointer-events: none; }
.tembers i {
  position: absolute;
  top: calc(218 * var(--u));
  width: calc(var(--s) * var(--u));
  height: calc(var(--s) * var(--u));
  background: var(--you-light);
  animation: lift linear infinite;
  opacity: 0;
}
@keyframes lift {
  0% { transform: translate(0, 0); opacity: 0; background: var(--you-light); }
  12% { opacity: 1; }
  60% { background: var(--physical); }
  100% { transform: translate(calc(-14 * var(--u)), calc(-120 * var(--u))); opacity: 0; background: var(--enemy); }
}
.tflash { position: absolute; inset: 0; background: var(--text); opacity: 0; pointer-events: none; }
.tlogo { position: absolute; left: calc(6 * var(--u)); top: calc(6 * var(--u)); margin: 0; line-height: 0; }
.tlogo img { width: calc(162 * var(--u)); image-rendering: pixelated; display: block; filter: drop-shadow(0 calc(var(--u) * 1.5) 0 var(--shadow)); }
/* A metal glint crossing the logo every few seconds, clipped to the logo's own pixels. */
.tlogo::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 40%, color-mix(in srgb, var(--you-light) 85%, transparent) 50%, transparent 60%) 160% 0 / 250% 100% no-repeat;
  -webkit-mask: url('../content/8bdc18872f9fa1dc4122b126469aa892ffc855bbf30540783a2141db0f048e4c.png') 0 0 / 100% 100%;
  mask: url('../content/8bdc18872f9fa1dc4122b126469aa892ffc855bbf30540783a2141db0f048e4c.png') 0 0 / 100% 100%;
  mix-blend-mode: screen;
  animation: glint 8s ease-in-out 2s infinite;
}
@keyframes glint {
  0%, 84% { background-position: 160% 0; }
  100% { background-position: -60% 0; }
}
.tmenu { position: absolute; left: calc(10 * var(--u)); top: calc(92 * var(--u)); }
.tmenu .menu { zoom: var(--ui-scale); }
.tscene.night .tworld { filter: brightness(0.6) saturate(0.85); }
.tscene.night .tl-fog { opacity: 0.6; }

/* The opening, first visit only (any key or click skips): the camera pulls back from the moon, the braziers
 * light, the gate erupts, the champions step out of the fire, a white hit, the logo strikes, the menu follows. */
.tscene.opening { animation: shake 320ms ease-out 1.05s both; }
.tscene.opening .tworld { animation: pull-back 1.5s cubic-bezier(0.25, 0, 0.2, 1) both; transform-origin: 86% 18%; }
.tscene.opening :is(.tl-brazier, .tl-firelight) { opacity: 0; animation: ignite 250ms ease-out 0.6s forwards, fire 660ms steps(6) infinite; }
.tscene.opening .tl-firelight { animation: ignite 250ms ease-out 0.6s forwards, flicker 1.9s steps(1) infinite; }
.tscene.opening .tl-gatefire { animation: erupt 450ms cubic-bezier(0.2, 0.9, 0.3, 1) 1.05s both, fire 600ms steps(6) infinite; }
.tscene.opening .tglow { animation: bloom 1s ease-out 1.05s both, breathe 2.6s ease-in-out 2.1s infinite alternate; }
.tscene.opening .tembers { animation: ignite 400ms ease-out 1.2s both; }
.tscene.opening .champ { animation: emerge 450ms cubic-bezier(0.2, 0.8, 0.3, 1) both; animation-delay: calc(1.35s + var(--i) * 70ms); }
.tscene.opening .tflash { animation: hit 500ms ease-out 2.1s both; }
.tscene.opening .tlogo { animation: strike 450ms cubic-bezier(0.2, 1.4, 0.4, 1) 2.15s both; }
.tscene.opening .tmenu { animation: rise 350ms cubic-bezier(0.2, 0.8, 0.3, 1) 2.5s both; }
.title-screen.holding :is(.corner-tr, .fineprint) { visibility: hidden; }
.title-screen.opening :is(.corner-tr, .fineprint) { animation: rise 350ms ease-out 2.6s both; }
@keyframes pull-back {
  from { transform: scale(1.6); filter: brightness(0); }
  25% { filter: brightness(0.7); }
  to { transform: none; filter: none; }
}
@keyframes ignite { from { opacity: 0; } to { opacity: 1; } }
@keyframes erupt { from { opacity: 0; clip-path: inset(85% 0 0 0); } to { opacity: 1; clip-path: inset(0 0 0 0); } }
@keyframes bloom { from { opacity: 0; } 18% { opacity: 1; } to { opacity: 0.55; } }
@keyframes shake {
  0%, 100% { transform: none; }
  20% { transform: translate(calc(var(--u) * 1), calc(var(--u) * -1)); }
  45% { transform: translate(calc(var(--u) * -1), calc(var(--u) * 1)); }
  70% { transform: translate(calc(var(--u) * 0.5), 0); }
}
@keyframes emerge { from { opacity: 0; transform: translateY(calc(6 * var(--u))); } to { opacity: 1; transform: none; } }
@keyframes hit { 0% { opacity: 0; } 12% { opacity: 0.9; } 100% { opacity: 0; } }
@keyframes strike { from { opacity: 0; transform: scale(1.5); } 60% { opacity: 1; transform: scale(0.97); } to { opacity: 1; transform: none; } }

.menu { display: flex; flex-direction: column; align-items: flex-start; gap: var(--s2); }
.menu-item {
  position: relative;
  background: none;
  border: none;
  padding: var(--s1) 0 var(--s1) var(--s6);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: var(--t-xl);
  text-align: left;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--text-dim);
  text-shadow: 0 3px 0 var(--bg-0);
  outline: none;
  transition: color 120ms, transform 160ms cubic-bezier(0.2, 0.9, 0.3, 1.3);
}
.menu-item::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  width: 12px;
  height: 18px;
  margin-top: -9px;
  background: var(--you);
  clip-path: polygon(0 0, 100% 50%, 0 100%, 0 75%, 50% 50%, 0 25%);
  opacity: 0;
  transform: translateX(-10px);
  transition: opacity 120ms, transform 160ms;
}
.menu-item:is(:hover, :focus-visible, .virtual-hover, .open):not(:disabled) { color: var(--you-light); transform: translateX(8px); }
.menu-item:is(:hover, :focus-visible, .virtual-hover, .open):not(:disabled)::before { opacity: 1; transform: none; }
.menu-item:disabled { color: var(--text-faint); cursor: default; }
.menu-item.hero { font-size: var(--t-display); color: var(--you); letter-spacing: 0; }
.menu-item.gold { color: var(--you); }
.menu-hero { display: flex; flex-direction: column; align-items: flex-start; margin-bottom: var(--s3); }
.menu-caption { padding-left: var(--s6); font-size: var(--t-s); color: var(--text-faint); letter-spacing: 0.04em; }
.friends {
  display: flex;
  align-items: center;
  gap: var(--s3);
  margin: 0 0 var(--s3) var(--s6);
  padding: var(--s3) 0 var(--s3) var(--s4);
  border-left: 2px solid var(--you-deep);
  animation: open 220ms cubic-bezier(0.2, 0.8, 0.3, 1);
}
@keyframes open { from { opacity: 0; transform: translateY(-6px); } }
.input.code { width: 270px; letter-spacing: 0.04em; text-transform: uppercase; }
.menu-status { padding-left: var(--s6); color: var(--text-dim); }
.menu-error { padding-left: var(--s6); color: var(--enemy); font-weight: 700; max-width: 560px; }
.corner-tr { position: absolute; right: var(--s6); top: var(--s5); zoom: var(--ui-scale); display: flex; align-items: center; gap: var(--s4); }
.namechip { display: flex; align-items: center; gap: var(--s2); font-size: var(--t-s); cursor: text; }
.namechip input {
  background: none;
  border: none;
  border-bottom: 1px dashed transparent;
  padding: 2px 0;
  font-weight: 700;
  color: var(--text);
  outline: none;
}
.namechip:hover input, .namechip input:focus { border-bottom-color: var(--you-deep); }
.namechip::after { content: '✎'; color: var(--text-faint); }
.iconbtn { background: none; border: none; padding: var(--s2); color: var(--text-dim); display: inline-flex; }
.iconbtn .ico { width: 24px; height: 24px; }
.iconbtn:is(:hover, .virtual-hover) { color: var(--you-light); }
.fineprint { position: absolute; left: var(--s6); bottom: var(--s4); zoom: var(--ui-scale); font-size: var(--t-xs); color: var(--text-faint); }
/* Opening, first visit only: fade from black, the wordmark strikes in, the menu follows word by word. */
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }

/* Lobby: champion select, seats, bots and invite in one screen */
.lobby {
  position: absolute;
  inset: 0;
  zoom: var(--ui-scale);
  width: calc(100vw / var(--ui-scale));
  height: calc(100vh / var(--ui-scale));
  padding: var(--s5) var(--s7) var(--s5);
  display: grid;
  gap: var(--s4) var(--s6);
  animation: arrive 420ms cubic-bezier(0.2, 0.8, 0.3, 1);
}
@keyframes arrive { from { opacity: 0; transform: scale(1.03); } }
.back {
  background: none;
  border: none;
  padding: var(--s2) 0;
  font-family: var(--font-head);
  font-weight: 700;
  font-size: var(--t-m);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-dim);
  align-self: start;
}
.back:is(:hover, .virtual-hover) { color: var(--you-light); }
.hero-stage { position: relative; display: flex; align-items: flex-end; justify-content: center; min-height: 0; padding-bottom: 7%; }
.hero-light {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 34% 42% at 50% 66%, var(--you-glow) 0%, color-mix(in srgb, var(--you) 12%, transparent) 45%, transparent 100%);
}
.hero-shadow {
  position: absolute;
  bottom: 6%;
  left: 50%;
  width: 260px;
  height: 36px;
  margin-left: -130px;
  background: radial-gradient(ellipse, var(--shadow) 0%, transparent 70%);
}
.hero-figure { position: relative; animation: step-in 380ms cubic-bezier(0.2, 0.9, 0.3, 1.2); filter: drop-shadow(0 0 24px color-mix(in srgb, var(--you) 25%, transparent)); }
@keyframes step-in { from { opacity: 0; transform: translateY(14px) scale(0.97); } }
.hero-info { display: flex; flex-direction: column; gap: var(--s3); min-height: 0; align-self: start; animation: rise 260ms ease-out; }
.hero-tags { gap: var(--s4); }
.hero-name {
  font-size: var(--t-display);
  line-height: 1;
  text-transform: uppercase;
  color: var(--you);
  text-shadow: 0 4px 0 var(--you-edge), 0 8px 0 var(--shadow);
}
/* Silkscreen's "?" reads poorly; every random marker uses the body face. */
.random-hero .hero-name { font-family: var(--font-body); }
.hero-summary { font-size: var(--t-l); color: var(--text); max-width: 600px; }
.lane-tag { font-size: var(--t-xs); font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink); background: var(--you); padding: 2px var(--s2); }
.diff { gap: 3px; }
.diff i { width: 10px; height: 10px; background: var(--bg-3); border: 1px solid var(--line-strong); transform: rotate(45deg); }
.diff i.on { background: var(--you); border-color: var(--you-light); }
.kit { display: flex; gap: var(--s3); margin-top: var(--s3); }
.kit .slot { transition: transform 120ms; }
.kit .slot:hover { transform: translateY(-3px); }
.kit-text {
  display: grid;
  max-width: 620px;
  padding: var(--s3) var(--s4);
  background: color-mix(in srgb, var(--bg-0) 72%, transparent);
  border-left: 2px solid var(--you-deep);
}
.kit-text .kt { grid-area: 1 / 1; display: flex; flex-direction: column; gap: var(--s1); }
.kit-text .kt.off { visibility: hidden; }
.kit-text b { font-family: var(--font-head); font-size: var(--t-l); }
.kit-all { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); margin: 0; padding: 0; }
.select-bottom { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s6); }
.ccard {
  position: relative;
  width: 108px;
  padding: 0;
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--s1);
  color: var(--text-dim);
  transition: transform 140ms cubic-bezier(0.2, 0.9, 0.3, 1.3);
}
.ccard img {
  width: 96px;
  height: 96px;
  display: block;
  image-rendering: pixelated;
  border: 2px solid var(--line-strong);
  box-shadow: 0 0 0 2px var(--bg-0), 0 6px 14px var(--shadow);
  filter: brightness(0.8) saturate(0.85);
  transition: filter 120ms, border-color 120ms;
}
.ccard .cname { font-family: var(--font-head); font-weight: 700; font-size: var(--t-s); text-transform: uppercase; letter-spacing: 0.02em; white-space: nowrap; }
.ccard:is(:hover, .virtual-hover):not(:disabled) { transform: translateY(-4px); color: var(--text); }
.ccard:is(:hover, .virtual-hover):not(:disabled) img { filter: none; border-color: var(--text-dim); }
.ccard.sel { transform: translateY(-8px); color: var(--you); }
.ccard .random-face { width: 96px; height: 96px; display: grid; place-items: center; font-family: var(--font-body); font-weight: 700; font-size: var(--t-xl); color: var(--text-faint); border: 2px dashed var(--line-strong); background: color-mix(in srgb, var(--bg-1) 70%, transparent); }
.ccard.random:is(:hover, .virtual-hover) .random-face { color: var(--you); border-color: var(--you); }
.ccard.sel img { filter: none; border-color: var(--you); box-shadow: 0 0 0 2px var(--bg-0), 0 0 0 4px var(--you-deep), 0 0 26px var(--you-glow); }
.ccard.taken { cursor: not-allowed; }
.ccard.taken img { filter: grayscale(1) brightness(0.4); }
.ccard .takenby, .ccard .enemytag {
  position: absolute;
  top: 36px;
  left: 6px;
  right: 6px;
  text-align: center;
  font-weight: 700;
  font-size: var(--t-xs);
  background: var(--scrim-strong);
  padding: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ccard .enemytag { top: 74px; color: var(--enemy); }
.lockin { display: flex; flex-direction: column; align-items: flex-end; gap: var(--s3); }
.lanes { display: flex; align-items: center; gap: var(--s3); }
.seg { display: flex; border: 2px solid var(--line-strong); background: color-mix(in srgb, var(--bg-0) 80%, transparent); }
.seg button {
  background: none;
  border: none;
  padding: var(--s2) var(--s4);
  font-weight: 700;
  font-size: var(--t-s);
  color: var(--text-dim);
}
.seg button + button { border-left: 2px solid var(--line); }
.seg button:is(:hover, .virtual-hover):not(:disabled) { color: var(--text); background: var(--bg-2); }
.seg button.on { color: var(--ink); background: var(--you); }
.seg button:disabled { color: var(--text-faint); text-decoration: line-through; cursor: not-allowed; }
/* The one primary action: an angled gold plate, like a struck ingot. */
.plate {
  position: relative;
  min-width: 380px;
  padding: var(--s4) var(--s7);
  border: none;
  clip-path: polygon(18px 0, 100% 0, calc(100% - 18px) 100%, 0 100%);
  background:
    linear-gradient(100deg, transparent 40%, color-mix(in srgb, var(--you-light) 70%, transparent) 50%, transparent 60%) 200% 0 / 250% 100% no-repeat,
    linear-gradient(180deg, var(--you-light) 0%, var(--you) 48%, var(--you-deep) 100%);
  color: var(--ink);
  font-family: var(--font-head);
  font-weight: 700;
  font-size: var(--t-xl);
  text-transform: uppercase;
  letter-spacing: 0.02em;
  transition: filter 120ms, transform 120ms;
}
.plate:is(:hover, .virtual-hover):not(:disabled) { filter: brightness(1.1); animation: shine 700ms ease-out; }
.plate:active:not(:disabled) { transform: translateY(2px); }
.plate:disabled { background: var(--bg-3); color: var(--text-faint); cursor: not-allowed; }
@keyframes shine { from { background-position: 200% 0, 0 0; } to { background-position: -60% 0, 0 0; } }

.select-title { gap: 0; }
.select-title h2 { text-transform: uppercase; }

/* Lobby grid: header; blue seats | champion stage | red seats; roster and start. */
.lobby { grid-template-columns: 370px minmax(0, 1fr) 370px; grid-template-rows: auto minmax(0, 1fr) auto; }
.lobby-top { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr auto 1fr; align-items: start; }
.lobby-top .back { justify-self: start; }
.lobby-top .select-title { align-items: center; text-align: center; }
.invite { justify-self: end; display: flex; align-items: center; gap: var(--s4); padding: var(--s2) var(--s4); background: color-mix(in srgb, var(--bg-0) 72%, transparent); border-right: 3px solid var(--you-deep); }
.invite .col { gap: 0; align-items: flex-end; }
/* Room codes are case-sensitive, so they use the legible body face, not the pixel one. */
.roomcode { font-weight: 700; font-size: var(--t-l); letter-spacing: 0.12em; font-variant-numeric: tabular-nums; color: var(--you); text-shadow: 0 2px 0 var(--you-edge); }
.team { display: flex; flex-direction: column; gap: var(--s3); align-self: center; }
.team h3 { padding-bottom: var(--s2); border-bottom: 3px solid var(--ally); text-transform: uppercase; letter-spacing: 0.06em; }
.team.red h3 { border-color: var(--enemy); text-align: right; }
.team.blue h3 { color: var(--ally); }
.team.red h3 { color: var(--enemy); }
.lobby .team.red { grid-column: 3; grid-row: 2; }
.lobby .team.blue { grid-column: 1; grid-row: 2; }
.pslot {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--s3);
  padding: var(--s2) var(--s3);
  min-height: 80px;
  width: 100%;
  color: var(--text);
  text-align: left;
  background: linear-gradient(90deg, color-mix(in srgb, var(--bg-1) 92%, transparent), color-mix(in srgb, var(--bg-1) 55%, transparent));
  border: none;
  border-left: 3px solid var(--line-strong);
  animation: seat-in 320ms cubic-bezier(0.2, 0.9, 0.3, 1.2) backwards;
}
@keyframes seat-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
.team.red .pslot { flex-direction: row-reverse; text-align: right; border-left: none; border-right: 3px solid var(--line-strong); background: linear-gradient(270deg, color-mix(in srgb, var(--bg-1) 92%, transparent), color-mix(in srgb, var(--bg-1) 55%, transparent)); }
.pslot.you { border-color: var(--you) !important; background: linear-gradient(90deg, var(--you-soft), color-mix(in srgb, var(--bg-1) 55%, transparent)); }
.team.red .pslot.you { background: linear-gradient(270deg, var(--you-soft), color-mix(in srgb, var(--bg-1) 55%, transparent)); }
.pslot .who { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.pslot .nameline { display: flex; align-items: center; gap: var(--s2); min-width: 0; }
.team.red .pslot .nameline { flex-direction: row-reverse; }
.pslot .nameline b { font-size: var(--t-m); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pslot .nameline > span { flex: none; }
.host-tag { font-size: var(--t-xs); letter-spacing: 0.1em; text-transform: uppercase; color: var(--you); vertical-align: middle; }
/* Bot seats: dashed and quieter; the host clicks one to choose its champion. */
.pslot.bot { background: color-mix(in srgb, var(--bg-1) 45%, transparent); border-left-style: dashed; }
.team.red .pslot.bot { border-right-style: dashed; }
.seat-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--s3); padding: 0; background: none; border: none; color: inherit; text-align: inherit; }
.team.red .seat-main { flex-direction: row-reverse; }
.seat-main:disabled { cursor: default; }
.seat-edit { font-size: var(--t-xs); font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-faint); opacity: 0; transition: opacity 120ms; }
.pslot.bot:is(:hover, .editing) .seat-edit { opacity: 1; color: var(--you); }
.pslot.bot:has(.seat-main:not(:disabled)):is(:hover, .editing) { background: color-mix(in srgb, var(--bg-2) 70%, transparent); }
.pslot .sit { flex: none; opacity: 0.75; }
.pslot:hover .sit { opacity: 1; }
.pslot .bot-random { flex: none; width: 48px; height: 48px; display: grid; place-items: center; font-family: var(--font-body); font-weight: 700; font-size: var(--t-xl); color: var(--text-faint); border: 2px dashed var(--line); }
.pslot .player-random { width: 64px; height: 64px; }
/* The host's bot champion picker opens beside the seat, toward the centre. */
.bot-picker {
  position: absolute;
  z-index: 3;
  top: 0;
  left: calc(100% + var(--s3));
  display: grid;
  grid-template-columns: repeat(5, 44px);
  gap: var(--s1);
  padding: var(--s3);
  background: var(--bg-1);
  border: 2px solid var(--line-strong);
  box-shadow: 0 12px 30px var(--shadow);
  animation: open 180ms cubic-bezier(0.2, 0.8, 0.3, 1);
}
.team.red .bot-picker { left: auto; right: calc(100% + var(--s3)); }
.bot-chip { width: 44px; height: 44px; padding: 0; display: grid; place-items: center; font-family: var(--font-body); font-weight: 700; font-size: var(--t-l); color: var(--text-dim); background: var(--bg-0); border: 2px solid var(--line); cursor: pointer; }
.bot-chip img { width: 100%; height: 100%; image-rendering: pixelated; display: block; filter: brightness(0.75); }
.bot-chip.on { border-color: var(--you); color: var(--you); }
.bot-chip.on img, .bot-chip:is(:hover, .virtual-hover):not(:disabled) img { filter: none; }
.bot-chip:is(:hover, .virtual-hover):not(:disabled) { border-color: var(--text-dim); }
.bot-chip:disabled { opacity: 0.25; cursor: default; }
.lobby-center { grid-column: 2; grid-row: 2; padding-top: var(--s6); display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: var(--s5); min-height: 0; }
.lobby-center .hero-name { font-size: var(--t-xl); }
.lobby-center .hero-summary { font-size: var(--t-m); min-height: calc(3 * 1.3em); }
.lobby .select-bottom { grid-column: 1 / -1; }
/* Roster: class filter over a wrapping grid of portraits, so more champions add rows instead of overflowing. */
.roster { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: var(--s2); }
.rfilter { display: flex; flex-wrap: wrap; gap: var(--s1); }
.rfilter button { background: none; border: none; border-bottom: 2px solid transparent; padding: var(--s1) var(--s2); font-size: var(--t-xs); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-faint); }
.rfilter button:is(:hover, .virtual-hover) { color: var(--text); }
.rfilter button.on { color: var(--you); border-bottom-color: var(--you); }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, 84px); gap: var(--s2) var(--s3); max-height: 250px; overflow-y: auto; padding: var(--s2) var(--s1) var(--s1); }
.lobby .ccard { width: 84px; }
.lobby .ccard img, .lobby .ccard .random-face { width: 72px; height: 72px; }
.lobby .ccard .cname { font-size: var(--t-xs); white-space: normal; text-align: center; line-height: 1.15; min-height: 2.3em; }
.lobby .ccard.sel { transform: translateY(-4px); }
.lobby .ccard .takenby { top: 26px; }
.lobby .ccard .enemytag { top: 54px; }

@media (prefers-reduced-motion: reduce) {
  .front *, .front *::before, .front *::after { animation: none !important; transition: none !important; }
  .embers { display: none; }
}

/* Results — one full-height column: banner, scrollable content, buttons always visible */
.results-screen { z-index: var(--z-modal); }
.resview, .res {
  position: absolute;
  inset: 0;
  zoom: var(--ui-scale);
  width: calc(100vw / var(--ui-scale));
  height: calc(100vh / var(--ui-scale));
  display: flex;
  flex-direction: column;
  gap: var(--s4);
  padding: var(--s5) var(--s7);
}
.result-banner { text-align: center; flex: none; }
.result-banner h1 { font-size: var(--t-hero); }
h1.victory, h2.victory { color: var(--you); text-shadow: 0 6px 0 var(--you-edge), 0 0 60px var(--you-glow); }
h1.defeat, h2.defeat { color: var(--enemy); }
h1.draw, h2.draw { color: var(--text-dim); }
.resfoot { flex: none; gap: var(--s4); padding-top: var(--s3); border-top: 2px solid var(--line); }
.res-head { gap: var(--s5); }
.res-head .tabs { border: none; }
.mine { display: flex; gap: var(--s6); align-items: center; padding: var(--s4) var(--s5); }
.mine .k { display: flex; flex-direction: column; }
.wrap { flex-wrap: wrap; }
.table-wrap { overflow: auto; min-height: 0; flex: 1; }
.rtable { width: 100%; border-collapse: collapse; font-size: var(--t-s); }
.rtable th { text-align: left; font-size: var(--t-xs); color: var(--text-dim); padding: var(--s2) var(--s3); border-bottom: 2px solid var(--line); font-weight: 700; position: sticky; top: 0; background: var(--bg-0); }
.rtable td { padding: var(--s2) var(--s3); border-bottom: 1px solid var(--line); vertical-align: middle; }
.rtable tr.you td { background: var(--you-soft); }
.rtable tr.you td:first-child { box-shadow: inset 4px 0 0 var(--you); }
.rtable .sep td { padding: var(--s1) var(--s3); font-weight: 700; font-size: var(--t-xs); letter-spacing: 0.12em; border-bottom: 2px solid var(--line); }
.dbar { display: flex; align-items: center; gap: var(--s2); }
.dbar i { display: block; height: 10px; background: var(--physical); }
.graph { padding: var(--s4); flex: 1; min-height: 0; overflow: auto; }
.graph-host { margin-top: var(--s3); }
.graph-host .u-legend { color: var(--text-dim); font-size: var(--t-xs); }
