:root {
  color-scheme: light;
  --paper: #f8edcf;
  --cream: #fffdf6;
  --ink: #17130e;
  --muted: #645743;
  --green: #2eb56f;
  --blue: #3f76d8;
  --red: #e14d3d;
  --yellow: #f2c94c;
  --teal: #66cfc3;
  --pink: #f59ab3;
  --violet: #8e78df;
  --shadow: rgba(23, 19, 14, 0.2);
  --border: 4px solid var(--ink);
  font-family: Inter, ui-rounded, "Arial Rounded MT Bold", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
  -webkit-user-select: none;
  user-select: none;
}

html,
body {
  min-height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(23, 19, 14, 0.06) 1px, transparent 1px),
    linear-gradient(180deg, rgba(23, 19, 14, 0.05) 1px, transparent 1px),
    var(--paper);
  background-size: 28px 28px;
  color: var(--ink);
  overscroll-behavior: none;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-text-size-adjust: 100%;
}

button {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.shell {
  width: 100%;
  min-height: 100svh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  padding: max(14px, env(safe-area-inset-top)) 12px max(8px, env(safe-area-inset-bottom));
}

.screen {
  min-width: 0;
  width: calc(100vw - 24px);
  max-width: 430px;
  height: min(calc(100svh - 24px), 780px);
  min-height: min(620px, calc(100svh - 24px));
  position: relative;
  display: flex;
  flex-direction: column;
}

.is-hidden {
  display: none !important;
}

.brand-row,
.hud,
.start-actions,
.result-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand-row {
  min-height: 44px;
  flex: 0 0 auto;
  font-size: 0.83rem;
  font-weight: 950;
  text-transform: uppercase;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: var(--border);
  border-radius: 50%;
  background: var(--green);
  box-shadow: 3px 3px 0 var(--ink);
}

.icon-button,
.primary-button,
.secondary-button {
  min-height: 48px;
  border: var(--border);
  border-radius: 8px;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 950;
  line-height: 1;
  box-shadow: 5px 5px 0 var(--ink);
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease;
}

.icon-button {
  min-width: 70px;
  height: 42px;
  min-height: 42px;
  padding: 0 10px;
  border-width: 3px;
  border-radius: 999px;
  background: var(--cream);
  font-size: 0.72rem;
  box-shadow: 3px 3px 0 var(--ink);
}

.icon-button[aria-pressed="false"] {
  background: #ffd8d1;
}

.primary-button,
.secondary-button {
  min-width: 136px;
  padding: 0 18px;
}

.primary-button {
  background: var(--green);
}

#startButton,
#retryButton {
  min-height: 64px;
  width: 100%;
  justify-content: center;
  border-width: 5px;
  font-size: 1.14rem;
  box-shadow: 7px 7px 0 var(--ink);
  animation: ctaPulse 1.6s ease-in-out infinite;
}

#retryButton {
  background: var(--yellow);
}

.secondary-button {
  background: var(--cream);
}

.secondary-button.is-revive {
  background: var(--green);
  color: #fffdf6;
}

.primary-button:active,
.secondary-button:active,
.icon-button:active,
.upgrade-card:active {
  transform: translate(4px, 4px);
  box-shadow: 1px 1px 0 var(--ink);
}

.start-screen {
  justify-content: space-between;
  gap: 12px;
}

.hero-art {
  flex: 1;
  min-height: 0;
  position: relative;
  overflow: hidden;
  border: var(--border);
  border-radius: 8px;
  background: #1f2733;
  box-shadow: 6px 6px 0 var(--ink);
}

.hero-art img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center;
}

.hero-scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(23, 19, 14, 0.04), rgba(23, 19, 14, 0.08) 38%, rgba(23, 19, 14, 0.74));
}

.title-stack {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 16px;
  color: var(--cream);
  text-shadow: 0 3px 0 rgba(23, 19, 14, 0.5);
}

.eyebrow {
  margin: 0 0 8px;
  color: inherit;
  font-size: 0.76rem;
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 9ch;
  margin-bottom: 10px;
  font-size: clamp(2.8rem, 10.8vw, 4.45rem);
  line-height: 0.88;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 8px;
  font-size: clamp(1.55rem, 6.5vw, 2.6rem);
  line-height: 0.94;
  letter-spacing: 0;
}

.intro-copy,
.start-note,
.result-copy {
  margin-bottom: 0;
  color: var(--muted);
  font-size: clamp(0.98rem, 3.5vw, 1.14rem);
  font-weight: 850;
  line-height: 1.28;
}

.title-stack .intro-copy {
  max-width: 24rem;
  color: rgba(255, 253, 246, 0.94);
}

.start-actions {
  flex: 0 0 auto;
  align-items: stretch;
  flex-direction: column;
  flex-wrap: nowrap;
  gap: 10px;
}

.start-note {
  flex: none;
  text-align: center;
}

.game-screen {
  gap: 7px;
}

.hud {
  flex: 0 0 auto;
  gap: 8px;
}

.hud-item {
  min-width: 0;
  flex: 1 1 0;
  height: 56px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: var(--cream);
  box-shadow: 3px 3px 0 var(--ink);
}

.hud-item.objective strong {
  color: var(--blue);
}

.hud-item span {
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 950;
  text-transform: uppercase;
}

.hud-item strong {
  overflow: hidden;
  font-size: clamp(1.03rem, 4.4vw, 1.48rem);
  font-weight: 950;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html[data-capture="thin"] .brand-row,
html[data-capture="thin"] .eyebrow,
html[data-capture="thin"] .hud-item span,
html[data-capture="thin"] .hud-item strong,
html[data-capture="thin"] .toast,
html[data-capture="thin"] .upgrade-card strong,
html[data-capture="thin"] .upgrade-card span,
html[data-capture="thin"] .result-panel dd {
  font-weight: 760;
}

html[data-capture="thin"] h1,
html[data-capture="thin"] h2,
html[data-capture="thin"] .primary-button,
html[data-capture="thin"] .secondary-button,
html[data-capture="thin"] .icon-button {
  font-weight: 820;
}

.hud-item.energy strong {
  color: var(--red);
}

.xp-frame {
  flex: 0 0 auto;
  height: 18px;
  overflow: hidden;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--cream);
  box-shadow: 3px 3px 0 var(--ink);
}

.xp-fill {
  width: 0%;
  height: 100%;
  display: block;
  background: linear-gradient(90deg, var(--teal), var(--blue));
  transition: width 120ms ease;
}

.objective-strip {
  flex: 0 0 auto;
  min-height: 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 10px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: var(--cream);
  box-shadow: 3px 3px 0 var(--ink);
}

.objective-strip span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 950;
  text-transform: uppercase;
}

.objective-strip strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 950;
  line-height: 1.1;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.canvas-wrap {
  flex: 1 1 auto;
  min-height: 0;
  aspect-ratio: 360 / 580;
  width: 100%;
  max-height: 100%;
  align-self: center;
  position: relative;
  overflow: hidden;
  border: var(--border);
  border-radius: 8px;
  background: #fff7df;
  box-shadow: 5px 5px 0 var(--ink);
  will-change: transform;
}

.canvas-wrap.is-shaking {
  animation: canvasShake 120ms linear infinite;
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.warning-pulse {
  position: absolute;
  inset: 0;
  border: 8px solid rgba(225, 77, 61, 0);
  pointer-events: none;
  transition: border-color 120ms ease;
}

.warning-pulse.is-hot {
  border-color: rgba(225, 77, 61, 0.58);
  animation: warningFlash 420ms ease-in-out infinite alternate;
}

.toast {
  position: absolute;
  left: 12px;
  right: 12px;
  top: 12px;
  min-height: 46px;
  display: grid;
  place-items: center;
  padding: 8px 12px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: var(--cream);
  box-shadow: 4px 4px 0 var(--ink);
  font-size: 0.92rem;
  font-weight: 950;
  text-align: center;
  pointer-events: none;
}

.joystick {
  width: 104px;
  height: 104px;
  position: absolute;
  left: 82px;
  bottom: 24px;
  z-index: 8;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  touch-action: none;
  transition: opacity 120ms ease;
}

.joystick.is-visible,
.joystick.is-active {
  opacity: 0.68;
}

.joystick-ring,
.joystick-knob {
  position: absolute;
  inset: 0;
  border-radius: 50%;
}

.joystick-ring {
  border: 3px solid rgba(23, 19, 14, 0.58);
  background: rgba(255, 253, 246, 0.48);
  box-shadow: none;
}

.joystick-knob {
  width: 42px;
  height: 42px;
  top: calc(50% - 21px);
  left: calc(50% - 21px);
  border: 3px solid rgba(23, 19, 14, 0.72);
  background: rgba(102, 207, 195, 0.82);
  box-shadow: none;
  pointer-events: none;
}

.upgrade-overlay {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 16px;
  overflow: hidden;
  background: rgba(23, 19, 14, 0.58);
}

.upgrade-panel {
  width: 100%;
  max-width: 394px;
  position: relative;
  z-index: 2;
  padding: 18px 16px 16px;
  border: 5px solid var(--ink);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 253, 246, 0.96), rgba(255, 244, 217, 0.96)),
    radial-gradient(circle at 20% 0%, rgba(242, 201, 76, 0.42), transparent 34%),
    radial-gradient(circle at 88% 18%, rgba(102, 207, 195, 0.34), transparent 30%),
    var(--cream);
  box-shadow: 8px 8px 0 var(--ink);
  animation: upgradePop 420ms cubic-bezier(0.2, 1.2, 0.2, 1);
}

.upgrade-panel .eyebrow {
  color: var(--muted);
  margin-bottom: 6px;
}

.upgrade-panel h2 {
  margin-bottom: 6px;
}

.upgrade-choices {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.upgrade-card {
  width: 100%;
  min-height: 92px;
  display: grid;
  grid-template-columns: 66px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  position: relative;
  overflow: hidden;
  padding: 13px 14px 13px 12px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.5), rgba(255, 253, 246, 0) 36%),
    #fff4d9;
  color: var(--ink);
  text-align: left;
  box-shadow: 4px 4px 0 var(--ink);
  cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.upgrade-card:nth-child(2) {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.52), rgba(255, 253, 246, 0) 36%),
    #e8f7ff;
}

.upgrade-card:nth-child(3) {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.52), rgba(255, 253, 246, 0) 36%),
    #ecf9dd;
}

.upgrade-card:hover {
  transform: translate(-2px, -2px);
  box-shadow: 6px 6px 0 var(--ink);
}

.upgrade-hotkey {
  width: 28px;
  height: 28px;
  position: absolute;
  left: 8px;
  top: 8px;
  z-index: 2;
  display: grid;
  place-items: center;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--cream);
  font-size: 0.82rem;
  font-weight: 950;
  line-height: 1;
  box-shadow: 2px 2px 0 var(--ink);
}

.upgrade-medal {
  width: 64px;
  height: 64px;
  position: relative;
  display: grid;
  place-items: center;
  border: 4px solid var(--ink);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.76), transparent 24%),
    var(--teal);
  box-shadow: 4px 4px 0 var(--ink);
}

.upgrade-medal::before,
.upgrade-medal::after,
.upgrade-symbol,
.upgrade-symbol::before,
.upgrade-symbol::after {
  content: "";
  position: absolute;
  display: block;
}

.upgrade-copy {
  min-width: 0;
  position: relative;
  z-index: 2;
}

.upgrade-card strong {
  display: block;
  margin-bottom: 5px;
  font-size: 1.08rem;
  font-weight: 950;
  line-height: 1.05;
}

.upgrade-copy span {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 850;
  line-height: 1.2;
}

.upgrade-spark {
  width: 120px;
  height: 120px;
  position: absolute;
  right: -56px;
  top: -54px;
  opacity: 0.28;
  background: conic-gradient(from 22deg, transparent 0 12deg, var(--yellow) 12deg 22deg, transparent 22deg 44deg);
  animation: rewardSpin 8s linear infinite;
}

.upgrade-icon-email .upgrade-symbol {
  width: 32px;
  height: 23px;
  left: 14px;
  top: 20px;
  border: 4px solid var(--ink);
  border-radius: 4px;
  background: #fffdf6;
}

.upgrade-icon-email .upgrade-symbol::before,
.upgrade-icon-email .upgrade-symbol::after {
  width: 19px;
  height: 4px;
  top: 8px;
  background: var(--ink);
}

.upgrade-icon-email .upgrade-symbol::before {
  left: -1px;
  transform: rotate(31deg);
}

.upgrade-icon-email .upgrade-symbol::after {
  right: -1px;
  transform: rotate(-31deg);
}

.upgrade-icon-turbo {
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.76), transparent 24%),
    var(--yellow);
}

.upgrade-icon-turbo .upgrade-symbol {
  width: 24px;
  height: 38px;
  left: 20px;
  top: 12px;
  background: var(--ink);
  clip-path: polygon(44% 0, 100% 0, 66% 35%, 98% 35%, 36% 100%, 48% 56%, 12% 56%);
}

.upgrade-icon-speed .upgrade-symbol {
  width: 34px;
  height: 34px;
  left: 17px;
  top: 15px;
  border: 4px solid var(--ink);
  border-left-color: transparent;
  border-bottom-color: transparent;
  transform: rotate(45deg);
}

.upgrade-icon-speed .upgrade-symbol::before,
.upgrade-icon-speed .upgrade-symbol::after {
  width: 20px;
  height: 4px;
  right: 17px;
  background: var(--ink);
}

.upgrade-icon-speed .upgrade-symbol::before {
  top: 7px;
}

.upgrade-icon-speed .upgrade-symbol::after {
  top: 19px;
}

.upgrade-icon-magnet {
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.76), transparent 24%),
    var(--violet);
}

.upgrade-icon-magnet .upgrade-symbol {
  width: 32px;
  height: 34px;
  left: 16px;
  top: 14px;
  border: 8px solid var(--ink);
  border-top: 0;
  border-radius: 0 0 16px 16px;
}

.upgrade-icon-magnet .upgrade-symbol::before,
.upgrade-icon-magnet .upgrade-symbol::after {
  width: 10px;
  height: 9px;
  top: -3px;
  background: var(--cream);
  border: 3px solid var(--ink);
}

.upgrade-icon-magnet .upgrade-symbol::before {
  left: -11px;
}

.upgrade-icon-magnet .upgrade-symbol::after {
  right: -11px;
}

.upgrade-icon-damage {
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.76), transparent 24%),
    var(--pink);
}

.upgrade-icon-damage .upgrade-symbol {
  width: 34px;
  height: 34px;
  left: 15px;
  top: 15px;
  border: 4px solid var(--ink);
  border-radius: 50%;
}

.upgrade-icon-damage .upgrade-symbol::before {
  width: 42px;
  height: 4px;
  left: -8px;
  top: 11px;
  background: var(--ink);
}

.upgrade-icon-damage .upgrade-symbol::after {
  width: 4px;
  height: 42px;
  left: 11px;
  top: -8px;
  background: var(--ink);
}

.upgrade-icon-energy .upgrade-symbol {
  width: 26px;
  height: 34px;
  left: 19px;
  top: 16px;
  border: 4px solid var(--ink);
  border-radius: 6px;
  background: var(--cream);
}

.upgrade-icon-energy .upgrade-symbol::before {
  width: 14px;
  height: 7px;
  left: 2px;
  top: -11px;
  border: 3px solid var(--ink);
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
  background: var(--yellow);
}

.upgrade-icon-energy .upgrade-symbol::after {
  width: 13px;
  height: 18px;
  left: 3px;
  bottom: 3px;
  background: var(--green);
}

.upgrade-icon-heal {
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.76), transparent 24%),
    #ffd8d1;
}

.upgrade-icon-heal .upgrade-symbol {
  width: 36px;
  height: 12px;
  left: 14px;
  top: 26px;
  background: var(--ink);
  border-radius: 3px;
}

.upgrade-icon-heal .upgrade-symbol::before {
  width: 12px;
  height: 36px;
  left: 12px;
  top: -12px;
  background: var(--ink);
  border-radius: 3px;
}

.upgrade-icon-coffee .upgrade-symbol {
  width: 31px;
  height: 28px;
  left: 14px;
  top: 22px;
  border: 4px solid var(--ink);
  border-radius: 0 0 10px 10px;
  background: var(--cream);
}

.upgrade-icon-coffee .upgrade-symbol::before {
  width: 11px;
  height: 14px;
  right: -15px;
  top: 3px;
  border: 4px solid var(--ink);
  border-left: 0;
  border-radius: 0 9px 9px 0;
}

.upgrade-icon-coffee .upgrade-symbol::after {
  width: 28px;
  height: 4px;
  left: -2px;
  top: -12px;
  background: var(--ink);
  box-shadow: 8px -8px 0 -1px var(--ink);
}

.upgrade-icon-stapler {
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.76), transparent 24%),
    var(--red);
}

.upgrade-icon-stapler .upgrade-symbol {
  width: 36px;
  height: 18px;
  left: 14px;
  top: 26px;
  border: 4px solid var(--ink);
  border-radius: 14px 14px 5px 5px;
  background: var(--cream);
  transform: skewX(-12deg);
}

.upgrade-icon-stapler .upgrade-symbol::before {
  width: 36px;
  height: 7px;
  left: -4px;
  bottom: -10px;
  border: 4px solid var(--ink);
  border-top: 0;
  background: var(--yellow);
}

.upgrade-icon-shield {
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.76), transparent 24%),
    var(--green);
}

.upgrade-icon-shield .upgrade-symbol {
  width: 36px;
  height: 42px;
  left: 14px;
  top: 12px;
  background: var(--cream);
  border: 4px solid var(--ink);
  border-radius: 8px 8px 16px 16px;
  clip-path: polygon(50% 0, 96% 16%, 88% 72%, 50% 100%, 12% 72%, 4% 16%);
}

.upgrade-icon-shield .upgrade-symbol::before,
.upgrade-icon-shield .upgrade-symbol::after {
  background: var(--ink);
}

.upgrade-icon-shield .upgrade-symbol::before {
  width: 24px;
  height: 4px;
  left: 2px;
  top: 14px;
}

.upgrade-icon-shield .upgrade-symbol::after {
  width: 4px;
  height: 24px;
  left: 12px;
  top: 4px;
}

.upgrade-icon-laser {
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.76), transparent 24%),
    var(--pink);
}

.upgrade-icon-laser .upgrade-symbol {
  width: 42px;
  height: 9px;
  left: 11px;
  top: 28px;
  border: 3px solid var(--ink);
  border-radius: 999px;
  background: var(--cream);
  box-shadow: 0 -9px 0 -4px var(--cream), 0 9px 0 -4px var(--cream);
}

.upgrade-icon-laser .upgrade-symbol::before {
  width: 48px;
  height: 4px;
  left: -5px;
  top: -1px;
  background: var(--red);
}

.upgrade-icon-calendar {
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.76), transparent 24%),
    var(--yellow);
}

.upgrade-icon-calendar .upgrade-symbol {
  width: 34px;
  height: 38px;
  left: 15px;
  top: 14px;
  border: 4px solid var(--ink);
  border-radius: 7px;
  background: var(--cream);
}

.upgrade-icon-calendar .upgrade-symbol::before {
  width: 34px;
  height: 10px;
  left: -4px;
  top: -4px;
  border-radius: 4px 4px 0 0;
  background: var(--red);
}

.upgrade-icon-calendar .upgrade-symbol::after {
  width: 5px;
  height: 5px;
  left: 7px;
  top: 17px;
  background: var(--ink);
  box-shadow: 10px 0 0 var(--ink), 20px 0 0 var(--ink), 0 10px 0 var(--ink), 10px 10px 0 var(--ink);
}

.upgrade-hint {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 950;
  text-align: center;
}

.upgrade-summary {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 850;
  line-height: 1.25;
}

.upgrade-flash {
  position: absolute;
  inset: -20%;
  z-index: 1;
  background:
    conic-gradient(from 0deg, rgba(242, 201, 76, 0), rgba(242, 201, 76, 0.5), rgba(102, 207, 195, 0), rgba(63, 118, 216, 0.38), rgba(242, 201, 76, 0));
  opacity: 0.75;
  animation: upgradeSpin 2.8s linear infinite;
}

.result-screen {
  justify-content: space-between;
  gap: 14px;
}

.result-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 20px;
  border: var(--border);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(106, 209, 200, 0.2), rgba(244, 198, 78, 0.24)),
    var(--cream);
  box-shadow: 6px 6px 0 var(--ink);
}

.result-panel .eyebrow {
  color: var(--muted);
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 18px 0 0;
}

.score-grid div {
  min-width: 0;
  padding: 10px 8px;
  border: 3px solid var(--ink);
  border-radius: 8px;
  background: #fff4d9;
  text-align: center;
}

.score-grid dt {
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 950;
  text-transform: uppercase;
}

.score-grid dd {
  margin: 4px 0 0;
  overflow: hidden;
  font-size: clamp(1.02rem, 4.4vw, 1.38rem);
  font-weight: 950;
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-feedback {
  min-height: 1.2em;
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 950;
  text-align: center;
}

.result-actions {
  align-items: stretch;
  flex-direction: column;
  gap: 8px;
}

.result-actions .secondary-button {
  width: 100%;
}

.compact-action {
  min-height: 44px;
  border-width: 3px;
  font-size: 0.82rem;
  box-shadow: 3px 3px 0 var(--ink);
}

@keyframes ctaPulse {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-3px);
  }
}

@keyframes upgradePop {
  from {
    opacity: 0;
    transform: scale(0.86) rotate(-1deg);
  }
  to {
    opacity: 1;
    transform: scale(1) rotate(0);
  }
}

@keyframes upgradeSpin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes rewardSpin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes warningFlash {
  from {
    border-color: rgba(225, 77, 61, 0.36);
  }
  to {
    border-color: rgba(225, 77, 61, 0.76);
  }
}

@keyframes canvasShake {
  0% {
    transform: translate(0, 0);
  }
  25% {
    transform: translate(3px, -2px);
  }
  50% {
    transform: translate(-2px, 3px);
  }
  75% {
    transform: translate(2px, 2px);
  }
  100% {
    transform: translate(-3px, -1px);
  }
}

@media (max-height: 680px) {
  .screen {
    min-height: calc(100svh - 24px);
  }

  .brand-row {
    min-height: 38px;
  }

  h1 {
    font-size: clamp(2.25rem, 10vw, 3.35rem);
  }

  .intro-copy,
  .start-note,
  .result-copy {
    font-size: 0.95rem;
  }

  .hud-item {
    height: 50px;
  }
}

@media (min-width: 700px) and (orientation: portrait) {
  .screen {
    max-width: 560px;
    height: min(calc(100svh - 32px), 920px);
  }

  .hud-item {
    height: 68px;
    padding: 10px;
  }

  .hud-item span {
    font-size: 0.78rem;
  }

  .hud-item strong {
    font-size: 1.74rem;
  }

  .canvas-wrap {
    max-width: 540px;
  }

  .upgrade-panel {
    max-width: 520px;
  }
}

@media (min-width: 760px) and (orientation: landscape) {
  .shell {
    padding: 14px 16px;
  }

  .screen {
    max-width: min(1320px, calc(100vw - 32px));
    height: min(calc(100svh - 28px), 760px);
    min-height: min(520px, calc(100svh - 28px));
  }

  .start-screen,
  .result-screen {
    max-width: 760px;
  }

  .game-screen {
    display: grid;
    grid-template-columns: minmax(210px, 284px) minmax(420px, 980px);
    grid-template-rows: 32px 20px 1fr;
    align-items: stretch;
    justify-content: center;
    gap: 12px;
  }

  .game-screen .hud {
    grid-column: 1;
    grid-row: 1 / span 3;
    display: grid;
    grid-template-columns: 1fr;
    align-content: start;
    gap: 10px;
  }

  .game-screen .hud-item {
    min-height: 76px;
    height: auto;
    padding: 12px;
  }

  .game-screen .hud-item span {
    font-size: 0.78rem;
  }

  .game-screen .hud-item strong {
    font-size: 1.78rem;
  }

  .game-screen .xp-frame {
    grid-column: 2;
    grid-row: 2;
    width: 100%;
  }

  .game-screen .objective-strip {
    grid-column: 2;
    grid-row: 1;
    width: 100%;
  }

  .game-screen .objective-strip strong {
    font-size: 0.92rem;
  }

  .game-screen .canvas-wrap {
    grid-column: 2;
    grid-row: 3;
    width: min(100%, 980px);
    height: auto;
    max-height: 100%;
    aspect-ratio: 16 / 9;
    justify-self: center;
    align-self: start;
  }

  .toast {
    left: 18px;
    right: 18px;
    top: 18px;
  }

  .upgrade-panel {
    max-width: min(720px, calc(100% - 36px));
  }
}

@media (hover: hover) and (pointer: fine) {
  .joystick {
    opacity: 0;
  }
}
