/* style.css */
:root {
  color-scheme: dark;
  --page: #0b1120;
  --page-glow: #17264b;
  --surface: rgba(21, 33, 61, 0.82);
  --surface-strong: #18284b;
  --border: rgba(188, 218, 255, 0.2);
  --text: #f3f7ff;
  --muted: #aebedb;
  --accent: #80d7ff;
  --accent-strong: #467ee8;
  --gold: #ffe68a;
  --shadow: rgba(0, 0, 0, 0.32);
  --touch-art: url("https://assets.popchat.com/assets/kenney/mobile-controls/Sprites/Highlights%20A/Default/button_bean_highlight.png");
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --page: #dcecff;
    --page-glow: #b5d4f8;
    --surface: rgba(248, 252, 255, 0.88);
    --surface-strong: #ffffff;
    --border: rgba(35, 78, 143, 0.19);
    --text: #132445;
    --muted: #536886;
    --accent: #2578bc;
    --accent-strong: #296bcb;
    --gold: #a86511;
    --shadow: rgba(43, 76, 124, 0.15);
  }
}

:root[data-theme="light"] {
  color-scheme: light;
  --page: #dcecff;
  --page-glow: #b5d4f8;
  --surface: rgba(248, 252, 255, 0.88);
  --surface-strong: #ffffff;
  --border: rgba(35, 78, 143, 0.19);
  --text: #132445;
  --muted: #536886;
  --accent: #2578bc;
  --accent-strong: #296bcb;
  --gold: #a86511;
  --shadow: rgba(43, 76, 124, 0.15);
}

:root[data-theme="dark"] {
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--page);
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 18% 0%, var(--page-glow), transparent 42rem),
    var(--page);
  color: var(--text);
  font-family: ui-rounded, "Arial Rounded MT Bold", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 14px;
  color: inherit;
  font: inherit;
  font-weight: 800;
  letter-spacing: 0.04em;
  cursor: pointer;
  touch-action: manipulation;
}

button:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
}

.app-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 16px 12px 20px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin: 2px 4px 14px;
}

.brand h1,
.panel-card h2,
p {
  margin: 0;
}

.brand h1 {
  font-size: clamp(1.55rem, 5vw, 2.3rem);
  line-height: 1;
  letter-spacing: -0.04em;
}

.eyebrow,
.panel-kicker,
.hud-label {
  color: var(--accent);
  font-size: 0.67rem;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.eyebrow {
  margin-bottom: 6px;
}

.top-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.utility-button,
.pause-button {
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: 0 5px 14px var(--shadow);
  color: var(--text);
  font-size: 0.68rem;
}

.utility-button:hover,
.pause-button:hover {
  border-color: var(--accent);
  background: var(--surface-strong);
}

.game-frame {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 22px;
  background: #558fdb;
  box-shadow: 0 20px 50px var(--shadow);
}

#gameCanvas {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #558fdb;
  image-rendering: auto;
}

.hud {
  position: absolute;
  inset: 12px 12px auto;
  display: flex;
  align-items: flex-start;
  gap: 7px;
  pointer-events: none;
}

.hud-card {
  min-width: 62px;
  padding: 7px 10px 6px;
  border: 1px solid rgba(235, 250, 255, 0.26);
  border-radius: 11px;
  background: rgba(12, 25, 52, 0.7);
  color: #ffffff;
  backdrop-filter: blur(8px);
}

.hud-card strong {
  display: block;
  margin-top: 1px;
  font-size: 1.05rem;
  line-height: 1;
}

.hud .hud-label {
  color: #aee7ff;
  font-size: 0.53rem;
}

.pause-button {
  margin-left: auto;
  color: #ffffff;
  pointer-events: auto;
}

.screen-panel {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(10, 19, 42, 0.36);
  backdrop-filter: blur(3px);
  transition: opacity 160ms ease, visibility 160ms ease;
}

.screen-panel.hidden {
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.panel-card {
  width: min(460px, 100%);
  padding: clamp(20px, 5vw, 34px);
  border: 1px solid rgba(232, 248, 255, 0.3);
  border-radius: 22px;
  background: rgba(17, 31, 61, 0.9);
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.3);
  text-align: center;
}

.panel-kicker {
  margin-bottom: 9px;
  color: #94e2ff;
}

.panel-card h2 {
  color: #ffffff;
  font-size: clamp(1.55rem, 6vw, 2.45rem);
  letter-spacing: -0.04em;
  line-height: 1;
}

.panel-card p:not(.panel-kicker) {
  max-width: 37ch;
  margin: 14px auto 0;
  color: #d2e0fa;
  font-size: 0.94rem;
  line-height: 1.55;
}

.panel-buttons {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
  margin-top: 21px;
}

.primary-button,
.secondary-button {
  width: 100%;
  padding: 0 18px;
}

.primary-button {
  background: linear-gradient(180deg, #75dcff, #397ee2);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.48), 0 7px 0 #2457ad;
  color: #09214a;
}

.primary-button:active {
  transform: translateY(4px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 3px 0 #2457ad;
}

.secondary-button {
  border: 1px solid rgba(194, 224, 255, 0.3);
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.control-note {
  color: #a9bedf !important;
  font-size: 0.74rem !important;
}

.touch-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 13px;
  padding: 0 4px;
  user-select: none;
  -webkit-user-select: none;
}

.move-controls {
  display: flex;
  gap: 9px;
}

.touch-button {
  position: relative;
  isolation: isolate;
  min-width: 72px;
  min-height: 58px;
  padding: 0 14px;
  overflow: hidden;
  border: 1px solid rgba(160, 210, 255, 0.28);
  background-color: #254b91;
  background-image:
    linear-gradient(rgba(26, 65, 134, 0.68), rgba(24, 47, 105, 0.8)),
    var(--touch-art);
  background-position: center;
  background-size: cover;
  box-shadow: 0 5px 0 #122b65, 0 8px 15px var(--shadow);
  color: #ffffff;
  font-size: 0.72rem;
  text-shadow: 0 1px 2px #071632;
}

.jump-button {
  min-width: 110px;
  background-color: #376b9d;
  background-image:
    linear-gradient(rgba(54, 136, 183, 0.5), rgba(20, 72, 127, 0.85)),
    var(--touch-art);
}

.touch-button.active,
.touch-button:active {
  transform: translateY(4px);
  box-shadow: 0 1px 0 #122b65, 0 3px 8px var(--shadow);
  filter: brightness(1.16);
}

.footer-bar {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin: 12px 5px 0;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.4;
}

.footer-bar p:first-child {
  color: var(--accent);
  font-weight: 800;
}

@media (min-width: 700px) {
  .app-shell {
    padding: 24px 22px;
  }

  .panel-buttons {
    grid-template-columns: 1fr 1fr;
  }

  .touch-controls {
    max-width: 640px;
    margin-right: auto;
    margin-left: auto;
  }

  .touch-button {
    min-width: 100px;
  }

  .jump-button {
    min-width: 145px;
  }
}

@media (max-width: 480px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .utility-button {
    flex: 1;
  }

  .hud {
    inset: 8px 8px auto;
    gap: 4px;
  }

  .hud-card {
    min-width: 52px;
    padding: 5px 7px;
  }

  .pause-button {
    min-height: 34px;
    padding: 0 8px;
    font-size: 0.6rem;
  }

  .footer-bar {
    flex-direction: column;
    gap: 3px;
  }

  .footer-bar p:last-child {
    display: none;
  }
}
