/* ============ Duck Duck Shoot ============ */
* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #1c120a;
  font-family: 'Lilita One', 'Arial Black', system-ui, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  color: #fff;
}

body {
  display: grid;
  place-items: center;
}

#viewport {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 45% 38%, #46301c 0%, #24170d 58%, #120c06 100%);
}

#stage {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1440px;
  height: 900px;
  transform: translate(-50%, -50%);
  transform-origin: center center;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .6);
}

canvas#game {
  position: absolute;
  inset: 0;
  width: 1440px;
  height: 900px;
  display: block;
}

.hidden { display: none !important; }

/* ---------- Text outlines ---------- */
.outline {
  text-shadow:
    -3px -3px 0 #3f2510, 0 -3px 0 #3f2510, 3px -3px 0 #3f2510,
    -3px 0 0 #3f2510, 3px 0 0 #3f2510,
    -3px 3px 0 #3f2510, 0 3px 0 #3f2510, 3px 3px 0 #3f2510,
    0 6px 8px rgba(0, 0, 0, .35);
}
.outline-sm {
  text-shadow:
    -2px -2px 0 #3f2510, 0 -2px 0 #3f2510, 2px -2px 0 #3f2510,
    -2px 0 0 #3f2510, 2px 0 0 #3f2510,
    -2px 2px 0 #3f2510, 0 2px 0 #3f2510, 2px 2px 0 #3f2510,
    0 3px 4px rgba(0, 0, 0, .3);
}
.outline-lg {
  text-shadow:
    -5px -5px 0 #3b220e, 0 -5px 0 #3b220e, 5px -5px 0 #3b220e,
    -5px 0 0 #3b220e, 5px 0 0 #3b220e,
    -5px 5px 0 #3b220e, 0 5px 0 #3b220e, 5px 5px 0 #3b220e,
    -7px 7px 0 #2a1809, 7px 7px 0 #2a1809,
    0 12px 18px rgba(0, 0, 0, .45);
}

/* ---------- Round counter ---------- */
#hud-round {
  position: absolute;
  top: 4px;
  left: 15px;
  z-index: 10;
  font-size: 44px;
  line-height: 1;
  letter-spacing: .5px;
  color: #fff;
  pointer-events: none;
}
#hud-round .hud-total { font-size: 30px; opacity: .95; }
#hud-round .hud-word { letter-spacing: .5px; }

/* ---------- Side panel ---------- */
#panel {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 270px;
  padding: 13px 13px 12px;
  z-index: 20;
  display: flex;
  flex-direction: column;
  border-left: 4px solid #cc9a60;
  border-radius: 18px 0 0 18px;
  background:
    repeating-linear-gradient(92deg,
      rgba(255, 226, 178, .035) 0px, rgba(255, 226, 178, .035) 2px,
      rgba(0, 0, 0, .035) 2px, rgba(0, 0, 0, .035) 8px),
    linear-gradient(175deg, #83512e 0%, #744627 42%, #5d351c 100%);
  box-shadow:
    -12px 0 30px rgba(20, 10, 4, .5),
    inset 0 0 0 3px rgba(255, 218, 165, .14),
    inset 0 0 70px rgba(0, 0, 0, .32),
    inset 8px 0 18px rgba(255, 230, 180, .06);
}
#panelInner {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
#panel::before {
  content: '';
  position: absolute;
  inset: 7px;
  border: 2px solid rgba(255, 222, 174, .16);
  border-radius: 12px;
  pointer-events: none;
}

/* resources */
.resource-box {
  position: relative;
  background: linear-gradient(180deg, #3b2413, #2c190b);
  border: 2px solid #8a5a30;
  border-radius: 12px;
  padding: 8px 11px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  box-shadow:
    inset 0 3px 12px rgba(0, 0, 0, .55),
    0 2px 0 rgba(0, 0, 0, .25);
  transition: transform .12s ease;
}
.resource-box.shake { animation: shake .34s ease; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}
.resource {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 26px;
}
.res-icon {
  width: 27px;
  height: 27px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex: none;
  border: 2px solid rgba(0, 0, 0, .28);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, .18), 0 2px 3px rgba(0, 0, 0, .35);
}
.res-icon.heart {
  background: radial-gradient(circle at 35% 30%, #ff8d82, #dc4a4a 60%, #b62f34);
}
.res-icon.heart svg { width: 17px; height: 17px; display: block; }
.res-icon.crumb {
  background: radial-gradient(circle at 35% 30%, #ffe6a3, #f0bd55 62%, #d99a2b);
}
.res-icon .emoji {
  font-size: 16px;
  line-height: 1;
  transform: translateY(-1px);
  filter: drop-shadow(0 1px 0 rgba(120, 70, 10, .35));
}
.res-num {
  font-size: 26px;
  line-height: 1;
  letter-spacing: .5px;
  color: #fff;
  transition: color .15s ease;
}

/* ducks label */
.panel-label {
  margin: 14px 3px 8px;
  font-size: 32px;
  line-height: 1;
  letter-spacing: .6px;
  color: #fff;
}

/* cards */
.duck-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}
.duck-card {
  position: relative;
  font-family: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 5px 3px 7px;
  border: 3px solid #633c1d;
  border-radius: 13px;
  background:
    radial-gradient(ellipse at 50% 0%, #fffdf4 0%, #f7edd5 60%, #ecd9b4 100%);
  color: #58351a;
  cursor: pointer;
  box-shadow:
    0 4px 0 #3a2210,
    inset 0 2px 0 rgba(255, 255, 255, .9),
    0 6px 9px rgba(0, 0, 0, .25);
  transition: transform .13s cubic-bezier(.2, .8, .4, 1), box-shadow .13s ease, filter .18s ease, opacity .18s ease;
  outline: none;
}
.duck-card img {
  width: 62px;
  height: 62px;
  object-fit: contain;
  pointer-events: none;
  filter: drop-shadow(0 2px 2px rgba(90, 50, 10, .28));
  transition: transform .13s ease;
}
.duck-card:hover {
  transform: translateY(-4px);
  box-shadow:
    0 8px 0 #3a2210,
    inset 0 2px 0 rgba(255, 255, 255, .9),
    0 12px 16px rgba(0, 0, 0, .3);
}
.duck-card:hover img { transform: scale(1.05); }
.duck-card:active { transform: translateY(-1px); box-shadow: 0 3px 0 #3a2210; }
.duck-card.poor {
  background: radial-gradient(ellipse at 50% 0%, #f4f1e8 0%, #e7e0d0 60%, #d8ceb9 100%);
}
.duck-card.poor img,
.duck-card.poor .card-name,
.duck-card.poor .card-price {
  filter: grayscale(.85) brightness(.82);
  opacity: .62;
}
.duck-card.poor:hover { transform: translateY(-2px); }
.duck-card.active {
  border-color: #ffd15a;
  box-shadow:
    0 0 0 3px #ffcf4a,
    0 5px 0 #3a2210,
    0 10px 18px rgba(0, 0, 0, .35),
    0 0 24px rgba(255, 205, 70, .35);
}
.card-name {
  font-size: 16px;
  letter-spacing: .3px;
  line-height: 1.1;
}
.card-price {
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 14px;
  line-height: 1.1;
  color: #8a5a20;
  letter-spacing: .2px;
}
.coin {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 28%, #ffeaa0, #f0b535 62%, #c98c17);
  box-shadow: inset 0 0 0 1.5px #a97010, 0 1px 1px rgba(0, 0, 0, .25);
  flex: none;
}

/* ---------- Upgrade box ---------- */
.upgrade-box {
  margin-top: 12px;
  padding: 7px;
  min-height: 250px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  border: 3px solid #966438;
  border-radius: 14px;
  background: linear-gradient(180deg, #4b2c17 0%, #3b2110 100%);
  box-shadow:
    inset 0 4px 14px rgba(0, 0, 0, .5),
    0 3px 0 rgba(0, 0, 0, .25);
}
.up-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 24px;
  padding: 1px 3px 0;
}
.up-name {
  font-size: 18px;
  letter-spacing: .35px;
  color: #ffd778;
  text-shadow: 0 2px 0 rgba(0, 0, 0, .55);
  white-space: nowrap;
}
.up-base {
  margin: -2px 3px 1px;
  font-family: 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
  font-weight: 600;
  font-size: 10.5px;
  line-height: 1.25;
  color: #e2c8a2;
}
.sell-btn {
  font-family: inherit;
  font-size: 11px;
  letter-spacing: .2px;
  padding: 4px 8px 5px;
  border-radius: 8px;
  border: 2px solid #7f3020;
  background: linear-gradient(#e26b52, #c24a35);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 2px 0 #74281a, inset 0 1px 0 rgba(255, 255, 255, .3);
  flex: none;
}
.sell-btn:hover { filter: brightness(1.08); }
.sell-btn:active { transform: translateY(1px); box-shadow: 0 1px 0 #74281a; }

.upgrade-hint {
  margin: auto 10px;
  font-size: 12.5px;
  line-height: 1.35;
  text-align: center;
  color: #e8cfaa;
  opacity: .8;
}

.up-path {
  border-radius: 9px;
  border: 1px solid rgba(255, 219, 160, .12);
  background: rgba(22, 11, 5, .32);
  transition: background .12s ease, border-color .12s ease, opacity .12s ease;
}
.up-path:hover { background: rgba(22, 11, 5, .5); border-color: rgba(255, 219, 160, .22); }
.up-path.locked { opacity: .45; }
.up-path.maxed { opacity: .78; }
.up-buy {
  width: 100%;
  font-family: inherit;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 7px;
  padding: 6px 7px;
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  border-radius: 8px;
}
.up-buy:disabled { cursor: default; }
.up-icon {
  width: 36px;
  height: 36px;
  flex: none;
  object-fit: contain;
  margin-top: -1px;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, .38));
  transition: opacity .12s ease, filter .12s ease;
}
.up-path.locked .up-icon {
  opacity: .6;
  filter: grayscale(1) brightness(.75) drop-shadow(0 2px 2px rgba(0, 0, 0, .3));
}
.up-mid {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
  text-align: left;
}
.up-path-name {
  font-size: 12.5px;
  letter-spacing: .1px;
  color: #fdf3dd;
  white-space: nowrap;
  line-height: 1.15;
  text-align: left;
}
.up-desc {
  font-family: 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
  font-weight: 600;
  font-size: 10px;
  line-height: 1.2;
  letter-spacing: .05px;
  color: #d8bd97;
}
.up-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
  flex: none;
  min-width: 44px;
}
.pips { display: flex; gap: 2px; }
.pip {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: #1d1007;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, .85), 0 0 0 1px rgba(255, 220, 165, .08);
}
.pip.on {
  background: linear-gradient(#ffe37e, #f0a92e);
  box-shadow: 0 0 5px rgba(255, 200, 70, .55);
}
.price-pill {
  min-width: 44px;
  text-align: center;
  font-size: 12px;
  line-height: 1;
  padding: 4px 5px 5px;
  border-radius: 6px;
  background: linear-gradient(#f6e2b7, #e4c68e);
  color: #5b3517;
  box-shadow: 0 2px 0 #a97a45, inset 0 1px 0 #fff8e6;
  white-space: nowrap;
}
.price-pill.cant {
  filter: grayscale(.55) brightness(.88);
  color: #7b5a37;
}
.price-pill.max {
  background: linear-gradient(#8fdc5c, #5cb22f);
  color: #fff;
  text-shadow: 0 1px 0 #2f6b18;
  box-shadow: 0 2px 0 #2f6b18;
}

/* ---------- Bottom ---------- */
.bottom-area {
  margin-top: auto;
  padding-top: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
}
.bottom-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}
.sound-btn {
  width: 34px;
  height: 34px;
  padding: 0;
  display: grid;
  place-items: center;
  border-radius: 9px;
  border: 2px solid rgba(255, 218, 165, .18);
  background: rgba(24, 12, 5, .52);
  color: #ffe9c2;
  cursor: pointer;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, .5);
  transition: color .12s ease, background .12s ease, filter .12s ease;
}
.sound-btn:hover { color: #fff6df; background: rgba(24, 12, 5, .72); }
.sound-btn:active { transform: translateY(1px); }
.sound-btn svg { width: 18px; height: 18px; display: block; }
.sound-btn .snd-off { display: none; }
.sound-btn.muted { color: #a98a64; }
.sound-btn.muted .snd-on { display: none; }
.sound-btn.muted .snd-off { display: block; }
.start-btn {
  width: 100%;
  font-family: inherit;
  font-size: 27px;
  letter-spacing: .5px;
  line-height: 1;
  color: #fff;
  padding: 13px 6px 15px;
  border: 3px solid #2f6914;
  border-radius: 16px;
  background: linear-gradient(180deg, #93df50 0%, #67be30 48%, #4c9f23 100%);
  box-shadow:
    0 6px 0 #24530e,
    0 10px 16px rgba(0, 0, 0, .35),
    inset 0 3px 0 rgba(255, 255, 255, .45),
    inset 0 -4px 0 rgba(0, 0, 0, .12);
  cursor: pointer;
  transition: filter .15s ease, transform .07s ease, box-shadow .07s ease;
}
.start-btn.running { font-size: 20px; padding: 16px 6px 18px; letter-spacing: .3px; }
.start-btn:hover:not(:disabled) { filter: brightness(1.08) saturate(1.05); }
.start-btn:active:not(:disabled) {
  transform: translateY(4px);
  box-shadow: 0 2px 0 #24530e, 0 4px 8px rgba(0, 0, 0, .3), inset 0 3px 0 rgba(255, 255, 255, .35);
}
.start-btn:disabled {
  cursor: default;
  filter: grayscale(.42) brightness(.74);
  box-shadow: 0 4px 0 #24530e, inset 0 2px 0 rgba(255, 255, 255, .25);
}
.speed-toggle {
  display: flex;
  gap: 3px;
  padding: 4px;
  border-radius: 11px;
  border: 2px solid rgba(255, 218, 165, .18);
  background: rgba(24, 12, 5, .52);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, .5);
}
.speed-btn {
  font-family: inherit;
  font-size: 14px;
  line-height: 1;
  color: #c9a97e;
  background: transparent;
  border: 0;
  border-radius: 7px;
  padding: 4px 15px 5px;
  cursor: pointer;
  transition: background .12s ease, color .12s ease, box-shadow .12s ease;
}
.speed-btn:hover { color: #ffe9c2; }
.speed-btn.active {
  background: linear-gradient(#ffe071, #f0b12d);
  color: #5a3418;
  box-shadow: 0 2px 0 #b47a14, inset 0 1px 0 #fff3bf;
}

/* ---------- Toast ---------- */
#toast {
  position: absolute;
  left: 585px;
  top: 128px;
  transform: translate(-50%, 0) scale(.86);
  z-index: 30;
  padding: 12px 30px 15px;
  border-radius: 16px;
  border: 3px solid #8a5a30;
  background: linear-gradient(180deg, rgba(74, 44, 23, .97), rgba(50, 28, 12, .97));
  box-shadow: 0 10px 22px rgba(0, 0, 0, .4), inset 0 2px 0 rgba(255, 230, 180, .2);
  font-size: 32px;
  letter-spacing: .4px;
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity .22s ease, transform .22s cubic-bezier(.2, .9, .3, 1.25);
  white-space: nowrap;
}
#toast.show {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

/* ---------- Start screen ---------- */
#title-screen {
  position: absolute;
  inset: 0;
  z-index: 40;
  overflow: hidden;
}
.title-bg {
  position: absolute;
  inset: 0;
  background: url('assets/map.png') center / cover no-repeat;
  filter: blur(5px) saturate(1.06) brightness(.76);
  transform-origin: 50% 50%;
  animation: titleDrift 28s ease-in-out infinite alternate;
}
@keyframes titleDrift {
  from { transform: scale(1.045) translate3d(-5px, -3px, 0); }
  to { transform: scale(1.06) translate3d(6px, 4px, 0); }
}
.title-scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(ellipse at 50% 38%, rgba(12, 24, 6, .04) 0%, rgba(12, 22, 6, .4) 52%, rgba(8, 14, 4, .88) 100%),
    linear-gradient(180deg, rgba(8, 16, 3, .32), rgba(8, 14, 3, .08) 42%, rgba(8, 14, 3, .62));
}
.title-decor {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  pointer-events: none;
  transform-origin: 50% 50%;
  animation: titleDrift 28s ease-in-out infinite alternate;
}
.title-content {
  position: absolute;
  inset: 0;
  z-index: 3;
  padding-top: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  pointer-events: none;
}
.title-logo {
  width: 620px;
  height: auto;
  display: block;
  pointer-events: none;
  filter: drop-shadow(0 15px 18px rgba(0, 0, 0, .42));
  animation: logoDrop .9s cubic-bezier(.16, 1.35, .32, 1) both, logoFloat 4.6s ease-in-out .9s infinite;
}
@keyframes logoDrop {
  0% { transform: translateY(-38px) scale(.9); opacity: 0; }
  65% { transform: translateY(6px) scale(1.025); opacity: 1; }
  100% { transform: translateY(0) scale(1); opacity: 1; }
}
@keyframes logoFloat {
  0%, 100% { transform: translateY(0) rotate(-.35deg); }
  50% { transform: translateY(-7px) rotate(.35deg); }
}
.title-sub {
  margin: 8px 0 0;
  font-size: 24px;
  letter-spacing: .4px;
  color: #ffe9b8;
}
.play-btn {
  font-family: inherit;
  margin-top: 32px;
  padding: 15px 56px 18px;
  font-size: 39px;
  line-height: 1;
  letter-spacing: .6px;
  color: #fff;
  border: 4px solid #2f6914;
  border-radius: 20px;
  background: linear-gradient(180deg, #9ae85a 0%, #6cc533 46%, #4e9f24 100%);
  box-shadow:
    0 8px 0 #24530e,
    0 18px 30px rgba(0, 0, 0, .45),
    inset 0 4px 0 rgba(255, 255, 255, .48),
    inset 0 -5px 0 rgba(0, 0, 0, .12);
  cursor: pointer;
  transition: transform .1s ease, filter .15s ease, box-shadow .1s ease;
  animation: playPulse 2.6s ease-in-out infinite;
}
@keyframes playPulse {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-3px) scale(1.018); }
}
.play-btn:hover {
  filter: brightness(1.09) saturate(1.05);
  animation-play-state: paused;
  transform: translateY(-3px) scale(1.03);
}
.play-btn:active {
  transform: translateY(3px) scale(.99);
  box-shadow: 0 3px 0 #24530e, inset 0 3px 0 rgba(255, 255, 255, .4);
}
.play-btn.small { font-size: 29px; padding: 12px 40px 15px; margin-top: 0; animation: none; }

.start-diffs {
  position: relative;
  margin-top: 16px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 12px;
  pointer-events: auto;
}
.start-diff {
  --c1: #9ae85a;
  --c2: #6cc533;
  --c3: #4e9f24;
  --edge: #2f6914;
  --shadow: #24530e;
  position: relative;
  width: 220px;
  min-height: 130px;
  padding: 12px 13px 13px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-family: inherit;
  color: #fff;
  border: 4px solid var(--edge);
  border-radius: 18px;
  background: linear-gradient(180deg, var(--c1) 0%, var(--c2) 48%, var(--c3) 100%);
  box-shadow:
    0 8px 0 var(--shadow),
    0 16px 24px rgba(0, 0, 0, .42),
    inset 0 4px 0 rgba(255, 255, 255, .42),
    inset 0 -5px 0 rgba(0, 0, 0, .13);
  cursor: pointer;
  transition: transform .1s ease, filter .15s ease, box-shadow .1s ease;
}
.start-diff:hover {
  filter: brightness(1.09) saturate(1.04);
  transform: translateY(-4px);
  box-shadow:
    0 12px 0 var(--shadow),
    0 20px 28px rgba(0, 0, 0, .46),
    inset 0 4px 0 rgba(255, 255, 255, .46),
    inset 0 -5px 0 rgba(0, 0, 0, .13);
}
.start-diff:active {
  transform: translateY(5px);
  box-shadow: 0 3px 0 var(--shadow), inset 0 3px 0 rgba(255, 255, 255, .36);
}
.start-diff:focus-visible { outline: 4px solid #fff6cf; outline-offset: 4px; }
.start-diff.easy { --c1: #a7ed68; --c2: #6cc533; --c3: #4c9f23; --edge: #2f6914; --shadow: #24530e; }
.start-diff.medium { --c1: #ffe98b; --c2: #f2bd38; --c3: #d69519; --edge: #8b5a08; --shadow: #603a04; }
.start-diff.hard { --c1: #ffc06d; --c2: #f28a28; --c3: #d4610f; --edge: #8b3e07; --shadow: #5c2404; }
.start-diff.xtra {
  --c1: #ff8474; --c2: #e64036; --c3: #b9201e; --edge: #6a110f; --shadow: #420908;
  width: 292px;
  min-height: 146px;
  margin-top: -16px;
  gap: 3px;
}
.start-diff.xtra::after {
  content: '';
  position: absolute;
  inset: -10px;
  border-radius: 27px;
  border: 3px solid rgba(255, 151, 128, .55);
  box-shadow: 0 0 26px rgba(255, 75, 52, .62), inset 0 0 20px rgba(255, 110, 78, .2);
  pointer-events: none;
  animation: xtraPulse 1.8s ease-in-out infinite;
}
@keyframes xtraPulse {
  0%, 100% { opacity: .38; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.012); }
}
.sd-name {
  font-size: 26px;
  line-height: 1;
  letter-spacing: .5px;
  color: #fff;
  text-shadow: 0 3px 0 rgba(62, 30, 5, .72), 0 5px 7px rgba(0, 0, 0, .28);
  white-space: nowrap;
}
.start-diff.xtra .sd-name { font-size: 29px; }
.sd-sub {
  font-family: 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
  font-weight: 700;
  font-size: 12.5px;
  line-height: 1.15;
  letter-spacing: .2px;
  color: #fff8e0;
  text-shadow: 0 2px 0 rgba(62, 30, 5, .62);
  white-space: nowrap;
}
.sd-price {
  margin-top: 2px;
  padding: 2px 7px 3px;
  border-radius: 7px;
  background: rgba(54, 27, 4, .24);
  font-family: 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
  font-weight: 700;
  font-size: 10px;
  line-height: 1.1;
  letter-spacing: .5px;
  color: #fff5d9;
  text-transform: uppercase;
}
.sd-extra {
  max-width: 260px;
  font-family: 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
  font-weight: 700;
  font-size: 9px;
  line-height: 1.22;
  letter-spacing: .15px;
  color: #ffe5cf;
  text-shadow: 0 1px 0 rgba(55, 20, 4, .8);
}
.start-footer {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 16px;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  pointer-events: none;
}
.sound-btn.title-sound {
  width: 42px;
  height: 42px;
  pointer-events: auto;
  border: 3px solid rgba(255, 218, 165, .28);
  border-radius: 12px;
  background: rgba(20, 11, 4, .62);
  box-shadow: 0 5px 12px rgba(0, 0, 0, .34), inset 0 2px 6px rgba(0, 0, 0, .42);
}
.sound-btn.title-sound svg { width: 23px; height: 23px; }
.made-with {
  font-family: 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: .45px;
  color: #f4e6c8;
  opacity: .7;
  text-shadow: 0 2px 4px rgba(0, 0, 0, .7);
}

/* ---------- End screen ---------- */
#end-screen {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  background: rgba(20, 12, 5, .66);
  backdrop-filter: blur(3px);
}
.end-card {
  min-width: 640px;
  max-width: 720px;
  padding: 36px 52px 34px;
  text-align: center;
  border-radius: 24px;
  border: 4px solid #c08a52;
  background:
    repeating-linear-gradient(92deg, rgba(255, 226, 178, .03) 0 3px, rgba(0, 0, 0, .03) 3px 9px),
    linear-gradient(180deg, #7c4d2b, #5a331b);
  box-shadow:
    0 24px 60px rgba(0, 0, 0, .55),
    inset 0 0 0 4px rgba(255, 222, 174, .14),
    inset 0 0 60px rgba(0, 0, 0, .3);
  animation: endPop .35s cubic-bezier(.2, .9, .3, 1.2) both;
}
@keyframes endPop {
  from { transform: scale(.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
#end-title {
  margin: 0 0 10px;
  font-size: 54px;
  line-height: 1.05;
  color: #fff;
}
#end-sub {
  margin: 0 0 26px;
  font-size: 20px;
  line-height: 1.35;
  color: #ffe9b8;
}
.end-buttons {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.ghost-btn {
  font-family: inherit;
  font-size: 17px;
  color: #f1d9b4;
  background: transparent;
  border: 2px solid rgba(255, 220, 170, .35);
  border-radius: 10px;
  padding: 7px 18px 9px;
  cursor: pointer;
}
.ghost-btn:hover { background: rgba(255, 230, 190, .1); color: #fff; }

/* scale-down tweaks are handled by the stage transform */

/* ==================== v2: panel, stats, map select ==================== */

/* compact six-card panel */
#resourceBox { padding: 6px 10px; gap: 3px; }
.resource { height: 24px; gap: 8px; }
.res-icon { width: 23px; height: 23px; }
.res-icon .emoji { font-size: 14px; }
.res-icon.heart svg { width: 15px; height: 15px; }
.res-num { font-size: 24px; }
.panel-label { margin: 8px 3px 5px; font-size: 24px; }
.duck-grid { gap: 6px; }
.duck-card {
  gap: 3px;
  padding: 4px 4px 5px;
  border-width: 2px;
  border-radius: 11px;
  box-shadow: 0 3px 0 #3a2210, inset 0 2px 0 rgba(255,255,255,.9), 0 4px 7px rgba(0,0,0,.22);
}
.duck-card:hover { transform: translateY(-2px); box-shadow: 0 5px 0 #3a2210, inset 0 2px 0 rgba(255,255,255,.9), 0 8px 12px rgba(0,0,0,.28); }
.card-top { display: flex; align-items: center; gap: 4px; width: 100%; min-width: 0; }
.duck-card .card-sprite { width: 33px; height: 33px; flex: none; object-fit: contain; }
.card-info { display: flex; flex-direction: column; align-items: flex-start; min-width: 0; line-height: 1.05; }
.card-name { font-size: 13px; letter-spacing: .1px; white-space: nowrap; }
.card-price { font-size: 10.5px; gap: 2px; }
.coin { width: 9px; height: 9px; }
.card-stats { width: 100%; display: flex; flex-direction: column; gap: 2px; }
.stat-row { display: flex; align-items: center; gap: 3px; height: 6px; }
.stat-label { width: 26px; flex: none; font-family: 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif; font-weight: 700; font-size: 6.5px; letter-spacing: .1px; color: #7b5a35; text-align: left; }
.stat-track { flex: 1; height: 4px; border-radius: 2px; background: rgba(91,53,23,.18); overflow: hidden; box-shadow: inset 0 1px 1px rgba(0,0,0,.18); }
.stat-track i { display: block; height: 100%; border-radius: 2px; background: linear-gradient(90deg, #e2a62f, #ffd86a); }
.card-specials { min-height: 9px; display: flex; flex-wrap: wrap; justify-content: center; gap: 2px; width: 100%; }
.badge {
  display: inline-block;
  font-family: 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
  font-weight: 700;
  font-size: 6.5px;
  line-height: 1;
  padding: 2px 3px;
  border-radius: 4px;
  color: #4c2c12;
  background: #efd7a7;
  box-shadow: inset 0 0 0 1px rgba(90,50,18,.18);
  white-space: nowrap;
}
.badge.ghost { color: #fff; background: #7d5bb5; }
.badge.foil { color: #3e3e48; background: #dfe3ec; }
.badge.slow { color: #2e5a72; background: #c9efff; }
.badge.splash { color: #6c3c14; background: #ffd58b; }
.badge.crumb { color: #663c0d; background: #ffd86d; }
.badge.buff { color: #2f5e1e; background: #c5ee9b; }

.upgrade-box { min-height: 0; padding: 6px; gap: 4px; margin-top: 8px; }
.up-head { min-height: 20px; padding: 0 2px; }
.up-name { font-size: 16px; }
.up-base { margin: -1px 2px 0; font-size: 9.5px; }
.sell-btn { font-size: 10px; padding: 3px 6px 4px; }
.duck-stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 7px; padding: 3px 2px 2px; }
.dstat { min-width: 0; }
.dstat-head { display: flex; align-items: baseline; justify-content: space-between; gap: 3px; line-height: 1; }
.dstat-label { font-family: 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif; font-weight: 700; font-size: 8px; color: #d9bd98; }
.dstat-value { font-size: 9px; color: #fff4d8; white-space: nowrap; }
.dstat.preview .dstat-value { color: #ffe37e; }
.dstat-track { display: block; height: 4px; margin-top: 2px; border-radius: 2px; background: rgba(0,0,0,.4); overflow: hidden; box-shadow: inset 0 0 0 1px rgba(255,220,160,.1); }
.dstat-track i { display: block; height: 100%; border-radius: 2px; background: linear-gradient(90deg, #e39b28, #ffe37e); transition: width .12s ease; }
.duck-specials { display: flex; flex-wrap: wrap; gap: 3px; padding: 0 2px 1px; min-height: 11px; }
.duck-specials .badge { font-size: 7px; padding: 2px 4px; }
.up-path { border-radius: 7px; }
.up-buy { padding: 5px 6px; gap: 6px; }
.up-icon { width: 36px; height: 36px; }
.up-path-name { font-size: 11.5px; }
.up-desc { font-size: 9px; }

.bottom-area { padding-top: 8px; gap: 6px; }
.start-btn { font-size: 24px; padding: 10px 6px 12px; border-radius: 14px; }
.start-btn.running { font-size: 18px; padding: 12px 6px 14px; }
.bottom-controls { gap: 6px; }
.sound-btn { width: 30px; height: 30px; }
.speed-btn { font-size: 13px; padding: 4px 12px 5px; }

#hudMeta { margin-top: 4px; font-size: 13px; letter-spacing: .5px; opacity: .82; }
#hud-round .diff-tag {
  display: inline-block;
  vertical-align: middle;
  margin-left: 9px;
  transform: translateY(-4px);
  font-family: 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: .45px;
  padding: 4px 9px 5px;
  border: 2px solid transparent;
  border-radius: 8px;
  text-shadow: 0 1px 0 rgba(0, 0, 0, .38);
}
.diff-tag.easy { color: #fff; border-color: #2f6914; background: linear-gradient(180deg, #a7ed68, #5eb52a); }
.diff-tag.medium { color: #4f2c08; border-color: #8b5a08; background: linear-gradient(180deg, #ffe98b, #f2bd38); text-shadow: none; }
.diff-tag.hard { color: #fff; border-color: #8b3e07; background: linear-gradient(180deg, #ffc06d, #e9781c); }
.diff-tag.xtra { color: #fff; border-color: #6a110f; background: linear-gradient(180deg, #ff8474, #d52b25); box-shadow: 0 0 10px rgba(255, 70, 52, .48); }

/* ---------- Map select ---------- */
#map-screen {
  position: absolute;
  inset: 0;
  z-index: 45;
  overflow: hidden;
  --map-img: url('assets/map.png');
}
#map-screen::before {
  content: '';
  position: absolute;
  inset: -28px;
  background: var(--map-img) center / cover no-repeat;
  filter: blur(7px) saturate(1.02) brightness(.48);
  transform: scale(1.03);
}
.map-scrim {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 50% 42%, rgba(10,18,6,.1), rgba(8,12,5,.68) 75%),
    linear-gradient(180deg, rgba(8,12,4,.35), rgba(8,12,4,.68));
}
.map-content {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 26px 40px 24px;
}
.map-title { margin: 0; font-size: 52px; line-height: 1; color: #fff; }
.map-sub { margin: 2px 0 6px; font-size: 19px; color: #ffe9b8; }
.map-sub .diff-tag {
  display: inline-block;
  vertical-align: 2px;
  margin: 0 2px;
  padding: 4px 9px 5px;
  font-family: 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: .4px;
  border: 2px solid transparent;
  border-radius: 8px;
  text-shadow: 0 1px 0 rgba(0, 0, 0, .38);
}
.map-grid { display: grid; grid-template-columns: repeat(4, 246px); gap: 13px; margin-top: 3px; }
.map-card {
  font-family: inherit;
  padding: 0 0 8px;
  text-align: left;
  border: 3px solid #6b4526;
  border-radius: 14px;
  background: linear-gradient(180deg, #fdf7e9, #ead8b5);
  box-shadow: 0 5px 0 #34200e, 0 10px 18px rgba(0,0,0,.35);
  color: #4e2e17;
  cursor: pointer;
  overflow: hidden;
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}
.map-card:hover { transform: translateY(-3px); box-shadow: 0 8px 0 #34200e, 0 14px 22px rgba(0,0,0,.4); }
.map-card.selected { border-color: #ffd15a; box-shadow: 0 0 0 3px #ffcf4a, 0 5px 0 #34200e, 0 12px 22px rgba(0,0,0,.4); }
.map-card img { width: 100%; height: 126px; object-fit: cover; display: block; border-bottom: 2px solid #6b4526; }
.map-card-body { padding: 6px 10px 0; }
.map-name { display: block; font-size: 21px; line-height: 1.1; letter-spacing: .2px; }
.map-note { display: block; margin-top: 1px; font-family: 'Trebuchet MS', 'Segoe UI', system-ui, sans-serif; font-weight: 700; font-size: 9px; line-height: 1.2; color: #8b6439; min-height: 21px; }
.map-best { display: inline-block; margin-top: 4px; font-size: 11px; color: #6b3d16; background: #f1c96f; border-radius: 6px; padding: 2px 6px; }
#startMapBtn { margin-top: 8px; font-size: 27px; padding: 11px 46px 13px; }
#mapBackBtn { margin-top: 0; }

/* ---------- Galleon warning ---------- */
#warning-banner {
  position: absolute;
  left: 585px;
  top: 202px;
  z-index: 36;
  transform: translate(-50%, -12px);
  padding: 10px 28px 13px;
  border: 3px solid #ffd15a;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(118,24,18,.96), rgba(74,12,10,.96));
  color: #ffe28a;
  font-size: 34px;
  letter-spacing: .5px;
  text-shadow: 0 3px 0 #42100b;
  box-shadow: 0 10px 24px rgba(0,0,0,.45), inset 0 2px 0 rgba(255,255,255,.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
  white-space: nowrap;
}
#warning-banner.show { opacity: 1; transform: translate(-50%, 0); }

/* ============ phones held upright ============ */
html, body { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
body.portrait #stage { border-radius: 0; }
body.portrait #panel {
  top: 900px;
  left: 0;
  right: 0;
  bottom: 0;
  width: auto;
  padding: 0;
  border-left: 0;
  border-top: 4px solid #cc9a60;
  border-radius: 18px 18px 0 0;
  box-shadow: 0 -12px 30px rgba(20, 10, 4, .5), inset 0 0 0 3px rgba(255, 218, 165, .14), inset 0 0 70px rgba(0, 0, 0, .32);
}
body.portrait #panelInner {
  position: absolute;
  left: 0;
  top: 0;
  width: calc(100% / var(--pz, 2));
  height: calc(100% / var(--pz, 2));
  transform: scale(var(--pz, 2));
  transform-origin: 0 0;
  padding: 13px 13px 12px;
}
body.portrait .duck-grid { grid-template-columns: repeat(3, 1fr); }
body.portrait .upgrade-box { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
body.portrait .title-decor { object-fit: cover; }
body.portrait .title-content,
body.portrait .map-content {
  left: 25%;
  right: auto;
  width: 50%;
  height: 50%;
  transform: scale(2);
  transform-origin: 50% 0;
}
body.portrait .title-content { justify-content: center; padding-top: 0; }
body.portrait .title-logo { width: 92%; max-width: 560px; }
body.portrait .start-diffs { flex-wrap: wrap; align-items: stretch; max-width: 470px; }
body.portrait .start-diff { width: 225px; }
body.portrait .map-grid { grid-template-columns: repeat(2, 246px); }
body.portrait .end-card { min-width: 0; width: 520px; transform: scale(2); }
