:root {
  --bg: #f7f9fc;
  --ink: #191c1e;
  --muted: #707975;
  --surface: #ffffff;
  --surface-2: #f2f4f7;
  --line: #e0e3e6;
  --accent: #366758;
  --accent-strong: #275245;
  --right: #4f956f;
  --left: #bd6260;
  --shadow: 0 20px 50px rgb(54 103 88 / 8%);
  color-scheme: light;
}

@property --stat-angle {
  syntax: "<angle>";
  inherits: true;
  initial-value: 180deg;
}

body {
  --start-accent: #b2e2f2;
  --start-accent-strong: #4e7789;
  --start-accent-shadow: rgb(78 119 137 / 16%);
  --start-accent-soft: rgb(178 226 242 / 48%);
}

body.start-role-ella {
  --start-accent: #ffd6e5;
  --start-accent-strong: #a95875;
  --start-accent-shadow: rgb(169 88 117 / 16%);
  --start-accent-soft: rgb(255 214 229 / 52%);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  background:
    linear-gradient(135deg, rgb(239 248 243 / 82%), transparent 34%),
    linear-gradient(225deg, rgb(245 234 217 / 78%), transparent 38%),
    var(--bg);
  color: var(--ink);
  font-family: "Plus Jakarta Sans", Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

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

button:disabled {
  cursor: wait;
  opacity: 0.68;
}

.app-shell {
  min-height: 100svh;
}

.screen {
  display: none;
  min-height: 100svh;
  padding: 24px;
}

.screen-active {
  display: flex;
}

#start-screen,
#end-screen {
  align-items: center;
  justify-content: center;
}

#start-screen {
  background:
    radial-gradient(circle at 50% 18%, var(--start-accent-soft), transparent 30%),
    radial-gradient(circle at 24% 78%, rgb(215 222 250 / 36%), transparent 30%),
    radial-gradient(circle at 82% 72%, rgb(255 220 196 / 36%), transparent 34%),
    #f7f9fc;
}

#game-screen.screen-active {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0;
  padding: 0;
  overflow: hidden;
  background: #f7f9fc;
}

.start-panel,
.end-panel {
  width: min(100%, 430px);
  text-align: center;
}

.start-panel {
  display: grid;
  gap: 22px;
  border: 1px solid rgb(192 201 196 / 42%);
  border-radius: 32px;
  padding: clamp(28px, 7vw, 42px);
  background: rgb(255 255 255 / 72%);
  box-shadow: 0 24px 70px rgb(54 103 88 / 10%);
  backdrop-filter: blur(14px);
}

.start-logo {
  width: 78px;
  height: 78px;
  margin: 0 auto -4px;
  border-radius: 999px;
  object-fit: cover;
  box-shadow: 0 14px 32px rgb(116 89 69 / 10%);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  color: #131b2f;
  font-size: clamp(2.35rem, 8.5vw, 4.15rem);
  line-height: 1;
  letter-spacing: 0;
}

.role-selector {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0;
  border: 1px solid rgb(192 201 196 / 44%);
  border-radius: 999px;
  padding: 6px;
  background: #f2f4f7;
}

.role-card {
  min-width: 0;
}

.role-card input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.role-card span {
  display: grid;
  min-height: 52px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: rgb(64 73 69 / 72%);
  font-size: 1rem;
  font-weight: 800;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.role-card input:checked + span {
  border-color: color-mix(in srgb, var(--start-accent-strong) 22%, transparent);
  background: var(--start-accent);
  color: var(--start-accent-strong);
  box-shadow: 0 8px 18px var(--start-accent-shadow);
}

.role-card:active span {
  transform: scale(0.98);
}

.start-actions {
  display: grid;
  gap: 12px;
}

.button {
  display: inline-grid;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  border: 0;
  border-radius: 999px;
  padding: 0 20px;
  color: var(--ink);
  font-weight: 850;
  letter-spacing: 0;
  transition: transform 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.button:active {
  transform: translateY(1px) scale(0.99);
}

.button.primary {
  background: var(--accent);
  color: #ffffff;
  box-shadow: 0 12px 26px rgb(54 103 88 / 18%);
}

#start-screen .button.primary {
  background: var(--start-accent);
  color: var(--start-accent-strong);
  box-shadow: 0 12px 26px var(--start-accent-shadow);
}

.button.primary:hover {
  background: var(--accent-strong);
}

#start-screen .button.primary:hover {
  background: color-mix(in srgb, var(--start-accent) 86%, white);
}

.button.secondary {
  border: 1px solid rgb(192 201 196 / 58%);
  background: rgb(255 255 255 / 66%);
  color: rgb(64 73 69 / 76%);
}

.button.danger {
  border: 1px solid rgb(189 98 96 / 24%);
  background: #fff8f7;
  color: #963f3d;
}

.game-header {
  display: grid;
  align-items: center;
  width: 100%;
  min-height: 118px;
  border-bottom: 1px solid #eef1f4;
  background: rgb(255 255 255 / 84%);
  backdrop-filter: blur(12px);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 18px;
  width: min(100%, 680px);
  margin: 0 auto;
  padding: 18px 24px;
}

.brand-lockup img {
  width: 62px;
  height: 62px;
  border-radius: 999px;
  object-fit: cover;
}

.brand-lockup span {
  color: #131b2f;
  font-size: clamp(1.8rem, 5.6vw, 2.8rem);
  font-weight: 850;
  letter-spacing: 0;
}

.game-stage {
  --game-header-height: 118px;
  --stage-gap: clamp(26px, 4.2svh, 44px);
  --stage-pad-top: clamp(44px, 7svh, 64px);
  --stage-pad-bottom: 104px;
  --stats-block: clamp(62px, 14.6vw, 98px);
  --question-block: clamp(92px, 13svh, 132px);
  --timeline-block: 86px;
  --image-fit-size: calc(
    100svh - var(--game-header-height) - var(--stage-pad-top) - var(--stage-pad-bottom) -
    var(--stats-block) - var(--question-block) - var(--timeline-block) - (var(--stage-gap) * 2)
  );
  display: grid;
  grid-template-rows: auto auto auto;
  align-content: center;
  gap: var(--stage-gap);
  width: min(100%, 660px);
  height: calc(100svh - var(--game-header-height));
  min-height: 0;
  margin: 0 auto;
  padding: var(--stage-pad-top) 24px var(--stage-pad-bottom);
}

.stats-icons {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
  gap: clamp(18px, 5vw, 58px);
}

.stat-token {
  --stat-accent: #8aa2c8;
  --stat-angle: 180deg;
  --stat-bg: #f1f5fa;
  --stat-cap-radius: clamp(4px, 6%, 6px);
  --stat-icon: #53605c;
  --stat-ring-track: #e6ebf3;
  --stat-ring-width: clamp(8px, 12%, 12px);
  --stat-value: 50%;
  position: relative;
  display: grid;
  justify-items: center;
  min-width: 0;
}

.stat-pareja {
  --stat-accent: #f1a982;
  --stat-bg: #ffe4d2;
  --stat-icon: #7b5f4a;
  --stat-ring-track: #fff1e8;
}

.stat-hijos {
  --stat-accent: #73d1ac;
  --stat-bg: #ccf1e0;
  --stat-icon: #366758;
  --stat-ring-track: #e2f8ee;
}

.stat-dios {
  --stat-accent: #7f8fc9;
  --stat-bg: #dfe5fb;
  --stat-icon: #565e76;
  --stat-ring-track: #eef1ff;
}

.stat-comunidad {
  --stat-accent: #9270da;
  --stat-bg: #e4d6ff;
  --stat-icon: #5a4880;
  --stat-ring-track: #f0e9ff;
}

.stat-orb {
  position: relative;
  display: grid;
  width: clamp(62px, 14.6vw, 98px);
  aspect-ratio: 1;
  place-items: center;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--stat-bg) 86%, white), var(--stat-bg));
  color: var(--stat-icon);
  box-shadow: 0 12px 26px rgb(42 55 66 / 7%);
  transition: --stat-angle 460ms linear;
}

.stat-orb::before,
.stat-orb::after {
  display: none;
  content: none;
}

.stat-fill {
  position: absolute;
  inset: 0;
  z-index: 2;
  border-radius: inherit;
  height: auto !important;
  background: conic-gradient(from 0deg, var(--stat-accent) 0 var(--stat-angle), transparent 0);
  mask: radial-gradient(farthest-side, transparent calc(100% - var(--stat-ring-width)), #000 calc(100% - var(--stat-ring-width) + 1px));
  transition: --stat-angle 460ms linear;
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - var(--stat-ring-width)), #000 calc(100% - var(--stat-ring-width) + 1px));
}

.stat-fill::before,
.stat-fill::after {
  position: absolute;
  inset: 0;
  content: "";
  border-radius: inherit;
  background: radial-gradient(
    circle at 50% var(--stat-cap-radius),
    var(--stat-accent) 0 var(--stat-cap-radius),
    transparent calc(var(--stat-cap-radius) + 0.5px)
  );
  transform-origin: 50% 50%;
}

.stat-fill::before {
  transform: rotate(0deg);
}

.stat-fill::after {
  transition: transform 460ms linear;
  transform: rotate(var(--stat-angle));
}

.stat-icon {
  position: relative;
  z-index: 4;
  display: block;
  width: 62%;
  height: 62%;
  background: currentColor;
  mask-position: center;
  mask-repeat: no-repeat;
  mask-size: contain;
  pointer-events: none;
  user-select: none;
  -webkit-mask-position: center;
  -webkit-mask-repeat: no-repeat;
  -webkit-mask-size: contain;
}

.stat-icon-alianzas {
  width: 61%;
  height: 61%;
  mask-image: url("../img/icon-alianzas.svg");
  -webkit-mask-image: url("../img/icon-alianzas.svg");
}

.stat-icon-hijos,
.stat-icon-comunidad {
  width: 68%;
  height: 68%;
}

.stat-icon-hijos {
  mask-image: url("../img/icon-hijos.svg");
  -webkit-mask-image: url("../img/icon-hijos.svg");
}

.stat-icon-dios {
  width: 67%;
  height: 67%;
  mask-image: url("../img/icon-dios.svg");
  -webkit-mask-image: url("../img/icon-dios.svg");
}

.stat-icon-comunidad {
  mask-image: url("../img/icon-comunidad.svg");
  -webkit-mask-image: url("../img/icon-comunidad.svg");
}

.stat-value {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.impact-dot {
  position: absolute;
  top: -25px;
  left: 50%;
  z-index: 3;
  width: 11px;
  height: 11px;
  border-radius: 999px;
  background: #5f6678;
  box-shadow: none;
  opacity: 0;
  transform: translate(-50%, 8px) scale(0.5);
  transition: opacity 120ms ease, transform 160ms ease, background 120ms ease, width 120ms ease, height 120ms ease, top 120ms ease, box-shadow 120ms ease;
}

.impact-dot.is-visible {
  opacity: var(--impact-opacity, 1);
  transform: translate(-50%, 0) scale(1);
}

.impact-dot.impact-small {
  top: -20px;
  width: 7px;
  height: 7px;
  box-shadow: none;
}

.impact-dot.impact-large {
  top: -25px;
  width: 11px;
  height: 11px;
  box-shadow: none;
}

.impact-dot.effect-positive {
  background: #5f6678;
}

.impact-dot.effect-negative {
  background: #5f6678;
}

.game-table {
  display: grid;
  place-items: center;
  width: 100%;
}

.decision-card {
  position: relative;
  display: grid;
  gap: 14px;
  width: 100%;
  overflow: visible;
  background: transparent;
  user-select: none;
}

.image-swipe-stage {
  position: relative;
  display: grid;
  width: min(100%, max(50%, var(--image-fit-size)));
  margin: 0 auto;
  isolation: isolate;
  perspective: 900px;
  transform-style: preserve-3d;
}

.image-swipe-stage::before {
  position: absolute;
  inset: 0;
  z-index: 0;
  content: "";
  border: 1px solid rgb(192 201 196 / 38%);
  border-radius: 28px;
  background:
    linear-gradient(rgb(255 255 255 / 8%), rgb(255 255 255 / 8%)),
    url("../img/fondo_naipe.png") center / cover;
  box-shadow: 0 18px 42px rgb(54 103 88 / 7%);
  opacity: 0;
  pointer-events: none;
  transform: translate(8px, 10px) scale(0.985);
  transition: opacity 120ms ease;
}

.card-back,
.image-swipe-card {
  grid-area: 1 / 1;
  overflow: hidden;
  border: 1px solid rgb(192 201 196 / 42%);
  border-radius: 28px;
  aspect-ratio: 1;
  backface-visibility: hidden;
  box-shadow: 0 20px 50px rgb(54 103 88 / 8%);
  transform-style: preserve-3d;
  -webkit-backface-visibility: hidden;
}

.card-back {
  z-index: 1;
  background:
    linear-gradient(rgb(255 255 255 / 8%), rgb(255 255 255 / 8%)),
    url("../img/fondo_naipe.png") center / cover;
  opacity: 0;
  transform: none;
  transition: opacity 140ms ease;
}

.image-swipe-stage.is-swiping .card-back {
  opacity: 0.92;
}

.image-swipe-stage.is-deck-ready .card-back {
  opacity: 1;
  transition: none;
}

.image-swipe-stage.is-deck-ready::before,
.image-swipe-stage.is-dealing::before {
  opacity: 0.88;
  transition: none;
}

.image-swipe-stage.is-dealing .card-back {
  z-index: 4;
  opacity: 1;
  transform-origin: 50% 50%;
  transition: none;
  animation: card-back-deal 480ms linear both;
}

.image-swipe-card {
  position: relative;
  z-index: 2;
  backface-visibility: hidden;
  background: #ffffff;
  touch-action: pan-y;
  transform-origin: 50% 88%;
  will-change: transform, opacity;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.image-swipe-stage.is-dealing .image-swipe-card {
  z-index: 3;
  pointer-events: none;
  transform-origin: 50% 50%;
}

.image-swipe-card.is-dragging {
  transition: none;
}

.image-swipe-card img {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--surface-2);
  object-fit: cover;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

#question-text {
  display: grid;
  align-content: center;
  justify-self: stretch;
  width: 100%;
  min-height: clamp(92px, 13svh, 132px);
  margin: 0;
  padding: clamp(22px, 5vw, 34px) clamp(24px, 7vw, 58px);
  color: #191c1e;
  font-size: clamp(1.2rem, 3.8vw, 1.72rem);
  font-weight: 400;
  line-height: 1.18;
  text-align: center;
  text-wrap: balance;
}

.swipe-option {
  position: absolute;
  top: 0;
  right: 0;
  left: 0;
  z-index: 4;
  display: grid;
  box-sizing: border-box;
  width: 100%;
  height: clamp(112px, 31%, 168px);
  align-items: start;
  padding-block: clamp(18px, 4vw, 30px) clamp(34px, 7vw, 50px);
  color: #ffffff;
  background: rgb(14 18 24 / 72%);
  font-size: clamp(1.05rem, 4vw, 1.52rem);
  font-weight: 500;
  line-height: 1.12;
  opacity: 0;
  overflow: hidden;
  overflow-wrap: anywhere;
  pointer-events: none;
  text-shadow: 0 1px 10px rgb(0 0 0 / 18%);
  text-wrap: balance;
  transition: opacity 90ms linear, clip-path 90ms linear;
}

.swipe-option::before {
  display: none;
  content: none;
}

.swipe-left {
  justify-items: end;
  padding-right: clamp(20px, 5vw, 34px);
  padding-left: 25%;
  text-align: right;
  clip-path: polygon(0 0, 100% 0, 100% 66%, 0 43%);
}

.swipe-right {
  justify-items: start;
  padding-right: 25%;
  padding-left: clamp(20px, 5vw, 34px);
  text-align: left;
  clip-path: polygon(0 0, 100% 0, 100% 43%, 0 66%);
}

.image-swipe-card[data-swipe="left"] .swipe-left,
.image-swipe-card[data-swipe="right"] .swipe-right {
  opacity: var(--swipe-opacity, 0);
}

.card-answered-right {
  opacity: 0;
  transform: translateX(120vw) rotate(16deg);
  transition: transform 240ms ease, opacity 240ms ease;
}

.card-answered-left {
  opacity: 0;
  transform: translateX(-120vw) rotate(-16deg);
  transition: transform 240ms ease, opacity 240ms ease;
}

.card-enter {
  animation: card-front-deal 480ms linear both;
}

.timeline-panel {
  display: grid;
  justify-items: center;
  gap: 16px;
}

.timeline-track {
  position: relative;
  width: 100%;
  height: 18px;
  overflow: hidden;
}

.timeline-track::before {
  position: absolute;
  top: 50%;
  right: 0;
  left: 0;
  height: 2px;
  content: "";
  background: rgb(192 201 196 / 42%);
  transform: translateY(-50%);
}

.timeline-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 11px;
  height: 11px;
  border: 2px solid #f7f9fc;
  border-radius: 999px;
  background: #366758;
  box-shadow: 0 0 0 1px rgb(54 103 88 / 10%);
  transform: translate(-50%, -50%);
}

.timeline-track.is-sliding::before {
  visibility: hidden;
}

.timeline-frame {
  position: absolute;
  inset: 0;
}

.timeline-frame::before,
.timeline-frame::after {
  position: absolute;
  content: "";
}

.timeline-frame::before {
  top: 50%;
  right: 0;
  left: 0;
  height: 2px;
  background: rgb(192 201 196 / 42%);
  transform: translateY(-50%);
}

.timeline-frame::after {
  top: 50%;
  left: 50%;
  width: 11px;
  height: 11px;
  border: 2px solid #f7f9fc;
  border-radius: 999px;
  background: #366758;
  box-shadow: 0 0 0 1px rgb(54 103 88 / 10%);
  transform: translate(-50%, -50%);
}

.timeline-frame-exit {
  animation: timeline-track-exit-left 640ms cubic-bezier(0.18, 0.86, 0.2, 1) both;
}

.timeline-frame-enter {
  animation: timeline-track-enter-right 640ms cubic-bezier(0.18, 0.86, 0.2, 1) both;
}

.timeline-year {
  position: relative;
  display: grid;
  width: 100%;
  min-height: 36px;
  place-items: center;
  overflow: hidden;
  color: #171b22;
  font-size: clamp(1.28rem, 4.8vw, 1.95rem);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-align: center;
  text-transform: uppercase;
}

.year-text {
  display: block;
  white-space: nowrap;
}

.timeline-year.is-sliding .year-text {
  position: absolute;
}

.year-exit {
  animation: year-exit-left 640ms cubic-bezier(0.18, 0.86, 0.2, 1) both;
}

.year-enter {
  animation: year-enter-right 640ms cubic-bezier(0.18, 0.86, 0.2, 1) both;
}

.milestone-badge {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 1px solid #efc9b2;
  border-radius: 999px;
  padding: 9px 18px;
  background: #ffe2cf;
  color: #745945;
  box-shadow: 0 7px 14px rgb(128 95 74 / 9%);
  font-size: clamp(0.74rem, 2.5vw, 0.88rem);
  font-weight: 800;
  letter-spacing: 0.11em;
  text-transform: uppercase;
}

.milestone-badge > span {
  position: relative;
  z-index: 2;
}

.badge-star {
  font-size: 0.95em;
  line-height: 1;
}

.milestone-badge::before,
.milestone-badge::after {
  position: absolute;
  pointer-events: none;
  content: "";
}

.milestone-badge::before {
  top: 50%;
  left: 50%;
  z-index: 0;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #efc09f;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.25);
}

.milestone-badge::after {
  inset: -7px;
  z-index: 1;
  border: 1px solid rgb(239 192 159 / 42%);
  border-radius: inherit;
  opacity: 0;
}

.milestone-badge.badge-pop {
  animation: badge-pop 1160ms cubic-bezier(0.18, 1.35, 0.25, 1) both;
}

.milestone-badge.badge-pop::before {
  animation: badge-spark-burst 1180ms ease-out both;
}

.milestone-badge.badge-pop::after {
  animation: badge-halo 1050ms ease-out both;
}

.milestone-badge.badge-pop .badge-star {
  animation: badge-star-twinkle 920ms ease-out both;
}

.previous-question {
  border: 0;
  background: transparent;
  color: #a8adb4;
  font-size: clamp(0.72rem, 2.4vw, 0.86rem);
  font-weight: 750;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.previous-question:not(:disabled) {
  color: rgb(64 73 69 / 38%);
}

.previous-question-bar {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 20;
  display: flex;
  justify-content: center;
  padding: 28px 20px max(24px, env(safe-area-inset-bottom));
  background: linear-gradient(to top, #f7f9fc 34%, rgb(247 249 252 / 86%) 68%, rgb(247 249 252 / 0));
  pointer-events: none;
}

.previous-question-bar .previous-question {
  pointer-events: auto;
}

.tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 58;
  overflow: hidden;
  background: rgb(19 27 47 / 58%);
}

.tutorial-overlay::before {
  position: absolute;
  inset: 0;
  content: "";
  background: rgb(0 0 0 / 8%);
  pointer-events: none;
}

.tutorial-callout {
  position: fixed;
  z-index: 1;
  width: max-content;
  max-width: min(315px, calc(100vw - 40px));
  border: 1px solid rgb(255 255 255 / 78%);
  border-radius: 22px;
  padding: 13px 16px;
  background: rgb(255 255 255 / 86%);
  color: #253039;
  box-shadow: 0 18px 44px rgb(42 55 66 / 13%);
  font-size: clamp(0.84rem, 2.7vw, 0.98rem);
  font-weight: 760;
  line-height: 1.32;
  text-align: center;
  animation: tutorial-callout-in 520ms cubic-bezier(0.18, 0.82, 0.22, 1) both;
}

.tutorial-callout p {
  margin: 0;
}

.tutorial-callout-icons {
  top: clamp(120px, 17svh, 174px);
  left: 50%;
  transform: translateX(-50%);
}

.tutorial-callout-card {
  top: clamp(360px, 49svh, 520px);
  right: max(18px, calc(50vw - 330px));
  text-align: left;
}

.tutorial-callout-previous {
  bottom: max(152px, calc(env(safe-area-inset-bottom) + 152px));
  left: 50%;
  transform: translateX(-50%);
}

.tutorial-arrow {
  position: absolute;
  display: block;
  color: #ffffff;
  background: #ffffff;
  border-radius: 999px;
  opacity: 0.78;
  pointer-events: none;
  animation: tutorial-arrow-pulse 1180ms ease-in-out infinite;
}

.tutorial-arrow::after {
  position: absolute;
  width: 11px;
  height: 11px;
  content: "";
}

.tutorial-arrow-down,
.tutorial-arrow-previous {
  bottom: -44px;
  left: 50%;
  width: 3px;
  height: 44px;
  transform: translateX(-50%);
}

.tutorial-arrow-down::after,
.tutorial-arrow-previous::after {
  bottom: 0;
  left: 50%;
  border-right: 3px solid currentColor;
  border-bottom: 3px solid currentColor;
  transform: translateX(-50%) rotate(45deg);
}

.tutorial-arrow-card {
  top: 50%;
  left: -46px;
  width: 46px;
  height: 3px;
  transform: translateY(-50%);
}

.tutorial-arrow-card::after {
  top: 50%;
  left: 0;
  border-bottom: 3px solid currentColor;
  border-left: 3px solid currentColor;
  transform: translateY(-50%) rotate(45deg);
}

.button.primary.tutorial-start {
  position: fixed;
  right: 50%;
  top: max(18px, env(safe-area-inset-top));
  z-index: 2;
  min-height: 50px;
  background: var(--start-accent);
  color: var(--start-accent-strong);
  box-shadow: 0 14px 30px var(--start-accent-shadow);
  transform: translateX(50%);
}

.button.primary.tutorial-start:hover {
  background: color-mix(in srgb, var(--start-accent) 86%, white);
}

.button.primary.tutorial-start:active {
  transform: translateX(50%) translateY(1px) scale(0.99);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgb(247 249 252 / 74%);
  backdrop-filter: blur(10px);
}

.modal-panel {
  display: grid;
  width: min(100%, 430px);
  gap: 16px;
  border: 1px solid rgb(192 201 196 / 54%);
  border-radius: 28px;
  padding: 24px;
  background: #ffffff;
  box-shadow: 0 24px 70px rgb(54 103 88 / 14%);
}

.modal-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.modal-heading h2 {
  margin: 0;
  color: #131b2f;
  font-size: 1.35rem;
  line-height: 1.15;
}

.modal-panel h2 {
  margin: 0;
  color: #131b2f;
  font-size: 1.25rem;
  line-height: 1.2;
}

.modal-question,
.modal-explanation {
  margin: 0;
  line-height: 1.48;
}

.modal-question {
  color: #191c1e;
  font-size: 1.08rem;
  font-weight: 650;
}

.modal-explanation {
  color: #404945;
  font-size: 0.98rem;
}

.end-panel img {
  width: min(100%, 390px);
  aspect-ratio: 16 / 10;
  border: 1px solid rgb(38 51 49 / 10%);
  border-radius: 8px;
  background: var(--surface-2);
  object-fit: cover;
  box-shadow: var(--shadow);
}

.end-panel h2 {
  margin: 22px 0 10px;
  font-size: clamp(1.75rem, 7vw, 2.55rem);
  line-height: 1.05;
  letter-spacing: 0;
}

.end-panel p {
  margin: 0 auto 18px;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.5;
}

.survival {
  font-weight: 900;
  color: var(--accent-strong) !important;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  max-width: min(360px, calc(100vw - 32px));
  border: 1px solid rgb(189 98 96 / 26%);
  border-radius: 8px;
  padding: 12px 14px;
  background: #fff8f7;
  color: #7d3433;
  font-weight: 750;
  box-shadow: 0 12px 30px rgb(38 51 49 / 12%);
}

.admin-page {
  min-height: 100svh;
}

.admin-login-screen {
  display: grid;
  min-height: 100svh;
  place-items: center;
  padding: 22px;
}

.admin-login {
  display: grid;
  width: min(100%, 390px);
  gap: 14px;
  border: 1px solid rgb(38 51 49 / 10%);
  border-radius: 8px;
  padding: 24px;
  background: rgb(255 253 249 / 86%);
  box-shadow: var(--shadow);
}

.admin-login h1 {
  margin: 0 0 6px;
  font-size: clamp(2.2rem, 10vw, 3.6rem);
}

.admin-login label {
  display: grid;
  gap: 6px;
}

.admin-login label > span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.admin-login input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
}

.login-error {
  margin: 0;
  color: #963f3d;
  font-weight: 800;
}

.admin-shell {
  width: min(1280px, 100%);
  min-height: 100svh;
  margin: 0 auto;
  padding: 22px;
}

.admin-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.admin-header h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.25rem);
  line-height: 1;
}

.admin-actions,
.editor-actions,
.admin-tools {
  display: flex;
  gap: 10px;
}

.admin-actions {
  flex-wrap: wrap;
  justify-content: end;
}

.admin-actions .button,
.editor-actions .button,
.admin-tools .button {
  min-height: 42px;
  padding: 0 14px;
}

.admin-panel-switch.is-active {
  border-color: rgb(54 103 88 / 24%);
  background: #edf6f1;
  color: var(--accent-strong);
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.admin-sidebar,
.admin-editor {
  border: 1px solid rgb(38 51 49 / 10%);
  border-radius: 8px;
  background: rgb(255 253 249 / 82%);
  box-shadow: 0 14px 34px rgb(38 51 49 / 9%);
}

.admin-sidebar {
  position: sticky;
  top: 18px;
  max-height: calc(100svh - 44px);
  overflow: hidden;
}

.admin-tools {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr) auto;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.admin-tools.death-tools {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.death-tools input,
.death-tools .button {
  grid-column: 1 / -1;
}

.question-list {
  max-height: calc(100svh - 120px);
  overflow: auto;
  padding: 8px;
}

.question-item {
  display: grid;
  width: 100%;
  gap: 5px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 10px;
  background: transparent;
  color: var(--ink);
  text-align: left;
}

.question-item:hover,
.question-item.is-active {
  border-color: rgb(63 117 107 / 28%);
  background: #edf6f1;
}

.question-item strong {
  display: -webkit-box;
  overflow: hidden;
  font-size: 0.95rem;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.question-meta {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
  text-transform: uppercase;
}

.admin-editor {
  padding: 18px;
}

.question-form,
.answer-editor {
  display: grid;
  gap: 14px;
}

.editor-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 14px;
}

.editor-heading h2 {
  margin: 0;
  font-size: clamp(1.35rem, 3vw, 2rem);
  line-height: 1.1;
}

.form-grid,
.answer-editors {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.question-form label,
.answer-editor label {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.question-form label > span,
.answer-editor label > span,
.answer-editor legend {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.question-form input,
.question-form select,
.question-form textarea,
.admin-tools input,
.admin-tools select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
}

.question-form textarea {
  min-height: 92px;
  resize: vertical;
  line-height: 1.4;
}

.image-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 10px;
}

.image-field .button {
  min-height: 42px;
  padding: 0 14px;
}

.image-preview {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.image-preview img {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 6;
  object-fit: cover;
}

.answer-editor {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdfb;
}

.answer-editor legend {
  padding: 0 6px;
}

.effects-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.effects-grid input {
  min-height: 38px;
}

.empty-state {
  margin: 12px;
  color: var(--muted);
  font-weight: 750;
}

.image-library-panel {
  width: min(920px, 100%);
  max-height: min(82svh, 760px);
  overflow: hidden;
  grid-template-rows: auto auto minmax(0, 1fr);
}

.image-upload-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfdfb;
}

.image-upload-form label {
  display: grid;
  gap: 6px;
}

.image-upload-form label > span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.image-upload-form input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
}

.image-upload-form .button {
  min-height: 42px;
  padding: 0 16px;
}

.image-library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
  min-height: 180px;
  overflow: auto;
  padding: 2px;
}

.image-choice {
  position: relative;
  display: block;
  gap: 8px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
  overflow: hidden;
}

.image-choice:hover,
.image-choice.is-selected {
  border-color: rgb(54 103 88 / 42%);
  background: #eef8f4;
}

.image-select {
  display: block;
  width: 100%;
  border: 0;
  padding: 8px;
  background: transparent;
  color: inherit;
}

.image-choice img {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 6px;
  background: var(--surface-2);
  object-fit: cover;
}

.image-actions {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 2;
  display: flex;
  gap: 6px;
  align-items: center;
}

.image-delete,
.image-replace {
  display: grid;
  height: 30px;
  place-items: center;
  border: 1px solid rgb(189 98 96 / 24%);
  border-radius: 999px;
  background: rgb(255 255 255 / 88%);
  box-shadow: 0 8px 18px rgb(38 51 49 / 12%);
  font-weight: 900;
  line-height: 1;
}

.image-delete {
  width: 30px;
  color: #963f3d;
  font-size: 1.2rem;
}

.image-replace {
  min-width: 78px;
  padding: 0 10px;
  color: var(--accent-strong);
  font-size: 0.72rem;
  text-transform: uppercase;
}

.image-delete:hover {
  background: #fff1ef;
}

.image-replace:hover {
  background: #edf6f1;
}

.image-delete:disabled,
.image-replace:disabled {
  border-color: rgb(192 201 196 / 26%);
  background: rgb(255 255 255 / 58%);
  color: rgb(64 73 69 / 26%);
  cursor: not-allowed;
  box-shadow: none;
}

.is-hidden {
  display: none !important;
}

.visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
}

@keyframes card-back-deal {
  0% {
    visibility: visible;
    box-shadow: 0 20px 50px rgb(54 103 88 / 8%);
    transform: translateY(0) rotateY(0deg) scale(1);
  }

  49.9% {
    visibility: visible;
    box-shadow: 0 20px 50px rgb(54 103 88 / 8%);
    transform: translateY(0) rotateY(89.8deg) scale(1);
  }

  50%,
  100% {
    visibility: hidden;
    box-shadow: 0 20px 50px rgb(54 103 88 / 8%);
    transform: translateY(0) rotateY(90deg) scale(1);
  }
}

@keyframes card-front-deal {
  0%,
  49.9% {
    visibility: hidden;
    box-shadow: 0 20px 50px rgb(54 103 88 / 8%);
    transform: translateY(0) rotateY(-89.8deg) scale(1);
  }

  50% {
    visibility: visible;
    box-shadow: 0 20px 50px rgb(54 103 88 / 8%);
    transform: translateY(0) rotateY(-89.8deg) scale(1);
  }

  100% {
    visibility: visible;
    box-shadow: 0 20px 50px rgb(54 103 88 / 8%);
    transform: translateY(0) rotateY(0deg) scale(1);
  }
}

@keyframes timeline-pulse {
  0% {
    box-shadow: 0 0 0 0 rgb(47 117 104 / 28%);
    transform: translate(-50%, -50%) scale(1);
  }

  45% {
    box-shadow: 0 0 0 16px rgb(47 117 104 / 0%);
    transform: translate(-50%, -50%) scale(1.24);
  }

  100% {
    box-shadow: 0 0 0 0 rgb(47 117 104 / 0%);
    transform: translate(-50%, -50%) scale(1);
  }
}

@keyframes timeline-track-exit-left {
  from {
    transform: translateX(0);
  }

  to {
    transform: translateX(-100vw);
  }
}

@keyframes timeline-track-enter-right {
  from {
    transform: translateX(100vw);
  }

  to {
    transform: translateX(0);
  }
}

@keyframes year-exit-left {
  from {
    transform: translateX(0);
  }

  to {
    transform: translateX(-100vw);
  }
}

@keyframes year-enter-right {
  from {
    transform: translateX(100vw);
  }

  to {
    transform: translateX(0);
  }
}

@keyframes badge-pop {
  0% {
    opacity: 0;
    filter: saturate(0.85);
    transform: translateY(14px) scale(0.76);
  }

  44% {
    opacity: 1;
    filter: saturate(1.12);
    transform: translateY(-5px) scale(1.07);
  }

  70% {
    transform: translateY(1px) scale(0.985);
  }

  100% {
    opacity: 1;
    filter: saturate(1);
    transform: translateY(0) scale(1);
  }
}

@keyframes badge-halo {
  0% {
    opacity: 0;
    transform: scale(0.78);
  }

  32% {
    opacity: 0.85;
  }

  100% {
    opacity: 0;
    transform: scale(1.55);
  }
}

@keyframes badge-spark-burst {
  0% {
    opacity: 0;
    box-shadow:
      0 0 0 #efc09f,
      0 0 0 #d7defa,
      0 0 0 #b5ead7,
      0 0 0 #fdd9c0,
      0 0 0 #efc09f,
      0 0 0 #d7defa;
    transform: translate(-50%, -50%) scale(0.1);
  }

  30% {
    opacity: 1;
    box-shadow:
      -58px -12px 0 #efc09f,
      -34px 24px 0 #d7defa,
      38px -22px 0 #b5ead7,
      58px 12px 0 #fdd9c0,
      -4px -35px 0 #efc09f,
      8px 34px 0 #d7defa;
    transform: translate(-50%, -50%) scale(0.95);
  }

  100% {
    opacity: 0;
    box-shadow:
      -76px -22px 0 #efc09f,
      -50px 38px 0 #d7defa,
      54px -36px 0 #b5ead7,
      76px 25px 0 #fdd9c0,
      -8px -50px 0 #efc09f,
      14px 50px 0 #d7defa;
    transform: translate(-50%, -50%) scale(0.25);
  }
}

@keyframes badge-star-twinkle {
  0% {
    opacity: 0;
    transform: rotate(-24deg) scale(0.5);
  }

  42% {
    opacity: 1;
    transform: rotate(12deg) scale(1.35);
  }

  100% {
    opacity: 1;
    transform: rotate(0) scale(1);
  }
}

@keyframes tutorial-callout-in {
  from {
    opacity: 0;
    filter: blur(2px);
    margin-top: 10px;
  }

  to {
    opacity: 1;
    filter: blur(0);
    margin-top: 0;
  }
}

@keyframes tutorial-arrow-pulse {
  0%,
  100% {
    opacity: 0.58;
  }

  50% {
    opacity: 0.95;
  }
}

@media (min-width: 621px) {
  #start-screen {
    padding: clamp(20px, 3svh, 32px);
  }

  .start-panel {
    width: min(100%, 480px);
    gap: 18px;
    padding: clamp(30px, 4svh, 38px) clamp(34px, 4vw, 42px);
  }

  #start-screen h1 {
    font-size: clamp(2.35rem, 4vw, 3.25rem);
    overflow-wrap: anywhere;
  }

  .start-logo {
    width: clamp(66px, 9svh, 76px);
    height: clamp(66px, 9svh, 76px);
  }

  #game-screen.screen-active {
    --game-header-height: clamp(76px, 10svh, 96px);
    grid-template-rows: var(--game-header-height) minmax(0, 1fr);
  }

  .game-header {
    height: var(--game-header-height);
    min-height: 0;
  }

  .brand-lockup {
    gap: 14px;
    padding: 12px 24px;
  }

  .brand-lockup img {
    width: clamp(46px, 6.2svh, 56px);
    height: clamp(46px, 6.2svh, 56px);
  }

  .brand-lockup span {
    font-size: clamp(1.65rem, 3.3svh, 2.25rem);
  }

  .game-stage {
    --game-header-height: clamp(76px, 10svh, 96px);
    --stage-gap: clamp(12px, 1.8svh, 22px);
    --stage-pad-top: clamp(18px, 2.4svh, 28px);
    --stage-pad-bottom: 72px;
    --stats-block: clamp(66px, 9.2svh, 84px);
    --question-block: clamp(88px, 11svh, 118px);
    --timeline-block: 52px;
    align-content: center;
    width: min(100%, calc(clamp(330px, 48svh, 512px) + 48px));
    height: calc(100svh - var(--game-header-height));
    min-height: 0;
    gap: var(--stage-gap);
    padding: var(--stage-pad-top) 24px var(--stage-pad-bottom);
  }

  .stats-icons {
    gap: clamp(20px, 3.4vw, 42px);
  }

  .stat-orb {
    width: clamp(66px, 9.2svh, 84px);
  }

  .decision-card {
    width: 100%;
  }

  .image-swipe-stage {
    width: min(100%, max(50%, var(--image-fit-size)));
  }

  .card-back,
  .image-swipe-card {
    height: auto;
    aspect-ratio: 1;
  }

  #question-text {
    min-height: clamp(88px, 11svh, 118px);
    padding: clamp(18px, 2.8svh, 28px) clamp(30px, 5vw, 52px);
    font-size: clamp(1.08rem, 2.3svh, 1.48rem);
  }

  .timeline-panel {
    gap: 8px;
  }

  .timeline-track {
    height: 14px;
  }

  .timeline-year {
    min-height: 30px;
    font-size: clamp(1rem, 2.4svh, 1.35rem);
  }

  .milestone-badge {
    padding: 7px 15px;
    font-size: clamp(0.68rem, 1.05svh, 0.78rem);
  }

  .previous-question-bar {
    padding: 16px 20px max(16px, env(safe-area-inset-bottom));
  }
}

@media (max-width: 620px) {
  .screen {
    padding: 12px;
  }

  .start-panel {
    gap: 18px;
    border-radius: 28px;
    padding: 26px 20px;
  }

  .start-logo {
    width: 66px;
    height: 66px;
    border-radius: 999px;
  }

  #game-screen.screen-active {
    gap: 0;
  }

  .game-header {
    min-height: 86px;
  }

  .brand-lockup {
    gap: 12px;
    padding: 12px 24px;
  }

  .brand-lockup img {
    width: 48px;
    height: 48px;
    border-radius: 999px;
  }

  .game-stage {
    --game-header-height: 86px;
    --stage-gap: 12px;
    --stage-pad-top: 22px;
    --stage-pad-bottom: 78px;
    --stats-block: 62px;
    --question-block: 82px;
    --timeline-block: 72px;
    gap: var(--stage-gap);
    height: calc(100svh - var(--game-header-height));
    min-height: 0;
    padding: var(--stage-pad-top) 22px var(--stage-pad-bottom);
  }

  .stats-icons {
    gap: 14px;
  }

  .stat-orb {
    border-width: 3px;
  }

  .decision-card {
    width: 100%;
  }

  .image-swipe-stage {
    width: min(100%, max(50%, var(--image-fit-size)));
  }

  .card-back,
  .image-swipe-card {
    border-radius: 30px;
  }

  #question-text {
    min-height: 82px;
    padding: 16px 24px;
    font-size: 1.08rem;
  }

  .swipe-option {
    height: clamp(104px, 33%, 126px);
    padding-block: 18px 36px;
    font-size: clamp(1.02rem, 5.2vw, 1.22rem);
  }

  .swipe-left {
    padding-right: 20px;
    padding-left: 25%;
  }

  .swipe-right {
    padding-right: 25%;
    padding-left: 20px;
  }

  .timeline-panel {
    gap: 8px;
  }

  .milestone-badge {
    padding: 10px 18px;
  }

  .tutorial-callout {
    max-width: calc(100vw - 34px);
    border-radius: 18px;
    padding: 10px 12px;
    font-size: 0.8rem;
  }

  .tutorial-callout-icons {
    top: 96px;
    width: calc(100vw - 44px);
  }

  .tutorial-callout-card {
    top: 47svh;
    right: 17px;
    left: 17px;
    width: auto;
    text-align: center;
  }

  .tutorial-callout-previous {
    bottom: max(148px, calc(env(safe-area-inset-bottom) + 148px));
    width: calc(100vw - 56px);
  }

  .tutorial-arrow-card {
    top: -38px;
    left: 50%;
    width: 3px;
    height: 38px;
    transform: translateX(-50%);
  }

  .tutorial-arrow-card::after {
    top: 0;
    left: 50%;
    border-top: 3px solid currentColor;
    border-left: 3px solid currentColor;
    border-bottom: 0;
    transform: translateX(-50%) rotate(45deg);
  }

  .tutorial-start {
    top: max(14px, env(safe-area-inset-top));
    width: min(310px, calc(100vw - 44px));
  }
}

@media (max-width: 820px) {
  .admin-shell {
    padding: 14px;
  }

  .admin-header,
  .editor-heading {
    display: grid;
  }

  .admin-actions,
  .editor-actions {
    justify-content: stretch;
  }

  .admin-actions .button,
  .editor-actions .button {
    width: 100%;
  }

  .admin-layout,
  .form-grid,
  .answer-editors,
  .image-field,
  .image-upload-form {
    grid-template-columns: 1fr;
  }

  .admin-sidebar {
    position: static;
    max-height: none;
  }

  .question-list {
    max-height: 38svh;
  }

  .admin-tools {
    grid-template-columns: 1fr;
  }

  .admin-tools.death-tools {
    grid-template-columns: 1fr;
  }

  .image-library-panel {
    max-height: 88svh;
  }

  .modal-heading {
    display: grid;
  }
}

@media (max-width: 380px) {
  .role-selector {
    grid-template-columns: 1fr;
  }

  .decision-card {
    width: 100%;
  }
}

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