.page-wrap {
  max-width: 480px;
  margin: 0 auto;
}

.game-body {
  padding: 24px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.click-zone {
  position: relative;
}

.score {
  font-size: clamp(1.3rem, 5vw, 1.7rem);
  margin: 0;
  color: var(--green);
}

.commit-btn {
  width: min(220px, 65vw);
  height: min(220px, 65vw);
  border-radius: 50%;
  border: 2px solid var(--green-dim);
  background: var(--bg-inset);
  color: var(--green);
  font-family: var(--font);
  font-size: 1.1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  box-shadow: 0 0 18px rgba(57, 255, 20, 0.15);
  transition: transform 0.05s ease, box-shadow 0.15s ease, background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
}

.commit-btn .commit-icon {
  font-size: 1.6rem;
}

.click-tip {
  margin: -6px 0 0;
  font-size: 0.72rem;
  color: var(--green-faint);
  font-style: italic;
}

.commit-btn:hover {
  background: #101c10;
  box-shadow: 0 0 26px rgba(57, 255, 20, 0.3);
}

.commit-btn:active {
  transform: scale(0.96);
}

.commit-btn.typing {
  border-color: var(--cyan);
  box-shadow: 0 0 30px rgba(0, 229, 255, 0.55);
}

.commit-btn.pulse {
  animation: commitPulse 0.18s ease-out;
}

@keyframes commitPulse {
  0% {
    transform: scale(0.92);
    box-shadow: 0 0 40px rgba(57, 255, 20, 0.7);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 18px rgba(57, 255, 20, 0.15);
  }
}

.float-text {
  position: fixed;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
  color: var(--green);
  font-weight: bold;
  font-size: 1.1rem;
  text-shadow: 0 0 6px currentColor;
  pointer-events: none;
  z-index: 200;
  will-change: transform, opacity;
  animation: numberRise 0.8s ease-out forwards;
}

/* the +N number just rises a short distance and fades - no fall */
@keyframes numberRise {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, calc(-50% - 85px));
  }
}

.float-particle {
  position: fixed;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
  font-size: 1.3rem;
  pointer-events: none;
  z-index: 199;
  will-change: transform, opacity;
  /* linear: the easing is baked into the keyframe positions themselves below,
     via real projectile-motion math, so an extra timing curve would fight it */
  animation: fountain 2.1s linear forwards;
}

/* Traces true projectile motion: decelerating rise to a peak at 22% of the
   duration (matches h = v0*t - 0.5*g*t^2), then accelerating fall from that
   peak down to the resting depth (matches h = 0.5*g*t^2) - a real parabola
   on the way up and another on the way down, not a straight-line V shape. */
@keyframes fountain {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  10% {
    opacity: 1;
    transform: translate(calc(-50% + var(--drift, 0px) * 0.2), calc(var(--rise, -110px) * 0.7025)) scale(1.02);
  }
  20% {
    opacity: 1;
    transform: translate(calc(-50% + var(--drift, 0px) * 0.4), calc(var(--rise, -110px) * 0.9917)) scale(1.05);
  }
  22% {
    opacity: 1;
    transform: translate(calc(-50% + var(--drift, 0px) * 0.44), var(--rise, -110px)) scale(1.05);
  }
  30% {
    opacity: 0.95;
    transform: translate(calc(-50% + var(--drift, 0px) * 0.6), calc(var(--rise, -110px) * 0.98947 + 48vh * 0.01053)) scale(1.03);
  }
  40% {
    opacity: 0.82;
    transform: translate(calc(-50% + var(--drift, 0px) * 0.8), calc(var(--rise, -110px) * 0.9468 + 48vh * 0.0532)) scale(1);
  }
  50% {
    opacity: 0.68;
    transform: translate(calc(-50% + var(--drift, 0px)), calc(var(--rise, -110px) * 0.8711 + 48vh * 0.1289)) scale(0.98);
  }
  60% {
    opacity: 0.53;
    transform: translate(calc(-50% + var(--drift, 0px) * 1.2), calc(var(--rise, -110px) * 0.7626 + 48vh * 0.2374)) scale(0.95);
  }
  70% {
    opacity: 0.38;
    transform: translate(calc(-50% + var(--drift, 0px) * 1.4), calc(var(--rise, -110px) * 0.6213 + 48vh * 0.3787)) scale(0.92);
  }
  80% {
    opacity: 0.24;
    transform: translate(calc(-50% + var(--drift, 0px) * 1.6), calc(var(--rise, -110px) * 0.447 + 48vh * 0.553)) scale(0.9);
  }
  90% {
    opacity: 0.1;
    transform: translate(calc(-50% + var(--drift, 0px) * 1.8), calc(var(--rise, -110px) * 0.24 + 48vh * 0.76)) scale(0.87);
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--drift, 0px) * 2), 48vh) scale(0.85);
  }
}

.upgrade-section {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.upgrade-section h3 {
  margin: 0;
  font-size: 0.82rem;
  color: var(--green-faint);
  font-weight: normal;
}

.upgrade-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 220px;
  overflow-y: auto;
  padding-right: 4px;
}

.upgrade-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  text-align: left;
  padding: 8px 10px;
  font-size: 0.8rem;
}

.upgrade-btn .u-info {
  display: flex;
  flex-direction: column;
  flex: 1;
  gap: 1px;
}

.upgrade-btn .u-name {
  color: var(--text);
}

.upgrade-btn .u-gain {
  color: var(--green-faint);
  font-size: 0.7rem;
}

.upgrade-btn .u-owned {
  color: var(--cyan);
  font-size: 0.75rem;
  white-space: nowrap;
}

.upgrade-btn .u-cost {
  color: var(--yellow);
  font-weight: bold;
  white-space: nowrap;
}

.stats {
  margin: 0;
  color: var(--green-faint);
  font-size: 0.9rem;
}

.prestige-bar {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 10px;
  border: 1px solid var(--magenta, #ff4fd8);
  border-radius: 4px;
  background: var(--bg-inset);
  font-size: 0.82rem;
}

.prestige-bar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.prestige-bar span {
  color: #ff4fd8;
}

.prestige-progress {
  width: 100%;
  height: 6px;
  border-radius: 3px;
  background: #2a0022;
  overflow: hidden;
}

.prestige-progress-fill {
  height: 100%;
  width: 0%;
  background: #ff4fd8;
  transition: width 0.2s ease;
}

.prestige-progress-label {
  font-size: 0.7rem;
  color: #b95a9a;
}

.prestige-btn {
  border-color: #ff4fd8;
  color: #ff4fd8;
  font-size: 0.78rem;
  padding: 8px 10px;
  white-space: nowrap;
}

.prestige-btn:hover:not(:disabled) {
  background: #ff4fd8;
  color: #1a0016;
}

.offline-banner {
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--cyan);
  border-radius: 4px;
  background: var(--bg-inset);
  color: var(--cyan);
  font-size: 0.8rem;
}

.offline-banner:not([hidden]) {
  display: flex;
}

.offline-banner button {
  background: transparent;
  border: none;
  color: var(--cyan);
  font-size: 1.1rem;
  cursor: pointer;
  line-height: 1;
}

.buy-mode-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
}

.buy-mode-label {
  color: var(--green-faint);
  font-size: 0.8rem;
}

.buy-mode-btn {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.buy-mode-btn.active {
  background: var(--green);
  color: #04150a;
}

.reset-btn {
  color: var(--red);
  border-color: #5a2323;
}

.reset-btn:hover {
  background: var(--red);
  color: #1a0000;
}

/* ---- side collection panel ---- */

.collection-tab {
  position: fixed;
  top: 50%;
  right: 0;
  transform: translateY(-50%);
  z-index: 60;
  font-family: var(--font);
  background: var(--bg-inset);
  color: var(--green);
  border: 1px solid var(--green-dim);
  border-right: none;
  border-radius: 6px 0 0 6px;
  padding: 12px 8px;
  writing-mode: vertical-rl;
  cursor: pointer;
  font-size: 0.85rem;
  letter-spacing: 0.05em;
}

.collection-tab:hover {
  background: #101c10;
}

.collection-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 55;
}

.collection-backdrop.open {
  opacity: 1;
  pointer-events: auto;
}

.collection-panel {
  position: fixed;
  top: 0;
  right: 0;
  height: 100vh;
  width: min(360px, 88vw);
  background: var(--bg-panel);
  border-left: 1px solid var(--border);
  transform: translateX(100%);
  transition: transform 0.25s ease;
  z-index: 58;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.collection-panel.open {
  transform: translateX(0);
}

.collection-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--green);
  font-size: 1rem;
}

.collection-close {
  background: transparent;
  border: none;
  color: var(--green-faint);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.collection-close:hover {
  color: var(--green);
}

.collection-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.collection-section h3 {
  margin: 0;
  font-size: 0.82rem;
  color: var(--green-faint);
  font-weight: normal;
}

.collection-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.collection-row {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 10px;
  background: var(--bg-inset);
}

.collection-row-header {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  margin-bottom: 6px;
}

.collection-name {
  flex: 1;
  color: var(--text);
}

.collection-count {
  color: var(--cyan);
}

.collection-icons {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 1.7rem;
}

.icon-tile {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 1px solid;
  font-size: 0.95rem;
  line-height: 1;
  flex-shrink: 0;
  animation: tilePop 0.25s ease;
  transition: transform 0.1s ease;
}

.icon-tile:hover {
  transform: scale(1.15);
}

.collection-icon.icon-tile {
  width: 22px;
  height: 22px;
  font-size: 0.82rem;
  border-radius: 5px;
}

@keyframes tilePop {
  from {
    transform: scale(0.3);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.collection-icons span {
  font-size: 1.05rem;
  line-height: 1;
}

.collection-icons:empty::after {
  content: "none yet";
  color: #4a5a4a;
  font-size: 0.72rem;
  font-style: italic;
}

/* ---- prestige tree panel (mirrors the collection panel, but from the left) ---- */

.tree-tab {
  left: 0;
  right: auto;
  border-radius: 0 6px 6px 0;
  border: 1px solid #ff4fd8;
  border-left: none;
  color: #ff4fd8;
}

.tree-tab:hover {
  background: #1a0016;
}

.tree-panel {
  left: 0;
  right: auto;
  border-left: none;
  border-right: 1px solid var(--border);
  transform: translateX(-100%);
}

.tree-panel.open {
  transform: translateX(0);
}

.tree-container {
  position: relative;
  padding-top: 8px;
}

.tree-lines {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.tree-row {
  position: relative;
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 22px;
  z-index: 1;
}

.tree-row.two-col {
  justify-content: space-between;
}

.tree-node {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 8px 9px;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: var(--bg-inset);
  color: var(--text);
  font-family: var(--font);
  text-align: left;
  cursor: pointer;
  font-size: 0.74rem;
}

.tree-node .t-name {
  color: var(--text);
  font-size: 0.78rem;
}

.tree-node .t-desc {
  color: var(--green-faint);
  font-size: 0.68rem;
}

.tree-node .t-cost {
  color: var(--yellow);
  font-weight: bold;
  font-size: 0.72rem;
}

.tree-node.owned {
  border-color: #ff4fd8;
  background: #1a0016;
  cursor: default;
}

.tree-node.owned .t-name {
  color: #ff4fd8;
}

.tree-node.locked {
  opacity: 0.45;
  cursor: not-allowed;
}

.tree-node:disabled {
  cursor: not-allowed;
}
