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

:root {
  --bg-deep: #111D2E;
  --bg-card: #162438;
  --bg-surface: #1B2D42;
  --gold: #D4AF6A;
  --gold-dim: rgba(212, 175, 106, 0.4);
  --gold-glow: rgba(212, 175, 106, 0.15);
  --cream: #EDE8DC;
  --text-primary: #D6D1C7;
  --text-secondary: #9FA5A8;
  --text-muted: #6A7580;
  --accent-upright: #7BAE8A;
  --accent-inverted: #C4977A;
  --border: rgba(212, 175, 106, 0.15);
}

body {
  font-family: 'Spectral', Georgia, serif;
  background-color: var(--bg-deep);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.7;
  overflow-x: hidden;
}

/* Starfield texture */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(1px 1px at 10% 20%, rgba(212,175,106,0.15) 0%, transparent 100%),
    radial-gradient(1px 1px at 30% 60%, rgba(212,175,106,0.1) 0%, transparent 100%),
    radial-gradient(1px 1px at 50% 10%, rgba(212,175,106,0.12) 0%, transparent 100%),
    radial-gradient(1px 1px at 70% 80%, rgba(212,175,106,0.08) 0%, transparent 100%),
    radial-gradient(1px 1px at 90% 40%, rgba(212,175,106,0.1) 0%, transparent 100%),
    radial-gradient(1px 1px at 15% 85%, rgba(212,175,106,0.06) 0%, transparent 100%),
    radial-gradient(1px 1px at 85% 15%, rgba(212,175,106,0.09) 0%, transparent 100%),
    radial-gradient(1px 1px at 45% 45%, rgba(212,175,106,0.07) 0%, transparent 100%);
  pointer-events: none;
  z-index: 0;
}

/* Layout */
.page-wrapper {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1.5rem 3rem;
}

/* Ad placeholder - top */
.ad-slot {
  width: 100%;
  max-width: 728px;
  min-height: 90px;
  border: 1px dashed var(--border);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.75rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 2.5rem;
  background: rgba(212, 175, 106, 0.02);
}
.ad-slot.ad-bottom {
  margin-bottom: 0;
  margin-top: 2.5rem;
}
.ad-slot.ad-sidebar {
  max-width: 300px;
  min-height: 250px;
  margin: 2rem auto;
}

/* Header */
header {
  text-align: center;
  margin-bottom: 2.5rem;
}

header h1 {
  font-family: 'Cinzel', Georgia, serif;
  font-weight: 500;
  font-size: 2.4rem;
  color: var(--gold);
  letter-spacing: 0.12em;
  margin-bottom: 0.4rem;
  text-shadow: 0 0 40px rgba(212, 175, 106, 0.2);
}

header .subtitle {
  font-size: 0.95rem;
  color: var(--text-secondary);
  font-style: italic;
  font-weight: 300;
  letter-spacing: 0.03em;
}

/* Decorative divider */
.divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 0 auto 2.5rem;
  width: 200px;
}
.divider::before, .divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--gold-dim), transparent);
}
.divider-star {
  color: var(--gold);
  font-size: 0.7rem;
}

/* Card display area */
.card-stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-bottom: 2rem;
  width: 100%;
  max-width: 600px;
}

/* The card back / draw prompt */
.draw-prompt {
  width: 200px;
  height: 320px;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--bg-surface), var(--bg-card));
  border: 2px solid var(--gold-dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.4s ease;
  position: relative;
  overflow: hidden;
  margin-bottom: 1.5rem;
}

.draw-prompt::before {
  content: '';
  position: absolute;
  inset: 8px;
  border: 1px solid var(--gold-dim);
  border-radius: 8px;
  pointer-events: none;
}

/* Diamond pattern on card back */
.draw-prompt::after {
  content: '';
  position: absolute;
  inset: 20px;
  background-image:
    linear-gradient(45deg, var(--gold-glow) 25%, transparent 25%),
    linear-gradient(-45deg, var(--gold-glow) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, var(--gold-glow) 75%),
    linear-gradient(-45deg, transparent 75%, var(--gold-glow) 75%);
  background-size: 24px 24px;
  background-position: 0 0, 0 12px, 12px -12px, -12px 0;
  opacity: 0.4;
  pointer-events: none;
  border-radius: 4px;
}

.draw-prompt:hover {
  border-color: var(--gold);
  box-shadow: 0 0 30px rgba(212, 175, 106, 0.15), inset 0 0 30px rgba(212, 175, 106, 0.05);
  transform: translateY(-2px);
}

.draw-prompt .prompt-text {
  position: relative;
  z-index: 2;
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  color: var(--gold);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  text-shadow: 0 0 20px rgba(212, 175, 106, 0.3);
}

.draw-prompt .prompt-icon {
  position: relative;
  z-index: 2;
  font-size: 2rem;
  margin-bottom: 0.8rem;
  opacity: 0.7;
}

/* Drawn card result */
.card-result {
  display: none;
  width: 100%;
  animation: cardReveal 0.6s ease-out forwards;
}

@keyframes cardReveal {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.card-image-container {
  display: flex;
  justify-content: center;
  margin-bottom: 1.8rem;
}

.card-image-placeholder {
  width: 180px;
  height: 310px;
  border-radius: 10px;
  background: linear-gradient(145deg, var(--bg-surface), var(--bg-card));
  border: 2px solid var(--gold-dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: var(--text-muted);
  position: relative;
  overflow: hidden;
}

.card-image-placeholder::before {
  content: '';
  position: absolute;
  inset: 6px;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.card-image-placeholder .placeholder-icon {
  font-size: 1.5rem;
  color: var(--gold-dim);
}

.card-image-placeholder .placeholder-text {
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.card-image-placeholder img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}

.card-image-placeholder.inverted img {
  transform: rotate(180deg);
}

.card-name-area {
  text-align: center;
  margin-bottom: 1.8rem;
}

.card-numeral {
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  color: var(--text-muted);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  margin-bottom: 0.3rem;
}

.card-name {
  font-family: 'Cinzel', serif;
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--gold);
  letter-spacing: 0.06em;
  text-shadow: 0 0 30px rgba(212, 175, 106, 0.2);
  margin-bottom: 0.5rem;
}

.card-orientation {
  font-family: 'Spectral', serif;
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  padding: 0.25rem 1rem;
  border-radius: 20px;
  display: inline-block;
}
.card-orientation.upright {
  color: var(--accent-upright);
  background: rgba(123, 166, 138, 0.1);
  border: 1px solid rgba(123, 166, 138, 0.2);
}
.card-orientation.inverted {
  color: var(--accent-inverted);
  background: rgba(166, 112, 123, 0.1);
  border: 1px solid rgba(166, 112, 123, 0.2);
}

.card-suit {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
  margin-top: 0.5rem;
}

/* Reading sections */
.reading-section {
  margin-bottom: 1.6rem;
}

.reading-label {
  font-family: 'Cinzel', serif;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--gold);
  margin-bottom: 0.5rem;
  opacity: 0.8;
}

.reading-text {
  font-size: 1.02rem;
  line-height: 1.75;
  color: var(--text-primary);
  font-weight: 300;
}

.keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.3rem;
}

.keyword {
  font-size: 0.8rem;
  color: var(--text-secondary);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 0.2rem 0.75rem;
  border-radius: 20px;
  font-style: italic;
}

/* Draw again button */
.draw-btn {
  display: none;
  margin: 0.5rem auto 0;
  background: none;
  border: 1.5px solid var(--gold-dim);
  color: var(--gold);
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  padding: 0.65rem 2rem;
  border-radius: 30px;
  cursor: pointer;
  transition: all 0.3s ease;
}

.draw-btn:hover {
  background: var(--gold);
  color: var(--bg-deep);
  border-color: var(--gold);
  box-shadow: 0 0 20px rgba(212, 175, 106, 0.2);
}

/* About section */
.about-section {
  max-width: 600px;
  width: 100%;
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border);
}

.about-section h2 {
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  font-weight: 500;
  color: var(--gold);
  letter-spacing: 0.08em;
  margin-bottom: 1rem;
}

.about-section p {
  font-size: 0.92rem;
  color: var(--text-secondary);
  margin-bottom: 0.9rem;
  font-weight: 300;
  line-height: 1.8;
}

.about-section p:last-child {
  margin-bottom: 0;
}

/* Footer */
footer {
  max-width: 600px;
  width: 100%;
  text-align: center;
  margin-top: 2.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-muted);
}

footer a {
  color: var(--text-secondary);
  text-decoration: none;
  border-bottom: 1px dotted var(--text-muted);
  transition: color 0.2s;
}
footer a:hover { color: var(--gold); }

/* Bookshop link */
.bookshop-section {
  max-width: 600px;
  width: 100%;
  margin-top: 2rem;
}

.bookshop-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  padding: 1.2rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-surface);
  text-decoration: none;
  transition: all 0.3s ease;
}

.bookshop-link:hover {
  border-color: var(--gold-dim);
  background: var(--bg-card);
  transform: translateY(-1px);
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.bookshop-icon { font-size: 1.3rem; }

.bookshop-text {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--gold);
  letter-spacing: 0.05em;
  text-align: center;
}

.bookshop-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
}

/* Responsive */
@media (max-width: 480px) {
  header h1 { font-size: 1.8rem; letter-spacing: 0.08em; }
  .card-name { font-size: 1.5rem; }
  .draw-prompt { width: 170px; height: 270px; }
  body { padding: 1.5rem 1rem; }
  .ad-slot { min-height: 60px; }
}
