:root {
  --bg: #1a120b;
  --panel: #2a1c12;
  --panel-2: #3a2818;
  --text: #fff6e8;
  --muted: #c4a882;
  --accent: #e8a54b;
  --accent-2: #f0c27a;
  --good: #7dcea0;
  --bad: #e07474;
  --border: #5a3d24;
  --shadow: rgba(0, 0, 0, 0.45);
  --radius: 16px;
  font-family: "Segoe UI", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(ellipse at top, #3d2414 0%, transparent 55%),
    radial-gradient(ellipse at bottom right, #2a1810 0%, var(--bg) 60%);
  color: var(--text);
}

body {
  overflow-x: hidden;
}

.bg-crumbs {
  pointer-events: none;
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}

.crumb {
  position: absolute;
  font-size: 14px;
  opacity: 0.15;
  animation: float-crumb 12s linear infinite;
}

@keyframes float-crumb {
  from { transform: translateY(100vh) rotate(0deg); }
  to { transform: translateY(-10vh) rotate(360deg); }
}

.top-bar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  background: rgba(26, 18, 11, 0.85);
  backdrop-filter: blur(8px);
}

.top-bar h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.top-actions {
  display: flex;
  gap: 0.5rem;
}

.ghost-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 999px;
  padding: 0.4rem 0.9rem;
  cursor: pointer;
  font: inherit;
  transition: 0.15s ease;
}

.ghost-btn:hover {
  color: var(--text);
  border-color: var(--accent);
}

.ghost-btn.danger:hover {
  color: var(--bad);
  border-color: var(--bad);
}

.layout {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
  max-width: 1100px;
  margin: 0 auto;
  padding: 1.25rem;
}

@media (max-width: 800px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

.panel {
  background: linear-gradient(160deg, var(--panel) 0%, #23160e 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px var(--shadow);
  padding: 1.25rem;
}

.click-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  min-height: 480px;
}

.stats {
  margin-bottom: 1rem;
}

.cookie-count {
  font-size: clamp(2.5rem, 8vw, 4rem);
  font-weight: 800;
  line-height: 1;
  background: linear-gradient(180deg, #fff 0%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 2px 8px rgba(232, 165, 75, 0.35));
}

.cookie-label {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  font-size: 0.75rem;
  margin-top: 0.35rem;
}

.rate-line {
  margin-top: 0.75rem;
  color: var(--accent-2);
  font-size: 0.95rem;
}

.cookie-btn {
  margin-top: 1.5rem;
  width: min(260px, 70vw);
  height: min(260px, 70vw);
  border: none;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #f6d7a0 0%, #d4923a 45%, #a86a1f 100%);
  box-shadow:
    0 0 0 8px rgba(232, 165, 75, 0.15),
    0 18px 40px rgba(0, 0, 0, 0.5),
    inset 0 -12px 24px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  transition: transform 0.08s ease;
  position: relative;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.cookie-btn:hover {
  transform: scale(1.03);
}

.cookie-btn:active,
.cookie-btn.pressed {
  transform: scale(0.94);
}

.cookie-face {
  font-size: clamp(5rem, 20vw, 8rem);
  line-height: 1;
  display: block;
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.25));
  pointer-events: none;
}

.hint {
  margin-top: auto;
  color: var(--muted);
  font-size: 0.9rem;
}

.shop-panel h2 {
  margin: 0 0 1rem;
  font-size: 1.25rem;
}

.shop-tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.tab {
  flex: 1;
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 10px;
  padding: 0.55rem;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
}

.tab.active {
  color: var(--text);
  border-color: var(--accent);
  background: linear-gradient(180deg, #4a3220, #3a2818);
}

.shop-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-height: 520px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.shop-list.hidden {
  display: none;
}

.shop-item {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 0.75rem;
  align-items: center;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 0.75rem;
  text-align: left;
  color: inherit;
  font: inherit;
  cursor: pointer;
  transition: 0.15s ease;
  width: 100%;
}

.shop-item:hover:not(:disabled) {
  border-color: var(--accent);
  background: rgba(232, 165, 75, 0.08);
}

.shop-item:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.shop-item.owned {
  border-color: rgba(125, 206, 160, 0.45);
}

.shop-icon {
  font-size: 1.75rem;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  background: var(--panel-2);
  border-radius: 10px;
}

.shop-info h3 {
  margin: 0;
  font-size: 1rem;
}

.shop-info p {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.3;
}

.shop-meta {
  text-align: right;
  white-space: nowrap;
}

.shop-meta .price {
  color: var(--accent-2);
  font-weight: 700;
}

.shop-meta .owned-count {
  display: block;
  margin-top: 0.25rem;
  color: var(--good);
  font-size: 0.8rem;
}

.float-num {
  position: fixed;
  pointer-events: none;
  z-index: 50;
  font-weight: 800;
  color: var(--accent-2);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
  animation: float-up 0.8s ease-out forwards;
  font-size: 1.25rem;
}

@keyframes float-up {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-60px) scale(1.2); }
}

.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 0.75rem 1.25rem;
  border-radius: 999px;
  z-index: 100;
  box-shadow: 0 8px 24px var(--shadow);
}

.toast.hidden {
  display: none;
}

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 8px;
}
