:root {
  --ink: #113516;
  --cream: #edf7cf;
  --green: #247d31;
  --dark-green: #155322;
  --border: #2a6a36;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  overflow: hidden;
  color: var(--ink);
  font-family: "Trebuchet MS", system-ui, sans-serif;
  background:
    radial-gradient(circle at 10% 10%, rgba(255, 255, 255, 0.75), transparent 22rem),
    linear-gradient(130deg, #dcffe7 0%, #9bddaa 42%, #61ad6b 100%);
}

body {
  display: grid;
  place-items: center;
  height: 100vh;
  padding: clamp(6px, 1vw, 12px);
}

.duck-game {
  width: min(98vw, 1720px);
  height: min(96vh, 980px);
  border: clamp(4px, 0.45vw, 7px) solid rgba(20, 87, 31, 0.95);
  border-radius: clamp(18px, 2vw, 36px);
  padding: clamp(7px, 1vw, 14px);
  background: rgba(202, 239, 188, 0.75);
  box-shadow: 0 26px 90px rgba(10, 54, 20, 0.32);
}

.game-shell,
.stage-wrap {
  width: 100%;
  height: 100%;
}

.stage-wrap {
  position: relative;
  overflow: hidden;
  border: 4px solid rgba(55, 117, 55, 0.78);
  border-radius: clamp(14px, 1.5vw, 26px);
  background: #bcefe1;
  box-shadow: inset 0 -10px 0 rgba(32, 109, 46, 0.2);
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  image-rendering: crisp-edges;
}

.top-hud {
  position: absolute;
  top: clamp(10px, 1.3vw, 20px);
  left: clamp(10px, 1.3vw, 20px);
  right: clamp(10px, 1.3vw, 20px);
  z-index: 3;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  pointer-events: none;
}

.title-card {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 245px;
  padding: 7px 10px;
  border: 3px solid #184e22;
  border-radius: 15px;
  background: linear-gradient(#2f9a3c, #1e6928);
  color: #fffbe8;
  box-shadow: inset 0 -6px 0 rgba(0, 0, 0, 0.16);
}

.duck-badge {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 12px;
  background: #e7ffc6;
  font-size: 19px;
  box-shadow: inset 0 -4px 0 rgba(31, 91, 36, 0.2);
}

.title-card p,
.title-card h1 {
  margin: 0;
}

.title-card p {
  color: #c8ffc0;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.18em;
}

.title-card h1 {
  font-size: clamp(20px, 2vw, 30px);
  line-height: 1;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.2);
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(58px, 82px));
  gap: 6px;
}

.sound-hud {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  padding: 7px 10px;
  border: 2px solid rgba(55, 117, 55, 0.78);
  border-radius: 13px;
  background: rgba(245, 250, 219, 0.82);
  box-shadow: inset 0 -5px 0 rgba(75, 127, 69, 0.12);
}

.sound-hud span {
  color: #386a34;
  font-size: 9px;
  font-weight: 900;
}

.sound-bars {
  display: flex;
  align-items: center;
  gap: 4px;
  height: 28px;
}

.sound-bars i {
  display: block;
  width: 5px;
  height: 8px;
  border-radius: 99px;
  background: linear-gradient(#2ee85a, #137b2a);
  transform-origin: bottom center;
  transition: height 80ms linear, opacity 80ms linear;
  opacity: 0.35;
}

.stats div {
  border: 2px solid rgba(55, 117, 55, 0.78);
  border-radius: 13px;
  padding: 6px 8px;
  background: rgba(245, 250, 219, 0.9);
  box-shadow: inset 0 -5px 0 rgba(75, 127, 69, 0.12);
}

.stats span {
  display: block;
  color: #386a34;
  font-size: 8px;
  font-weight: 900;
  text-transform: uppercase;
}

.stats strong {
  display: block;
  margin-top: 2px;
  color: #12441a;
  font-size: clamp(18px, 1.9vw, 28px);
  line-height: 1;
}

.how-to {
  position: absolute;
  top: clamp(72px, 8vw, 102px);
  right: clamp(10px, 1.3vw, 20px);
  z-index: 3;
  width: min(190px, 20vw);
  padding: 8px 10px;
  border: 2px solid rgba(55, 117, 55, 0.78);
  border-radius: 16px;
  background: rgba(245, 250, 219, 0.74);
  box-shadow: inset 0 -5px 0 rgba(75, 127, 69, 0.12);
  pointer-events: none;
}

.how-to h2 {
  margin: 0 0 8px;
  padding: 7px;
  border-radius: 12px;
  background: linear-gradient(#33913a, #1d6525);
  color: #fffbe8;
  text-align: center;
  font-size: clamp(14px, 1.35vw, 20px);
}

.how-to ul {
  display: grid;
  gap: 5px;
  margin: 0;
  padding-left: 17px;
  font-size: clamp(10px, 1vw, 13px);
  line-height: 1.22;
}

.message-box {
  position: absolute;
  left: clamp(14px, 1.6vw, 26px);
  right: auto;
  bottom: clamp(14px, 1.6vw, 26px);
  width: min(520px, calc(100% - 32px));
  z-index: 4;
  padding: 9px 14px;
  border: 2px solid rgba(28, 82, 31, 0.76);
  border-radius: 14px;
  background: rgba(239, 248, 216, 0.78);
  font-size: clamp(13px, 1.25vw, 18px);
  font-weight: 900;
}

.message-box.is-hidden {
  display: none;
}

.screen-action {
  position: absolute;
  left: 50%;
  top: 58%;
  z-index: 6;
  min-width: min(360px, 72vw);
  min-height: clamp(62px, 7vw, 92px);
  padding: 0 28px;
  border: 0;
  border-radius: 22px;
  color: #fff;
  background: linear-gradient(#32d553, #16972e);
  box-shadow:
    inset 0 -8px 0 rgba(0, 0, 0, 0.18),
    0 12px 30px rgba(22, 93, 28, 0.32);
  cursor: pointer;
  font: inherit;
  font-size: clamp(24px, 3.2vw, 44px);
  font-weight: 900;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) scale(0.96);
  transition: opacity 160ms ease, transform 160ms ease;
}

.screen-action.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translate(-50%, -50%) scale(1);
}

.screen-action:active {
  transform: translate(-50%, -48%) scale(0.99);
}

.voice-tools {
  display: none;
  position: absolute;
  left: clamp(14px, 1.6vw, 26px);
  bottom: clamp(78px, 8.5vw, 112px);
  z-index: 3;
  grid-template-columns: auto minmax(120px, 210px) minmax(120px, 260px);
  align-items: center;
  gap: 10px;
  max-width: min(720px, calc(100% - 32px));
  padding: 8px 10px;
  border: 2px solid rgba(55, 117, 55, 0.55);
  border-radius: 14px;
  background: rgba(245, 250, 219, 0.7);
  font-size: clamp(11px, 1vw, 14px);
  font-weight: 900;
}

.slider-label {
  display: grid;
  gap: 4px;
}

input[type="range"] {
  width: 100%;
}

.meter {
  position: relative;
  overflow: hidden;
  height: 24px;
  border: 3px solid #214f25;
  border-radius: 999px;
  background: #dcefbf;
}

#voiceFill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #48d65e, #e8d53e, #e7603d);
}

#needMarker {
  position: absolute;
  top: -5px;
  bottom: -5px;
  left: 52%;
  width: 4px;
  background: #122c14;
  border-radius: 99px;
}

@media (max-width: 860px) {
  .top-hud {
    align-items: stretch;
  }

  .title-card {
    max-width: 210px;
  }

  .stats {
    grid-template-columns: repeat(2, minmax(62px, 1fr));
    width: min(42vw, 210px);
  }

  .sound-hud {
    display: none;
  }

  .how-to {
    top: auto;
    right: 10px;
    bottom: 78px;
    width: min(210px, 45vw);
  }

  .how-to ul {
    gap: 4px;
  }

  .voice-tools {
    grid-template-columns: 1fr;
    width: 210px;
  }
}

@media (max-width: 560px) {
  .duck-game {
    width: 100vw;
    height: 100vh;
    border-radius: 0;
    border-width: 0;
    padding: 0;
  }

  .stage-wrap {
    border-radius: 0;
    border-width: 0;
  }

  .title-card h1 {
    font-size: 20px;
  }

  .duck-badge {
    display: none;
  }

  .how-to {
    display: none;
  }
}
