@import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&family=DM+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --ink: #272b27;
  --muted: #7e857a;
  --paper: #f4f0df;
  --panel: #fffdf4;
  --line: #dedcc9;
  --green: #3d754c;
  --green-dark: #285538;
  --orange: #e77a3b;
  --purple: #8170c9;
  --pixel: 'Press Start 2P', monospace;
  --sans: 'DM Sans', system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--sans);
  background-color: var(--paper);
  background-image: radial-gradient(#d9d6c4 0.7px, transparent 0.7px);
  background-size: 16px 16px;
}

button {
  font: inherit;
  cursor: pointer;
}

button:focus-visible {
  outline: 3px solid #8170c9;
  outline-offset: 3px;
}

.app {
  width: min(1120px, calc(100% - 40px));
  margin: 0 auto;
  padding: 24px 0 20px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 800;
  font-size: 19px;
  letter-spacing: 1.1px;
}

.brand-icon {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: #fff8e8;
  background: var(--green);
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  font-size: 21px;
}

.brand-accent {
  color: var(--orange);
}

.brand small {
  display: block;
  margin-top: 5px;
  font-size: 8px;
  letter-spacing: 2.1px;
  color: var(--muted);
  font-weight: 700;
}

.top-actions {
  display: flex;
  gap: 9px;
}

.icon-btn,
.secondary-btn {
  border: 2px solid var(--ink);
  background: var(--panel);
  color: var(--ink);
  padding: 10px 13px;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 3px 3px 0 var(--ink);
  transition: transform .12s, box-shadow .12s;
}

.icon-btn span {
  margin-left: 5px;
}

.icon-btn:active,
.secondary-btn:active,
.primary-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink);
}

.game-shell {
  background: var(--panel);
  border: 3px solid var(--ink);
  box-shadow: 7px 7px 0 var(--ink);
  overflow: hidden;
}

.game-topline {
  min-height: 69px;
  display: flex;
  align-items: center;
  gap: clamp(20px, 6vw, 75px);
  padding: 12px 22px;
  border-bottom: 2px solid var(--ink);
  background: #fffdf5;
}

.stat {
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 66px;
}

.stat-label {
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 1.6px;
  font-weight: 800;
}

.stat strong {
  font-family: var(--pixel);
  font-size: 14px;
  letter-spacing: 1px;
}

.game-frame {
  position: relative;
  background: #eaf2d8;
  overflow: hidden;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 960 / 420;
  image-rendering: pixelated;
  touch-action: manipulation;
}

.canvas-caption {
  position: absolute;
  bottom: 12px;
  left: 16px;
  right: 16px;
  display: flex;
  justify-content: space-between;
  color: #60765c;
  font-size: 9px;
  letter-spacing: 1.5px;
  font-weight: 800;
  pointer-events: none;
}

.live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: #64a56b;
  box-shadow: 0 0 0 3px #64a56b22;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(237, 241, 218, .78);
  backdrop-filter: blur(2px);
}

.hidden {
  display: none !important;
}

.overlay-card {
  width: min(420px, 100%);
  padding: 25px 26px 22px;
  text-align: center;
  background: var(--panel);
  border: 3px solid var(--ink);
  box-shadow: 6px 6px 0 var(--ink);
}

.fox-badge {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin: 0 auto 16px;
  border: 3px solid var(--ink);
  background: #f7c27c;
  font-size: 32px;
  box-shadow: 4px 4px 0 var(--ink);
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--green);
  font-size: 9px;
  line-height: 1.8;
  font-weight: 800;
  letter-spacing: 1.4px;
}

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

h1 {
  margin-bottom: 14px;
  font-family: var(--pixel);
  font-size: clamp(19px, 3.2vw, 28px);
  line-height: 1.6;
  letter-spacing: -1px;
}

h1 span {
  color: var(--orange);
}

h2 {
  margin-bottom: 12px;
  font-family: var(--pixel);
  font-size: 22px;
  line-height: 1.5;
}

.overlay-copy {
  max-width: 300px;
  margin: 0 auto 20px;
  color: #737a6f;
  font-size: 13px;
  line-height: 1.7;
}

.primary-btn {
  width: 100%;
  min-height: 48px;
  border: 2px solid var(--ink);
  color: white;
  background: var(--green);
  box-shadow: 4px 4px 0 var(--ink);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1px;
}

.primary-btn:hover {
  background: var(--green-dark);
}

.controls-hint {
  margin-top: 17px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1px;
}

kbd {
  display: inline-block;
  padding: 5px 7px;
  border: 1px solid #d3d1c0;
  background: #f5f2e7;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 10px;
}

.compact {
  max-width: 340px;
}

.overlay-symbol {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  margin: 0 auto 17px;
  border: 2px solid var(--ink);
  background: #e4e0f8;
  color: var(--purple);
  font-size: 23px;
  font-weight: 900;
  box-shadow: 3px 3px 0 var(--ink);
}

.overlay-symbol.danger {
  background: #ffe0c8;
  color: var(--orange);
}

.result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 0 18px;
  padding: 12px 0;
  border-top: 1px dashed var(--line);
  border-bottom: 1px dashed var(--line);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
}

.result-row strong {
  font-family: var(--pixel);
  font-size: 13px;
}

.game-footer {
  display: flex;
  align-items: center;
  gap: clamp(10px, 3vw, 34px);
  padding: 14px 20px;
  border-top: 2px solid var(--ink);
  background: #fffdf5;
}

.tip {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
}

.tip-icon {
  display: grid;
  place-items: center;
  width: 31px;
  height: 31px;
  flex-shrink: 0;
  border: 2px solid var(--ink);
  background: #e8efd9;
  font-size: 16px;
  font-weight: 900;
}

.tip-icon.down {
  background: #fce5ce;
}

.tip b,
.tip small {
  display: block;
}

.tip b {
  font-size: 10px;
  letter-spacing: 1px;
}

.tip small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 8px;
  white-space: nowrap;
}

.secondary-btn {
  margin-left: auto;
  white-space: nowrap;
}

.bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 17px;
  margin-top: 24px;
}

.info-card {
  padding: 19px 20px;
  border: 2px solid var(--ink);
  background: var(--panel);
  box-shadow: 4px 4px 0 var(--ink);
}

.card-heading {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-bottom: 15px;
}

.card-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border: 2px solid var(--ink);
  background: #ffebc6;
  color: #b86b31;
  font-size: 18px;
}

.card-icon.purple {
  background: #e8e2ff;
  color: var(--purple);
}

.card-heading .eyebrow {
  margin-bottom: 4px;
  font-size: 8px;
}

.card-heading h3 {
  margin-bottom: 0;
  font-size: 15px;
}

.tag {
  margin-left: auto;
  padding: 6px 7px;
  border: 1px solid #c9d8c5;
  background: #edf4e8;
  color: var(--green);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 1px;
}

.info-card>p {
  margin-bottom: 14px;
  color: #747a70;
  font-size: 12px;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border: 1px solid var(--ink);
  background: #e8e5d7;
}

.progress-track span {
  display: block;
  width: 0%;
  height: 100%;
  background: var(--orange);
  transition: width .2s;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.progress-meta span:last-child {
  color: var(--green);
}

.mini-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding-top: 4px;
}

.mini-stats div {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.mini-stats strong {
  font-family: var(--pixel);
  font-size: 15px;
}

.mini-stats span {
  color: var(--muted);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .6px;
}

.page-footer {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  padding: 23px 2px 0;
  color: #85897c;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 1.2px;
}

.footer-dot {
  color: var(--orange);
  padding: 0 5px;
}

@media (max-width:700px) {
  .app {
    width: min(100% - 22px, 1120px);
    padding-top: 15px;
  }

  .topbar {
    margin-bottom: 16px;
  }

  .brand {
    font-size: 15px;
    gap: 9px;
  }

  .brand-icon {
    width: 38px;
    height: 38px;
  }

  .brand small {
    font-size: 7px;
    letter-spacing: 1.5px;
  }

  .icon-btn {
    padding: 9px;
  }

  .icon-btn span {
    display: none;
  }

  .game-topline {
    min-height: 58px;
    padding: 10px 12px;
    justify-content: space-between;
    gap: 12px;
  }

  .stat-label {
    font-size: 8px;
  }

  .stat strong {
    font-size: 11px;
  }

  .overlay-card {
    padding: 17px 18px;
  }

  .fox-badge {
    width: 44px;
    height: 44px;
    margin-bottom: 9px;
    font-size: 25px;
  }

  .overlay-copy {
    margin-bottom: 13px;
    font-size: 12px;
  }

  .eyebrow {
    margin-bottom: 7px;
    font-size: 8px;
  }

  .controls-hint {
    margin-top: 11px;
  }

  .canvas-caption {
    bottom: 7px;
    left: 9px;
    right: 9px;
    font-size: 7px;
    letter-spacing: .7px;
  }

  .game-footer {
    flex-wrap: wrap;
    gap: 12px 17px;
    padding: 12px;
  }

  .tip {
    gap: 6px;
  }

  .tip-icon {
    width: 27px;
    height: 27px;
  }

  .tip small {
    font-size: 7px;
  }

  .tip b {
    font-size: 9px;
  }

  .secondary-btn {
    padding: 8px 10px;
    font-size: 10px;
  }

  .bottom-grid {
    grid-template-columns: 1fr;
    gap: 14px;
    margin-top: 19px;
  }

  .info-card {
    padding: 16px;
  }

  .page-footer {
    flex-direction: column;
    font-size: 7px;
    line-height: 1.8;
    padding-top: 19px;
  }
}

@media (max-width:390px) {
  .app {
    width: calc(100% - 16px);
  }

  .game-footer {
    gap: 10px;
  }

  .tip small {
    letter-spacing: -.2px;
  }

  .secondary-btn {
    margin-left: 0;
  }

  .mini-stats {
    gap: 5px;
  }

  .mini-stats strong {
    font-size: 12px;
  }

  .mini-stats span {
    font-size: 7px;
  }
}

@media (prefers-reduced-motion: reduce) {

  *,
  *::before,
  *::after {
    transition: none !important;
  }
}

/* ==========================================
   PIXEL FOX — LOADING SCREEN
========================================== */

.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 99999;

  display: grid;
  place-items: center;

  padding: 24px;

  background: #f4f0df;
  background-image:
    radial-gradient(#d9d6c4 0.8px, transparent 0.8px);

  background-size: 16px 16px;

  transition:
    opacity 0.55s ease,
    visibility 0.55s ease;
}

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

.loading-content {
  width: min(430px, 100%);
  text-align: center;
}

.loading-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
}

.loading-fox {
  width: 66px;
  height: 66px;

  display: grid;
  place-items: center;

  background: #f7c27c;
  border: 3px solid #272b27;
  box-shadow: 5px 5px 0 #272b27;

  font-size: 37px;

  animation: loadingFoxBounce 0.65s ease-in-out infinite alternate;
}

.loading-title {
  display: flex;
  gap: 7px;

  font-family: "Press Start 2P", monospace;
  font-size: clamp(18px, 5vw, 27px);
  letter-spacing: -1px;
}

.loading-title span:first-child {
  color: #272b27;
}

.loading-accent {
  color: #e77a3b;
}

.loading-subtitle {
  margin: 24px 0 35px;

  color: #7e857a;

  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1.5px;
}

.loading-runner {
  position: relative;

  width: 100%;
  height: 78px;

  margin-bottom: 22px;
  overflow: hidden;
}

.loading-ground {
  position: absolute;
  bottom: 10px;
  left: 0;

  width: 100%;
  height: 4px;

  background: #65865a;
}

.loading-runner-fox {
  position: absolute;
  bottom: 12px;
  left: 12%;

  font-size: 37px;

  image-rendering: pixelated;

  animation: loadingFoxRun 0.6s steps(2, end) infinite;
}

.loading-pixel {
  position: absolute;
  bottom: 18px;

  width: 7px;
  height: 7px;

  background: #e77a3b;

  animation: loadingPixelMove 1s linear infinite;
}

.pixel-one {
  left: 38%;
}

.pixel-two {
  left: 62%;
  animation-delay: 0.25s;
}

.pixel-three {
  left: 83%;
  animation-delay: 0.5s;
}

.loading-bar {
  height: 12px;

  overflow: hidden;

  background: #e5e1d0;
  border: 2px solid #272b27;
  box-shadow: 3px 3px 0 #272b27;
}

.loading-progress {
  width: 0%;
  height: 100%;

  background: #3d754c;

  transition: width 0.16s ease-out;
}

.loading-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;

  margin-top: 15px;

  color: #7e857a;

  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.6px;
}

.loading-footer {
  margin-top: 35px;

  color: #96988c;

  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1.4px;
}

.loading-footer span {
  color: #e77a3b;
  margin-left: 5px;
}

@keyframes loadingFoxBounce {
  from {
    transform: translateY(0);
  }

  to {
    transform: translateY(-8px);
  }
}

@keyframes loadingFoxRun {
  0% {
    transform: translateY(0) rotate(-5deg);
  }

  50% {
    transform: translateY(-7px) rotate(5deg);
  }

  100% {
    transform: translateY(0) rotate(-5deg);
  }
}

@keyframes loadingPixelMove {
  from {
    transform: translateX(20px);
    opacity: 0;
  }

  30% {
    opacity: 1;
  }

  to {
    transform: translateX(-30px);
    opacity: 0;
  }
}

/* ==========================================
   FOX MOVEMENT VISUALS
========================================== */

#gameCanvas {
  image-rendering: pixelated;
  touch-action: manipulation;
}

/* Make buttons consistent */
button {
  -webkit-tap-highlight-color: transparent;
}

/* Mobile loading layout */
@media (max-width: 480px) {
  .loading-fox {
    width: 54px;
    height: 54px;
    font-size: 30px;
  }

  .loading-subtitle {
    font-size: 8px;
  }

  .loading-meta {
    font-size: 8px;
  }
}

/* ==========================================
   PIXEL FOX — PHONE RESPONSIVE LAYOUT
   Additive overrides: preserves desktop styling
========================================== */


html {
  width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

body {
  width: 100%;
  min-width: 320px;
  overflow-x: hidden;
}

.app,
.game-shell,
.game-frame,
.bottom-grid,
.info-card {
  min-width: 0;
  max-width: 100%;
}

.game-shell {
  border-radius: 2px;
}

#gameCanvas {
  display: block;
  width: 100%;
  max-width: 100%;
  height: auto;
  aspect-ratio: 960 / 420;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

button,
a {
  touch-action: manipulation;
}

@media (max-width: 700px) {
  .app {
    width: calc(100% - 22px);
    padding: max(12px, env(safe-area-inset-top)) 0 max(16px, env(safe-area-inset-bottom));
  }

  .topbar {
    align-items: center;
    gap: 10px;
    margin-bottom: 15px;
  }

  .brand {
    min-width: 0;
    gap: 8px;
    font-size: clamp(12px, 3.7vw, 15px);
    letter-spacing: .5px;
  }

  .brand-icon {
    flex: 0 0 auto;
    width: 36px;
    height: 36px;
    font-size: 18px;
    box-shadow: 3px 3px 0 var(--ink);
  }

  .brand small {
    font-size: 6px;
    letter-spacing: 1.2px;
  }

  .top-actions {
    flex: 0 0 auto;
    gap: 7px;
  }

  .icon-btn {
    min-width: 38px;
    min-height: 38px;
    padding: 8px 9px;
    box-shadow: 2px 2px 0 var(--ink);
  }

  .game-shell {
    border-width: 2px;
    box-shadow: 4px 4px 0 var(--ink);
  }

  .game-topline {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    align-items: center;
    gap: 8px;
    min-height: 0;
    padding: 11px 10px;
  }

  .stat {
    min-width: 0;
    gap: 6px;
  }

  .stat:nth-child(2) {
    text-align: center;
    align-items: center;
  }

  .stat:nth-child(3) {
    text-align: right;
    align-items: flex-end;
  }

  .stat-label {
    font-size: 7px;
    letter-spacing: 1px;
  }

  .stat strong {
    font-size: clamp(9px, 2.8vw, 12px);
    letter-spacing: 0;
    overflow-wrap: anywhere;
  }

  .game-frame {
    width: 100%;
  }

  .canvas-caption {
    bottom: 6px;
    left: 8px;
    right: 8px;
    gap: 8px;
    font-size: clamp(6px, 1.7vw, 8px);
    letter-spacing: .4px;
  }

  .live-dot {
    width: 5px;
    height: 5px;
    margin-right: 4px;
  }

  .overlay {
    padding: 10px;
  }

  .overlay-card {
    width: min(100%, 390px);
    padding: clamp(12px, 3.5vw, 18px);
    border-width: 2px;
    box-shadow: 4px 4px 0 var(--ink);
  }

  .fox-badge {
    width: 39px;
    height: 39px;
    margin-bottom: 8px;
    border-width: 2px;
    font-size: 23px;
    box-shadow: 2px 2px 0 var(--ink);
  }

  .eyebrow {
    margin-bottom: 6px;
    font-size: 7px;
    letter-spacing: .8px;
  }

  h1 {
    margin-bottom: 8px;
    font-size: clamp(15px, 4vw, 22px);
    line-height: 1.5;
  }

  h2 {
    margin-bottom: 8px;
    font-size: clamp(14px, 4vw, 20px);
  }

  .overlay-copy {
    margin-bottom: 11px;
    font-size: clamp(10px, 2.8vw, 12px);
    line-height: 1.5;
  }

  .primary-btn {
    min-height: 43px;
    padding: 10px 8px;
    font-size: 10px;
    letter-spacing: .5px;
  }

  .controls-hint {
    margin-top: 10px;
    font-size: 7px;
    line-height: 1.9;
    letter-spacing: .3px;
  }

  kbd {
    padding: 3px 4px;
    font-size: 8px;
  }

  .overlay-symbol {
    width: 38px;
    height: 38px;
    margin-bottom: 10px;
    font-size: 19px;
  }

  .result-row {
    margin-bottom: 12px;
    padding: 9px 0;
    font-size: 8px;
  }

  .result-row strong {
    font-size: 10px;
  }

  .game-footer {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: 10px;
    padding: 11px;
  }

  .tip {
    gap: 7px;
  }

  .tip-icon {
    width: 29px;
    height: 29px;
    font-size: 14px;
  }

  .tip b {
    font-size: 9px;
  }

  .tip small {
    font-size: 7px;
    white-space: normal;
    line-height: 1.4;
  }

  .secondary-btn {
    width: 100%;
    min-height: 38px;
    margin: 0;
    padding: 8px;
    font-size: 9px;
    box-shadow: 2px 2px 0 var(--ink);
  }

  .bottom-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 13px;
    margin-top: 17px;
  }

  .info-card {
    padding: 14px;
    box-shadow: 3px 3px 0 var(--ink);
  }

  .card-heading {
    gap: 9px;
    margin-bottom: 12px;
  }

  .card-icon {
    width: 34px;
    height: 34px;
    font-size: 16px;
  }

  .card-heading h3 {
    font-size: 14px;
  }

  .tag {
    padding: 5px;
    font-size: 7px;
    letter-spacing: .5px;
  }

  .info-card>p {
    font-size: 11px;
    line-height: 1.6;
  }

  .progress-meta {
    font-size: 9px;
  }

  .mini-stats {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
  }

  .mini-stats strong {
    font-size: clamp(10px, 3vw, 14px);
    overflow-wrap: anywhere;
  }

  .mini-stats span {
    font-size: 7px;
    letter-spacing: .2px;
    line-height: 1.4;
  }

  .page-footer {
    gap: 6px;
    padding: 17px 2px 0;
    font-size: 7px;
    line-height: 1.8;
    overflow-wrap: anywhere;
  }
}

@media (max-width: 390px) {
  .app {
    width: calc(100% - 16px);
  }

  .topbar {
    gap: 7px;
  }

  .brand {
    gap: 6px;
    font-size: 11px;
  }

  .brand-icon {
    width: 32px;
    height: 32px;
    font-size: 16px;
  }

  .brand small {
    margin-top: 3px;
    font-size: 5px;
    letter-spacing: .8px;
  }

  .top-actions {
    gap: 5px;
  }

  .icon-btn {
    min-width: 34px;
    min-height: 34px;
    padding: 6px 7px;
    font-size: 11px;
  }

  .game-topline {
    padding: 9px 8px;
  }

  .overlay {
    padding: 7px;
  }

  .overlay-card {
    padding: 10px;
  }

  .overlay-copy {
    font-size: 10px;
  }

  .controls-hint {
    font-size: 6px;
  }

  .game-footer {
    gap: 9px 6px;
    padding: 9px;
  }

  .tip {
    gap: 5px;
  }

  .tip-icon {
    width: 25px;
    height: 25px;
    font-size: 12px;
  }
}

/* Short landscape phones: keep overlays compact and the game visible. */
@media (max-width: 900px) and (orientation: landscape) and (max-height: 520px) {
  .app {
    width: calc(100% - 24px);
    padding-top: 8px;
  }

  .topbar {
    margin-bottom: 8px;
  }

  .brand-icon {
    width: 30px;
    height: 30px;
  }

  .game-topline {
    padding-top: 7px;
    padding-bottom: 7px;
  }

  .overlay-card {
    max-width: 440px;
    padding: 8px 14px;
  }

  .fox-badge,
  .overlay-symbol {
    display: none;
  }

  .overlay-copy {
    margin-bottom: 8px;
  }

  .controls-hint {
    margin-top: 6px;
  }

  .primary-btn {
    min-height: 36px;
  }
}

/* =========================================================
   PIXEL FOX — CHALLENGES, XP & EVENT SYSTEM
   Additive styles; keeps the original theme and mobile rules.
========================================================= */
.pixel-fox {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: pixelated;
  shape-rendering: crispEdges
}

.loading-fox {
  display: grid;
  place-items: center;
  overflow: hidden;
  animation: loadingFoxBounce .65s ease-in-out infinite alternate
}

.loading-fox .pixel-fox {
  width: 100%;
  height: 100%
}

.loading-runner-fox {
  display: block;
  width: 38px;
  height: 38px;
  bottom: 8px !important;
  font-size: 0 !important
}

.loading-runner-fox .pixel-fox {
  width: 100%;
  height: 100%;
  animation: loadingFoxRun .6s steps(2, end) infinite
}

.fox-badge {
  display: grid;
  place-items: center;
  overflow: hidden
}

.fox-badge .pixel-fox {
  width: 100%;
  height: 100%
}

.progression-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 18px
}

.feature-card {
  min-width: 0;
  overflow: hidden
}

.challenge-list {
  display: grid;
  gap: 12px;
  margin-top: 16px
}

.challenge-item {
  padding: 12px;
  border: 2px solid #d8d4c4;
  background: rgba(255, 255, 255, .42);
  box-shadow: 3px 3px 0 rgba(39, 43, 39, .08);
  min-width: 0
}

.challenge-item.is-complete {
  border-color: #6e9a73;
  background: rgba(110, 154, 115, .11)
}

.challenge-item-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px
}

.challenge-item-top strong {
  font-size: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere
}

.challenge-item-top>span {
  flex-shrink: 0;
  color: #3d754c;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .4px
}

.challenge-item p {
  margin: 6px 0 9px;
  color: #74796f;
  font-size: 11px;
  line-height: 1.55
}

.challenge-track,
.level-track,
.event-track {
  height: 8px;
  background: #e5e1d0;
  border: 1px solid #272b27;
  overflow: hidden
}

.challenge-track span,
.level-track span,
.event-track span {
  display: block;
  width: 0;
  height: 100%;
  background: #3d754c;
  transition: width .2s ease
}

.challenge-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: 7px;
  color: #777c72;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .3px
}

.challenge-meta span {
  overflow-wrap: anywhere
}

.bonus-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-top: 13px;
  margin-top: 14px;
  border-top: 1px dashed #cbc7b8;
  color: #74796f;
  font-size: 11px
}

.bonus-line strong {
  color: #272b27;
  font-size: 11px;
  text-align: right
}

.level-track {
  height: 12px;
  margin-top: 20px
}

.level-track span {
  background: #7557d9
}

.event-track {
  margin-top: 16px
}

.event-track span {
  background: #e77a3b
}

.event-card.event-active {
  border-color: #e77a3b;
  box-shadow: 4px 4px 0 rgba(231, 122, 59, .18)
}

.collection-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px
}

.collection-badges span {
  padding: 8px 10px;
  border: 2px solid #d8d4c4;
  background: #f7f3e5;
  color: #3b4038;
  font-size: 10px;
  font-weight: 800
}

.feature-stats {
  margin-top: 18px
}

.tag[data-rarity="COMMON"] {
  background: #e5e1d0;
  color: #555b51
}

.tag[data-rarity="RARE"] {
  background: #d8e8f5;
  color: #2e6592
}

.tag[data-rarity="EPIC"] {
  background: #e8defa;
  color: #6a43a5
}

.tag[data-rarity="LEGENDARY"] {
  background: #fae5a8;
  color: #79551b
}

.progress-toast-wrap {
  position: fixed;
  z-index: 9999;
  right: 18px;
  top: 18px;
  display: grid;
  gap: 9px;
  width: min(310px, calc(100vw - 28px));
  pointer-events: none
}

.progress-toast {
  display: grid;
  gap: 4px;
  padding: 13px 15px;
  background: #272b27;
  color: #fff0cf;
  border: 2px solid #e77a3b;
  box-shadow: 4px 4px 0 rgba(39, 43, 39, .22);
  animation: progressToastIn .2s ease-out
}

.progress-toast strong {
  font-size: 11px;
  letter-spacing: 1px
}

.progress-toast span {
  font-size: 11px;
  line-height: 1.4;
  color: #d8d9cb
}

.progress-toast.toast-out {
  opacity: 0;
  transform: translateX(12px);
  transition: opacity .3s, transform .3s
}

@keyframes progressToastIn {
  from {
    opacity: 0;
    transform: translateY(-8px)
  }

  to {
    opacity: 1;
    transform: translateY(0)
  }
}

@media(max-width:760px) {
  .progression-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 12px
  }

  .challenge-item {
    padding: 11px
  }

  .challenge-item-top strong {
    font-size: 11px
  }

  .challenge-item p {
    font-size: 10px
  }

  .challenge-meta {
    font-size: 8px
  }

  .bonus-line {
    font-size: 10px
  }

  .bonus-line strong {
    font-size: 10px
  }

  .progress-toast-wrap {
    right: 10px;
    top: 10px
  }
}

@media(max-width:420px) {
  .progression-grid {
    margin-top: 12px
  }

  .challenge-item-top {
    gap: 6px
  }

  .challenge-item-top>span {
    font-size: 8px
  }

  .challenge-meta {
    gap: 5px
  }

  .collection-badges span {
    font-size: 9px;
    padding: 7px 8px
  }

  .loading-fox {
    width: 54px;
    height: 54px
  }
}

@media(prefers-reduced-motion:reduce) {

  .loading-fox,
  .loading-runner-fox .pixel-fox,
  .progress-toast {
    animation: none !important
  }

  .challenge-track span,
  .level-track span,
  .event-track span {
    transition: none
  }
}

.skin-showcase {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 16px auto 8px;
  max-width: 280px;
  min-height: 112px;
  background: #f7f3e5;
  border: 2px solid #d8d4c4;
  box-shadow: 3px 3px 0 rgba(39, 43, 39, .08)
}

#skinPreview {
  display: block;
  width: 120px;
  height: 100px;
  max-width: 55%;
  image-rendering: pixelated
}

.skin-arrow {
  display: grid;
  place-items: center;
  width: 34px;
  height: 38px;
  border: 2px solid #272b27;
  background: #e5e1d0;
  color: #272b27;
  font-size: 26px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 2px 2px 0 #272b27
}

.skin-arrow:active {
  transform: translate(1px, 1px);
  box-shadow: 1px 1px 0 #272b27
}

.skin-name {
  text-align: center;
  margin-top: 10px;
  color: #272b27;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 2px
}

.skin-hint {
  text-align: center;
  margin: 6px 0 10px;
  color: #3d754c;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 1px
}

.pixel-card-fox {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 4px
}

@media(max-width:420px) {
  .skin-showcase {
    gap: 8px;
    min-height: 100px
  }

  .skin-arrow {
    width: 30px;
    height: 34px
  }

  #skinPreview {
    height: 88px
  }
}


/* =========================================================
   PIXEL FOX — APP-LIKE LAYOUT, PLAYER IDENTITY & DRAWER
========================================================= */
html,
body {
  min-height: 100%;
}

body {
  overflow-x: hidden;
}

body.player-app-mode {
  padding-bottom: calc(74px + env(safe-area-inset-bottom));
}

.app {
  width: min(1240px, calc(100% - 28px));
  padding-top: 12px;
  padding-bottom: 12px;
}

.topbar {
  margin-bottom: 10px;
}

.top-actions {
  align-items: center;
}

.player-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 5px 10px 5px 5px;
  background: var(--panel);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
}

.player-avatar-mini {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  background: #ffebc6;
  border: 1px solid var(--ink);
  font-size: 20px;
}

.player-chip-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
  max-width: 150px;
}

.player-chip-copy strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}

.player-chip-copy small {
  color: var(--muted);
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .5px;
}

.profile-open-btn {
  white-space: nowrap;
}

.game-shell {
  box-shadow: 5px 5px 0 var(--ink);
}

.game-topline {
  min-height: 54px;
  padding: 8px 16px;
}

.game-frame {
  touch-action: none;
}

.touch-controls {
  position: absolute;
  z-index: 5;
  left: 12px;
  right: 12px;
  bottom: 28px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  pointer-events: none;
  opacity: 0;
  transition: opacity .18s;
}

body.game-started .touch-controls {
  opacity: 1;
}

.touch-control {
  pointer-events: auto;
  display: grid;
  place-items: center;
  gap: 3px;
  width: 76px;
  height: 76px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: rgba(255, 253, 244, .82);
  color: var(--ink);
  box-shadow: 4px 4px 0 rgba(39, 43, 39, .6);
  backdrop-filter: blur(4px);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.touch-control span {
  font-size: 29px;
  font-weight: 900;
  line-height: 1;
}

.touch-control small {
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 1px;
}

.jump-control {
  background: rgba(255, 235, 198, .9);
}

.sneak-control {
  width: 64px;
  height: 64px;
  background: rgba(232, 226, 255, .9);
}

.sneak-control span {
  font-size: 24px;
}

.relocated-section {
  display: none !important;
}

.game-bottom-nav {
  position: fixed;
  z-index: 1000;
  left: 0;
  right: 0;
  bottom: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding: 7px 8px calc(7px + env(safe-area-inset-bottom));
  background: rgba(255, 253, 244, .97);
  border-top: 2px solid var(--ink);
  box-shadow: 0 -5px 18px rgba(39, 43, 39, .12);
  backdrop-filter: blur(12px);
}

.bottom-nav-item {
  display: grid;
  justify-items: center;
  gap: 4px;
  min-width: 0;
  padding: 5px 2px;
  border: 0;
  background: transparent;
  color: #74796f;
}

.bottom-nav-item span {
  font-size: 19px;
  line-height: 1.1;
}

.bottom-nav-item small {
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .6px;
}

.bottom-nav-item.active {
  color: var(--green-dark);
}

.bottom-nav-item.active span {
  filter: drop-shadow(1px 1px 0 #e77a3b);
}

.game-drawer {
  position: fixed;
  z-index: 1200;
  inset: 0;
  display: flex;
  align-items: flex-end;
  visibility: hidden;
  pointer-events: none;
}

.game-drawer.open {
  visibility: visible;
  pointer-events: auto;
}

.drawer-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(23, 28, 23, .52);
  opacity: 0;
  transition: opacity .2s;
}

.game-drawer.open .drawer-backdrop {
  opacity: 1;
}

.drawer-sheet {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(100%, 980px);
  height: min(78dvh, 780px);
  margin: 0 auto;
  background: var(--paper);
  border: 2px solid var(--ink);
  border-bottom: 0;
  box-shadow: 0 -8px 0 rgba(39, 43, 39, .2);
  transform: translateY(105%);
  transition: transform .25s cubic-bezier(.2, .8, .2, 1);
}

.game-drawer.open .drawer-sheet {
  transform: translateY(0);
}

.drawer-grabber {
  flex: 0 0 auto;
  width: 42px;
  height: 4px;
  border-radius: 4px;
  background: #a5a899;
  margin: 8px auto 3px;
}

.drawer-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 18px 12px;
}

.drawer-kicker {
  margin: 0 0 6px;
  color: var(--green);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 1.7px;
}

.drawer-heading h2,
.profile-card h2 {
  margin: 0;
  font-size: clamp(18px, 3vw, 25px);
  font-weight: 900;
}

.drawer-close,
.profile-close {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border: 2px solid var(--ink);
  background: var(--panel);
  font-size: 25px;
  line-height: 1;
  box-shadow: 2px 2px 0 var(--ink);
}

.drawer-tabs {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 6px;
  padding: 0 14px 12px;
  border-bottom: 2px solid var(--ink);
}

.drawer-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 8px 4px;
  border: 2px solid var(--line);
  background: var(--panel);
  font-size: 11px;
  font-weight: 900;
}

.drawer-tab.active {
  border-color: var(--ink);
  background: #ffebc6;
  box-shadow: 2px 2px 0 var(--ink);
}

.drawer-content {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 15px 17px calc(24px + env(safe-area-inset-bottom));
}

.drawer-panel {
  display: none;
}

.drawer-panel.active {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  gap: 14px;
}

.drawer-panel .drawer-card {
  min-width: 0;
  margin: 0;
  box-shadow: 3px 3px 0 rgba(39, 43, 39, .12);
}

.drawer-panel[data-panel="missions"] .mission-card,
.drawer-panel[data-panel="missions"] .event-card {
  grid-column: 1/-1;
}

.drawer-panel[data-panel="stats"] .drawer-card {
  min-width: 0;
}

.drawer-panel[data-panel="skins"] .drawer-card {
  min-width: 0;
}

.leaderboard-tools {
  grid-column: 1/-1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.leaderboard-tools p {
  margin: 0;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 1px;
}

.mini-action,
.secondary-action {
  border: 2px solid var(--ink);
  background: var(--panel);
  padding: 8px 10px;
  font-size: 10px;
  font-weight: 900;
  box-shadow: 2px 2px 0 var(--ink);
}

.leaderboard-status {
  grid-column: 1/-1;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.leaderboard-list {
  grid-column: 1/-1;
  display: grid;
  gap: 8px;
  list-style: none;
  margin: 0;
  padding: 0;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: 28px 34px minmax(0, 1fr) minmax(104px, auto);
  align-items: center;
  gap: 9px;
  padding: 10px;
  border: 2px solid var(--line);
  background: var(--panel);
  min-width: 0;
}

.leaderboard-row.is-you {
  border-color: var(--green);
  background: #edf5e8;
}

.rank-number {
  font-family: var(--pixel);
  font-size: 10px;
  text-align: center;
}

.rank-avatar {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--ink);
  background: #ffebc6;
  font-size: 19px;
}

.rank-person {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.rank-person strong {
  font-size: 11px;
  overflow-wrap: anywhere;
}

.rank-person small {
  color: var(--muted);
  font-size: 8px;
  font-weight: 800;
}

.rank-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, auto));
  align-items: center;
  gap: 10px;
  text-align: right;
}

.rank-metric {
  display: grid;
  gap: 4px;
  justify-items: end;
  min-width: 0;
}

.rank-metric small {
  color: var(--muted);
  font-size: 7px;
  font-weight: 900;
  letter-spacing: .04em;
}

.rank-metric strong {
  font-family: var(--pixel);
  font-size: 9px;
  white-space: nowrap;
}

.rank-total strong {
  color: var(--green);
}


@media (max-width: 420px) {
  .leaderboard-row {
    grid-template-columns: 22px 28px minmax(0, 1fr) minmax(88px, auto);
    gap: 6px;
    padding: 8px 7px;
  }

  .rank-avatar {
    width: 27px;
    height: 27px;
    font-size: 16px;
  }

  .rank-metrics {
    gap: 6px;
  }

  .rank-metric small {
    font-size: 6px;
  }

  .rank-metric strong {
    font-size: 8px;
  }

  .rank-person strong {
    font-size: 10px;
  }

  .rank-person small {
    font-size: 7px;
  }
}

.leaderboard-empty {
  padding: 22px 12px;
  text-align: center;
  background: var(--panel);
  border: 2px dashed var(--line);
  font-size: 11px;
  line-height: 1.6;
}

.cloud-note {
  grid-column: 1/-1;
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.6;
}

.profile-modal {
  position: fixed;
  z-index: 2000;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
}

.profile-modal.hidden {
  display: none;
}

.profile-backdrop {
  position: absolute;
  inset: 0;
  border: 0;
  background: rgba(23, 28, 23, .65);
  backdrop-filter: blur(4px);
}

.profile-card {
  position: relative;
  width: min(460px, 100%);
  max-height: min(92dvh, 780px);
  overflow: auto;
  padding: 24px;
  background: var(--paper);
  border: 3px solid var(--ink);
  box-shadow: 7px 7px 0 var(--ink);
}

.profile-close {
  position: absolute;
  top: 12px;
  right: 12px;
}

.profile-fox {
  display: grid;
  place-items: center;
  width: 66px;
  height: 66px;
  margin: 0 auto 14px;
  border: 3px solid var(--ink);
  background: #ffebc6;
  box-shadow: 3px 3px 0 var(--ink);
  font-size: 36px;
}

.profile-card>.drawer-kicker,
.profile-card h2,
.profile-intro {
  text-align: center;
}

.profile-intro {
  margin: 10px auto 20px;
  max-width: 330px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.field-label {
  display: block;
  margin-bottom: 7px;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 1.2px;
}

#profileUsername {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 2px solid var(--ink);
  border-radius: 0;
  background: var(--panel);
  font: 700 14px var(--sans);
  color: var(--ink);
}

.field-help {
  margin-top: 6px;
  color: var(--muted);
  font-size: 10px;
}

.avatar-picker {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 7px;
  margin: 15px 0;
}

.avatar-choice {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border: 2px solid var(--line);
  background: var(--panel);
  font-size: 24px;
}

.avatar-choice.selected {
  border-color: var(--ink);
  background: #ffebc6;
  box-shadow: 2px 2px 0 var(--ink);
  transform: translateY(-1px);
}

.profile-id-line {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px;
  border: 1px dashed var(--line);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .6px;
}

.profile-id-line strong {
  font-family: var(--pixel);
  font-size: 10px;
}

.profile-id-line span {
  margin-left: auto;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0;
}

.profile-message {
  min-height: 16px;
  margin: 10px 0;
  color: var(--green-dark);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.5;
}

.profile-message.error {
  color: #b13d2f;
}

.profile-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

.profile-actions button {
  min-height: 43px;
  padding: 9px 8px;
  font-size: 11px;
  font-weight: 900;
}

.primary-action {
  border: 2px solid var(--ink);
  background: var(--green);
  color: white;
  box-shadow: 3px 3px 0 var(--ink);
}

.profile-cloud-status {
  margin-top: 13px;
  text-align: center;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
}

@media(min-width:900px) {
  body.player-app-mode {
    padding-bottom: 82px;
  }

  .drawer-sheet {
    border-bottom: 2px solid var(--ink);
    margin-bottom: 12px;
    height: min(82dvh, 820px);
  }
}

@media(max-width:700px) {
  body.player-app-mode {
    padding-bottom: calc(68px + env(safe-area-inset-bottom));
  }

  .app {
    width: calc(100% - 14px);
    padding-top: max(7px, env(safe-area-inset-top));
  }

  .topbar {
    gap: 6px;
    margin-bottom: 7px;
  }

  .brand {
    gap: 6px;
    font-size: 12px;
  }

  .brand-icon {
    width: 31px;
    height: 31px;
    font-size: 16px;
    box-shadow: 2px 2px 0 var(--ink);
  }

  .brand small {
    font-size: 5px;
    letter-spacing: .8px;
  }

  .top-actions {
    gap: 5px;
  }

  .player-chip {
    gap: 5px;
    padding: 3px 5px 3px 3px;
    box-shadow: 2px 2px 0 var(--ink);
  }

  .player-avatar-mini {
    width: 28px;
    height: 28px;
    font-size: 16px;
  }

  .player-chip-copy {
    max-width: 80px;
    gap: 2px;
  }

  .player-chip-copy strong {
    font-size: 9px;
  }

  .player-chip-copy small {
    font-size: 6px;
  }

  .profile-open-btn {
    min-width: 34px !important;
    min-height: 34px !important;
    padding: 5px !important;
    font-size: 12px !important;
  }

  .profile-open-btn span,
  .sound-toggle span {
    display: none;
  }

  .sound-toggle {
    min-width: 32px !important;
    min-height: 34px !important;
    padding: 5px !important;
  }

  .game-shell {
    border-width: 2px;
    box-shadow: 3px 3px 0 var(--ink);
  }

  .game-topline {
    min-height: 42px;
    padding: 6px 8px;
  }

  .stat {
    gap: 3px;
  }

  .stat-label {
    font-size: 6px;
    letter-spacing: .5px;
  }

  .stat strong {
    font-size: clamp(8px, 2.5vw, 11px);
  }

  .touch-controls {
    left: 8px;
    right: 8px;
    bottom: 18px;
  }

  .touch-control {
    width: 60px;
    height: 60px;
    border-width: 2px;
    box-shadow: 2px 2px 0 rgba(39, 43, 39, .55);
  }

  .touch-control span {
    font-size: 23px;
  }

  .touch-control small {
    font-size: 7px;
  }

  .sneak-control {
    width: 51px;
    height: 51px;
  }

  .sneak-control span {
    font-size: 19px;
  }

  .canvas-caption {
    bottom: 5px;
  }

  .drawer-sheet {
    width: 100%;
    height: min(82dvh, 800px);
    border-left: 0;
    border-right: 0;
  }

  .drawer-heading {
    padding: 7px 13px 10px;
  }

  .drawer-tabs {
    padding: 0 8px 9px;
    gap: 5px;
  }

  .drawer-tab {
    min-height: 38px;
    gap: 4px;
    font-size: 10px;
  }

  .drawer-content {
    padding: 11px 10px calc(20px + env(safe-area-inset-bottom));
  }

  .drawer-panel.active {
    grid-template-columns: minmax(0, 1fr);
    gap: 11px;
  }

  .drawer-panel[data-panel="missions"] .mission-card,
  .drawer-panel[data-panel="missions"] .event-card {
    grid-column: auto;
  }

  .drawer-panel .info-card {
    padding: 13px;
  }

  .bottom-nav-item span {
    font-size: 17px;
  }

  .bottom-nav-item small {
    font-size: 7px;
  }

  .game-bottom-nav {
    padding-top: 5px;
  }

  .profile-card {
    padding: 20px 16px;
  }

  .avatar-picker {
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 5px;
  }

  .avatar-choice {
    font-size: 21px;
  }
}

@media(max-width:380px) {
  .player-chip-copy {
    max-width: 58px;
  }

  .brand small {
    display: none;
  }

  .top-actions {
    gap: 4px;
  }

  .profile-open-btn {
    min-width: 30px !important;
  }

  .drawer-tab {
    font-size: 9px;
  }

  .touch-control {
    width: 54px;
    height: 54px;
  }

  .sneak-control {
    width: 47px;
    height: 47px;
  }
}

@media(orientation:landscape) and (max-height:520px) {
  body.player-app-mode {
    padding-bottom: 58px;
  }

  .app {
    width: calc(100% - 20px);
    padding-top: 5px;
  }

  .topbar {
    margin-bottom: 4px;
  }

  .brand-icon {
    width: 27px;
    height: 27px;
  }

  .game-topline {
    min-height: 34px;
    padding: 4px 10px;
  }

  .touch-controls {
    bottom: 14px;
  }

  .touch-control {
    width: 50px;
    height: 50px;
  }

  .sneak-control {
    width: 44px;
    height: 44px;
  }

  .game-bottom-nav {
    padding-top: 3px;
    padding-bottom: 3px;
  }

  .bottom-nav-item {
    padding: 2px;
    gap: 1px;
  }

  .bottom-nav-item span {
    font-size: 15px;
  }

  .bottom-nav-item small {
    font-size: 6px;
  }
}

/* The app navigation replaces the old below-the-fold controls/footer. */
.game-footer,
.page-footer {
  display: none !important;
}


/* ===== REVDPIXEL OFFICIAL LOGO INTEGRATION ===== */
.brand {
  gap: 10px;
}

.brand-logo-mark {
  display: block;
  width: 52px;
  height: 40px;
  object-fit: contain;
  image-rendering: pixelated;
  flex: 0 0 auto;
}

.brand-wordmark {
  display: block;
}

.loading-logo-image-wrap {
  width: 100%;
  margin: 0 auto 10px;
}

.loading-logo-image {
  display: block;
  width: min(390px, 100%);
  max-height: 190px;
  object-fit: contain;
  margin: 0 auto;
  image-rendering: pixelated;
}

.overlay-brand-logo {
  display: block;
  width: min(350px, 100%);
  max-height: 190px;
  object-fit: contain;
  margin: 0 auto 18px;
  image-rendering: pixelated;
}

/* The supplied logo already contains the fox, title and tagline. */
.overlay-card .overlay-brand-logo+.eyebrow {
  display: none;
}

@media (max-width:600px) {
  .brand-logo-mark {
    width: 38px;
    height: 32px;
  }

  .brand {
    gap: 7px;
  }

  .loading-logo-image {
    width: min(310px, 100%);
    max-height: 145px;
  }

  .overlay-brand-logo {
    width: min(290px, 100%);
    max-height: 155px;
    margin-bottom: 14px;
  }
}

@media (max-width:380px) {
  .brand-logo-mark {
    width: 30px;
    height: 27px;
  }
}


/* Achievement list and live progress */
.achievements-section {
  margin-top: 22px;
}

.achievement-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.ach-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px;
  border: 1px solid rgba(130, 150, 170, .25);
  border-radius: 14px;
  background: rgba(255, 255, 255, .48);
  min-width: 0;
}

.ach-item.done {
  border-color: rgba(61, 145, 91, .55);
  background: rgba(222, 247, 226, .65);
}

.ach-icon {
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(120, 130, 150, .13);
  font-size: 18px;
}

.ach-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.ach-text b {
  font-size: .82rem;
  letter-spacing: .04em;
}

.ach-text small {
  line-height: 1.4;
  opacity: .78;
}

.ach-text em {
  font-size: .75rem;
  font-style: normal;
  opacity: .8;
}

.ach-bar {
  display: block;
  height: 5px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(100, 110, 120, .18);
}

.ach-bar u {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #e5a23b, #7dbd79);
  text-decoration: none;
  transition: width .2s ease;
}

.ach-reward {
  font-weight: 800;
  white-space: nowrap;
  font-size: .85rem;
}

#achBar {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #e5a23b, #7dbd79);
  transition: width .25s ease;
}

@media (max-width:600px) {
  .achievement-list {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   PIXEL FOX — ACHIEVEMENTS THEME MATCH
   Uses the same paper / ink / pixel-card style as the rest
   of the interface instead of rounded, generic white cards.
   ========================================================= */
.achievements-section {
  margin-top: 22px;
  padding: clamp(14px, 2.2vw, 22px);
  color: var(--ink);
  background: var(--panel);
  border: 3px solid var(--ink);
  border-radius: 0;
  box-shadow: 5px 5px 0 rgba(39, 43, 39, .16);
  min-width: 0;
}

.achievements-section .card-heading {
  margin-bottom: 12px;
}

.achievements-section .card-icon {
  border: 2px solid var(--ink);
  border-radius: 0;
  background: #f5b24b;
  box-shadow: 2px 2px 0 var(--ink);
}

.achievements-section .tag,
#achCount {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 25px;
  padding: 5px 9px;
  color: var(--panel);
  background: var(--green);
  border: 2px solid var(--ink);
  border-radius: 0;
  font-family: var(--pixel);
  font-size: 8px;
  line-height: 1.5;
  white-space: nowrap;
}

#achCardText,
#achLatest {
  margin: 8px 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.achievements-section .level-track {
  height: 10px;
  margin: 10px 0 12px;
  background: #e5e1d0;
  border: 2px solid var(--ink);
  border-radius: 0;
  overflow: hidden;
}

#achBar {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 0;
  background: repeating-linear-gradient(135deg, var(--orange) 0 7px, #f5b24b 7px 14px);
  transition: width .25s steps(8, end);
}

.achievement-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.ach-item {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 11px;
  min-width: 0;
  padding: 13px;
  color: var(--ink);
  background: #fffdf4;
  border: 2px solid var(--line);
  border-radius: 0;
  box-shadow: 3px 3px 0 rgba(39, 43, 39, .07);
  transition: transform .16s ease, border-color .16s ease, box-shadow .16s ease, background .16s ease;
}

.ach-item:hover {
  transform: translate(-2px, -2px);
  border-color: var(--orange);
  box-shadow: 5px 5px 0 rgba(39, 43, 39, .12);
}

.ach-item.done {
  background: #edf7e8;
  border-color: #6e9a73;
  box-shadow: 3px 3px 0 rgba(61, 117, 76, .14);
}

.ach-item.done::after {
  content: "✓";
  position: absolute;
  top: 8px;
  right: 9px;
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  color: #fffdf4;
  background: var(--green);
  border: 1px solid var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.ach-icon {
  display: grid;
  place-items: center;
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  color: var(--ink);
  background: #efeee7;
  border: 2px solid var(--ink);
  border-radius: 0;
  font-size: 18px;
  image-rendering: pixelated;
}

.ach-item.done .ach-icon {
  background: #d7edce;
}

.ach-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
  padding-right: 3px;
}

.ach-text b {
  padding-right: 18px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.45;
  letter-spacing: .35px;
  overflow-wrap: anywhere;
}

.ach-text small {
  color: #74796f;
  font-size: 11px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.ach-text em {
  color: var(--green-dark);
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
  line-height: 1.4;
}

.ach-bar {
  display: block;
  width: 100%;
  height: 7px;
  margin-top: 4px;
  overflow: hidden;
  background: #e5e1d0;
  border: 1px solid #d2cebb;
  border-radius: 0;
}

.ach-bar u {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--orange), #f5b24b 55%, #7dbd79);
  border-radius: 0;
  text-decoration: none;
  transition: width .25s steps(8, end);
}

.ach-item.done .ach-bar u {
  background: var(--green);
}

.ach-reward {
  flex: 0 0 auto;
  padding: 4px 6px;
  color: var(--ink);
  background: #fff0d1;
  border: 1px solid #e8b35d;
  border-radius: 0;
  font-size: 10px;
  font-weight: 900;
  white-space: nowrap;
}

@media (max-width: 900px) {
  .achievement-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .achievements-section {
    margin-top: 14px;
    padding: 12px;
    box-shadow: 3px 3px 0 rgba(39, 43, 39, .14);
  }

  .achievement-list {
    grid-template-columns: minmax(0, 1fr);
    gap: 9px;
  }

  .ach-item {
    padding: 11px;
    gap: 10px;
  }

  .ach-text b {
    font-size: 11px;
  }

  .ach-text small {
    font-size: 10px;
  }

  .ach-reward {
    font-size: 9px;
  }
}

@media (prefers-reduced-motion: reduce) {

  .ach-item,
  .ach-bar u,
  #achBar {
    transition: none !important;
  }
}

/* =========================================================
   PIXEL FOX — MISSIONS PANEL LAYOUT REFINEMENT
   Balanced cards, clear hierarchy, responsive achievement grid.
========================================================= */
#drawerMissions.drawer-panel.active {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-content: start;
  align-items: stretch;
  gap: 14px;
}

#drawerMissions>.drawer-card {
  width: 100%;
  min-width: 0;
  height: 100%;
  box-sizing: border-box;
  padding: 16px;
  border: 2px solid var(--line, #d8d4c4);
  background: var(--paper, #fffdf5);
  box-shadow: 3px 3px 0 rgba(39, 43, 39, .10);
}

#drawerMissions .mission-card,
#drawerMissions .event-card {
  grid-column: auto;
}

#drawerMissions .daily-card,
#drawerMissions .weekly-card {
  display: flex;
  flex-direction: column;
}

#drawerMissions .card-heading {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 0;
  margin-bottom: 12px;
}

#drawerMissions .card-heading>div {
  flex: 1 1 auto;
  min-width: 0;
}

#drawerMissions .card-heading h3 {
  margin: 2px 0 0;
  font-size: clamp(13px, 1.5vw, 17px);
  line-height: 1.3;
  overflow-wrap: anywhere;
}

#drawerMissions .eyebrow {
  margin: 0;
  font-size: 8px;
  line-height: 1.5;
  letter-spacing: 1.2px;
}

#drawerMissions .tag {
  flex: 0 0 auto;
  max-width: 42%;
  overflow-wrap: anywhere;
}

#drawerMissions .challenge-list {
  flex: 1 1 auto;
  align-content: start;
  gap: 10px;
  margin-top: 8px;
}

#drawerMissions .challenge-item {
  padding: 12px;
  background: #fbf8ed;
  border: 2px solid #d8d4c4;
  box-shadow: 2px 2px 0 rgba(39, 43, 39, .07);
}

#drawerMissions .challenge-item.is-complete {
  border-color: #6e9a73;
  background: #edf6e9;
}

#drawerMissions .challenge-track {
  height: 8px;
  border: 1px solid #272b27;
  background: #e5e1d0;
}

#drawerMissions .mission-card>p,
#drawerMissions .event-card>p,
#drawerMissions .cosmetics-card>p {
  line-height: 1.6;
  overflow-wrap: anywhere;
}

#drawerMissions .mission-card .progress-track,
#drawerMissions .event-card .event-track {
  margin-top: 12px;
}

#drawerMissions .achievements-section {
  grid-column: 1 / -1;
  margin: 0;
  height: auto;
  padding: 17px;
  border: 2px solid var(--ink, #272b27);
  background: var(--paper, #fffdf5);
  box-shadow: 4px 4px 0 rgba(39, 43, 39, .12);
}

#drawerMissions .achievements-section>p {
  line-height: 1.55;
}

#drawerMissions .achievement-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: stretch;
  gap: 10px;
  margin-top: 14px;
}

#drawerMissions .achievement-list>* {
  min-width: 0;
  height: 100%;
  box-sizing: border-box;
}

#drawerMissions .bonus-line {
  margin-top: auto;
  padding-top: 12px;
}

#drawerMissions .level-track {
  overflow: hidden;
}

@media (max-width: 760px) {
  #drawerMissions.drawer-panel.active {
    grid-template-columns: minmax(0, 1fr);
    gap: 11px;
  }

  #drawerMissions .mission-card,
  #drawerMissions .event-card,
  #drawerMissions .achievements-section {
    grid-column: auto;
  }

  #drawerMissions>.drawer-card {
    padding: 13px;
  }

  #drawerMissions .achievement-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }
}

@media (max-width: 420px) {
  #drawerMissions .achievement-list {
    grid-template-columns: minmax(0, 1fr);
  }

  #drawerMissions .card-heading {
    gap: 8px;
  }

  #drawerMissions .card-heading h3 {
    font-size: 13px;
  }

  #drawerMissions .tag {
    max-width: 38%;
    white-space: normal;
    text-align: center;
  }

  #drawerMissions .achievements-section {
    padding: 12px;
  }
}

/* =====================================================================
   FIXES & ENHANCEMENTS (v3)
===================================================================== */

/* Achievement toasts (pehle in classes ki CSS thi hi nahi → toast dikhte nahi the) */
.toast-wrap {
  position: fixed;
  z-index: 9998;
  left: 50%;
  top: 14px;
  transform: translateX(-50%);
  display: grid;
  gap: 8px;
  width: min(340px, calc(100vw - 24px));
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  background: var(--ink);
  color: #fff0cf;
  border: 2px solid var(--orange);
  box-shadow: 4px 4px 0 rgba(39, 43, 39, .25);
  animation: foxToastIn .22s ease-out;
}

.toast-icon {
  display: grid;
  place-items: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  background: #ffebc6;
  color: var(--ink);
  border: 2px solid var(--ink);
  font-size: 16px;
  font-weight: 900;
}

.toast small {
  display: block;
  font-size: 8px;
  font-weight: 900;
  letter-spacing: 1.2px;
  color: #f4bd45;
}

.toast b {
  display: block;
  margin: 3px 0;
  font-size: 12px;
  letter-spacing: .4px;
}

.toast em {
  font-style: normal;
  font-size: 10px;
  font-weight: 800;
  color: #d8d9cb;
}

@keyframes foxToastIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: none;
  }
}

/* Username availability states + cloud status */
.field-help.good {
  color: var(--green-dark);
  font-weight: 800;
}

.field-help.bad {
  color: #b13d2f;
  font-weight: 800;
}

.profile-cloud-status.cloud-ok {
  color: var(--green-dark);
}

#profileUsername:focus-visible,
.avatar-choice:focus-visible,
.primary-btn:focus-visible,
.secondary-btn:focus-visible,
.icon-btn:focus-visible,
.bottom-nav-item:focus-visible,
.drawer-tab:focus-visible,
.touch-control:focus-visible {
  outline: 3px solid var(--orange);
  outline-offset: 2px;
}

.avatar-choice.selected {
  border-color: var(--ink);
  background: #ffebc6;
  box-shadow: 2px 2px 0 var(--ink);
}

/* Touch devices: text select / callout / double-tap zoom band */
.touch-control,
.game-frame,
.bottom-nav-item {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

button {
  touch-action: manipulation;
}

/* Chhoti screens par toast bottom nav ke upar na aaye */
@media (max-width:760px) {
  .toast-wrap {
    top: 8px;
  }
}

@media (prefers-reduced-motion:reduce) {
  .toast {
    animation: none;
  }
}

/* =====================================================================
   MOBILE FIX (v4) — phone par START button / overlays / controls
   Problem: canvas phone par ~160px ऊँचा रह जाता था, aur uske andar ka
   overlay card (logo + text + START) kat jata tha; touch buttons bhi
   poora game dhak lete the. Ye block sabse last me hai, isliye jeetega.
===================================================================== */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body.game-started {
  overscroll-behavior: none;
}

/* khelte waqt pull-to-refresh band */
.rotate-hint {
  display: none;
}

/* ---------- PORTRAIT PHONES ---------- */
@media (max-width:700px) and (orientation:portrait) {
  .topbar {
    position: relative;
    z-index: 950;
  }

  /* overlay ke upar bhi Profile/Sound buttons chalein */

  /* Overlays ab screen-level hain (canvas ke andar kat-te nahi) */
  .overlay {
    position: fixed;
    z-index: 900;
    left: 0;
    right: 0;
    top: 0;
    bottom: calc(64px + env(safe-area-inset-bottom));
    padding: calc(62px + env(safe-area-inset-top)) 12px 14px;
    display: flex;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    background: rgba(237, 241, 218, .94);
  }

  .overlay-card {
    margin: auto;
    width: min(100%, 380px);
    max-height: none;
    padding: 18px 16px 16px;
  }

  .overlay-brand-logo {
    width: min(250px, 80%);
    max-height: 120px;
    margin-bottom: 10px;
  }

  .overlay-copy {
    font-size: 12px;
    line-height: 1.55;
    margin: 8px 0 14px;
  }

  .overlay .primary-btn {
    width: 100%;
    min-height: 52px;
    font-size: 12px;
  }

  .controls-hint {
    margin-top: 12px;
    font-size: 8px;
    line-height: 2;
  }

  .rotate-hint {
    display: block;
    margin: 12px 0 0;
    font-size: 10px;
    font-weight: 800;
    color: var(--muted);
  }

  /* Touch buttons: canvas ke upar nahi, thumb ke paas screen ke neeche */
  .touch-controls {
    position: fixed;
    z-index: 850;
    left: 14px;
    right: 14px;
    bottom: calc(76px + env(safe-area-inset-bottom));
  }

  .touch-control {
    width: 78px;
    height: 78px;
  }

  .sneak-control {
    width: 66px;
    height: 66px;
  }

  .touch-control span {
    font-size: 28px;
  }

  .touch-control small {
    font-size: 8px;
  }

  /* Game ke neeche khali jagah: chhoti hint taaki page adhura na lage */
  .game-shell {
    margin-bottom: 8px;
  }
}

/* ---------- LANDSCAPE PHONES (kam height) ---------- */
@media (orientation:landscape) and (max-height:520px) {

  /* canvas poora screen height me fit ho, scroll na karna pade */
  #gameCanvas {
    width: min(100%, calc((100dvh - 118px) * 960 / 420));
    margin: 0 auto;
  }

  .game-frame {
    background: var(--ink);
  }

  .game-frame .overlay {
    padding: 6px;
  }

  .overlay-card {
    max-height: calc(100% - 4px);
    overflow: auto;
    padding: 8px 14px;
  }

  .overlay-brand-logo {
    max-height: 62px;
    width: auto;
    margin-bottom: 6px;
  }

  .overlay-copy {
    margin: 4px 0 8px;
    font-size: 11px;
  }

  .controls-hint {
    display: none;
  }

  .overlay .primary-btn {
    min-height: 40px;
  }

  .canvas-caption {
    display: none;
  }

  .touch-controls {
    bottom: 10px;
  }
}

/* Bahut chhoti screens (≤360px) */
@media (max-width:360px) {
  .overlay-brand-logo {
    max-height: 96px;
  }

  .touch-control {
    width: 70px;
    height: 70px;
  }

  .sneak-control {
    width: 60px;
    height: 60px;
  }
}

/* =====================================================================
   NEW: Google login · Weekly leaderboard · Share score · PWA install
===================================================================== */
.install-btn {
  background: var(--orange);
  color: #fff;
}

.install-btn.hidden {
  display: none !important;
}

.share-btn {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 11px 14px;
  border: 2px solid var(--ink);
  background: var(--panel);
  color: var(--ink);
  font-family: var(--pixel);
  font-size: 10px;
  letter-spacing: .5px;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--ink);
}

.share-btn:hover {
  background: #fff6d6;
}

.share-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink);
}

.lb-scope {
  grid-column: 1/-1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.lb-scope-btn {
  padding: 10px 8px;
  border: 2px solid var(--ink);
  background: var(--panel);
  color: var(--ink);
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--ink);
}

.lb-scope-btn.active {
  background: var(--green);
  color: #fff;
}

.account-box {
  margin-top: 13px;
  display: grid;
  gap: 9px;
  padding: 11px;
  border: 2px dashed var(--line);
  background: var(--panel);
}

.account-box.signed-in {
  border-style: solid;
  border-color: var(--green);
}

.account-info {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.account-info strong {
  font-size: 12px;
  font-weight: 900;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-info small {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.google-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 42px;
  border: 2px solid var(--ink);
  background: #fff;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
  cursor: pointer;
  box-shadow: 3px 3px 0 var(--ink);
}

.google-btn:disabled {
  opacity: .6;
  cursor: wait;
}

.google-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink);
}

.google-btn .g-logo {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 3px;
  background: #4285f4;
  color: #fff;
  font: 900 13px/1 var(--sans);
}

.account-box.signed-in .google-btn {
  background: var(--panel);
}

.account-box.signed-in .google-btn .g-logo {
  background: var(--muted);
}

.delete-account-btn {
  display: block;
  width: 100%;
  margin-top: 10px;
  padding: 9px;
  border: 2px solid #b13d2f;
  background: transparent;
  color: #b13d2f;
  font-size: 11px;
  font-weight: 900;
  cursor: pointer;
}

.delete-account-btn:hover {
  background: #b13d2f;
  color: #fff;
}

.delete-account-btn:disabled {
  opacity: .6;
  cursor: wait;
}

/* =====================================================================
   MOBILE FIX (v5) — phone par playable layout + non-intrusive toasts
   - body.is-running      : run chal raha hai (koi overlay nahi)
   - body.show-controls   : start screen band, touch buttons dikhao
   - Toasts run ke dauraan hide; run ke baad Game Over card me summary
   Ye block sabse last me hai, isliye jeetega.
===================================================================== */

/* ---------- Toasts: khelte waqt kabhi screen na dhakein ---------- */
body.is-running .toast-wrap,
body.is-running .progress-toast-wrap {
  display: none !important;
}

/* Toasts chhote + top par (jab dikhein) */
.toast-wrap {
  top: calc(8px + env(safe-area-inset-top));
  width: min(300px, calc(100vw - 24px));
}

.toast {
  padding: 7px 10px;
  gap: 9px;
}

.toast-icon {
  flex-basis: 26px;
  width: 26px;
  height: 26px;
  font-size: 13px;
}

/* Run ke dauraan mini trophy badge (canvas ke corner me, chhota) */
.run-badge {
  position: absolute;
  z-index: 6;
  top: 6px;
  right: 8px;
  padding: 3px 8px;
  background: var(--ink);
  color: #ffe7a8;
  border: 2px solid var(--orange);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .5px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(-6px);
  transition: opacity .2s, transform .2s;
}

.run-badge.on {
  opacity: .92;
  transform: none;
}

/* Game Over card me is run ke unlocks */
.run-unlocks {
  margin: 10px 0 4px;
  padding: 8px 10px;
  border: 2px dashed var(--orange);
  background: #fff6d6;
  text-align: left;
  max-height: 96px;
  overflow-y: auto;
}

.run-unlocks h4 {
  margin: 0 0 4px;
  font-size: 9px;
  letter-spacing: 1.2px;
  color: var(--green-dark);
}

.run-unlocks div {
  font-size: 11px;
  font-weight: 800;
  line-height: 1.5;
}

.run-unlocks div small {
  color: var(--muted);
  font-weight: 700;
}

/* Fullscreen button (start overlay) */
.fs-btn {
  display: none;
  width: 100%;
  margin-top: 10px;
  padding: 11px 12px;
  border: 2px solid var(--ink);
  background: var(--panel);
  color: var(--ink);
  font-family: var(--pixel);
  font-size: 10px;
  letter-spacing: .5px;
  box-shadow: 3px 3px 0 var(--ink);
}

@media (pointer:coarse) {
  .fs-btn {
    display: block;
  }

  .rotate-hint {
    display: none !important;
  }
}

/* Touch buttons: sirf jab start screen band ho */
body .touch-control {
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s;
}

body.show-controls .touch-control {
  opacity: 1;
  pointer-events: auto;
}

/* Khelte waqt page scroll / pull-to-refresh band */
html:has(body.is-running),
body.is-running {
  overflow: hidden;
  overscroll-behavior: none;
}

/* Run ke dauraan bottom nav ki zarurat nahi — jagah aur galti se tap dono bachte hain */
body.is-running .game-bottom-nav {
  display: none !important;
}

/* ---------- PORTRAIT PHONE ---------- */
@media (max-width:700px) and (orientation:portrait) {

  /* Game ko screen ke beech me rakho, buttons neeche bade pads */
  body.is-running .app {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    padding-bottom: 170px;
  }

  body.is-running .game-shell {
    margin-top: auto;
    margin-bottom: auto;
  }

  body .touch-controls {
    position: fixed;
    z-index: 850;
    left: calc(12px + env(safe-area-inset-left));
    right: calc(12px + env(safe-area-inset-right));
    bottom: calc(76px + env(safe-area-inset-bottom));
    display: flex;
    gap: 12px;
    align-items: stretch;
    opacity: 1;
    pointer-events: none;
  }

  body.is-running .touch-controls {
    bottom: calc(14px + env(safe-area-inset-bottom));
  }

  body .touch-control {
    width: auto;
    height: clamp(92px, 15dvh, 132px);
    border-radius: 20px;
    grid-auto-flow: row;
    align-content: center;
  }

  body .sneak-control {
    flex: 1 1 0;
    width: auto;
  }

  body .jump-control {
    flex: 1.7 1 0;
    width: auto;
  }

  body .touch-control span {
    font-size: 34px;
  }

  body .touch-control small {
    font-size: 10px;
  }
}

/* ---------- LANDSCAPE PHONE ---------- */
@media (orientation:landscape) and (max-height:520px) {

  body .app {
    width: 100% !important;
    max-width: none !important;
    padding: 4px max(8px, env(safe-area-inset-right)) 4px max(8px, env(safe-area-inset-left)) !important;
  }

  /* Compact top bar: sirf icon buttons */
  .topbar {
    margin-bottom: 4px;
    min-height: 0;
  }

  .brand-wordmark,
  .player-chip,
  .top-actions .icon-btn span {
    display: none !important;
  }

  .brand-logo-mark {
    width: 28px;
    height: 28px;
  }

  .top-actions .icon-btn {
    min-width: 34px;
    min-height: 30px;
    padding: 2px 8px;
  }

  .game-topline {
    display: flex;
    justify-content: space-between;
    min-height: 0;
    padding: 3px 14px;
  }

  .game-topline .stat strong {
    font-size: 15px;
  }

  .game-topline .stat-label {
    font-size: 8px;
  }

  /* [SNEAK] [ CANVAS ] [JUMP] — buttons canvas ke BAHAR, side me */
  body .game-frame {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
    align-items: end;
    background: var(--ink);
    padding: 0;
  }

  body .game-frame #gameCanvas {
    grid-column: 2;
    grid-row: 1;
    display: block;
    width: calc((100dvh - 92px) * 960 / 420);
    max-width: calc(100vw - 190px);
    height: auto;
    aspect-ratio: 960 / 420;
    margin: 0 auto;
  }

  body .touch-controls {
    display: contents;
  }

  body .touch-control {
    position: relative;
    z-index: 2;
    grid-row: 1;
    align-self: end;
    margin: 0 0 10px;
  }

  body .sneak-control {
    grid-column: 1;
    justify-self: start;
    margin-left: 10px;
    width: 72px;
    height: 72px;
  }

  body .jump-control {
    grid-column: 3;
    justify-self: end;
    margin-right: 10px;
    width: 88px;
    height: 88px;
  }

  body .game-frame .overlay {
    grid-column: 1 / -1;
  }

  /* Game Over card chhota: landscape me bina scroll ke dikhe */
  #gameOverOverlay .overlay-symbol {
    display: none;
  }

  #gameOverOverlay .overlay-card h2 {
    margin: 2px 0;
    font-size: 22px;
  }

  #gameOverOverlay .overlay-copy {
    margin: 2px 0 6px;
  }

  #gameOverOverlay .result-row {
    padding: 6px 0;
  }

  #gameOverOverlay .primary-btn,
  #gameOverOverlay .share-btn {
    min-height: 34px;
    margin-top: 6px;
    padding-top: 6px;
    padding-bottom: 6px;
  }

  .run-unlocks {
    margin: 6px 0 2px;
    padding: 5px 8px;
    max-height: 52px;
  }
}


/* =========================================================
   REVD PIXEL — MAP EXPLORER PANEL
========================================================= */
.explorer-toggle {
  position: absolute;
  z-index: 25;
  top: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 10px 12px;
  border: 2px solid var(--ink);
  background: var(--panel);
  color: var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .6px;
  transition: transform .12s, box-shadow .12s
}

.explorer-toggle:hover,
.explorer-toggle.active {
  background: #ffebc6
}

.explorer-toggle:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 var(--ink)
}

.explorer-panel {
  position: absolute;
  z-index: 40;
  top: 58px;
  right: 12px;
  width: min(330px, calc(100% - 24px));
  max-height: calc(100% - 72px);
  overflow: auto;
  padding: 17px;
  background: var(--panel);
  border: 3px solid var(--ink);
  box-shadow: 6px 6px 0 rgba(39, 43, 39, .75);
  color: var(--ink)
}

.explorer-panel.hidden {
  display: none !important
}

.explorer-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 15px
}

.explorer-kicker {
  font-size: 8px;
  letter-spacing: 1.5px;
  color: var(--green);
  font-weight: 900
}

.explorer-panel-head h3 {
  margin: 6px 0 0;
  font-size: 17px;
  font-weight: 900
}

.explorer-close {
  width: 31px;
  height: 31px;
  border: 2px solid var(--ink);
  background: #fff0df;
  font-size: 22px;
  line-height: 1
}

.explorer-field {
  display: grid;
  gap: 7px;
  margin: 12px 0;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .4px
}

.explorer-field select {
  width: 100%;
  min-height: 39px;
  padding: 8px 10px;
  border: 2px solid var(--ink);
  border-radius: 0;
  background: #fffdf4;
  color: var(--ink);
  font: 700 11px var(--sans)
}

.explorer-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 0;
  border-bottom: 1px dashed var(--line);
  cursor: pointer
}

.explorer-switch span {
  display: grid;
  gap: 4px
}

.explorer-switch b {
  font-size: 11px
}

.explorer-switch small {
  font-size: 9px;
  color: var(--muted)
}

.explorer-switch input {
  position: absolute;
  opacity: 0;
  pointer-events: none
}

.explorer-switch i {
  position: relative;
  flex: 0 0 38px;
  width: 38px;
  height: 22px;
  border: 2px solid var(--ink);
  background: #e3e0d2;
  transition: background .15s
}

.explorer-switch i:after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 14px;
  height: 14px;
  background: #fffdf4;
  border: 1px solid var(--ink);
  transition: transform .15s
}

.explorer-switch input:checked+i {
  background: var(--green)
}

.explorer-switch input:checked+i:after {
  transform: translateX(16px)
}

.explorer-switch input:focus-visible+i {
  outline: 3px solid var(--purple);
  outline-offset: 3px
}

.explorer-note {
  margin: 13px 0;
  padding: 10px;
  background: #f4f0df;
  color: #686e62;
  font-size: 10px;
  line-height: 1.6
}

.explorer-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px
}

.explorer-actions button {
  min-height: 38px;
  padding: 8px;
  border: 2px solid var(--ink);
  background: #fffdf4;
  color: var(--ink);
  font-size: 10px;
  font-weight: 900;
  box-shadow: 2px 2px 0 var(--ink)
}

.explorer-actions button:last-child {
  background: var(--green);
  color: white
}

@media(max-width:700px) {
  .explorer-toggle {
    top: 8px;
    right: 8px;
    padding: 8px 9px;
    font-size: 9px
  }

  .explorer-panel {
    top: 49px;
    right: 8px;
    width: min(310px, calc(100% - 16px));
    max-height: calc(100% - 57px);
    padding: 13px
  }

  .explorer-panel-head h3 {
    font-size: 15px
  }

  .explorer-note {
    font-size: 9px
  }
}

@media(orientation:landscape) and (max-height:520px) {
  .explorer-toggle {
    top: 7px;
    right: 7px;
    padding: 7px 8px
  }

  .explorer-panel {
    top: 43px;
    right: 7px;
    max-height: calc(100% - 49px);
    padding: 10px
  }

  .explorer-panel-head {
    margin-bottom: 8px
  }

  .explorer-field {
    margin: 7px 0
  }

  .explorer-switch {
    padding: 7px 0
  }

  .explorer-note {
    margin: 8px 0;
    padding: 7px
  }

  .explorer-actions button {
    min-height: 32px
  }
}

/* ---------- MAP EXPLORER: FULL PIXEL-ART SELECT CONTROLS ---------- */
.explorer-panel .pixel-select {
  position: relative;
  min-width: 0;
  font-family: var(--sans)
}

.explorer-panel .pixel-select-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 2px solid var(--ink);
  border-radius: 0;
  background: #fffdf4;
  color: var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  font: 900 10px/1.4 var(--sans);
  letter-spacing: .35px;
  text-align: left;
  cursor: pointer;
  image-rendering: pixelated
}

.explorer-panel .pixel-select-trigger span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap
}

.explorer-panel .pixel-select-trigger b {
  flex: 0 0 auto;
  font-size: 10px;
  color: var(--green);
  transition: transform .12s
}

.explorer-panel .pixel-select.open .pixel-select-trigger {
  background: #ffebc6;
  box-shadow: 1px 1px 0 var(--ink);
  transform: translate(2px, 2px)
}

.explorer-panel .pixel-select.open .pixel-select-trigger b {
  transform: rotate(180deg)
}

.explorer-panel .pixel-select-menu {
  display: none;
  position: absolute;
  z-index: 60;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  max-height: 190px;
  overflow: auto;
  padding: 4px;
  border: 3px solid var(--ink);
  background: #fffdf4;
  box-shadow: 4px 4px 0 rgba(39, 43, 39, .75);
  scrollbar-color: var(--green) #e9e4d4;
  scrollbar-width: thin
}

.explorer-panel .pixel-select.open .pixel-select-menu {
  display: grid;
  gap: 3px
}

.explorer-panel .pixel-select-option {
  display: block;
  width: 100%;
  min-height: 34px;
  padding: 8px 9px;
  border: 2px solid transparent;
  border-radius: 0;
  background: #f4f0df;
  color: var(--ink);
  font: 900 9px/1.4 var(--sans);
  letter-spacing: .3px;
  text-align: left;
  cursor: pointer
}

.explorer-panel .pixel-select-option:before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 8px;
  background: transparent;
  vertical-align: 1px
}

.explorer-panel .pixel-select-option:hover,
.explorer-panel .pixel-select-option:focus-visible {
  border-color: var(--ink);
  background: #ffebc6;
  outline: none
}

.explorer-panel .pixel-select-option.selected {
  border-color: var(--ink);
  background: var(--green);
  color: #fff
}

.explorer-panel .pixel-select-option.selected:before {
  background: #fff;
  box-shadow: 2px 0 0 #fff, 0 2px 0 #fff
}

@media(max-width:700px) {
  .explorer-panel .pixel-select-trigger {
    min-height: 42px;
    font-size: 10px
  }

  .explorer-panel .pixel-select-menu {
    max-height: 160px
  }
}


/* Map Explorer sandbox: hide the normal live-mission card while exploring. */
.map-explorer-mode .mission-card {
  display: none !important;
}

/* =========================================================
   REVD PIXEL — POLISHED TUTORIAL UI
   Better Layout + Responsive Cards + Disabled Explore
   ========================================================= */

/* ---------- TUTORIAL OVERLAY ---------- */

#tutorialOverlay {
  position: fixed;
  inset: 0;
  z-index: 9999;

  display: flex;
  align-items: center;
  justify-content: center;

  padding: 20px;
  overflow-y: auto;

  background: rgba(12, 15, 22, 0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* ---------- MAIN TUTORIAL CARD ---------- */

#tutorialOverlay .tutorial-card {
  width: min(820px, 100%);
  max-height: calc(100vh - 40px);

  overflow-x: hidden;
  overflow-y: auto;

  margin: auto;
  padding: clamp(18px, 3vw, 30px);

  border: 3px solid var(--ink);
  border-radius: 4px;

  background: #f8f4e8;
  color: #242820;

  box-shadow:
    6px 6px 0 var(--ink),
    0 18px 55px rgba(0, 0, 0, 0.35);

  scrollbar-width: thin;
  scrollbar-color: var(--green) #e7e4d4;

  animation: tutorialEnter 0.22s ease-out;
}

@keyframes tutorialEnter {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- HEADER ---------- */

#tutorialOverlay .tutorial-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;

  padding-bottom: 16px;
  margin-bottom: 16px;

  border-bottom: 2px dashed #c9c6b7;
}

#tutorialOverlay .tutorial-heading h2 {
  margin: 0;
  font-size: clamp(17px, 3vw, 23px);
  line-height: 1.5;
  overflow-wrap: anywhere;
}

/* ---------- TUTORIAL TIMER ---------- */

#tutorialOverlay .tutorial-clock {
  flex-shrink: 0;
  min-width: 76px;
  padding: 10px;

  display: grid;
  place-items: center;
  gap: 4px;

  background: #fce5ce;
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
}

#tutorialOverlay .tutorial-clock strong {
  font-size: 20px;
  line-height: 1.3;
}

#tutorialOverlay .tutorial-clock small {
  font-size: 8px;
  letter-spacing: 1px;
}

/* ---------- PROGRESS BAR ---------- */

#tutorialOverlay .tutorial-progress {
  height: 12px;
  margin: 0 0 22px;

  overflow: hidden;

  border: 2px solid var(--ink);
  background: #e3dfd1;
}

#tutorialOverlay .tutorial-progress span {
  display: block;
  height: 100%;

  background: var(--green);
  transition: width 0.3s ease;
}

/* ---------- CURRENT LESSON ---------- */

#tutorialOverlay .tour-slide {
  min-height: 125px;
  padding: clamp(15px, 3vw, 22px);
  margin-bottom: 20px;

  background: #edf2df;
  border: 2px solid var(--ink);
  box-shadow: 4px 4px 0 #d1d5c2;
}

#tutorialOverlay .tutorial-step {
  margin: 0 0 10px;

  color: var(--green-dark);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

#tutorialOverlay .tour-slide h3 {
  margin: 0 0 12px;

  font-size: clamp(17px, 3vw, 22px);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

#tutorialOverlay .tour-slide p:last-child {
  margin: 0;

  color: #586151;
  font-size: 13px;
  line-height: 1.8;
  overflow-wrap: anywhere;
}

/* ---------- GUIDE CARDS ---------- */

#tutorialOverlay .tutorial-guide-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;

  margin-top: 18px;
}

#tutorialOverlay .tutorial-guide-grid article {
  display: flex;
  align-items: flex-start;
  gap: 12px;

  min-width: 0;
  padding: 15px;

  background: #fffdf5;
  border: 2px solid #d8d5c7;

  transition:
    transform 0.18s ease,
    box-shadow 0.18s ease,
    border-color 0.18s ease;
}

#tutorialOverlay .tutorial-guide-grid article:hover {
  transform: translateY(-2px);
  border-color: var(--green);
  box-shadow: 3px 3px 0 #d8d5c7;
}

#tutorialOverlay .tutorial-guide-grid article>span {
  flex-shrink: 0;
  font-size: 25px;
  line-height: 1.2;
}

#tutorialOverlay .tutorial-guide-grid article>div {
  min-width: 0;
}

#tutorialOverlay .tutorial-guide-grid b {
  display: block;
  margin-bottom: 7px;

  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

#tutorialOverlay .tutorial-guide-grid p {
  margin: 0;

  color: #70776b;
  font-size: 11px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

/* ---------- TUTORIAL ACTION BUTTONS ---------- */

#tutorialOverlay .tutorial-actions {
  display: flex;
  align-items: stretch;
  gap: 12px;

  margin-top: 24px;
}

#tutorialOverlay .tutorial-actions button {
  min-height: 48px;
  cursor: pointer;

  transition:
    transform 0.15s ease,
    opacity 0.15s ease;
}

#tutorialOverlay .tutorial-actions button:active:not(:disabled) {
  transform: translateY(2px);
}

#tutorialOverlay .tutorial-actions .primary-btn {
  flex: 1;
  min-width: 0;
}

#tutorialOverlay .tutorial-actions .secondary-btn {
  flex-shrink: 0;
  margin: 0;
  min-height: 48px;
}

#tutorialOverlay .tutorial-footnote {
  margin: 15px 0 0;

  font-size: 11px;
  line-height: 1.8;
  overflow-wrap: anywhere;
}

#tutorialOverlay .tutorial-footer-btn {
  margin-left: auto;
}

/* ---------- DISABLED BUTTON VISUALS ---------- */

#tutorialOverlay button:disabled,
#tutorialOverlay button[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.6);
  box-shadow: none;
}

/* ---------- EXPLORE BUTTON DURING TUTORIAL ---------- */

/* Tutorial visible hone par Explore button ko visually disable karo. */
body:has(#tutorialOverlay:not(.hidden)) .explorer-toggle,
body:has(#tutorialOverlay:not(.hidden)) .explorer-toggle.active {
  opacity: 0.4 !important;
  cursor: not-allowed !important;
  filter: grayscale(1);
  box-shadow: none !important;
}

/* ---------- SMALL SCREENS ---------- */

@media (max-width: 620px) {
  #tutorialOverlay {
    align-items: flex-start;
    padding: 10px;
  }

  #tutorialOverlay .tutorial-card {
    width: 100%;
    max-height: calc(100dvh - 20px);
    padding: 15px;
    box-shadow: 4px 4px 0 var(--ink);
  }

  #tutorialOverlay .tutorial-heading {
    gap: 10px;
    align-items: center;
  }

  #tutorialOverlay .tutorial-clock {
    min-width: 62px;
    padding: 7px;
  }

  #tutorialOverlay .tutorial-clock strong {
    font-size: 17px;
  }

  #tutorialOverlay .tutorial-guide-grid {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  #tutorialOverlay .tutorial-guide-grid article {
    padding: 12px;
  }

  #tutorialOverlay .tour-slide {
    min-height: auto;
    padding: 15px;
  }

  #tutorialOverlay .tutorial-actions {
    flex-wrap: wrap;
    gap: 9px;
  }

  #tutorialOverlay .tutorial-actions .primary-btn {
    flex-basis: 100%;
  }

  #tutorialOverlay .tutorial-actions .secondary-btn {
    flex: 1;
    min-width: 0;
    padding: 10px;
  }
}

/* ---------- EXTRA SMALL PHONES ---------- */

@media (max-width: 360px) {
  #tutorialOverlay .tutorial-card {
    padding: 11px;
  }

  #tutorialOverlay .tutorial-heading h2 {
    font-size: 15px;
  }

  #tutorialOverlay .tour-slide h3 {
    font-size: 16px;
  }

  #tutorialOverlay .tour-slide p:last-child {
    font-size: 12px;
  }

  #tutorialOverlay .tutorial-guide-grid article>span {
    font-size: 21px;
  }
}

/* ---------- REDUCED MOTION ---------- */

@media (prefers-reduced-motion: reduce) {
  #tutorialOverlay .tutorial-card {
    animation: none;
  }

  #tutorialOverlay *,
  #tutorialOverlay *::before,
  #tutorialOverlay *::after {
    transition-duration: 0.01ms !important;
  }
}

/* Explore button locked during tutorial */
.explorer-toggle:disabled {
  opacity: 0.4 !important;
  cursor: not-allowed !important;
  pointer-events: none !important;
  filter: grayscale(1);
  box-shadow: none !important;
}

/* ===============================================================
   v1.1.1 — QUICK TUTORIAL: small coach card, the frozen obstacle stays visible
=============================================================== */
#tutorialOverlay.tutorial-coach {
  align-items: flex-start;
  justify-content: center;
  padding: clamp(6px, 2vh, 18px);
  background: rgba(12, 15, 22, 0.22);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  pointer-events: none;
  overflow: hidden;
}

#tutorialOverlay.tutorial-coach .tutorial-card {
  pointer-events: auto;
  width: min(430px, 100%);
  max-height: none;
  margin: 0;
  padding: 12px 14px 14px;
  display: grid;
  gap: 9px;
  overflow: visible;
}

#tutorialOverlay.tutorial-coach .tutorial-heading {
  margin: 0;
  align-items: center;
}

#tutorialOverlay.tutorial-coach .tutorial-heading h2 {
  font-size: clamp(15px, 3.4vw, 20px);
  margin: 4px 0 0;
}

#tutorialOverlay.tutorial-coach .tutorial-step {
  margin: 0;
  font-size: 8px;
  color: var(--orange);
}

#tutorialOverlay.tutorial-coach .tutorial-clock {
  transform: scale(.82);
  transform-origin: right center;
}

#tutorialOverlay.tutorial-coach .tutorial-progress {
  margin: 0;
}

.tutorial-line {
  margin: 0;
  font-size: clamp(14px, 3.2vw, 16px);
  font-weight: 800;
  line-height: 1.35;
  color: #242820;
}

.tutorial-keys {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.tkey {
  display: grid;
  grid-template-columns: 30px 1fr;
  grid-template-rows: auto auto;
  column-gap: 8px;
  align-items: center;
  padding: 7px 8px;
  border: 2px solid var(--ink);
  background: #ece8d4;
  color: #6a7066;
  opacity: .5;
  filter: grayscale(.6);
  transition: opacity .15s, transform .15s, filter .15s;
}

.tkey b {
  grid-row: 1 / 3;
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  font-size: 17px;
  border: 2px solid var(--ink);
  border-bottom-width: 4px;
  background: #fffdf4;
  color: var(--ink);
}

.tkey span {
  font-family: var(--pixel);
  font-size: 9px;
  color: var(--ink);
}

.tkey small {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .03em;
}

.tutorial-keys[data-use="jump"] .tkey-jump,
.tutorial-keys[data-use="sneak"] .tkey-sneak,
.tutorial-keys[data-use="both"] .tkey {
  opacity: 1;
  filter: none;
  background: #fff3d6;
}

.tutorial-keys[data-use="jump"] .tkey-jump b,
.tutorial-keys[data-use="sneak"] .tkey-sneak b,
.tutorial-keys[data-use="both"] .tkey b {
  animation: tkeyPress 0.9s steps(2) infinite;
  background: #ffd36a;
}

@keyframes tkeyPress {
  50% {
    transform: translateY(3px);
    border-bottom-width: 2px;
  }
}

.tutorial-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.tutorial-chips small {
  font-family: var(--pixel);
  font-size: 7px;
  color: #7e857a;
  margin-right: 4px;
}

.tutorial-chips i {
  font-style: normal;
  font-size: 10px;
  font-weight: 800;
  padding: 3px 6px;
  border: 1.5px solid var(--ink);
  background: #e1f1d9;
  color: var(--ink);
}

#tutorialOverlay.tutorial-coach .tutorial-actions {
  margin: 0;
  display: grid;
  grid-template-columns: .6fr 1.4fr;
  gap: 8px;
}

#tutorialOverlay.tutorial-coach .tutorial-actions button {
  padding: 10px 8px;
}

@media (max-height: 460px) {
  #tutorialOverlay.tutorial-coach {
    justify-content: flex-end;
  }

  #tutorialOverlay.tutorial-coach .tutorial-card {
    width: min(340px, 46vw);
    padding: 8px 10px 10px;
    gap: 6px;
  }

  .tutorial-chips {
    display: none;
  }

  .tutorial-line {
    font-size: 13px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tutorial-keys .tkey b {
    animation: none !important;
  }
}


/* CUSTOM FOX — LOADING SCREEN */
.loading-runner-fox {
  width: 58px !important;
  height: 58px !important;
  bottom: 8px !important;
  display: block;
}

.loading-custom-fox {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  animation: loadingFoxRun .6s steps(2, end) infinite;
}

@media (prefers-reduced-motion: reduce) {
  .loading-custom-fox {
    animation: none !important;
  }
}
