:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-solid: #ffffff;
  --text: #23415d;
  --muted: #6d8399;
  --primary: #5f8ef7;
  --primary-dark: #3f6ddf;
  --error: #d85c5c;
  --shadow: 0 18px 50px rgba(72, 98, 138, 0.16);
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius-md: 18px;
  --max-width: 1120px;
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 203, 119, 0.3), transparent 34%),
    radial-gradient(circle at top right, rgba(95, 142, 247, 0.16), transparent 30%),
    linear-gradient(180deg, #fbfdff 0%, var(--bg) 100%);
}

.app-shell {
  width: min(calc(100% - 20px), var(--max-width));
  margin: 0 auto;
  padding: 10px 0 24px;
}

.hero-panel,
.portal-screen {
  background: var(--panel);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 20px;
}

.page-panel {
  min-height: calc(100vh - 24px);
}

.hero-panel {
  min-height: calc(100vh - 24px);
  display: grid;
  align-content: center;
  gap: 16px;
  text-align: center;
}

.eyebrow {
  margin: 0;
  color: var(--primary-dark);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.82rem;
  font-weight: 700;
}

h1, h2, p { margin: 0; }
h1 {
  font-size: clamp(2.2rem, 10vw, 4.3rem);
  line-height: 1.05;
}
h2 {
  font-size: clamp(1.5rem, 7vw, 2.4rem);
}

.hero-copy {
  color: var(--muted);
  font-size: 1.05rem;
}

.code-form {
  display: grid;
  gap: 12px;
  width: min(100%, 420px);
  margin: 8px auto 0;
}

input, button {
  font: inherit;
}

input {
  width: 100%;
  border: 2px solid rgba(95, 142, 247, 0.14);
  border-radius: 999px;
  padding: 16px 20px;
  background: var(--panel-solid);
  color: var(--text);
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.7);
}
input:focus {
  border-color: rgba(95, 142, 247, 0.62);
  box-shadow: 0 0 0 4px rgba(95, 142, 247, 0.16);
}

button,
.ghost-button,
.primary-button {
  border: 0;
  border-radius: 999px;
  padding: 14px 20px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
button:hover,
.ghost-button:hover,
.primary-button:hover { transform: translateY(-1px); }

.code-form button,
.primary-button {
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  box-shadow: 0 14px 28px rgba(63, 109, 223, 0.24);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.ghost-button {
  background: rgba(255, 255, 255, 0.78);
  color: var(--text);
  border: 1px solid rgba(95, 142, 247, 0.16);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.error-message {
  color: var(--error);
  font-weight: 600;
}

.portal-screen {
  display: grid;
  gap: 18px;
}

.dashboard-header,
.game-header {
  display: grid;
  gap: 12px;
}

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

.game-card {
  background: rgba(255, 255, 255, 0.92);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(95, 142, 247, 0.12);
  box-shadow: 0 12px 30px rgba(72, 98, 138, 0.10);
  overflow: hidden;
  padding: 12px;
  text-align: left;
  display: grid;
  gap: 12px;
}

.game-thumb {
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: var(--radius-md);
  object-fit: cover;
  background: #dbe8ff;
}

.game-card h3 {
  font-size: 1.08rem;
}

.game-card p {
  color: var(--muted);
  font-size: 0.95rem;
}

.game-card .primary-button {
  width: 100%;
}

.game-stage {
  min-height: 62vh;
  border-radius: var(--radius-xl);
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(95, 142, 247, 0.12);
  overflow: hidden;
}

.game-page {
  grid-template-rows: auto 1fr;
}

#game-frame {
  width: 100%;
  height: 100%;
  min-height: 62vh;
  border: 0;
  display: block;
  background: white;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (min-width: 721px) {
  .app-shell {
    width: min(calc(100% - 32px), var(--max-width));
    padding: 32px 0 56px;
  }

  .hero-panel,
  .portal-screen {
    padding: 28px;
    border-radius: var(--radius-xl);
  }

  .hero-panel,
  .page-panel {
    min-height: calc(100vh - 88px);
  }

  .hero-panel {
    gap: 18px;
  }

  .portal-screen {
    gap: 22px;
  }

  .dashboard-header,
  .game-header {
    grid-template-columns: 1fr auto;
    align-items: center;
  }

  .game-grid {
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 18px;
  }

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