:root {
  color-scheme: dark;
  --paper: #f0eee8;
  --ink: #0d0d0f;
  --muted: #98989e;
  --line: rgba(255, 255, 255, 0.12);
  --panel: #17171a;
  --red: #ff3b30;
  font-family: Inter, "Helvetica Neue", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--ink);
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--paper);
  background:
    radial-gradient(circle at 80% -10%, rgba(255, 59, 48, 0.18), transparent 36rem),
    var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

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

.topbar {
  min-height: 84px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  border-bottom: 1px solid var(--line);
}

.brand {
  width: max-content;
  color: var(--paper);
  text-decoration: none;
  font-weight: 900;
  letter-spacing: -0.06em;
  font-size: 25px;
}

.brand-mark {
  color: var(--red);
}

.environment {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.environment-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 14px var(--red);
}

.topbar .quiet-button {
  justify-self: end;
}

.login-view {
  min-height: calc(100vh - 84px);
  display: grid;
  place-items: center;
}

.login-panel {
  width: min(520px, 100%);
  padding: 48px;
  border: 1px solid var(--line);
  background: rgba(23, 23, 26, 0.82);
  backdrop-filter: blur(24px);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--red);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 820px;
  margin-bottom: 16px;
  font-size: clamp(42px, 7vw, 88px);
  line-height: 0.94;
  letter-spacing: -0.065em;
}

h2 {
  margin-bottom: 0;
  font-size: 24px;
  letter-spacing: -0.035em;
}

.login-panel h1 {
  font-size: clamp(42px, 7vw, 66px);
}

.login-panel > p:not(.eyebrow, .error-text),
.hero-copy,
.status-text {
  color: var(--muted);
  line-height: 1.6;
}

.login-panel form {
  margin-top: 32px;
}

label {
  display: grid;
  gap: 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.input-row {
  display: grid;
  grid-template-columns: 1fr auto;
}

input,
select {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 0;
  outline: none;
  color: var(--paper);
  background: #111113;
}

input:focus,
select:focus {
  border-color: var(--red);
}

button {
  min-height: 46px;
  padding: 0 20px;
  border: 1px solid var(--red);
  border-radius: 0;
  color: #fff;
  background: var(--red);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.quiet-button {
  min-height: 38px;
  padding: 0 14px;
  border-color: var(--line);
  color: var(--paper);
  background: transparent;
}

.error-text {
  min-height: 24px;
  margin: 14px 0 0;
  color: #ff746b;
  font-size: 13px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: 64px;
  align-items: end;
  padding: 88px 0 56px;
}

.hero-copy {
  max-width: 420px;
  margin: 0 0 5px;
}

.controls {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 1px;
  padding: 1px;
  background: var(--line);
}

.controls label {
  padding: 18px;
  background: var(--panel);
}

.section-heading,
.stage-bar,
.round-tool {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.section-heading {
  margin-top: 56px;
}

.status-text {
  min-height: 26px;
  margin: 12px 0;
  font-size: 13px;
}

.games-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.game-card {
  position: relative;
  min-height: 310px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--panel);
}

.game-card img {
  width: 100%;
  height: 100%;
  min-height: 310px;
  display: block;
  object-fit: cover;
  transition: transform 400ms ease;
}

.game-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, transparent 42%, rgba(0, 0, 0, 0.9));
}

.game-card:hover img {
  transform: scale(1.035);
}

.game-meta {
  position: absolute;
  z-index: 1;
  inset: auto 18px 18px;
}

.game-meta p {
  margin: 5px 0 14px;
  color: rgba(255, 255, 255, 0.68);
  font-size: 12px;
}

.game-meta button {
  min-height: 38px;
}

.stage {
  margin-top: 64px;
  border-top: 1px solid var(--line);
  padding-top: 24px;
}

.stage-actions {
  display: flex;
  gap: 8px;
}

#game-frame {
  width: 100%;
  height: min(78vh, 900px);
  min-height: 560px;
  border: 1px solid var(--line);
  background: #000;
}

.round-tool {
  margin-top: 64px;
  padding: 32px;
  align-items: end;
  border: 1px solid var(--line);
  background: var(--panel);
  flex-wrap: wrap;
}

.round-form {
  display: grid;
  grid-template-columns: minmax(260px, 440px) auto;
}

.round-result {
  width: 100%;
  max-height: 420px;
  margin: 12px 0 0;
  padding: 20px;
  overflow: auto;
  color: #bbf7d0;
  background: #09090a;
  font: 12px/1.55 "SFMono-Regular", Consolas, monospace;
}

@media (max-width: 1080px) {
  .controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 760px) {
  .shell {
    padding: 0 16px 40px;
  }

  .topbar {
    grid-template-columns: 1fr auto;
  }

  .environment {
    display: none;
  }

  .hero {
    grid-template-columns: 1fr;
    gap: 16px;
    padding-top: 56px;
  }

  .controls,
  .games-grid {
    grid-template-columns: 1fr 1fr;
  }

  .round-tool,
  .round-form {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  #game-frame {
    min-height: 68vh;
  }
}

@media (max-width: 500px) {
  .login-panel {
    padding: 30px 20px;
  }

  .controls,
  .games-grid {
    grid-template-columns: 1fr;
  }

  .section-heading,
  .stage-bar {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
