@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@600;700;800;900&display=swap');

:root {
  color-scheme: light;
  font-family: "Nunito", "Trebuchet MS", sans-serif;
  color: #173c60;
  background: #d7f4ff;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    radial-gradient(ellipse at 12% 18%, rgba(255,255,255,.82) 0 2%, transparent 20%),
    radial-gradient(ellipse at 88% 82%, rgba(255,255,255,.55) 0 3%, transparent 22%),
    linear-gradient(145deg, #dff8ff 0%, #c8efff 48%, #e8faff 100%);
}

button { font: inherit; }

.game-shell {
  width: min(100%, 560px);
  padding: 18px;
  border: 1px solid rgba(255,255,255,.95);
  border-radius: 28px;
  background: rgba(255,255,255,.78);
  box-shadow: 0 22px 70px rgba(41, 111, 153, .2), inset 0 1px 0 #fff;
  backdrop-filter: blur(12px);
}

.topbar {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 4px 13px;
}

.wordmark {
  color: #174b73;
  font-size: 19px;
  font-weight: 1000;
  letter-spacing: .045em;
  line-height: .9;
  text-decoration: none;
}

.wordmark span {
  display: block;
  margin-top: 5px;
  color: #65a2bd;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .24em;
}

.scoreboard {
  display: flex;
  gap: 20px;
  margin-left: auto;
  margin-right: 17px;
}

.scoreboard div { display: grid; justify-items: center; gap: 0; }
.score-label { color: #77a5b8; font-size: 8px; font-weight: 900; letter-spacing: .13em; }
.scoreboard strong { color: #1b4e73; font-size: 17px; line-height: 1.1; }

.pause-button {
  width: 35px;
  height: 35px;
  border: 1px solid #d5edf5;
  border-radius: 11px;
  color: #3685a6;
  background: #f8fdff;
  font-size: 16px;
  font-weight: 900;
  cursor: pointer;
}

.pause-button[hidden], .secondary-button[hidden] { display: none; }
.pause-button:hover { background: #eaf8fd; }

.game-frame {
  position: relative;
  overflow: hidden;
  width: 100%;
  height: min(70svh, 680px);
  min-height: 420px;
  border: 5px solid #fff;
  border-radius: 20px;
  background: #80dfff;
  box-shadow: 0 8px 18px rgba(52, 126, 158, .16);
  isolation: isolate;
}

#game-canvas { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
#game-canvas.is-aiming { cursor: grabbing; }

.screen-card {
  position: absolute;
  z-index: 3;
  inset: 0;
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  padding: 24px;
  text-align: center;
  background: linear-gradient(180deg, rgba(20, 87, 130, .2), rgba(20, 72, 111, .53));
  transition: opacity .22s ease, visibility .22s ease;
}

.screen-card.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.card-sparkle { color: #fff28a; font-size: 35px; line-height: 1; text-shadow: 0 2px 0 #f6a948; }
.eyebrow { margin: 10px 0 7px; color: #e6fbff; font-size: 10px; font-weight: 1000; letter-spacing: .2em; text-shadow: 0 2px 5px #387ba2; }

.screen-card h1 {
  max-width: 100%;
  margin: 0;
  color: #fff;
  font-size: clamp(24px, 8.5vw, 64px);
  font-weight: 1000;
  line-height: .95;
  letter-spacing: -.045em;
  text-shadow: 0 4px 0 #2187b0, 0 8px 18px rgba(24,78,111,.3);
}

.card-copy { margin: 14px 0 20px; color: #f1fcff; font-size: 13px; font-weight: 800; line-height: 1.5; text-shadow: 0 1px 4px #36799b; }
.card-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 11px; }

.play-button, .secondary-button {
  min-width: 162px;
  padding: 13px 17px;
  border: 0;
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(180deg, #ffbd52, #ff8e36);
  box-shadow: 0 5px 0 #d66b2b, 0 9px 18px rgba(47, 86, 107, .25);
  font-size: 12px;
  font-weight: 1000;
  letter-spacing: .07em;
  cursor: pointer;
  transition: transform .12s, box-shadow .12s;
}

.play-button:hover, .secondary-button:hover { transform: translateY(-2px); box-shadow: 0 7px 0 #d66b2b, 0 12px 20px rgba(47,86,107,.26); }
.play-button:active, .secondary-button:active { transform: translateY(3px); box-shadow: 0 2px 0 #d66b2b; }
.play-button span { margin-left: 8px; font-size: 15px; }
.secondary-button { color: #276386; background: #f2fbff; box-shadow: 0 5px 0 #b5dce9, 0 9px 18px rgba(47,86,107,.2); }
.secondary-button:hover { box-shadow: 0 7px 0 #b5dce9, 0 12px 20px rgba(47,86,107,.26); }
.secondary-button:active { box-shadow: 0 2px 0 #b5dce9; }
.card-hint { margin: 18px 0 0; color: rgba(239,252,255,.9); font-size: 8px; font-weight: 900; letter-spacing: .12em; }

.game-caption {
  position: absolute;
  z-index: 2;
  bottom: 11px;
  left: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: rgba(34, 86, 116, .8);
  font-size: 8px;
  font-weight: 1000;
  letter-spacing: .1em;
  pointer-events: none;
}

.caption-dot { width: 6px; height: 6px; border-radius: 50%; background: #ff9a43; box-shadow: 0 0 0 3px rgba(255,255,255,.45); }
.instructions {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  padding: 15px 3px 1px;
  color: #709bb0;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .06em;
}

.instructions span { display: inline-flex; align-items: center; gap: 5px; }
.instructions kbd { min-width: 20px; padding: 3px 5px; border: 1px solid #d7edf4; border-radius: 5px; color: #46819b; background: #fff; box-shadow: 0 2px 0 #c6e2eb; font: inherit; text-align: center; }
.instruction-divider { color: #a9cad6; }

@media (max-width: 560px) {
  body { padding: 10px; }
  .game-shell { padding: 12px; border-radius: 23px; }
  .topbar { min-height: 52px; }
  .game-frame { height: min(70svh, 680px); min-height: 360px; }
  .instructions { gap: 7px; font-size: 8px; letter-spacing: .02em; }
}

@media (max-width: 360px) {
  body { padding: 6px; }
  .game-shell { padding: 9px; }
  .topbar { gap: 7px; }
  .wordmark { font-size: 15px; }
  .wordmark span { font-size: 7px; letter-spacing: .18em; }
  .scoreboard { gap: 9px; margin-right: 7px; }
  .pause-button { width: 32px; height: 32px; }
  .instructions { gap: 5px; font-size: 7px; }
}

@media (max-height: 620px) {
  body { padding-top: 8px; padding-bottom: 8px; }
  .game-shell { padding-top: 10px; padding-bottom: 10px; }
  .topbar { min-height: 45px; }
  .game-frame { height: 65svh; min-height: 320px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
