:root {
  --bg: #fff6fb;
  --panel: #ffffff;
  --ink: #222;
  --sub: #666;
  --accent: #ff69b4;
  --accent-2: #b84dff;
  --good: #38b000;
  --warn: #ff9f1c;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
  --radius: 20px;
}
* {
  box-sizing: border-box;
}
html,
body {
  height: 100%;
}
body {
  margin: 0;
  font-family:
    "Sour Gummy",
    ui-sans-serif,
    system-ui,
    -apple-system,
    Segoe UI,
    Roboto,
    "Helvetica Neue",
    Arial,
    "Noto Sans",
    "Apple Color Emoji",
    "Segoe UI Emoji";
  color: var(--ink);
  background:
    radial-gradient(1200px 800px at 15% 10%, #ffe3f0 0%, transparent 50%),
    radial-gradient(800px 600px at 85% 15%, #efe0ff 0%, transparent 50%),
    radial-gradient(900px 700px at 70% 80%, #ffe6ea 0%, transparent 50%),
    var(--bg);
  text-transform: lowercase;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  gap: 20px;
  grid-template-rows: auto 1fr;
  margin-top: 20px;
}
@media (max-width: 940px) {
  .container {
    grid-template-rows: auto auto auto;
    padding: 16px;
    margin-top: 16px;
  }
}

@media (max-width: 768px) {
  .container {
    padding: 12px;
    margin-top: 12px;
  }

  header.app {
    padding: 14px 16px;
  }

  .app h1 {
    font-size: clamp(18px, 4vw, 24px);
  }
}

header.app {
  grid-row: 1;
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 5;
}
.app h1 {
  margin: 0;
  font-weight: 800;
  letter-spacing: 0.3px;
  font-size: clamp(20px, 3.4vw, 28px);
}
.badge {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  background: #fff0f6;
  color: var(--accent);
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 13px;
}
.controls {
  display: flex;
  gap: 10px;
  align-items: center;
}
.btn {
  border: 0;
  background: var(--ink);
  color: #fff;
  padding: 10px 14px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.btn.secondary {
  background: #f2f2f2;
  color: var(--ink);
}
.btn.danger {
  background: #ff5d5d;
}
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.panel {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* New vertical stack layout */
.main-section {
  grid-row: 2;
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  margin: 0 auto;
}

/* Shop and achievements side by side */
.shop,
.achievements {
  flex: 1;
}

.shop {
  margin-right: 10px;
}

.achievements {
  margin-left: 10px;
}

/* Container for shop and achievements to be side by side */
.shop-achievements-container {
  display: flex;
  gap: 20px;
  width: 100%;
}

@media (max-width: 768px) {
  .shop-achievements-container {
    flex-direction: column;
    gap: 16px;
  }

  .shop,
  .achievements {
    margin: 0;
  }
}

@media (max-width: 480px) {
  .shop-achievements-container {
    gap: 12px;
  }
}

/* Make scroll areas keep space for the scrollbar */
.scrollable {
  max-height: 280px; /* or whatever height you like */
  overflow: auto;
  padding-right: 12px; /* space for overlay scrollbars */
  scrollbar-gutter: stable; /* reserves gutter (Chrome/Firefox) */
}

.scrollable::-webkit-scrollbar {
  width: 6px;
}

.scrollable::-webkit-scrollbar-thumb {
  background: #ff9ccd;
  border-radius: 6px;
}

.scrollable::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 6px;
}

/* --- PLAY AREA: make it tall and center the heart --- */
.play {
  padding: 22px;
  display: grid;
  gap: 16px;
  justify-items: center;         /* center horizontally */
  align-content: start;
  min-height: clamp(420px, 60vh, 720px);
}
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.stat {
  background: #fafafa;
  border-radius: 10px;
  padding: 8px;
  text-align: center;
  font-weight: 800;
}
.stat .label {
  display: block;
  font-size: 10px;
  letter-spacing: 0.3px;
  color: var(--sub);
  font-weight: 600;
}
.stat .value {
  font-size: clamp(14px, 4vw, 20px);
}

/* Big clickable stage */
.big-heart {
  width: min(78vw, 680px);
  aspect-ratio: 1 / 1;
  margin: 0 auto;
  display: grid;
  place-items: center;
  border-radius: 28px;
  background:
    radial-gradient(120% 120% at 50% 50%, #ffe0ef 0%, #fff 60%),
    linear-gradient(145deg, #fff0f7, #fff);
  border: 2px dashed #ffd2e8;
  position: relative;
  overflow: hidden;
}
/* The heart itself */
.clicker {
  width: min(48vw, 380px);
  aspect-ratio: 1 / 1;
  border-radius: 999px;
  border: 0;
  cursor: pointer;
  font-size: 0;                   /* we'll use a bg heart */
  background:
    radial-gradient(circle at 40% 35%, #ff9ccd 0%, #ff5fb3 60%, #ff2e93 100%);
  box-shadow:
    0 22px 60px rgba(255, 99, 164, .40),
    inset 0 10px 26px rgba(255,255,255,.55);
  animation: floatY 4s ease-in-out infinite, glow 3.2s ease-in-out infinite;
  position: relative;
}

/* put the emoji heart centered on top */
.clicker::before {
  content: "❤️";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: min(18vw, 180px);
  filter: drop-shadow(0 10px 18px rgba(255, 0, 100, .25));
}

.clicker:active { transform: scale(.985); }
.per-click-float {
  position: absolute;
  font-weight: 800;
  color: var(--accent);
  pointer-events: none;
}

/* Shop & Achievements sections */

.shop {
  padding: 18px;
}
.shop h2,
.achievements h2 {
  margin: 0 0 12px 0;
}
.shop .row {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  background: #fafafa;
  padding: 12px;
  border-radius: 12px;
}
.shop .meta {
  display: grid;
  gap: 6px;
}
.shop .title {
  font-weight: 800;
}
.shop .desc {
  color: var(--sub);
  font-size: 13px;
}
.shop .cost {
  font-weight: 800;
}
.shop .qty {
  color: var(--sub);
  font-size: 12px;
}
.shop .buy {
  background: var(--accent);
}
.shop .buy.can {
  filter: none;
}
.shop .buy.cant {
  filter: grayscale(1) brightness(0.9);
  cursor: not-allowed;
}

/* Achievements grid: fill rows with flexible columns and align to top */
.achievements {
  padding: 18px;
  min-width: 0; /* allow flex child to shrink properly */
}

@media (max-width: 768px) {
  .achievements {
    padding: 14px;
  }
}

@media (max-width: 480px) {
  .achievements {
    padding: 12px;
  }
}

.achv-grid {
  display: grid;
  grid-template-columns: repeat(
    auto-fit,
    minmax(180px, 1fr)
  ); /* responsive cols */
  gap: 14px;
  justify-items: stretch; /* cards take full column width */
  align-content: start; /* content sticks to top when scrollable */
}

@media (max-width: 768px) {
  .achv-grid {
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 12px;
  }
}
@media (max-width: 480px) {
  .achv-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
}
@media (max-width: 360px) {
  .achv-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}
/* Let each achievement card fill its grid column (no clipping near scrollbar) */
.achv {
  background: #fafafa;
  border-radius: 12px;
  padding: 12px;
  display: grid;
  gap: 6px;
  text-align: center;
  position: relative;
  width: 100%;
  max-width: none; /* remove the old 160px cap */
  min-height: 110px;
}
.achv .icon {
  font-size: 24px;
}
.achv .name {
  font-weight: 800;
  font-size: 12px;
  line-height: 1.2;
}
.achv .rules {
  color: var(--sub);
  font-size: 10px;
  line-height: 1.2;
}
.achv.locked {
  opacity: 0.55;
  filter: grayscale(1);
}
.achv.unlocked {
  outline: 2px solid #ffd0ea;
  box-shadow: 0 8px 16px rgba(255, 0, 120, 0.08);
}

/* Toasts */
.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: grid;
  gap: 10px;
  z-index: 100;
}
.toast {
  background: #141414;
  color: #fff;
  padding: 12px 14px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  display: flex;
  gap: 10px;
  align-items: center;
  animation: slideIn 0.25s ease both;
}
.toast .ticon {
  font-size: 20px;
}
@keyframes slideIn {
  from {
    transform: translateY(20px);
    opacity: 0;
  }
}

/* click ring ripple */
.ring {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 30%;
  aspect-ratio: 1 / 1;
  border-radius: 999px;
  border: 3px solid rgba(255, 105, 180, 0.55);
  transform: translate(-50%, -50%) scale(0.7);
  animation: ringPop 0.45s ease-out forwards;
}

/* floating +numbers from clicks/autos */
.particle {
  position: absolute;
  font-weight: 800;
  color: #ff3f98;
  pointer-events: none;
  animation: floatUp 1.1s ease forwards;
}

/* a tiny badge for combos */
.combo-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  background: #fff0f7;
  color: #ff2e93;
  font-weight: 800;
  border-radius: 999px;
  padding: 6px 10px;
  box-shadow: 0 6px 16px rgba(255, 0, 120, 0.12);
  display: none;
}

@keyframes floatY {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes glow {
  0%,
  100% {
    box-shadow: 0 22px 60px rgba(255, 99, 164, 0.4),
      inset 0 10px 26px rgba(255, 255, 255, 0.55);
  }
  50% {
    box-shadow: 0 28px 72px rgba(255, 99, 164, 0.55),
      inset 0 16px 30px rgba(255, 255, 255, 0.7);
  }
}

@keyframes ringPop {
  to {
    transform: translate(-50%, -50%) scale(1.6);
    opacity: 0;
  }
}

@keyframes floatUp {
  0% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  100% {
    transform: translateY(-50px) scale(0.8);
    opacity: 0;
  }
}

/* Footer tips */
.tips {
  grid-column: 1/-1;
  text-align: center;
  color: var(--sub);
  font-size: 12px;
  padding-bottom: 16px;
}

/* Reset Modal Styles */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 1000;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.modal.active {
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 1;
}

.modal-content {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.2);
  max-width: 400px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
  animation: modalPop 0.3s ease;
}

@keyframes modalPop {
  0% {
    transform: scale(0.9);
    opacity: 0;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.modal-header {
  padding: 20px 20px 0 20px;
  text-align: center;
}

.modal-header h2 {
  margin: 0;
  color: var(--ink);
  font-size: 1.5em;
  font-weight: 800;
}

.modal-body {
  padding: 20px;
  text-align: center;
}

.modal-body p {
  margin: 0 0 16px 0;
  color: var(--ink);
  line-height: 1.5;
}

.reset-warning {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: #fff3cd;
  border: 1px solid #ffeaa7;
  border-radius: 12px;
  padding: 12px;
  color: #856404;
  font-weight: 600;
}

.warning-icon {
  font-size: 1.2em;
}

.modal-footer {
  padding: 0 20px 20px 20px;
  display: flex;
  gap: 12px;
  justify-content: center;
}

.modal-footer .btn {
  flex: 1;
  max-width: 140px;
}

.btn-danger {
  background: #ff5d5d;
  color: white;
}

.btn-danger:hover {
  background: #ff4444;
  transform: translateY(-1px);
}

.btn-secondary {
  background: #f2f2f2;
  color: var(--ink);
}

.btn-secondary:hover {
  background: #e8e8e8;
  transform: translateY(-1px);
}

@media (max-width: 480px) {
  .modal-content {
    width: 95%;
    margin: 20px;
  }

  .modal-footer {
    flex-direction: column;
  }

  .modal-footer .btn {
    max-width: none;
  }
}
