:root {
  --ink: #3c2924;
  --muted: #8d6d64;
  --rose: #c85b4c;
  --rose-deep: #a84336;
  --cream: #fffaf6;
  --line: rgba(80, 42, 32, 0.1);
  --shadow: 0 16px 40px rgba(120, 62, 40, 0.08);
  --font: "Outfit", "Avenir Next", "Segoe UI", sans-serif;
  --serif: "Fraunces", "Iowan Old Style", Palatino, serif;
}

* { box-sizing: border-box; }

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

body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(900px 500px at 10% -10%, #ffe7c7 0%, transparent 60%),
    radial-gradient(800px 520px at 110% 10%, #f8d5dc 0%, transparent 55%),
    radial-gradient(700px 500px at 50% 120%, #f3ddc8 0%, transparent 50%),
    #f7efe8;
}

.sky {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(8px);
  opacity: 0.7;
}

.blob-a {
  width: 220px;
  height: 220px;
  left: -40px;
  top: 12%;
  background: #ffd7b8;
  animation: drift 14s ease-in-out infinite;
}

.blob-b {
  width: 180px;
  height: 180px;
  right: -30px;
  top: 28%;
  background: #f6c9d2;
  animation: drift 18s ease-in-out infinite reverse;
}

.blob-c {
  width: 260px;
  height: 160px;
  left: 20%;
  bottom: -40px;
  background: #ffe8c4;
  animation: drift 16s ease-in-out infinite;
}

.device {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding:
    max(22px, env(safe-area-inset-top))
    22px
    max(28px, env(safe-area-inset-bottom));
}

.top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-bottom: 8px;
}

.mark {
  width: 36px;
  height: 36px;
}

.wordmark {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: #b06a58;
}

.screen {
  display: none;
  flex: 1;
  flex-direction: column;
  justify-content: center;
  gap: 28px;
  width: min(100%, 460px);
  margin: 0 auto;
  animation: rise 0.45s ease;
}

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

.screen-logs {
  justify-content: flex-start;
  gap: 16px;
}

.log-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 62vh;
  overflow: auto;
}

.log-card {
  margin: 0;
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(255, 252, 249, 0.92);
  box-shadow: var(--shadow);
}

.log-card h2 {
  margin: 0 0 6px;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0;
}

.log-card p,
.log-card li {
  margin: 4px 0;
  font-size: 0.95rem;
  line-height: 1.35;
}

.log-time {
  color: var(--muted);
  font-size: 0.82rem;
}

.log-card ol {
  margin: 8px 0 0;
  padding-left: 1.1rem;
}

.copy h1,
.copy h2,
.lead,
.message {
  font-family: var(--serif);
  font-weight: 560;
  letter-spacing: -0.03em;
}

.copy h1,
.copy h2 {
  margin: 0;
  line-height: 1.18;
}

.copy h1 {
  font-size: clamp(2rem, 7vw, 2.7rem);
}

.copy h2 {
  font-size: clamp(1.65rem, 4.8vw, 2.05rem);
  line-height: 1.25;
}

.copy h2.is-long {
  font-size: clamp(1.28rem, 3.6vw, 1.48rem);
  line-height: 1.32;
}

.hint,
.kicker {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.45;
}

.kicker {
  margin: 0 0 10px;
  font-family: var(--font);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #c47b68;
}

form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 600;
}

input {
  width: 100%;
  border: 1.5px solid transparent;
  background: rgba(255, 252, 249, 0.9);
  color: var(--ink);
  border-radius: 18px;
  padding: 16px 18px;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 500;
  box-shadow: var(--shadow);
  outline: none;
}

input::placeholder { color: #c3aaa2; }

input:focus {
  border-color: #e7b19a;
  background: #fff;
}

.error {
  margin: 0;
  color: var(--rose-deep);
  font-size: 0.92rem;
}

.btn {
  appearance: none;
  border: 0;
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  letter-spacing: 0.04em;
  border-radius: 999px;
  padding: 16px 22px;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  color: white;
  background: linear-gradient(180deg, #e07a68 0%, #c85b4c 100%);
  box-shadow: 0 12px 24px rgba(200, 91, 76, 0.28);
}

.btn-primary:hover { background: linear-gradient(180deg, #e58674 0%, #b84e40 100%); }

.btn-ghost,
.btn-back {
  color: #8d5c50;
  background: transparent;
}

.btn-back {
  align-self: center;
  padding: 8px 12px;
}

.screen-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.lead {
  margin: 0;
  font-size: clamp(1.7rem, 5.4vw, 2.15rem);
  line-height: 1.28;
}

.lead strong {
  font-style: italic;
  font-weight: 680;
  color: #c85b4c;
}

.choices {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.choice {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  width: 100%;
  text-align: left;
  padding: 16px 16px;
  border-radius: 22px;
  border: 1.5px solid var(--line);
  background: rgba(255, 252, 249, 0.92);
  color: var(--ink);
  box-shadow: var(--shadow);
  cursor: pointer;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 500;
  line-height: 1.35;
}

.choice:hover { border-color: #efc2b2; }

.choice .key {
  flex: none;
  width: 38px;
  height: 38px;
  margin-top: 1px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fde8df;
  color: var(--rose-deep);
  font-weight: 600;
}

.note {
  background: rgba(255, 252, 249, 0.78);
  border-radius: 28px;
  padding: 28px 24px;
  box-shadow: var(--shadow);
}

.message {
  margin: 0;
  font-size: clamp(1.45rem, 4.6vw, 1.85rem);
  line-height: 1.35;
}

.tone-sun .note { background: rgba(255, 248, 236, 0.9); }
.tone-moon .note { background: rgba(255, 246, 248, 0.92); }

.cartoon {
  width: 100%;
}

.cartoon[hidden],
.scene[hidden] {
  display: none;
}

.scene {
  display: block;
  width: 100%;
  height: auto;
}

.man { transform: translate(52px, 146px); }
.woman { transform: translate(308px, 146px); }
.faller { transform: translate(40px, 146px); }
.hearts,
.hug-hearts { opacity: 0; }

.scene .ground,
.scene .hair,
.scene .head,
.scene .nose,
.scene .smile,
.scene .eye-arc,
.scene .neck,
.scene .torso,
.scene .dress,
.scene .bust,
.scene .hug-arm,
.scene line {
  fill: none;
  stroke: #fffaf6;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.scene .head { fill: rgba(255, 250, 246, 0.16); }
.scene .dress { fill: rgba(255, 250, 246, 0.2); }
.scene .bust { fill: none; }
.scene .only-hearts path { fill: #fffaf6; stroke: none; }
.scene .torso { fill: rgba(255, 250, 246, 0.12); }
.scene .eye { fill: #fffaf6; stroke: none; }
.scene .hearts path,
.scene .hug-hearts path { fill: #fffaf6; stroke: none; }

.leg,
.arm,
.fore,
.shin {
  transform-box: fill-box;
  transform-origin: top center;
}

.scene-good.is-playing .bob { animation: bob-stop 3.4s ease-in-out forwards; }
.scene-bad.is-playing .bob { animation: fall-bob 4.8s linear infinite; }

.scene-good.is-playing .leg-a,
.scene-good.is-playing .arm-b { animation: step-stop 3.4s ease-in-out forwards; }
.scene-good.is-playing .leg-b,
.scene-good.is-playing .arm-a { animation: step-stop-alt 3.4s ease-in-out forwards; }
.scene-good.is-playing .shin,
.scene-good.is-playing .fore { animation: bend-stop 3.4s ease-in-out forwards; }

.scene-bad.is-playing .leg-a,
.scene-bad.is-playing .arm-b { animation: fall-thigh 4.8s linear infinite; }
.scene-bad.is-playing .leg-b,
.scene-bad.is-playing .arm-a { animation: fall-thigh-alt 4.8s linear infinite; }
.scene-bad.is-playing .shin,
.scene-bad.is-playing .fore { animation: fall-bend 4.8s linear infinite; }

.scene-good.is-playing .man { animation: meet-man 3.4s ease-in-out forwards; }
.scene-good.is-playing .woman { animation: meet-woman 3.4s ease-in-out forwards; }
.scene-good.is-playing .hearts { animation: heart-arrive 3.4s ease-out forwards; }
.scene-good.is-playing .hearts path {
  transform-box: fill-box;
  transform-origin: center;
  animation: heart-pulse 1.25s ease-in-out 2.3s infinite;
}
.scene-hug.is-playing .embrace {
  transform-origin: 180px 96px;
  animation: sway 3.2s ease-in-out infinite;
}
.scene-hug.is-playing .hug-hearts { animation: hug-beat 1.35s ease-in-out infinite; }
.scene-hearts.is-playing .beat {
  transform-box: fill-box;
  transform-origin: center;
  animation: heart-pulse 1.15s ease-in-out infinite;
}
.scene-hearts.is-playing .only-hearts > g:nth-child(2) .beat { animation-delay: 0.18s; }
.scene-hearts.is-playing .only-hearts > g:nth-child(3) .beat { animation-delay: 0.36s; }
.scene-bad { overflow: hidden; border-radius: 22px; }
.scene-bad.is-playing .faller { animation: walk-fall 4.8s linear infinite; }

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3.5px); }
}

@keyframes bob-stop {
  0% { transform: translateY(0); }
  16% { transform: translateY(-3.5px); }
  32% { transform: translateY(0); }
  48% { transform: translateY(-3.5px); }
  64%, 100% { transform: translateY(0); }
}

@keyframes step-stop {
  0% { transform: rotate(-24deg); }
  16% { transform: rotate(22deg); }
  32% { transform: rotate(-24deg); }
  48% { transform: rotate(18deg); }
  64%, 100% { transform: rotate(0deg); }
}

@keyframes step-stop-alt {
  0% { transform: rotate(22deg); }
  16% { transform: rotate(-24deg); }
  32% { transform: rotate(22deg); }
  48% { transform: rotate(-16deg); }
  64%, 100% { transform: rotate(0deg); }
}

@keyframes bend-stop {
  0% { transform: rotate(10deg); }
  16% { transform: rotate(32deg); }
  32% { transform: rotate(8deg); }
  48% { transform: rotate(26deg); }
  64%, 100% { transform: rotate(2deg); }
}

@keyframes thigh {
  from { transform: rotate(-26deg); }
  to { transform: rotate(24deg); }
}

@keyframes bend {
  from { transform: rotate(6deg); }
  to { transform: rotate(34deg); }
}

@keyframes meet-man {
  0%, 6% { transform: translate(52px, 146px); }
  64%, 100% { transform: translate(156px, 146px); }
}

@keyframes meet-woman {
  0%, 6% { transform: translate(308px, 146px); }
  64%, 100% { transform: translate(214px, 146px); }
}

@keyframes heart-arrive {
  0%, 52% { opacity: 0; transform: translate(162px, 42px) scale(0.45); }
  70%, 100% { opacity: 1; transform: translate(162px, 34px) scale(1); }
}

@keyframes heart-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.16); }
}

@keyframes sway {
  0%, 100% { transform: rotate(-2.2deg); }
  50% { transform: rotate(2.2deg); }
}

@keyframes hug-beat {
  0%, 100% { opacity: 1; transform: translate(158px, 28px) scale(0.92); }
  50% { opacity: 1; transform: translate(158px, 24px) scale(1.12); }
}

@keyframes walk-fall {
  0% { transform: translate(32px, 146px); opacity: 1; }
  52.5% { transform: translate(258px, 146px); opacity: 1; }
  70% { transform: translate(258px, 146px); opacity: 1; }
  94% { transform: translate(258px, 300px); opacity: 1; }
  100% { transform: translate(258px, 340px); opacity: 0; }
}

@keyframes fall-bob {
  0%, 8.75%, 17.5%, 26.25%, 35%, 43.75%, 52.5%, 61.25%, 70%, 100% { transform: translateY(0); }
  4.4%, 13.1%, 21.9%, 30.6%, 39.4%, 48.1%, 56.9%, 65.6% { transform: translateY(-3.5px); }
}

@keyframes fall-thigh {
  0% { transform: rotate(-26deg); }
  8.75% { transform: rotate(24deg); }
  17.5% { transform: rotate(-26deg); }
  26.25% { transform: rotate(24deg); }
  35% { transform: rotate(-26deg); }
  43.75% { transform: rotate(24deg); }
  52.5% { transform: rotate(-26deg); }
  61.25% { transform: rotate(24deg); }
  70% { transform: rotate(-26deg); }
  78%, 100% { transform: rotate(0deg); }
}

@keyframes fall-thigh-alt {
  0% { transform: rotate(24deg); }
  8.75% { transform: rotate(-26deg); }
  17.5% { transform: rotate(24deg); }
  26.25% { transform: rotate(-26deg); }
  35% { transform: rotate(24deg); }
  43.75% { transform: rotate(-26deg); }
  52.5% { transform: rotate(24deg); }
  61.25% { transform: rotate(-26deg); }
  70% { transform: rotate(24deg); }
  78%, 100% { transform: rotate(0deg); }
}

@keyframes fall-bend {
  0%, 17.5%, 35%, 52.5%, 70% { transform: rotate(6deg); }
  8.75%, 26.25%, 43.75%, 61.25% { transform: rotate(34deg); }
  78%, 100% { transform: rotate(0deg); }
}

.noscript {
  position: relative;
  z-index: 2;
  max-width: 420px;
  margin: 24px auto;
  text-align: center;
}

@media (min-width: 800px) {
  body {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    min-height: 100vh;
    padding: 24px 0;
  }

  .device {
    width: min(440px, calc(100vw - 48px));
    min-height: min(820px, calc(100vh - 48px));
    height: auto;
    border-radius: 40px;
    overflow: visible;
    background: rgba(255, 250, 246, 0.72);
    box-shadow:
      0 30px 80px rgba(92, 48, 32, 0.16),
      inset 0 0 0 1px rgba(255, 255, 255, 0.7);
    backdrop-filter: blur(8px);
  }
}

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

@keyframes drift {
  50% { transform: translate3d(16px, -18px, 0) scale(1.06); }
}

@media (prefers-reduced-motion: reduce) {
  .screen, .blob { animation: none; }
  .btn { transition: none; }
  .man { transform: translate(156px, 146px); }
  .woman { transform: translate(214px, 146px); }
  .hearts { opacity: 1; transform: translate(162px, 34px); }
  .hug-hearts { opacity: 1; transform: translate(158px, 26px); }
  .faller { transform: translate(90px, 146px); }
  .leg, .arm, .fore, .shin, .bob, .man, .woman, .hearts, .hug-hearts, .faller, .embrace { animation: none; }
}

h1:focus,
h2:focus,
.lead:focus,
.message:focus {
  outline: none;
}

.btn:focus-visible,
.choice:focus-visible,
input:focus-visible {
  outline: 3px solid #f0b59a;
  outline-offset: 3px;
}
