:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #071019;
  color: #f5f8fb;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 10%, rgba(74, 151, 255, .16), transparent 30%),
    radial-gradient(circle at 85% 20%, rgba(62, 255, 204, .10), transparent 30%),
    #071019;
}

button, input { font: inherit; }

button { cursor: pointer; }

.shell {
  width: min(1120px, calc(100% - 32px));
  margin: 0 auto;
  padding-bottom: 64px;
}

.topbar {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  font-weight: 950;
  font-size: 1.35rem;
  color: #04110d;
  background: linear-gradient(135deg, #66f1cd, #66b9ff);
  box-shadow: 0 8px 28px rgba(85,232,196,.18);
}

.brand {
  font-weight: 900;
  letter-spacing: .11em;
  font-size: 1.02rem;
}

.tagline {
  color: #8fa2b5;
  font-size: .9rem;
  margin-top: 4px;
}

.account-strip {
  display: flex;
  align-items: center;
  gap: 12px;
}

.balance {
  background: rgba(255,255,255,.07);
  border: 1px solid rgba(255,255,255,.09);
  padding: 9px 12px;
  border-radius: 999px;
  font-weight: 700;
}

.hidden { display: none !important; }

.auth-grid {
  min-height: 72vh;
  display: grid;
  grid-template-columns: 1.2fr .8fr;
  gap: 24px;
  align-items: center;
}

.hero-card, .auth-card, .game-card, .history-card {
  background: rgba(12, 25, 38, .82);
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: 0 20px 70px rgba(0,0,0,.25);
  border-radius: 24px;
}

.hero-card { padding: 48px; }

.hero-card h1 {
  max-width: 700px;
  font-size: clamp(2.3rem, 5vw, 4.8rem);
  line-height: .98;
  margin: 14px 0 18px;
}

.hero-card p, .game-copy p {
  color: #aab8c5;
  line-height: 1.65;
}

.eyebrow {
  color: #55e8c4;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.promise-grid {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 10px;
  margin-top: 30px;
}

.promise-grid div {
  background: rgba(255,255,255,.04);
  border-radius: 16px;
  padding: 18px;
}

.promise-grid strong {
  font-size: 2rem;
  display: block;
}

.promise-grid span {
  color: #8fa2b5;
  font-size: .82rem;
}

.auth-card { padding: 26px; }

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: rgba(255,255,255,.04);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 22px;
}

.tab {
  border: 0;
  background: transparent;
  color: #8294a5;
  padding: 11px;
  border-radius: 9px;
  font-weight: 700;
}

.tab.active {
  background: #13283b;
  color: white;
}

form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: #b8c5d0;
  font-size: .9rem;
}

input {
  width: 100%;
  color: white;
  background: #091522;
  border: 1px solid #20384e;
  border-radius: 12px;
  padding: 13px 14px;
  outline: none;
}

input:focus { border-color: #55e8c4; }

.primary, .ghost {
  border-radius: 12px;
  padding: 12px 16px;
  font-weight: 800;
}

.primary {
  border: 0;
  color: #04110d;
  background: linear-gradient(135deg, #66f1cd, #66b9ff);
}

.primary:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.ghost {
  color: white;
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.11);
}

.small { padding: 8px 11px; font-size: .85rem; }

.message {
  min-height: 22px;
  margin-top: 14px;
  color: #ffadad;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 20px;
  margin: 28px 0 18px;
}

.section-head.compact { margin: 0 0 14px; }

.section-head h2, .section-head h3 { margin: 6px 0 0; }

.game-card {
  display: grid;
  grid-template-columns: .95fr 1.05fr;
  overflow: hidden;
}

.game-art {
  min-height: 420px;
  position: relative;
  background:
    linear-gradient(#10253c, #0d3650 55%, #0e6a6d);
  overflow: hidden;
}

.orb {
  width: 62px;
  height: 62px;
  border-radius: 50%;
  position: absolute;
  top: 48%;
  left: 25%;
  background: radial-gradient(circle at 35% 30%, #fff, #75e7ff 35%, #3976ff 72%);
  box-shadow: 0 0 40px rgba(85,220,255,.5);
}

.gate {
  position: absolute;
  width: 70px;
  top: -50px;
  bottom: -50px;
  background:
    linear-gradient(to bottom,
      #50f0c2 0 31%,
      transparent 31% 56%,
      #50f0c2 56% 100%);
  box-shadow: 0 0 20px rgba(80,240,194,.25);
}

.gate-a { left: 60%; }
.gate-b { left: 86%; transform: translateY(45px); opacity: .7; }

.game-copy { padding: 36px; }

.game-copy h3 { font-size: 2rem; margin: 8px 0; }

.stake-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 28px 0 16px;
}

.stake-buttons {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: end;
}

.stake-button {
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(255,255,255,.05);
  color: #dce8f1;
  border-radius: 999px;
  padding: 8px 12px;
}

.stake-button.active {
  border-color: #55e8c4;
  background: rgba(85,232,196,.15);
  color: white;
}

.wide { width: 100%; margin-top: 8px; }

.status-panel, .result-panel {
  margin-top: 14px;
  padding: 14px;
  background: rgba(255,255,255,.05);
  border-radius: 12px;
  color: #bfd0df;
}

.history-card {
  margin-top: 18px;
  padding: 24px;
}

.match-history {
  display: grid;
  gap: 8px;
}

.match-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255,255,255,.035);
  align-items: center;
}

.muted { color: #8fa2b5; }

.match-top {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 20px;
  align-items: center;
  margin: 22px 0 14px;
}

.match-top h2 { margin: 4px 0 0; }

.versus {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}

.player-pill {
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 14px;
  padding: 12px 14px;
  background: rgba(255,255,255,.04);
}

.player-pill.right { text-align: right; }

.game-wrap {
  width: min(100%, 440px);
  margin: 0 auto;
  position: relative;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  background: #10253c;
  border: 1px solid rgba(255,255,255,.1);
  border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,.3);
}

.game-overlay {
  position: absolute;
  inset: 0;
  border-radius: 20px;
  background: rgba(4, 12, 20, .76);
  display: grid;
  place-content: center;
  text-align: center;
  padding: 32px;
  backdrop-filter: blur(4px);
}

.game-overlay h3 { font-size: 2rem; margin: 0 0 8px; }
.game-overlay p { color: #b4c3d0; }

.game-stats {
  width: min(100%, 440px);
  margin: 12px auto 0;
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 8px;
}

.game-stats div {
  background: rgba(255,255,255,.045);
  border-radius: 12px;
  padding: 12px;
}

.game-stats span {
  display: block;
  color: #8fa2b5;
  font-size: .78rem;
}

.game-stats strong {
  display: block;
  margin-top: 4px;
}

.result-panel {
  width: min(100%, 620px);
  margin: 14px auto 0;
}

@media (max-width: 760px) {
  .auth-grid, .game-card { grid-template-columns: 1fr; }
  .hero-card { padding: 30px; }
  .game-art { min-height: 270px; }
  .promise-grid { grid-template-columns: 1fr; }
  .topbar { align-items: flex-start; padding-top: 18px; }
  .account-strip { flex-wrap: wrap; justify-content: end; }
  .match-row { grid-template-columns: 1fr; }
}


.game-overlay h3 {
  text-shadow: 0 0 24px rgba(102, 241, 205, .35);
}

.player-pill .muted {
  margin-top: 4px;
}


.admin-overview {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}

.admin-overview div {
  background: rgba(255,255,255,.045);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 16px;
  padding: 18px;
}

.admin-overview strong {
  display: block;
  font-size: 2rem;
}

.admin-overview span {
  color: #8fa2b5;
  font-size: .85rem;
}

@media (max-width: 760px) {
  .admin-overview { grid-template-columns: 1fr 1fr; }
}


.site-footer {
  margin-top: 34px;
  padding: 18px 4px 0;
  border-top: 1px solid rgba(255,255,255,.07);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: #71869a;
  font-size: .78rem;
}

.site-footer span:first-child {
  color: #9cb0c2;
  font-weight: 800;
}

@media (max-width: 760px) {
  body {
    background:
      radial-gradient(circle at 10% 5%, rgba(74, 151, 255, .14), transparent 25%),
      radial-gradient(circle at 90% 10%, rgba(62, 255, 204, .08), transparent 24%),
      #071019;
  }

  .shell {
    width: min(100% - 22px, 1120px);
    padding-bottom: 32px;
  }

  .topbar {
    min-height: 82px;
    padding-top: 14px;
    gap: 12px;
  }

  .brand-lockup {
    gap: 9px;
  }

  .brand-mark {
    width: 36px;
    height: 36px;
    border-radius: 11px;
    font-size: 1.15rem;
  }

  .brand {
    font-size: .78rem;
    letter-spacing: .08em;
  }

  .tagline {
    font-size: .76rem;
    margin-top: 2px;
  }

  .account-strip {
    gap: 7px;
  }

  .account-strip > #usernameLabel {
    width: 100%;
    text-align: right;
    font-size: .78rem;
    color: #aab8c5;
  }

  .balance {
    padding: 7px 9px;
    font-size: .76rem;
  }

  .small {
    padding: 7px 9px;
    font-size: .76rem;
  }

  .auth-grid {
    min-height: unset;
    gap: 14px;
    align-items: start;
  }

  .hero-card {
    padding: 26px 22px 22px;
    border-radius: 20px;
  }

  .hero-card h1 {
    font-size: clamp(2.25rem, 12vw, 3.2rem);
    line-height: .96;
    margin: 11px 0 15px;
  }

  .hero-card p {
    font-size: .94rem;
    line-height: 1.55;
    margin-bottom: 0;
  }

  .promise-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 7px;
    margin-top: 20px;
  }

  .promise-grid div {
    padding: 13px 8px;
    border-radius: 13px;
    min-width: 0;
  }

  .promise-grid strong {
    font-size: 1.55rem;
  }

  .promise-grid span {
    display: block;
    margin-top: 3px;
    font-size: .66rem;
    line-height: 1.25;
  }

  .auth-card {
    padding: 20px;
    border-radius: 20px;
  }

  .section-head {
    align-items: center;
    margin-top: 20px;
  }

  .game-card {
    border-radius: 20px;
  }

  .game-art {
    min-height: 205px;
  }

  .game-copy {
    padding: 24px 20px;
  }

  .game-copy h3 {
    font-size: 1.7rem;
  }

  .stake-row {
    align-items: flex-start;
    flex-direction: column;
    margin-top: 22px;
  }

  .stake-buttons {
    justify-content: flex-start;
  }

  .match-top {
    grid-template-columns: 1fr auto;
    gap: 10px;
  }

  .match-top > button {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .versus {
    grid-template-columns: 1fr;
  }

  .versus > :nth-child(2) {
    text-align: center;
  }

  .player-pill.right {
    text-align: left;
  }

  .game-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .game-stats div {
    padding: 10px 8px;
  }

  .game-stats strong {
    font-size: .9rem;
  }

  .site-footer {
    flex-direction: column;
    gap: 4px;
    margin-top: 26px;
  }
}

@media (max-width: 420px) {
  .brand {
    font-size: .7rem;
  }

  .tagline {
    max-width: 220px;
  }

  .hero-card h1 {
    font-size: 2.45rem;
  }
}
