:root {
  --ink: #302016;
  --muted: #7e6553;
  --cream: #fff5cf;
  --milk: #fffdf4;
  --red: #e94a35;
  --blue: #2878be;
  --yellow: #ffd34e;
  --line: rgba(92, 62, 31, 0.16);
  --shadow: 0 18px 45px rgba(77, 45, 19, 0.22);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", Arial, sans-serif;
  background: #efe3ca;
}

button {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
  background:
    linear-gradient(135deg, rgba(255, 210, 79, 0.36), rgba(40, 120, 190, 0.2)),
    #f4e7cf;
}

.phone-frame {
  width: min(100vw, 430px);
  height: min(100vh, 932px);
  aspect-ratio: 9 / 16;
  max-height: calc(100vh - 32px);
  border-radius: 30px;
  overflow: hidden;
  box-shadow: 0 28px 80px rgba(40, 26, 9, 0.34);
  background: var(--cream);
}

.scene {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  isolation: isolate;
}

.desk-bg,
.warm-vignette,
.screen {
  position: absolute;
  inset: 0;
}

.desk-bg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scale(1.02);
}

.warm-vignette {
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 36%, rgba(255, 255, 246, 0.38), transparent 38%),
    linear-gradient(to bottom, rgba(255, 247, 214, 0.18), rgba(90, 43, 11, 0.1));
  z-index: 1;
}

.screen {
  z-index: 2;
  display: none;
  padding: clamp(22px, 7vw, 34px);
}

.screen.is-active {
  display: block;
  animation: fadeIn 420ms ease both;
}

.brand-chip,
.eyebrow {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 28px;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255, 253, 244, 0.82);
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  box-shadow: 0 4px 14px rgba(107, 65, 20, 0.12);
}

.cover-copy {
  position: absolute;
  left: clamp(24px, 8vw, 36px);
  right: clamp(24px, 8vw, 36px);
  top: 18%;
}

.cover-copy h1,
.top-copy h2,
.reveal-card h2,
.result-card h2,
.brand-finale h2 {
  margin: 12px 0 10px;
  font-size: clamp(32px, 9vw, 46px);
  line-height: 1.04;
  letter-spacing: 0;
}

.cover-copy p,
.top-copy p,
.reveal-card p,
.result-card p,
.brand-finale p {
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.65;
}

.bottle-button {
  position: absolute;
  left: 50%;
  bottom: 7.5%;
  transform: translateX(-50%);
  width: 158px;
  height: 158px;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background:
    radial-gradient(circle at 35% 26%, rgba(255, 255, 255, 0.68), transparent 20%),
    linear-gradient(135deg, var(--red), #ff8b43);
  box-shadow: 0 18px 36px rgba(196, 53, 38, 0.32);
  font-weight: 900;
  cursor: pointer;
}

.bottle-button > span:last-child {
  position: absolute;
  inset-inline: 0;
  bottom: 16px;
  font-size: 18px;
  line-height: 1;
}

.bottle-button .milk-bottle {
  transform: scale(.82);
  transform-origin: top center;
  margin-top: 9px;
}

.milk-bottle {
  position: relative;
  display: block;
  width: 56px;
  height: 98px;
  margin: 12px auto 0;
  border: 4px solid #2e7cc1;
  border-radius: 18px 18px 14px 14px;
  background:
    linear-gradient(90deg, rgba(255,255,255,.58), transparent 38%),
    linear-gradient(#fff8d8 0 18%, #fffef2 18% 100%);
  box-shadow: inset 0 -12px 0 rgba(255, 211, 78, 0.32);
}

.milk-bottle .cap {
  position: absolute;
  left: 14px;
  top: -13px;
  width: 28px;
  height: 14px;
  border-radius: 8px 8px 4px 4px;
  background: var(--blue);
}

.milk-bottle .label {
  position: absolute;
  left: 7px;
  right: 7px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 900;
}

.milk-bottle .label-top {
  top: 26px;
  height: 24px;
  border-radius: 8px 8px 0 0;
  background: var(--red);
  font-size: 15px;
}

.milk-bottle .label-bottom {
  top: 50px;
  height: 23px;
  border-radius: 0 0 8px 8px;
  background: var(--yellow);
  color: #284a7a;
  font-size: 12px;
}

.milk-bottle .straw {
  position: absolute;
  width: 7px;
  height: 72px;
  right: -12px;
  top: -22px;
  border-radius: 999px;
  background: repeating-linear-gradient(145deg, #fff 0 8px, var(--red) 8px 16px);
  transform: rotate(-14deg);
}

.top-copy {
  position: absolute;
  top: 11%;
  left: 26px;
  right: 26px;
  text-align: center;
  padding: 16px 14px 18px;
  border-radius: 24px;
  background: rgba(255, 253, 244, 0.58);
  backdrop-filter: blur(2px);
}

.top-copy.compact {
  top: 5%;
}

.top-copy h2 {
  font-size: clamp(28px, 8vw, 38px);
}

.drawer-track {
  position: absolute;
  left: 26px;
  right: 26px;
  bottom: 17%;
  height: 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: inset 0 0 0 1px var(--line);
}

.drawer-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--yellow), var(--red));
}

.drawer-handle {
  position: absolute;
  left: 50%;
  bottom: 9%;
  transform: translateX(-50%);
  width: 132px;
  height: 56px;
  border-radius: 26px;
  border: 3px solid rgba(84, 51, 26, 0.78);
  background: linear-gradient(#8c5b33, #5a331e);
  display: grid;
  place-items: center;
  touch-action: none;
  cursor: grab;
  box-shadow: var(--shadow);
}

.drawer-handle span {
  width: 82px;
  height: 18px;
  border: 3px solid #d6b17b;
  border-top: 0;
  border-radius: 0 0 18px 18px;
}

.drawer-handle:active {
  cursor: grabbing;
}

.drag-hint {
  position: absolute;
  left: 50%;
  bottom: 22%;
  transform: translateX(-50%);
  margin: 0;
  width: max-content;
  max-width: calc(100% - 48px);
  padding: 7px 13px;
  border-radius: 999px;
  background: rgba(255, 253, 244, 0.76);
  text-align: center;
  color: #6c4a2a;
  font-size: 13px;
  font-weight: 800;
  box-shadow: 0 6px 16px rgba(94, 55, 22, 0.12);
}

.editor-copy {
  padding: 12px 14px 14px;
}

.editor-copy h2 {
  font-size: clamp(24px, 7vw, 32px);
}

.ticket-editor {
  position: absolute;
  left: 18px;
  right: 18px;
  top: 23%;
  bottom: 3%;
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto auto;
  gap: 10px;
}

.ticket-card {
  position: relative;
  overflow: hidden;
  min-height: 320px;
  border-radius: 30px;
  border: 3px solid rgba(233, 74, 53, 0.2);
  background:
    linear-gradient(90deg, transparent 0 calc(100% - 92px), rgba(233, 74, 53, 0.1) calc(100% - 92px)),
    radial-gradient(circle at 16% 22%, rgba(255, 211, 78, 0.28), transparent 26%),
    linear-gradient(180deg, rgba(255, 253, 244, 0.98), rgba(255, 247, 214, 0.98));
  box-shadow: var(--shadow);
  touch-action: none;
}

.ticket-card::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  right: 92px;
  border-left: 2px dashed rgba(126, 101, 83, 0.24);
}

.ticket-hole {
  position: absolute;
  top: 50%;
  z-index: 2;
  width: 28px;
  height: 42px;
  border-radius: 999px;
  background: rgba(245, 229, 200, 0.96);
}

.ticket-hole.left {
  left: -14px;
}

.ticket-hole.right {
  right: -14px;
}

.ticket-head {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 20px 20px 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.ticket-head strong {
  color: var(--red);
}

.ticket-card h3 {
  position: relative;
  z-index: 1;
  margin: 20px 20px 8px;
  font-size: clamp(34px, 10vw, 50px);
  line-height: 1;
  letter-spacing: 0;
}

.ticket-card p {
  position: relative;
  z-index: 1;
  margin: 0 20px;
  color: var(--muted);
  font-size: 15px;
  font-weight: 800;
}

.ticket-code {
  position: absolute;
  left: 20px;
  bottom: 22px;
  z-index: 1;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(48, 32, 22, 0.08);
  color: rgba(48, 32, 22, 0.62);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .08em;
}

.ticket-bottle {
  position: absolute;
  right: 24px;
  bottom: 24px;
  z-index: 1;
  transform: scale(.9) rotate(4deg);
  margin: 0;
}

.sticker-layer {
  position: absolute;
  inset: 0;
  z-index: 4;
}

.placed-sticker {
  position: absolute;
  width: 78px;
  height: 78px;
  border: 0;
  padding: 0;
  border-radius: 18px;
  background: transparent;
  cursor: grab;
  touch-action: none;
  filter: drop-shadow(0 8px 12px rgba(80, 45, 17, 0.2));
}

.placed-sticker .item {
  width: 100%;
  height: 100%;
}

.placed-sticker.is-dragging {
  z-index: 8;
  cursor: grabbing;
  filter: drop-shadow(0 14px 20px rgba(80, 45, 17, 0.28));
}

.editor-tip {
  margin: 0;
  text-align: center;
  color: #6c4a2a;
  font-size: 12px;
  font-weight: 800;
}

.sticker-tray {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  padding: 10px;
  border-radius: 22px;
  background: rgba(255, 253, 244, 0.82);
  box-shadow: 0 10px 28px rgba(97, 58, 20, 0.14);
}

.sticker-tray button {
  display: grid;
  place-items: center;
  min-width: 0;
  aspect-ratio: 1;
  border: 2px solid rgba(91, 58, 26, 0.12);
  border-radius: 16px;
  background: #fffdf4;
}

.sticker-tray .item {
  width: min(50px, 11vw);
  height: min(50px, 11vw);
}

.finish-ticket {
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(233, 74, 53, .24);
}

.finish-ticket:disabled {
  background: rgba(126, 101, 83, 0.34);
  box-shadow: none;
}

.item {
  width: 66px;
  height: 66px;
  display: block;
}

.item-flower {
  border-radius: 50%;
  background:
    radial-gradient(circle, #fff 0 18%, transparent 19%),
    conic-gradient(from 18deg, #e94a35 0 16%, #ff8e70 16% 32%, #e94a35 32% 48%, #ff8e70 48% 64%, #e94a35 64% 80%, #ff8e70 80% 100%);
  box-shadow: inset 0 0 0 7px rgba(255,255,255,.28);
}

.item-marble {
  border-radius: 50%;
  background:
    radial-gradient(circle at 31% 27%, rgba(255,255,255,.9), transparent 16%),
    radial-gradient(circle at 65% 70%, #ffd34e, transparent 22%),
    linear-gradient(135deg, #71b5e8, #2e7cc1);
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.52), 0 8px 20px rgba(40,120,190,.24);
}

.item-notebook {
  border-radius: 12px;
  background:
    linear-gradient(90deg, #e94a35 0 12px, transparent 12px),
    repeating-linear-gradient(#fff9df 0 13px, #b9d8ec 13px 15px);
  border: 3px solid #2e7cc1;
  transform: rotate(-4deg);
}

.item-heart {
  position: relative;
  transform: rotate(-45deg) scale(.78);
  border-radius: 12px;
  background: var(--red);
}

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

.item-heart::before {
  top: -50%;
  left: 0;
}

.item-heart::after {
  left: 50%;
  top: 0;
}

.item-star {
  clip-path: polygon(50% 3%, 61% 36%, 96% 36%, 68% 56%, 79% 91%, 50% 70%, 21% 91%, 32% 56%, 4% 36%, 39% 36%);
  background: linear-gradient(135deg, #ffd34e, #ff8b43);
  box-shadow: inset 0 0 0 8px rgba(255,255,255,.28);
}

.reveal-card,
.brand-finale {
  position: absolute;
  left: 24px;
  right: 24px;
  top: 50%;
  transform: translateY(-50%);
  padding: 30px 24px;
  border-radius: 28px;
  background: rgba(255, 253, 244, 0.91);
  box-shadow: var(--shadow);
  text-align: center;
}

.sparkles {
  width: 104px;
  height: 104px;
  margin: 0 auto 12px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, var(--yellow) 0 18%, transparent 19%),
    radial-gradient(circle at 26% 24%, var(--red) 0 7%, transparent 8%),
    radial-gradient(circle at 78% 35%, var(--blue) 0 8%, transparent 9%),
    radial-gradient(circle at 34% 78%, #ff8e70 0 8%, transparent 9%);
  animation: spin 2.2s linear infinite;
}

.result-card {
  position: absolute;
  left: 24px;
  right: 24px;
  top: 7%;
  min-height: auto;
  padding: 22px;
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 247, 213, .96), rgba(255, 253, 244, .96)),
    var(--milk);
  box-shadow: var(--shadow);
  text-align: center;
  border: 2px solid rgba(233, 74, 53, 0.16);
}

.card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 800;
}

.card-top p {
  margin: 0;
}

.card-top span {
  color: var(--red);
}

.result-visual {
  position: relative;
  height: 210px;
  margin: 12px 0 10px;
}

.chosen-item {
  position: absolute;
  left: 22%;
  top: 30px;
  transform: rotate(-9deg);
}

.result-stickers {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.result-stickers .placed-sticker {
  width: 54px;
  height: 54px;
  cursor: default;
  filter: drop-shadow(0 6px 10px rgba(80, 45, 17, 0.16));
}

.result-bottle {
  position: absolute;
  right: 18px;
  bottom: 16px;
  z-index: 2;
  transform: scale(.72) rotate(4deg);
  margin: 0;
}

.result-postcard {
  position: relative;
  width: min(250px, 78%);
  height: 100%;
  margin: 0 auto;
  overflow: hidden;
  border-radius: 22px;
  border: 2px solid rgba(233, 74, 53, 0.18);
  background:
    linear-gradient(90deg, transparent 0 calc(100% - 68px), rgba(233, 74, 53, 0.1) calc(100% - 68px)),
    linear-gradient(180deg, rgba(255, 253, 244, .98), rgba(255, 247, 214, .98));
}

.result-postcard::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  right: 68px;
  border-left: 2px dashed rgba(126, 101, 83, 0.2);
}

.result-postcard-head {
  position: relative;
  z-index: 1;
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
}

.result-postcard-head strong {
  color: var(--red);
}

.result-postcard-title {
  position: relative;
  z-index: 1;
  margin: 14px 14px 0;
  max-width: calc(100% - 84px);
  color: rgba(48, 32, 22, .9);
  font-size: 22px;
  line-height: 1;
  font-weight: 900;
  text-align: left;
}

.result-card h2 {
  font-size: clamp(24px, 6.4vw, 31px);
  margin-top: 0;
}

.sweet-meter {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  margin-top: 18px;
  font-size: 13px;
  font-weight: 900;
}

.sweet-meter div {
  height: 12px;
  border-radius: 999px;
  background: rgba(126, 101, 83, .16);
  overflow: hidden;
}

.sweet-meter i {
  display: block;
  width: 92%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--yellow), var(--red));
}

.slogan {
  margin-top: 18px !important;
  margin-bottom: 0 !important;
  color: var(--red) !important;
  font-weight: 900;
}

.actions {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 4.5%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.actions button,
.brand-finale button {
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-weight: 900;
  box-shadow: 0 10px 24px rgba(233, 74, 53, .24);
}

.actions button + button,
.brand-finale button {
  background: var(--blue);
}

.brand-finale {
  padding-top: 26px;
}

.final-bottle {
  transform: scale(1.25);
  margin-bottom: 28px;
}

.brand-finale h2 {
  color: var(--red);
  font-size: clamp(30px, 8vw, 42px);
}

.brand-finale button {
  width: 100%;
  margin-top: 22px;
}

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

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

@media (max-width: 520px) {
  .app-shell {
    padding: 0;
    background: var(--cream);
  }

  .phone-frame {
    width: 100vw;
    height: 100vh;
    max-height: none;
    border-radius: 0;
    box-shadow: none;
  }
}

@media (max-height: 720px) {
  .pick-grid {
    gap: 10px;
  }

  .memory-card {
    min-height: 98px;
    padding: 14px 16px;
  }

  .result-card {
    top: 4%;
    min-height: 70%;
    padding: 18px;
  }

  .result-visual {
    height: 124px;
  }
}
