:root {
  color-scheme: light;
  --white: #fffdf8;
  --red: #c1121f;
  --green: #2f9e44;
  --dark-green: #1b6b35;
  --crust: #d99b53;
  --cheese: #ffe066;
  --ink: #2d1f1a;
  --muted: #705c51;
  --shadow: 0 18px 42px rgba(56, 31, 20, 0.18);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--white);
  font-family: ui-rounded, "Avenir Next", "Trebuchet MS", system-ui, sans-serif;
}

button,
a,
input {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  overflow-x: hidden;
}

.heart-tag,
.creator-tag,
.visitor-counter {
  position: fixed;
  z-index: 5;
  margin: 0;
  padding: 9px 14px;
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.92);
  box-shadow: 0 10px 24px rgba(56, 31, 20, 0.12);
  font-weight: 900;
}

.heart-tag {
  top: clamp(10px, 2.6vw, 24px);
  left: 50%;
  font-size: clamp(1rem, 4vw, 1.55rem);
  transform: translateX(-50%);
}

.creator-tag {
  right: clamp(12px, 3vw, 28px);
  bottom: clamp(12px, 3vw, 28px);
  color: var(--red);
}

.visitor-counter {
  left: clamp(12px, 3vw, 28px);
  bottom: clamp(12px, 3vw, 28px);
}

.screen {
  display: none;
  min-height: 100vh;
  padding: clamp(22px, 4vw, 48px);
  padding-bottom: 128px;
  background:
    linear-gradient(rgba(255, 253, 248, 0.92), rgba(255, 253, 248, 0.92)),
    repeating-linear-gradient(90deg, rgba(193, 18, 31, 0.08) 0 30px, transparent 30px 60px),
    repeating-linear-gradient(0deg, rgba(47, 158, 68, 0.07) 0 30px, transparent 30px 60px);
}

.screen.is-active {
  display: flex;
}

.builder-screen,
.chart-screen {
  flex-direction: column;
  gap: 24px;
}

.site-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  width: min(1180px, 100%);
  margin: 38px auto 0;
}

.kicker {
  margin: 0 0 8px;
  color: var(--green);
  font-size: 0.95rem;
  font-weight: 900;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
}

h1 {
  color: var(--red);
  font-size: clamp(3rem, 10vw, 7rem);
  line-height: 1;
}

h2 {
  color: var(--red);
  font-size: clamp(1.8rem, 4vw, 3.4rem);
  line-height: 1.05;
}

.intro,
.summary-text,
.result-message,
.empty-chart,
.chart-note {
  color: var(--muted);
  font-size: clamp(1rem, 2.2vw, 1.18rem);
  font-weight: 800;
  line-height: 1.45;
}

.site-links,
.action-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.site-links a,
.primary-button,
.secondary-button,
.text-button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  padding: 10px 16px;
  box-shadow: var(--shadow);
  font-weight: 900;
  text-decoration: none;
  cursor: pointer;
}

.site-links a,
.text-button {
  color: var(--red);
  background: rgba(255, 255, 255, 0.88);
}

.primary-button {
  color: white;
  background: var(--red);
}

.secondary-button {
  color: white;
  background: var(--green);
}

.site-links a:hover,
.primary-button:hover,
.secondary-button:hover,
.text-button:hover {
  transform: translateY(-2px);
}

.layout {
  display: grid;
  grid-template-columns: minmax(300px, 1fr) minmax(320px, 420px);
  gap: 24px;
  width: min(1180px, 100%);
  margin: 0 auto;
}

.control-panel,
.preview-panel,
.result-card,
.chart-group {
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.control-panel {
  display: grid;
  gap: 18px;
  padding: 18px;
}

.control-group {
  display: grid;
  gap: 10px;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.96rem;
  font-weight: 800;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.dense-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.option-grid label {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 8px;
  border-radius: 8px;
  padding: 8px 10px;
  background: rgba(47, 158, 68, 0.08);
  font-weight: 800;
}

.preview-panel {
  display: grid;
  align-content: start;
  justify-items: center;
  gap: 18px;
  padding: 24px;
  text-align: center;
}

.pizza-preview {
  position: relative;
  width: min(330px, 76vw);
  height: min(330px, 76vw);
  filter: drop-shadow(0 18px 20px rgba(56, 31, 20, 0.18));
}

.pizza-preview span {
  position: absolute;
  display: block;
}

.crust {
  inset: 0;
  border-radius: 50%;
  background: var(--crust);
}

.shape-square .crust {
  border-radius: 24px;
}

.shape-heart .crust {
  transform: rotate(-45deg) scale(0.78);
  border-radius: 26px;
}

.shape-heart .crust::before,
.shape-heart .crust::after {
  position: absolute;
  content: "";
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--crust);
}

.shape-heart .crust::before {
  top: -50%;
}

.shape-heart .crust::after {
  right: -50%;
}

.shape-triangle .crust {
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  border-radius: 0;
}

.shape-bagel .crust {
  border-radius: 50%;
}

.shape-bagel .crust::after {
  position: absolute;
  inset: 34%;
  border-radius: 50%;
  background: var(--white);
  content: "";
}

.sauce,
.cheese {
  inset: 8%;
  border-radius: inherit;
}

.shape-triangle .sauce,
.shape-triangle .cheese {
  clip-path: polygon(50% 5%, 94% 94%, 6% 94%);
}

.sauce {
  background: #c1121f;
}

.sauce-right {
  opacity: 0;
}

.has-half-sauce .sauce-left {
  clip-path: inset(0 50% 0 0);
}

.has-half-sauce .sauce-right {
  opacity: 1;
  clip-path: inset(0 0 0 50%);
}

.sauce-red .sauce-left,
.sauce-right-red .sauce-right {
  background: #c1121f;
}

.sauce-pink .sauce-left,
.sauce-right-pink .sauce-right {
  background: #f4a6b8;
}

.sauce-white .sauce-left,
.sauce-right-white .sauce-right {
  background: #fff4d6;
}

.sauce-green .sauce-left,
.sauce-right-green .sauce-right {
  background: #2f9e44;
}

.cheese {
  inset: 15%;
  background:
    radial-gradient(circle at 30% 32%, rgba(255, 255, 255, 0.7) 0 9px, transparent 10px),
    radial-gradient(circle at 64% 55%, rgba(255, 255, 255, 0.66) 0 11px, transparent 12px),
    var(--cheese);
  opacity: 0.88;
}

.topping {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 35%, #111 0 3px, transparent 4px),
    #d00000;
  opacity: 0;
}

.has-toppings .topping {
  opacity: 1;
}

.topping-one {
  left: 29%;
  top: 34%;
}

.topping-two {
  left: 58%;
  top: 42%;
  background: #2f9e44;
}

.topping-three {
  left: 42%;
  top: 62%;
  background: #6f4e37;
}

.finish-lines {
  inset: 22%;
  border-radius: inherit;
  opacity: 0;
  background:
    linear-gradient(35deg, transparent 0 46%, rgba(255, 255, 255, 0.75) 46% 51%, transparent 51%),
    linear-gradient(-25deg, transparent 0 48%, rgba(47, 158, 68, 0.75) 48% 52%, transparent 52%);
}

.has-finishes .finish-lines {
  opacity: 1;
}

.action-row {
  justify-content: center;
}

.result-screen {
  align-items: center;
  justify-content: center;
}

.result-card {
  width: min(700px, 100%);
  padding: clamp(24px, 5vw, 44px);
  text-align: center;
}

.result-visual {
  position: relative;
  width: min(520px, 100%);
  height: 320px;
  margin: 18px auto;
}

.oven-box {
  position: absolute;
  right: 34px;
  bottom: 28px;
  width: 230px;
  height: 180px;
  border-radius: 110px 110px 18px 18px;
  background: var(--red);
}

.oven-box::after {
  position: absolute;
  inset: 62px 36px 30px;
  border-radius: 46px 46px 12px 12px;
  background: #2d1f1a;
  content: "";
}

.flame {
  position: absolute;
  z-index: 1;
  bottom: 46px;
  width: 28px;
  height: 48px;
  border-radius: 50% 50% 50% 0;
  background: #ffb703;
  transform: rotate(-45deg);
  animation: flameFlicker 500ms ease-in-out infinite alternate;
}

.flame-one {
  left: 82px;
}

.flame-two {
  left: 124px;
  animation-delay: 180ms;
}

.animated-pizza {
  position: absolute;
  left: 42px;
  bottom: 76px;
  width: 146px;
  height: 146px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 35%, #d00000 0 10px, transparent 11px),
    radial-gradient(circle at 65% 58%, #2f9e44 0 9px, transparent 10px),
    linear-gradient(var(--cheese), var(--cheese));
  border: 12px solid var(--crust);
  animation: pizzaToOven 2.2s ease forwards;
}

.fold-half {
  display: none;
}

.calzone-mode .animated-pizza {
  animation: calzoneFold 2.5s ease forwards;
}

.calzone-mode .fold-half {
  position: absolute;
  display: block;
  inset: -12px 50% -12px -12px;
  border-radius: 90px 0 0 90px;
  background: var(--crust);
  transform-origin: right center;
  animation: foldHalf 1.2s ease forwards;
}

.calzone-mode .oven-box {
  animation: ovenGlow 1.2s ease-in-out infinite alternate;
}

@keyframes pizzaToOven {
  to {
    transform: translate(236px, 24px) scale(0.62);
  }
}

@keyframes calzoneFold {
  0% {
    transform: translateX(0);
  }
  48% {
    transform: translateX(0);
    border-radius: 50%;
  }
  100% {
    transform: translate(236px, 24px) scale(0.62);
    border-radius: 80px 80px 18px 18px;
  }
}

@keyframes foldHalf {
  to {
    transform: rotateY(180deg);
  }
}

@keyframes flameFlicker {
  to {
    transform: rotate(-45deg) scale(1.12);
  }
}

@keyframes ovenGlow {
  to {
    box-shadow: 0 0 30px rgba(193, 18, 31, 0.5);
  }
}

.chart-body {
  display: grid;
  gap: 20px;
  width: min(980px, 100%);
  margin: 0 auto;
}

.chart-group {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.chart-row {
  display: grid;
  grid-template-columns: minmax(150px, 240px) 1fr auto;
  align-items: center;
  gap: 12px;
}

.bar-track {
  height: 18px;
  border-radius: 999px;
  background: rgba(47, 158, 68, 0.14);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--red), var(--green));
}

.chart-empty-line {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

@media (max-width: 900px) {
  .site-header,
  .layout {
    grid-template-columns: 1fr;
  }

  .site-header {
    flex-direction: column;
  }

  .site-links {
    justify-content: flex-start;
  }

  .dense-grid,
  .option-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .heart-tag {
    position: relative;
    top: auto;
    left: auto;
    display: table;
    margin: 12px auto 0;
    transform: none;
  }

  .creator-tag {
    right: 50%;
    transform: translateX(50%);
  }

  .visitor-counter {
    left: 50%;
    bottom: 64px;
    transform: translateX(-50%);
  }

  .screen {
    padding-bottom: 170px;
  }

  .chart-row {
    grid-template-columns: 1fr auto;
  }

  .bar-track {
    grid-column: 1 / -1;
    order: 3;
  }
}
