:root {
  --bg: #e9defa;
  --accent: #ffd84d;
  --cookie: #e7c28f;
  --paper: #fff8e8;
  --text: #2b2340;
}

body.dark {
  --bg: #1c162b;
  --text: #e6e1ff;
  --paper: #2b2340;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  transition: background 0.3s;
}

.topbar {
  padding: 10px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

button {
  background: var(--accent);
  border: none;
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
}

.stage {
  min-height: calc(100vh - 60px);
  display: grid;
  place-items: center;
  padding: 20px;
}

.cookie-wrap {
  position: relative;
  width: min(320px, 90vw);
  height: min(220px, 60vw);
  display: flex;
  justify-content: center;
  align-items: center;
}

.cookie {
  background: var(--cookie);
  width: 50%;
  height: 100%;
  border-radius: 160px 160px 140px 140px;
  box-shadow:
    inset 0 -10px 0 rgba(0,0,0,0.08),
    0 12px 30px rgba(0,0,0,0.25);
  position: relative;
  transition: transform 0.25s;
}

.cookie::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: repeating-radial-gradient(
    circle at 30% 40%,
    rgba(255,255,255,0.08),
    rgba(255,255,255,0.08) 2px,
    transparent 3px,
    transparent 8px
  );
}

.cookie.left {
  border-top-right-radius: 40px;
  border-bottom-right-radius: 40px;
}

.cookie.right {
  border-top-left-radius: 40px;
  border-bottom-left-radius: 40px;
}

.cookie.crack-1 { transform: translateX(-2px) rotate(-1deg); }
.cookie.crack-2 { transform: translateX(-4px) rotate(1deg); }
.cookie.crack-3 { transform: translateX(-6px) rotate(-2deg); }
.cookie.crack-4 { transform: translateX(-8px) rotate(2deg); }

.cookie.right.crack-1 { transform: translateX(2px) rotate(1deg); }
.cookie.right.crack-2 { transform: translateX(4px) rotate(-1deg); }
.cookie.right.crack-3 { transform: translateX(6px) rotate(2deg); }
.cookie.right.crack-4 { transform: translateX(8px) rotate(-2deg); }

.cookie.open.left {
  transform: translateX(-60px) rotate(-18deg);
}

.cookie.open.right {
  transform: translateX(60px) rotate(18deg);
}

.paper {
  position: absolute;
  background: var(--paper);
  border-radius: 8px;
  padding: 16px 18px;
  box-shadow: 0 10px 25px rgba(0,0,0,0.25);
  max-width: min(320px, 90vw);
  margin-top: 20px;
}

.paper.hidden {
  display: none;
}

.fortune-text {
  font-size: clamp(14px, 3.5vw, 16px);
}

.fortune-code {
  background: #111;
  color: #f8f8f2;
  padding: 10px;
  border-radius: 6px;
  font-size: 13px;
  overflow-x: auto;
}

.fortune-image {
  max-width: 100%;
  border-radius: 6px;
}

.fortune-file {
  color: var(--text);
  text-decoration: underline;
}

.cookie-consent {
  position: fixed;
  bottom: 12px;
  left: 12px;
  right: 12px;
  background: var(--paper);
  border-radius: 10px;
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.3);
  z-index: 999;
}

.cookie-consent.hidden {
  display: none;
}

.fortune-type {
  display: inline-block;
  margin-bottom: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: var(--accent);
  color: #1a1400;
}

/* optional subtle category tints */

.type-activity { background: #ffe28a; }
.type-excuse { background: #ffd1d1; }
.type-website { background: #c7f0ff; }
.type-csnippet,
.type-cline { background: #d7d2ff; }
.type-image { background: #d1ffd8; }
.type-file { background: #e6e6e6; }