:root {
  --ink: #0E0E10;
  --ink2: #1A1A1F;
  --ink3: #26262D;
  --line: #2A2A31;
  --lime: #C6FF00;
  --lavender: #B8A6FF;
  --paper: #F6F5F0;
  --mute: #8A8A94;
  --danger: #FF5A5F;
  --spring: cubic-bezier(.34, 1.4, .64, 1);
  --ease: cubic-bezier(.22, 1, .36, 1);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  background: var(--ink);
  color: #fff;
  font-family: Nunito, ui-rounded, system-ui, sans-serif;
  font-weight: 800;
  -webkit-font-smoothing: antialiased;
}

body { min-height: 100dvh; }

.page {
  max-width: 440px;
  margin: 0 auto;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding: calc(env(safe-area-inset-top) + 18px) 20px calc(env(safe-area-inset-bottom) + 16px);
}

.view { display: flex; flex-direction: column; gap: 16px; }
.view[hidden] { display: none; }
.view.center { flex: 1; align-items: center; justify-content: center; text-align: center; gap: 12px; padding-bottom: 40px; }

/* header */
.top { display: flex; justify-content: center; padding: 4px 0 22px; }
.wordmark {
  display: inline-flex; align-items: center;
  color: var(--lime); text-decoration: none;
  font-size: 34px; font-weight: 900; letter-spacing: -.04em; line-height: 1;
}
.wordmark .eye-slot { width: .62em; height: .62em; margin: 0 .01em; transform: translateY(.06em); }

/* eye */
.eye-slot { display: inline-block; }
.eye-slot svg { display: block; width: 100%; height: 100%; }
.eye .lid { transform-box: fill-box; transform-origin: 50% 0; }
.eye.alive .lid { animation: blink 4.2s infinite; }
.eye.alive .pupil { animation: glance 7s infinite var(--ease); }
@keyframes blink { 0%, 91%, 100% { transform: scaleY(1); } 94% { transform: scaleY(1.75); } }
@keyframes glance { 0%, 40% { transform: translateX(0); } 48%, 80% { transform: translateX(-20px); } 88%, 100% { transform: translateX(0); } }

/* profile + sticker */
.profile { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 52px; height: 52px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--lime); color: var(--ink);
  font-size: 24px; font-weight: 900;
}
.handle { font-size: 20px; font-weight: 900; }
.sub { font-size: 14px; font-weight: 700; color: var(--mute); }

.sticker {
  position: relative;
  border-radius: 26px;
  padding: 20px 20px 22px;
  margin-bottom: 8px;
  background: var(--ink2);
  box-shadow: 0 14px 40px rgba(0, 0, 0, .45);
}
.sticker::after {
  content: ""; position: absolute; left: 32px; bottom: -11px;
  width: 26px; height: 26px; border-radius: 4px;
  background: inherit; transform: rotate(45deg);
}
.sticker.ink { background: var(--ink2); color: #fff; border: 1px solid var(--line); }
.sticker.ink::after { border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.sticker.lime { background: var(--lime); color: var(--ink); }
.sticker.lavender { background: var(--lavender); color: var(--ink); }
.sticker-kind { display: flex; align-items: center; gap: 6px; font-size: 13px; opacity: .75; margin-bottom: 8px; }
.sticker-kind .eye-slot { width: 15px; height: 15px; }
.sticker-q { font-size: 27px; font-weight: 900; line-height: 1.12; letter-spacing: -.015em; }

/* composer */
.composer { display: flex; flex-direction: column; gap: 14px; margin-top: 6px; }
.field {
  background: #fff;
  color: var(--ink);
  border-radius: 24px;
  padding: 18px 18px 12px;
  transition: box-shadow .25s var(--ease), transform .25s var(--ease);
}
.field:focus-within { box-shadow: 0 0 0 3px var(--lime); }
textarea {
  width: 100%; border: 0; outline: 0; resize: none;
  background: transparent; color: var(--ink);
  font: inherit; font-size: 20px; font-weight: 800; line-height: 1.3;
  caret-color: #6E8F00;
}
textarea::placeholder { color: #B5B5BD; }
.field-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 6px; }
.dice {
  border: 0; cursor: pointer;
  width: 40px; height: 40px; border-radius: 14px;
  background: var(--lavender); font-size: 19px;
  transition: transform .4s var(--spring);
}
.dice:active { transform: scale(.88) rotate(-20deg); }
.dice.spin { animation: spin .5s var(--spring); }
@keyframes spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }
.count { font-size: 13px; color: #9A9AA3; font-variant-numeric: tabular-nums; }
.count.near { color: #D9480F; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.promises { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.promises li {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: #fff; opacity: .8;
  background: var(--ink2); border-radius: 999px; padding: 7px 12px;
}
.promises .dot { font-size: 12px; }

/* buttons */
.btn {
  position: relative;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; border: 0; cursor: pointer; text-decoration: none;
  border-radius: 999px; padding: 17px 20px;
  font: inherit; font-size: 18px; font-weight: 900;
  transition: transform .3s var(--spring), opacity .2s, background .2s;
}
.btn:active { transform: scale(.96); }
.btn-lime { background: var(--lime); color: var(--ink); }
.btn-ghost { background: var(--ink2); color: #fff; }
.btn:disabled { background: var(--ink3); color: var(--mute); cursor: default; }
.btn:disabled:active { transform: none; }
.spinner {
  display: none; width: 18px; height: 18px; border-radius: 50%;
  border: 3px solid rgba(14, 14, 16, .25); border-top-color: var(--ink);
  animation: rot .7s linear infinite;
}
.btn.loading .btn-label { opacity: .6; }
.btn.loading .spinner { display: inline-block; }
@keyframes rot { to { transform: rotate(360deg); } }
.error { margin: 0; text-align: center; color: var(--danger); font-size: 14px; }
.stack { display: flex; flex-direction: column; gap: 10px; width: 100%; margin-top: 18px; }

/* result screens */
h1 { margin: 6px 0 0; font-size: 38px; font-weight: 900; letter-spacing: -.03em; line-height: 1.05; }
.lead { margin: 0; color: var(--mute); font-size: 17px; font-weight: 700; line-height: 1.4; }
.lead [data-handle] { color: #fff; }
.big-eye { width: 120px; height: 120px; margin-bottom: 8px; }
.big-eye .eye-slot { width: 100%; height: 100%; }
.pop { animation: pop .7s var(--spring) both; }
@keyframes pop { from { transform: scale(.3) rotate(-25deg); opacity: 0; } to { transform: none; opacity: 1; } }

/* entrance */
.appear { animation: rise .6s var(--ease) both; animation-delay: calc(var(--i, 0) * 70ms); }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }

/* loading */
.skeleton { background: linear-gradient(90deg, var(--ink2), var(--ink3), var(--ink2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 26px; }
.card-skel { height: 150px; margin-top: 68px; }
.box-skel { height: 150px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* sheet */
.sheet-wrap { position: fixed; inset: 0; z-index: 10; display: flex; align-items: flex-end; justify-content: center; }
.sheet-wrap[hidden] { display: none; }
.sheet-dim { position: absolute; inset: 0; background: rgba(0, 0, 0, .55); animation: fade .25s both; }
.sheet {
  position: relative; width: 100%; max-width: 440px;
  background: var(--ink2); border-radius: 32px 32px 0 0;
  padding: 10px 20px calc(env(safe-area-inset-bottom) + 24px);
  animation: up .45s var(--ease) both;
}
.sheet h2 { margin: 14px 0 6px; font-size: 26px; font-weight: 900; }
.sheet p { margin: 0; color: var(--mute); font-size: 15px; font-weight: 700; }
.grabber { width: 40px; height: 5px; border-radius: 3px; background: var(--ink3); margin: 0 auto; }
@keyframes up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes fade { from { opacity: 0; } }

.foot { margin-top: auto; padding-top: 28px; display: flex; gap: 8px; justify-content: center; font-size: 12px; color: var(--ink3); }
.foot a { color: #55555E; text-decoration: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

.sticker.ink .sticker-kind .eye-slot { color: var(--lime); }
