:root {
  color-scheme: dark;
  --sky-1: #1aa7ff;
  --sky-2: #7253ff;
  --sky-3: #ff5aa6;
  --ink: #17213a;
  --ink-deep: #0b1020;
  --outline: #10172c;
  --cream: #fff4c8;
  --white: #ffffff;
  --yellow: #ffd447;
  --orange: #ff942e;
  --pink: #ff4e91;
  --blue: #20c8ff;
  --green: #55f07b;
  --shadow-hard: 0 8px 0 rgba(7, 10, 24, 0.75);
  --shadow-soft: 0 28px 70px rgba(7, 10, 24, 0.45);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  overflow-x: hidden;
  font-family: "Avenir Next", "Trebuchet MS", Verdana, sans-serif;
  color: var(--white);
  background:
    radial-gradient(circle at 15% 12%, rgba(255, 244, 200, 0.42), transparent 13rem),
    radial-gradient(circle at 88% 18%, rgba(255, 78, 145, 0.5), transparent 18rem),
    radial-gradient(circle at 50% 96%, rgba(255, 212, 71, 0.38), transparent 24rem),
    linear-gradient(150deg, var(--sky-1) 0%, var(--sky-2) 48%, var(--sky-3) 100%);
}

body::before,
body::after {
  position: fixed;
  inset: 0;
  pointer-events: none;
  content: "";
}

body::before {
  opacity: 0.24;
  background-image:
    radial-gradient(circle, #fff 1px, transparent 2px),
    radial-gradient(circle, #fff 1px, transparent 2px);
  background-position: 0 0, 34px 36px;
  background-size: 68px 72px;
}

body::after {
  background:
    linear-gradient(135deg, transparent 0 44%, rgba(255, 255, 255, 0.17) 44.5%, transparent 45% 100%),
    radial-gradient(circle at 22% 72%, rgba(32, 200, 255, 0.24), transparent 20rem),
    radial-gradient(circle at 82% 76%, rgba(255, 148, 46, 0.2), transparent 22rem);
}

.shell {
  position: relative;
  z-index: 1;
  width: min(1220px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: clamp(0.55rem, 1.35vw, 1rem);
}

.game-chrome {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-height: 3rem;
  margin-bottom: 0.7rem;
  padding: 0.45rem 0.62rem 0.58rem 0.8rem;
  border: 4px solid var(--outline);
  border-radius: 22px;
  background:
    linear-gradient(180deg, #2fe3ff 0%, #167eff 58%, #0f52d6 100%);
  box-shadow: var(--shadow-hard), inset 0 4px 0 rgba(255, 255, 255, 0.35);
}

h1 {
  margin: 0;
  color: var(--cream);
  font-size: clamp(1.12rem, 2vw, 1.5rem);
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow:
    0 3px 0 var(--outline),
    2px 0 0 var(--outline),
    -2px 0 0 var(--outline);
}

.build-pill {
  padding: 0.35rem 0.66rem 0.42rem;
  border: 3px solid var(--outline);
  border-radius: 999px;
  color: var(--outline);
  background: linear-gradient(180deg, #fff176 0%, var(--yellow) 52%, #ffad28 100%);
  box-shadow: 0 4px 0 rgba(7, 10, 24, 0.65), inset 0 3px 0 rgba(255, 255, 255, 0.4);
  font-size: 0.72rem;
  font-weight: 1000;
  letter-spacing: 0.07em;
  white-space: nowrap;
}

.game-panel {
  position: relative;
  overflow: visible;
  padding: clamp(0.62rem, 1.35vw, 0.9rem);
  border: 5px solid var(--outline);
  border-radius: 34px;
  background:
    linear-gradient(180deg, #2f3c71 0%, #1c2852 100%);
  box-shadow: var(--shadow-soft), var(--shadow-hard), inset 0 5px 0 rgba(255, 255, 255, 0.16);
}

.game-panel::before {
  position: absolute;
  inset: 0.55rem;
  z-index: 0;
  pointer-events: none;
  content: "";
  border: 2px solid rgba(255, 255, 255, 0.16);
  border-radius: 24px;
}

.game-panel::after {
  position: absolute;
  top: -0.48rem;
  right: 4.5rem;
  width: 9rem;
  height: 0.95rem;
  content: "";
  border: 4px solid var(--outline);
  border-radius: 999px;
  background: linear-gradient(90deg, var(--pink), var(--yellow), var(--blue));
  box-shadow: 0 5px 0 rgba(7, 10, 24, 0.55);
}

.online-rail {
  position: absolute;
  top: 1rem;
  right: -0.55rem;
  z-index: 3;
  display: grid;
  gap: 0.42rem;
  justify-items: end;
  pointer-events: none;
}

.online-rail__label {
  padding: 0.22rem 0.45rem 0.28rem;
  border: 3px solid var(--outline);
  border-radius: 999px;
  color: var(--outline);
  background: linear-gradient(180deg, #7dff9d, var(--green));
  box-shadow: 0 4px 0 rgba(7, 10, 24, 0.55);
  font-size: 0.58rem;
  font-weight: 1000;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.online-avatars {
  display: grid;
  gap: 0.36rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.online-avatar {
  position: relative;
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border: 4px solid var(--outline);
  border-radius: 999px;
  color: var(--outline);
  box-shadow: 0 5px 0 rgba(7, 10, 24, 0.58), inset 0 3px 0 rgba(255, 255, 255, 0.36);
  font-size: 0.78rem;
  font-weight: 1000;
  text-transform: uppercase;
}

.online-avatar::after {
  position: absolute;
  right: -0.1rem;
  bottom: -0.1rem;
  width: 0.6rem;
  height: 0.6rem;
  border: 3px solid var(--outline);
  border-radius: 999px;
  background: var(--green);
  content: "";
}

.online-avatar span {
  position: absolute;
  right: calc(100% + 0.5rem);
  width: max-content;
  max-width: 8rem;
  padding: 0.24rem 0.48rem 0.3rem;
  border: 3px solid var(--outline);
  border-radius: 999px;
  color: var(--cream);
  background: #25335e;
  box-shadow: 0 5px 0 rgba(7, 10, 24, 0.58);
  font-size: 0.68rem;
  font-weight: 1000;
  opacity: 0;
  transform: translateX(0.25rem);
  transition: opacity 160ms ease, transform 160ms ease;
}

.online-avatar:hover span {
  opacity: 1;
  transform: translateX(0);
}

#game-root {
  position: relative;
  z-index: 1;
  overflow: hidden;
  min-height: 0;
  border: 4px solid #0d1430;
  border-radius: 24px;
  background: #1b75df;
  box-shadow: inset 0 6px 0 rgba(255, 255, 255, 0.14), inset 0 -10px 0 rgba(7, 10, 24, 0.22);
}

#game-root canvas {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: auto;
  text-rendering: geometricPrecision;
}

.auth-gate {
  position: absolute;
  inset: clamp(0.62rem, 1.35vw, 0.9rem);
  z-index: 6;
  display: grid;
  place-items: center;
  padding: 1rem;
  border: 4px solid #0d1430;
  border-radius: 24px;
  background:
    radial-gradient(circle at 70% 12%, rgba(255, 212, 71, 0.35), transparent 12rem),
    linear-gradient(180deg, rgba(5, 8, 22, 0.86), rgba(11, 16, 32, 0.94));
  backdrop-filter: blur(3px);
}

.auth-gate.is-hidden {
  display: none;
}

.auth-card {
  width: min(26rem, 92%);
  padding: 1.25rem;
  border: 5px solid var(--outline);
  border-radius: 26px;
  color: var(--cream);
  background:
    linear-gradient(180deg, #2f59d9 0%, #233c92 52%, #17213a 100%);
  box-shadow: 0 10px 0 rgba(7, 10, 24, 0.75), inset 0 4px 0 rgba(255, 255, 255, 0.18);
}

.auth-badge {
  display: inline-flex;
  margin-bottom: 0.65rem;
  padding: 0.32rem 0.56rem 0.38rem;
  border: 3px solid var(--outline);
  border-radius: 999px;
  color: var(--outline);
  background: linear-gradient(180deg, #fff176, var(--yellow));
  box-shadow: 0 4px 0 rgba(7, 10, 24, 0.58);
  font-size: 0.72rem;
  font-weight: 1000;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-card h2 {
  margin: 0 0 0.45rem;
  color: var(--white);
  font-size: clamp(1.8rem, 4vw, 2.55rem);
  line-height: 0.95;
  text-transform: uppercase;
  text-shadow: 0 4px 0 var(--outline);
}

.auth-card p {
  margin: 0 0 1rem;
  color: #d9e7ff;
  font-weight: 800;
  line-height: 1.38;
}

.auth-field {
  display: grid;
  gap: 0.32rem;
  margin-bottom: 0.75rem;
  color: var(--white);
  font-size: 0.75rem;
  font-weight: 1000;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.auth-field input {
  width: 100%;
  min-height: 3rem;
  padding: 0.72rem 0.82rem;
  border: 4px solid var(--outline);
  border-radius: 14px;
  color: var(--outline);
  background: #fffdf0;
  box-shadow: inset 0 4px 0 rgba(7, 10, 24, 0.12);
  font: inherit;
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: 0;
  text-transform: none;
}

.auth-field input:focus {
  outline: 4px solid var(--yellow);
  outline-offset: 2px;
}

.auth-actions {
  display: flex;
  gap: 0.6rem;
}

.auth-actions button {
  min-height: 3rem;
  flex: 1;
  border: 4px solid var(--outline);
  border-radius: 14px;
  color: var(--outline);
  background: linear-gradient(180deg, #7dff9d, var(--green));
  box-shadow: 0 5px 0 rgba(7, 10, 24, 0.65), inset 0 3px 0 rgba(255, 255, 255, 0.35);
  cursor: pointer;
  font: inherit;
  font-size: 0.95rem;
  font-weight: 1000;
  text-transform: uppercase;
}

.auth-actions button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.auth-code-step {
  margin-top: 0.8rem;
}

.auth-message {
  min-height: 2.4rem;
  margin: 0.9rem 0 0;
  padding: 0.58rem 0.7rem;
  border: 3px solid rgba(255, 255, 255, 0.18);
  border-radius: 14px;
  color: var(--cream);
  background: rgba(7, 10, 24, 0.42);
  font-size: 0.86rem;
}

.control-dock {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.5rem;
  padding: 0.75rem 0.1rem 0.05rem;
  color: var(--cream);
}

.control-cluster {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 0.48rem;
  min-height: 3.1rem;
  padding: 0.34rem 0.46rem 0.42rem;
  border: 3px solid var(--outline);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(47, 89, 217, 0.96), rgba(28, 40, 82, 0.98));
  box-shadow: 0 5px 0 rgba(7, 10, 24, 0.62), inset 0 3px 0 rgba(255, 255, 255, 0.18);
}

.control-cluster--tablet {
  background:
    linear-gradient(180deg, rgba(255, 212, 71, 0.98), rgba(255, 148, 46, 0.98));
  color: var(--outline);
}

.control-icon {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border: 3px solid var(--outline);
  border-radius: 999px;
  color: var(--outline);
  background: linear-gradient(180deg, #ffffff, #d9e7ff);
  box-shadow: 0 3px 0 rgba(7, 10, 24, 0.5);
  font-size: 1rem;
  font-weight: 1000;
}

.control-label {
  align-self: end;
  color: var(--white);
  font-size: 0.68rem;
  font-weight: 1000;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
  text-shadow: 0 2px 0 var(--outline);
}

.control-cluster--tablet .control-label {
  color: var(--outline);
  text-shadow: none;
}

.key-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.18rem;
  min-width: 0;
  color: #d9e7ff;
  font-size: 0.68rem;
  font-weight: 1000;
  line-height: 1.15;
}

.control-cluster--tablet .key-row {
  color: var(--outline);
}

kbd {
  display: inline-grid;
  min-width: 1.45rem;
  min-height: 1.25rem;
  place-items: center;
  padding: 0.05rem 0.28rem 0.12rem;
  border: 2px solid var(--outline);
  border-radius: 0.42rem;
  color: var(--outline);
  background: linear-gradient(180deg, #ffffff, #d9e7ff);
  box-shadow: 0 2px 0 rgba(7, 10, 24, 0.58);
  font-family: inherit;
  font-size: 0.65rem;
  font-weight: 1000;
  line-height: 1;
}

.key-or {
  color: var(--yellow);
  font-size: 0.75rem;
  font-weight: 1000;
  text-shadow: 0 1px 0 var(--outline);
}

@media (max-width: 760px) {
  .shell {
    padding: 0.65rem;
  }

  .game-chrome {
    min-height: 2.7rem;
    border-radius: 17px;
  }

  .build-pill {
    display: none;
  }

  .game-panel {
    overflow: hidden;
    padding: 0.45rem;
    border-radius: 26px;
  }

  .game-panel::after {
    display: none;
  }

  .online-rail {
    top: 0.8rem;
    right: 0.8rem;
    grid-auto-flow: column;
    align-items: center;
  }

  .online-rail__label {
    display: none;
  }

  .online-avatars {
    grid-auto-flow: column;
  }

  .online-avatar {
    width: 1.75rem;
    height: 1.75rem;
    border-width: 3px;
    font-size: 0.62rem;
  }

  .online-avatar span {
    display: none;
  }

  #game-root {
    border-radius: 18px;
  }

  .control-dock {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.42rem;
    padding-top: 0.55rem;
  }

  .control-cluster {
    min-height: 2.75rem;
    border-radius: 14px;
  }

  .control-icon {
    width: 1.75rem;
    height: 1.75rem;
  }

  .control-cluster--tablet {
    grid-column: 1 / -1;
  }
}
