/* Chop Shop — lumber mini-game overlay (All Aboard) */

.chop {
  position: fixed;
  inset: 0;
  z-index: 120;
  font-family: "Fredoka", "Nunito", system-ui, sans-serif;
  color: #263238;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
  overscroll-behavior: none;
}
.chop[hidden] {
  display: none;
}
.chop__canvas {
  position: absolute;
  inset: 0;
  display: block;
}

/* ── top bar ── */
.chop__top {
  position: absolute;
  top: max(10px, env(safe-area-inset-top));
  left: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.chop__title {
  padding: 6px 14px;
  background: #fff;
  border: 4px solid #263238;
  border-radius: 999px;
  box-shadow: 0 4px 0 rgba(38, 50, 56, 0.3);
  font-weight: 700;
  font-size: 1.05rem;
  white-space: nowrap;
}
.chop__cargo {
  padding: 6px 14px;
  background: #fff3c4;
  border: 4px solid #263238;
  border-radius: 999px;
  box-shadow: 0 4px 0 rgba(38, 50, 56, 0.3);
  font-weight: 600;
  font-size: 1.05rem;
  white-space: nowrap;
}
.chop__cargo b {
  font-size: 1.2rem;
}
.chop__done {
  margin-left: auto;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 4px solid #fff;
  background: #ff9800;
  color: #fff;
  font: inherit;
  font-weight: 800;
  font-size: 1.3rem;
  box-shadow: 0 4px 0 rgba(38, 50, 56, 0.3);
  cursor: pointer;
}

/* ── wooden sign with the sum ── */
.chop__sign {
  position: absolute;
  top: calc(max(10px, env(safe-area-inset-top)) + 64px);
  left: 50%;
  transform: translateX(-50%);
  min-width: 11rem;
  padding: 0.35rem 1.4rem 0.45rem;
  text-align: center;
  background: linear-gradient(180deg, #d7a86e, #b98551);
  border: 5px solid #263238;
  border-radius: 18px;
  box-shadow:
    inset 0 -6px 0 rgba(93, 64, 55, 0.35),
    0 6px 0 rgba(38, 50, 56, 0.3);
  color: #fff;
  font-weight: 800;
  font-size: clamp(2.4rem, 11vw, 3.4rem);
  line-height: 1.15;
  text-shadow:
    -3px -3px 0 #263238, 3px -3px 0 #263238, -3px 3px 0 #263238, 3px 3px 0 #263238,
    0 4px 0 #263238;
  white-space: nowrap;
}
.chop__sign::before,
.chop__sign::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 10px;
  height: 10px;
  margin-top: -5px;
  border-radius: 50%;
  background: #5d4037;
  border: 2px solid #263238;
}
.chop__sign::before {
  left: 8px;
}
.chop__sign::after {
  right: 8px;
}
.chop__sign.is-golden {
  background: linear-gradient(180deg, #ffe082, #ffb300);
  box-shadow:
    inset 0 -6px 0 rgba(255, 143, 0, 0.45),
    0 6px 0 rgba(38, 50, 56, 0.3),
    0 0 0 6px rgba(255, 235, 59, 0.6);
}
.chop__sign.is-pop {
  animation: chop-sign-pop 0.4s cubic-bezier(0.2, 1.6, 0.4, 1);
}
@keyframes chop-sign-pop {
  0% { transform: translateX(-50%) scale(0.6) rotate(-4deg); }
  100% { transform: translateX(-50%) scale(1) rotate(0); }
}

/* ── answer logs ── */
.chop__answers {
  position: absolute;
  left: 0;
  right: 0;
  bottom: max(14px, env(safe-area-inset-bottom));
  display: flex;
  justify-content: center;
  gap: clamp(10px, 4vw, 26px);
  padding: 0 12px;
}
.chop__ans {
  position: relative;
  width: clamp(88px, 27vw, 128px);
  height: clamp(88px, 27vw, 128px);
  border-radius: 50%;
  border: 5px solid #263238;
  background:
    radial-gradient(circle at 50% 50%, transparent 0 30%, rgba(141, 110, 99, 0.35) 31% 33%, transparent 34% 48%, rgba(141, 110, 99, 0.35) 49% 51%, transparent 52%),
    radial-gradient(circle at 50% 50%, #ffe0b2 0 62%, #ffcc80 63%);
  box-shadow:
    inset 0 0 0 9px #8d6e63,
    0 7px 0 #263238;
  font: inherit;
  font-weight: 800;
  font-size: clamp(2.2rem, 10vw, 3rem);
  color: #263238;
  cursor: pointer;
  transition: transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}
.chop__ans span {
  position: relative;
  text-shadow: 0 2px 0 #fff;
}
.chop__ans:active:not(:disabled) {
  transform: translateY(5px);
  box-shadow:
    inset 0 0 0 9px #8d6e63,
    0 2px 0 #263238;
}
.chop__ans.is-golden {
  box-shadow:
    inset 0 0 0 9px #ffb300,
    0 7px 0 #263238,
    0 0 0 5px rgba(255, 235, 59, 0.7);
}
.chop__ans.is-right {
  background: radial-gradient(circle, #c8e6c9 0 62%, #81c784 63%);
  animation: chop-right 0.35s ease-out;
}
.chop__ans.is-cracked {
  filter: grayscale(0.9) brightness(0.85);
  animation: chop-shake 0.35s ease-out;
  cursor: default;
}
.chop__ans.is-cracked::after {
  content: "";
  position: absolute;
  inset: 18% 30%;
  background:
    linear-gradient(115deg, transparent 45%, #263238 46% 50%, transparent 51%),
    linear-gradient(70deg, transparent 47%, #263238 48% 52%, transparent 53%);
  pointer-events: none;
}
.chop__ans:disabled:not(.is-right):not(.is-cracked) {
  opacity: 0.75;
}
@keyframes chop-right {
  50% { transform: scale(1.12); }
}
@keyframes chop-shake {
  25% { transform: translateX(-8px) rotate(-6deg); }
  75% { transform: translateX(8px) rotate(6deg); }
}

/* ── end card ── */
.chop__end {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(38, 50, 56, 0.35);
}
.chop__end[hidden] {
  display: none;
}
.chop__end-card {
  width: min(380px, 100%);
  box-sizing: border-box;
  padding: 20px 18px 18px;
  text-align: center;
  background: #fff;
  border: 5px solid #263238;
  border-radius: 28px;
  box-shadow: 0 8px 0 rgba(38, 50, 56, 0.4);
  animation: chop-pop 0.4s cubic-bezier(0.2, 1.6, 0.4, 1);
}
@keyframes chop-pop {
  0% { transform: scale(0.6); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.chop__end-icon {
  font-size: 3rem;
  line-height: 1;
}
.chop__end-title {
  margin: 6px 0 4px;
  font-size: 1.9rem;
  font-weight: 800;
}
.chop__end-sub {
  margin: 0 0 14px;
  font-weight: 600;
  opacity: 0.85;
}
.chop__end-go {
  font: inherit;
  font-weight: 800;
  font-size: 1.15rem;
  padding: 12px 22px;
  color: #fff;
  text-shadow: 0 2px 0 #263238;
  background: #43a047;
  border: 4px solid #263238;
  border-radius: 999px;
  box-shadow: 0 5px 0 #263238;
  cursor: pointer;
}

/* ── phone on its side ── */
@media (max-height: 500px) and (orientation: landscape) {
  .chop__sign {
    top: calc(max(8px, env(safe-area-inset-top)) + 4px);
    font-size: 2rem;
    padding: 0.15rem 1.2rem 0.25rem;
  }
  .chop__top {
    top: 8px;
  }
  .chop__cargo {
    display: none;
  }
  .chop__answers {
    left: auto;
    right: 12px;
    bottom: 10px;
    width: auto;
    gap: 10px;
  }
  .chop__ans {
    width: 76px;
    height: 76px;
    font-size: 2rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chop__sign.is-pop,
  .chop__ans.is-right,
  .chop__ans.is-cracked,
  .chop__end-card {
    animation: none;
  }
}
