* {
  box-sizing: border-box;
}

:root {
  --ink: #171821;
  --muted: #656b7a;
  --paper: #fbf8ef;
  --panel: #ffffff;
  --line: #d9d5c9;
  --rose: #e95070;
  --gold: #f3bf4b;
  --teal: #24b3a8;
  --blue: #3f7ef6;
  --shadow: 0 18px 48px rgb(23 24 33 / 12%);
}

html {
  min-height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% 10%, rgb(233 80 112 / 22%), transparent 28rem),
    radial-gradient(circle at 82% 5%, rgb(36 179 168 / 20%), transparent 26rem),
    linear-gradient(180deg, #fff9f1 0%, #f0f4fb 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
}

.page-shell {
  width: min(100% - 28px, 1120px);
  margin: 0 auto;
  padding: 22px 0 36px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.brand {
  align-items: center;
  display: inline-flex;
  gap: 10px;
  font-weight: 800;
  text-decoration: none;
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  background: var(--gold);
  box-shadow: 4px 4px 0 var(--ink);
  font-size: 0.85rem;
}

.topbar__nav {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.topbar__email {
  color: var(--muted);
  font-size: 0.9rem;
  max-width: 34vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.button,
.auth-form input[type="submit"] {
  align-items: center;
  border: 2px solid var(--ink);
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  font-weight: 800;
  justify-content: center;
  min-height: 42px;
  padding: 10px 16px;
  text-decoration: none;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.button:hover,
.auth-form input[type="submit"]:hover {
  transform: translateY(-2px);
}

.button--primary,
.auth-form input[type="submit"] {
  background: var(--rose);
  box-shadow: 4px 4px 0 var(--ink);
  color: #fff;
}

.button--ghost {
  background: rgb(255 255 255 / 72%);
  color: var(--ink);
}

.button--large {
  min-height: 50px;
  padding-inline: 22px;
}

.flash {
  border: 2px solid var(--ink);
  border-radius: 8px;
  box-shadow: 4px 4px 0 var(--ink);
  font-weight: 700;
  margin: 0 0 18px;
  padding: 12px 14px;
}

.flash--notice {
  background: #e1fbef;
}

.flash--alert {
  background: #ffe2e5;
}

.eyebrow {
  color: #8b4053;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0;
  margin: 0 0 10px;
  text-transform: uppercase;
}

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

h1 {
  font-size: clamp(2.7rem, 8vw, 6.9rem);
  letter-spacing: 0;
  line-height: 0.9;
  margin-bottom: 18px;
}

h2 {
  font-size: 1.05rem;
  margin-bottom: 10px;
}

p {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.6;
}

.hero {
  align-items: center;
  display: grid;
  min-height: min(720px, calc(100vh - 120px));
  overflow: hidden;
  position: relative;
}

.hero__glow {
  position: absolute;
  inset: 12% 4% auto auto;
  width: min(38vw, 360px);
  aspect-ratio: 1;
  background:
    linear-gradient(90deg, transparent 48%, rgb(23 24 33 / 82%) 49% 51%, transparent 52%),
    linear-gradient(0deg, transparent 48%, rgb(23 24 33 / 82%) 49% 51%, transparent 52%),
    conic-gradient(from 45deg, var(--gold), var(--rose), var(--teal), var(--blue), var(--gold));
  border: 3px solid var(--ink);
  border-radius: 18px;
  box-shadow: 10px 10px 0 var(--ink), 0 0 70px rgb(233 80 112 / 34%);
  opacity: 0.95;
  transform: rotate(8deg);
}

.hero__content {
  max-width: 680px;
  position: relative;
  z-index: 1;
}

.hero__copy {
  color: #394050;
  font-size: clamp(1.05rem, 2vw, 1.28rem);
  max-width: 600px;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.feature-band {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 8px;
}

.feature,
.auth-form,
.game-panel {
  background: rgb(255 255 255 / 86%);
  border: 2px solid var(--ink);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.feature {
  padding: 20px;
}

.feature p {
  margin-bottom: 0;
}

.auth-shell {
  align-items: center;
  display: grid;
  gap: 34px;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  min-height: calc(100vh - 118px);
}

.auth-copy p {
  max-width: 560px;
}

.auth-form {
  display: grid;
  gap: 16px;
  padding: 22px;
}

.auth-form label {
  display: block;
  font-weight: 800;
  margin-bottom: 8px;
}

.auth-form input[type="email"],
.auth-form input[type="password"] {
  background: #fff;
  border: 2px solid #c9c5bb;
  border-radius: 8px;
  min-height: 46px;
  padding: 10px 12px;
  width: 100%;
}

.form-note {
  font-size: 0.95rem;
  margin: 0;
}

.form-note a {
  color: #b42d49;
  font-weight: 800;
}

.error-list {
  background: #ffe2e5;
  border: 1px solid #f0a9b4;
  border-radius: 8px;
  padding: 12px;
}

.error-list ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.dashboard {
  display: grid;
  gap: 18px;
}

.dashboard__intro {
  text-align: center;
}

.dashboard__intro h1 {
  font-size: clamp(2.3rem, 7vw, 5.2rem);
}

.dashboard__intro p {
  margin-inline: auto;
  max-width: 680px;
}

.game-layout {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(260px, 520px) minmax(240px, 320px);
  justify-content: center;
}

.game-panel {
  padding: 14px;
}

.game-panel--board {
  display: grid;
  place-items: center;
}

.game-board-wrap {
  aspect-ratio: 1 / 2;
  background: #11131d;
  border: 3px solid var(--ink);
  border-radius: 8px;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 8%);
  max-height: min(62vh, 640px);
  max-width: 100%;
  overflow: hidden;
  position: relative;
  width: min(100%, 320px);
}

.game-board {
  display: block;
  height: 100%;
  image-rendering: crisp-edges;
  width: 100%;
}

.game-message {
  align-items: center;
  background: rgb(17 19 29 / 88%);
  color: #fff;
  display: grid;
  gap: 6px;
  inset: 0;
  justify-items: center;
  padding: 24px;
  position: absolute;
  text-align: center;
}

.game-message[hidden] {
  display: none;
}

.game-message strong {
  font-size: 1.5rem;
}

.game-message span {
  color: #e8edf7;
}

.game-panel--stats {
  display: grid;
  gap: 16px;
}

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

.stat {
  background: #f7f3ea;
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 10px;
  text-align: center;
}

.stat span {
  color: var(--muted);
  display: block;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.stat strong {
  display: block;
  font-size: clamp(1.15rem, 4vw, 1.8rem);
  line-height: 1.1;
  margin-top: 4px;
}

.next-box {
  align-items: center;
  display: grid;
  gap: 10px;
  justify-items: center;
}

.next-box canvas {
  background: #11131d;
  border: 2px solid var(--ink);
  border-radius: 8px;
  height: 96px;
  width: 96px;
}

.desktop-help p {
  font-size: 0.92rem;
  margin-bottom: 0;
}

.game-actions {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 1fr;
}

.touch-controls {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  margin: 0 auto;
  max-width: 720px;
  width: 100%;
}

.touch-controls button {
  background: #fff;
  border: 2px solid var(--ink);
  border-radius: 8px;
  box-shadow: 3px 3px 0 var(--ink);
  color: var(--ink);
  cursor: pointer;
  font-weight: 900;
  min-height: 54px;
  padding: 10px 8px;
  touch-action: manipulation;
}

.touch-controls button:active {
  box-shadow: 1px 1px 0 var(--ink);
  transform: translate(2px, 2px);
}

@media (max-width: 860px) {
  .feature-band,
  .auth-shell,
  .game-layout {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: 580px;
  }

  .hero__glow {
    inset: auto -18% 6% auto;
    width: 260px;
  }

  .game-layout {
    justify-items: center;
  }

  .game-panel {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .page-shell {
    width: min(100% - 18px, 1120px);
    padding-top: 14px;
  }

  .topbar {
    align-items: flex-start;
  }

  .brand span:last-child {
    display: none;
  }

  .topbar__email {
    display: none;
  }

  h1 {
    font-size: clamp(2.6rem, 17vw, 4.2rem);
  }

  .auth-shell {
    gap: 20px;
    min-height: auto;
  }

  .game-board-wrap {
    max-height: 58vh;
    width: min(100%, 285px);
  }

  .stat-grid,
  .touch-controls {
    grid-template-columns: repeat(3, 1fr);
  }

  .touch-controls button {
    min-height: 50px;
  }

  .desktop-help {
    display: none;
  }
}
