/* Наш Кликер — тёмная «пекарная» тема, адаптив под мобильные и десктоп */
* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #1a120b;
  --bg2: #241811;
  --panel: #2e2016;
  --panel2: #3a2a1d;
  --line: #4a3527;
  --text: #f3e9dc;
  --muted: #b39c86;
  --accent: #f5a623;
  --good: #7ec96f;
  --bad: #8a7563;
}

html, body { height: 100%; }
body {
  background: radial-gradient(1200px 800px at 50% -10%, #2b1c10 0%, var(--bg) 60%);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  min-height: 100dvh;
  overflow-x: hidden;
}

/* шапка */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  background: rgba(0,0,0,.25);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
  backdrop-filter: blur(6px);
}
.brand { font-size: 20px; font-weight: 800; letter-spacing: .3px; color: var(--accent); }
.brand-sub { display: block; font-size: 11px; font-weight: 400; color: var(--muted); letter-spacing: 1px; text-transform: uppercase; }
.top-stats { display: flex; gap: 18px; }
.stat { text-align: right; }
.stat b { display: block; font-size: 16px; color: var(--text); font-variant-numeric: tabular-nums; }
.stat span { font-size: 11px; color: var(--muted); }

/* раскладка */
.layout {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(320px, 480px);
  gap: 16px;
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
  align-items: start;
}

/* панель кликера */
.clicker-panel {
  display: flex; flex-direction: column; align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 24px 16px 16px;
  position: sticky; top: 80px;
}
.counters { text-align: center; margin-bottom: 10px; }
.big-count {
  font-size: clamp(34px, 7vw, 52px);
  font-weight: 900; color: var(--text);
  font-variant-numeric: tabular-nums; line-height: 1.1;
  text-shadow: 0 2px 12px rgba(245,166,35,.25);
}
.big-label { color: var(--accent); font-size: 14px; letter-spacing: 1px; text-transform: uppercase; }
.small-count { color: var(--muted); font-size: 12px; margin-top: 4px; }

.cookie {
  width: min(46vw, 240px); height: min(46vw, 240px);
  border-radius: 50%;
  border: none; cursor: pointer;
  background: radial-gradient(circle at 35% 30%, #d59a5b, #9c6230 60%, #7a4a22);
  box-shadow: 0 10px 30px rgba(0,0,0,.5), inset 0 -8px 20px rgba(0,0,0,.35), inset 0 8px 16px rgba(255,255,255,.15);
  margin: 16px 0;
  transition: transform .08s ease;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
  position: relative;
}
.cookie:active { transform: scale(.94); }
.cookie.pop { animation: pop .12s ease; }
@keyframes pop { 0% { transform: scale(.92);} 100% { transform: scale(1);} }
.cookie-face {
  position: absolute; inset: 0;
  border-radius: 50%;
  background:
    radial-gradient(10px 10px at 32% 30%, #4a2c14 45%, transparent 46%),
    radial-gradient(8px 8px at 62% 24%, #4a2c14 45%, transparent 46%),
    radial-gradient(12px 12px at 70% 55%, #4a2c14 45%, transparent 46%),
    radial-gradient(9px 9px at 40% 62%, #4a2c14 45%, transparent 46%),
    radial-gradient(7px 7px at 22% 48%, #4a2c14 45%, transparent 46%),
    radial-gradient(10px 10px at 50% 42%, #4a2c14 45%, transparent 46%);
}

.hint { color: var(--muted); font-size: 12px; text-align: center; line-height: 1.5; }
.save-row { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.save-state { color: var(--bad); font-size: 12px; transition: color .2s; }
.save-state.on { color: var(--good); }
.btn-ghost {
  background: none; border: 1px solid var(--line); color: var(--muted);
  border-radius: 8px; padding: 5px 12px; font-size: 12px; cursor: pointer;
}
.btn-ghost:hover { color: var(--text); border-color: var(--muted); }

/* магазин */
.shop {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
}
.shop-title { font-size: 18px; color: var(--accent); margin-bottom: 12px; }
.shop-hint { font-size: 12px; color: var(--muted); font-weight: 400; }
.shop-list { display: flex; flex-direction: column; gap: 8px; }

.shop-item {
  display: grid; grid-template-columns: 40px 1fr auto; gap: 12px;
  align-items: center;
  background: var(--panel2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--text);
  cursor: pointer; text-align: left;
  transition: border-color .15s, background .15s;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  font: inherit;
}
.shop-item:hover:not(:disabled) { border-color: var(--accent); background: #43311f; }
.shop-item:disabled { opacity: .55; cursor: not-allowed; }
.shop-item.maxed { border-color: var(--good); opacity: .9; }
.si-icon { font-size: 26px; text-align: center; }
.si-name { display: block; font-weight: 700; font-size: 15px; }
.si-desc { display: block; font-size: 12px; color: var(--muted); margin-top: 2px; }
.si-right { text-align: right; }
.si-cost { display: block; font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.si-owned { display: block; font-size: 12px; color: var(--muted); }

/* всплывающие +N */
.floater {
  position: fixed; z-index: 50; pointer-events: none;
  font-weight: 800; color: var(--accent); font-size: 18px;
  text-shadow: 0 1px 4px rgba(0,0,0,.6);
  animation: rise .9s ease-out forwards;
}
.floater.crit { color: var(--good); font-size: 20px; }
@keyframes rise {
  from { opacity: 1; transform: translateY(0); }
  to   { opacity: 0; transform: translateY(-70px); }
}

/* мобильная раскладка: кликер сверху, магазин снизу */
@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; padding: 12px; gap: 12px; }
  .clicker-panel { position: static; padding-top: 16px; }
  .brand { font-size: 17px; }
  .topbar { padding: 8px 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .cookie, .floater { animation: none; transition: none; }
}
