* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  font-family: "Segoe UI", Arial, sans-serif;
  background: #4a7c2f;
  color: #2b2313;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

#app {
  position: relative;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
}

.screen {
  display: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.screen.active {
  display: flex;
}

/* ---------- Shared widgets ---------- */
.btn {
  font-size: 1.05rem;
  font-weight: 700;
  padding: 12px 22px;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}
.btn:active {
  transform: scale(0.96);
}
.btn.primary {
  background: linear-gradient(180deg, #ffd54f, #ffb300);
  color: #3d2b00;
  box-shadow: 0 3px 0 #c98100;
}
.btn.secondary {
  background: #ffffff;
  color: #4a7c2f;
  box-shadow: 0 3px 0 #c7c7c7;
}
.btn.disabled {
  background: #d9d9d9;
  color: #8a8a8a;
  cursor: default;
  box-shadow: none;
}
.btn.danger {
  background: #fff;
  color: #c0392b;
  box-shadow: 0 3px 0 #d9a09a;
}

.button-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
}

.currency-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(0, 0, 0, 0.15);
  color: #fff59d;
  font-weight: 700;
  padding: 6px 14px;
  border-radius: 999px;
  margin: 10px auto;
}

/* ---------- Home screen ---------- */
#screen-home {
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 20%, #a9d977, #4a7c2f 70%);
}

.home-card {
  background: rgba(255, 255, 255, 0.94);
  border-radius: 20px;
  padding: 30px 34px;
  max-width: 420px;
  width: 90%;
  text-align: center;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}
.home-card h1 {
  margin: 0 0 4px;
  font-size: 2rem;
  color: #4a7c2f;
}
.home-card .tagline {
  margin: 0 0 6px;
  color: #6b5a3a;
  font-size: 0.95rem;
}

.field-group {
  text-align: left;
  margin: 18px 0;
}
.field-group label {
  display: block;
  font-weight: 700;
  margin-bottom: 8px;
  color: #4a3b1e;
}
.field-group input[type=range] {
  width: 100%;
}
.field-group .hint {
  font-size: 0.78rem;
  color: #8a7a58;
  margin: 6px 0 0;
}
.field-group .checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  margin-bottom: 0;
  cursor: pointer;
}
.field-group .checkbox-label input {
  width: 18px;
  height: 18px;
}

.mode-toggle {
  display: flex;
  gap: 8px;
}

.mode-btn {
  flex: 1;
  padding: 10px 8px;
  border-radius: 10px;
  border: 2px solid #cfd8c5;
  background: #f4f6ef;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.85rem;
  transition: background 0.15s, border-color 0.15s;
}
.mode-btn.active {
  background: #7cb342;
  border-color: #4a7c2f;
  color: #fff;
}

.controls-hint {
  margin: 18px 0 0;
  font-size: 0.75rem;
  color: #8a7a58;
}

.speed-toggle {
  display: flex;
  gap: 8px;
}

.speed-btn {
  flex: 1;
  padding: 10px 6px;
  border-radius: 10px;
  border: 2px solid #cfd8c5;
  background: #f4f6ef;
  font-weight: 600;
  cursor: pointer;
  font-size: 0.8rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  transition: background 0.15s, border-color 0.15s;
}
.speed-btn .speed-reward {
  font-size: 0.7rem;
  font-weight: 700;
  color: #7a6b4d;
}
.speed-btn.active {
  background: #ffb300;
  border-color: #c98100;
  color: #3d2b00;
}
.speed-btn.active .speed-reward {
  color: #6b4a00;
}

/* ---------- Shop screen ---------- */
#screen-shop {
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 20%, #a9d977, #4a7c2f 70%);
}

.shop-card {
  background: rgba(255, 255, 255, 0.96);
  border-radius: 20px;
  padding: 24px 28px 30px;
  max-width: 520px;
  width: 92%;
  max-height: 88vh;
  overflow-y: auto;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}
.shop-card h2 {
  margin: 0;
  color: #4a7c2f;
}
.shop-card h3 {
  color: #6b5a3a;
  margin: 18px 0 10px;
  font-size: 1rem;
}

.shop-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}

.shop-item {
  background: #f4f6ef;
  border: 2px solid #dfe6d3;
  border-radius: 12px;
  padding: 12px;
  text-align: center;
}
.shop-item.owned, .shop-item.equipped {
  border-color: #7cb342;
  background: #eaf5df;
}
.shop-item.shake {
  animation: shake 0.4s;
}
.shop-item .shop-item-name {
  font-weight: 700;
  color: #3d3220;
  margin-bottom: 4px;
}
.shop-item .shop-item-desc {
  font-size: 0.72rem;
  color: #7a6b4d;
  margin-bottom: 8px;
  min-height: 2.4em;
}
.shop-item .shop-item-uses {
  font-size: 0.72rem;
  font-weight: 700;
  color: #4a7c2f;
  margin-bottom: 6px;
}
.shop-item .shop-item-uses.out {
  color: #c0392b;
}
.shop-item.depleted {
  border-color: #e0a89c;
  background: #fbecea;
}
.shop-item .btn {
  width: 100%;
  padding: 8px 6px;
  font-size: 0.85rem;
}
.shop-item .skin-swatch {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  margin: 0 auto 8px;
  border: 3px solid rgba(0, 0, 0, 0.15);
}
.shop-item .shop-item-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 8px;
  display: block;
}

@keyframes shake {
  0%, 100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-6px);
  }
  75% {
    transform: translateX(6px);
  }
}
/* ---------- 2-Player setup screen ---------- */
#screen-2p-setup {
  align-items: center;
  justify-content: center;
  background: radial-gradient(circle at 50% 20%, #a9d977, #4a7c2f 70%);
}

.twop-card {
  max-width: 640px;
}

.twop-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 14px 0;
}

.twop-col {
  background: #f4f6ef;
  border: 2px solid #dfe6d3;
  border-radius: 12px;
  padding: 12px;
  text-align: left;
}

.twop-label {
  display: block;
  font-weight: 700;
  color: #4a3b1e;
  font-size: 0.8rem;
  margin: 8px 0 6px;
}

.twop-input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 2px solid #cfd8c5;
  font-size: 0.9rem;
  box-sizing: border-box;
}

.twop-skin-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.twop-swatch {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 3px solid rgba(0, 0, 0, 0.15);
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}
.twop-swatch:hover {
  transform: scale(1.08);
}
.twop-swatch.selected {
  border-color: #7cb342;
  box-shadow: 0 0 0 2px #7cb342;
}

.twop-upgrades {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  background: #f4f6ef;
  border: 2px solid #dfe6d3;
  border-radius: 12px;
  padding: 12px;
}

.twop-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  color: #4a3b1e;
  font-size: 0.9rem;
}
.twop-check input {
  width: 18px;
  height: 18px;
}

/* ---------- Game screen ---------- */
#screen-game {
  background: #000;
}

#gameCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

#split-divider {
  display: none;
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 4px;
  margin-left: -2px;
  background: rgba(255, 255, 255, 0.85);
  z-index: 5;
  pointer-events: none;
}

#hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 10px 14px;
  font-weight: 700;
  color: #fff;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.6);
  z-index: 6;
  pointer-events: none;
}

#hud-jumps {
  margin-left: 10px;
  font-size: 0.85em;
  opacity: 0.9;
}

#toast-container {
  position: absolute;
  top: 46px;
  right: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 7;
  pointer-events: none;
  max-width: 60vw;
}

.toast {
  background: rgba(20, 20, 20, 0.75);
  color: #fff;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.25s, transform 0.25s;
}
.toast.show {
  opacity: 1;
  transform: translateX(0);
}

.viewport-banner {
  display: none;
  position: absolute;
  top: 0;
  bottom: 0;
  width: 50%;
  align-items: center;
  justify-content: center;
  background: rgba(120, 0, 0, 0.35);
  color: #fff;
  font-weight: 700;
  font-size: 1.1rem;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.6);
  z-index: 4;
  pointer-events: none;
  text-align: center;
  padding: 0 10px;
}
.viewport-banner.p1 {
  left: 0;
}
.viewport-banner.p2 {
  left: 50%;
}

#touch-joystick {
  display: none;
  position: absolute;
  bottom: 24px;
  left: 24px;
  width: 110px;
  height: 110px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  border: 2px solid rgba(255, 255, 255, 0.5);
  touch-action: none;
  z-index: 8;
}

#touch-joystick-knob {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.85);
  position: absolute;
  top: 50%;
  left: 50%;
  margin: -23px 0 0 -23px;
  pointer-events: none;
}

/* ---------- Power-up buttons ---------- */
.power-cluster {
  position: absolute;
  bottom: 20px;
  right: 16px;
  display: none;
  gap: 12px;
  align-items: flex-end;
  z-index: 8;
}

#powerups-p1 {
  display: flex;
}

.power-btn-wrap {
  position: relative;
  width: 58px;
  height: 58px;
}

.power-btn {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.7);
  background-color: rgba(20, 20, 20, 0.4);
  background-size: 68%;
  background-position: center;
  background-repeat: no-repeat;
  touch-action: none;
  padding: 0;
}
.power-btn:active {
  transform: scale(0.92);
}

.power-ring {
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  pointer-events: none;
}

.ring-circular {
  --pct: 1;
  --ring-color: rgba(255, 255, 255, 0.55);
  background: conic-gradient(var(--ring-color) calc(var(--pct) * 360deg), rgba(0, 0, 0, 0.35) 0deg);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 5px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 5px), #000 calc(100% - 5px));
  transition: background 0.15s linear;
}

.ring-segmented {
  --seg-angle: 120deg;
}

.ring-seg {
  position: absolute;
  inset: 0;
  transform: rotate(calc(var(--i, 0) * var(--seg-angle, 360deg)));
}
.ring-seg::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  width: 5px;
  height: 10px;
  margin-left: -2.5px;
  background: #8bc34a;
  border-radius: 2px;
  box-shadow: 0 0 3px rgba(0, 0, 0, 0.5);
}
.ring-seg.spent::before {
  background: rgba(255, 255, 255, 0.25);
}

.power-btn-wrap .ring-seg:nth-child(1) {
  --i: 0;
}

.power-btn-wrap .ring-seg:nth-child(2) {
  --i: 1;
}

.power-btn-wrap .ring-seg:nth-child(3) {
  --i: 2;
}

.power-key {
  position: absolute;
  bottom: -5px;
  right: -6px;
  min-width: 20px;
  padding: 1px 4px;
  background: #fff;
  color: #3d2b00;
  font-size: 0.62rem;
  font-weight: 800;
  border-radius: 4px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  text-align: center;
  border: 1px solid rgba(0, 0, 0, 0.15);
  z-index: 2;
  pointer-events: none;
}

/* ---------- End screen ---------- */
#screen-end {
  align-items: center;
  justify-content: center;
}

#end-overlay {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  color: #fff;
  padding: 20px;
  animation: endFadeIn 0.7s ease;
}
#end-overlay.lose {
  background: radial-gradient(circle at 50% 40%, #e74c3c, #a5271b 80%);
}
#end-overlay.win {
  background: radial-gradient(circle at 50% 40%, #ffd54f, #c98100 85%);
}
#end-overlay h1 {
  font-size: 3rem;
  margin: 0;
  text-shadow: 2px 2px 6px rgba(0, 0, 0, 0.4);
}
#end-overlay p {
  font-size: 1.1rem;
  max-width: 320px;
  margin: 0 0 14px;
}

@keyframes endFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/*# sourceMappingURL=styles.css.map */
