/* Miles' Fun Arcade — template styles */

:root {
  --sky-top: #4FB3E3;
  --sky-low: #92DCF2;
  --hill-1: #A6D86E;
  --hill-2: #74BF62;
  --hill-3: #5AA45E;
  --cream: #FBF3E2;
  --cream-deep: #E6D9BF;
  --navy: #1C2B4A;
  --white: #FFFFFF;
  --yellow: #F8D94A;
  --gold: #F5C64B;
  --orange: #EE7B3C;
  --orange-deep: #C95F25;
  --clay: #E8935E;
  --stripe: #FCEBC8;
  --door: #4DA3D6;
  --ink: #1C2B4A;
  --ink-soft: #4A5578;
  --font-display: 'Rubik', 'Arial Black', system-ui, sans-serif;
  --font-body: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --stage-max: 1200px;
  color-scheme: light;
  box-sizing: border-box;
}

*, *::before, *::after { box-sizing: inherit; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--cream);
  padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) env(safe-area-inset-bottom, 0px) env(safe-area-inset-left, 0px);
}

/* ---------- Scenery behind everything ---------- */

.scene {
  position: absolute;
  inset: 0 0 auto 0;
  height: 900px;
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-low) 62%);
  overflow: hidden;
  z-index: -1;
}
.hill { position: absolute; border-radius: 50%; }
.hill-back { left: -10%; right: -10%; top: 600px; height: 520px; background: var(--hill-1); }
.hill-left { left: -25%; width: 80%; top: 690px; height: 520px; background: var(--hill-2); }
.hill-right { right: -25%; width: 85%; top: 660px; height: 560px; background: var(--hill-3); }
.scene::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 860px;
  height: 40px;
  background: var(--cream);
}

/* ---------- Logo ---------- */

.site-header {
  display: flex;
  justify-content: center;
  padding: 28px 16px 8px;
}
.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  border-radius: 16px;
}
.logo:focus-visible { outline: 4px solid var(--yellow); outline-offset: 6px; }
.logo-icon {
  font-size: clamp(3rem, 7vw, 5.4rem);
  line-height: 1;
  filter: drop-shadow(4px 5px 0 var(--navy));
  transform: rotate(-8deg);
}
.logo-text { display: flex; flex-direction: column; line-height: 0.88; }
.logo-top, .logo-bottom {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 900;
  letter-spacing: -0.02em;
  text-shadow: 3px 4px 0 var(--navy);
  -webkit-text-stroke: 2px var(--navy);
}
.logo-top { color: var(--white); font-size: clamp(2.2rem, 5vw, 3.6rem); }
.logo-bottom { color: var(--yellow); font-size: clamp(2.6rem, 6.4vw, 4.6rem); }

/* ---------- Stage: the box where content and games appear ---------- */

.stage {
  width: min(var(--stage-max), calc(100% - 32px));
  margin: 12px auto 40px;
}

/* ---------- Home view ---------- */

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
  gap: 32px;
  align-items: center;
  padding: 24px 8px 40px;
}
.hero-copy { text-align: center; }
.eyebrow {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 800;
  font-size: clamp(1.1rem, 2vw, 1.5rem);
  color: var(--white);
  text-shadow: 2px 2px 0 var(--navy);
}
.welcome { margin: 0; display: flex; flex-direction: column; align-items: center; line-height: 0.95; }
.welcome-line, .welcome-name {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: -0.02em;
  -webkit-text-stroke: 2px var(--navy);
  text-shadow: 5px 6px 0 var(--navy);
}
.welcome-line { color: var(--white); font-size: clamp(2.6rem, 6vw, 5.4rem); }
.welcome-name { color: var(--yellow); font-size: clamp(2.6rem, 6vw, 5.4rem); max-width: 10ch; text-wrap: balance; }
.ribbon {
  display: inline-block;
  margin: 28px 0 0;
  padding: 12px 34px;
  background: var(--orange);
  color: var(--white);
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 800;
  font-size: clamp(1.1rem, 2.2vw, 1.6rem);
  transform: rotate(-2deg);
  box-shadow: 0 6px 0 var(--orange-deep);
}

/* Arcade building drawing */
.building { position: relative; padding-top: 70px; max-width: 520px; justify-self: center; width: 100%; }
.awning {
  height: 120px;
  border: 6px solid var(--navy);
  border-bottom-width: 8px;
  border-radius: 90px 90px 10px 10px;
  background: repeating-linear-gradient(90deg, var(--orange) 0 9%, var(--stripe) 9% 18%);
}
.marquee {
  position: absolute;
  left: 12%;
  right: 12%;
  top: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 18px 16px;
  background: var(--gold);
  border: 6px solid var(--navy);
  border-radius: 40px;
  outline: 4px dotted var(--white);
  outline-offset: -16px;
}
.marquee-icon { font-size: 2.4rem; }
.marquee-text {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 900;
  font-size: clamp(1.3rem, 2.6vw, 2.2rem);
  line-height: 1;
  color: var(--white);
  text-transform: uppercase;
  -webkit-text-stroke: 1.5px var(--navy);
  text-shadow: 2px 3px 0 var(--navy);
}
.building-body {
  position: relative;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  height: 260px;
  padding: 0 40px 0;
  margin: 0 14px;
  background: var(--clay);
  border: 6px solid var(--navy);
  border-top: 0;
  box-shadow: 0 18px 0 rgba(28, 43, 74, 0.25);
}
.door {
  position: relative;
  width: 36%;
  height: 78%;
  background: var(--door);
  border: 6px solid var(--navy);
  border-bottom: 0;
  border-radius: 14px 14px 0 0;
}
.door-split { position: absolute; left: 50%; top: 0; bottom: 0; width: 8px; transform: translateX(-50%); background: var(--yellow); }
.joystick { font-size: 3rem; margin-bottom: 40px; }

/* Games panel */
.games-panel {
  background: var(--cream);
  border-radius: 36px;
  padding: 36px 40px 44px;
  box-shadow: 0 14px 0 var(--cream-deep);
}
.games-heading {
  margin: 0 0 24px;
  font-family: var(--font-body);
  font-weight: 900;
  font-size: clamp(1.8rem, 3.4vw, 2.6rem);
  color: var(--navy);
}
.game-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 32px; }
.game-card {
  display: flex;
  flex-direction: column;
  border-radius: 28px;
  overflow: hidden;
  background: var(--white);
  border: 6px solid var(--white);
  box-shadow: 0 10px 0 var(--cream-deep);
}
.game-art {
  display: grid;
  text-decoration: none;
  place-items: center;
  aspect-ratio: 16 / 9;
  font-size: clamp(4rem, 9vw, 7rem);
  border-radius: 22px 22px 0 0;
}
.game-art span { transition: transform 0.25s ease; }
.game-card:hover .game-art span { transform: scale(1.08) rotate(-4deg); }
.game-info { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 20px 24px 22px; }
.game-name { margin: 0; font-weight: 900; font-size: 1.9rem; color: var(--navy); line-height: 1.1; }
.game-tag { margin: 2px 0 0; font-weight: 800; color: var(--ink-soft); }

/* ---------- Buttons ---------- */

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 0 24px;
  border: 0;
  border-radius: 999px;
  font-family: var(--font-body);
  font-weight: 900;
  font-size: 1.1rem;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.12s ease, background-color 0.12s ease;
  white-space: nowrap;
}
.pill:hover { transform: translateY(-2px); }
.pill:active { transform: translateY(1px); }
.pill:focus-visible { outline: 4px solid var(--navy); outline-offset: 3px; }
.pill-orange { background: var(--orange); color: var(--white); box-shadow: 0 4px 0 var(--orange-deep); }
.pill-light { background: var(--white); color: var(--navy); box-shadow: 0 4px 0 var(--cream-deep); }
.pill-play::before {
  content: "";
  width: 0;
  height: 0;
  border-left: 12px solid currentColor;
  border-top: 8px solid transparent;
  border-bottom: 8px solid transparent;
}
.pill[aria-current="true"] { background: var(--navy); color: var(--white); box-shadow: none; }

/* ---------- Game view: the game plays inside the box ---------- */

.game-view {
  background: var(--cream);
  border-radius: 36px;
  padding: 18px;
  box-shadow: 0 14px 0 var(--cream-deep);
}
.game-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}
.game-title { margin: 0 auto 0 8px; font-weight: 900; font-size: 1.8rem; color: var(--navy); }
.game-switch { display: flex; flex-wrap: wrap; gap: 8px; }
.game-frame-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-height: calc(100vh - 230px);
  min-height: 360px;
  border: 6px solid var(--navy);
  border-radius: 24px;
  overflow: hidden;
  background: var(--navy);
}
.game-frame-wrap:fullscreen { max-height: none; border: 0; border-radius: 0; }
.game-frame-wrap iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
.game-msg {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 24px;
  text-align: center;
  background: var(--cream);
  z-index: 2;
}
.game-msg-title { margin: 0; font-weight: 900; font-size: 1.8rem; color: var(--navy); }
.game-msg-text { margin: 0 0 8px; max-width: 46ch; font-weight: 800; color: var(--ink-soft); line-height: 1.45; }
.game-msg-text code { font-size: 0.95em; background: var(--white); padding: 2px 6px; border-radius: 6px; }

.noscript { text-align: center; font-weight: 900; font-size: 1.2rem; padding: 2rem; }

/* ---------- Smaller screens ---------- */

@media (max-width: 900px) {
  .hero { grid-template-columns: minmax(0, 1fr); }
  .building { max-width: 420px; }
  .building-body { height: 200px; }
  .games-panel { padding: 24px 20px 32px; }
}

@media (max-width: 560px) {
  .game-info { flex-direction: column; align-items: flex-start; }
  .game-frame-wrap { aspect-ratio: 3 / 4; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .pill, .game-art span { transition: none; }
}
