:root {
  color-scheme: light;
  font-family: "Gill Sans", "Trebuchet MS", "Avenir Next", sans-serif;
  --text: #17345e;
  --text-soft: #5d6c8b;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background:
    radial-gradient(circle at top, rgba(255, 248, 196, 0.9), transparent 38%),
    linear-gradient(180deg, #fff8f1 0%, #f8e9ff 45%, #dff0ff 100%);
  color: var(--text);
}

.game-page {
  min-height: 100vh;
  padding: 18px 18px 24px;
}

.topbar {
  width: min(1320px, calc(100vw - 36px));
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.back-link,
.topbar-note {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.76);
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 30px rgba(42, 52, 102, 0.14);
}

.back-link {
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
}

.topbar-note {
  margin: 0;
  color: rgba(23, 52, 94, 0.74);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.72rem;
}

.page-shell {
  min-height: calc(100vh - 86px);
  display: grid;
  place-items: center;
  padding: 8px 0;
}

.game-shell {
  position: relative;
  width: min(calc(100vw - 40px), calc((100vh - 140px) * 1.6), 1440px);
  aspect-ratio: 16 / 10;
  max-height: calc(100vh - 140px);
  border-radius: 32px;
  overflow: hidden;
  box-shadow:
    0 28px 80px rgba(42, 52, 102, 0.24),
    inset 0 0 0 2px rgba(255, 255, 255, 0.75);
  background: #ffffff;
}

.game-shell:fullscreen {
  width: 100vw;
  height: 100vh;
  max-width: none;
  max-height: none;
  border-radius: 0;
}

#game {
  display: block;
  width: 100%;
  height: 100%;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(18, 34, 58, 0.16);
  backdrop-filter: blur(8px);
}

.hidden {
  display: none;
}

.panel {
  width: min(560px, 100%);
  padding: 30px 32px;
  border-radius: 28px;
  border: 2px solid rgba(255, 255, 255, 0.75);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(255, 241, 248, 0.92)),
    rgba(255, 255, 255, 0.92);
  box-shadow:
    0 22px 60px rgba(24, 42, 74, 0.16),
    inset 0 0 40px rgba(255, 210, 232, 0.28);
}

.small-panel {
  width: min(460px, 100%);
  text-align: center;
}

.eyebrow {
  margin: 0 0 8px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.75rem;
  color: #a34f82;
}

h1,
h2 {
  margin: 0;
  font-family: "Palatino Linotype", "Book Antiqua", serif;
  font-weight: 700;
  line-height: 1.05;
  color: var(--text);
}

h1 {
  font-size: clamp(2.5rem, 5vw, 4.2rem);
}

h2 {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
}

.lede {
  margin: 14px 0 18px;
  line-height: 1.6;
  font-size: 1.02rem;
}

.controls-grid {
  display: grid;
  grid-template-columns: auto auto;
  gap: 8px 18px;
  margin: 20px 0 24px;
  align-items: baseline;
}

.controls-grid span {
  color: var(--text-soft);
}

.controls-grid strong {
  color: var(--text);
}

button {
  appearance: none;
  border: 0;
  border-radius: 999px;
  padding: 14px 26px;
  font: inherit;
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, #ff7f9f, #7a66ff 70%, #3cc7ff);
  box-shadow:
    0 12px 25px rgba(104, 67, 175, 0.26),
    inset 0 0 18px rgba(255, 255, 255, 0.28);
  cursor: pointer;
}

button:hover {
  filter: brightness(1.05);
}

button:active {
  transform: translateY(1px);
}

@media (max-width: 720px) {
  .game-page {
    padding: 12px 12px 16px;
  }

  .topbar {
    margin-bottom: 10px;
    flex-direction: column;
    align-items: stretch;
  }

  .page-shell {
    min-height: auto;
  }

  .game-shell {
    width: min(calc(100vw - 24px), calc((100vh - 176px) * 1.6));
    max-height: calc(100vh - 176px);
  }

  .overlay {
    padding: 14px;
  }

  .panel {
    padding: 22px 18px;
    border-radius: 24px;
  }

  .controls-grid {
    gap: 7px 14px;
  }
}
