:root {
  --sky: #6ec6e0;
  --sky-deep: #4eabc8;
  --field: #b7e36a;
  --field-deep: #7cbc3a;
  --sun: #ffd45a;
  --coral: #ff7a59;
  --coral-deep: #e85a3a;
  --leaf: #2f8f5b;
  --ink: #1f3a2e;
  --paper: #fff9ee;
  --edge: #ffe4a8;
  --lantern: #ff5a4a;
  --pink: #ff8fab;
  --teal: #1fa7a0;
  --teal-deep: #0e7c77;
  --shadow: 0 10px 0 rgba(31, 58, 46, 0.12);
  --font-display: "Fredoka", system-ui, sans-serif;
  --font-body: "Be Vietnam Pro", system-ui, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: linear-gradient(180deg, var(--sky) 0%, #c7ecf6 42%, #e7f6c4 72%, var(--field) 100%);
  background-attachment: fixed;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  appearance: none;
}

a {
  color: inherit;
  text-decoration: none;
}

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

.sun {
  position: absolute;
  top: 4%;
  right: 8%;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff7c8, var(--sun) 62%, #f0a83a);
  box-shadow: 0 0 36px rgba(255, 212, 90, 0.55);
}

.cloud {
  position: absolute;
  background: rgba(255, 255, 255, 0.88);
  border-radius: 999px;
  animation: drift 36s linear infinite;
}

.cloud::before,
.cloud::after {
  content: "";
  position: absolute;
  background: inherit;
  border-radius: 50%;
}

.c1 {
  width: 96px;
  height: 32px;
  top: 12%;
  left: -20%;
}
.c1::before {
  width: 40px;
  height: 40px;
  top: -20px;
  left: 14px;
}
.c1::after {
  width: 50px;
  height: 50px;
  top: -26px;
  left: 38px;
}

.c2 {
  width: 72px;
  height: 26px;
  top: 22%;
  left: -30%;
  animation-duration: 46s;
  animation-delay: -14s;
  opacity: 0.8;
}

.lantern {
  position: absolute;
  top: 8%;
  width: 16px;
  height: 24px;
  background: var(--lantern);
  border-radius: 8px 8px 10px 10px;
  animation: sway 3.2s ease-in-out infinite;
}
.lantern::before {
  content: "";
  position: absolute;
  top: -10px;
  left: 50%;
  width: 2px;
  height: 10px;
  background: rgba(31, 58, 46, 0.35);
  transform: translateX(-50%);
}
.l1 {
  left: 8%;
}
.l2 {
  right: 18%;
  animation-delay: -1s;
}

.hill {
  position: absolute;
  bottom: -8%;
  left: -10%;
  width: 70%;
  height: 28%;
  border-radius: 50% 50% 0 0;
  background: linear-gradient(180deg, #9fd84a, var(--field-deep));
  opacity: 0.55;
}
.hill.back {
  left: auto;
  right: -12%;
  width: 65%;
  height: 24%;
  opacity: 0.4;
  background: linear-gradient(180deg, #b7e36a, #6aaa2e);
}

@keyframes drift {
  from {
    transform: translateX(0);
  }
  to {
    transform: translateX(140vw);
  }
}

@keyframes sway {
  0%,
  100% {
    transform: rotate(-6deg);
  }
  50% {
    transform: rotate(6deg);
  }
}

.screen {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  padding: max(16px, var(--safe-top)) 16px max(24px, var(--safe-bottom));
  display: none;
  align-items: center;
  justify-content: center;
}

.screen.is-active {
  display: flex;
}

.start-stage,
.result-stage {
  width: min(520px, 100%);
  text-align: center;
  animation: rise-in 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(28px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.back-hub {
  display: inline-flex;
  align-items: center;
  margin: 0 0 10px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  color: var(--leaf);
  font-weight: 800;
  font-size: 0.9rem;
  box-shadow: 0 4px 0 rgba(31, 58, 46, 0.1);
}

.back-hub.mini {
  margin: 0;
  min-width: 44px;
  justify-content: center;
  padding: 8px 10px;
}

.brand {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 4vw, 1.45rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff;
  text-shadow: 0 2px 10px rgba(31, 58, 46, 0.25);
}

.title {
  margin: 0;
  line-height: 1.05;
}

.title-line {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 10vw, 3.5rem);
  font-weight: 700;
  color: #fff;
  text-shadow: 0 4px 0 rgba(47, 143, 91, 0.28);
}

.title-sub {
  display: inline-block;
  margin-top: 6px;
  padding: 6px 18px;
  border-radius: 999px;
  background: var(--sun);
  color: var(--leaf);
  font-family: var(--font-display);
  font-size: clamp(1.2rem, 5vw, 1.7rem);
  font-weight: 700;
  box-shadow: 0 6px 0 rgba(200, 140, 20, 0.35);
}

.tagline {
  margin: 18px auto 0;
  max-width: 34ch;
  font-size: 1.05rem;
  font-weight: 700;
  color: rgba(31, 58, 46, 0.92);
}

.how-row {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 16px 0 4px;
  flex-wrap: wrap;
}

.how-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: var(--shadow);
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--ink);
}

.host-wrap {
  position: relative;
  margin: 18px auto 8px;
  width: min(220px, 58vw);
}

.host {
  width: 100%;
  height: auto;
  filter: drop-shadow(0 10px 16px rgba(0, 0, 0, 0.15));
}

.host-idle {
  animation: bob 2.4s ease-in-out infinite;
}

.host-happy {
  animation: bounce-happy 0.6s ease;
}

.host-sad {
  animation: shake-sad 0.55s ease;
}

.host-talk {
  animation: bob 1.1s ease-in-out infinite;
}

@keyframes bob {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}

@keyframes bounce-happy {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  40% {
    transform: translateY(-14px) scale(1.05);
  }
  70% {
    transform: translateY(-4px) scale(1.02);
  }
}

@keyframes shake-sad {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-8px);
  }
  75% {
    transform: translateX(8px);
  }
}

.host-bubble {
  position: absolute;
  left: 72%;
  top: 8%;
  min-width: 150px;
  margin: 0;
  padding: 10px 12px;
  border-radius: 16px 16px 16px 4px;
  background: #fff;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 700;
  line-height: 1.3;
  box-shadow: var(--shadow);
  animation: pop 0.5s 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
  text-align: left;
}

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

.cam-status {
  margin: 8px auto 0;
  max-width: 34ch;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--leaf);
}

.cam-status.is-error {
  color: #b83b52;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 999px;
  font-weight: 800;
  transition: transform 0.15s ease, filter 0.15s ease;
  user-select: none;
}

.btn:active {
  transform: scale(0.96) translateY(2px);
}

.btn-primary {
  background: linear-gradient(180deg, #ff8a5b 0%, var(--coral) 100%);
  color: #fff;
  box-shadow: 0 8px 0 #c4452d, 0 14px 24px rgba(196, 69, 45, 0.35);
}

.btn-secondary {
  background: #fff;
  color: var(--leaf);
  box-shadow: 0 6px 0 rgba(47, 143, 91, 0.2), var(--shadow);
}

.btn-xl {
  margin-top: 16px;
  min-height: 64px;
  min-width: min(300px, 90vw);
  padding: 0 28px;
  font-size: 1.25rem;
}

.btn-lg {
  min-height: 56px;
  min-width: 200px;
  padding: 0 24px;
  font-size: 1.15rem;
}

.btn-icon {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  font-size: 1.25rem;
  box-shadow: var(--shadow);
  flex-shrink: 0;
}

.voice-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(8px);
  color: var(--ink);
  font-weight: 700;
  font-size: 0.95rem;
  cursor: pointer;
}

.voice-toggle input {
  width: 22px;
  height: 22px;
  accent-color: var(--coral);
}

.screen-play {
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  gap: 10px;
  max-width: 980px;
  margin: 0 auto;
}

.play-bar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
}

.progress-wrap {
  text-align: center;
}

.progress-track {
  height: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.08);
}

.progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--sun), #ff9f1c);
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.progress-text {
  margin: 6px 0 0;
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--ink);
}

.play-main {
  flex: 1;
  display: grid;
  gap: 14px;
  align-items: start;
}

.cam-panel {
  display: grid;
  gap: 10px;
}

.cam-frame {
  position: relative;
  width: min(100%, 420px);
  margin: 0 auto;
  aspect-ratio: 4 / 3;
  border-radius: 28px;
  overflow: hidden;
  background: #123;
  box-shadow: var(--shadow), 0 0 0 4px rgba(255, 255, 255, 0.45);
}

#cam-video,
#cam-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

#cam-overlay {
  pointer-events: none;
}

.face-guide {
  position: absolute;
  inset: 14% 18%;
  border: 3px dashed rgba(255, 255, 255, 0.7);
  border-radius: 46%;
  pointer-events: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.face-guide.is-found {
  border-color: #57cc99;
  box-shadow: 0 0 0 4px rgba(87, 204, 153, 0.25);
}

.face-guide.is-tilt-a {
  border-color: #57cc99;
  box-shadow: 0 0 0 5px rgba(87, 204, 153, 0.35);
}

.face-guide.is-tilt-b {
  border-color: #ff8fab;
  box-shadow: 0 0 0 5px rgba(255, 143, 171, 0.35);
}

.tilt-meter {
  width: min(100%, 420px);
  margin: 0 auto;
  text-align: center;
}

.tilt-track {
  position: relative;
  height: 42px;
  border-radius: 999px;
  background: linear-gradient(90deg, #57cc99 0%, #fff9ee 45%, #fff9ee 55%, #ff8fab 100%);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.08);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 14px;
}

.tilt-side {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--ink);
}

.tilt-side.right {
  text-align: right;
}

.tilt-needle {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 3px 0 rgba(196, 69, 45, 0.45);
  transform: translateX(0);
  transition: transform 0.08s linear;
  justify-self: center;
}

.tilt-hint {
  margin: 8px 0 0;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink-soft, #3d5c4a);
}

.tilt-hold {
  margin: 8px auto 0;
  width: min(220px, 70%);
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.65);
  overflow: hidden;
}

.tilt-hold-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--sun), var(--coral));
  transition: width 0.05s linear;
}

.qa-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.host-mini {
  width: 84px;
  margin: 0 auto;
}

.statement-board {
  margin: 0;
  padding: 18px 16px;
  border-radius: 28px;
  background: linear-gradient(180deg, #fff 0%, var(--paper) 100%);
  box-shadow: var(--shadow), 0 0 0 4px rgba(255, 255, 255, 0.35);
  text-align: center;
  animation: board-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes board-in {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.statement-kicker {
  margin: 0 0 8px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--leaf);
}

.statement-text {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(1.15rem, 4.4vw, 1.55rem);
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
}

.choice-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.choice-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 120px;
  padding: 14px 10px;
  border-radius: 24px;
  color: #fff;
  transition: transform 0.15s ease, filter 0.15s ease, outline 0.15s ease;
  text-align: center;
}

.choice-card:active {
  transform: scale(0.95);
}

.choice-card:disabled {
  opacity: 0.55;
  pointer-events: none;
}

.choice-card.is-hot {
  outline: 4px solid #fff;
  filter: brightness(1.08);
  transform: scale(1.03);
}

.choice-a {
  background: linear-gradient(180deg, #57cc99 0%, #2d9f6f 100%);
  box-shadow: 0 8px 0 #1b7a52, 0 14px 24px rgba(45, 159, 111, 0.35);
}

.choice-b {
  background: linear-gradient(180deg, #ff8fab 0%, #e85d75 100%);
  box-shadow: 0 8px 0 #b83b52, 0 14px 24px rgba(232, 93, 117, 0.35);
}

.choice-key {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
}

.choice-label {
  font-family: var(--font-display);
  font-size: clamp(0.95rem, 3.4vw, 1.15rem);
  font-weight: 600;
  line-height: 1.25;
}

.tap-fallback {
  margin: 0;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 700;
  color: rgba(31, 58, 46, 0.7);
}

.feedback {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(12, 48, 46, 0.55);
  backdrop-filter: blur(6px);
}

.feedback-card {
  width: min(420px, 100%);
  padding: 28px 22px 24px;
  border-radius: 32px;
  background: #fff;
  text-align: center;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.25);
  animation: pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

.feedback-emoji {
  font-size: 3.4rem;
  line-height: 1;
  margin-bottom: 8px;
  animation: bounce-happy 0.7s ease;
}

.feedback-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 2rem;
  color: var(--leaf);
}

.feedback.is-wrong .feedback-title {
  color: #c4452d;
}

.feedback-explain {
  margin: 12px 0 22px;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.45;
  color: #334;
}

.result-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2rem, 8vw, 2.8rem);
  color: #fff;
  text-shadow: 0 3px 0 rgba(47, 143, 91, 0.3);
}

.result-trophy {
  font-size: 4.5rem;
  margin: 8px 0;
  animation: bounce-happy 1.2s ease infinite;
}

.result-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 12px 0 18px;
  width: min(320px, 100%);
}

.stat {
  padding: 14px 8px;
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 1.8rem;
  color: var(--coral);
  line-height: 1;
}

.stat-label {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--leaf);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.result-message {
  margin: 0 auto 8px;
  max-width: 34ch;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--ink);
}

.review-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  width: min(420px, 100%);
  max-height: 26vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.review-list li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: start;
  text-align: left;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 16px;
  padding: 10px 12px;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--ink);
  box-shadow: 0 4px 0 rgba(31, 58, 46, 0.08);
}

.result-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 8px;
}

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

.confetti-piece {
  position: absolute;
  top: -12px;
  width: 10px;
  height: 14px;
  border-radius: 2px;
  animation: fall linear forwards;
}

@keyframes fall {
  to {
    transform: translateY(105vh) rotate(720deg);
    opacity: 0.85;
  }
}

@media (min-width: 860px) {
  .play-main {
    grid-template-columns: minmax(280px, 420px) 1fr;
    align-items: stretch;
  }

  .cam-panel {
    position: sticky;
    top: 12px;
  }

  .choice-card {
    min-height: 140px;
  }

  .result-actions {
    flex-direction: row;
    justify-content: center;
  }
}

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