/* Backyard Legends Games hub — mobile first, phone-scrollable */

:root {
  --bg: #0c1118;
  --ink: #f3efe6;
  --muted: #c4bdb0;
  --line: rgba(243, 239, 230, 0.12);
  --card: rgba(16, 22, 31, 0.78);
  --wk: #c6e14a;
  --ff: #f0c45a;
  --ep: #3de0ea;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: Figtree, "Segoe UI", sans-serif;
  -webkit-text-size-adjust: 100%;
}

html {
  overflow-x: hidden;
  overflow-y: auto;
  scroll-behavior: smooth;
}

body {
  min-height: 100dvh;
  overflow-x: hidden;
}

img { max-width: 100%; height: auto; display: block; }

a {
  color: inherit;
  text-decoration: none;
}

.sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(255, 214, 130, 0.16), transparent 55%),
    radial-gradient(900px 500px at -10% 0%, rgba(61, 224, 234, 0.08), transparent 50%),
    radial-gradient(800px 700px at 50% 120%, rgba(198, 225, 74, 0.07), transparent 55%),
    linear-gradient(180deg, #141c28 0%, var(--bg) 42%, #0a0e14 100%);
}

.sky::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.35;
  background-image: radial-gradient(rgba(255, 255, 255, 0.35) 1px, transparent 1px);
  background-size: 72px 72px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,0.55), transparent 55%);
}

.page {
  position: relative;
  z-index: 1;
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: calc(28px + var(--safe-t)) calc(20px + var(--safe-r)) calc(36px + var(--safe-b)) calc(20px + var(--safe-l));
}

.hero {
  max-width: 22rem;
  padding: 8px 0 28px;
}

.brand {
  margin: 0 0 14px;
  font-family: "Bricolage Grotesque", Figtree, sans-serif;
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ff);
}

.hero h1 {
  margin: 0 0 12px;
  font-family: "Bricolage Grotesque", Figtree, sans-serif;
  font-size: clamp(2rem, 8.5vw, 3.6rem);
  font-weight: 800;
  line-height: 0.95;
  letter-spacing: -0.04em;
}

.lede {
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.45;
}

.games {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 16px;
}

.card {
  display: grid;
  grid-template-columns: 104px 1fr;
  gap: 16px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--card);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.card:hover,
.card:focus-visible {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35), 0 0 0 1px color-mix(in srgb, var(--accent) 35%, transparent);
}

.card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.card-wk { --accent: var(--wk); }
.card-ff { --accent: var(--ff); }
.card-ep { --accent: var(--ep); }

.art {
  width: 104px;
  height: 104px;
  object-fit: cover;
  border-radius: 16px;
  background: #000;
}

.copy h2 {
  margin: 0 0 6px;
  font-family: "Bricolage Grotesque", Figtree, sans-serif;
  font-size: 1.28rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.copy p {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.4;
}

.play {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--accent);
  color: #10140c;
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: 0.02em;
}

.card-ff .play { color: #2a1d08; }
.card-ep .play { color: #04181a; }

.foot {
  margin-top: 32px;
  color: #8d867b;
  font-size: 0.85rem;
}

.foot p { margin: 0; }

@media (min-width: 760px) {
  .page { padding-top: calc(56px + var(--safe-t)); }
  .hero { max-width: 44rem; padding-bottom: 40px; }
  .lede { font-size: 1.15rem; }
  .games {
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
  }
  .card {
    grid-template-columns: 1fr;
    align-items: stretch;
    padding: 16px 16px 20px;
    min-height: 100%;
  }
  .art {
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    border-radius: 18px;
  }
  .copy h2 { font-size: 1.55rem; }
  .play { min-height: 44px; padding: 0 18px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .card { transition: none; }
  .card:hover, .card:focus-visible { transform: none; }
}

.foot-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.logout {
  color: #8d867b;
  text-decoration: underline;
  text-underline-offset: 3px;
  white-space: nowrap;
}

.logout:hover,
.logout:focus-visible {
  color: var(--ink);
}

.page-login {
  width: min(28rem, 100%);
}

.page-login .hero {
  max-width: none;
  text-align: left;
}

.pin-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--card);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.pin-label {
  font-family: "Bricolage Grotesque", Figtree, sans-serif;
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.pin-input {
  width: 100%;
  min-height: 56px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(8, 11, 16, 0.85);
  color: var(--ink);
  font-family: "Bricolage Grotesque", Figtree, sans-serif;
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: 0.28em;
  text-align: center;
}

.pin-input:focus {
  outline: 2px solid var(--ff);
  outline-offset: 2px;
}

.pin-error {
  margin: 0;
  color: #ffb4a2;
  font-size: 0.95rem;
  line-height: 1.4;
}

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

.key {
  min-height: 56px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(243, 239, 230, 0.06);
  color: var(--ink);
  font-family: "Bricolage Grotesque", Figtree, sans-serif;
  font-size: 1.35rem;
  font-weight: 800;
  cursor: pointer;
}

.key:hover,
.key:focus-visible {
  background: rgba(243, 239, 230, 0.12);
}

.key:focus-visible {
  outline: 2px solid var(--ff);
  outline-offset: 2px;
}

.key-action { color: var(--muted); }

.key-go {
  background: var(--ff);
  color: #2a1d08;
  border-color: transparent;
}

.key-go:hover,
.key-go:focus-visible {
  background: #f6d27a;
}

@media (min-width: 760px) {
  .page-login { padding-top: calc(56px + var(--safe-t)); }
  .page-login .hero { padding-bottom: 24px; }
  .key { min-height: 60px; }
}
