:root {
  --bg: #f3efe8;
  --panel: #fcfaf6;
  --panel-soft: #f0ebe2;
  --line: #d8d0c3;
  --text: #1f1d1a;
  --muted: #6e675f;
  --shadow: 0 18px 40px rgba(39, 31, 20, 0.08);
  --jam-color: #d84a5e;
  --jam-deep: #7a2132;
  --jam-light: #ff98a3;
  --jam-glow: rgba(216, 74, 94, 0.28);
  --shelf: #d9d0c4;
  --slot: #f8f5ef;
  color-scheme: light;
  font-family: "Avenir Next", "Helvetica Neue", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  background: transparent;
}

img {
  display: block;
  max-width: 100%;
  -webkit-user-drag: none;
  user-select: none;
}

#app {
  min-height: 100vh;
}

.screen {
  min-height: 100vh;
  padding: 22px clamp(14px, 4vw, 44px);
  display: grid;
  align-items: center;
}

.screen-inner {
  width: min(1120px, 100%);
  margin: 0 auto;
  display: grid;
  gap: 24px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
}

.app-bar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}

.mini-meta {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.page-title,
.hero-title,
.memory-reveal h2 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 700;
  letter-spacing: 0;
}

.page-title {
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 0.95;
}

.hero-title {
  font-size: clamp(3rem, 10vw, 6.5rem);
  line-height: 0.88;
}

.hero-note,
.tray-note,
.memory-echo,
.memory-copy,
.memory-date,
.bite-note,
.status-strip {
  color: var(--muted);
}

.hero-note,
.tray-note,
.memory-echo,
.memory-copy,
.bite-note,
.status-strip {
  line-height: 1.65;
}

.button-row,
.shelf-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.warm-button,
.ghost-button,
.danger-button,
.jam-pill,
.emoji-button,
.ingredient-button,
.shelf-jar {
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 180ms ease, box-shadow 180ms ease, border-color 180ms ease,
    background 180ms ease, opacity 180ms ease;
}

.warm-button,
.ghost-button,
.danger-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 15px;
  border-radius: 999px;
  font-weight: 700;
}

.warm-button {
  color: #fff;
  background: var(--text);
  box-shadow: 0 10px 24px rgba(31, 29, 26, 0.16);
}

.ghost-button {
  color: var(--text);
  background: var(--panel-soft);
  border: 1px solid var(--line);
}

.danger-button {
  color: #8a2f2f;
  background: #f7ecea;
  border: 1px solid #e7c0bd;
}

.warm-button:hover,
.ghost-button:hover,
.danger-button:hover,
.jam-pill:hover,
.emoji-button:hover,
.ingredient-button:hover,
.shelf-jar:hover {
  transform: translateY(-2px);
}

.warm-button:disabled,
.ghost-button:disabled,
.ingredient-button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

[hidden] {
  display: none !important;
}

.intro-card {
  padding: clamp(22px, 4vw, 40px);
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(240px, 0.8fr);
  gap: 28px;
  align-items: center;
}

.intro-copy {
  display: grid;
  gap: 16px;
}

.intro-jars {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 16px;
}

.intro-jars img {
  width: clamp(82px, 11vw, 134px);
  filter: drop-shadow(0 18px 20px rgba(32, 25, 18, 0.12));
}

.intro-jars img:nth-child(2) {
  width: clamp(94px, 13vw, 148px);
}

.maker-grid,
.finish-grid,
.taste-layout {
  display: grid;
  gap: 24px;
}

.maker-grid {
  grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 1.1fr);
}

.control-panel,
.pot-panel,
.jar-card,
.finish-form,
.taste-panel,
.memory-panel {
  padding: clamp(18px, 3vw, 28px);
}

.control-panel {
  display: grid;
  gap: 18px;
  align-content: start;
}

.panel-block {
  display: grid;
  gap: 12px;
}

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

.jam-pill {
  min-height: 132px;
  padding: 12px 10px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  display: grid;
  justify-items: center;
  gap: 8px;
  color: var(--text);
  text-align: center;
}

.jam-pill img {
  height: 76px;
  object-fit: contain;
  filter: drop-shadow(0 10px 12px rgba(32, 25, 18, 0.1));
}

.jam-pill span {
  font-size: 0.9rem;
  font-weight: 700;
}

.jam-pill.is-selected {
  border-color: rgba(0, 0, 0, 0.2);
  box-shadow: 0 0 0 2px rgba(31, 29, 26, 0.07);
}

.emotion-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.emoji-button {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  font-size: 1.35rem;
}

.emoji-button.is-selected {
  background: #fff;
  box-shadow: 0 0 0 2px rgba(31, 29, 26, 0.08);
}

.note-editor {
  background: var(--panel-soft);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 12px;
}

textarea {
  width: 100%;
  min-height: 184px;
  padding: 12px 2px 4px;
  resize: vertical;
  border: 0;
  background: transparent;
  color: var(--text);
  line-height: 1.7;
}

textarea::placeholder,
input::placeholder {
  color: #9a9186;
}

textarea:focus,
input:focus {
  outline: none;
}

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

.ingredient-button {
  min-height: 124px;
  padding: 12px;
  border-radius: 20px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  display: grid;
  justify-items: center;
  gap: 10px;
  color: var(--text);
}

.ingredient-button img {
  height: 64px;
  object-fit: contain;
  filter: drop-shadow(0 10px 10px rgba(32, 25, 18, 0.1));
}

.ingredient-button span {
  font-size: 0.9rem;
  font-weight: 700;
}

.ingredient-button.is-added {
  opacity: 0.55;
}

.mini-note {
  width: 68px;
  min-height: 68px;
  display: grid;
  place-items: center;
  padding: 8px;
  border-radius: 12px;
  background: #f7f2e8;
  border: 1px solid #e0d7c9;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.35;
  text-align: center;
}

.pot-panel {
  position: relative;
  overflow: hidden;
}

.pot-stage {
  position: relative;
  min-height: 470px;
  display: grid;
  place-items: center;
}

.drop-layer {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.mix-bowl {
  position: relative;
  width: min(460px, 86vw);
  aspect-ratio: 1.2 / 0.78;
  border-radius: 50%;
  overflow: hidden;
  background:
    radial-gradient(ellipse at 50% 34%, rgba(255, 255, 255, 0.16), transparent 32%),
    radial-gradient(ellipse at 50% 50%, #766d62 0 56%, #554d44 57% 72%, #302b27 73% 100%);
  box-shadow:
    inset 0 -18px 28px rgba(21, 18, 15, 0.35),
    inset 0 18px 22px rgba(255, 255, 255, 0.12),
    0 24px 34px rgba(39, 31, 20, 0.16);
}

.bowl-rim {
  position: absolute;
  inset: 7% 6% 15%;
  border-radius: 50%;
  border: 16px solid rgba(255, 255, 255, 0.15);
  box-shadow: inset 0 14px 18px rgba(21, 18, 15, 0.25);
}

.jam-surface {
  position: absolute;
  left: 12%;
  right: 12%;
  top: 22%;
  bottom: 18%;
  border-radius: 50%;
  overflow: hidden;
  opacity: calc(0.2 + var(--mix, 0) * 0.78);
  background:
    radial-gradient(circle at 28% 24%, rgba(255, 255, 255, 0.7), transparent 18%),
    radial-gradient(circle at 68% 66%, var(--jam-light), transparent 22%),
    linear-gradient(145deg, var(--jam-light), var(--jam-color) 48%, var(--jam-deep));
  box-shadow:
    inset 0 8px 14px rgba(255, 255, 255, calc(0.15 + var(--mix, 0) * 0.18)),
    inset 0 -16px 24px rgba(48, 10, 18, calc(0.2 + var(--mix, 0) * 0.25)),
    0 0 26px var(--jam-glow);
  filter: saturate(calc(0.7 + var(--mix, 0) * 0.5));
}

.jam-surface::before,
.jam-surface::after {
  content: "";
  position: absolute;
  inset: 8%;
  border-radius: 50%;
  border: 8px solid rgba(255, 255, 255, 0.14);
  border-left-color: rgba(255, 255, 255, 0.02);
  border-bottom-color: rgba(255, 255, 255, 0.06);
  animation: swirl var(--swirl-speed, 4.6s) linear infinite;
}

.jam-surface::after {
  inset: 22%;
  border-width: 6px;
  animation-direction: reverse;
  animation-duration: calc(var(--swirl-speed, 4.6s) * 0.76);
}

.fruit-bit {
  position: absolute;
  left: var(--x);
  top: var(--y);
  width: var(--s);
  height: var(--s);
  border-radius: 58% 42% 56% 44%;
  background:
    radial-gradient(circle at 28% 24%, rgba(255, 255, 255, 0.42), transparent 28%),
    linear-gradient(145deg, var(--jam-light), var(--jam-deep));
  opacity: var(--show);
  transform: rotate(var(--r)) scale(calc(0.56 + var(--mix, 0) * 0.46));
  box-shadow: inset 0 -3px 5px rgba(54, 11, 18, 0.24);
  transition: opacity 260ms ease, transform 260ms ease;
}

.pot-flags {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.pot-flag {
  position: absolute;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(0, 0, 0, 0.05);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 700;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 200ms ease, transform 200ms ease;
}

.pot-flag:first-child {
  left: 18%;
  top: 19%;
}

.pot-flag:last-child {
  right: 18%;
  top: 22%;
}

.pot-flag.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.stir-spoon {
  position: absolute;
  right: 10%;
  bottom: 13%;
  width: 150px;
  transform: rotate(-18deg);
  filter: drop-shadow(0 18px 18px rgba(39, 31, 20, 0.16));
  cursor: grab;
  touch-action: none;
}

.stir-spoon.is-stirring {
  position: fixed;
  z-index: 50;
  pointer-events: none;
  cursor: grabbing;
}

.progress-panel {
  display: grid;
  gap: 12px;
  padding: 16px 2px 2px;
}

.progress-copy {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

.progress-track {
  height: 10px;
  border-radius: 999px;
  background: #e8e1d6;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--jam-light), var(--jam-color), var(--jam-deep));
  box-shadow: 0 0 18px var(--jam-glow);
}

.ingredient-drop {
  position: absolute;
  top: 2%;
  left: var(--drop-left, 24%);
  pointer-events: none;
}

.ingredient-drop.fruit {
  width: var(--drop-size, 14px);
  height: var(--drop-size, 14px);
  border-radius: 58% 42% 56% 44%;
  background:
    radial-gradient(circle at 26% 22%, rgba(255, 255, 255, 0.48), transparent 28%),
    linear-gradient(145deg, var(--jam-light), var(--jam-color), var(--jam-deep));
  box-shadow: 0 6px 10px rgba(39, 31, 20, 0.08);
  animation: fruitDrop 720ms ease-in forwards;
  animation-delay: var(--drop-delay, 0ms);
}

.ingredient-drop.note {
  width: 76px;
  height: 54px;
  border-radius: 12px;
  background: #f7f2e8;
  border: 1px solid #dfd4c5;
  box-shadow: 0 10px 18px rgba(39, 31, 20, 0.08);
  animation: noteDrop 820ms ease-in forwards;
}

.finish-grid {
  grid-template-columns: minmax(280px, 0.9fr) minmax(320px, 0.9fr);
  align-items: center;
}

.jar-card {
  display: grid;
  place-items: center;
  min-height: 520px;
}

.preview-jar,
.open-jar,
.portable-jar {
  position: relative;
  display: grid;
  place-items: center;
}

.preview-jar img,
.open-jar img {
  width: min(260px, 46vw);
  filter: drop-shadow(0 22px 24px rgba(39, 31, 20, 0.16));
}

.jar-label {
  position: absolute;
  left: 50%;
  bottom: 22%;
  transform: translateX(-50%);
  width: 116px;
  min-height: 56px;
  padding: 8px;
  border-radius: 14px;
  background: rgba(247, 242, 232, 0.96);
  border: 1px solid #dfd4c5;
  text-align: center;
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.3;
  box-shadow: 0 10px 20px rgba(39, 31, 20, 0.08);
}

.jar-label strong {
  display: block;
  margin-bottom: 3px;
  color: var(--text);
  font-size: 0.76rem;
}

.large-label {
  width: 132px;
  min-height: 70px;
}

.finish-form {
  display: grid;
  gap: 16px;
  align-content: center;
}

.finish-form label {
  display: grid;
  gap: 8px;
}

.text-field {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--panel-soft);
  color: var(--text);
}

.memory-echo {
  min-height: 92px;
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
}

.placement-tray {
  padding: 18px 20px;
  display: grid;
  grid-template-columns: minmax(160px, 220px) 1fr;
  align-items: center;
  gap: 18px;
}

.portable-jar {
  width: 152px;
  cursor: grab;
  touch-action: none;
}

.portable-jar.is-floating {
  position: fixed;
  z-index: 90;
  margin: 0;
  cursor: grabbing;
}

.portable-jar img {
  filter: drop-shadow(0 20px 22px rgba(39, 31, 20, 0.16));
}

.shelf-shell {
  padding: 18px;
  background: var(--shelf);
}

.shelf-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(94px, 1fr));
  gap: 14px;
}

.shelf-slot {
  min-height: 150px;
  border-radius: 18px;
  background: var(--slot);
  border: 1px solid rgba(0, 0, 0, 0.06);
  display: grid;
  place-items: end center;
  padding: 10px 8px;
  position: relative;
}

.shelf-slot.is-drop-ready {
  border-style: dashed;
}

.shelf-slot.is-hovered {
  box-shadow: 0 0 0 2px rgba(31, 29, 26, 0.12);
}

.shelf-jar {
  position: relative;
  width: 100%;
  height: 126px;
  display: grid;
  place-items: center;
}

.shelf-jar img {
  max-width: 78px;
  max-height: 110px;
  object-fit: contain;
  filter: drop-shadow(0 16px 16px rgba(39, 31, 20, 0.12));
}

.shelf-tag,
.shelf-label {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 12px;
  width: 78px;
  min-height: 40px;
  padding: 5px 6px;
  border-radius: 12px;
  background: rgba(247, 242, 232, 0.96);
  border: 1px solid #dfd4c5;
  text-align: center;
  color: var(--muted);
  font-size: 0.58rem;
  line-height: 1.28;
}

.shelf-tag strong,
.shelf-label strong {
  display: block;
  color: var(--text);
  font-size: 0.62rem;
  margin-bottom: 2px;
}

.taste-layout {
  grid-template-columns: minmax(420px, 1.05fr) minmax(280px, 0.75fr);
  align-items: center;
}

.taste-panel {
  min-height: 620px;
}

.taste-stage {
  position: relative;
  min-height: 540px;
}

.open-jar {
  position: absolute;
  left: 7%;
  bottom: 14%;
}

.open-jar::before {
  content: "";
  position: absolute;
  top: 12%;
  width: 90px;
  height: 24px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 26%, rgba(255, 255, 255, 0.58), transparent 20%),
    linear-gradient(180deg, var(--jam-light), var(--jam-color), var(--jam-deep));
  box-shadow: inset 0 4px 8px rgba(255, 255, 255, 0.24), 0 6px 12px var(--jam-glow);
}

.toast-zone {
  position: absolute;
  right: 7%;
  bottom: 15%;
  width: min(300px, 48vw);
  border: 0;
  padding: 0;
  display: grid;
  place-items: center;
  filter: drop-shadow(0 18px 18px rgba(39, 31, 20, 0.12));
}

.toast-zone img {
  width: 100%;
}

.toast-zone::after {
  content: "";
  position: absolute;
  top: 7%;
  right: 13%;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--bg);
  opacity: 0;
  transform: scale(0.2);
  transition: opacity 220ms ease, transform 220ms ease;
}

.toast-zone.is-bitten::after {
  opacity: 1;
  transform: scale(1);
}

.toast-spread {
  position: absolute;
  width: 49%;
  height: 34%;
  top: 34%;
  left: 27%;
  border-radius: 55% 45% 48% 52%;
  opacity: 0;
  transform: scale(0.7) rotate(-4deg);
  background:
    radial-gradient(circle at 27% 24%, rgba(255, 255, 255, 0.62), transparent 22%),
    radial-gradient(circle at 70% 60%, var(--jam-light), transparent 24%),
    linear-gradient(145deg, var(--jam-light), var(--jam-color) 48%, var(--jam-deep));
  box-shadow:
    inset 0 7px 11px rgba(255, 255, 255, 0.28),
    inset 0 -10px 16px rgba(49, 10, 18, 0.22),
    0 8px 16px var(--jam-glow);
  transition: opacity 220ms ease, transform 220ms ease;
}

.toast-zone.is-spread .toast-spread {
  opacity: 0.95;
  transform: scale(1) rotate(-4deg);
}

.taste-spoon {
  position: absolute;
  left: 43%;
  top: 53%;
  width: 148px;
  transform: rotate(-18deg);
  filter: drop-shadow(0 18px 18px rgba(39, 31, 20, 0.12));
  cursor: grab;
  touch-action: none;
}

.taste-spoon img {
  width: 100%;
  pointer-events: none;
}

.taste-spoon.is-floating {
  position: fixed;
  z-index: 90;
  margin: 0;
  pointer-events: none;
  cursor: grabbing;
}

.spoon-jam {
  position: absolute;
  left: 16%;
  top: 19%;
  width: 42px;
  height: 27px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 23%, rgba(255, 255, 255, 0.6), transparent 24%),
    linear-gradient(145deg, var(--jam-light), var(--jam-color), var(--jam-deep));
  opacity: 0;
  transform: translate(-20px, -8px) rotate(-18deg);
  box-shadow: inset 0 -5px 8px rgba(45, 10, 18, 0.28), 0 7px 14px var(--jam-glow);
  transition: opacity 180ms ease;
}

.taste-spoon.loaded .spoon-jam {
  opacity: 1;
}

.status-strip {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  text-align: center;
  font-size: 0.92rem;
}

.memory-panel {
  display: grid;
  align-content: center;
  gap: 14px;
  min-height: 620px;
}

.memory-reveal {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 260ms ease, transform 260ms ease;
}

.memory-reveal.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.memory-reveal h2 {
  font-size: clamp(1.8rem, 4vw, 3rem);
  line-height: 0.95;
}

.memory-date {
  margin: 10px 0 16px;
  font-size: 0.92rem;
}

.memory-copy {
  margin: 0;
  font-size: 1rem;
}

.bite-note {
  min-height: 28px;
  margin: 0;
  opacity: 0;
  transition: opacity 220ms ease;
}

.bite-note.is-visible {
  opacity: 1;
}

@keyframes swirl {
  to {
    transform: rotate(360deg);
  }
}

@keyframes fruitDrop {
  0% {
    transform: translate(0, -22px) scale(0.55);
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  100% {
    transform: translate(var(--drop-drift, 0px), 320px) scale(0.86);
    opacity: 0;
  }
}

@keyframes noteDrop {
  0% {
    transform: translateY(-28px) rotate(-8deg) scale(0.82);
    opacity: 0;
  }
  24% {
    opacity: 1;
  }
  100% {
    transform: translate(12px, 300px) rotate(12deg) scale(0.92);
    opacity: 0;
  }
}

@media (max-width: 980px) {
  .intro-card,
  .maker-grid,
  .finish-grid,
  .taste-layout {
    grid-template-columns: 1fr;
  }

  .taste-panel,
  .memory-panel {
    min-height: unset;
  }

  .shelf-grid {
    grid-template-columns: repeat(3, minmax(88px, 1fr));
  }

  .placement-tray {
    grid-template-columns: 1fr;
  }

  .preview-jar img,
  .open-jar img {
    width: min(220px, 52vw);
  }
}

@media (max-width: 640px) {
  .screen {
    padding: 16px 12px;
  }

  .app-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .button-row,
  .shelf-actions {
    width: 100%;
  }

  .warm-button,
  .ghost-button,
  .danger-button {
    width: 100%;
  }

  .jam-tabs {
    grid-template-columns: 1fr;
  }

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

  .pot-stage {
    min-height: 420px;
  }

  .mix-bowl {
    width: min(390px, 92vw);
  }

  .stir-spoon {
    width: 130px;
    right: 0;
    bottom: 20%;
  }

  .progress-copy {
    display: grid;
  }

  .taste-stage {
    min-height: 500px;
  }

  .toast-zone {
    width: min(240px, 58vw);
    right: 2%;
  }

  .open-jar {
    left: 2%;
    bottom: 24%;
  }

  .taste-spoon {
    width: 124px;
    left: 38%;
    top: 46%;
  }

  .shelf-grid {
    gap: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}
