* {
  box-sizing: border-box;
}
html {
  color-scheme: dark;
}
body {
  margin: 0;
  background: #080f19;
  color: #e7edf4;
  font:
    16px/1.6 system-ui,
    sans-serif;
  background-image: radial-gradient(
    ellipse at 80% 25%,
    #1a3746 0,
    transparent 55%
  );
}
a {
  color: inherit;
  text-decoration: none;
}
button,
input,
select {
  font: inherit;
}
button,
a,
input,
select {
  touch-action: manipulation;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}
:focus-visible {
  outline: 3px solid #71d9e7;
  outline-offset: 4px;
}
.shell {
  max-width: 1440px;
  margin: auto;
  padding: 0 5vw;
}
header {
  height: 104px;
  display: flex;
  align-items: center;
  gap: 24px;
  border-bottom: 1px solid #ffffff12;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 25px;
  font-weight: 800;
  letter-spacing: 2px;
}
.brand img {
  width: 46px;
}
.brand small {
  display: block;
  font-size: 9px;
  letter-spacing: 4px;
  color: #b5c0ce;
}
.gold {
  color: #dfbd7b;
}
.build {
  font-size: 10px;
  letter-spacing: 2px;
  border: 1px solid #b7955a55;
  padding: 4px 12px;
  color: #dfbd7b;
}
.identity {
  margin-left: auto;
  color: #b4c4d4;
  font-size: 13px;
}
nav {
  display: flex;
  gap: 36px;
  padding: 20px 0;
  border-bottom: 1px solid #ffffff12;
}
nav a {
  font-size: 14px;
  color: #a8b5c6;
  padding-bottom: 6px;
}
nav a[aria-current="page"] {
  color: #edca87;
  border-bottom: 2px solid #d6b273;
}
main {
  min-height: calc(100vh - 250px);
  padding: 34px 0 50px;
}
h1,
h2,
h3,
p {
  margin-top: 0;
}
h1 {
  font-size: clamp(36px, 5vw, 70px);
  line-height: 1.08;
  letter-spacing: -2px;
  margin-bottom: 24px;
}
h2 {
  font-size: 30px;
  line-height: 1.2;
}
.eyebrow {
  font-size: 11px;
  letter-spacing: 3px;
  color: #d9b879;
  margin-bottom: 20px;
}
.muted {
  color: #99aabd;
}
.lead {
  max-width: 510px;
  font-size: 17px;
  color: #aebdcd;
}
.hero-layout {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 36px;
  align-items: center;
  min-height: 410px;
}
.primary,
.secondary {
  display: inline-block;
  border: 1px solid #c6a269;
  padding: 13px 30px;
  font-weight: 700;
  letter-spacing: 2px;
  border-radius: 3px;
}
.primary {
  background: linear-gradient(110deg, #efd69f, #bb904b);
  color: #151a21;
}
.secondary {
  background: transparent;
  color: #dfbd7b;
}
.actions {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin: 26px 0;
}
.arena {
  position: relative;
  aspect-ratio: 1.25;
  display: grid;
  place-items: center;
  border: 1px solid #d9b87935;
  background: radial-gradient(ellipse, #204d59 0, #142834 45%, #101d2b 75%);
  overflow: hidden;
  border-radius: 6px;
}
.arena:before,
.arena:after {
  content: "";
  position: absolute;
  width: 66%;
  height: 70%;
  border: 1px solid #c7a56c66;
  transform: rotate(35deg);
}
.arena:after {
  transform: rotate(-35deg);
  width: 50%;
  height: 88%;
  border-color: #73b9c333;
}
.arena img {
  width: 37%;
  filter: drop-shadow(0 0 30px #69c4d166);
  z-index: 1;
}
.arena .versus {
  position: absolute;
  bottom: 18px;
  letter-spacing: 6px;
  font-size: 12px;
  color: #d9b879;
}
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid #ffffff14;
  border-bottom: 1px solid #ffffff14;
  margin-top: 30px;
}
.stats > div {
  padding: 20px;
}
.stats b {
  display: block;
  color: #e5c58b;
  font-size: 23px;
}
.stats span {
  font-size: 12px;
  color: #9eaec0;
}
.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 16px;
}
.card,
.panel {
  border: 1px solid #ffffff15;
  background: #111f2ddd;
  border-radius: 5px;
  padding: 24px;
}
.card h3 {
  margin: 12px 0 3px;
}
.card p {
  font-size: 13px;
  color: #a9b8c8;
}
.hero-portrait {
  width: 100%;
  height: 180px;
  object-fit: contain;
  background: radial-gradient(ellipse, #254252, transparent 70%);
}
.role {
  font-size: 10px;
  letter-spacing: 2px;
  color: #d9b879;
  text-transform: uppercase;
}
.filters {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 24px 0;
}
.filters button {
  border: 1px solid #425263;
  border-radius: 3px;
  background: #142332;
  color: #bdcbd8;
  padding: 7px 15px;
}
.filters button[aria-pressed="true"] {
  border-color: #d9b879;
  color: #f1d39e;
}
.rank-wrap {
  max-width: 800px;
  margin: auto;
  text-align: center;
}
.rank-badge {
  width: 100px;
  margin: 20px;
}
.slots {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 20px 0;
}
.slot {
  border: 1px dashed #536071;
  width: 48px;
  height: 60px;
  display: grid;
  place-items: center;
  color: #8697ac;
}
.notice {
  border-left: 3px solid #c9a96e;
  background: #d0aa6010;
  padding: 15px;
  color: #cbd3df;
  font-size: 14px;
  text-align: left;
}
.field {
  display: grid;
  gap: 8px;
  margin: 20px 0;
}
input,
select {
  width: 100%;
  max-width: 440px;
  padding: 12px;
  background: #0d1825;
  border: 1px solid #465567;
  color: #e7edf4;
  border-radius: 4px;
}
label {
  font-size: 14px;
}
.skills {
  font-size: 12px;
  color: #a8bbcc;
  margin: 18px 0;
}
.detail {
  margin-top: 22px;
}
.empty {
  padding: 40px;
  text-align: center;
  color: #aebdcd;
}
footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 20px 0;
  border-top: 1px solid #ffffff15;
  font-size: 10px;
  letter-spacing: 1px;
  color: #8fa0b4;
}
.section-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin: 32px 0 18px;
}
.section-title h2 {
  font-size: 20px;
  margin: 0;
}
.section-title a {
  font-size: 12px;
  color: #d9b879;
}
ol {
  padding-left: 22px;
}
li {
  margin-bottom: 16px;
}
.compact h1 {
  font-size: 38px;
  letter-spacing: -1px;
}
.form-result {
  color: #e5c58b;
  min-height: 26px;
}
@media (max-width: 760px) {
  .shell {
    padding: 0 5vw;
  }
  header {
    height: 80px;
  }
  .brand {
    font-size: 20px;
  }
  .brand img {
    width: 34px;
  }
  .build {
    display: none;
  }
  .identity {
    font-size: 11px;
  }
  nav {
    gap: 25px;
    overflow-x: auto;
    white-space: nowrap;
  }
  .hero-layout {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  .arena {
    aspect-ratio: 1.8;
  }
  .stats > div {
    padding: 14px 8px;
  }
  .stats b {
    font-size: 19px;
  }
  .cards {
    grid-template-columns: repeat(2, 1fr);
  }
  .card {
    padding: 15px;
  }
  .hero-portrait {
    height: 140px;
  }
  .primary,
  .secondary {
    padding: 12px 22px;
  }
  .slot {
    width: 42px;
  }
  footer {
    letter-spacing: 0;
    font-size: 10px;
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    scroll-behavior: auto !important;
  }
}
.teams {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin: 24px 0;
  text-align: left;
}
.team {
  border: 1px solid #558cab44;
  border-radius: 4px;
  padding: 16px;
}
.team:nth-child(2) {
  border-color: #c76d6d55;
}
.team h3 {
  font-size: 16px;
}
.member {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid #ffffff15;
  padding: 10px 0;
  font-size: 12px;
  overflow-wrap: anywhere;
}
.member span:first-child {
  min-width: 0;
}
.member span:last-child {
  white-space: nowrap;
  color: #bdc9d5;
}
.is-me {
  color: #efca82;
}
.rank-actions {
  justify-content: center;
}
.queue-count {
  font-size: 54px;
  color: #e5c58b;
  margin: 20px;
}
.queue-count span {
  font-size: 24px;
  color: #98acbd;
}
.rank-wrap input {
  max-width: none;
}
.rank-wrap label {
  display: block;
  text-align: left;
}
@media (max-width: 600px) {
  .teams {
    grid-template-columns: 1fr;
  }
  .member {
    font-size: 13px;
  }
}

/* Stage 4: mode selection and responsive battle HUD. */
[hidden] {
  display: none !important;
}
.pick {
  cursor: pointer;
  position: relative;
}
.pick input {
  width: auto;
  position: absolute;
  left: 14px;
  top: 14px;
  accent-color: #d8b879;
}
.pick:has(input:checked) {
  border-color: #e1c78d;
  box-shadow: 0 0 0 1px #e1c78d55;
}
.pick-heading {
  margin-top: 28px;
  font-size: 23px;
}
.mode-cards {
  grid-template-columns: repeat(3, 1fr);
}
.mode-cards h2 {
  font-size: 30px;
  margin: 10px 0;
}
.member small {
  display: block;
  color: #91a5bc;
  font-size: 10px;
}
.in-arena .shell {
  max-width: 1800px;
  padding: 0 2vw;
}
.in-arena main {
  padding-top: 16px;
}
.arena-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.arena-heading h2 {
  font-size: 22px;
  margin: 5px 0;
}
.arena-heading .eyebrow {
  font-size: 9px;
}
.arena-tools {
  display: flex;
  gap: 8px;
}
.arena-tools button {
  font-size: 10px;
  padding: 8px 13px;
}
.arena-status {
  font-size: 12px;
  color: #9eb9c8;
  margin: 8px 0;
}
.battle-wrap {
  position: relative;
  border: 1px solid #6a919050;
  border-radius: 6px;
  overflow: hidden;
  height: clamp(460px, 70vh, 900px);
  background: #102b2c;
  touch-action: none;
}
.battle-wrap:fullscreen {
  width: 100vw;
  height: 100dvh;
  border: 0;
  border-radius: 0;
}
.battle-wrap canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}
.battle-top {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  padding: 7px 16px;
  border: 1px solid #c6d9d533;
  background: #081b2ce0;
  color: #e1dfb7;
  border-radius: 4px;
  font-size: 13px;
  white-space: nowrap;
  pointer-events: none;
}
.touch-controls {
  position: absolute;
  bottom: 24px;
  left: 24px;
  right: 24px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  pointer-events: none;
}
.touch-controls button,
.touch-controls #joystick {
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.touch-controls button {
  border: 2px solid #a4c7d77a;
  box-shadow: 0 4px 18px #0005;
  color: #f5f0db;
  background: #142c43de;
  padding: 0;
}
#joystick {
  width: 116px;
  height: 116px;
  border: 2px solid #9bc9d13a;
  background: #0d253e66;
  border-radius: 50%;
  display: grid;
  place-items: center;
}
#stick-knob {
  width: 46px;
  height: 46px;
  border: 2px solid #beddeb77;
  background: #75bdcd66;
  border-radius: 50%;
  pointer-events: none;
}
.combat-buttons {
  display: flex;
  align-items: flex-end;
  gap: 12px;
}
.skill-buttons {
  display: flex;
  gap: 9px;
  padding-bottom: 8px;
}
.skill {
  position: relative;
  overflow: hidden;
  width: 62px;
  height: 62px;
  border-radius: 50%;
}
.skill img {
  width: 100%;
  height: 100%;
  opacity: 0.9;
}
.skill > span {
  position: absolute;
  bottom: 2px;
  left: 0;
  right: 0;
  font-size: 10px;
  text-shadow: 0 1px 3px #000;
}
.skill > b {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 20px;
}
.skill.cooling img {
  opacity: 0.3;
}
.attack-button {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 800;
}
.attack-button small {
  display: block;
  font-size: 8px;
  font-weight: 500;
}
.player-hud {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  padding: 13px 0;
  font-size: 12px;
}
.player-hud b {
  color: #e9cb8d;
}
.shop {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 10px;
  background: #101f2d;
  border: 1px solid #ffffff12;
  border-radius: 4px;
  font-size: 12px;
}
.shop button {
  border: 1px solid #71897c55;
  background: #1c3439;
  color: #c5dbc8;
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 3px;
}
.shop small {
  color: #8c9fae;
}
.control-guide {
  font-size: 12px;
  margin: 12px 0;
}
.hero-picks .hero-portrait {
  height: 160px;
}
.arena-screen .actions .secondary {
  font-size: 11px;
  padding: 10px 18px;
}
@media (max-width: 800px) {
  .mode-cards {
    grid-template-columns: 1fr;
  }
  .hero-picks {
    grid-template-columns: repeat(2, 1fr);
  }
  .battle-wrap {
    height: 65dvh;
    min-height: 420px;
  }
  .touch-controls {
    bottom: 15px;
    left: 12px;
    right: 12px;
  }
  #joystick {
    width: 88px;
    height: 88px;
  }
  .skill {
    width: 47px;
    height: 47px;
  }
  .skill-buttons {
    gap: 5px;
  }
  .attack-button {
    width: 66px;
    height: 66px;
    font-size: 11px;
  }
  .combat-buttons {
    gap: 6px;
  }
  .battle-top {
    font-size: 10px;
    padding: 5px 9px;
    top: 6px;
  }
  .arena-tools button {
    padding: 7px 8px;
    font-size: 9px;
  }
  .hero-picks .hero-portrait {
    height: 130px;
  }
  .player-hud {
    gap: 8px;
    font-size: 11px;
  }
}
@media (max-height: 520px) and (orientation: landscape) {
  .battle-wrap {
    height: 85dvh;
    min-height: 300px;
  }
  .touch-controls {
    bottom: 12px;
  }
  #joystick {
    width: 80px;
    height: 80px;
  }
  .skill {
    width: 46px;
    height: 46px;
  }
  .attack-button {
    width: 64px;
    height: 64px;
  }
}

.exit-fullscreen {
  display: none;
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 2;
  border: 1px solid #a4c7d766;
  background: #102533cc;
  color: #e5d7ad;
  padding: 8px;
  font-size: 11px;
}
.battle-wrap:fullscreen .exit-fullscreen {
  display: block;
}

/* PWA and safe areas for installed/mobile shells. */
body {
  padding-left: env(safe-area-inset-left, 0px);
  padding-right: env(safe-area-inset-right, 0px);
}
footer {
  padding-bottom: max(20px, env(safe-area-inset-bottom, 0px));
}
.network-notice {
  background: #47351d;
  color: #ffe1ad;
  border: 1px solid #98713b;
  padding: 10px 14px;
  font-size: 13px;
}
.offline-card {
  max-width: 650px;
  margin: 8vh auto;
  padding: 30px;
}
.offline-card h1 {
  font-size: 42px;
}
.offline-card .primary {
  margin: 20px 0;
}
.install-cards {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}
.install-cards h2 {
  font-size: 26px;
  margin-top: 18px;
}
.install-cards p {
  font-size: 14px;
}
.battle-wrap:fullscreen .touch-controls {
  bottom: max(24px, env(safe-area-inset-bottom, 0px));
  left: max(24px, env(safe-area-inset-left, 0px));
  right: max(24px, env(safe-area-inset-right, 0px));
}
