:root {
  --ink: #2a1810;
  --ink-soft: #5c3a28;
  --cream: #fff6e8;
  --foam: #fffaf3;
  --gold: #e4a31a;
  --gold-deep: #b87410;
  --berry: #d84b3c;
  --mint: #2f9d68;
  --wood: #4a2a18;
  --panel: rgba(255, 250, 243, 0.94);
  --panel-strong: #fffaf3;
  --line: rgba(42, 24, 16, 0.12);
  --shadow: 0 20px 50px rgba(18, 8, 4, 0.38);
  --radius: 22px;
  --header-h: 74px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: "Nunito", "Segoe UI", sans-serif;
  background:
    linear-gradient(180deg, rgba(28, 14, 8, 0.62), rgba(42, 22, 12, 0.78)),
    url("../img/bakery-hero.png") center / cover fixed no-repeat,
    #2a1810;
  line-height: 1.55;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: #8a4b12;
}

a:hover {
  color: var(--gold-deep);
}

.skip-link {
  position: absolute;
  left: -999px;
  top: 8px;
  background: var(--gold);
  color: var(--ink);
  padding: 8px 14px;
  border-radius: 8px;
  z-index: 100;
}

.skip-link:focus {
  left: 8px;
}

.site-header,
.site-footer,
.notice-bar,
.legal,
.page,
.game-shell,
.seo,
.prose,
.consent {
  width: min(1240px, calc(100% - 24px));
  margin-left: auto;
  margin-right: auto;
}

.site-header {
  position: sticky;
  top: 10px;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: var(--header-h);
  padding: 10px 16px;
  background: rgba(255, 250, 243, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 20px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-family: "Fredoka", "Nunito", sans-serif;
  font-weight: 700;
  font-size: 1.15rem;
}

.brand img {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  object-fit: cover;
  box-shadow: 0 6px 16px rgba(80, 40, 10, 0.25);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  align-items: center;
}

.nav a {
  text-decoration: none;
  color: var(--ink-soft);
  font-weight: 700;
  padding: 8px 10px;
  border-radius: 10px;
}

.nav a:hover,
.nav a[aria-current="page"] {
  background: #ffe7c2;
  color: var(--ink);
}

.nav-toggle {
  display: none;
}

.notice-bar {
  margin-top: 12px;
  padding: 10px 16px;
  background: #fff1d6;
  border: 1px solid #efd09a;
  border-radius: 14px;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.hero-play {
  width: min(1240px, calc(100% - 24px));
  margin: 18px auto 0;
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
  align-items: center;
}

.hero-copy,
.panel,
.seo-card,
.legal,
.page {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 28px 30px;
}

.kicker {
  margin: 0 0 8px;
  color: var(--gold-deep);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  font-size: 0.78rem;
}

h1,
h2,
h3,
.cookie-count {
  font-family: "Fredoka", "Nunito", sans-serif;
  line-height: 1.15;
}

h1 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 4vw, 3.3rem);
}

.lede {
  margin: 0 0 18px;
  font-size: 1.08rem;
  color: var(--ink-soft);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  padding: 12px 18px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  text-decoration: none;
}

.btn-gold {
  background: linear-gradient(#f3c14a, var(--gold));
  color: var(--ink);
  box-shadow: 0 8px 0 #9a5d0c;
}

.btn-gold:hover {
  filter: brightness(1.05);
}

.btn-gold:active {
  transform: translateY(2px);
  box-shadow: 0 6px 0 #9a5d0c;
}

.btn-ghost {
  background: #fff;
  color: var(--ink);
  border: 2px solid #efd09a;
}

.hero-art {
  overflow: hidden;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-height: 240px;
}

.hero-art img {
  display: block;
  width: 100%;
  height: 280px;
  object-fit: cover;
}

.game-shell {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr) 340px;
  gap: 14px;
  align-items: start;
}

.panel {
  padding: 16px;
}

.panel h2 {
  margin: 0 0 12px;
  font-size: 1.2rem;
}

.bakery {
  text-align: center;
  position: relative;
  overflow: hidden;
  min-height: 540px;
}

.ticker {
  margin: 0 auto 10px;
  max-width: 520px;
  min-height: 42px;
  padding: 8px 12px;
  background: #2a1810;
  color: #ffe7c2;
  border-radius: 12px;
  font-size: 0.92rem;
}

.cookie-count {
  margin: 8px 0 0;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
}

.cookie-cps {
  margin: 4px 0 12px;
  color: var(--ink-soft);
  font-weight: 700;
}

.cookie-btn {
  width: min(320px, 72vw);
  height: min(320px, 72vw);
  border: 0;
  padding: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff3, transparent 45%), transparent;
  cursor: pointer;
  position: relative;
  touch-action: manipulation;
}

.cookie-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
  filter: drop-shadow(0 18px 24px rgba(40, 18, 8, 0.45));
  animation: idle-spin 18s linear infinite;
  transition: transform 0.08s ease;
}

.cookie-btn:hover img {
  animation-play-state: paused;
  transform: scale(1.04);
}

.cookie-btn:active img,
.cookie-btn.is-clicked img {
  transform: scale(0.92);
  animation: none;
}

@keyframes idle-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.click-pop {
  position: absolute;
  font-weight: 800;
  color: #fff8e8;
  text-shadow: 0 2px 0 #7a3f10;
  pointer-events: none;
  animation: float-up 0.7s ease-out forwards;
  z-index: 5;
}

@keyframes float-up {
  from { transform: translate(-50%, 0); opacity: 1; }
  to { transform: translate(-50%, -70px); opacity: 0; }
}

.crumb {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #c9843a;
  pointer-events: none;
  animation: crumb-fly 0.6s ease-out forwards;
}

@keyframes crumb-fly {
  to { transform: translate(var(--dx), var(--dy)); opacity: 0; }
}

.lucky {
  position: absolute;
  width: 88px;
  height: 88px;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
  z-index: 6;
  animation: lucky-bob 1.4s ease-in-out infinite;
  filter: drop-shadow(0 8px 16px rgba(232, 163, 23, 0.55));
}

.lucky img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

@keyframes lucky-bob {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-10px) scale(1.05); }
}

.fx-banner {
  display: none;
  margin: 10px auto 0;
  padding: 8px 14px;
  border-radius: 999px;
  background: #ffe08a;
  font-weight: 800;
  width: fit-content;
}

.fx-banner.on {
  display: inline-flex;
}

.stat-list {
  display: grid;
  gap: 8px;
  margin: 0;
}

.stat-list div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--line);
}

.stat-list dt {
  color: var(--ink-soft);
  font-weight: 700;
}

.stat-list dd {
  margin: 0;
  font-weight: 800;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.toolbar .btn,
.shop-tabs button,
.buy-toggle button {
  padding: 8px 12px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.achievements {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.badge {
  font-size: 0.78rem;
  padding: 5px 8px;
  border-radius: 999px;
  background: #efe0c8;
  color: var(--ink-soft);
}

.badge.got {
  background: #ffe08a;
  color: var(--ink);
  font-weight: 800;
}

.shop-tabs,
.buy-toggle {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
}

.shop-tabs button.active,
.buy-toggle button.active {
  background: #2a1810;
  color: #fff8e8;
  border-color: #2a1810;
}

.shop-list {
  display: grid;
  gap: 8px;
  max-height: 640px;
  overflow: auto;
  padding-right: 4px;
}

.shop-item {
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 16px;
  padding: 8px;
  cursor: pointer;
  font: inherit;
}

.shop-item img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border-radius: 14px;
}

.shop-item h3 {
  margin: 0;
  font-size: 1rem;
}

.shop-item p {
  margin: 2px 0 0;
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.shop-item .owned {
  font-weight: 800;
  font-size: 1.2rem;
  color: var(--gold-deep);
}

.shop-item:hover:not(:disabled) {
  border-color: var(--gold);
  transform: translateY(-1px);
}

.shop-item:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.shop-item.upgrade .owned {
  display: none;
}

#prestige-btn {
  margin-top: 12px;
  width: 100%;
}

.btn[hidden],
#prestige-btn[hidden] {
  display: none !important;
}

#import-box {
  margin-top: 10px;
  min-height: 88px;
}

.seo {
  margin: 28px auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.seo-card {
  padding: 20px;
}

.seo-card h2 {
  margin: 0 0 8px;
  font-size: 1.2rem;
}

.seo-card p {
  margin: 0;
  color: var(--ink-soft);
}

.page,
.legal {
  margin: 18px auto 28px;
  padding: 28px;
}

.page h1 {
  margin-top: 0;
}

.page h2,
.legal h2 {
  margin-top: 1.4em;
}

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

form {
  display: grid;
  gap: 10px;
}

label {
  font-weight: 800;
}

input,
textarea,
select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #e2c8a2;
  font: inherit;
  background: #fff;
}

textarea {
  min-height: 140px;
  resize: vertical;
}

.check {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  font-weight: 600;
}

.check input {
  width: auto;
  margin-top: 4px;
}

.form-status {
  min-height: 1.4em;
  font-weight: 800;
}

.site-footer {
  margin: 10px auto 28px;
  padding: 22px;
  background: rgba(20, 10, 6, 0.82);
  color: #f7e6cc;
  border-radius: var(--radius);
}

.site-footer a {
  color: #ffd789;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: 18px;
}

.footer-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.muted {
  color: #e2c8a2;
  font-size: 0.92rem;
}

.consent {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 60;
  display: none;
  width: min(720px, calc(100% - 24px));
  padding: 16px;
  background: var(--panel-strong);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.consent.open {
  display: block;
}

.consent-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(20, 8, 4, 0.55);
  z-index: 70;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal.open {
  display: flex;
}

.modal-card {
  width: min(480px, 100%);
  background: var(--foam);
  border-radius: 20px;
  padding: 22px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

@media (max-width: 980px) {
  .hero-play,
  .game-shell,
  .seo,
  .contact-grid,
  .footer-grid {
    grid-template-columns: 1fr;
  }

  .nav-toggle {
    display: inline-flex;
    border: 0;
    background: #ffe7c2;
    border-radius: 12px;
    padding: 10px 12px;
    font: inherit;
    font-weight: 800;
    cursor: pointer;
  }

  .nav {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 10px;
    left: 10px;
    background: #fffaf3;
    border-radius: 16px;
    padding: 10px;
    box-shadow: var(--shadow);
    flex-direction: column;
  }

  .site-header.open .nav {
    display: flex;
  }

  .bakery {
    min-height: 460px;
  }

  .kitchen-catalog {
    grid-template-columns: 1fr 1fr;
  }
}

.prose {
  margin: 18px auto 28px;
  padding: 28px 32px 36px;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.page.prose {
  margin-top: 18px;
}

.crumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.prose h2 {
  margin-top: 1.5em;
}

.prose p,
.prose li {
  color: var(--ink-soft);
}

.prose strong {
  color: var(--ink);
}

.tips {
  display: grid;
  gap: 10px;
  padding-left: 1.2em;
}

.kitchen-catalog {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 18px 0 8px;
}

.kitchen-catalog figure {
  margin: 0;
  padding: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
}

.kitchen-catalog img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  border-radius: 12px;
}

.kitchen-catalog figcaption {
  margin-top: 8px;
  font-size: 0.92rem;
}

.faq {
  display: grid;
  gap: 10px;
}

.faq details {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 16px;
}

.faq summary {
  cursor: pointer;
  font-weight: 800;
  font-family: "Fredoka", "Nunito", sans-serif;
}

.faq details p {
  margin: 10px 0 4px;
}

body.kernel {
  min-height: 100vh;
  margin: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 35%, rgba(232, 163, 26, 0.22), transparent 42%),
    radial-gradient(circle at 50% 100%, #4a2412, #120805 70%);
}

.kernel-stage {
  position: relative;
  z-index: 2;
  width: min(440px, calc(100% - 32px));
  text-align: center;
  color: #fff6e8;
}

.kernel-halo {
  position: absolute;
  inset: -40px;
  background: radial-gradient(circle, rgba(243, 193, 74, 0.28), transparent 62%);
  filter: blur(8px);
  animation: kernel-pulse 2.4s ease-in-out infinite;
  pointer-events: none;
}

.kernel-cookie-wrap {
  position: relative;
  width: 240px;
  height: 240px;
  margin: 0 auto 18px;
}

.kernel-cookie {
  width: 240px;
  height: 240px;
  object-fit: cover;
  border-radius: 50%;
  animation: kernel-spin 10s linear infinite, kernel-bob 2.2s ease-in-out infinite;
  filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.45));
}

.kernel-spark {
  position: absolute;
  width: 64px;
  height: 64px;
  right: -8px;
  bottom: 12px;
  border-radius: 50%;
  animation: kernel-orbit 3.2s ease-in-out infinite;
}

.kernel-brand {
  position: relative;
  margin: 0;
  font-family: "Fredoka", "Nunito", sans-serif;
  font-size: 2.2rem;
}

.kernel-kicker {
  margin: 4px 0 14px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.72rem;
  font-weight: 800;
  color: #ffd789;
}

.kernel-status {
  position: relative;
  min-height: 1.5em;
  margin: 0 0 14px;
  font-weight: 800;
}

.kernel-bar {
  height: 12px;
  border-radius: 999px;
  background: rgba(255, 246, 232, 0.15);
  overflow: hidden;
  border: 1px solid rgba(255, 215, 137, 0.35);
}

.kernel-fill {
  height: 100%;
  width: 12%;
  border-radius: inherit;
  background: linear-gradient(90deg, #f3c14a, #fff1c4, #e4a31a);
  box-shadow: 0 0 18px #e4a31a;
  transition: width 0.2s linear;
}

.kernel-hint {
  margin: 14px 0 0;
  color: #e2c8a2;
  font-size: 0.95rem;
}

.kernel-crumbs span {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #c9843a;
  opacity: 0.7;
  animation: kernel-fall 7s linear infinite;
}

.kernel-crumbs span:nth-child(1) { left: 8%; animation-delay: 0s; }
.kernel-crumbs span:nth-child(2) { left: 22%; animation-delay: 1.2s; width: 7px; height: 7px; }
.kernel-crumbs span:nth-child(3) { left: 38%; animation-delay: 2.1s; }
.kernel-crumbs span:nth-child(4) { left: 51%; animation-delay: 0.6s; width: 14px; height: 14px; }
.kernel-crumbs span:nth-child(5) { left: 67%; animation-delay: 2.8s; }
.kernel-crumbs span:nth-child(6) { left: 74%; animation-delay: 1.7s; width: 8px; height: 8px; }
.kernel-crumbs span:nth-child(7) { left: 86%; animation-delay: 3.4s; }
.kernel-crumbs span:nth-child(8) { left: 93%; animation-delay: 0.3s; }

@keyframes kernel-spin {
  to { transform: rotate(360deg); }
}

@keyframes kernel-bob {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -10px; }
}

@keyframes kernel-pulse {
  0%, 100% { opacity: 0.55; transform: scale(0.96); }
  50% { opacity: 1; transform: scale(1.04); }
}

@keyframes kernel-orbit {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-16px) rotate(18deg); }
}

@keyframes kernel-fall {
  0% { top: -12px; opacity: 0; }
  12% { opacity: 0.8; }
  100% { top: 110vh; opacity: 0; }
}

@media (max-width: 980px) {
  .kitchen-catalog {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 560px) {
  .kitchen-catalog {
    grid-template-columns: 1fr;
  }
}
