@import url("https://fonts.googleapis.com/css2?family=Baloo+2:wght@500;700;800&family=Delius&display=swap");

:root {
  --bg: #fff8f1;
  --bg-soft: #fff2df;
  --paper: #fffdf8;
  --paper-warm: #fff9ef;
  --ink: #5b4637;
  --ink-soft: #836958;
  --line: #efd8b9;
  --line-strong: #e7c592;
  --peach: #ffbd8d;
  --peach-strong: #f39b67;
  --butter: #ffe28c;
  --mint: #dceecf;
  --sky: #cfe6ee;
  --rose: #f5c7bd;
  --accent: #f3a35f;
  --accent-pressed: #eb914a;
  --shadow: 0 10px 28px rgba(174, 124, 74, 0.15);
  color-scheme: light;
  font-family: "Baloo 2", "Trebuchet MS", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100svh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at 9% 8%, rgba(255, 226, 140, 0.28), transparent 30%),
    radial-gradient(circle at 91% 6%, rgba(207, 230, 238, 0.34), transparent 27%),
    radial-gradient(circle at 50% 100%, rgba(220, 238, 207, 0.36), transparent 34%),
    var(--bg);
}

button,
a {
  -webkit-tap-highlight-color: transparent;
  color: inherit;
}

button {
  font: inherit;
}

.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    linear-gradient(135deg, rgba(255, 189, 141, 0.15), transparent 38%),
    linear-gradient(315deg, rgba(220, 238, 207, 0.2), transparent 36%);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(100%, 560px);
  min-height: 66px;
  margin: 0 auto;
  padding: 12px 14px 8px;
  backdrop-filter: blur(14px);
}

.brand-button,
.nav-button,
.choice,
.primary-action,
.secondary-action,
.day,
.plate {
  border: 0;
  cursor: pointer;
}

.brand-button {
  display: grid;
  padding: 0;
  color: var(--ink);
  text-align: left;
  background: transparent;
}

.brand-button span {
  color: var(--ink-soft);
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1;
}

.brand-button strong {
  font-family: "Delius", "Comic Sans MS", cursive;
  font-size: 1.16rem;
  line-height: 1.05;
  letter-spacing: 0;
}

.nav-button {
  min-height: 38px;
  padding: 0 13px;
  border: 2px solid var(--line);
  border-radius: 999px;
  color: #a55f33;
  background: rgba(255, 253, 248, 0.78);
  font-size: 0.82rem;
  font-weight: 800;
  box-shadow: 0 8px 22px rgba(174, 124, 74, 0.1);
  transition:
    transform 140ms ease,
    background 140ms ease,
    border-color 140ms ease;
}

.nav-button:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  background: #fffaf2;
}

.app {
  width: min(100%, 560px);
  min-height: calc(100svh - 66px);
  margin: 0 auto;
  padding: 10px 14px max(22px, env(safe-area-inset-bottom));
}

.screen {
  min-height: calc(100svh - 98px);
  display: grid;
  align-items: center;
  animation: view-in 320ms ease both;
}

.chat-card {
  display: grid;
  gap: 0.85rem;
  width: 100%;
  padding: 1rem;
  border: 2px solid var(--line);
  border-radius: 1.45rem;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.home .chat-card,
.birthday .chat-card,
.reveal .chat-card {
  background: linear-gradient(180deg, #fffdf8, #fff7eb);
}

.xavier {
  display: grid;
  justify-items: center;
  gap: 8px;
  margin: 0;
}

.xavier img {
  width: clamp(176px, 52vw, 246px);
  aspect-ratio: 1;
  display: block;
  border: 2px solid #fff;
  border-radius: 1.45rem;
  background: #f9efe7;
  box-shadow: 0 10px 25px rgba(174, 124, 74, 0.14);
  object-fit: cover;
  animation: float-soft 3.2s ease-in-out infinite;
}

.xavier figcaption {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.happy img,
.gift img {
  animation: float-happy 2.5s ease-in-out infinite;
}

.thinking img {
  animation: float-thinking 3.4s ease-in-out infinite;
}

.message {
  display: grid;
  gap: 0.42rem;
  text-align: center;
}

.eyebrow {
  margin: 0;
  color: #c0773e;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin: 0;
}

.message h1,
.gift-card h2 {
  font-family: "Delius", "Comic Sans MS", cursive;
  letter-spacing: 0.01em;
}

.message h1 {
  font-size: clamp(1.72rem, 8vw, 2.42rem);
  line-height: 1.1;
}

.copy {
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.42;
}

.choices {
  display: grid;
  gap: 0.62rem;
}

.choices.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.choice {
  display: grid;
  gap: 0.2rem;
  min-height: 3rem;
  padding: 0.76rem 0.86rem;
  border: 2px solid var(--line);
  border-radius: 0.98rem;
  color: var(--ink);
  text-align: left;
  background: #fffaf2;
  box-shadow: 0 6px 14px rgba(224, 156, 86, 0.1);
  transition:
    transform 130ms ease,
    border-color 130ms ease,
    background-color 130ms ease,
    box-shadow 130ms ease;
}

.choice:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  background: #fff4e3;
  box-shadow: 0 9px 18px rgba(224, 156, 86, 0.14);
}

.choice strong {
  font-size: 1rem;
  line-height: 1.08;
}

.choice span {
  color: var(--ink-soft);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.18;
}

.choice:active,
.primary-action:active,
.secondary-action:active,
.plate:active,
.day.available:active {
  transform: translateY(0) scale(0.99);
}

.choice:focus-visible,
.primary-action:focus-visible,
.secondary-action:focus-visible,
.plate:focus-visible,
.day:focus-visible,
.brand-button:focus-visible,
.nav-button:focus-visible {
  outline: 2px solid #cc8f5a;
  outline-offset: 3px;
}

.actions {
  display: flex;
  justify-content: center;
}

.actions.stacked {
  display: grid;
  gap: 0.62rem;
}

.primary-action,
.secondary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.72rem 1rem;
  border-radius: 0.95rem;
  font-weight: 800;
  line-height: 1.1;
  text-align: center;
  text-decoration: none;
  transition:
    transform 130ms ease,
    box-shadow 130ms ease,
    background-color 130ms ease,
    border-color 130ms ease;
}

.primary-action {
  min-width: 11rem;
  border: 2px solid #eda762;
  color: #5b3e24;
  background: var(--peach);
  box-shadow: 0 6px 14px rgba(224, 156, 86, 0.28);
}

.primary-action:hover {
  transform: translateY(-1px);
  background: var(--accent);
}

.primary-action[disabled] {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
}

.secondary-action {
  border: 2px solid var(--line);
  color: #a55f33;
  background: #fffdf8;
}

.secondary-action:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  background: #fff7eb;
}

.calendar {
  display: grid;
  gap: 0.62rem;
  padding: 0.85rem;
  border: 2px solid var(--line);
  border-radius: 1.1rem;
  background: #fff9ee;
}

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

.calendar-head strong {
  font-size: 1.08rem;
}

.calendar-head span {
  padding: 0.36rem 0.68rem;
  border: 2px solid #f0d4a1;
  border-radius: 999px;
  color: #956025;
  background: #fff0c7;
  font-size: 0.82rem;
  font-weight: 800;
}

.weekdays,
.days {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.35rem;
}

.weekdays span {
  color: var(--ink-soft);
  font-size: 0.68rem;
  font-weight: 800;
  text-align: center;
}

.day {
  aspect-ratio: 1;
  border-radius: 0.72rem;
  color: rgba(91, 70, 55, 0.32);
  background: #fffdf8;
  font-weight: 800;
}

.day.empty {
  visibility: hidden;
}

.day.available {
  border: 2px solid #f0d4a1;
  color: #956025;
  background: #fff0c7;
}

.day.available:hover {
  transform: translateY(-1px);
  background: #ffe8a7;
}

.day.selected {
  color: #4e3927;
  background: var(--butter);
}

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

.plate {
  display: grid;
  justify-items: center;
  gap: 0.56rem;
  min-height: 6.9rem;
  padding: 0.78rem 0.5rem;
  border: 2px solid var(--line);
  border-radius: 1rem;
  color: var(--ink);
  background: #fffaf2;
  font-weight: 800;
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    background-color 140ms ease;
}

.plate:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  background: #fff5e8;
}

.cloche {
  position: relative;
  width: 58px;
  height: 42px;
}

.cloche::before {
  content: "";
  position: absolute;
  left: 7px;
  right: 7px;
  bottom: 5px;
  height: 11px;
  border-radius: 0 0 999px 999px;
  background: #b8d7df;
}

.cloche::after {
  content: "";
  position: absolute;
  left: 5px;
  right: 5px;
  top: 8px;
  height: 30px;
  border: 3px solid #8cb7c8;
  border-radius: 999px 999px 10px 10px;
  background: #e7f3f7;
  transform-origin: left bottom;
  transition: transform 240ms ease;
}

.cloche span {
  position: absolute;
  left: 8px;
  right: 8px;
  bottom: 5px;
  height: 18px;
  border-radius: 0 0 999px 999px;
  background:
    radial-gradient(circle at 25% 45%, #d85f54 0 8%, transparent 9%),
    radial-gradient(circle at 64% 46%, #9abf77 0 7%, transparent 8%),
    #efd16b;
  opacity: 0;
  transition: opacity 180ms ease;
}

.plate.revealed .cloche::after {
  transform: rotate(-24deg) translate(-4px, -7px);
}

.plate.revealed .cloche span {
  opacity: 1;
}

.poster-row,
.gift-panel {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 0.72rem;
  align-items: center;
  padding: 0.62rem;
  border: 2px solid var(--line);
  border-radius: 1.05rem;
  background: #fffaf2;
}

.poster-row img,
.gift-panel img {
  width: 92px;
  aspect-ratio: 1;
  border-radius: 0.86rem;
  object-fit: cover;
}

.poster-row span,
.gift-info {
  display: grid;
  gap: 0.15rem;
  font-weight: 800;
}

.gift-info span {
  color: var(--ink-soft);
  font-size: 0.88rem;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.46rem;
}

.chips span,
.thinking-lines span {
  padding: 0.46rem 0.7rem;
  border: 2px solid var(--line);
  border-radius: 999px;
  color: #956025;
  background: #fffaf2;
  font-size: 0.82rem;
  font-weight: 800;
}

.thinking-lines {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.46rem;
}

.thinking-lines span {
  opacity: 0.35;
  transition:
    opacity 220ms ease,
    transform 220ms ease,
    background-color 220ms ease;
}

.thinking-lines span.done {
  opacity: 1;
  transform: translateY(-1px);
  background: #fff0c7;
}

.gift-grid {
  display: grid;
  gap: 0.62rem;
}

.gift-card {
  display: grid;
  gap: 0.5rem;
  padding: 0.9rem;
  border: 2px dashed #e8c9a6;
  border-radius: 1rem;
  background: #fffdf8;
}

.gift-card h2 {
  font-size: 1.28rem;
}

.gift-card p {
  color: var(--ink-soft);
}

.confetti-layer {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  overflow: hidden;
}

.confetti {
  position: absolute;
  top: -16px;
  left: var(--x);
  width: 9px;
  height: 13px;
  border-radius: 999px;
  background: var(--c);
  animation: confetti-drop var(--d) linear forwards;
}

@keyframes view-in {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes float-soft {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}

@keyframes float-happy {
  0%,
  100% {
    transform: translateY(0) rotate(-1deg);
  }
  50% {
    transform: translateY(-7px) rotate(1deg);
  }
}

@keyframes float-thinking {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-3px) scale(0.99);
  }
}

@keyframes confetti-drop {
  to {
    transform: translate3d(var(--shift), 105svh, 0) rotate(480deg);
  }
}

@media (min-width: 720px) {
  .topbar,
  .app {
    width: min(100%, 620px);
  }

  .chat-card {
    padding: 1.12rem;
  }

  .gift-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 374px) {
  .choices.compact {
    grid-template-columns: 1fr;
  }

  .message h1 {
    font-size: clamp(1.58rem, 8vw, 2rem);
  }
}

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