:root {
  color-scheme: dark;
  font-family: 'Trebuchet MS', system-ui, sans-serif;
  color: #faf0ff;
  background: #130f25;
  --pink: #ff94d4;
  --blue: #87e3ff;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100svh; background: radial-gradient(ellipse at 52% 0, #452951, transparent 66%), #130f25; }
button, input { font: inherit; }
button { cursor: pointer; color: inherit; border: 1px solid #ddc1ff42; background: #3c2e60; border-radius: 9px; min-height: 40px; padding: 8px 14px; font-weight: 800; }
button:hover:enabled { filter: brightness(1.18); }
button:active:enabled { transform: translateY(1px); }
button:disabled { opacity: .55; cursor: default; }
:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.shell { width: min(1150px, calc(100% - 44px)); margin: 0 auto; padding: 23px 0 17px; }
.mast { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 15px; }
.brand { display: inline-flex; gap: .38em; align-items: center; text-decoration: none; color: var(--pink); font-size: clamp(17px, 3vw, 33px); font-weight: 1000; font-style: italic; letter-spacing: -.055em; text-shadow: 0 0 22px #e759bf50; line-height: 1; }
.brand i { color: #fff0c6; font-size: .6em; padding: .35em .45em; border: 1px solid #fff0c661; border-radius: 5px; }
.brand span:last-child { color: var(--blue); }
.quiet { min-height: 34px; padding: 5px 10px; background: #ffffff0c; font-size: .78rem; }
.game { border: 1px solid #a779b9; border-radius: 16px; overflow: hidden; background: #251d41; box-shadow: 0 24px 60px #080512d9, 0 0 43px #a25cc62e; }
.hud { padding: 12px 15px; display: grid; grid-template-columns: minmax(0,1fr) clamp(54px,10vw,114px) minmax(0,1fr); align-items: center; gap: clamp(5px,1.5vw,21px); background: linear-gradient(110deg,#442448,#211a40 48%,#243654); }
.pink { --team: var(--pink); --bar: #dc59b7; }
.blue { --team: var(--blue); --bar: #538ee8; }
.player { display: flex; align-items: center; gap: clamp(6px,1vw,14px); min-width: 0; }
.player.blue { flex-direction: row-reverse; text-align: right; }
.portrait { width: clamp(37px,6vw,75px); aspect-ratio: 1; border-radius: 18%; background: color-mix(in srgb, var(--team) 32%, #362248); border: 1px solid var(--team); padding: 2px; }
.vitals { flex: 1; min-width: 0; }
small, .meters span { font-size: clamp(9px,1.25vw,12px); font-weight: 900; letter-spacing: .13em; color: var(--team,#d5bfed); }
.vitals strong { display: block; font-size: clamp(13px,2.25vw,28px); font-style: italic; line-height: 1.06; margin-bottom: 4px; }
progress { appearance: none; display: block; width: 100%; height: 11px; border: 1px solid #eadbff39; border-radius: 5px; overflow: hidden; background: #0f0b22; }
progress::-webkit-progress-bar { background: #0f0b22; }
progress::-webkit-progress-value { background: linear-gradient(90deg,var(--bar),var(--team)); transition: width .15s; }
progress::-moz-progress-bar { background: linear-gradient(90deg,var(--bar),var(--team)); }
.blue progress { direction: rtl; }
.wins { display: flex; gap: 5px; margin-top: 5px; }
.blue .wins { justify-content: end; }
.wins i { width: 7px; height: 7px; transform: rotate(45deg); border: 1px solid var(--team); }
.wins i.filled { background: var(--team); box-shadow: 0 0 6px var(--team); }
.clock { text-align: center; background: #130e27; border: 1px solid #9f81c7; border-radius: 11px; padding: 5px 0; }
.clock small { display: block; white-space: nowrap; }
.clock b { font: italic 1000 clamp(23px,4.3vw,52px)/1 system-ui; font-variant-numeric: tabular-nums; color: #fff4d5; }
.stage { position: relative; background: #70558d url('laboratorio.webp') center / cover; border-block: 1px solid #d9befbaa; isolation: isolate; }
canvas { display: block; width: 100%; height: 100%; position: absolute; inset: 0; }
.stage::before { display: block; content: ''; padding-top: 50%; }
.overlay { position: absolute; inset: 0; display: grid; align-items: center; justify-items: center; padding: 8px; background: linear-gradient(90deg,#25144527,#1b102748 40%,#25144527); }
.dialog { width: min(360px, 100%); padding: clamp(12px,2.5vw,24px); border: 1px solid #d8adf5ad; border-radius: 16px; text-align: center; background: linear-gradient(150deg,#382050f5,#211831f7); box-shadow: 0 16px 55px #1b0c39a8, 0 0 0 4px #ead3ff27; }
.dialog h1 { font: italic 950 clamp(21px,3.4vw,38px)/1.05 system-ui; margin: 0 0 13px; letter-spacing: -.035em; }
.primary { width: 100%; color: #231439; border-color: #fff6fc; background: linear-gradient(105deg,#ffc3e8,#e3c0fc 60%,#b6dbff); }
#join { display: flex; gap: 7px; margin-top: 8px; }
#code { width: 100%; min-width: 0; padding: 7px 8px; background: #130e24; color: #fff; border: 1px solid #bd9bdb8e; border-radius: 8px; text-transform: uppercase; font-weight: 800; }
#code::placeholder { color: #c9b8db; font-weight: 500; text-transform: none; }
.status { margin: 7px 0; color: #f4d9fc; font-size: .81rem; }
.status:empty { display: none; }
.invite,.seats,.choices { display: flex; justify-content: center; gap: 8px; margin-bottom: 7px; }
.invite { align-items: center; }
.invite strong { font: 900 1.02rem ui-monospace, monospace; letter-spacing: .12em; color: #fff2c5; }
.seat { flex: 1; border: 1px solid #c8aee567; border-radius: 7px; color: #eee0ff; padding: 5px 2px; font-size: .67rem; }
.seat b,.seat span { display: block; }
.seat b { color: #f3c7ff; margin-bottom: 2px; }
.seat.online span { color: #a6f4d6; }
.choices button { flex: 1; min-height: 0; padding: 3px 5px; font-size: .75rem; }
.choices img { width: 49px; height: 49px; display: block; margin: 0 auto; }
#result .quiet { margin-top: 7px; }
.callout { position: absolute; top: 34%; left: 50%; transform: translate(-50%,-50%); width: max-content; max-width: 94%; text-align: center; color: white; font: italic 1000 clamp(23px,5vw,55px)/1 system-ui; text-shadow: 0 3px #3f235c,0 0 14px #3b205a,2px 2px #593468; pointer-events: none; }
.meters { display: grid; grid-template-columns: minmax(0,1fr) auto minmax(0,1fr); align-items: center; gap: 14px; padding: 9px 15px 12px; }
.meters .blue { text-align: right; }
.meters progress { height: 7px; margin-top: 4px; }
.meters .charged { filter: drop-shadow(0 0 6px var(--team)); }
.connection { color: #e1d2ee; font: 800 clamp(8px,1.25vw,12px)/1.1 system-ui; text-align: center; white-space: nowrap; }
.controls { padding-top: 13px; }
.keys { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 22px; color: #ddd0ee; font-size: .8rem; }
kbd { display: inline-block; font: 800 .71rem ui-monospace, monospace; border: 1px solid #9a7eb869; border-radius: 5px; background: #2d2345; padding: 4px; color: #fbf1ff; }
.touch { display: none; justify-content: space-between; align-items: flex-end; padding-inline: 5px; gap: 8px; }
.touch, .touch button { touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.touch button { min-width: 43px; min-height: 43px; padding-inline: 7px; }
.pad { display: grid; grid-template-columns: repeat(3,1fr); gap: 3px; }
.pad button:first-child { grid-column: 2; }
.pad button:nth-child(2) { grid-column: 1; }
.actions { display: flex; gap: 5px; }
.actions button:last-child { background: #533167; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
@media (any-pointer: coarse), (max-width: 700px) {
  html.in-match, html.in-match body {
    overflow: hidden;
    overscroll-behavior: none;
    touch-action: none;
  }
  .touch { display: flex; }
  .keys { display: none; }
  .shell { width: calc(100% - 16px); padding-top: 10px; }
  .hud,.meters { padding-inline: 7px; }
  .stage:has(.overlay:not([hidden])) { min-height: 265px; }
}
@media (max-width: 450px) {
  .hud { padding-block: 7px; }
  .meters { gap: 6px; }
  .mast { margin-bottom: 8px; }
  #sound { font-size: 10px; }
}
@media (max-height: 550px) and (orientation: portrait) and (max-width: 700px) {
  .in-match .stage::before { padding-top: min(50%, max(100px, calc(100svh - 290px))); }
}
@media (max-height: 520px) and (orientation: landscape) and (any-pointer: coarse) {
  .shell { width: min(720px, calc(100% - 154px)); padding-block: 5px; }
  .stage:not(:has(.overlay:not([hidden])))::before { padding-top: min(50%, calc(100svh - 135px)); }
  .stage:has(.overlay:not([hidden])) { min-height: 240px; }
  .touch { position: fixed; inset: auto 4px 4px; pointer-events: none; padding: 0; z-index: 3; }
  .touch button { pointer-events: auto; min-width: 32px; min-height: 39px; font-size: .7rem; }
  .actions { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) { progress::-webkit-progress-value { transition: none; } }

.hp-count { float: right; margin-top: 3px; font-size: clamp(9px, 1.1vw, 12px); color: #f8ebff; font-variant-numeric: tabular-nums; }
.blue .hp-count { float: left; }

.in-match .stage { overflow: hidden; }
.in-match .stage::after {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 0 -5%;
  background: inherit;
  transform: translateX(var(--arena-pan, 0%));
  transition: transform 100ms linear;
}
@media (prefers-reduced-motion: reduce) {
  .in-match .stage::after { display: none; }
}
