:root {
  --ink: #1a2430;
  --ink-soft: #3a4a5a;
  --paper: #e3eae6;
  --paper-deep: #d4ddd8;
  --paper-lift: #eef3f0;
  --sea: #1f5a68;
  --copper: #a86b32;
  --line: rgba(26, 36, 48, 0.12);
  --ok: #2d6a4f;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Manrope", system-ui, sans-serif;
  --drum-h: 48px;
}

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

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

body {
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: 0;
  background:
    radial-gradient(ellipse 85% 55% at 8% -8%, rgba(31, 90, 104, 0.12), transparent 55%),
    radial-gradient(ellipse 70% 45% at 100% 15%, rgba(168, 107, 50, 0.08), transparent 50%),
    radial-gradient(ellipse 80% 50% at 50% 110%, rgba(45, 106, 79, 0.08), transparent 55%),
    linear-gradient(165deg, #e8eeeb 0%, var(--paper) 42%, #dce5e0 100%);
  pointer-events: none;
}

.grid-lines {
  position: fixed;
  inset: 0;
  z-index: 0;
  opacity: 0.35;
  background-image:
    linear-gradient(var(--line) 1px, transparent 1px),
    linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 40%, #000 20%, transparent 75%);
  pointer-events: none;
}

#app {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  max-width: 440px;
  margin: 0 auto;
  padding: 1.25rem 1.25rem 2.5rem;
}

.screen {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - 3.75rem);
  animation: rise 0.45s ease both;
}

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

.brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(2.4rem, 9vw, 3.1rem);
  letter-spacing: -0.03em;
  line-height: 1;
  margin: 0.35rem 0 0.4rem;
}

.tagline {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--sea);
}

.lead {
  margin: 0.75rem 0 0;
  font-size: 0.98rem;
  line-height: 1.45;
  color: var(--ink-soft);
  max-width: 34ch;
}

.linkish {
  appearance: none;
  border: none;
  background: none;
  font-family: var(--font-body);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink-soft);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  padding: 0.5rem;
  margin-top: 0.15rem;
}

.section-label {
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin: 1.35rem 0 0.15rem;
  letter-spacing: -0.02em;
}

.section-hint {
  margin: 0 0 0.55rem;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

/* Picker tipo iOS — cilindro 3D */
.picker {
  --picker-rows: 7;
  --picker-h: calc(var(--drum-h) * var(--picker-rows));
  position: relative;
  height: var(--picker-h);
  margin: 0.35rem 0 0.15rem;
  border-radius: 20px;
  background: rgba(238, 243, 240, 0.72);
  border: 1px solid rgba(26, 36, 48, 0.12);
  overflow: hidden;
  isolation: isolate;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}

.picker-highlight {
  position: absolute;
  left: 12px;
  right: 12px;
  top: 50%;
  height: var(--drum-h);
  margin-top: calc(var(--drum-h) / -2);
  border-radius: 11px;
  background: rgba(31, 90, 104, 0.08);
  border: 1px solid rgba(31, 90, 104, 0.14);
  pointer-events: none;
  z-index: 2;
}

.picker-mask {
  position: absolute;
  left: 0;
  right: 0;
  height: 42%;
  z-index: 3;
  pointer-events: none;
}

.picker-mask-top {
  top: 0;
  background: linear-gradient(
    180deg,
    rgba(227, 234, 230, 0.98) 0%,
    rgba(227, 234, 230, 0.75) 45%,
    rgba(227, 234, 230, 0) 100%
  );
}

.picker-mask-bot {
  bottom: 0;
  background: linear-gradient(
    0deg,
    rgba(227, 234, 230, 0.98) 0%,
    rgba(227, 234, 230, 0.75) 45%,
    rgba(227, 234, 230, 0) 100%
  );
}

.picker-wheel {
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  perspective: 900px;
  perspective-origin: 50% 50%;
}

.picker-wheel::-webkit-scrollbar {
  display: none;
}

.picker-spacer {
  height: calc(var(--drum-h) * 3);
  scroll-snap-align: none;
  pointer-events: none;
}

.picker-list {
  list-style: none;
  margin: 0;
  padding: 0;
  transform-style: preserve-3d;
}

.picker-list li {
  margin: 0;
  padding: 0;
}

.drum-item {
  height: var(--drum-h);
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 0 1.25rem;
  border: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 1.2rem;
  font-weight: 500;
  letter-spacing: -0.01em;
  color: var(--ink);
  opacity: 0.28;
  scroll-snap-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transform-origin: center center;
  will-change: transform, opacity;
  transition: color 0.15s ease;
}

.drum-item.is-active {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.42rem;
  letter-spacing: -0.03em;
  color: var(--ink);
  opacity: 1;
}

.hint {
  text-align: center;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--ink-soft);
  margin: 0.55rem 0 0;
  min-height: 1.2em;
}

.deck-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.7rem;
}

.deck-btn {
  appearance: none;
  position: relative;
  text-align: left;
  border: none;
  cursor: pointer;
  font-family: var(--font-body);
  color: var(--ink);
  padding: 1.05rem 0.95rem 1.1rem;
  min-height: 132px;
  border-radius: 14px;
  background: var(--paper-lift);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.9) inset,
    0 0 0 1px rgba(26, 36, 48, 0.1),
    4px 5px 0 rgba(26, 36, 48, 0.06);
  overflow: hidden;
  transition: transform 0.15s ease;
}

.deck-btn::before {
  content: "";
  position: absolute;
  inset: 8px auto 8px 0;
  width: 4px;
  border-radius: 0 3px 3px 0;
  background: var(--deck-accent, var(--sea));
}

.deck-btn::after {
  content: "";
  position: absolute;
  right: 10px;
  top: 10px;
  width: 28px;
  height: 36px;
  border-radius: 3px;
  border: 1px solid rgba(26, 36, 48, 0.12);
  background:
    repeating-linear-gradient(
      -12deg,
      transparent,
      transparent 3px,
      rgba(26, 36, 48, 0.05) 3px,
      rgba(26, 36, 48, 0.05) 4px
    ),
    var(--paper-lift);
  opacity: 0.9;
  transform: rotate(8deg);
}

.deck-btn:active {
  transform: translate(1px, 1px);
}

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

.deck-btn[data-deck="curiosidades-serias"] {
  --deck-accent: #1f5a68;
}

.deck-btn[data-deck="curiosidades-graciosas"] {
  --deck-accent: #a86b32;
}

.deck-btn[data-deck="historia"] {
  --deck-accent: #5c4a3a;
}

.deck-btn[data-deck="geografia"] {
  --deck-accent: #2d6a4f;
}

.deck-btn strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.05rem;
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 1.6rem 0.4rem 0.35rem;
}

.deck-btn span {
  display: block;
  font-size: 0.72rem;
  color: var(--ink-soft);
  line-height: 1.35;
  margin: 0 0.35rem;
}

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

.actions {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 1rem;
}

.btn {
  appearance: none;
  border: none;
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1rem;
  padding: 0.95rem 1.1rem;
  border-radius: 4px;
  cursor: pointer;
}

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

.btn-primary {
  background: var(--ink);
  color: var(--paper);
}

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

.btn-ghost {
  background: transparent;
  color: var(--ink);
  border: 1.5px solid rgba(26, 36, 48, 0.35);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}

.mini-brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
}

.cat-chip {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--sea);
}

.ficha {
  margin-top: 0.5rem;
  padding: 1.45rem 1.3rem 1.5rem;
  background: rgba(238, 243, 240, 0.92);
  border: 1px solid rgba(26, 36, 48, 0.16);
  border-radius: 16px;
  border-left: 4px solid var(--copper);
  animation: ficha-in 0.4s ease both;
  text-align: left;
  width: 100%;
  font-family: var(--font-body);
  color: var(--ink);
  box-shadow: 0 10px 28px rgba(26, 36, 48, 0.06);
}

.study-stage {
  margin-top: 0.35rem;
  perspective: 1400px;
  min-height: 320px;
}

.study-card {
  position: relative;
  width: 100%;
  min-height: 320px;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: var(--font-body);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
  transform-style: preserve-3d;
  transition: transform 0.55s cubic-bezier(0.2, 0.7, 0.2, 1);
}

.study-card.is-flipped {
  transform: rotateY(180deg);
}

.study-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 1.6rem 1.4rem 1.5rem;
  border-radius: 18px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  text-align: left;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.85) inset,
    0 14px 32px rgba(26, 36, 48, 0.1);
}

.study-front {
  background:
    radial-gradient(ellipse 80% 50% at 100% 0%, rgba(31, 90, 104, 0.1), transparent 55%),
    linear-gradient(165deg, var(--paper-lift) 0%, #e4ebe7 100%);
  border: 1px solid rgba(26, 36, 48, 0.14);
}

.study-front::before {
  content: "";
  position: absolute;
  left: 1.15rem;
  right: 1.15rem;
  top: 1.15rem;
  bottom: 1.15rem;
  border: 1px solid rgba(26, 36, 48, 0.08);
  border-radius: 12px;
  pointer-events: none;
}

.study-back {
  background:
    radial-gradient(ellipse 70% 45% at 0% 100%, rgba(168, 107, 50, 0.12), transparent 50%),
    linear-gradient(165deg, #fbf8f4 0%, #f3eee7 100%);
  border: 1px solid rgba(92, 74, 58, 0.18);
  transform: rotateY(180deg);
}

.study-face .ficha-type {
  position: relative;
  z-index: 1;
}

.study-face h1,
.study-face p {
  position: relative;
  z-index: 1;
}

.card-prompt {
  margin: 1.25rem 0 0 !important;
  font-size: 0.78rem !important;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--sea) !important;
  font-weight: 700;
}

@keyframes ficha-in {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.ficha-type {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--copper);
  margin: 0 0 0.65rem;
}

.ficha h1,
.study-face h1 {
  font-family: var(--font-display);
  font-size: 1.65rem;
  line-height: 1.15;
  margin: 0 0 0.85rem;
  letter-spacing: -0.02em;
}

.ficha p,
.study-face p {
  margin: 0 0 0.75rem;
  font-size: 1.02rem;
  line-height: 1.5;
  color: var(--ink-soft);
}

.impacto {
  color: var(--ink) !important;
  font-weight: 600;
}

.fuente {
  margin-top: 1.1rem !important;
  padding-top: 0.85rem;
  border-top: 1px solid var(--line);
  font-size: 0.78rem !important;
}

.fuente strong {
  color: var(--ink);
}

.close-screen {
  text-align: center;
  justify-content: center;
  gap: 0.75rem;
}

.close-mark {
  width: 64px;
  height: 64px;
  margin: 0 auto 0.5rem;
  border: 2px solid var(--ok);
  border-radius: 50%;
  display: grid;
  place-items: center;
}

.close-mark svg {
  width: 28px;
  height: 28px;
  stroke: var(--ok);
  fill: none;
  stroke-width: 2.5;
}

.close-screen h1 {
  font-family: var(--font-display);
  font-size: 2rem;
  margin: 0;
}

.close-screen p {
  margin: 0 auto;
  color: var(--ink-soft);
  line-height: 1.45;
  max-width: 28ch;
}
