:root {
  --bg: #1d1433;
  --bg2: #2a1d48;
  --panel: #2f2350;
  --line: #45366e;
  --text: #faf6ff;
  --muted: #c3b6e6;
  --mint: #9ff0d5;
  --violet: #b18cff;
  --red: #ff8fa3;
  --radius: 20px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: linear-gradient(180deg, var(--bg) 0%, var(--bg2) 100%) fixed;
  color: var(--text);
  font: 16px/1.55 "M PLUS Rounded 1c", system-ui, sans-serif;
}

a { color: inherit; }

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 1120px;
  margin: 0 auto;
  padding: 20px 16px;
}
.brand { font-weight: 800; font-size: 22px; text-decoration: none; color: var(--mint); }
.top nav { display: flex; gap: 20px; }
.top nav a { color: var(--muted); text-decoration: none; font-weight: 500; }
.top nav a:hover { color: var(--text); }

main { max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* Live mood */
.live {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 48px;
  align-items: center;
  padding: 24px 0 72px;
}
.portrait { position: relative; }
.frame {
  position: relative;
  border-radius: 28px;
  overflow: hidden;
  border: 1px solid var(--line);
  box-shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.7);
  transition: opacity 0.35s ease;
}
.frame.swap { opacity: 0; }
.frame img { display: block; width: 100%; height: auto; }
.frame video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* One-shot reactions when her mood changes */
.fx-crying { animation: shake 0.5s ease-in-out 2; }
.fx-worried { animation: wobble 0.9s ease-in-out; }
.fx-starry, .fx-celebrating { animation: hop 0.45s ease-out 3; }
.fx-happy { animation: hop 0.5s ease-out 1; }
.fx-smug { animation: pop 0.6s ease-out; }
.fx-asleep .frame { animation: breathe 4s ease-in-out infinite; }
@keyframes shake {
  20%, 60% { transform: translateX(-10px) rotate(-1deg); }
  40%, 80% { transform: translateX(10px) rotate(1deg); }
}
@keyframes wobble { 25% { transform: rotate(-2deg); } 75% { transform: rotate(2deg); } }
@keyframes hop { 40% { transform: translateY(-18px); } }
@keyframes pop { 40% { transform: scale(1.04) rotate(-1.5deg); } }
@keyframes breathe { 50% { transform: scale(0.985); } }

#confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 20; }
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 30;
  max-width: calc(100% - 32px);
  padding: 12px 20px;
  border-radius: 999px;
  background: var(--mint);
  color: #1d1433;
  font-weight: 800;
  transform: translate(-50%, calc(100% + 40px));
  visibility: hidden;
  transition: transform 0.35s ease, visibility 0s linear 0.35s;
}
.toast.show { transform: translate(-50%, 0); visibility: visible; transition: transform 0.35s ease; }

@media (prefers-reduced-motion: reduce) {
  .portrait, .frame, .toast { animation: none !important; transition: none !important; }
}
.badge {
  position: absolute;
  left: 16px;
  top: 16px;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(29, 20, 51, 0.82);
  font: 700 13px "JetBrains Mono", monospace;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 14px;
  font: 700 13px "JetBrains Mono", monospace;
  color: var(--muted);
}
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); }
.dot.on { background: var(--mint); animation: blink 1.6s ease-in-out infinite; }
@keyframes blink { 50% { opacity: 0.35; } }
h1 {
  font-size: clamp(42px, 6vw, 72px);
  line-height: 1.02;
  letter-spacing: -0.02em;
  margin: 0 0 24px;
  font-weight: 800;
}
.bubble {
  position: relative;
  display: inline-block;
  max-width: 100%;
  padding: 16px 20px;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  font-size: 19px;
  font-weight: 500;
}
.bubble::before {
  content: "";
  position: absolute;
  left: -9px;
  top: 22px;
  width: 16px;
  height: 16px;
  background: var(--panel);
  border-left: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  transform: rotate(45deg);
}
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 24px 0 0;
}
.stats div { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 10px 12px; }
.stats dt { color: var(--muted); font-size: 12px; }
.stats dd { margin: 2px 0 0; font: 700 15px "JetBrains Mono", monospace; overflow-wrap: anywhere; }
.up { color: var(--mint); }
.down { color: var(--red); }
.why { color: var(--muted); font-size: 14px; margin: 14px 0 0; }

/* Mood grid */
.moods { padding: 24px 0 64px; scroll-margin-top: 16px; }
.moods h2, .coin h2 { font-size: clamp(30px, 4vw, 44px); margin: 0 0 6px; font-weight: 800; }
.sub { color: var(--muted); margin: 0 0 24px; }
.grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.mood {
  padding: 0;
  border: 2px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.mood img { display: block; width: 100%; height: auto; aspect-ratio: 1; }
.mood span { display: block; padding: 10px 12px 12px; font-size: 14px; }
.mood strong { display: block; font-size: 16px; }
.mood em { font-style: normal; color: var(--muted); }
.mood.now { border-color: var(--mint); }

/* Coin */
.coin { text-align: center; padding: 56px 0 64px; scroll-margin-top: 16px; }
.coin h2 { color: var(--mint); }
.coin > p { color: var(--muted); margin: 0 0 24px; }
.ca {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  max-width: 100%;
  padding: 10px 12px 10px 18px;
  margin-bottom: 22px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
}
.ca .label { color: var(--muted); font-size: 13px; }
.ca code { font: 14px "JetBrains Mono", monospace; overflow-wrap: anywhere; }
.row { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }
.btn, .chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text);
  font: 800 15px "M PLUS Rounded 1c", sans-serif;
  text-decoration: none;
  cursor: pointer;
}
.btn { padding: 13px 24px; }
.chip { padding: 6px 14px; font-size: 13px; }
.btn.primary { background: var(--mint); border-color: var(--mint); color: #1d1433; }
.btn[aria-disabled="true"] { background: transparent; border-color: var(--line); color: var(--muted); pointer-events: none; }
.chart { margin-top: 32px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.chart iframe { width: 100%; height: 480px; border: 0; display: block; }


@media (max-width: 820px) {
  .live { grid-template-columns: 1fr; gap: 28px; padding-top: 8px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ca { border-radius: 18px; flex-wrap: wrap; justify-content: center; }
}
