/* Modals & Overlays */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 10, 0.85);
  backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.modal-backdrop.active {
  opacity: 1;
  pointer-events: all;
}

.modal-dialog {
  background: #0f131c;
  background-image: 
    radial-gradient(circle at 50% 0%, rgba(30, 20, 50, 0.4), transparent 70%),
    linear-gradient(to bottom, #121724, #0b0e17);
  border: 1.5px solid var(--border-gold);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.9), 0 0 30px rgba(197, 160, 89, 0.2);
  width: 90%;
  max-width: 580px;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  transform: scale(0.92) translateY(20px);
  transition: transform 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal-backdrop.active .modal-dialog {
  transform: scale(1) translateY(0);
}

.modal-dialog.danger {
  border-color: var(--crimson-red);
  box-shadow: 0 0 50px rgba(220, 38, 38, 0.5);
}

.modal-close-btn {
  position: absolute;
  top: 14px;
  right: 16px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
  transition: color 0.15s;
}

.modal-close-btn:hover {
  color: var(--gold-primary);
}

/* Card Reveal Card Styling */
.card-presentation {
  padding: 30px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.card-tarot-box {
  width: 250px;
  min-height: 350px;
  border-radius: 14px;
  border: 2px solid var(--gold-primary);
  background: #121620;
  box-shadow: 
    0 0 0 2px rgba(10, 14, 22, 0.9),
    0 0 0 4px rgba(212, 175, 55, 0.4),
    inset 0 0 0 2px rgba(212, 175, 55, 0.25),
    inset 0 0 35px rgba(0, 0, 0, 0.8),
    0 20px 45px rgba(0, 0, 0, 0.85);
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  margin-bottom: 20px;
  position: relative;
  overflow: hidden;
  animation: cardFlipIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* Ornate corner florets */
.card-tarot-box::before {
  content: '❖';
  position: absolute;
  top: 6px;
  left: 8px;
  color: var(--gold-primary);
  font-size: 0.75rem;
  opacity: 0.8;
}

.card-tarot-box::after {
  content: '❖';
  position: absolute;
  top: 6px;
  right: 8px;
  color: var(--gold-primary);
  font-size: 0.75rem;
  opacity: 0.8;
}

.card-tarot-box.omen {
  border-color: #a855f7;
  box-shadow: 
    0 0 0 2px rgba(10, 14, 22, 0.9),
    0 0 0 4px rgba(168, 85, 247, 0.5),
    inset 0 0 0 2px rgba(168, 85, 247, 0.3),
    inset 0 0 40px rgba(46, 16, 101, 0.9),
    0 0 35px rgba(147, 51, 234, 0.45);
  background: 
    radial-gradient(circle at 50% 15%, rgba(147, 51, 234, 0.35), transparent 75%),
    radial-gradient(circle at 50% 90%, rgba(220, 38, 38, 0.25), transparent 70%),
    #0c0617;
}

.card-tarot-box.item {
  border-color: #eab308;
  box-shadow: 
    0 0 0 2px rgba(10, 14, 22, 0.9),
    0 0 0 4px rgba(234, 179, 8, 0.4),
    inset 0 0 0 2px rgba(234, 179, 8, 0.25),
    inset 0 0 40px rgba(30, 20, 5, 0.85),
    0 0 30px rgba(234, 179, 8, 0.3);
  background: 
    radial-gradient(circle at 50% 15%, rgba(217, 119, 6, 0.3), transparent 75%),
    radial-gradient(circle at 50% 85%, rgba(16, 185, 129, 0.15), transparent 70%),
    #131008;
}

.card-tarot-box.event {
  border-color: #38bdf8;
  box-shadow: 
    0 0 0 2px rgba(10, 14, 22, 0.9),
    0 0 0 4px rgba(56, 189, 248, 0.4),
    inset 0 0 0 2px rgba(56, 189, 248, 0.25),
    inset 0 0 40px rgba(8, 47, 73, 0.85),
    0 0 30px rgba(56, 189, 248, 0.3);
  background: 
    radial-gradient(circle at 50% 15%, rgba(14, 165, 233, 0.3), transparent 75%),
    radial-gradient(circle at 50% 85%, rgba(220, 38, 38, 0.2), transparent 70%),
    #08121d;
}

.card-type-banner {
  font-family: var(--font-heading);
  font-size: 0.72rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--gold-light);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 3px 0;
  border-bottom: 1px solid rgba(212, 175, 55, 0.2);
}

.card-big-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  color: #fff;
  margin: 6px 0 4px 0;
  line-height: 1.25;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
}

.card-icon-art {
  width: 90px;
  height: 90px;
  margin: 6px auto;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold-light);
  filter: drop-shadow(0 0 10px rgba(223, 177, 91, 0.5));
  position: relative;
}

.card-icon-art svg {
  width: 100%;
  height: 100%;
}

.card-flavor-text {
  font-size: 0.76rem;
  font-style: italic;
  color: #cbd5e1;
  line-height: 1.35;
  margin: 6px 0;
  padding: 0 4px;
}

.card-effect-text {
  font-size: 0.82rem;
  color: #fef08a;
  font-weight: 600;
  line-height: 1.35;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.6);
  border: 1px dashed rgba(212, 175, 55, 0.35);
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.6);
}

/* Dice Roller Modal */
.dice-tray-box {
  padding: 24px;
  text-align: center;
}

.dice-tray-title {
  font-family: var(--font-heading);
  font-size: 1.25rem;
  color: var(--gold-light);
  margin-bottom: 4px;
}

.dice-tray-reason {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 20px;
}

.dice-cluster {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin: 20px 0;
  min-height: 70px;
}

/* Betrayal Die Representation */
.betrayal-die {
  width: 52px;
  height: 52px;
  background: #f8fafc;
  border: 2px solid #cbd5e1;
  border-radius: 10px;
  box-shadow: 0 6px 15px rgba(0, 0, 0, 0.6), inset 0 2px 4px rgba(255,255,255,0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.betrayal-die.rolling {
  animation: diceRollAnim 0.5s ease;
}

.die-pips-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.die-pip-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #0f172a;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.8);
}

.die-zero {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  font-weight: 800;
  color: #94a3b8;
}

.dice-total-display {
  margin-top: 14px;
  font-family: var(--font-heading);
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--gold-light);
  text-shadow: 0 0 15px rgba(223, 177, 91, 0.5);
}

/* Haunt Cinematic Alarm */
.haunt-alert-dialog {
  border-color: var(--crimson-red);
  background: radial-gradient(circle at 50% 20%, #450a0a, #090b10);
  box-shadow: 0 0 60px rgba(220, 38, 38, 0.7);
  padding: 30px 24px;
  text-align: center;
  animation: screenQuake 0.6s ease;
}

.haunt-skull-icon {
  width: 72px;
  height: 72px;
  color: var(--crimson-red);
  margin-bottom: 12px;
  animation: skullPulse 2s infinite;
}

.haunt-alert-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  letter-spacing: 2px;
  color: #fca5a5;
  text-shadow: 0 0 20px rgba(239, 68, 68, 0.8);
  margin-bottom: 8px;
}

.haunt-scenario-name {
  font-family: var(--font-heading);
  font-size: 1.3rem;
  color: var(--gold-light);
  margin-bottom: 14px;
}

.haunt-prologue-box {
  background: rgba(0, 0, 0, 0.6);
  border-left: 3px solid var(--crimson-red);
  padding: 14px;
  border-radius: 6px;
  font-style: italic;
  font-size: 0.88rem;
  color: #e2e8f0;
  line-height: 1.5;
  margin: 16px 0;
  text-align: left;
}

.traitor-reveal-banner {
  padding: 10px;
  border-radius: 6px;
  background: rgba(220, 38, 38, 0.2);
  border: 1px solid var(--crimson-red);
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  color: #fca5a5;
  margin: 14px 0;
}

/* Haunt Guide Tome (Survivor vs Traitor tabs) */
.tome-dialog {
  max-width: 720px;
}

.tome-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.tome-title {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  color: var(--gold-light);
}

.tome-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-subtle);
}

.tome-tab {
  flex: 1;
  padding: 12px;
  text-align: center;
  font-family: var(--font-heading);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  background: transparent;
  border: none;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  transition: all 0.2s;
}

.tome-tab.active {
  color: var(--gold-primary);
  border-bottom-color: var(--gold-primary);
  background: rgba(197, 160, 89, 0.05);
}

.tome-tab.traitor-tab.active {
  color: #f87171;
  border-bottom-color: var(--crimson-red);
  background: rgba(220, 38, 38, 0.1);
}

.tome-content {
  padding: 20px;
  line-height: 1.6;
  font-size: 0.9rem;
}

.tome-section-title {
  font-family: var(--font-heading);
  font-size: 0.95rem;
  color: var(--gold-light);
  margin-top: 14px;
  margin-bottom: 6px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  padding-bottom: 4px;
}

/* Animations */
@keyframes cardFlipIn {
  0% { transform: rotateY(90deg) scale(0.7); opacity: 0; }
  100% { transform: rotateY(0deg) scale(1); opacity: 1; }
}

@keyframes diceRollAnim {
  0% { transform: rotate(0deg) scale(0.6); }
  50% { transform: rotate(180deg) scale(1.15); }
  100% { transform: rotate(360deg) scale(1); }
}

@keyframes screenQuake {
  0% { transform: translate(0, 0); }
  20% { transform: translate(-10px, 8px); }
  40% { transform: translate(10px, -8px); }
  60% { transform: translate(-6px, 4px); }
  80% { transform: translate(6px, -4px); }
  100% { transform: translate(0, 0); }
}

@keyframes skullPulse {
  0% { transform: scale(1); filter: drop-shadow(0 0 5px rgba(220, 38, 38, 0.5)); }
  50% { transform: scale(1.1); filter: drop-shadow(0 0 20px rgba(220, 38, 38, 0.9)); }
  100% { transform: scale(1); filter: drop-shadow(0 0 5px rgba(220, 38, 38, 0.5)); }
}
