/* Cookie Clicker — warm bakery / photo cookie look */

:root {
  --dough-light: #f0d9b8;
  --dough-mid: #c9a06c;
  --dough-dark: #8b5a2e;
  --chocolate: #2c1810;
  --cream: #fffaf3;
  --cream-muted: #e8dfd4;
  --shadow-cookie: 0 12px 40px rgba(44, 24, 16, 0.35),
    0 4px 12px rgba(44, 24, 16, 0.2),
    inset 0 -4px 20px rgba(0, 0, 0, 0.12);
}

body {
  background-color: #e5e2dc;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.35) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.35) 1px, transparent 1px);
  background-size: 24px 24px;
  background-position: center;
  color: var(--chocolate);
  font-family: "Segoe UI", Georgia, "Times New Roman", serif;
  margin: 0;
  padding: 20px 16px 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  box-sizing: border-box;
  min-height: 100vh;
}

h1 {
  font-weight: 700;
  letter-spacing: 0.06em;
  font-size: clamp(1.35rem, 4vw, 1.75rem);
  color: var(--dough-dark);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6);
  margin-bottom: 8px;
  text-align: center;
}

.top-buttons {
  display: flex;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

button:not(#cookie) {
  background: linear-gradient(180deg, #5c3d2e 0%, #3d2618 100%);
  color: var(--cream);
  border: 1px solid rgba(0, 0, 0, 0.2);
  padding: 10px 18px;
  font-size: 15px;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  box-shadow: 0 3px 10px rgba(44, 24, 16, 0.25);
}

button:not(#cookie):hover {
  background: linear-gradient(180deg, #6d4a38 0%, #4a3020 100%);
  box-shadow: 0 5px 14px rgba(44, 24, 16, 0.3);
}

button:not(#cookie):active {
  transform: translateY(1px);
}

.game-container {
  display: flex;
  gap: 36px;
  margin-top: 12px;
  align-items: flex-start;
}

.cookie-column {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Clickable cookie — uses photo asset, domed highlight preserved in image */
.cookie-wrap {
  position: relative;
  width: min(72vw, 280px);
  height: min(72vw, 280px);
}

#cookie {
  width: 100%;
  height: 100%;
  padding: 0;
  margin: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: var(--shadow-cookie);
  transition: transform 0.08s ease-out, filter 0.12s;
  display: block;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

#cookie:hover {
  filter: brightness(1.03);
}

#cookie:active {
  transform: scale(0.96);
  filter: brightness(0.97);
}

.cookie-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  pointer-events: none;
}

/* Floating +1 / +N */
.float-plus {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
  font-weight: 800;
  font-size: 1.35rem;
  color: var(--dough-dark);
  text-shadow: 0 1px 0 #fff, 0 2px 6px rgba(255, 255, 255, 0.8);
  opacity: 0;
  transform: translate(-50%, 0);
  z-index: 5;
  transition: opacity 0.2s ease-out, transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}

.float-plus.float-plus--show {
  opacity: 1;
  transform: translate(-50%, -52px);
}

@media (prefers-reduced-motion: reduce) {
  #cookie {
    transition: none;
  }
  .float-plus {
    transition: opacity 0.15s ease-out;
  }
  .float-plus.float-plus--show {
    transform: translate(-50%, -28px);
  }
}

.score-panel {
  text-align: center;
  margin-top: 22px;
  font-size: clamp(1.1rem, 3vw, 1.35rem);
  color: var(--chocolate);
  font-weight: 600;
  line-height: 1.5;
}

.score-panel #score {
  font-variant-numeric: tabular-nums;
}

.score-panel #cps {
  font-size: 0.92em;
  color: #5c4030;
  font-weight: 500;
}

.shop {
  width: min(100%, 300px);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.shop-item {
  background: linear-gradient(180deg, #fffef9 0%, var(--cream-muted) 100%);
  border: 1px solid rgba(139, 90, 46, 0.35);
  border-radius: 12px;
  padding: 12px 14px;
  color: var(--chocolate);
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
  box-shadow: 0 2px 8px rgba(44, 24, 16, 0.12);
  font-size: 16px;
}

.shop-item:hover {
  background: #fff;
  box-shadow: 0 4px 16px rgba(44, 24, 16, 0.18);
}

.shop-item:active {
  transform: scale(0.99);
}

.shop-item span {
  float: right;
  color: #a65d2e;
  font-weight: 700;
}

.shop-item small {
  color: #6b4e3d;
  font-size: 0.85em;
}

@media (max-width: 700px) {
  .game-container {
    flex-direction: column;
    align-items: center;
    gap: 24px;
  }

  .shop {
    width: 92%;
    max-width: 360px;
  }
}
