/* ============================================
   culpables — design system
   ============================================ */
:root {
  --bg: #0a0507;
  --bg-2: #140709;
  --ink: #f4ede4;
  --ink-soft: #c9bfb4;
  --ink-mute: #7d7167;
  --red: #c01933;
  --red-bright: #e84a5f;
  --red-deep: #6b0d1d;
  --gold: #d4a55c;
  --line: rgba(244, 237, 228, 0.08);
  --shadow-card: 0 30px 80px rgba(0, 0, 0, 0.6), 0 8px 24px rgba(192, 25, 51, 0.15);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  background:
    radial-gradient(ellipse at 50% 0%, rgba(107, 13, 29, 0.35) 0%, transparent 55%),
    radial-gradient(ellipse at 50% 100%, rgba(107, 13, 29, 0.2) 0%, transparent 50%),
    var(--bg);
  position: relative;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle at 20% 30%, rgba(232, 74, 95, 0.04) 0, transparent 30%),
    radial-gradient(circle at 80% 70%, rgba(212, 165, 92, 0.03) 0, transparent 25%);
  pointer-events: none;
  z-index: 0;
}

/* Subtle grain */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.06;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  z-index: 0;
}

/* ============================================
   SCREENS
   ============================================ */
.screen {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  z-index: 1;
  animation: fadeIn 0.4s ease;
}
.screen.active { display: flex; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================
   TOPBAR
   ============================================ */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  padding-top: max(1rem, env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
  background: rgba(10, 5, 7, 0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 10;
}
.topbar h2 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 400;
  font-size: 1.4rem;
  letter-spacing: 0.04em;
  text-transform: lowercase;
  color: var(--ink);
}
.iconbtn {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(244, 237, 228, 0.05);
  border: 1px solid var(--line);
  color: var(--ink);
  font-size: 1.2rem;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}
.iconbtn:hover, .iconbtn:active {
  background: rgba(192, 25, 51, 0.2);
  border-color: var(--red);
}
.spacer { width: 40px; }

/* ============================================
   INTRO
   ============================================ */
#intro .intro-inner {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  text-align: center;
  gap: 0.5rem;
}

.logo-wrap {
  width: 140px;
  height: 155px;
  margin-bottom: 1.25rem;
  filter: drop-shadow(0 8px 30px rgba(192, 25, 51, 0.4));
  animation: floatLogo 4s ease-in-out infinite;
}
.logo { width: 100%; height: 100%; }

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

.brand {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 300;
  font-size: clamp(3.2rem, 12vw, 4.5rem);
  letter-spacing: 0.02em;
  color: var(--ink);
  line-height: 1;
  text-transform: lowercase;
}
.brand .dot { color: var(--red); }

.tag {
  font-family: 'Inter', sans-serif;
  font-weight: 300;
  font-size: 0.85rem;
  text-transform: lowercase;
  letter-spacing: 0.25em;
  color: var(--ink-mute);
  margin-top: 0.25rem;
  margin-bottom: 2.5rem;
}

.intro-cta {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
  max-width: 320px;
}

.age {
  position: absolute;
  bottom: max(1.5rem, env(safe-area-inset-bottom));
  font-size: 0.7rem;
  text-transform: lowercase;
  letter-spacing: 0.2em;
  color: var(--ink-mute);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
  font-family: 'Inter', sans-serif;
  font-weight: 500;
  font-size: 0.95rem;
  text-transform: lowercase;
  letter-spacing: 0.08em;
  padding: 0.95rem 2rem;
  border-radius: 100px;
  cursor: pointer;
  border: none;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}
.btn.primary {
  background: linear-gradient(135deg, var(--red) 0%, var(--red-deep) 100%);
  color: var(--ink);
  box-shadow: 0 6px 20px rgba(192, 25, 51, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.btn.primary:hover, .btn.primary:active {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(192, 25, 51, 0.5);
}
.btn.ghost {
  background: rgba(244, 237, 228, 0.04);
  color: var(--ink-soft);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
}
.btn.ghost:hover, .btn.ghost:active {
  background: rgba(244, 237, 228, 0.08);
  color: var(--ink);
  border-color: rgba(244, 237, 228, 0.2);
}
.btn.block { width: 100%; }

/* ============================================
   RULES
   ============================================ */
.rules-content {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem 1.25rem 2rem;
  -webkit-overflow-scrolling: touch;
}
.rule-card {
  background: linear-gradient(180deg, rgba(20, 7, 9, 0.8) 0%, rgba(10, 5, 7, 0.6) 100%);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  position: relative;
}
.rule-card.mazo1 { border-left: 3px solid var(--red); }
.rule-card.mazo2 { border-left: 3px solid var(--gold); }
.rule-card h3 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 500;
  font-size: 1.5rem;
  text-transform: lowercase;
  margin-bottom: 0.75rem;
  display: flex; align-items: center; gap: 0.5rem;
}
.badge {
  font-family: 'Inter', sans-serif;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.15em;
  background: var(--red);
  color: var(--ink);
  padding: 0.25rem 0.6rem;
  border-radius: 50px;
  text-transform: uppercase;
}
.rule-card.mazo2 .badge { background: var(--gold); color: var(--bg); }
.rule-card p {
  color: var(--ink-soft);
  font-size: 0.92rem;
  margin-bottom: 0.6rem;
  line-height: 1.5;
}
.rule-card ul { list-style: none; }
.rule-card li {
  position: relative;
  padding-left: 1.25rem;
  color: var(--ink-soft);
  font-size: 0.9rem;
  line-height: 1.55;
  margin-bottom: 0.4rem;
}
.rule-card li::before {
  content: '✦';
  position: absolute;
  left: 0;
  color: var(--red);
  font-size: 0.65rem;
  top: 0.45rem;
}

.footnote {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 1.05rem;
  color: var(--ink-soft);
  text-align: center;
  padding: 1.5rem 0.5rem 2rem;
  line-height: 1.5;
}

/* ============================================
   MENU - DECK SELECTION
   ============================================ */
.deck-grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  padding: 1.5rem 1.25rem;
  align-content: safe center;
  max-width: 700px;
  width: 100%;
  margin: 0 auto;
}
@media (min-width: 700px) {
  .deck-grid { grid-template-columns: 1fr 1fr; }
}

.deck-card {
  position: relative;
  aspect-ratio: 3 / 4.2;
  max-height: 60vh;
  background: linear-gradient(160deg, var(--bg-2) 0%, #1c0a0d 50%, var(--bg-2) 100%);
  border: 1px solid rgba(192, 25, 51, 0.25);
  border-radius: 22px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  cursor: pointer;
  color: var(--ink);
  font-family: inherit;
  text-align: center;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.deck-card::before {
  content: '';
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(212, 165, 92, 0.25);
  border-radius: 18px;
  pointer-events: none;
}
.deck-card:hover, .deck-card:active {
  transform: translateY(-4px);
  border-color: var(--red);
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.7), 0 0 40px rgba(192, 25, 51, 0.3);
}

.deck-corner {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.4rem;
  color: var(--gold);
  text-transform: uppercase;
  align-self: flex-start;
  z-index: 1;
}
.deck-corner.br { align-self: flex-end; transform: rotate(180deg); }

.deck-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  z-index: 1;
}
.deck-icon {
  font-size: 2.5rem;
  color: var(--red);
  margin-bottom: 0.5rem;
  filter: drop-shadow(0 0 12px rgba(192, 25, 51, 0.5));
}
.deck-card h3 {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 500;
  font-size: 2.5rem;
  text-transform: lowercase;
  letter-spacing: 0.02em;
  line-height: 1;
}
.deck-card p {
  font-size: 0.85rem;
  color: var(--ink-mute);
  text-transform: lowercase;
  letter-spacing: 0.1em;
}
.deck-count {
  margin-top: 0.5rem;
  font-size: 0.7rem;
  color: var(--gold);
  text-transform: uppercase;
  letter-spacing: 0.2em;
  background: rgba(212, 165, 92, 0.08);
  padding: 0.35rem 0.8rem;
  border-radius: 50px;
  border: 1px solid rgba(212, 165, 92, 0.2);
}

.deck-accion .deck-icon { color: var(--gold); filter: drop-shadow(0 0 12px rgba(212, 165, 92, 0.5)); }

/* ============================================
   GAME
   ============================================ */
.game-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1rem 1.25rem;
  position: relative;
}

.progress {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
#progress-text {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--ink-mute);
  align-self: center;
}
.progress-bar {
  height: 2px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--red), var(--red-bright));
  width: 0%;
  transition: width 0.4s ease;
  box-shadow: 0 0 8px var(--red);
}

.card-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  min-height: 0;
  perspective: 1500px;
}

/* CARD BACK STACK */
.card-back-stack {
  position: relative;
  width: min(85vw, 340px);
  aspect-ratio: 3 / 4.2;
  max-height: 60vh;
}
.card-back {
  position: absolute;
  inset: 0;
  background: linear-gradient(160deg, #1c0a0d 0%, #0a0507 50%, #1c0a0d 100%);
  border: 1px solid rgba(192, 25, 51, 0.3);
  border-radius: 22px;
  box-shadow: var(--shadow-card);
  cursor: pointer;
  transition: all 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}
.stack-3 { transform: translate(-12px, 12px) rotate(-3deg); opacity: 0.5; }
.stack-2 { transform: translate(-6px, 6px) rotate(-1.5deg); opacity: 0.75; }
.stack-1 { z-index: 3; }
.stack-1:hover, .stack-1:active { transform: translateY(-6px); box-shadow: 0 40px 100px rgba(0, 0, 0, 0.7), 0 0 50px rgba(192, 25, 51, 0.4); }

.back-inner {
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(212, 165, 92, 0.25);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  padding: 2rem;
}
.back-flame { width: 50px; opacity: 0.85; }
.back-flame svg { width: 100%; height: auto; }
.back-brand {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.8rem;
  color: var(--ink);
  letter-spacing: 0.04em;
  text-transform: lowercase;
}
.back-brand span { color: var(--red); }
.back-tap {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: var(--ink-mute);
  margin-top: 1rem;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

/* CARD FRONT */
.card-front {
  position: absolute;
  width: min(85vw, 340px);
  aspect-ratio: 3 / 4.2;
  max-height: 60vh;
  background: linear-gradient(160deg, #1a0a0d 0%, #2a0d12 50%, #1a0a0d 100%);
  border: 1px solid rgba(212, 165, 92, 0.35);
  border-radius: 22px;
  box-shadow: var(--shadow-card), 0 0 50px rgba(192, 25, 51, 0.15);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  animation: flipIn 0.55s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
}
.card-front::before {
  content: '';
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(212, 165, 92, 0.2);
  border-radius: 16px;
  pointer-events: none;
}
@keyframes flipIn {
  0% { opacity: 0; transform: rotateY(-90deg) scale(0.9); }
  100% { opacity: 1; transform: rotateY(0deg) scale(1); }
}

.front-corner {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.3rem;
  color: var(--gold);
  text-transform: uppercase;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
  z-index: 1;
}
.front-corner span { font-size: 1rem; color: var(--red); margin-top: 2px; }
.front-corner.tl { align-self: flex-start; }
.front-corner.br { align-self: flex-end; transform: rotate(180deg); }

.front-content {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.5rem;
  text-align: center;
  gap: 1.25rem;
}
.front-flame { width: 26px; opacity: 0.6; }
.front-flame svg { width: 100%; height: auto; }

.front-text {
  font-family: 'Cormorant Garamond', serif;
  font-weight: 500;
  font-size: clamp(1.15rem, 4.5vw, 1.55rem);
  line-height: 1.4;
  color: var(--ink);
  text-transform: lowercase;
  letter-spacing: 0.01em;
  max-width: 100%;
}
.front-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.3em;
  color: var(--gold);
  margin-top: 0.5rem;
}

/* EMPTY STATE */
.empty-state {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
  padding: 2rem;
}
.empty-icon {
  font-size: 3rem;
  color: var(--red);
  opacity: 0.6;
}
.empty-state h3 {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.6rem;
  text-transform: lowercase;
}
.empty-state p {
  color: var(--ink-mute);
  font-size: 0.9rem;
  max-width: 280px;
  line-height: 1.5;
  margin-bottom: 1rem;
}

/* ACTIONS */
.actions {
  display: flex;
  gap: 0.75rem;
  padding: 1.25rem 0 0.5rem;
}
.actions .btn { flex: 1; padding: 0.85rem 1rem; }

.safeword {
  text-align: center;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.25em;
  color: var(--ink-mute);
  padding: 0.75rem 1rem;
  padding-bottom: max(0.75rem, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(10, 5, 7, 0.5);
}
.safeword strong {
  color: var(--red-bright);
  font-weight: 600;
  letter-spacing: 0.3em;
}

.hidden { display: none !important; }
