:root {
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

html, body {
  height: 100%;
}

body {
  background: #2b2b2b;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
}

.phone-frame {
  width: 430px;
  height: 932px;
  border: 3px solid #000;
  border-radius: 55px;
  overflow: hidden;
  background: #000;
}

.screen {
  width: 100%;
  height: 100%;
  background: #efe6d8;
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 48px 20px 0;
  user-select: none;
}

.reset-btn {
  position: absolute;
  top: 24px;
  right: 20px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.reset-btn i {
  font-size: 15px;
  color: #1a1a1a;
}

.top-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.counter {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-mono);
  font-size: 36px;
  font-weight: 700;
  color: #1a1a1a;
  letter-spacing: 0.5px;
  font-variant-numeric: tabular-nums;
}

.counter.tick {
  animation: counterTick 0.16s ease-out;
}

@keyframes counterTick {
  0% { transform: scale(1); }
  45% { transform: scale(1.045); }
  100% { transform: scale(1); }
}

.currency-icon {
  font-size: 0.7em;
  color: #c9a227;
}

.cps-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #a89c86;
  font-variant-numeric: tabular-nums;
}

.circle-zone {
  position: relative;
  flex: 1;
  width: 280px; /* wider than the 170px circle itself — the ring/particles need room around it */
  max-width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 170px;
  flex-shrink: 0;
}

.click-circle {
  width: 170px;
  height: 170px;
  border-radius: 50%;
  background: #1a1a1a;
  border: none;
  cursor: pointer;
  transition: transform 0.08s ease;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25);
  flex-shrink: 0;
  position: relative;
  z-index: 1; /* stays above the ring/particles beneath it */
}

/* One small icon per helper TYPE you've actually recruited (owned > 0),
   evenly spaced and slowly orbiting — like an atom's electron shell, with
   the rift as the nucleus. Rebuilt only when `owned` crosses 0 (see the buy
   handler), not every tick — the arrangement only changes when a new
   helper joins it. */
.rift-particles {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.helper-ring {
  position: absolute;
  inset: 0;
  animation: ringSpin 60s linear infinite;
}

@keyframes ringSpin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.ring-icon {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 26px;
  height: 26px;
  margin: -13px 0 0 -13px;
  border-radius: 50%;
  background: #1a1a1a;
  color: #c9a227;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

.click-circle:active {
  transform: scale(0.94);
}

/* Boosted state — a slow gold breathing glow while a claimed Supercharge is
   active, so the effect stays visible for its whole duration, not just the
   moment it was claimed. */
.click-circle.supercharged {
  animation: superchargedGlow 1.1s ease-in-out infinite;
}

@keyframes superchargedGlow {
  0%, 100% { box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25), 0 0 0 0 rgba(201, 162, 39, 0.55); }
  50% { box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25), 0 0 0 14px rgba(201, 162, 39, 0); }
}

/* Appears occasionally above the circle; a pop-in + steady pulse to draw the
   eye, gone again (with a fade) if left untapped. z-index above the circle
   (1) since it visually sits in front of it. */
.supercharge-btn {
  position: absolute;
  top: 6px;
  left: 50%;
  width: 54px;
  height: 54px;
  margin-left: -27px;
  border-radius: 50%;
  border: none;
  background: #c9a227;
  color: #1a1a1a;
  font-size: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2;
  box-shadow: 0 8px 20px rgba(201, 162, 39, 0.5);
  animation: superchargeBtnPop 0.25s ease, superchargeBtnPulse 1s ease-in-out infinite 0.25s;
}

.supercharge-btn[hidden] {
  display: none;
}

.supercharge-btn.leaving {
  animation: superchargeBtnLeave 0.3s ease forwards;
}

@keyframes superchargeBtnPop {
  from { transform: scale(0.4); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes superchargeBtnPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.08); }
}

@keyframes superchargeBtnLeave {
  from { transform: scale(1); opacity: 1; }
  to { transform: scale(0.4); opacity: 0; }
}

/* A quick compress-then-overshoot "punch" instead of a flat press, plus a
   brief gold rim-light — makes each tap read as a small impact. Layered on
   top of :active, which still handles the instant press feedback. */
.click-circle.punch {
  animation: circlePunch 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes circlePunch {
  0% { transform: scale(1); box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25), 0 0 0 0 rgba(201, 162, 39, 0.5); }
  35% { transform: scale(0.9); box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25), 0 0 0 0 rgba(201, 162, 39, 0.5); }
  70% { transform: scale(1.035); box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25), 0 0 0 10px rgba(201, 162, 39, 0); }
  100% { transform: scale(1); box-shadow: 0 10px 25px rgba(0, 0, 0, 0.25), 0 0 0 0 rgba(201, 162, 39, 0); }
}

.tap-ripple {
  position: absolute;
  width: 12px;
  height: 12px;
  transform: translate(-50%, -50%);
  border: 1.5px solid #c9a227;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
}

.tap-ripple.expand {
  animation: rippleExpand 0.45s ease-out forwards;
}

@keyframes rippleExpand {
  0% { opacity: 0.7; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(9); }
}

.tap-floater {
  position: absolute;
  transform: translate(-50%, -50%);
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 800;
  color: #c9a227;
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  opacity: 0;
  text-shadow: 0 1px 6px rgba(239, 230, 216, 0.9);
}

.tap-floater.rise {
  animation: floatUp 0.6s ease-out forwards;
}

@keyframes floatUp {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
  18% { opacity: 1; transform: translate(-50%, -80%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -180%) scale(1); }
}

.tab-list[hidden] {
  display: none; /* explicit: an author `display:flex` rule of equal specificity to [hidden] could otherwise win the cascade over the UA stylesheet */
}

.helper-list {
  width: 100%;
  max-width: 340px;
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 8px;
}

.helper-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 60px;
  padding: 10px 14px;
  border-radius: 16px;
  border: none;
  background: rgba(0, 0, 0, 0.04);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}

.helper-row.unaffordable {
  opacity: 0.45;
}

/* Not-yet-unlocked helper: same footprint, no content — just hints that
   something will appear here later, without revealing what or when. */
.helper-row-locked {
  background: rgba(0, 0, 0, 0.02);
  cursor: default;
}

.helper-row-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: #1a1a1a;
  color: #efe6d8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.helper-row-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.helper-row-name {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: #1a1a1a;
}

.helper-row-cost {
  display: flex;
  align-items: center;
  gap: 4px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  color: #8a6d1a;
  font-variant-numeric: tabular-nums;
}

.helper-row-cost i {
  font-size: 10px;
  color: #c9a227;
}

/* The owned count — the main thing a glance at this row needs to answer. */
.helper-row-owned {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 800;
  color: #1a1a1a;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.helper-row.milestone-hit {
  animation: milestonePulse 0.5s ease;
}

@keyframes milestonePulse {
  0% { box-shadow: 0 0 0 0 rgba(201, 162, 39, 0.85); }
  55% { box-shadow: 0 0 0 10px rgba(201, 162, 39, 0); }
  100% { box-shadow: 0 0 0 0 rgba(201, 162, 39, 0); }
}

.achievements-list {
  width: 100%;
  max-width: 340px;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.achievements-count {
  flex-shrink: 0;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #a89c86;
  padding-bottom: 10px;
}

.achievements-rows {
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 8px;
}

.achievement-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 56px;
  padding: 10px 14px;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.04);
}

/* Not-yet-earned: same footprint, no content — same mystery convention as
   locked helpers and locked upgrades. With 50 of these, revealing nothing
   about what's still ahead matters even more than elsewhere. */
.achievement-row-locked {
  background: rgba(0, 0, 0, 0.02);
}

.achievement-row-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: #1a1a1a;
  color: #c9a227;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.achievement-row-body {
  flex: 1;
  min-width: 0;
}

.achievement-row-name {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
  color: #1a1a1a;
}

.achievement-row-desc {
  font-size: 11px;
  color: #6b6558;
  margin-top: 2px;
}

.achievement-row.just-earned {
  animation: milestonePulse 0.6s ease;
}

.tab-bar {
  width: 100%;
  flex-shrink: 0;
  display: flex;
  padding: 6px 8px calc(10px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

.tab-btn {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 4px 4px;
  border: none;
  background: none;
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #a89c86;
}

.tab-btn i {
  font-size: 19px;
}

.tab-btn.active {
  color: #1a1a1a;
}

.tab-badge {
  position: absolute;
  top: 5px;
  right: calc(50% - 20px);
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #c9a227;
  border: 1.5px solid #efe6d8;
}

.tab-badge[hidden] {
  display: none;
}

/* Tap a row's icon (not the row itself, which buys) to see this. */
.helper-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
}

.helper-overlay[hidden] {
  display: none;
}

.helper-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(26, 26, 26, 0.55);
}

.helper-overlay-card {
  position: relative;
  width: 260px;
  padding: 30px 24px 26px;
  border-radius: 24px;
  background: #efe6d8;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
  animation: overlayPop 0.2s ease;
}

@keyframes overlayPop {
  from { transform: scale(0.92); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.helper-overlay-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: #1a1a1a;
  color: #efe6d8;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
}

.helper-overlay-name {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #1a1a1a;
}

.helper-overlay-story {
  font-size: 13px;
  line-height: 1.5;
  color: #6b6558;
  font-style: italic;
}

.helper-overlay-output {
  margin-top: 4px;
  padding: 6px 14px;
  border-radius: 10px;
  background: rgba(0, 0, 0, 0.05);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #4f7a4a;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 480px) {
  .phone-frame {
    width: 100%;
    height: 100%;
    border: none;
    border-radius: 0;
  }
}
