@import url('https://fonts.googleapis.com/css2?family=Bungee:wght@400&family=Changa:wght@400;600;700&family=Space+Mono:wght@400;700&display=swap');

:root {
  --ink: #15120f;
  --paper: #fff4d6;
  --cream: #fffaec;
  --red: #f2542d;
  --orange: #ff9f1c;
  --blue: #2e86ab;
  --mint: #53d8b8;
  --line: 4px solid var(--ink);
  --shadow: 8px 8px 0 var(--ink);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Changa", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 15%, rgba(255, 255, 255, 0.5) 0, rgba(255, 255, 255, 0) 32%),
    radial-gradient(circle at 86% 17%, rgba(83, 216, 184, 0.24) 0, rgba(83, 216, 184, 0) 27%),
    linear-gradient(132deg, #ffb703 0%, #ffd166 31%, #f49f0a 100%);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image: repeating-linear-gradient(
    25deg,
    rgba(21, 18, 15, 0.06) 0,
    rgba(21, 18, 15, 0.06) 1px,
    transparent 1px,
    transparent 12px
  );
  opacity: 0.45;
}

.shape-burst {
  position: fixed;
  width: clamp(120px, 17vw, 220px);
  top: 16px;
  right: 16px;
  transform: rotate(11deg);
  z-index: 1;
}

.shell {
  width: min(1200px, calc(100vw - 1.6rem));
  margin: 1rem auto 2rem;
  position: relative;
  z-index: 2;
}

.topbar {
  border: var(--line);
  box-shadow: var(--shadow);
  background:
    linear-gradient(155deg, rgba(255, 255, 255, 0.35) 0, rgba(255, 255, 255, 0) 45%),
    linear-gradient(42deg, #ffce5c 0%, #ffe59f 100%);
  padding: 1rem;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 0.8rem;
}

.eyebrow {
  margin: 0;
  font-family: "Space Mono", monospace;
  letter-spacing: 0.09em;
  font-size: 0.8rem;
  font-weight: 700;
}

h1,
h2,
h3 {
  margin: 0;
}

h1 {
  margin-top: 0.25rem;
  font-family: "Bungee", sans-serif;
  font-size: clamp(1.65rem, 5.6vw, 3.7rem);
  line-height: 0.95;
  text-transform: uppercase;
}

h2 {
  font-family: "Bungee", sans-serif;
  font-size: clamp(1.2rem, 3.8vw, 2.2rem);
  line-height: 1;
}

h3 {
  font-family: "Bungee", sans-serif;
  font-size: 1.08rem;
}

.subtitle {
  margin: 0.7rem 0 0;
  max-width: 68ch;
  font-size: 1.03rem;
  line-height: 1.22;
}

.action-link {
  display: inline-block;
  border: var(--line);
  box-shadow: 4px 4px 0 var(--ink);
  background: var(--blue);
  color: #fff;
  text-decoration: none;
  padding: 0.58rem 0.75rem;
  font-family: "Space Mono", monospace;
  font-weight: 700;
  transform: rotate(-2deg);
  white-space: nowrap;
}

.action-link:hover {
  transform: rotate(0deg) translateY(-1px);
}

.calc-layout {
  margin-top: 1rem;
  display: grid;
  grid-template-columns: 1.08fr 0.92fr;
  gap: 1rem;
  align-items: start;
}

.calc-left,
.calc-right {
  display: grid;
  gap: 1rem;
}

.panel {
  border: var(--line);
  box-shadow: var(--shadow);
  background: var(--paper);
  padding: 0.9rem;
}

.panel-result {
  background: linear-gradient(145deg, #fff9eb 0%, #ffe8bc 100%);
}

.panel h2 {
  margin-bottom: 0.65rem;
}

.style-grid {
  display: grid;
  gap: 0.62rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.style-card {
  border: 3px solid var(--ink);
  box-shadow: 4px 4px 0 var(--ink);
  background: var(--cream);
  padding: 0.62rem;
  display: grid;
  gap: 0.42rem;
  justify-items: center;
  min-height: 126px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  text-align: center;
  transition: transform 0.14s ease, background-color 0.14s ease;
}

.style-card:nth-child(1) {
  background: #ffe3b0;
}

.style-card:nth-child(2) {
  background: #d5edf6;
}

.style-card:nth-child(3) {
  background: #ffdaca;
}

.style-card:nth-child(4) {
  background: #d9e8b2;
}

.style-card img {
  width: 66px;
  height: 66px;
}

.style-card:hover {
  transform: translate(-2px, -2px);
}

.style-card.active {
  background: var(--orange);
  transform: translate(-3px, -3px) rotate(-1.4deg);
}

.option-grid {
  margin-top: 0.85rem;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

fieldset {
  margin: 0;
  border: 3px solid var(--ink);
  background: #fffdf5;
  padding: 0.65rem;
}

legend {
  padding: 0 0.3rem;
  font-family: "Space Mono", monospace;
  font-size: 0.83rem;
  font-weight: 700;
}

label {
  display: block;
}

fieldset label {
  margin: 0.3rem 0;
}

.input-grid {
  margin-top: 0.85rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.5rem;
  align-items: center;
}

input[type="number"] {
  width: 100%;
  border: 3px solid var(--ink);
  background: #fff;
  font: inherit;
  padding: 0.45rem 0.5rem;
}

input[type="number"]:focus,
input[type="range"]:focus,
button:focus,
.action-link:focus,
a:focus {
  outline: 3px solid var(--red);
  outline-offset: 1px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
}

button.ghost {
  border: 3px solid var(--ink);
  background: var(--mint);
  box-shadow: 3px 3px 0 var(--ink);
  font: inherit;
  font-weight: 700;
  padding: 0.35rem 0.62rem;
  cursor: pointer;
}

.slider-grid {
  display: grid;
  gap: 0.46rem;
}

.slider-grid label {
  border: 2px solid var(--ink);
  background: #fff;
  padding: 0.45rem 0.52rem;
  font-weight: 700;
}

.slider-grid strong {
  float: right;
}

input[type="range"] {
  width: 100%;
  margin-top: 0.45rem;
  accent-color: var(--red);
}

.hint {
  margin: 0.42rem 0 0;
  font-family: "Space Mono", monospace;
  font-size: 0.83rem;
  line-height: 1.3;
}

.calc-right {
  position: sticky;
  top: 0.7rem;
}

.result-meta {
  display: grid;
  gap: 0.45rem;
  grid-template-columns: 1fr;
  margin-bottom: 0.75rem;
}

.stamp {
  border: 3px solid var(--ink);
  background: #fff;
  box-shadow: 3px 3px 0 var(--ink);
  padding: 0.45rem 0.52rem;
  font-weight: 700;
}

.result-table {
  width: 100%;
  border-collapse: collapse;
  border: 3px solid var(--ink);
  background: #fff;
}

.result-table th,
.result-table td {
  border-bottom: 2px dashed var(--ink);
  padding: 0.49rem 0.58rem;
  text-align: left;
}

.result-table tr:last-child th,
.result-table tr:last-child td {
  border-bottom: 0;
}

.result-table .sum {
  background: #ffd86f;
}

#starterRow,
#directFlourRow,
#directWaterRow {
  display: none;
}

.timeline-wrap {
  margin-top: 0.8rem;
  border: 3px solid var(--ink);
  background: #fff;
  padding: 0.62rem;
}

.timeline-wrap h3 {
  margin-bottom: 0.4rem;
}

#timeline {
  margin: 0;
  padding-left: 1rem;
}

#timeline li {
  margin: 0.26rem 0;
}

.info-shell .panel {
  background: #fff5de;
}

.consensus-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.68rem;
}

.consensus-grid article {
  border: 3px solid var(--ink);
  background: #fff;
  padding: 0.62rem;
}

.consensus-grid p {
  margin: 0.45rem 0 0;
  line-height: 1.28;
}

.sources {
  margin: 0;
  padding-left: 1rem;
}

.sources li {
  margin: 0.34rem 0;
}

.sources a {
  color: #065f83;
  font-weight: 700;
}

.footer {
  margin: 1rem 0 0.2rem;
  text-align: center;
  font-family: "Space Mono", monospace;
  font-size: 0.78rem;
}

.reveal {
  animation: rise 0.44s ease both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

  .calc-right {
    position: static;
  }

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

@media (max-width: 840px) {
  .topbar {
    flex-direction: column;
  }

  .action-link {
    transform: rotate(0deg);
  }

  .style-grid,
  .option-grid,
  .consensus-grid,
  .result-meta,
  .input-grid {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 0.78rem;
  }
}

@media (max-width: 560px) {
  .shell {
    width: min(1200px, calc(100vw - 0.9rem));
  }

  .shape-burst {
    width: 92px;
    top: 8px;
    right: 8px;
  }

  .style-card {
    min-height: 104px;
  }
}
