:root {
  --bg: #0e1a18;
  --bg-2: #152824;
  --ink: #f6f0e6;
  --muted: rgba(246, 240, 230, 0.68);
  --accent: #d4a24c;
  --accent-2: #e8c57a;
  --accent-soft: rgba(212, 162, 76, 0.2);
  --line: rgba(246, 240, 230, 0.14);
  --ok: #7dbe9a;
  --danger: #e08b7a;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Outfit", sans-serif;
}

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

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

body {
  font-family: var(--font-body);
  color: var(--ink);
  background:
    radial-gradient(900px 420px at 15% -5%, rgba(212, 162, 76, 0.16), transparent 55%),
    radial-gradient(700px 380px at 95% 10%, rgba(125, 190, 154, 0.1), transparent 50%),
    linear-gradient(165deg, var(--bg), var(--bg-2));
  overflow-x: hidden;
}

.topbar {
  position: fixed;
  inset: 0 0 auto;
  z-index: 30;
  backdrop-filter: blur(8px);
  background: rgba(14, 26, 24, 0.55);
}

.topbar-progress {
  height: 4px;
  background: rgba(255, 255, 255, 0.06);
}

.topbar-progress > i {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.topbar-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 1.25rem 0.75rem;
  font-size: 0.82rem;
  color: var(--muted);
}

.hub-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.hub-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.15rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.2);
  color: var(--ink);
  text-decoration: none;
  transition: border-color 0.2s ease, transform 0.15s ease;
}

.hub-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
}

.hub-card span {
  color: var(--accent);
  font-weight: 600;
}

.admin-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 0.75rem;
  margin-left: 0.75rem;
  opacity: 0.55;
}

.admin-link:hover {
  color: var(--accent);
  opacity: 1;
}

.viewport {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 5.5rem 1.25rem 3rem;
}

.slide-layer {
  width: min(720px, 100%);
  position: relative;
}

.screen {
  width: 100%;
  will-change: transform, opacity;
}

.screen.enter-from-right {
  animation: enterRight 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.screen.enter-from-left {
  animation: enterLeft 0.42s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.screen.exit-to-left {
  animation: exitLeft 0.28s ease both;
}

.screen.exit-to-right {
  animation: exitRight 0.28s ease both;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 1rem;
}

.q-number {
  opacity: 0.75;
  font-variant-numeric: tabular-nums;
}

.question-title,
.welcome-title {
  font-family: var(--font-display);
  font-weight: 550;
  font-size: clamp(1.7rem, 4.6vw, 2.55rem);
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin: 0 0 0.85rem;
}

.lead {
  margin: 0 0 1.75rem;
  color: var(--muted);
  font-size: 1.05rem;
  max-width: 36rem;
}

.scale {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.55rem;
  margin-top: 1.5rem;
}

.scale button {
  appearance: none;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.22);
  color: var(--ink);
  border-radius: 16px;
  padding: 1rem 0.35rem 0.85rem;
  cursor: pointer;
  font: inherit;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.scale button:hover {
  transform: translateY(-3px);
  border-color: rgba(212, 162, 76, 0.55);
}

.scale button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.scale button.selected {
  background: var(--accent-soft);
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(212, 162, 76, 0.35), 0 10px 30px rgba(0, 0, 0, 0.2);
  transform: translateY(-3px) scale(1.03);
}

.scale .val {
  display: block;
  font-size: 1.35rem;
  font-weight: 700;
}

.scale .lbl {
  display: block;
  margin-top: 0.25rem;
  font-size: 0.78rem;
  color: var(--muted);
}

.hint-row {
  margin-top: 1.25rem;
  color: var(--muted);
  font-size: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: center;
}

.hint-row kbd,
.kbd-hint kbd {
  display: inline-block;
  min-width: 1.4em;
  padding: 0.1rem 0.4rem;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.25);
  font-size: 0.8rem;
  text-align: center;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin: 1.25rem 0 0.5rem;
}

.field input {
  appearance: none;
  width: 100%;
  border: none;
  border-bottom: 2px solid var(--line);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: clamp(1.25rem, 3vw, 1.6rem);
  padding: 0.55rem 0;
  outline: none;
  transition: border-color 0.2s ease;
}

.field input:focus {
  border-bottom-color: var(--accent);
}

.field .error {
  color: var(--danger);
  font-size: 0.85rem;
  min-height: 1.1em;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.75rem;
  align-items: center;
}

.btn {
  appearance: none;
  border: none;
  border-radius: 999px;
  padding: 0.85rem 1.3rem;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
  transition: transform 0.15s ease, filter 0.2s ease, opacity 0.2s ease, background 0.2s ease;
}

.btn:active {
  transform: scale(0.98);
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #1a1408;
}

.btn-primary:hover:not(:disabled) {
  filter: brightness(1.05);
}

.btn-lg {
  padding: 1rem 1.6rem;
  font-size: 1.05rem;
}

.meta-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 0 0 1.75rem;
}

.meta-pills span {
  font-size: 0.82rem;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  background: rgba(0, 0, 0, 0.18);
}

.scale-prompt {
  margin: 0 0 0.35rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.scenario-body {
  margin: 0 0 1.1rem;
  color: var(--muted);
  font-size: 1.02rem;
  line-height: 1.55;
  max-width: 38rem;
}

.choices {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin: 0.35rem 0 0.5rem;
}

.choice-opt {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  width: 100%;
  text-align: left;
  padding: 0.9rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}

.choice-opt:hover {
  border-color: rgba(212, 162, 76, 0.45);
  background: rgba(212, 162, 76, 0.08);
}

.choice-opt:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.choice-opt.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  box-shadow: 0 0 0 1px rgba(212, 162, 76, 0.35);
}

.choice-letter {
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  display: grid;
  place-items: center;
  border-radius: 999px;
  font-weight: 700;
  font-size: 0.9rem;
  background: rgba(212, 162, 76, 0.18);
  color: var(--accent-2);
}

.choice-opt.selected .choice-letter {
  background: var(--accent);
  color: #1a1510;
}

.choice-text {
  flex: 1;
  font-size: 0.95rem;
  line-height: 1.45;
  padding-top: 0.2rem;
}

.scale-opt {
  position: relative;
  min-height: 4.5rem;
}

.scale-opt .kbd-chip {
  display: none;
}

.celebrate {
  position: relative;
  height: 0;
  pointer-events: none;
}

.celebrate i {
  position: absolute;
  top: 0;
  left: calc(8% + (var(--i) * 6.5%));
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--accent);
  opacity: 0;
  animation: confetti 1.1s ease-out forwards;
  animation-delay: calc(var(--i) * 0.04s);
}

.celebrate i:nth-child(odd) {
  background: var(--ok);
  width: 6px;
  height: 10px;
}

.celebrate i:nth-child(3n) {
  background: var(--accent-2);
}

@keyframes confetti {
  0% {
    opacity: 0;
    transform: translateY(0) rotate(0);
  }
  20% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(-90px) rotate(180deg);
  }
}

.reduce-motion .screen.enter-from-right,
.reduce-motion .screen.enter-from-left,
.reduce-motion .screen.exit-to-left,
.reduce-motion .screen.exit-to-right,
.reduce-motion .rank-item,
.reduce-motion .celebrate i {
  animation: none !important;
}

.hide-mobile {
  display: inline;
}

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

.btn-ghost:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.05);
}

.nav-fab {
  position: fixed;
  left: 1rem;
  bottom: 1rem;
  z-index: 25;
}

.calculando {
  text-align: center;
}

.pulse {
  width: 54px;
  height: 54px;
  margin: 0 auto 1.25rem;
  border-radius: 50%;
  border: 3px solid var(--accent-soft);
  border-top-color: var(--accent);
  animation: spin 0.75s linear infinite;
}

.rank-list {
  list-style: none;
  margin: 1.25rem 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.rank-item {
  padding: 1rem 1.1rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.18);
  animation: rise 0.5s ease both;
}

.rank-item.first {
  background: linear-gradient(135deg, rgba(212, 162, 76, 0.18), rgba(212, 162, 76, 0.04));
  border-color: rgba(212, 162, 76, 0.45);
}

.rank-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: baseline;
}

.rank-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  font-weight: 600;
}

.rank-pct {
  color: var(--accent);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.rank-desc {
  margin: 0.55rem 0 0;
  color: var(--muted);
}

.explain {
  margin-top: 1.5rem;
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}

.explain summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 600;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.explain summary::-webkit-details-marker {
  display: none;
}

.explain summary::before {
  content: "▸";
  transition: transform 0.2s ease;
}

.explain[open] summary::before {
  transform: rotate(90deg);
}

.explain-body {
  margin-top: 0.9rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.explain-body p {
  margin: 0 0 0.75rem;
}

.explain-body .formula {
  margin: 0.85rem 0;
  padding: 0.85rem 1rem;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 0.9rem;
}

.explain-body ul {
  margin: 0.5rem 0 0.85rem;
  padding-left: 1.2rem;
}

.explain-body li {
  margin-bottom: 0.35rem;
}

.meter {
  margin-top: 0.65rem;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.meter > i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.85s cubic-bezier(0.22, 1, 0.36, 1);
}

.footer-note {
  margin: 1.25rem 0 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.user-chip {
  color: var(--muted);
  margin: 0 0 0.25rem;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.35rem;
  transform: translateX(-50%) translateY(16px);
  background: #12241f;
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 0.7rem 1.1rem;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: 0.25s ease;
  z-index: 40;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.kbd-hint {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  color: var(--muted);
  font-size: 0.8rem;
  z-index: 20;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.45rem 0.75rem;
}

@keyframes enterRight {
  from {
    opacity: 0;
    transform: translateX(36px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes enterLeft {
  from {
    opacity: 0;
    transform: translateX(-36px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes exitLeft {
  to {
    opacity: 0;
    transform: translateX(-28px);
  }
}

@keyframes exitRight {
  to {
    opacity: 0;
    transform: translateX(28px);
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

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

@media (max-width: 560px) {
  .scale {
    gap: 0.4rem;
  }

  .scale-opt {
    min-height: 4.8rem;
    padding: 0.85rem 0.2rem 0.7rem;
  }

  .scale .lbl {
    font-size: 0.62rem;
  }

  .scale .val {
    font-size: 1.2rem;
  }

  .kbd-hint,
  .hide-mobile {
    display: none;
  }

  .actions {
    flex-direction: column;
    align-items: stretch;
  }

  .btn {
    width: 100%;
  }

  .question-title,
  .welcome-title {
    font-size: clamp(1.45rem, 7vw, 1.9rem);
  }
}
