:root {
  --paper: #f3ead6;
  --paper-deep: #ece0c6;
  --ink: #211b14;
  --ink-soft: #5b4f3d;
  --gold: #e7b033;
  --gold-deep: #c8902a;
  --plum: #6d2438;
  --line: #ccbd9c;
  --shadow: 32, 24, 12;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  min-height: 100vh;
  background:
    radial-gradient(120% 90% at 85% -10%, rgba(231, 176, 51, 0.28), transparent 55%),
    radial-gradient(90% 80% at -10% 110%, rgba(109, 36, 56, 0.16), transparent 50%),
    var(--paper);
  color: var(--ink);
  font-family: "Fraunces", Georgia, serif;
  display: flex;
  justify-content: center;
  padding: clamp(1.2rem, 4vw, 3.5rem);
  overflow-x: hidden;
}

/* Film grain overlay */
.grain {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
  opacity: 0.5;
  mix-blend-mode: multiply;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.35'/%3E%3C/svg%3E");
}

.stage {
  width: min(720px, 100%);
  display: flex;
  flex-direction: column;
  gap: clamp(1.6rem, 4vw, 2.6rem);
}

/* ---------- Masthead ---------- */
.masthead { position: relative; }

.brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.9rem;
}
.brand__rule { flex: 1; height: 1px; background: var(--line); }

.masthead__title {
  font-size: clamp(3.1rem, 13vw, 6rem);
  font-weight: 600;
  line-height: 0.86;
  letter-spacing: -0.03em;
  font-optical-sizing: auto;
}
.masthead__title em {
  font-style: italic;
  font-weight: 500;
  color: var(--plum);
}

.masthead__dek {
  margin-top: 1.1rem;
  max-width: 42ch;
  font-size: clamp(1rem, 2.4vw, 1.18rem);
  line-height: 1.5;
  color: var(--ink-soft);
}
.masthead__dek a {
  color: var(--ink);
  text-decoration-color: var(--gold-deep);
  text-underline-offset: 3px;
  text-decoration-thickness: 2px;
}

/* ---------- Oracle row ---------- */
.oracle {
  display: grid;
  grid-template-columns: 116px 1fr;
  gap: clamp(1rem, 3vw, 1.8rem);
  align-items: start;
}

.seer {
  position: relative;
  width: 116px;
  padding-top: 0.4rem;
}
.seer__halo {
  position: absolute;
  inset: -10px -10px auto -10px;
  height: 116px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--gold) 0%, transparent 68%);
  filter: blur(6px);
  opacity: 0.75;
  animation: pulse 5.5s ease-in-out infinite;
}
.seer__face {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 50%;
  border: 3px solid var(--ink);
  box-shadow: 0 10px 26px rgba(var(--shadow), 0.28);
  filter: saturate(1.05);
}
.seer__caption {
  margin-top: 0.6rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-soft);
  text-align: center;
}

/* ---------- Card ---------- */
.card {
  position: relative;
  background: linear-gradient(168deg, #fdf8ec 0%, var(--paper-deep) 100%);
  border: 1.5px solid var(--ink);
  border-radius: 4px;
  padding: clamp(1.6rem, 4vw, 2.4rem) clamp(1.5rem, 4vw, 2.3rem) clamp(1.3rem, 3vw, 1.7rem);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.5) inset,
    14px 16px 0 -2px rgba(var(--shadow), 0.13),
    14px 16px 0 -3px var(--ink);
  min-height: 230px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.card__quote-mark {
  position: absolute;
  top: -0.35em;
  left: 0.45rem;
  font-size: 5.5rem;
  line-height: 1;
  color: var(--gold);
  font-weight: 600;
  pointer-events: none;
}

.card__text {
  font-size: clamp(1.4rem, 4.4vw, 2rem);
  line-height: 1.28;
  font-weight: 500;
  letter-spacing: -0.012em;
  text-wrap: balance;
}

.card__meta {
  margin-top: 1.5rem;
  padding-top: 0.9rem;
  border-top: 1px dashed var(--line);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  flex-wrap: wrap;
}
.card__handle {
  font-style: italic;
  font-size: 1.05rem;
  color: var(--plum);
}
.card__category {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.68rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
  background: rgba(231, 176, 51, 0.25);
  padding: 0.3rem 0.6rem;
  border-radius: 2px;
}

/* fade/lift animation on new wisdom */
.card.is-shuffling .card__text,
.card.is-shuffling .card__category { opacity: 0; transform: translateY(8px); }
.card__text, .card__category {
  transition: opacity 0.32s ease, transform 0.32s ease;
}

/* ---------- Controls ---------- */
.controls {
  display: flex;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.btn {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.84rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border: 1.5px solid var(--ink);
  border-radius: 3px;
  padding: 0.95rem 1.4rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.2s ease;
}
.btn:active { transform: translate(3px, 3px); }

.btn--primary {
  background: var(--gold);
  color: var(--ink);
  flex: 1;
  justify-content: center;
  box-shadow: 4px 4px 0 var(--ink);
  font-weight: 600;
}
.btn--primary:hover { background: var(--gold-deep); }
.btn--primary:active { box-shadow: 1px 1px 0 var(--ink); }

.btn__hint {
  font-size: 0.66rem;
  border: 1px solid rgba(33, 27, 20, 0.45);
  border-radius: 2px;
  padding: 0.12rem 0.42rem;
  opacity: 0.7;
}

.btn--ghost {
  background: transparent;
  color: var(--ink);
}
.btn--ghost:hover { background: rgba(33, 27, 20, 0.06); }
.btn--ghost.is-copied { background: var(--plum); color: var(--paper); border-color: var(--plum); }

/* ---------- Footer ---------- */
.footer {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  color: var(--ink-soft);
  border-top: 1px solid var(--line);
  padding-top: 1rem;
}
.footer__count strong { color: var(--ink); font-size: 0.85rem; }
.footer__disclaimer { line-height: 1.6; max-width: 60ch; opacity: 0.85; }

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.65; }
  50% { transform: scale(1.12); opacity: 0.9; }
}

/* ---------- Mobile ---------- */
@media (max-width: 540px) {
  .oracle { grid-template-columns: 1fr; }
  .seer {
    width: 92px;
    margin: 0 auto;
  }
  .seer__halo { height: 92px; }
  .card { min-height: 200px; }
}

@media (prefers-reduced-motion: reduce) {
  .seer__halo { animation: none; }
  .card__text, .card__category { transition: none; }
}
