:root {
  --sky: #70c5ce;
  --ink: #2b2b2b;
  --white: #ffffff;
  --hud-pill-width: clamp(150px, 30vw, 230px);
  --panel: #ded895;
  --panel-dark: #b89f55;
  --panel-stroke: #86733f;
  --orange: #f7ac3a;
  --orange-shadow: #d1802d;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  overscroll-behavior: none;
  touch-action: none;
}

body {
  background: #000;
  color: var(--white);
  font-family: "Trebuchet MS", "Verdana", sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.game-shell {
  position: fixed;
  inset: 0;
  background: var(--sky);
  overflow: hidden;
}

#gameCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  -webkit-user-select: none;
  user-select: none;
}

.hud {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.timer,
.cooldown {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  margin: 0;
  padding: 6px 10px;
  color: #fff8df;
  font-size: clamp(12px, 3.4vw, 17px);
  font-weight: 900;
  letter-spacing: 0.45px;
  border: 2px solid #ffefba;
  background: linear-gradient(180deg, #643829d8, #4d261bd8);
  box-shadow: 0 4px 0 #30160f;
  -webkit-text-stroke: 1.1px #3f2020;
  paint-order: stroke fill;
  text-shadow: none;
}

.flap {
  display: none;
  position: absolute;
  top: calc(max(10px, env(safe-area-inset-top)) + 5px);
  left: max(10px, env(safe-area-inset-left));
  margin: 0;
  padding: 0;
  color: #f7f0cf;
  font-size: clamp(14px, 3.6vw, 19px);
  font-weight: 900;
  letter-spacing: 0.45px;
  -webkit-text-stroke: 1px #3f2020;
  paint-order: stroke fill;
  text-shadow: none;
}

.flap.active {
  color: #ffea71;
  -webkit-text-stroke: 1px #3f2020;
  paint-order: stroke fill;
  text-shadow: none;
}

.timer {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
}

.timer.urgent {
  animation: timer-urgent-blink 0.55s steps(1, end) infinite;
}

@keyframes timer-urgent-blink {
  0% {
    color: #fff8df;
    border-color: #ffefba;
  }
  50% {
    color: #ffd8d8;
    border-color: #ff9b9b;
  }
  100% {
    color: #fff8df;
    border-color: #ffefba;
  }
}

.cooldown {
  right: max(10px, env(safe-area-inset-right));
  width: var(--hud-pill-width);
  text-align: center;
  --poop-ready: 100%;
  background:
    linear-gradient(
      90deg,
      #7dc95f 0 var(--poop-ready),
      #4d261bd8 var(--poop-ready) 100%
    );
}

.score {
  position: absolute;
  top: calc(max(10px, env(safe-area-inset-top)) + clamp(52px, 12vw, 68px));
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  color: #ffffff;
  font-size: clamp(52px, 18vw, 94px);
  line-height: 0.86;
  font-weight: 900;
  -webkit-text-stroke: 2.6px #533;
  paint-order: stroke fill;
  text-shadow: none;
  filter: none;
}

.score.flash {
  color: #ffe75e;
  filter: drop-shadow(0 0 6px #fff38a) drop-shadow(0 0 14px #ffd84d);
}

.boost-hud {
  position: absolute;
  right: max(10px, env(safe-area-inset-right));
  top: calc(max(10px, env(safe-area-inset-top)) + clamp(34px, 8vw, 42px));
  width: var(--hud-pill-width);
  pointer-events: none;
}

.boost-label {
  display: block;
  width: 100%;
  margin: 0;
  padding: 6px 10px;
  text-align: center;
  font-size: clamp(12px, 3.2vw, 16px);
  font-weight: 900;
  color: #fff8df;
  border: 2px solid #fff8ce;
  box-shadow: 0 4px 0 #30160f;
  --boost-ready: 100%;
  background:
    linear-gradient(
      90deg,
      #7dc95f 0 var(--boost-ready),
      #4d261bd8 var(--boost-ready) 100%
    );
  -webkit-text-stroke: 1.1px #3f2020;
  paint-order: stroke fill;
  text-shadow: none;
}

.overlay {
  position: absolute;
  inset: 0;
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
}

.ready {
  background: linear-gradient(180deg, #00000014, #0000004a);
  pointer-events: none;
}

.logo-card,
.score-card {
  border: 3px solid var(--panel-stroke);
  box-shadow: 0 6px 0 #7f6a39;
}

.logo-card {
  position: relative;
  z-index: 3;
  background: var(--panel);
  color: #3f2d22;
  padding: 14px;
  width: min(92vw, 440px);
}

.logo-card h1 {
  margin: 0;
  font-size: clamp(30px, 10vw, 62px);
  line-height: 0.92;
  letter-spacing: 1px;
  color: #fff;
  -webkit-text-stroke: 2.4px #533;
  paint-order: stroke fill;
  text-shadow: none;
}

.logo-card p {
  margin: 10px 0 0;
  font-size: clamp(13px, 3.5vw, 19px);
  font-weight: 800;
}

.control-card {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  width: 100%;
  overflow: hidden;
  z-index: 1;
}

.left-zone,
.right-zone {
  padding: 14px 10px;
  font-size: clamp(16px, 4.8vw, 30px);
  font-weight: 900;
  line-height: 1.1;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  -webkit-text-stroke: 1.4px #533;
  paint-order: stroke fill;
  text-shadow: none;
}

.left-zone {
  background: linear-gradient(180deg, #3a9ef22e, #3a9ef240);
  border-right: 2px dashed #b3dfff8e;
}

.right-zone {
  background: linear-gradient(180deg, #f08e332e, #f08e3340);
}

.pixel-logo {
  position: relative;
  width: 124px;
  height: 124px;
  margin: 0 auto 10px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  overflow: visible;
  background: radial-gradient(circle at 35% 30%, #ffe69a 10%, #f9cb58 55%, #db9e32 100%);
  box-shadow:
    inset 0 0 0 4px #fff4c7,
    0 5px 0 #aa6f1f;
}

.pixel-logo-canvas {
  position: relative;
  width: 124px;
  height: 124px;
  transform: translateY(-8px);
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.start-hint,
.tiny-hint {
  position: relative;
  z-index: 3;
  margin: 0;
  padding: 7px 10px;
  font-size: clamp(12px, 3.4vw, 18px);
  font-weight: 900;
  border: 3px solid #fff8ce;
  color: #fff9d7;
  background: #00000073;
  -webkit-text-stroke: 1px #2b2b2b;
  paint-order: stroke fill;
  text-shadow: none;
}

.side-action-hints {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 3;
  display: flex;
  justify-content: space-between;
  padding: 0 14px;
  pointer-events: none;
}

.side-action {
  margin: 0;
  color: #fff;
  font-size: clamp(12px, 3vw, 16px);
  font-weight: 900;
  letter-spacing: 0.6px;
  -webkit-text-stroke: 1px #2b2b2b;
  paint-order: stroke fill;
  text-shadow: none;
}

.game-over {
  background: linear-gradient(180deg, #0000001f, #0000006a);
  pointer-events: auto;
}

.game-over-title {
  margin: 0;
  font-size: clamp(42px, 13vw, 88px);
  color: #f2ece5;
  letter-spacing: 1px;
  line-height: 0.9;
  -webkit-text-stroke: 2.8px #533;
  paint-order: stroke fill;
  text-shadow: none;
}

.score-card {
  width: min(90vw, 380px);
  background: var(--panel);
  padding: 12px 14px;
}

.score-card p {
  margin: 6px 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  color: #452e20;
  font-size: clamp(18px, 5vw, 32px);
  font-weight: 900;
}

.score-card strong {
  color: #fff;
  -webkit-text-stroke: 1.5px #533;
  paint-order: stroke fill;
  text-shadow: none;
  font-size: 1.05em;
}

.retry-btn {
  display: block;
  width: min(90vw, 380px);
  border: 3px solid #6a3d24;
  box-shadow: 0 6px 0 var(--orange-shadow);
  background: var(--orange);
  color: #fffde6;
  padding: 12px 26px;
  min-height: 56px;
  font-size: clamp(22px, 7vw, 40px);
  font-weight: 900;
  letter-spacing: 1px;
  -webkit-text-stroke: 2px #6b3419;
  paint-order: stroke fill;
  text-shadow: none;
}

.retry-btn:active {
  transform: translateY(3px);
  box-shadow: 0 2px 0 var(--orange-shadow);
}

.hidden {
  display: none;
}
