:root{
  --bg:#ffffff;
  --text:#111;
  --accent: #e6b97a;
  --shadow: rgba(0,0,0,0.12);
  font-family: 'Noto Sans', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  background: url('bakery.png') center center / cover no-repeat, var(--bg);
  color:var(--text);
  display:flex;
  align-items:center;
  justify-content:center;
}

.Zurück {
    display: inline-block;      /* oder block, wenn er die ganze Breite haben soll */
    padding: 10px 16px;
    background: #f0f0f0;
    color: #333;
    text-decoration: none;
    border-radius: 8px;
    font-weight: 500;
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
    transition: 
    
  transform 0.15s ease,
    box-shadow 0.25s ease;
}

.Zurück:hover {
    background: #e4e4e4;
    transform: translateY(-2px);
    box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}

.Zurück:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.stage{
  width:100%;
  height:100%;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:18px;
  padding:24px;
}

/* Score badge above the cookie */
.score{
  font-weight:800;
  font-size:20px;
  background:#fff8e6;
  padding:12px 18px;
  border-radius:999px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.18), inset 0 -6px 0 rgba(0,0,0,0.04);
  color:var(--text);
  border:4px solid #ffdca8;
}
.level{
  font-weight:800;
  font-size:14px;
  margin-top:6px;
  background: rgba(255,255,255,0.9);
  padding:6px 10px;
  border-radius:999px;
  border:2px solid #ffe6b8;
  color:var(--text);
}

/* cartoon-ish cookie button */
.cookie-btn{
  border: none;
  background: linear-gradient(#fff,#fff0) ;
  padding:8px;
  cursor:pointer;
  border-radius:999px;
  transition:transform 160ms ease, box-shadow 160ms ease;
  display:inline-grid;
  place-items:center;
  will-change:transform;
  box-shadow: 0 18px 40px rgba(0,0,0,0.18);
  transform-origin:center;
}
.cookie-btn:active{ transform: scale(0.96) rotate(-2deg); }

/* cookie image gets a subtle cartoon outline */
.cookie-img{
  width:min(360px, 66vw);
  height:auto;
  display:block;
  filter: drop-shadow(0 14px 30px rgba(0,0,0,0.18)) saturate(1.05);
  user-select:none;
  -webkit-user-drag:none;
  border-radius:50%;
  outline:6px solid rgba(255,220,150,0.12);
}

/* upgrades panel */
.upgrades{
  width:min(720px,92vw);
  display:flex;
  gap:12px;
  justify-content:center;
  margin-top:6px;
}
.upgrade{
  background:#fffaf0;
  border:3px solid #ffe6b8;
  padding:10px;
  border-radius:14px;
  display:flex;
  gap:12px;
  align-items:center;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}
.upgrade .upgrade-btn + .upgrade-btn { margin-top:6px; }
.upgrade-title{ font-weight:800; font-size:14px; }
.upgrade-desc{ font-size:13px; color:#5a4b3a; }
.upgrade-btn{
  background:#ffd48a;
  border:none;
  padding:8px 12px;
  border-radius:10px;
  font-weight:700;
  cursor:pointer;
  box-shadow: 0 6px 0 rgba(0,0,0,0.08);
  transition:transform 120ms ease;
}
.upgrade-btn:active{ transform: translateY(2px); }

.title{
  display:flex;
  align-items:center;
  gap:10px;
  margin-bottom:6px;
  user-select:none;
}
.title h1{
  font-size:1.6rem;
  margin:0;
  font-weight:900;
  letter-spacing:0.6px;
}
.title-cookie{
  width:1em;
  height:1em;
  display:block;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.12)) saturate(1.05);
  transform: translateY(1px);
}

/* background hill & small factory */
.scene-bg{
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: 30vh;
  pointer-events:none;
  display:flex;
  align-items:flex-end;
  justify-content:center;
  z-index: 5;
  opacity: 0.9;
}
.scene-bg .hill{
  width: 360px;
  height: 120px;
  background: linear-gradient(180deg,#eaf2e6,#d7ead3);
  border-radius: 50% 50% 20% 20%;
  box-shadow: 0 20px 40px rgba(0,0,0,0.08) inset;
  position: relative;
  transform: translateY(18px) scale(0.85);
}
.scene-bg .factory{
  position: absolute;
  right: 18%;
  bottom: 36%;
  width: 72px;
  height: 56px;
  transform-origin: bottom right;
  opacity: 0;
  transition: transform 520ms cubic-bezier(.2,.9,.2,1), opacity 420ms;
  filter: drop-shadow(0 14px 22px rgba(0,0,0,0.12));
}
/* simple stylized factory using CSS shapes */
.scene-bg .factory .base{
  position:absolute; left:0; bottom:0;
  width:100%; height:60%;
  background:#e3d9d0;
  border-radius:6px;
  border:3px solid rgba(0,0,0,0.06);
}
.scene-bg .factory .smoke{
  position:absolute; left:8px; top:-24px;
  width:12px; height:12px;
  background:rgba(255,255,255,0.85);
  border-radius:50%;
  filter: blur(8px);
  animation: smokeRise 2.6s linear infinite;
  opacity:0.9;
}
@keyframes smokeRise {
  0%{ transform: translateY(0) scale(0.8); opacity:0.6;}
  50%{ transform: translateY(-12px) scale(1.1); opacity:0.9;}
  100%{ transform: translateY(-28px) scale(1.4); opacity:0;}
}
/* visible state */
.scene-bg .factory.visible{
  opacity:1;
  transform: translateY(0) scale(1);
}
/* small chimney and windows */
.scene-bg .factory .chimney{ position:absolute; right:6px; top:-6px; width:16px; height:34px; background:#c9b7a7; border-radius:4px; border:2px solid rgba(0,0,0,0.06); }
.scene-bg .factory .window{ position:absolute; left:12px; top:8px; width:14px; height:12px; background:#fff; border-radius:2px; box-shadow: inset 0 -6px 0 rgba(0,0,0,0.04); }

/* grandma sitting at table on the hill */
.scene-bg .grandma {
  position: absolute;
  left: 14%;
  bottom: 34%;
  width: 110px;
  height: 110px;
  opacity: 0;
  transform: translateY(8px) scale(0.9);
  transition: transform 420ms cubic-bezier(.2,.9,.2,1), opacity 360ms;
  pointer-events: none;
  z-index: 8;
}
.scene-bg .grandma.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}
/* simplified shapes: table, chair and grandma (cartoonish) */
.scene-bg .grandma .chair {
  position:absolute; left:6px; bottom:10px; width:36px; height:28px; background:#d9a87a; border-radius:6px; box-shadow: inset 0 -6px 0 rgba(0,0,0,0.06);
}
.scene-bg .grandma .table {
  position:absolute; left:42px; bottom:14px; width:54px; height:30px; background:#e7cfa8; border-radius:8px; border:3px solid rgba(0,0,0,0.04);
}
.scene-bg .grandma .cookie-plate { position:absolute; left:54px; bottom:28px; width:18px; height:18px; background:#fff3d9; border-radius:50%; box-shadow:0 6px 10px rgba(0,0,0,0.08) inset; }
.scene-bg .grandma .figure { position:absolute; left:8px; bottom:30px; width:44px; height:56px; border-radius:14px; background:linear-gradient(#f8e7d3,#f0d8c0); border:2px solid rgba(0,0,0,0.04); }
.scene-bg .grandma .head { position:absolute; left:18px; top:-12px; width:22px; height:22px; background:#ffdcb3; border-radius:50%; box-shadow:0 4px 10px rgba(0,0,0,0.08); }
.scene-bg .grandma .apron { position:absolute; left:14px; bottom:6px; width:34px; height:26px; background:#ffd6e6; border-radius:8px; }
/* a tiny steam puff near plate when baking */
.scene-bg .grandma .steam {
  position:absolute; left:62px; bottom:44px; width:8px; height:8px; background:rgba(255,255,255,0.85);
  border-radius:50%; filter: blur(6px); animation: steamRise 2s linear infinite;
}
@keyframes steamRise {
  0%{ transform: translateY(0) scale(0.9); opacity:0.6;}
  50%{ transform: translateY(-10px) scale(1.05); opacity:0.9;}
  100%{ transform: translateY(-22px) scale(1.3); opacity:0;}
}

@keyframes floatFadeFall {
  0% { transform: translateY(0) scale(1); opacity: 1; }
  60% { opacity: 0.85; }
  100% { transform: translateY(48px) scale(0.9); opacity: 0; }
}
.cookie-hit {
  position: absolute;
  left: 50%;
  top: 28%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  display: flex;
  gap:6px;
  align-items:center;
  z-index: 30;
  animation: floatFadeFall 900ms cubic-bezier(.2,.7,.2,1) forwards;
  will-change: transform, opacity;
}
.cookie-hit .plus {
  font-weight:900;
  color:#ffffff;
  text-shadow: 0 6px 18px rgba(0,0,0,0.35);
  font-size:18px;
  background: linear-gradient(#ffefc6,#ffd8a8);
  padding:6px 8px;
  border-radius:999px;
  border:2px solid rgba(255,230,180,0.9);
}
.cookie-hit .mini-cookie {
  width:28px;
  height:28px;
  border-radius:50%;
  object-fit:cover;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,0.18));
}

.wheel-btn{
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 60;
  background:#fffaf0;
  border:3px solid #ffe6b8;
  padding:8px 12px;
  border-radius:10px;
  font-weight:800;
  cursor:pointer;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}
.wheel-modal{
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.45);
  z-index: 70;
  padding: 18px;
}
.wheel-modal[aria-hidden="false"]{ display:flex; }
.wheel-panel{
  background: #fffef8;
  border-radius:14px;
  padding:16px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.28);
  display:flex;
  flex-direction:column;
  gap:12px;
  align-items:center;
}
#wheelCanvas{ border-radius:10px; width:320px; height:320px; max-width:90vw; max-height:70vh; background:linear-gradient(#fff,#fff8); }
.wheel-controls{ display:flex; gap:10px; align-items:center; }
@keyframes pointer-tap { 0%{ transform:translateY(0);} 50%{ transform:translateY(-6px);} 100%{ transform:translateY(0);} }

.rebirth-btn{
  position: relative;
  left: -8px;
  margin-right: -8px;
  background:#fff4f8;
  border:3px solid #ffd6e6;
  color:#9b3858;
  font-weight:800;
  padding:8px 12px;
  border-radius:12px;
  cursor:pointer;
  box-shadow: 0 10px 24px rgba(0,0,0,0.12);
  transition: transform 120ms ease;
}
.rebirth-btn:active{ transform: translateY(2px); }

.settings-btn {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 60;
  background:#fffaf0;
  border:3px solid #ffe6b8;
  padding:8px 12px;
  border-radius:10px;
  font-weight:800;
  cursor:pointer;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.settings-modal{
  position: fixed;
  inset: 0;
  display: none;
  align-items:center;
  justify-content:center;
  background: rgba(0,0,0,0.45);
  z-index: 80;
}

.settings-modal[aria-hidden="false"]{
  display:flex;
}

.settings-panel{
  background:#fffef8;
  padding:16px;
  border-radius:14px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.3);
  min-width:240px;
  display:flex;
  flex-direction:column;
  gap:16px;
  text-align:left;
}

.toggle-row{
  display:flex;
  justify-content:space-between;
  align-items:center;
  font-weight:700;
}
