:root {
  --bg-color: #09090b;
  --text-primary: #39ff14; /* Hacker Green */
  --text-secondary: #e2e8f0;
  --accent: #b026ff; /* Neon Purple */
  --accent-glow: rgba(176, 38, 255, 0.4);
  --error: #ff3366;
  --font-heading: 'Bebas Neue', display;
  --font-body: 'Space Mono', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-color);
  color: var(--text-secondary);
  font-family: var(--font-body);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 100vh;
  padding: 20px;
  overflow-x: hidden;
}

.container {
  max-width: 500px;
  width: 100%;
  padding: 20px;
  /* Make it slightly tall for stories 9:16 approx */
  min-height: 90vh;
  display: flex;
  flex-direction: column;
  position: relative;
  background-color: var(--bg-color);
}

/* Header & Typography */
header {
  text-align: center;
  margin-bottom: 30px;
}

h1 {
  font-family: var(--font-heading);
  font-size: 3.5rem;
  color: var(--text-primary);
  letter-spacing: 2px;
  margin-bottom: 5px;
  text-shadow: 0 0 10px rgba(57, 255, 20, 0.5);
}

.subtitle {
  font-size: 0.8rem;
  color: var(--accent);
  letter-spacing: 1px;
}

/* Glitch Effect */
.glitch {
  position: relative;
}
.glitch::before, .glitch::after {
  content: attr(data-text);
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg-color);
}
.glitch::before {
  left: 2px;
  text-shadow: -1px 0 red;
  clip: rect(24px, 550px, 90px, 0);
  animation: glitch-anim 2s infinite linear alternate-reverse;
}
.glitch::after {
  left: -2px;
  text-shadow: -1px 0 blue;
  clip: rect(85px, 550px, 140px, 0);
  animation: glitch-anim 2.5s infinite linear alternate-reverse;
}

@keyframes glitch-anim {
  0% { clip: rect(10px, 9999px, 86px, 0); }
  5% { clip: rect(98px, 9999px, 87px, 0); }
  10% { clip: rect(32px, 9999px, 49px, 0); }
  15% { clip: rect(88px, 9999px, 93px, 0); }
  20% { clip: rect(38px, 9999px, 63px, 0); }
  25% { clip: rect(28px, 9999px, 73px, 0); }
  30% { clip: rect(52px, 9999px, 25px, 0); }
  35% { clip: rect(5px, 9999px, 2px, 0); }
  40% { clip: rect(1px, 9999px, 7px, 0); }
  45% { clip: rect(85px, 9999px, 100px, 0); }
  50% { clip: rect(27px, 9999px, 5px, 0); }
  55% { clip: rect(9px, 9999px, 19px, 0); }
  60% { clip: rect(4px, 9999px, 20px, 0); }
  65% { clip: rect(10px, 9999px, 82px, 0); }
  70% { clip: rect(81px, 9999px, 86px, 0); }
  75% { clip: rect(29px, 9999px, 57px, 0); }
  80% { clip: rect(96px, 9999px, 70px, 0); }
  85% { clip: rect(38px, 9999px, 26px, 0); }
  90% { clip: rect(29px, 9999px, 78px, 0); }
  95% { clip: rect(34px, 9999px, 90px, 0); }
  100% { clip: rect(80px, 9999px, 15px, 0); }
}

/* Sections */
.section {
  display: none;
  flex-direction: column;
  flex-grow: 1;
}
.section.active {
  display: flex;
}

/* Inputs & Buttons */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

input, textarea {
  background-color: transparent;
  border: 1px solid var(--text-primary);
  color: var(--text-primary);
  padding: 15px;
  font-family: var(--font-body);
  font-size: 1rem;
  outline: none;
  transition: all 0.3s;
}
input:focus, textarea:focus {
  box-shadow: 0 0 10px rgba(57, 255, 20, 0.3);
}

.warning-text {
  font-size: 0.8rem;
  color: var(--error);
  margin-bottom: 10px;
}

.btn {
  font-family: var(--font-heading);
  font-size: 1.5rem;
  padding: 15px;
  cursor: pointer;
  border: none;
  text-transform: uppercase;
  transition: all 0.2s;
  letter-spacing: 2px;
}

.primary-btn {
  background-color: var(--text-primary);
  color: var(--bg-color);
}
.primary-btn:hover {
  background-color: #fff;
  box-shadow: 0 0 15px var(--text-primary);
}

.secondary-btn {
  background-color: var(--accent);
  color: #fff;
}
.secondary-btn:hover {
  box-shadow: 0 0 15px var(--accent);
}

.outline-btn {
  background-color: transparent;
  border: 1px solid var(--text-secondary);
  color: var(--text-secondary);
  font-size: 1rem;
  padding: 10px;
}
.outline-btn:hover {
  background-color: rgba(255,255,255,0.1);
}

/* Cards Layout */
.cards-container {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 25px;
  perspective: 1000px;
}

.tarot-card {
  flex: 1;
  background-color: #111;
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 15px 5px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 160px;
  box-shadow: 0 0 15px var(--accent-glow);
  animation: card-appear 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
  opacity: 0;
  transform: translateY(20px) rotateX(20deg);
}

/* Stagger card animations */
.tarot-card:nth-child(1) { animation-delay: 0.1s; }
.tarot-card:nth-child(2) { animation-delay: 0.4s; }
.tarot-card:nth-child(3) { animation-delay: 0.7s; }

@keyframes card-appear {
  to {
    opacity: 1;
    transform: translateY(0) rotateX(0);
  }
}

.card-emoji {
  font-size: 3rem;
  margin-bottom: 10px;
}

.card-name {
  font-size: 0.75rem;
  font-weight: bold;
  color: #fff;
  word-break: break-word;
  text-transform: uppercase;
}

/* Reading Box */
.reading-box {
  background-color: rgba(0, 0, 0, 0.5);
  border-left: 3px solid var(--text-primary);
  padding: 15px;
  font-size: 0.9rem;
  line-height: 1.5;
  margin-bottom: 30px;
}

/* Action Buttons for Result */
.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 15px;
  margin-top: auto;
}

/* Watermark */
.watermark {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.3);
  display: none;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: var(--error);
  color: white;
  padding: 10px 20px;
  border-radius: 4px;
  font-size: 0.8rem;
  z-index: 100;
  transition: opacity 0.3s;
}
.toast.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Footer */
footer {
  text-align: center;
  font-size: 0.7rem;
  color: #555;
  margin-top: 20px;
}
#clear-key-btn {
  cursor: pointer;
  text-decoration: underline;
}

/* Print/Screenshot Overrides */
.capturing .no-capture {
  display: none !important;
}
.capturing .watermark {
  display: block;
}
.capturing {
  padding: 30px 20px !important;
  background-color: var(--bg-color) !important;
}
