:root {
  color-scheme: light;
  --bg-1: #fbece2;
  --bg-2: #f3d6cf;
  --bg-3: #e6c9d6;
  --ink: #2c1d1a;
  --ink-soft: #6b4a44;
  --muted: #957a73;
  --line: rgba(60, 30, 25, 0.08);
  --card: rgba(255, 252, 249, 0.72);
  --card-strong: rgba(255, 252, 249, 0.92);
  --accent: #c75a3b;
  --accent-deep: #8a3a23;
  --accent-soft: rgba(199, 90, 59, 0.12);
  --shadow-sm: 0 1px 2px rgba(60, 30, 25, 0.04),
    0 6px 18px rgba(60, 30, 25, 0.06);
  --shadow-lg: 0 20px 50px rgba(80, 35, 25, 0.14);
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  color: var(--ink);
  background: linear-gradient(160deg, var(--bg-1) 0%, var(--bg-2) 55%, var(--bg-3) 100%);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}

.aurora {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.blob {
  position: absolute;
  border-radius: 999px;
  filter: blur(60px);
  opacity: 0.55;
  will-change: transform;
}
.blob-a {
  width: 22rem; height: 22rem;
  top: -6rem; left: -5rem;
  background: #ffd9c0;
  animation: drift 18s ease-in-out infinite alternate;
}
.blob-b {
  width: 26rem; height: 26rem;
  bottom: -10rem; right: -8rem;
  background: #f1b6c7;
  animation: drift 22s ease-in-out infinite alternate-reverse;
}
.blob-c {
  width: 16rem; height: 16rem;
  top: 40%; right: 20%;
  background: #ffe5b4;
  opacity: 0.4;
  animation: drift 26s ease-in-out infinite alternate;
}
@keyframes drift {
  from { transform: translate3d(0,0,0) scale(1); }
  to   { transform: translate3d(2rem, 1.5rem, 0) scale(1.08); }
}

.page {
  position: relative;
  z-index: 1;
  max-width: 560px;
  margin: 0 auto;
  padding: max(1.25rem, env(safe-area-inset-top)) 1.25rem
           max(2rem, env(safe-area-inset-bottom)) 1.25rem;
  display: grid;
  gap: 1.25rem;
}

.intro {
  padding: 2.25rem 0.25rem 0.5rem;
  text-align: left;
  animation: fade-up 700ms ease both;
}
.kicker {
  margin: 0 0 0.9rem;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent-deep);
  font-weight: 500;
}
h1 {
  margin: 0;
  font-family: "Fraunces", "Times New Roman", serif;
  font-weight: 400;
  font-size: clamp(2.4rem, 9vw, 3.4rem);
  line-height: 1.05;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.lead {
  margin: 1.1rem 0 0;
  color: var(--ink-soft);
  font-size: 1.02rem;
  line-height: 1.6;
  max-width: 32rem;
}

.card {
  position: relative;
  padding: 1.25rem 1.1rem 1.1rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow-sm);
  animation: fade-up 700ms ease both;
  animation-delay: 80ms;
}
.emoji-card { animation-delay: 160ms; }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
}
h2 {
  margin: 0;
  font-family: "Fraunces", serif;
  font-weight: 500;
  font-size: 1.15rem;
  letter-spacing: -0.005em;
  color: var(--ink);
}

.chip {
  font-size: 0.7rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.35rem 0.6rem;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-deep);
}
.chip.soft {
  background: rgba(149, 122, 115, 0.12);
  color: var(--muted);
}
.chip.is-on {
  background: rgba(80, 145, 95, 0.14);
  color: #2f6b3d;
}

textarea {
  width: 100%;
  resize: none;
  min-height: 9.5rem;
  padding: 1rem 1.05rem;
  font: inherit;
  font-size: 1.02rem;
  line-height: 1.55;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  outline: none;
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}
textarea::placeholder { color: #b29a93; }
textarea:focus {
  border-color: rgba(199, 90, 59, 0.55);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 0 0 4px rgba(199, 90, 59, 0.1);
}

.meter {
  display: flex;
  justify-content: flex-end;
  align-items: baseline;
  gap: 0.25rem;
  margin-top: 0.55rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}
.meter-sep { opacity: 0.5; }

.primary {
  margin-top: 1rem;
  width: 100%;
  min-height: 3rem;
  border: 0;
  border-radius: 999px;
  padding: 0.95rem 1.1rem;
  font: inherit;
  font-weight: 600;
  font-size: 1rem;
  color: #fff8f3;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  box-shadow: 0 10px 22px rgba(138, 58, 35, 0.25);
  cursor: pointer;
  transition: transform 140ms ease, box-shadow 140ms ease, filter 140ms ease;
}
.primary:hover { transform: translateY(-1px); }
.primary:active { transform: translateY(0); filter: brightness(0.97); }
.primary:disabled,
.primary.is-done {
  background: rgba(80, 145, 95, 0.9);
  box-shadow: none;
  cursor: default;
  transform: none;
}

.hint {
  margin: 0 0 0.85rem;
  color: var(--ink-soft);
  font-size: 0.95rem;
}
.emoji-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.55rem;
}
.emoji {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.75);
  border-radius: var(--radius-md);
  min-height: 3.4rem;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  transition: transform 140ms ease, border-color 140ms ease,
    background 140ms ease, box-shadow 140ms ease;
}
.emoji:hover { transform: translateY(-2px); }
.emoji:active { transform: translateY(0) scale(0.96); }
.emoji.is-selected {
  border-color: rgba(199, 90, 59, 0.75);
  background: rgba(255, 230, 218, 0.95);
  box-shadow: 0 6px 16px rgba(199, 90, 59, 0.18);
}

.sign-off {
  margin: 0.5rem 0 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.92rem;
  font-style: italic;
  animation: fade-up 700ms ease both;
  animation-delay: 240ms;
}
.sign-off p { margin: 0; }

.toast {
  position: fixed;
  left: 50%;
  bottom: max(1.25rem, env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(1.5rem);
  background: rgba(44, 29, 26, 0.92);
  color: #fff8f3;
  padding: 0.7rem 1.05rem;
  border-radius: 999px;
  font-size: 0.9rem;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  transition: opacity 220ms ease, transform 220ms ease;
  z-index: 10;
  pointer-events: none;
}
.toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0);
  white-space: nowrap; border: 0;
}

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

@media (prefers-reduced-motion: reduce) {
  .blob, .intro, .card, .sign-off { animation: none !important; }
}

@media (max-width: 380px) {
  .page { padding-left: 1rem; padding-right: 1rem; }
  .card { padding: 1.05rem 0.95rem; }
  .emoji { min-height: 3rem; font-size: 1.45rem; }
  .emoji-grid { gap: 0.45rem; }
}

@media (min-width: 720px) {
  .page { padding-top: 3rem; gap: 1.5rem; }
  .intro { padding-top: 2.5rem; }
  .card { padding: 1.6rem 1.5rem; }
  textarea { min-height: 11rem; padding: 1.1rem 1.2rem; }
  .emoji { min-height: 3.8rem; font-size: 1.75rem; }
}
