:root {
  color-scheme: light;
  --ink: #1d2433;
  --paper: #fff7df;
  --red: #d8302b;
  --blue: #1c72bf;
  --gold: #f6c744;
  --green: #2f9f64;
  --shadow: rgba(20, 27, 40, 0.24);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at 20% 12%, rgba(255, 223, 87, 0.58), transparent 19rem),
    linear-gradient(180deg, #78cdf4 0%, #bce8ff 42%, #fff2be 100%);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  font: inherit;
}

.shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.game-frame {
  position: relative;
  width: min(100%, 1120px);
  aspect-ratio: 16 / 9;
  max-height: calc(100vh - 48px);
  border: 8px solid #f7efd1;
  background: #68c7f3;
  box-shadow: 0 28px 80px var(--shadow);
  overflow: hidden;
}

#game {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: auto;
}

.topbar {
  position: absolute;
  inset: 14px 16px auto 16px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
  pointer-events: none;
}

.brand,
.meter {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 3px solid rgba(255, 255, 255, 0.8);
  background: rgba(255, 247, 223, 0.92);
  box-shadow: 0 8px 0 rgba(50, 30, 15, 0.14);
  font-weight: 900;
}

.brand {
  color: var(--red);
  text-transform: uppercase;
}

.meter span {
  min-width: 72px;
  padding: 4px 8px;
  border-radius: 3px;
  background: #fff;
  text-align: center;
}

.sun-mark {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: radial-gradient(circle, #fff59a 0 28%, var(--gold) 31% 100%);
  box-shadow: 0 0 0 4px rgba(246, 199, 68, 0.4);
}

.character-rail {
  position: absolute;
  left: 18px;
  bottom: 16px;
  display: flex;
  gap: 8px;
}

.character,
.touch-controls button,
#primaryAction {
  border: 3px solid #fff;
  background: #fdf4d0;
  color: var(--ink);
  box-shadow: 0 6px 0 rgba(74, 47, 18, 0.22);
  cursor: pointer;
}

.character {
  width: 100px;
  min-height: 52px;
  display: grid;
  grid-template-columns: 32px 1fr;
  align-items: center;
  gap: 6px;
  padding: 7px 8px;
  font-weight: 900;
}

.character.active {
  background: #fff;
  border-color: var(--gold);
  transform: translateY(2px);
  box-shadow: 0 4px 0 rgba(74, 47, 18, 0.22);
}

.avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 3px solid #fff;
  display: block;
}

.avatar.surfer {
  background: linear-gradient(135deg, #f36d38 0 48%, #fff 49% 59%, #1e6fc7 60%);
}

.avatar.swimmer {
  background: linear-gradient(135deg, #4db7ff 0 48%, #fff 49% 59%, #176e8c 60%);
}

.avatar.climber {
  background: linear-gradient(135deg, #8f4f25 0 48%, #fff 49% 59%, #3fba62 60%);
}

.touch-controls {
  position: absolute;
  right: 18px;
  bottom: 16px;
  display: none;
  gap: 8px;
}

.touch-controls button {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  font-size: 22px;
  font-weight: 900;
}

.curtain {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 16px;
  padding: 28px;
  text-align: center;
  background:
    linear-gradient(rgba(255, 247, 223, 0.78), rgba(255, 247, 223, 0.82)),
    radial-gradient(circle at 50% 0%, rgba(246, 199, 68, 0.6), transparent 32rem);
}

.curtain.hidden {
  display: none;
}

.curtain h1 {
  margin: 0;
  color: var(--red);
  font-size: clamp(42px, 8vw, 96px);
  line-height: 0.9;
  text-transform: uppercase;
  text-shadow: 0 6px 0 #fff, 0 12px 0 rgba(29, 36, 51, 0.18);
}

.curtain p {
  max-width: 620px;
  margin: 0;
  font-size: clamp(16px, 2.1vw, 22px);
  font-weight: 700;
}

.seal {
  padding: 8px 14px;
  background: var(--blue);
  color: #fff;
  border: 3px solid #fff;
  font-weight: 900;
  text-transform: uppercase;
}

#primaryAction {
  min-width: 132px;
  min-height: 52px;
  padding: 10px 20px;
  background: var(--red);
  color: #fff;
  font-weight: 900;
  text-transform: uppercase;
}

@media (max-width: 760px), (pointer: coarse) {
  .shell {
    padding: 8px;
  }

  .game-frame {
    border-width: 4px;
    max-height: calc(100vh - 16px);
  }

  .brand {
    display: none;
  }

  .topbar {
    inset: 8px 8px auto 8px;
  }

  .meter {
    width: 100%;
    justify-content: space-between;
    min-height: 34px;
    padding: 5px;
    font-size: 12px;
  }

  .meter span {
    min-width: 0;
    flex: 1;
  }

  .character-rail {
    left: 8px;
    bottom: 8px;
  }

  .character {
    width: 58px;
    min-height: 46px;
    grid-template-columns: 1fr;
    justify-items: center;
    padding: 5px;
    font-size: 10px;
  }

  .avatar {
    width: 24px;
    height: 24px;
  }

  .touch-controls {
    display: flex;
  }

  .curtain {
    gap: 7px;
    padding: 10px;
  }

  .curtain h1 {
    font-size: clamp(28px, 12vw, 50px);
    line-height: 0.88;
    text-shadow: 0 3px 0 #fff, 0 7px 0 rgba(29, 36, 51, 0.16);
  }

  .curtain p {
    max-width: 340px;
    font-size: 14px;
    line-height: 1.15;
  }

  .seal {
    padding: 5px 9px;
    border-width: 2px;
    font-size: 12px;
  }

  #primaryAction {
    min-width: 96px;
    min-height: 36px;
    padding: 6px 12px;
    border-width: 2px;
    font-size: 13px;
  }
}
