/* The games page. Plain CSS: the site's security policy allows no inline styles or outside fonts. */
:root {
  --ink: #4b3f72;
  --ink-soft: #7a6fa0;
  --pink: #ff8fb8;
  --lavender: #b48cff;
  --sky: #6fc3ff;
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: linear-gradient(135deg, #f6e7ff 0%, #e3edff 50%, #dff7f1 100%);
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: ui-rounded, "SF Pro Rounded", "Nunito", system-ui, sans-serif;
  color: var(--ink);
  padding: max(24px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
}

main {
  flex: 1;
  width: 100%;
  max-width: 880px;
  margin: 0 auto;
}

header {
  text-align: center;
  margin: 24px 0 32px;
}

.studio {
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

h1 {
  margin: 4px 0 8px;
  font-size: clamp(2.6rem, 9vw, 4rem);
  line-height: 1;
  background: linear-gradient(90deg, var(--pink), var(--lavender), var(--sky));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lede {
  margin: 0;
  color: var(--ink-soft);
  font-weight: 500;
}

.games {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
}

.card {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  border-radius: 28px;
  border: 2px solid rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.6);
  box-shadow: 0 12px 30px -12px rgba(75, 63, 114, 0.35);
  color: inherit;
  text-decoration: none;
  transition: transform 120ms ease;
}

.card:hover {
  transform: translateY(-3px);
}

.card:active {
  transform: translateY(1px);
}

.card img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1200 / 630;
  object-fit: cover;
}

.card-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px 20px 20px;
}

.name {
  font-size: 1.4rem;
  font-weight: 800;
}

.about {
  color: var(--ink-soft);
}

.play {
  align-self: flex-start;
  margin-top: 8px;
  padding: 8px 18px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  background: linear-gradient(#ffd0de, #ffa8c2);
  color: #7a2e51;
  font-weight: 700;
}

footer {
  margin-top: 40px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

/* --- beta sign-in ------------------------------------------------------------------------------ */

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* Until /api/session answers, neither the sign-in nor "Sign out" shows. */
.gate,
.session {
  display: none;
}
[data-signed-in="false"] .gate {
  display: block;
}
[data-signed-in="true"] .session {
  display: block;
}
[data-signed-in="false"] .games {
  opacity: 0.55;
}

.gate {
  max-width: 440px;
  margin: 0 auto 32px;
  padding: 24px;
  text-align: center;
  border-radius: 28px;
  border: 2px solid rgba(255, 255, 255, 0.85);
  background: rgba(255, 255, 255, 0.7);
  box-shadow: 0 12px 30px -12px rgba(75, 63, 114, 0.35);
}

.badge {
  display: inline-block;
  margin: 0 0 8px;
  padding: 4px 12px;
  border-radius: 999px;
  background: #fff0a3;
  color: #6e5410;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.gate h2 {
  margin: 4px 0;
  font-size: 1.5rem;
}

.gate-help {
  margin: 0 0 16px;
  color: var(--ink-soft);
}

#pin-form {
  display: flex;
  gap: 10px;
  justify-content: center;
}

#pin {
  width: 9.5ch;
  padding: 10px 12px;
  border-radius: 16px;
  border: 2px solid #e6dcff;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: 0.25em;
  text-align: center;
}

#pin:focus {
  outline: 3px solid var(--lavender);
  outline-offset: 2px;
}

#pin-form button,
.session button {
  padding: 10px 22px;
  border-radius: 999px;
  border: 2px solid rgba(255, 255, 255, 0.9);
  background: linear-gradient(#ffd0de, #ffa8c2);
  color: #7a2e51;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

#pin-form.busy button {
  opacity: 0.6;
}

.error {
  min-height: 1.4em;
  margin: 12px 0 0;
  color: #c0508a;
  font-weight: 700;
}

.tag {
  margin-left: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #fff0a3;
  color: #6e5410;
  font-size: 0.7rem;
  font-weight: 800;
  vertical-align: middle;
  text-transform: uppercase;
}

.session {
  margin-top: 24px;
  text-align: center;
}

.session button {
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink-soft);
}
