:root {
  --gold: #c9a769;
  --gold-soft: #e7d3a1;
  --ink: #0b0710;
  --ink-deep: #060409;
  --veil: rgba(6, 4, 9, 0.62);
  --box-w: 420px;
  font-size: 16px;
}

@media (min-width: 640px) {
  :root { --box-w: 460px; font-size: 16.5px; }
}

@media (min-width: 1024px) {
  :root { --box-w: 500px; font-size: 17px; }
}

@media (min-width: 1440px) {
  :root { --box-w: 540px; font-size: 18px; }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: var(--ink);
  color: #f4ede0;
  font-family: 'Inter', system-ui, sans-serif;
  overflow-x: hidden;
}

/* ---------- Background photo ---------- */

.bg-photo {
  position: fixed;
  inset: 0;
  z-index: 0;
  background-image:
    url('../assets/bg.jpg'),
    radial-gradient(120% 90% at 50% 8%, #2a1a3a 0%, #150c22 42%, #0a0612 78%, #050308 100%);
  background-size: cover, cover;
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
}

.bg-veil {
  position: fixed;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(140% 80% at 50% 0%, rgba(6,4,9,0.15) 0%, rgba(6,4,9,0.55) 55%, rgba(4,3,7,0.88) 100%),
    linear-gradient(to bottom, rgba(5,3,8,0.55) 0%, rgba(5,3,8,0.35) 30%, rgba(5,3,8,0.72) 100%);
  pointer-events: none;
}

/* ---------- Layout ---------- */

.app {
  position: relative;
  z-index: 2;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(1.75rem, 6vw, 3.5rem) 1.25rem 2.5rem;
}

/* ---------- Header ---------- */

.site-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: clamp(1.5rem, 5vw, 2.5rem);
}

.brand-logo {
  width: clamp(64px, 16vw, 96px);
  height: auto;
  margin-bottom: 1.1rem;
  filter: drop-shadow(0 2px 14px rgba(0,0,0,0.5));
}

.site-title {
  font-family: 'Cinzel', serif;
  font-weight: 600;
  color: #ffffff;
  font-size: clamp(1.7rem, 6.5vw, 2.6rem);
  letter-spacing: 0.06em;
  line-height: 1.28;
  margin: 0;
  text-transform: uppercase;
  text-shadow: 0 2px 18px rgba(0,0,0,0.55), 0 0 40px rgba(201,167,105,0.15);
}

.site-subtitle {
  margin: 0.85rem 0 0;
  font-family: 'Inter', sans-serif;
  font-weight: 300;
  font-size: clamp(0.85rem, 2.6vw, 0.98rem);
  letter-spacing: 0.03em;
  color: rgba(244, 237, 224, 0.72);
}

/* ---------- Reading area ---------- */

.reading-area {
  width: 100%;
  max-width: calc(var(--box-w) + 40px);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stage {
  width: 100%;
  max-width: var(--box-w);
  aspect-ratio: 921 / 1394;
  margin: 0.5rem 0 1.5rem;
}

.card {
  all: unset;
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  perspective: 1600px;
  -webkit-perspective: 1600px;
  -webkit-transform-style: preserve-3d;
  transform-style: preserve-3d;
}

.card:focus-visible .card-inner {
  outline: 2px solid var(--gold-soft);
  outline-offset: 6px;
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  filter: drop-shadow(0 18px 40px rgba(0,0,0,0.55));
}

.card-face {
  position: absolute;
  inset: 0;
  border-radius: 14px;
  overflow: hidden;
  visibility: hidden;
}

.card-face.is-active {
  visibility: visible;
}

.card-back {
  background: linear-gradient(155deg, #1c1128 0%, #120a1c 55%, #0b0713 100%);
  border: 1px solid rgba(201, 167, 105, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}

.card-back-frame {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.1rem;
}

.card-back-logo {
  width: 58%;
  height: auto;
  filter: drop-shadow(0 2px 10px rgba(0,0,0,0.45));
}

.card-back-label {
  font-family: 'Cinzel', serif;
  font-size: 0.62rem;
  letter-spacing: 0.28em;
  color: var(--gold-soft);
  text-align: center;
  line-height: 1.8;
  opacity: 0.85;
}

.card-front {
  background: #0b0713;
  border: 1px solid rgba(201, 167, 105, 0.35);
}

.card-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hint {
  font-family: 'Inter', sans-serif;
  font-weight: 300;
  font-size: 0.85rem;
  letter-spacing: 0.03em;
  color: rgba(244, 237, 224, 0.55);
  margin: 0 0 0.5rem;
  text-align: center;
  transition: opacity 0.4s ease;
}

.hint.is-hidden { opacity: 0; height: 0; margin: 0; overflow: hidden; }

/* ---------- Result ---------- */

.result {
  width: 100%;
  max-width: var(--box-w);
  text-align: center;
  opacity: 0;
  transform: translateY(14px);
  pointer-events: none;
  transition: opacity 0.6s ease 0.25s, transform 0.6s ease 0.25s;
}

.result.is-visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.result-card {
  background: linear-gradient(180deg, #4d51c4 0%, #3a2f8f 32%, rgba(53, 43, 130, 0.55) 50%, rgba(36, 26, 84, 0) 78%);
  border: none;
  border-top: 3px solid rgba(201, 167, 105, 0.6);
  border-radius: 28px;
  padding: clamp(1.75rem, 6vw, 2.5rem) clamp(1.5rem, 6vw, 2.25rem) clamp(2rem, 6vw, 2.5rem);
}

.result-name {
  font-family: 'Cinzel', serif;
  font-weight: 600;
  color: #ffffff;
  font-size: clamp(1.3rem, 4.5vw, 1.65rem);
  letter-spacing: 0.05em;
  margin: 0 0 1rem;
  text-transform: uppercase;
}

.result-text {
  font-family: 'Inter', sans-serif;
  font-weight: 300;
  font-size: clamp(0.92rem, 2.6vw, 1.02rem);
  line-height: 1.75;
  color: rgba(244, 237, 224, 0.92);
  white-space: pre-line;
  margin: 0 0 1.75rem;
}

.draw-again {
  font-family: 'Inter', sans-serif;
  font-weight: 600;
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #ffffff;
  background: linear-gradient(180deg, #dcbf8c 0%, #c9a769 100%);
  border: 1px solid var(--gold);
  border-radius: 999px;
  padding: 0.85rem 2rem;
  cursor: pointer;
  transition: background 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.draw-again:hover,
.draw-again:focus-visible {
  background: transparent;
  border-color: var(--gold);
  color: var(--gold-soft);
}

/* ---------- Footer ---------- */

.site-footer {
  margin-top: auto;
  padding-top: 2.5rem;
  font-family: 'Cinzel', serif;
  font-size: 0.62rem;
  letter-spacing: 0.3em;
  color: rgba(244, 237, 224, 0.4);
  text-align: center;
}

.credit {
  margin: 0.7rem 0 0;
  font-family: 'Inter', sans-serif;
  font-weight: 300;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  color: rgba(244, 237, 224, 0.38);
}

.disclaimer {
  margin: 0.9rem auto 0;
  max-width: 320px;
  font-family: 'Inter', sans-serif;
  font-weight: 300;
  font-size: 0.62rem;
  letter-spacing: 0.01em;
  line-height: 1.6;
  color: rgba(244, 237, 224, 0.32);
}
