:root {
  font-family: "Trebuchet MS", "Comic Sans MS", "Avenir Next", sans-serif;
  line-height: 1.45;
  font-weight: 400;
  color: #163256;
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.65), transparent 32%),
    linear-gradient(180deg, #9be3ff 0%, #dff6ff 24%, #fff5cc 100%);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

#app {
  min-height: 100vh;
}

.hidden {
  display: none;
}

.phone-shell {
  width: 100%;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 16px;
}

.app-shell {
  width: min(100%, 460px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.hero-card,
.panel {
  position: relative;
  overflow: hidden;
  border-radius: 28px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.84);
  box-shadow: 0 14px 40px rgba(67, 109, 145, 0.16);
  backdrop-filter: blur(12px);
}

.hero-card {
  min-height: 360px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(255, 240, 208, 0.92)),
    linear-gradient(180deg, #ffd664, #fff3bf);
}

.hero-glow {
  position: absolute;
  inset: auto -50px -70px auto;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(255, 168, 205, 0.78), transparent 68%);
}

.hero-copy h1,
.panel h2 {
  margin: 4px 0 10px;
  font-size: clamp(2rem, 7vw, 2.8rem);
  line-height: 0.96;
}

.panel h2 {
  font-size: 1.7rem;
}

.hero-copy p,
.panel p,
.character-card-copy span,
.character-card-copy small {
  margin: 0;
  color: #45607c;
}

.eyebrow {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  border-radius: 999px;
  padding: 7px 12px;
  background: #e8f8ff;
  color: #206089;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 0.74rem;
}

.hero-buddies {
  display: flex;
  align-items: flex-end;
  gap: 18px;
}

.hero-stats,
.stats-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.hero-stats div,
.stat-card {
  padding: 12px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
}

.hero-stats span,
.stat-card span {
  display: block;
  font-size: 0.78rem;
  color: #5b7590;
}

.hero-stats strong,
.stat-card strong {
  display: block;
  margin-top: 4px;
  font-size: 1.1rem;
}

.screen-stack {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.camera-stage {
  position: sticky;
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  z-index: 8;
  overflow: hidden;
  min-height: min(56vh, 420px);
  border-radius: 28px;
  background: #1a3750;
  box-shadow: 0 18px 42px rgba(30, 62, 90, 0.25);
  touch-action: none;
}

.camera-video,
.camera-fallback,
.camera-ui-frame,
.camera-fallback-overlay {
  position: absolute;
  inset: 0;
}

.camera-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.camera-fallback {
  background:
    radial-gradient(circle at 30% 20%, rgba(255, 226, 148, 0.45), transparent 20%),
    linear-gradient(145deg, #6ed1ff 0%, #8ef4d6 44%, #ffe9a5 100%);
}

.camera-find {
  background:
    radial-gradient(circle at 70% 20%, rgba(255, 194, 214, 0.52), transparent 18%),
    linear-gradient(145deg, #7fc7ff 0%, #b1f5d9 44%, #fff0bf 100%);
}

.camera-fallback-overlay {
  background:
    linear-gradient(transparent 82%, rgba(0, 0, 0, 0.08) 82%, rgba(0, 0, 0, 0.08) 84%, transparent 84%),
    linear-gradient(90deg, transparent 82%, rgba(0, 0, 0, 0.05) 82%, rgba(0, 0, 0, 0.05) 84%, transparent 84%);
  background-size: 88px 88px;
  opacity: 0.55;
}

.camera-status-card {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 2;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.85);
  color: #224766;
}

.camera-status-card strong,
.camera-status-card span {
  display: block;
}

.camera-status-card span {
  margin-top: 4px;
  font-size: 0.88rem;
}

.camera-ui-frame {
  pointer-events: none;
  border: 16px solid rgba(14, 32, 50, 0.22);
  border-radius: 28px;
}

.placement-overlay,
.hint-arrow {
  position: absolute;
  z-index: 4;
  transform: translate(-50%, -50%);
}

.hint-arrow {
  padding: 10px 14px;
  border-radius: 999px;
  background: #fff;
  color: #ff4b7d;
  font-weight: 900;
  animation: bob 0.9s ease-in-out infinite alternate;
}

.crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 86px;
  height: 86px;
  margin-left: -43px;
  margin-top: -43px;
  border: 3px solid rgba(255, 255, 255, 0.9);
  border-radius: 50%;
  box-shadow: 0 0 0 6px rgba(0, 0, 0, 0.16);
  z-index: 3;
}

.crosshair::before,
.crosshair::after {
  content: "";
  position: absolute;
  background: rgba(255, 255, 255, 0.94);
}

.crosshair::before {
  left: 50%;
  top: 14px;
  bottom: 14px;
  width: 3px;
  transform: translateX(-50%);
}

.crosshair::after {
  top: 50%;
  left: 14px;
  right: 14px;
  height: 3px;
  transform: translateY(-50%);
}

.character-avatar {
  position: relative;
  width: 78px;
  height: 78px;
  border-radius: 28px;
  background: var(--char-color);
  box-shadow: inset 0 -8px 0 rgba(255, 255, 255, 0.16), 0 8px 16px rgba(29, 44, 57, 0.15);
}

.character-avatar.is-ghost {
  opacity: 0.82;
  filter: drop-shadow(0 8px 16px rgba(14, 39, 52, 0.2));
}

.character-avatar.is-reveal {
  animation: celebrate 0.7s ease-out both;
}

.shape-blob {
  border-radius: 36px 36px 26px 26px;
}

.shape-cat,
.shape-goblin {
  border-radius: 24px;
}

.shape-cookie {
  border-radius: 50%;
}

.shape-dino {
  border-radius: 28px 30px 26px 20px;
}

.char-eye,
.char-mouth,
.ear,
.tail,
.spikes,
.chips {
  position: absolute;
}

.char-eye {
  top: 28px;
  width: 8px;
  height: 12px;
  border-radius: 999px;
  background: #14324f;
}

.char-eye.left {
  left: 23px;
}

.char-eye.right {
  right: 23px;
}

.char-mouth {
  left: 50%;
  bottom: 18px;
  width: 20px;
  height: 10px;
  border: 3px solid #14324f;
  border-top: 0;
  border-radius: 0 0 12px 12px;
  transform: translateX(-50%);
}

.ear {
  top: -10px;
  width: 20px;
  height: 22px;
  background: var(--char-color);
  clip-path: polygon(50% 0%, 100% 100%, 0% 100%);
}

.ear.left {
  left: 10px;
}

.ear.right {
  right: 10px;
}

.ear.pointy {
  width: 18px;
  height: 18px;
  top: 8px;
}

.tail {
  right: -10px;
  bottom: 16px;
  width: 20px;
  height: 10px;
  border-radius: 999px;
  background: var(--char-color);
  transform: rotate(28deg);
}

.spikes {
  left: 10px;
  top: -8px;
  width: 48px;
  height: 18px;
  background:
    linear-gradient(90deg, transparent 0 10%, var(--char-accent) 10% 26%, transparent 26% 34%, var(--char-accent) 34% 52%, transparent 52% 60%, var(--char-accent) 60% 76%, transparent 76%);
}

.chips {
  inset: 12px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 20% 22%, #6b4f3b 0 7%, transparent 8%),
    radial-gradient(circle at 62% 18%, #6b4f3b 0 8%, transparent 9%),
    radial-gradient(circle at 72% 56%, #6b4f3b 0 7%, transparent 8%),
    radial-gradient(circle at 26% 68%, #6b4f3b 0 6%, transparent 7%);
}

.character-grid,
.pill-grid,
.button-column {
  display: grid;
  gap: 12px;
}

.character-card {
  display: grid;
  grid-template-columns: 88px 1fr;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border-radius: 24px;
  background: linear-gradient(180deg, #fff, #f7fbff);
  border: 3px solid transparent;
  text-align: left;
}

.character-card:hover,
.character-card:focus-visible {
  border-color: #ffbb43;
}

.character-card.is-locked {
  opacity: 0.58;
}

.character-card-copy {
  display: grid;
  gap: 5px;
}

.character-card-copy strong {
  font-size: 1.05rem;
}

.character-card-copy small {
  font-weight: 700;
  color: #206089;
}

.radio-grid {
  grid-template-columns: repeat(2, 1fr);
  margin: 16px 0;
}

.pill {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border-radius: 999px;
  background: #eef8ff;
  color: #27506c;
  font-weight: 700;
  text-align: center;
  padding: 12px;
}

.pill.is-selected {
  background: #ffd665;
}

.slider-group {
  display: grid;
  gap: 8px;
  margin: 10px 0 18px;
}

.slider-group span {
  font-weight: 700;
}

.slider-group input {
  width: 100%;
}

.button-row,
.button-column {
  display: grid;
  gap: 12px;
}

.button-row {
  grid-template-columns: 1fr 1fr;
}

.primary-button,
.secondary-button {
  min-height: 56px;
  border-radius: 20px;
  padding: 14px 18px;
  font-weight: 900;
  font-size: 1rem;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.primary-button:active,
.secondary-button:active,
.character-card:active,
.pill:active {
  transform: translateY(1px) scale(0.99);
}

.primary-button {
  color: #173257;
  background: linear-gradient(180deg, #ffe06e, #ffbb43);
  box-shadow: 0 10px 20px rgba(255, 187, 67, 0.3);
}

.secondary-button {
  color: #173257;
  background: #eaf7ff;
}

.primary-button.large {
  min-height: 64px;
  font-size: 1.1rem;
}

.pass-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-radius: 22px;
  background: linear-gradient(180deg, #fff9e6, #fff);
}

.info-strip,
.small-note {
  padding: 12px 14px;
  border-radius: 18px;
  background: #f1f8ff;
  color: #375975;
  font-size: 0.93rem;
}

.meter-bar {
  overflow: hidden;
  height: 16px;
  margin: 14px 0;
  border-radius: 999px;
  background: #e5f0f7;
}

.meter-fill {
  height: 100%;
  border-radius: inherit;
  transition: width 260ms ease;
}

.meter-hot {
  background: linear-gradient(90deg, #ff7a59, #ff477d);
}

.meter-warm {
  background: linear-gradient(90deg, #ffcb52, #ff8d4b);
}

.meter-cool {
  background: linear-gradient(90deg, #83d7ff, #55a6ff);
}

.meter-cold {
  background: linear-gradient(90deg, #add8ee, #7ab7d4);
}

.warmth-hot {
  background: #ffe3e0;
}

.warmth-warm {
  background: #fff2d2;
}

.warmth-cool,
.warmth-cold {
  background: #eaf7ff;
}

.result-burst {
  display: grid;
  place-items: center;
  min-height: 120px;
  margin: 8px 0 14px;
  border-radius: 26px;
}

.result-burst.is-success {
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 214, 101, 0.48), transparent 55%),
    linear-gradient(180deg, #fffdf4, #fff4be);
}

.result-burst.is-fail {
  background: linear-gradient(180deg, #f2fbff, #e8f2ff);
}

.result-copy {
  text-align: center;
  margin: 14px 0 18px;
}

.stars {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
}

.star {
  font-size: 2rem;
  color: #d5deea;
}

.star.filled {
  color: #ffbf35;
}

.steps-list {
  padding-left: 18px;
  color: #3b5971;
}

.steps-list li + li {
  margin-top: 8px;
}

@keyframes celebrate {
  0% {
    transform: scale(0.4) rotate(-10deg);
    opacity: 0;
  }
  60% {
    transform: scale(1.1) rotate(5deg);
    opacity: 1;
  }
  100% {
    transform: scale(1) rotate(0deg);
    opacity: 1;
  }
}

@keyframes bob {
  from {
    transform: translate(-50%, -50%) translateY(-6px);
  }
  to {
    transform: translate(-50%, -50%) translateY(6px);
  }
}

@media (max-width: 420px) {
  .button-row,
  .hero-stats,
  .stats-row,
  .radio-grid {
    grid-template-columns: 1fr;
  }

  .character-card {
    grid-template-columns: 78px 1fr;
  }
}

@media (min-width: 560px) {
  .phone-shell {
    padding: 24px;
  }
}

.hero-home {
  background:
    radial-gradient(circle at 18% 18%, rgba(255, 255, 255, 0.72), transparent 24%),
    radial-gradient(circle at 82% 20%, rgba(255, 179, 207, 0.45), transparent 22%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.95), rgba(255, 240, 208, 0.92)),
    linear-gradient(180deg, #ffd664, #fff3bf);
}

.hero-short {
  font-weight: 800;
  color: #214d6f;
}

.hero-buddies-large .character-avatar {
  animation: floaty 2.2s ease-in-out infinite alternate;
}

.panel-characters,
.panel-pass,
.panel-result {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(247, 251, 255, 0.94));
}

.panel-lead {
  margin-bottom: 14px;
  font-weight: 700;
  color: #315973;
}

.character-art-wrap {
  position: relative;
  display: grid;
  place-items: center;
}

.character-card.is-ready {
  border-color: rgba(255, 187, 67, 0.22);
  box-shadow: 0 12px 24px rgba(84, 119, 151, 0.08);
}

.badge-pill {
  position: absolute;
  right: 0;
  bottom: -6px;
  padding: 6px 10px;
  border-radius: 999px;
  background: #173257;
  color: #fff;
  font-size: 0.74rem;
  font-weight: 800;
}

.mini-guide {
  display: grid;
  gap: 8px;
  margin: 12px 0 16px;
}

.mini-guide span {
  display: block;
  padding: 10px 12px;
  border-radius: 14px;
  background: #eef8ff;
  color: #315973;
  font-weight: 700;
}

.pass-guide {
  margin-top: 16px;
}

.pass-card-large {
  align-items: flex-start;
}

.pass-note {
  margin-top: 6px;
  color: #567188;
}

.coach-banner {
  margin: 12px 0;
  padding: 12px 14px;
  border-radius: 18px;
  font-weight: 800;
}

.coach-soft {
  background: #fff5d2;
  color: #754d00;
}

.coach-hot {
  background: #ffe3de;
  color: #aa2d33;
}

.coach-warm {
  background: #fff0d5;
  color: #9a5d12;
}

.coach-cool,
.coach-cold {
  background: #eaf6ff;
  color: #2c5b85;
}

.screen-badge {
  position: absolute;
  z-index: 5;
  top: 16px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #173257;
  font-size: 0.78rem;
  font-weight: 900;
}

.top-left {
  left: 16px;
}

.top-right {
  right: 16px;
}

.unlock-card {
  margin: 14px 0 4px;
  padding: 12px 14px;
  border-radius: 18px;
  background: linear-gradient(180deg, #fff7da, #fff2b8);
  color: #6f4d00;
  font-weight: 800;
}

.celebrate-ring {
  position: absolute;
  width: 148px;
  height: 148px;
  border-radius: 50%;
  border: 10px solid rgba(255, 214, 101, 0.44);
  animation: ring-pop 0.8s ease-out both;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

@keyframes floaty {
  from {
    transform: translateY(-4px);
  }
  to {
    transform: translateY(6px);
  }
}

@keyframes ring-pop {
  from {
    transform: scale(0.7);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}
