:root {
  --bg-1: #e6d9f8;
  --bg-2: #f0e2f6;
  --bg-3: #d3c1f0;
  --card-bg: #fdfaff;
  --ink: #362c47;
  --ink-soft: #7c6f8f;
  --accent: #9b6fd1;
  --accent-dark: #7548b0;
  --accent-soft: #e6d8f7;
  --good: #7bc99f;
  --shadow: 0 20px 50px rgba(130, 90, 190, 0.25);
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background: linear-gradient(135deg, var(--bg-1), var(--bg-2), var(--bg-3));
  background-size: 300% 300%;
  animation: drift 18s ease-in-out infinite;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-x: hidden;
}

@keyframes drift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

.progress-track {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.4);
  z-index: 10;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-dark));
  transition: width 0.5s ease;
}

#app {
  width: 100%;
  display: flex;
  justify-content: center;
}

.card {
  position: relative;
  width: 100%;
  max-width: 480px;
  min-height: 420px;
  background: var(--card-bg);
  border-radius: 28px;
  box-shadow: var(--shadow);
  padding: 36px 28px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 18px;
  overflow: hidden;
  animation: pop-in 0.5s ease;
}

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

.scene-tag {
  align-self: flex-start;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-dark);
  background: var(--accent-soft);
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 600;
}

h1 {
  font-size: 1.5rem;
  line-height: 1.35;
  margin: 0;
}

h2 {
  font-size: 1.3rem;
  line-height: 1.35;
  margin: 0;
}

p {
  margin: 0;
  line-height: 1.5;
  color: var(--ink-soft);
}

.reveal-text {
  min-height: 1.6em;
}

.choices {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 6px;
}

button {
  font: inherit;
  cursor: pointer;
}

.btn {
  position: relative;
  border: none;
  border-radius: 16px;
  padding: 14px 18px;
  background: var(--accent-soft);
  color: var(--ink);
  font-weight: 600;
  font-size: 0.98rem;
  text-align: left;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease, padding 0.15s ease;
}

.btn:hover {
  transform: translateY(-2px);
  background: #d9c4f2;
  box-shadow: 0 6px 16px rgba(117, 72, 176, 0.25);
}

.btn:active {
  transform: translateY(0);
}

.btn.selected {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  padding-left: 38px;
  box-shadow: 0 6px 16px rgba(117, 72, 176, 0.4);
}

.btn.selected:hover {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
}

.btn.selected::before {
  content: "✓";
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-weight: 700;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: white;
  text-align: center;
  align-self: center;
  padding: 14px 28px;
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--accent-dark), var(--accent));
}

.btn-ghost {
  background: transparent;
  border: 2px dashed var(--accent-soft);
}

.next-row {
  margin-top: 8px;
  display: flex;
  justify-content: center;
}

/* fleeing / trick buttons need a positioning context */
.trick-zone {
  position: relative;
  min-height: 160px;
  margin-top: 8px;
}

.trick-zone .btn {
  position: absolute;
}

.fleeing-btn {
  transition: top 0.25s ease, left 0.25s ease, transform 0.2s ease;
}

.swap-pair {
  position: relative;
  min-height: 70px;
  margin-top: 8px;
}

.swap-pair .btn {
  position: absolute;
  width: calc(50% - 8px);
  text-align: center;
  transition: left 0.35s ease, right 0.35s ease;
}

/* fake analysis / progress bar */
.analysis-box {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bar-track {
  width: 100%;
  height: 14px;
  border-radius: 999px;
  background: #f0e4e6;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-dark));
  transition: width 0.4s ease;
}

.bar-label {
  font-size: 0.85rem;
  color: var(--ink-soft);
  display: flex;
  justify-content: space-between;
}

.stat-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 10px;
}

.vslider-wrap {
  margin-top: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.vslider-wrap .bar-label {
  width: 100%;
}

.vslider-track {
  position: relative;
  width: 76px;
  height: 260px;
  border-radius: 999px;
  background: #f0e4e6;
  touch-action: none;
}

.vslider-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 0%;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--accent-dark), var(--accent));
}

.vslider-thumb {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  transform: translateX(-50%);
  background:
    radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.55), transparent 45%),
    linear-gradient(135deg, var(--accent), var(--accent-dark));
  border: 2px solid rgba(255, 255, 255, 0.5);
  box-shadow: 0 10px 24px rgba(117, 72, 176, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  cursor: grab;
  touch-action: none;
}

.vslider-thumb:active {
  cursor: grabbing;
}

.vslider-track.is-locked .vslider-thumb {
  cursor: default;
}

.intro-cat {
  width: 128px;
  height: 128px;
  object-fit: cover;
  border-radius: 50%;
  align-self: center;
  border: 3px solid rgba(255, 255, 255, 0.6);
  box-shadow: 0 12px 26px rgba(117, 72, 176, 0.35);
  animation: intro-cat-float 4s ease-in-out infinite;
}

.cat-caption {
  text-align: center;
  font-size: 0.8rem;
  font-style: italic;
  color: var(--ink-soft);
  margin-top: -6px;
}

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

.spinner {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 4px solid var(--accent-soft);
  border-top-color: var(--accent-dark);
  animation: spin 0.8s linear infinite;
  align-self: center;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.footnote {
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--accent-dark);
  text-align: center;
  margin-top: 4px;
  min-height: 1.2em;
  padding: 0;
  border-radius: 14px;
  transition: padding 0.2s ease;
}

.footnote:not(:empty) {
  background: var(--accent-soft);
  padding: 10px 14px;
}

.footnote.pop {
  animation: footnote-pop 0.35s ease;
}

@keyframes footnote-pop {
  0%   { transform: scale(0.92); opacity: 0; }
  60%  { transform: scale(1.04); opacity: 1; }
  100% { transform: scale(1); }
}

.shake {
  animation: shake 0.4s ease;
}

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

.fade-in {
  animation: fade-in 0.4s ease both;
}

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

@media (max-width: 420px) {
  .card {
    padding: 28px 20px;
    border-radius: 22px;
  }
}
