:root {
  color-scheme: dark;
  --river: #08756b;
  --river-deep: #064c48;
  --cream: #fff3d7;
  --paper: #f8e6bd;
  --ink: #153c36;
  --coral: #f05b3f;
  --orange: #f28a2e;
  --gold: #f3c64e;
  --pink: #e94d88;
  --blue: #33a9c2;
  --shadow: rgba(2, 23, 21, 0.4);
  --safe-top: min(59px, max(0px, env(safe-area-inset-top, 0px)));
  --safe-right: min(44px, max(0px, env(safe-area-inset-right, 0px)));
  --safe-bottom: min(34px, max(0px, env(safe-area-inset-bottom, 0px)));
  --safe-left: min(44px, max(0px, env(safe-area-inset-left, 0px)));
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: #075f57;
  touch-action: none;
}

body,
button {
  font-family: "Avenir Next Condensed", "Trebuchet MS", sans-serif;
}

button,
a {
  -webkit-user-select: none;
  user-select: none;
}

button {
  color: inherit;
}

[hidden] {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

#game-shell {
  position: relative;
  width: 100%;
  height: 100dvh;
  min-height: 480px;
  overflow: hidden;
  isolation: isolate;
  background: linear-gradient(#6dcbd2 0 44%, #d8b875 44% 100%);
}

/* Every game surface is tied to the visual viewport. This avoids mobile
   browser toolbar and overlay transitions shifting absolute descendants. */
#game-shell > * {
  position: fixed;
}

#game-canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  touch-action: none;
}

.world-tint,
.sun-wash {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.world-tint {
  background:
    linear-gradient(to bottom, rgba(255, 246, 207, 0.18), transparent 28%),
    radial-gradient(circle at 50% 48%, transparent 42%, rgba(1, 29, 26, 0.24) 120%);
  mix-blend-mode: soft-light;
}

.sun-wash {
  background: radial-gradient(circle at 83% 12%, rgba(255, 241, 164, 0.34), transparent 28%);
}

.top-hud {
  position: absolute;
  z-index: 10;
  top: calc(8px + var(--safe-top));
  left: calc(10px + var(--safe-left));
  right: calc(10px + var(--safe-right));
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
}

.mini-brand {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
  color: var(--cream);
  text-decoration: none;
  text-shadow: 0 2px 10px rgba(2, 33, 29, 0.5);
  pointer-events: auto;
}

.brand-flower {
  display: grid;
  place-items: center;
  width: 37px;
  height: 37px;
  flex: 0 0 auto;
  border: 2px solid rgba(255, 244, 214, 0.86);
  border-radius: 50%;
  color: var(--gold);
  background: rgba(4, 73, 65, 0.78);
  box-shadow: 0 4px 16px var(--shadow);
  font-size: 23px;
}

.mini-brand > span:last-child {
  display: grid;
  grid-template-columns: auto auto;
  line-height: 0.86;
  letter-spacing: -0.03em;
}

.mini-brand b,
.mini-brand strong {
  font-family: "Rockwell Extra Bold", "Cooper Black", Georgia, serif;
  font-size: clamp(12px, 3.8vw, 17px);
}

.mini-brand b {
  color: var(--gold);
  margin-right: 4px;
}

.mini-brand small {
  grid-column: 1 / -1;
  margin-top: 4px;
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.18em;
}

.top-readouts {
  display: flex;
  align-items: center;
  gap: 6px;
  pointer-events: auto;
}

.cash-chip {
  min-width: 91px;
  padding: 7px 10px 6px;
  border: 1px solid rgba(255, 241, 201, 0.72);
  border-radius: 13px;
  background: rgba(6, 67, 60, 0.84);
  box-shadow: 0 6px 18px var(--shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  line-height: 1;
}

.cash-chip span {
  display: block;
  color: #ffd863;
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.cash-chip strong {
  display: inline-block;
  margin-top: 3px;
  color: white;
  font-family: "Rockwell Extra Bold", Georgia, serif;
  font-size: 16px;
}

.cash-chip small {
  color: rgba(255, 244, 216, 0.75);
  font-size: 8px;
}

.round-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 1px solid rgba(255, 241, 201, 0.72);
  border-radius: 50%;
  background: rgba(6, 67, 60, 0.82);
  box-shadow: 0 5px 16px var(--shadow);
  color: var(--cream);
  font-size: 16px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.round-button:active {
  transform: scale(0.92);
}

.round-button.needs-unlock {
  color: #173f38;
  background: var(--gold);
  animation: sound-unlock-pulse 1.15s ease-in-out infinite;
}

@keyframes sound-unlock-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(243, 198, 78, 0.62), 0 5px 16px var(--shadow); }
  50% { box-shadow: 0 0 0 8px rgba(243, 198, 78, 0), 0 5px 16px var(--shadow); }
}

.mission-card {
  position: absolute;
  z-index: 8;
  top: calc(67px + var(--safe-top));
  left: calc(11px + var(--safe-left));
  width: min(57vw, 228px);
  padding: 9px 12px 10px;
  border: 1px solid rgba(255, 244, 214, 0.58);
  border-radius: 13px 13px 18px 4px;
  background: linear-gradient(135deg, rgba(6, 73, 65, 0.91), rgba(5, 48, 44, 0.83));
  box-shadow: 0 7px 24px rgba(2, 28, 25, 0.28);
  color: white;
  pointer-events: none;
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
}

.mission-card::before {
  content: "";
  position: absolute;
  left: 11px;
  top: -4px;
  width: 38px;
  height: 7px;
  border-radius: 50%;
  background: var(--coral);
  transform: rotate(-2deg);
}

.mission-kicker {
  display: block;
  margin-bottom: 3px;
  color: #ffcf58;
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.15em;
}

.mission-card strong {
  display: block;
  font-family: "Rockwell Extra Bold", Georgia, serif;
  font-size: 13px;
  line-height: 1.04;
}

.mission-card small {
  display: block;
  margin-top: 3px;
  color: rgba(255, 248, 227, 0.78);
  font-size: 8px;
  line-height: 1.2;
}

.mission-track {
  height: 3px;
  margin-top: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
}

.mission-track i,
.bag-meter i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--coral));
  transition: width 240ms ease;
}

.bag-chip {
  position: absolute;
  z-index: 8;
  top: calc(67px + var(--safe-top));
  right: calc(11px + var(--safe-right));
  display: grid;
  grid-template-columns: 29px 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  gap: 1px 7px;
  width: min(34vw, 137px);
  padding: 8px 9px;
  border: 1px solid rgba(255, 245, 218, 0.75);
  border-radius: 13px 13px 5px 18px;
  background: rgba(255, 239, 202, 0.91);
  box-shadow: 0 7px 22px var(--shadow);
  color: var(--ink);
  pointer-events: none;
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
}

.bag-symbol {
  grid-row: 1 / 3;
  font-family: Georgia, serif;
  font-size: 34px;
  line-height: 0.8;
  transform: rotate(-5deg);
}

.bag-chip small {
  display: block;
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.bag-chip strong {
  display: flex;
  align-items: baseline;
  gap: 3px;
  margin-top: 1px;
  font-family: "Rockwell Extra Bold", Georgia, serif;
  font-size: 17px;
}

.bag-chip strong span,
.bag-chip strong b:last-child {
  font-size: 10px;
  opacity: 0.62;
}

.bag-meter {
  grid-column: 1 / -1;
  height: 3px;
  margin-top: 4px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(21, 60, 54, 0.15);
}

.location-ribbon {
  position: absolute;
  z-index: 5;
  top: calc(145px + var(--safe-top));
  left: 50%;
  display: flex;
  align-items: center;
  gap: 7px;
  width: max-content;
  padding: 4px 8px;
  border-radius: 999px;
  color: rgba(255, 249, 228, 0.9);
  background: rgba(4, 47, 43, 0.48);
  box-shadow: 0 3px 12px rgba(3, 29, 26, 0.2);
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.1em;
  transform: translateX(-50%);
  pointer-events: none;
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}

.location-ribbon i {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--gold);
}

.aim-layer {
  position: absolute;
  z-index: 6;
  left: 50%;
  top: 52%;
  display: grid;
  place-items: center;
  gap: 12px;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

.reticle {
  position: relative;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255, 248, 226, 0.65);
  border-radius: 50%;
  box-shadow: 0 1px 8px rgba(0, 32, 29, 0.38);
  transition: transform 130ms ease, border-color 130ms ease, background 130ms ease;
}

.reticle::before,
.reticle::after {
  content: "";
  position: absolute;
  background: rgba(255, 248, 226, 0.72);
}

.reticle::before {
  width: 38px;
  height: 1px;
}

.reticle::after {
  width: 1px;
  height: 38px;
}

.reticle i {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.8);
}

.reticle.targeting {
  border-color: var(--gold);
  background: rgba(242, 138, 46, 0.19);
  transform: scale(1.18) rotate(45deg);
}

.reticle.targeting i {
  background: var(--gold);
}

.aim-label {
  padding: 4px 8px;
  border-radius: 999px;
  color: white;
  background: rgba(3, 44, 40, 0.54);
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.11em;
  opacity: 0.72;
  transition: opacity 150ms ease, transform 150ms ease;
}

.targeting + .aim-label {
  color: #143d37;
  background: rgba(255, 218, 99, 0.92);
  opacity: 1;
  transform: translateY(2px);
}

.context-action {
  position: absolute;
  z-index: 16;
  left: 50%;
  bottom: calc(150px + var(--safe-bottom));
  min-width: 174px;
  padding: 10px 16px 9px;
  border: 2px solid rgba(255, 244, 210, 0.92);
  border-radius: 16px;
  background: linear-gradient(135deg, var(--coral), #d9412e);
  box-shadow: 0 8px 0 #7d2d25, 0 14px 28px var(--shadow);
  color: white;
  text-align: center;
  transform: translateX(-50%);
  pointer-events: auto;
}

.context-action span,
.context-action small {
  display: block;
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.13em;
}

.context-action strong {
  display: block;
  margin: 2px 0;
  font-family: "Rockwell Extra Bold", Georgia, serif;
  font-size: 17px;
}

.context-action:active {
  box-shadow: 0 3px 0 #7d2d25, 0 8px 18px var(--shadow);
  transform: translate(-50%, 5px);
}

.grab-button {
  position: absolute;
  z-index: 14;
  right: calc(24px + var(--safe-right));
  bottom: calc(24px + var(--safe-bottom));
  display: grid;
  place-items: center;
  width: 82px;
  height: 82px;
  padding: 6px;
  border: 2px solid rgba(255, 246, 219, 0.9);
  border-radius: 50%;
  background: linear-gradient(145deg, #ff9a3c, var(--coral));
  box-shadow: 0 7px 0 #963a2f, 0 12px 27px var(--shadow);
  color: white;
  pointer-events: auto;
  transition: filter 150ms ease, opacity 150ms ease, transform 100ms ease;
}

.move-right .grab-button {
  right: auto;
  left: calc(24px + var(--safe-left));
}

.grab-button[data-action="dump"] {
  background: linear-gradient(145deg, #f3c64e, #e56f2e);
}

.grab-button[data-action="shop"] {
  background: linear-gradient(145deg, #24a798, #07645d);
  box-shadow: 0 7px 0 #034d48, 0 12px 27px var(--shadow);
}

.grab-button:disabled {
  filter: saturate(0.3);
  opacity: 0.48;
}

.grab-button:not(:disabled) {
  animation: hand-ready 1.45s ease-in-out infinite;
}

.grab-button:not(:disabled) .grab-pulse {
  position: absolute;
  inset: -8px;
  border: 2px solid rgba(255, 214, 86, 0.75);
  border-radius: 50%;
  animation: pickup-pulse 1.45s ease-out infinite;
}

.grab-button:active {
  box-shadow: 0 2px 0 #963a2f, 0 7px 17px var(--shadow);
  transform: translateY(5px) scale(0.96);
}

.grab-hand {
  font-size: 28px;
  line-height: 1;
}

.grab-button small {
  margin-top: -6px;
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.07em;
}

@keyframes pickup-pulse {
  from { opacity: 0.75; transform: scale(0.82); }
  to { opacity: 0; transform: scale(1.22); }
}

@keyframes hand-ready {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

.control-zone {
  position: absolute;
  z-index: 12;
  top: 34%;
  bottom: 0;
  width: 50%;
  pointer-events: auto;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.control-zone-left {
  left: 0;
}

.control-zone-right {
  right: 0;
}

.floating-stick {
  position: absolute;
  left: 72px;
  top: calc(100% - 116px);
  width: 118px;
  height: 118px;
  border-radius: 50%;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.74);
  transition: opacity 110ms ease, transform 110ms ease;
  pointer-events: none;
}

.control-zone[data-control="move"].active .floating-stick {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.joystick-ring {
  position: absolute;
  inset: 2px;
  border: 2px solid rgba(255, 244, 213, 0.46);
  border-radius: 50%;
  background:
    linear-gradient(90deg, transparent 49.5%, rgba(255,255,255,.13) 50%, transparent 50.5%),
    linear-gradient(0deg, transparent 49.5%, rgba(255,255,255,.13) 50%, transparent 50.5%),
    rgba(3, 49, 45, 0.27);
  box-shadow: inset 0 0 24px rgba(2, 32, 29, 0.18), 0 7px 24px rgba(2, 28, 25, 0.18);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.joystick-knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 48px;
  height: 48px;
  border: 2px solid rgba(255, 250, 231, 0.77);
  border-radius: 50%;
  background: rgba(9, 94, 85, 0.76);
  box-shadow: 0 6px 18px rgba(2, 27, 24, 0.34), inset 0 3px 7px rgba(255,255,255,.16);
  transform: translate(-50%, -50%);
  transition: background 140ms ease;
}

.control-zone.active .joystick-knob {
  background: rgba(240, 91, 63, 0.86);
}

.control-hint {
  position: absolute;
  bottom: calc(31px + var(--safe-bottom));
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border-radius: 999px;
  color: rgba(255, 249, 230, 0.78);
  background: rgba(3, 45, 41, 0.5);
  font-weight: 900;
  opacity: 0.82;
  transition: opacity 180ms ease;
  pointer-events: none;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.control-zone[data-control="look"] .control-hint {
  bottom: calc(119px + var(--safe-bottom));
}

.control-zone-left .control-hint {
  left: calc(20px + var(--safe-left));
}

.control-zone-right .control-hint {
  right: calc(20px + var(--safe-right));
}

.control-hint b {
  font-size: 16px;
  line-height: 0.8;
}

.control-hint small {
  font-size: 6px;
  letter-spacing: 0.1em;
  white-space: nowrap;
}

.control-zone.control-used .control-hint {
  opacity: 0.3;
}

.control-zone[data-control="move"].active .control-hint {
  opacity: 0;
}

.swap-shortcut {
  position: absolute;
  z-index: 12;
  left: 50%;
  bottom: calc(24px + var(--safe-bottom));
  display: grid;
  place-items: center;
  gap: 1px;
  width: 66px;
  padding: 5px 4px;
  border: 1px solid rgba(255, 244, 214, 0.38);
  border-radius: 11px;
  background: rgba(4, 53, 48, 0.5);
  box-shadow: 0 5px 16px rgba(2, 30, 27, 0.16);
  color: rgba(255, 247, 226, 0.82);
  transform: translateX(-50%);
  pointer-events: auto;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.swap-shortcut span {
  font-size: 18px;
  line-height: 1;
}

.swap-shortcut small {
  font-size: 6px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.toast-stack {
  position: absolute;
  z-index: 40;
  left: 50%;
  top: 35%;
  display: grid;
  justify-items: center;
  gap: 6px;
  width: min(82vw, 340px);
  transform: translateX(-50%);
  pointer-events: none;
}

.toast {
  padding: 7px 11px;
  border: 1px solid rgba(255, 247, 220, 0.73);
  border-radius: 10px;
  background: rgba(5, 58, 53, 0.9);
  box-shadow: 0 7px 24px var(--shadow);
  color: white;
  font-size: 10px;
  font-weight: 800;
  animation: toast-in 2.4s both;
}

@keyframes toast-in {
  0% { opacity: 0; transform: translateY(8px) scale(.96); }
  12%, 82% { opacity: 1; transform: none; }
  100% { opacity: 0; transform: translateY(-7px); }
}

.pickup-float {
  position: absolute;
  z-index: 17;
  left: 50%;
  top: 56%;
  color: #fff4bf;
  font-family: "Rockwell Extra Bold", Georgia, serif;
  font-size: 24px;
  text-shadow: 0 3px 12px rgba(2, 32, 29, 0.7);
  opacity: 0;
  transform: translate(-50%, 0);
  pointer-events: none;
}

.pickup-float.show {
  animation: pickup-float 650ms ease-out;
}

@keyframes pickup-float {
  0% { opacity: 0; transform: translate(-50%, 15px) scale(.78); }
  22% { opacity: 1; transform: translate(-50%, 0) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -34px) scale(1.04); }
}

.sheet-scrim {
  position: absolute;
  z-index: 50;
  inset: 0;
  background: rgba(1, 24, 22, 0.58);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
}

.bottom-sheet {
  position: absolute;
  z-index: 55;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: min(78dvh, 690px);
  padding: 10px calc(14px + var(--safe-right)) calc(18px + var(--safe-bottom)) calc(14px + var(--safe-left));
  overflow: auto;
  border: 2px solid #41645a;
  border-bottom: 0;
  border-radius: 26px 26px 0 0;
  background:
    linear-gradient(rgba(255,255,255,.23) 1px, transparent 1px),
    #f7e9c7;
  background-size: 100% 29px;
  box-shadow: 0 -18px 60px rgba(0, 27, 24, 0.42);
  color: var(--ink);
  opacity: 0;
  visibility: hidden;
  transform: translateY(105%);
  transition:
    transform 300ms cubic-bezier(.2,.8,.2,1),
    opacity 180ms ease,
    visibility 0s linear 300ms;
  pointer-events: none;
}

.bottom-sheet.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  transition-delay: 0s;
  pointer-events: auto;
}

.sheet-handle {
  width: 58px;
  height: 5px;
  margin: 0 auto 11px;
  border-radius: 999px;
  background: rgba(21, 60, 54, 0.25);
}

.sheet-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.sheet-header span {
  color: #bd4934;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.sheet-header h2 {
  margin: 2px 0 11px;
  font-family: "Rockwell Extra Bold", "Cooper Black", Georgia, serif;
  font-size: clamp(22px, 7vw, 34px);
  line-height: 0.98;
  letter-spacing: -0.04em;
}

.sheet-close {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  border: 1px solid rgba(21, 60, 54, 0.25);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.38);
  color: var(--ink);
  font-size: 26px;
}

.shop-wallet {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  margin-bottom: 10px;
  padding: 6px 10px;
  border: 1px solid rgba(21, 60, 54, 0.2);
  border-radius: 8px;
  background: #f2cf65;
  box-shadow: 3px 3px 0 rgba(117, 72, 32, 0.18);
}

.shop-wallet span {
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.12em;
}

.shop-wallet strong {
  font-family: "Rockwell Extra Bold", Georgia, serif;
  font-size: 18px;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.upgrade-card {
  position: relative;
  min-height: 145px;
  padding: 12px 10px 10px;
  overflow: hidden;
  border: 1px solid rgba(21, 60, 54, 0.27);
  border-radius: 7px 16px 8px 13px;
  background: rgba(255, 250, 232, 0.78);
  box-shadow: 3px 4px 0 rgba(86, 73, 45, 0.15);
}

.upgrade-card:nth-child(2) { transform: rotate(.55deg); }
.upgrade-card:nth-child(3) { transform: rotate(-.45deg); }

.upgrade-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.upgrade-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: white;
  background: var(--river);
  font-size: 19px;
}

.upgrade-level {
  color: #bd4934;
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.09em;
}

.upgrade-card h3 {
  margin: 8px 0 3px;
  font-family: "Rockwell Extra Bold", Georgia, serif;
  font-size: 15px;
  line-height: 1;
}

.upgrade-card p {
  min-height: 31px;
  margin: 0 0 8px;
  color: rgba(21, 60, 54, 0.73);
  font-size: 9px;
  line-height: 1.15;
}

.upgrade-buy {
  width: 100%;
  padding: 8px 6px 7px;
  border: 0;
  border-radius: 8px;
  background: var(--coral);
  box-shadow: 0 3px 0 #8c342a;
  color: white;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 0.07em;
}

.upgrade-buy:disabled {
  background: #a8a598;
  box-shadow: 0 3px 0 #77756d;
  opacity: 0.72;
}

.settings-sheet {
  max-height: min(61dvh, 510px);
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  margin: 9px 0;
  padding: 14px 12px;
  border: 1px solid rgba(21, 60, 54, 0.25);
  border-radius: 12px;
  background: rgba(255, 250, 231, 0.72);
  color: var(--ink);
  text-align: left;
}

.setting-row span,
.setting-row b,
.setting-row small {
  display: block;
}

.setting-row b {
  font-family: "Rockwell Extra Bold", Georgia, serif;
  font-size: 14px;
}

.setting-row small {
  margin-top: 2px;
  color: rgba(21, 60, 54, 0.66);
  font-size: 9px;
}

.setting-row strong {
  flex: 0 0 auto;
  padding: 6px 8px;
  border-radius: 7px;
  color: white;
  background: var(--river);
  font-size: 8px;
  letter-spacing: 0.08em;
}

.desktop-help {
  margin: 13px 3px 0;
  color: rgba(21, 60, 54, 0.67);
  font-size: 10px;
  line-height: 1.35;
}

.start-screen {
  position: absolute;
  z-index: 100;
  inset: 0;
  display: grid;
  grid-template-rows: minmax(175px, 42%) 1fr;
  min-height: 100%;
  overflow: auto;
  background: #f7e8bd;
  color: var(--ink);
  transition: opacity 420ms ease, visibility 420ms ease;
  pointer-events: auto;
  touch-action: pan-y;
}

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

.intro-sky {
  position: relative;
  min-height: 210px;
  overflow: hidden;
  border-bottom: 5px solid #0b5d54;
  background:
    linear-gradient(170deg, transparent 0 65%, rgba(255,255,255,.17) 65.5% 67%, transparent 67.5%),
    linear-gradient(#7dd7d5 0 52%, #18867d 52% 72%, #0a645d 72% 100%);
}

.intro-sky::before,
.intro-sky::after {
  content: "";
  position: absolute;
  z-index: 3;
  bottom: 0;
  width: 46%;
  height: 43%;
  background: #ccb37c;
  box-shadow: inset 0 9px 0 #ead8ac;
}

.intro-sky::before { left: 0; clip-path: polygon(0 0, 82% 16%, 100% 100%, 0 100%); }
.intro-sky::after { right: 0; clip-path: polygon(18% 16%, 100% 0, 100% 100%, 0 100%); }

.intro-sun {
  position: absolute;
  top: 18px;
  right: 13%;
  width: 61px;
  height: 61px;
  border-radius: 50%;
  background: #ffe782;
  box-shadow: 0 0 0 12px rgba(255, 231, 130, 0.15);
}

.intro-bridge {
  position: absolute;
  z-index: 5;
  left: 50%;
  bottom: 35px;
  width: min(78vw, 390px);
  height: 82px;
  border: 15px solid #e0c999;
  border-bottom: 0;
  border-radius: 50% 50% 0 0;
  box-shadow: inset 0 0 0 3px #6b6857, 0 -3px 0 #6b6857;
  transform: translateX(-50%);
}

.intro-bridge::before {
  content: "";
  position: absolute;
  left: 3%;
  right: 3%;
  top: -27px;
  height: 18px;
  border: 3px solid #5d5a4b;
  border-bottom: 0;
  border-radius: 50% 50% 0 0;
}

.intro-boat {
  position: absolute;
  z-index: 6;
  left: 50%;
  bottom: 8px;
  width: 122px;
  padding: 8px 8px 6px;
  border-radius: 5px 5px 40% 40%;
  color: #fff2b9;
  background: #ef5c3d;
  box-shadow: 0 5px 0 #7b392d;
  font-family: "Rockwell Extra Bold", Georgia, serif;
  font-size: 11px;
  text-align: center;
  transform: translateX(-50%);
}

.paper-flag {
  position: absolute;
  z-index: 7;
  top: 28px;
  width: 38px;
  height: 34px;
  clip-path: polygon(0 0, 100% 0, 100% 78%, 75% 100%, 50% 78%, 25% 100%, 0 78%);
}

.flag-one { left: 10%; background: var(--pink); transform: rotate(-7deg); }
.flag-two { left: 28%; top: 49px; background: var(--gold); transform: rotate(4deg); }
.flag-three { right: 7%; top: 92px; background: var(--coral); transform: rotate(8deg); }

.intro-copy {
  position: relative;
  z-index: 8;
  width: min(100%, 540px);
  margin: -3px auto 0;
  padding: 18px 20px calc(24px + var(--safe-bottom));
  text-align: center;
}

.eyebrow {
  color: #bd4934;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.18em;
}

.intro-copy h1 {
  margin: 3px 0 8px;
  color: #123f39;
  font-family: "Rockwell Extra Bold", "Cooper Black", Georgia, serif;
  font-size: clamp(48px, 16vw, 83px);
  line-height: 0.68;
  letter-spacing: -0.07em;
  text-shadow: 3px 3px 0 #e3bf56;
}

.intro-copy h1 i {
  color: var(--coral);
  font-size: 0.67em;
  font-style: normal;
  letter-spacing: 0.05em;
  text-shadow: 2px 2px 0 #f6d46d;
}

.intro-copy > p {
  max-width: 430px;
  margin: 10px auto 13px;
  color: rgba(21, 60, 54, 0.77);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.28;
}

.intro-controls {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  max-width: 420px;
  margin: 0 auto 13px;
}

.intro-controls > div {
  display: grid;
  justify-items: center;
  align-content: start;
  min-height: 76px;
  padding: 8px 4px 6px;
  border: 1px solid rgba(21, 60, 54, 0.18);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.28);
}

.mini-stick {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  margin-bottom: 4px;
  border: 2px solid var(--river);
  border-radius: 50%;
  color: var(--coral);
  background: rgba(8,117,107,.1);
  font-size: 15px;
}

.mini-hand {
  height: 35px;
  margin-bottom: 2px;
  font-size: 27px;
}

.intro-controls b,
.intro-controls small {
  display: block;
}

.intro-controls b {
  font-size: 8px;
  letter-spacing: 0.1em;
}

.intro-controls small {
  color: rgba(21, 60, 54, 0.65);
  font-size: 8px;
}

.start-button {
  width: min(100%, 420px);
  padding: 13px 15px 11px;
  border: 2px solid #fff1c9;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--coral), #d74333);
  box-shadow: 0 6px 0 #8d342c, 0 12px 24px rgba(94, 51, 35, 0.2);
  color: white;
}

.start-button span,
.start-button small {
  display: block;
}

.start-button span {
  font-family: "Rockwell Extra Bold", Georgia, serif;
  font-size: 18px;
}

.start-button small {
  margin-top: 2px;
  color: rgba(255, 244, 218, 0.8);
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.13em;
}

.start-button:active {
  box-shadow: 0 2px 0 #8d342c, 0 7px 16px rgba(94, 51, 35, 0.2);
  transform: translateY(4px);
}

.intro-swap {
  margin-top: 12px;
  padding: 4px;
  border: 0;
  background: transparent;
  color: rgba(21, 60, 54, 0.68);
  font-size: 10px;
}

.intro-swap b {
  color: #b84533;
  text-decoration: underline;
}

.win-screen {
  position: absolute;
  z-index: 90;
  left: 50%;
  top: 50%;
  width: min(calc(100% - 34px), 390px);
  padding: 25px 20px 20px;
  border: 3px solid #164e47;
  border-radius: 20px 9px 23px 12px;
  background: #f7e6b9;
  box-shadow: 0 20px 70px rgba(1, 27, 24, 0.5);
  color: var(--ink);
  text-align: center;
  transform: translate(-50%, -50%) rotate(-0.6deg);
  pointer-events: auto;
}

.win-burst {
  color: var(--coral);
  font-size: 42px;
}

.win-screen > span {
  color: #bd4934;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.win-screen h2 {
  margin: 4px 0 7px;
  font-family: "Rockwell Extra Bold", Georgia, serif;
  font-size: 30px;
  line-height: 0.96;
}

.win-screen p {
  margin: 0 auto 15px;
  color: rgba(21, 60, 54, 0.7);
  font-size: 12px;
}

.win-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 15px;
}

.win-stats div {
  padding: 8px 4px;
  border: 1px solid rgba(21, 60, 54, 0.18);
  border-radius: 9px;
  background: rgba(255,255,255,.3);
}

.win-stats small,
.win-stats strong {
  display: block;
}

.win-stats small {
  font-size: 7px;
  font-weight: 900;
  letter-spacing: 0.09em;
}

.win-stats strong {
  margin-top: 2px;
  font-family: "Rockwell Extra Bold", Georgia, serif;
  font-size: 17px;
}

.win-screen button {
  width: 100%;
  padding: 11px;
  border: 0;
  border-radius: 10px;
  background: var(--river);
  box-shadow: 0 4px 0 #043f3a;
  color: white;
  font-family: "Rockwell Extra Bold", Georgia, serif;
  font-size: 14px;
}

.rotate-note {
  display: none;
}

@media (min-width: 700px) {
  .mission-card {
    width: 260px;
  }

  .bag-chip {
    width: 150px;
  }

  .grab-button {
    right: calc(44px + var(--safe-right));
  }

  .move-right .grab-button {
    right: auto;
    left: calc(44px + var(--safe-left));
  }

  .bottom-sheet {
    left: 50%;
    right: auto;
    width: min(620px, calc(100% - 28px));
    border-radius: 26px 26px 0 0;
    transform: translate(-50%, 105%);
  }

  .bottom-sheet.open {
    transform: translate(-50%, 0);
  }

  .shop-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  .top-hud { top: calc(5px + var(--safe-top)); }
  .mission-card { top: calc(49px + var(--safe-top)); width: 210px; }
  .bag-chip { top: calc(49px + var(--safe-top)); }
  .location-ribbon { top: calc(112px + var(--safe-top)); }
  .control-zone { top: 28%; }
  .floating-stick { width: 96px; height: 96px; }
  .joystick-knob { width: 40px; height: 40px; }
  .grab-button { bottom: calc(14px + var(--safe-bottom)); width: 64px; height: 64px; }
  .control-hint { bottom: calc(18px + var(--safe-bottom)); }
  .control-zone[data-control="look"] .control-hint { bottom: calc(88px + var(--safe-bottom)); }
  .swap-shortcut { bottom: calc(8px + var(--safe-bottom)); }
  .start-screen { grid-template-columns: 47% 53%; grid-template-rows: 1fr; }
  .intro-sky { min-height: 100%; border-bottom: 0; border-right: 5px solid #0b5d54; }
  .intro-copy { align-self: center; padding-top: calc(14px + var(--safe-top)); }
  .intro-copy h1 { font-size: clamp(45px, 10vw, 70px); }
  .intro-copy > p { margin: 7px auto 9px; }
  .intro-controls { margin-bottom: 9px; }
}

@media (pointer: fine) and (hover: hover) and (min-width: 700px) {
  .control-zone {
    display: none;
  }

  .swap-shortcut {
    display: none;
  }

  .grab-button {
    right: 38px;
  }

  .move-right .grab-button {
    right: 38px;
    left: auto;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
