.clicker-section {
  --clicker-ink: #24354a;
  --clicker-muted: #64716c;
  --clicker-purple: #6258d9;
  --clicker-purple-dark: #4940ba;
  --clicker-purple-soft: #eeecff;
  --clicker-green: #28886d;
  --clicker-pearl-top: #ffffff;
  --clicker-pearl-mid: #fbfbff;
  --clicker-pearl-bottom: #f4f5fb;
  --clicker-indigo-base: #5650a4;
  --clicker-indigo-base-dark: #49438d;
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: var(--page-card-gap) 0;
}

.clicker-panel {
  display: grid;
  gap: clamp(22px, 3vw, 34px);
  min-width: 0;
  max-width: 100%;
  padding: clamp(22px, 3.6vw, 44px);
  overflow: visible;
  background:
    radial-gradient(circle, rgba(55, 65, 72, 0.12) 1.1px, transparent 1.3px) 0 0 / 20px 20px,
    linear-gradient(145deg, #ffffff 0%, #fbfcff 100%);
  /*border: 1px solid rgba(73, 64, 186, 0.1);*/
  border-radius: 24px;
  box-shadow: none;
}

.clicker-panel > * {
  min-width: 0;
  max-width: 100%;
}

.clicker-scoreboard {
  display: grid;
  grid-template-columns: max-content max-content;
  justify-content: center;
  justify-items: center;
  gap: 0;
  width: min(100%, 560px);
  margin: 0 auto;
  padding: clamp(10px, 1.3vw, 18px) 20px 0;
  color: var(--clicker-ink);
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  text-align: center;
}

.clicker-total-wrap {
  position: relative;
  display: grid;
  grid-column: 1 / -1;
  min-width: min(100%, 320px);
  place-items: center;
}

.clicker-total {
  max-width: 100%;
  font-family: var(--font-display);
  font-size: clamp(4rem, 9vw, 7rem);
  font-variant-numeric: tabular-nums;
  font-weight: 950;
  letter-spacing: -0.065em;
  line-height: 0.84;
  overflow-wrap: anywhere;
}

.clicker-total.is-bumped {
  animation: clicker-score-bump 150ms ease-out;
}

.clicker-gain {
  position: absolute;
  left: var(--gain-x, 72%);
  top: var(--gain-y, 18%);
  color: var(--gain-color, var(--clicker-purple));
  font-family: var(--font-display);
  font-size: clamp(1rem, 2vw, 1.35rem);
  font-weight: 900;
  opacity: 0;
  pointer-events: none;
}

.clicker-gain.is-visible {
  animation: clicker-gain 620ms ease-out;
}

.clicker-rate,
.clicker-power {
  margin: 0;
  font-variant-numeric: tabular-nums;
}

.clicker-rate {
  display: block;
  grid-column: 1 / -1;
  min-height: 0;
  margin-top: 18px;
  padding: 0;
  color: var(--clicker-ink);
  background: transparent;
  border: 0;
  border-radius: 0;
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 2.6vw, 1.55rem);
  font-weight: 850;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.clicker-rate span {
  color: var(--effect-color, var(--clicker-purple-dark));
}

.clicker-power {
  align-self: center;
  justify-self: end;
  margin-top: 26px;
  padding: 5px 20px 5px 0;
  color: var(--clicker-muted);
  font-size: 0.8rem;
  font-weight: 850;
  letter-spacing: 0.06em;
  line-height: 1.5;
  text-align: right;
  text-transform: uppercase;
}

.clicker-power span {
  color: var(--clicker-ink);
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 950;
}

.clicker-rank {
  display: flex;
  align-self: center;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 5px 7px;
  min-height: 0;
  margin: 26px 0 0;
  padding: 5px 0 5px 20px;
  color: var(--clicker-muted);
  background: transparent;
  border: 0;
  border-left: 1px solid rgba(82, 98, 94, 0.18);
  border-radius: 0;
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.5;
  text-align: left;
}

.clicker-rank span:first-child {
  color: var(--clicker-purple-dark);
  font-family: var(--font-display);
  font-weight: 950;
}

.clicker-stage {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 18px;
  min-width: 0;
  padding: 12px 0 54px;
}

.press-effects {
  position: absolute;
  z-index: 2;
  overflow: hidden;
  pointer-events: none;
}

.clicker-stage .press-effects {
  inset: -32px 0 -16px;
  border-radius: 24px;
}

.clicker-key {
  position: relative;
  z-index: 3;
  display: grid;
  place-items: center;
  width: min(100%, 980px);
  min-height: clamp(108px, 12vw, 142px);
  padding: 24px;
  color: #474173;
  background:
    radial-gradient(circle at 86% -32%, rgba(139, 124, 246, 0.16), transparent 35%),
    linear-gradient(145deg, var(--clicker-pearl-top) 0%, var(--clicker-pearl-mid) 56%, var(--clicker-pearl-bottom) 100%);
  border: 2px solid rgba(73, 64, 186, 0.52);
  border-radius: 19px;
  box-shadow:
    0 16px 0 var(--clicker-indigo-base),
    inset 0 1px 0 rgba(255, 255, 255, 0.98),
    inset 0 -4px 0 rgba(72, 65, 130, 0.045);
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  transition: transform 80ms ease, box-shadow 80ms ease, filter 120ms ease;
}

.clicker-key::before {
  content: "";
  position: absolute;
  inset: 7px 10px auto;
  height: 34%;
  border-radius: 13px 13px 48% 48%;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.88), rgba(255, 255, 255, 0));
  pointer-events: none;
}

.clicker-key span {
  position: relative;
  font-family: var(--font-display);
  font-size: clamp(1rem, 2vw, 1.4rem);
  font-weight: 950;
  letter-spacing: 0.34em;
}

.clicker-key:hover {
  filter: brightness(1.012) saturate(1.04);
}

.clicker-key.is-pressed {
  transform: translateY(7px);
  box-shadow:
    0 4px 0 var(--clicker-indigo-base-dark),
    inset 0 1px 0 rgba(255, 255, 255, 0.86),
    inset 0 -3px 0 rgba(72, 65, 130, 0.055);
}

.clicker-key:focus-visible {
  outline: none;
  border-color: rgba(73, 64, 186, 0.82);
}

.clicker-key:focus-visible span {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  text-underline-offset: 8px;
}

.clicker-tool-button:focus-visible,
.upgrade-card:focus-visible {
  outline: 4px solid rgba(98, 88, 217, 0.28);
  outline-offset: 5px;
}

.clicker-hint {
  position: relative;
  z-index: 3;
  max-width: 640px;
  margin: 5px 0 0;
  color: var(--clicker-muted);
  font-size: 0.85rem;
  font-weight: 800;
  line-height: 1.5;
  text-align: center;
}

.clicker-corner-controls {
  position: absolute;
  right: 2px;
  bottom: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 13px;
  min-height: 38px;
}

.clicker-tool-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  padding: 0;
  color: #66746f;
  background: transparent;
  border: 0;
  border-radius: 50%;
  cursor: pointer;
  touch-action: manipulation;
  box-shadow: none;
  transition: background-color 180ms ease, color 180ms ease, opacity 180ms ease, transform 180ms ease, box-shadow 180ms ease;
}

.clicker-tool-button svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.35;
}

.clicker-tool-button:hover {
  color: #172a3b;
  background: transparent;
  transform: translateY(-1px) scale(1.03);
  box-shadow: none;
}

.clicker-tool-button.is-on {
  color: #514bc5;
  background: transparent;
  box-shadow: none;
}

.clicker-tool-button.is-off {
  color: #66746f;
  background: transparent;
}

.clicker-tool-button.clicker-reset-icon {
  color: #66746f;
}

.clicker-tool-button.clicker-reset-icon:hover {
  color: #172a3b;
}

.clicker-reset-dialog {
  width: min(calc(100% - 32px), 460px);
  max-width: none;
  padding: 0;
  color: var(--clicker-ink);
  background: transparent;
  border: 0;
  overflow: visible;
}

.clicker-reset-dialog::backdrop {
  background: rgba(25, 31, 45, 0.54);
  backdrop-filter: blur(3px);
}

.clicker-reset-dialog[open] {
  animation: clicker-dialog-enter 190ms ease-out both;
}

.clicker-reset-dialog-card {
  padding: 28px;
  background:
    radial-gradient(circle, rgba(55, 65, 72, 0.08) 1px, transparent 1.2px) 0 0 / 20px 20px,
    #ffffff;
  border: 1px solid rgba(73, 64, 186, 0.14);
  border-radius: 22px;
  box-shadow: 0 24px 70px rgba(27, 34, 49, 0.24);
}

.clicker-reset-dialog-eyebrow {
  margin: 0 0 7px;
  color: #8b4552;
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.clicker-reset-dialog h2 {
  margin: 0;
  color: var(--clicker-ink);
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 4vw, 1.9rem);
  line-height: 1.2;
}

.clicker-reset-dialog-description {
  margin: 13px 0 0;
  color: #55645f;
  font-size: 0.94rem;
  line-height: 1.65;
}

.clicker-reset-dialog-warning {
  margin: 9px 0 0;
  color: #7d3f4a;
  font-size: 0.82rem;
  font-weight: 850;
}

.clicker-reset-dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 24px;
}

.clicker-dialog-button {
  min-height: 44px;
  padding: 10px 17px;
  border: 1px solid transparent;
  border-radius: 12px;
  cursor: pointer;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 900;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease, transform 160ms ease;
}

.clicker-dialog-button:hover {
  transform: translateY(-1px);
}

.clicker-dialog-button:active {
  transform: translateY(0);
}

.clicker-dialog-button:focus-visible {
  outline: 3px solid rgba(98, 88, 217, 0.3);
  outline-offset: 3px;
}

.clicker-dialog-cancel {
  color: #41504c;
  background: #f4f5f2;
  border-color: rgba(65, 80, 76, 0.12);
}

.clicker-dialog-cancel:hover {
  color: var(--clicker-purple-dark);
  background: var(--clicker-purple-soft);
  border-color: rgba(98, 88, 217, 0.18);
}

.clicker-dialog-confirm {
  color: #ffffff;
  background: #914652;
  border-color: #914652;
}

.clicker-dialog-confirm:hover {
  background: #753641;
  border-color: #753641;
}

.clicker-reset {
  color: #8a5d61;
}

.clicker-panel:fullscreen,
.clicker-panel.is-app-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  grid-template-rows: auto auto auto;
  align-content: start;
  width: 100%;
  max-width: none;
  height: 100dvh;
  min-height: 100dvh;
  margin: 0;
  padding: clamp(22px, 3vw, 44px);
  overflow-x: hidden;
  overflow-y: auto;
  border-radius: 0;
}

html[data-page="spacebar"] body.fullscreen-open {
  overflow: hidden;
}

.upgrade-shop {
  display: grid;
  gap: 18px;
  padding-top: clamp(16px, 2vw, 24px);
  border-top: 1px solid rgba(63, 78, 91, 0.11);
}

.upgrade-shop-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.7fr);
  align-items: end;
  gap: 24px;
}

.upgrade-eyebrow {
  margin: 0 0 5px;
  color: var(--clicker-purple-dark);
  font-size: 0.72rem;
  font-weight: 950;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.upgrade-shop h2 {
  margin: 0;
  color: var(--clicker-ink);
  font-family: var(--font-display);
  font-size: clamp(1.65rem, 3vw, 2.45rem);
  line-height: 1.05;
}

.upgrade-shop-actions {
  display: grid;
  justify-items: end;
  gap: 10px;
}

.upgrade-shop-actions > p {
  margin: 0;
  color: var(--clicker-muted);
  font-size: 0.9rem;
  line-height: 1.6;
  text-align: right;
}

.buy-mode {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  background: rgba(238, 236, 255, 0.72);
  border-radius: 999px;
}

.buy-mode button {
  min-width: 48px;
  min-height: 34px;
  padding: 7px 12px;
  color: #66716d;
  background: transparent;
  border: 0;
  border-radius: 999px;
  cursor: pointer;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 900;
  transition: color 160ms ease, background-color 160ms ease, box-shadow 160ms ease;
}

.buy-mode button[aria-pressed="true"] {
  color: var(--clicker-purple-dark);
  background: #ffffff;
  box-shadow: 0 4px 12px rgba(55, 61, 78, 0.08);
}

.buy-mode button:focus-visible {
  outline: 3px solid rgba(98, 88, 217, 0.28);
  outline-offset: 2px;
}

.upgrade-list {
  display: grid;
  gap: 12px;
}

.upgrade-card {
  --upgrade-card-accent: #6258d9;
  --upgrade-card-accent-soft: rgba(98, 88, 217, 0.1);
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px 24px;
  width: 100%;
  min-width: 0;
  padding: 20px 20px 21px 24px;
  color: var(--clicker-ink);
  background:
    radial-gradient(circle at 88% -35%, rgba(139, 124, 246, 0.14), transparent 34%),
    linear-gradient(145deg, var(--clicker-pearl-top) 0%, var(--clicker-pearl-mid) 56%, var(--clicker-pearl-bottom) 100%);
  border: 1px solid rgba(73, 64, 186, 0.2);
  border-radius: 17px;
  overflow: hidden;
  cursor: pointer;
  font: inherit;
  text-align: left;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.96),
    inset 0 -3px 0 rgba(72, 65, 130, 0.045),
    0 3px 0 rgba(65, 61, 107, 0.09),
    0 10px 24px rgba(36, 53, 74, 0.065);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease, opacity 160ms ease, filter 180ms ease;
}

.upgrade-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(var(--upgrade-card-accent), var(--upgrade-card-accent)) 0 0 / 5px 100% no-repeat,
    linear-gradient(112deg, rgba(255, 255, 255, 0.62), transparent 32%);
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.48);
  pointer-events: none;
}

.upgrade-card::after {
  content: "";
  position: absolute;
  inset: -30% auto -30% -34%;
  z-index: 0;
  width: 28%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.88), transparent);
  opacity: 0;
  pointer-events: none;
  transform: translateX(-160%) skewX(-18deg);
}

.upgrade-card > * {
  position: relative;
  z-index: 1;
}

.upgrade-card:hover:not(:disabled) {
  border-color: rgba(98, 88, 217, 0.42);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.96),
    inset 0 -3px 0 rgba(72, 65, 130, 0.04),
    0 4px 0 rgba(65, 61, 107, 0.11),
    0 16px 30px rgba(42, 49, 73, 0.11);
  transform: translateY(-3px);
}

.upgrade-card:active:not(:disabled) {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    inset 0 -2px 0 rgba(72, 65, 130, 0.04),
    0 1px 0 rgba(65, 61, 107, 0.1),
    0 6px 14px rgba(42, 49, 73, 0.08);
  transform: translateY(2px) scale(0.997);
}

.upgrade-card.is-affordable {
  --upgrade-card-accent: #28886d;
  --upgrade-card-accent-soft: rgba(40, 136, 109, 0.11);
  background:
    radial-gradient(circle at 88% -35%, rgba(70, 187, 145, 0.16), transparent 36%),
    linear-gradient(145deg, #fbfffd 0%, #f7fdf9 58%, #edf8f2 100%);
  border-color: rgba(40, 136, 109, 0.36);
}

.upgrade-card:disabled {
  cursor: not-allowed;
  opacity: 0.9;
  filter: saturate(0.68);
}

.upgrade-card:disabled::before {
  opacity: 0.64;
}

.upgrade-card.is-max-empty {
  opacity: 0.72;
}

.upgrade-card.is-max-empty [data-role="gain"],
.upgrade-card.is-max-empty .upgrade-price-label {
  color: #8b555f;
}

.upgrade-card.is-new {
  animation: clicker-upgrade-reveal 300ms ease-out both;
}

.upgrade-card.is-purchased {
  will-change: transform;
  animation: clicker-upgrade-purchased 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

.upgrade-card.is-purchased::after {
  will-change: transform, opacity;
  animation: clicker-upgrade-shine 520ms ease-out;
}

.upgrade-celebration {
  position: fixed;
  inset: 0;
  z-index: 1100;
  overflow: hidden;
  pointer-events: none;
}

.upgrade-confetti-canvas {
  position: fixed;
  inset: 0;
  z-index: 1090;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.upgrade-celebration-ring,
.upgrade-confetti-piece {
  position: absolute;
  left: var(--celebration-x);
  top: var(--celebration-y);
  pointer-events: none;
}

.upgrade-celebration-ring {
  width: 24px;
  height: 24px;
  border: 2px solid rgba(98, 88, 217, 0.5);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: clicker-celebration-ring 520ms ease-out forwards;
}

.upgrade-confetti-piece {
  width: var(--confetti-width);
  height: var(--confetti-height);
  background: var(--confetti-color);
  border-radius: 2px;
  box-shadow: 0 2px 6px rgba(36, 53, 74, 0.12);
  opacity: 0;
  transform: translate(-50%, -50%);
  animation: clicker-confetti-burst 760ms cubic-bezier(0.15, 0.75, 0.28, 1) var(--confetti-delay) forwards;
}

.upgrade-confetti-piece.is-round {
  border-radius: 50%;
}

.upgrade-copy {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.upgrade-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px;
}

.upgrade-name {
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  font-weight: 950;
}

.upgrade-level {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  color: var(--clicker-purple-dark);
  background: var(--upgrade-card-accent-soft);
  border: 1px solid rgba(98, 88, 217, 0.13);
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 950;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
}

.upgrade-card.is-affordable .upgrade-level {
  color: #21745e;
  border-color: rgba(40, 136, 109, 0.16);
}

.upgrade-description {
  margin: 0;
  color: var(--clicker-muted);
  font-size: 0.87rem;
  line-height: 1.55;
}

.upgrade-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  color: #66726d;
  font-size: 0.74rem;
  font-weight: 800;
}

.upgrade-efficiency {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 2px 8px;
  color: var(--clicker-green);
  background: rgba(40, 136, 109, 0.08);
  border: 1px solid rgba(40, 136, 109, 0.1);
  border-radius: 999px;
}

.upgrade-price-wrap {
  display: grid;
  align-content: center;
  justify-items: end;
  gap: 4px;
  min-width: 112px;
  padding: 4px 0 4px 20px;
  background: transparent;
  border: 0;
  border-left: 1px solid rgba(73, 64, 186, 0.12);
  border-radius: 0;
  box-shadow: none;
}

.upgrade-card.is-affordable .upgrade-price-wrap {
  background: transparent;
  border-color: rgba(40, 136, 109, 0.18);
}

.upgrade-price-label {
  color: var(--clicker-muted);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.upgrade-price {
  color: var(--clicker-ink);
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 2.5vw, 1.65rem);
  font-variant-numeric: tabular-nums;
  font-weight: 950;
}

.upgrade-card.is-affordable .upgrade-price {
  color: var(--clicker-green);
}

.press-pop {
  position: absolute;
  left: var(--effect-x, 50%);
  top: var(--effect-y, 50%);
  z-index: 2;
  color: var(--clicker-purple-dark);
  font-family: var(--font-display);
  font-size: clamp(1rem, 2vw, 1.45rem);
  font-weight: 900;
  line-height: 1;
  text-shadow: 0 5px 16px rgba(35, 47, 61, 0.14);
  pointer-events: none;
  transform: translate(-50%, -50%);
  animation: spacebar-press-pop 680ms ease-out forwards;
}

@keyframes clicker-score-bump {
  0% { transform: scale(1); }
  42% { transform: scale(1.035); }
  100% { transform: scale(1); }
}

@keyframes clicker-gain {
  0% { opacity: 0; transform: translate(-50%, calc(-50% + 8px)) scale(0.9) rotate(0deg); }
  18% { opacity: 1; transform: translate(-50%, -50%) scale(1) rotate(var(--gain-rotation, 0deg)); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--gain-drift, 0px)), calc(-50% - 32px)) scale(1.04) rotate(var(--gain-rotation, 0deg)); }
}

@keyframes clicker-upgrade-reveal {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes clicker-upgrade-purchased {
  0% {
    transform: translateY(0) scale(1);
  }
  24% {
    transform: translateY(2px) scale(0.987);
  }
  58% {
    transform: translateY(-2px) scale(1.008);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

@keyframes clicker-upgrade-shine {
  0% {
    opacity: 0;
    transform: translateX(-160%) skewX(-18deg);
  }
  20% {
    opacity: 0.78;
  }
  100% {
    opacity: 0;
    transform: translateX(560%) skewX(-18deg);
  }
}

@keyframes clicker-celebration-ring {
  0% {
    opacity: 0.78;
    transform: translate(-50%, -50%) scale(0.35);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(3.4);
  }
}

@keyframes clicker-confetti-burst {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.45) rotate(0deg);
  }
  12% {
    opacity: 1;
  }
  72% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform:
      translate(calc(-50% + var(--confetti-x)), calc(-50% + var(--confetti-y)))
      scale(0.92)
      rotate(var(--confetti-rotation));
  }
}

@keyframes spacebar-press-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -38%) scale(0.82) rotate(0deg);
  }
  16% {
    opacity: 1;
    transform: translate(-50%, -72%) scale(1) rotate(var(--effect-rotation, 0deg));
  }
  100% {
    opacity: 0;
    transform:
      translate(calc(-50% + var(--effect-drift, 0px)), calc(-50% - var(--effect-rise, 64px)))
      scale(1.08)
      rotate(var(--effect-rotation, 0deg));
  }
}

@keyframes clicker-dialog-enter {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

@media (max-width: 760px) {
  .clicker-panel {
    padding: 22px 16px 26px;
    border-radius: 20px;
  }

  .clicker-total {
    font-size: clamp(3.6rem, 18vw, 6.2rem);
  }

  .clicker-scoreboard {
    width: min(100%, 520px);
    padding: 10px 8px 0;
    border-radius: 0;
  }

  .clicker-power {
    padding-right: 16px;
  }

  .clicker-rank {
    padding-left: 16px;
  }

  .clicker-key {
    min-height: 104px;
    border-width: 2px;
    border-radius: 17px;
    box-shadow:
      0 9px 0 var(--clicker-indigo-base),
      inset 0 1px 0 rgba(255, 255, 255, 0.98),
      inset 0 -3px 0 rgba(72, 65, 130, 0.045);
  }

  .clicker-key.is-pressed {
    transform: translateY(6px);
    box-shadow:
      0 3px 0 var(--clicker-indigo-base-dark),
      inset 0 1px 0 rgba(255, 255, 255, 0.86),
      inset 0 -2px 0 rgba(72, 65, 130, 0.055);
  }

  .clicker-corner-controls {
    position: static;
    justify-self: end;
    margin-top: -4px;
  }

  .clicker-stage {
    padding-bottom: 2px;
  }

  .clicker-tool-button {
    width: 44px;
    height: 44px;
  }

  .upgrade-shop-head {
    grid-template-columns: 1fr;
    gap: 9px;
  }

  .upgrade-shop-actions {
    justify-items: start;
  }

  .upgrade-shop-actions > p {
    text-align: left;
  }

  .upgrade-card {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 16px;
  }

  .upgrade-price-wrap {
    grid-template-columns: auto auto;
    align-items: baseline;
    justify-content: space-between;
    justify-items: start;
    min-width: 0;
    padding-top: 10px;
    padding-right: 0;
    padding-left: 0;
    border-left: 0;
    border-top: 1px solid rgba(72, 84, 89, 0.1);
  }
}

@media (max-width: 620px) {
  .clicker-panel:is(:fullscreen, .is-app-fullscreen) {
    gap: 20px;
    padding: 16px 14px 24px;
    overscroll-behavior: contain;
  }

  .clicker-scoreboard {
    grid-template-columns: 1fr;
    width: 100%;
    padding: 4px 0 0;
  }

  .clicker-total-wrap,
  .clicker-rate,
  .clicker-power,
  .clicker-rank {
    grid-column: 1;
  }

  .clicker-total {
    font-size: clamp(3.6rem, 19vw, 5.6rem);
  }

  .clicker-rate {
    margin-top: 12px;
  }

  .clicker-power {
    width: auto;
    justify-self: center;
    margin-top: 18px;
    padding: 0;
    border-top: 0;
    text-align: center;
  }

  .clicker-rank {
    justify-content: center;
    justify-self: center;
    margin-top: 8px;
    padding: 0;
    border-left: 0;
    text-align: center;
  }

  .clicker-stage {
    gap: 14px;
    padding: 6px 0 12px;
  }

  .upgrade-shop {
    gap: 14px;
    padding-top: 18px;
  }

  .upgrade-shop-head {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 10px;
  }

  .upgrade-shop h2 {
    font-size: clamp(1.5rem, 7vw, 1.85rem);
  }

  .upgrade-shop-actions {
    display: grid;
    justify-items: stretch;
    gap: 12px;
  }

  .upgrade-shop-actions > p {
    font-size: 0.84rem;
    line-height: 1.5;
    text-align: left;
  }

  .buy-mode {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    width: 100%;
    gap: 8px;
    padding: 0;
    background: transparent;
    border-radius: 0;
  }

  .buy-mode button {
    min-width: 0;
    min-height: 44px;
    padding: 8px 10px;
    background: rgba(255, 255, 255, 0.58);
    border: 1px solid rgba(73, 64, 186, 0.12);
    border-radius: 10px;
  }

  .buy-mode button[aria-pressed="true"] {
    border-color: rgba(73, 64, 186, 0.3);
    box-shadow: none;
  }
}

@media (max-width: 460px) {
  .clicker-section {
    width: min(100% - 20px, 1200px);
  }

  .clicker-total {
    font-size: clamp(3.2rem, 19vw, 4.8rem);
  }

  .clicker-key span {
    font-size: 0.92rem;
    letter-spacing: 0.25em;
  }

  .clicker-reset-dialog-card {
    padding: 24px 20px 20px;
    border-radius: 18px;
  }

  .clicker-reset-dialog-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .clicker-dialog-button {
    padding-inline: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .press-pop {
    display: none;
  }

  .clicker-total.is-bumped,
  .clicker-gain.is-visible,
  .upgrade-card.is-new,
  .upgrade-card.is-purchased,
  .upgrade-card.is-purchased::after {
    animation: none;
  }

  .upgrade-celebration {
    display: none;
  }

  .upgrade-confetti-canvas {
    display: none;
  }

  .clicker-key,
  .upgrade-card,
  .clicker-tool-button,
  .clicker-dialog-button {
    transition: none;
  }

  .clicker-reset-dialog[open] {
    animation: none;
  }
}
