/* The Rusty Nail — ink & runes on aged parchment. Candlelit, hand-marked. */

:root {
  /* Parchment */
  --parch: #e7d5ad;
  --parch-lit: #f1e3c4;
  --parch-deep: #d8c193;
  --parch-edge: #b89a63;

  /* Ink */
  --ink: #3a2a16;
  --ink-soft: #5c462c;
  --ink-dim: #8a7150;

  /* Accents */
  --wax: #7e2c1c;
  --wax-bright: #a23a23;
  --gold: #a9802f;
  --gold-bright: #caa14a;

  /* Verdict */
  --true: #4f6b39;
  --false: #97341f;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100vh;
}

body {
  position: relative;
  background-color: var(--parch);
  background-image: radial-gradient(
      ellipse at 50% 35%,
      var(--parch-lit),
      transparent 65%
    ),
    radial-gradient(ellipse at 50% 120%, rgba(60, 38, 14, 0.35), transparent 70%),
    radial-gradient(ellipse at 0% 0%, rgba(120, 80, 30, 0.18), transparent 55%),
    radial-gradient(ellipse at 100% 100%, rgba(90, 55, 20, 0.22), transparent 60%);
  color: var(--ink);
  font-family: 'IM Fell English', Georgia, serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1.25rem;
  text-align: center;
  overflow-x: hidden;
}

/* Warm candle vignette beneath the wards */
html::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(
    ellipse at 50% 40%,
    transparent 42%,
    rgba(48, 30, 10, 0.3) 100%
  );
}

/* Two arcane magic circles, counter-rotating about the page centre.
   Oversized + centred so the rotation never leaves bare corners. */
body::before,
body::after {
  content: '';
  position: fixed;
  top: 50%;
  left: 50%;
  width: 200vmax;
  height: 200vmax;
  pointer-events: none;
  z-index: 0;
  background-repeat: no-repeat;
  background-position: center;
  transform: translate(-50%, -50%);
}

body::before {
  background-image: url('/magic-circle-a.svg');
  background-size: 86vmax;
  opacity: 0.18;
  animation: spin-cw 150s linear infinite, breathe 12s ease-in-out infinite;
}

body::after {
  background-image: url('/magic-circle-b.svg');
  background-size: 52vmax;
  opacity: 0.16;
  animation: spin-ccw 110s linear infinite;
}

@keyframes spin-cw {
  from {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  to {
    transform: translate(-50%, -50%) rotate(360deg);
  }
}

@keyframes spin-ccw {
  from {
    transform: translate(-50%, -50%) rotate(0deg);
  }
  to {
    transform: translate(-50%, -50%) rotate(-360deg);
  }
}

@keyframes breathe {
  0%,
  100% {
    opacity: 0.13;
  }
  50% {
    opacity: 0.22;
  }
}

.board {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 640px;
  animation: rise 0.7s cubic-bezier(0.2, 0.8, 0.25, 1) both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* --- Parchment scroll panel --- */
.panel {
  position: relative;
  background-color: var(--parch-lit);
  background-image: radial-gradient(
      ellipse at 22% 18%,
      rgba(150, 110, 50, 0.12),
      transparent 55%
    ),
    radial-gradient(ellipse at 82% 86%, rgba(110, 70, 25, 0.14), transparent 55%),
    radial-gradient(ellipse at 60% 50%, rgba(255, 245, 220, 0.35), transparent 70%);
  border: 1px solid var(--parch-edge);
  border-radius: 6px;
  padding: 2.75rem 2.25rem;
  box-shadow: 0 22px 55px rgba(40, 24, 8, 0.4),
    inset 0 0 0 1px rgba(255, 248, 230, 0.5),
    inset 0 0 70px rgba(150, 110, 55, 0.18),
    inset 0 0 26px rgba(90, 55, 20, 0.12);
}

/* Faint gilt frame just inside the edge */
.panel::before {
  content: '';
  position: absolute;
  inset: 9px;
  border: 1px solid rgba(169, 128, 47, 0.45);
  border-radius: 3px;
  pointer-events: none;
}

.hidden {
  display: none !important;
}

.mark {
  width: 46px;
  height: 110px;
  margin: 0 auto 0.7rem;
  background: url('/nail.svg') center / contain no-repeat;
  transform: rotate(-24deg);
  transform-origin: center;
  filter: drop-shadow(0 4px 6px rgba(40, 20, 8, 0.42));
  animation: sigil 6s ease-in-out infinite;
}

@keyframes sigil {
  0%,
  100% {
    transform: rotate(-24deg) scale(1);
    filter: drop-shadow(0 4px 6px rgba(40, 20, 8, 0.42));
  }
  50% {
    transform: rotate(-24deg) translateY(-3px) scale(1.04);
    filter: drop-shadow(0 7px 11px rgba(120, 50, 20, 0.5));
  }
}

h1 {
  font-family: 'Cinzel', serif;
  font-size: 2.5rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.15;
  margin: 0 0 1rem;
  color: var(--ink);
  text-shadow: 0 1px 0 rgba(255, 248, 230, 0.55);
}

.lede {
  color: var(--ink-soft);
  font-size: 1.08rem;
  line-height: 1.75;
  margin: 0 0 2rem;
}

.lede strong {
  color: var(--wax);
  font-weight: 700;
}

/* --- Streak bar --- */
.streak-bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 0.6rem;
}

.streak-label {
  font-family: 'Cinzel', serif;
  text-transform: uppercase;
  letter-spacing: 0.28em;
  font-size: 0.7rem;
  color: var(--ink-dim);
}

.streak-count {
  font-family: 'Caveat', cursive;
  font-size: 2rem;
  font-weight: 700;
  color: var(--wax);
}

.streak-track {
  height: 6px;
  background: rgba(80, 50, 18, 0.16);
  border: 1px solid rgba(120, 80, 35, 0.25);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 2rem;
}

.streak-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--gold), var(--wax-bright));
  box-shadow: 0 0 10px rgba(202, 161, 74, 0.6);
  transition: width 0.45s cubic-bezier(0.3, 0.8, 0.3, 1);
}

/* --- Question --- */
.prompt {
  font-family: 'Cinzel', serif;
  font-weight: 600;
  font-size: 1.7rem;
  line-height: 1.35;
  margin: 0 0 1.85rem;
  color: var(--ink);
  text-shadow: 0 1px 0 rgba(255, 248, 230, 0.5);
  animation: fadeUp 0.45s ease both;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.options {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.8rem;
}

.option {
  width: 100%;
  text-align: left;
  background: rgba(255, 248, 228, 0.55);
  border: 1px solid var(--parch-edge);
  color: var(--ink);
  font-family: 'IM Fell English', Georgia, serif;
  font-size: 1.08rem;
  padding: 1rem 1.2rem;
  border-radius: 4px;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255, 250, 235, 0.6);
  transition: background 0.18s, border-color 0.18s, transform 0.06s,
    box-shadow 0.18s;
}

.option:hover:not(:disabled) {
  background: rgba(169, 128, 47, 0.16);
  border-color: var(--gold);
  box-shadow: inset 0 1px 0 rgba(255, 250, 235, 0.6),
    0 4px 14px rgba(120, 80, 30, 0.22);
  transform: translateY(-1px);
}

.option:active:not(:disabled) {
  transform: translateY(0);
}

.option:disabled {
  cursor: default;
}

.option.correct {
  border-color: var(--true);
  background: rgba(79, 107, 57, 0.22);
  box-shadow: inset 0 0 0 1px rgba(79, 107, 57, 0.4),
    0 0 18px rgba(79, 107, 57, 0.25);
}

.option.wrong {
  border-color: var(--false);
  background: rgba(151, 52, 31, 0.2);
  box-shadow: inset 0 0 0 1px rgba(151, 52, 31, 0.4);
  animation: smear 0.4s ease;
}

@keyframes smear {
  0%,
  100% {
    transform: translateX(0);
  }
  25% {
    transform: translateX(-4px);
  }
  75% {
    transform: translateX(4px);
  }
}

/* --- Verdict --- */
.verdict {
  min-height: 1.6rem;
  margin: 1.5rem 0 0;
  font-family: 'Caveat', cursive;
  font-size: 1.6rem;
  font-weight: 700;
  opacity: 0;
  transform: scale(0.96);
  transition: opacity 0.25s, transform 0.25s;
}

.verdict.show {
  opacity: 1;
  transform: scale(1);
}

.verdict.true {
  color: var(--true);
}

.verdict.false {
  color: var(--false);
}

/* --- Button (wax seal) --- */
.btn {
  display: inline-block;
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-decoration: none;
  color: var(--parch-lit);
  background: linear-gradient(180deg, var(--wax-bright), var(--wax));
  border: 1px solid var(--gold);
  padding: 0.95rem 1.7rem;
  border-radius: 4px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(90, 30, 15, 0.35),
    inset 0 1px 0 rgba(255, 220, 180, 0.35);
  transition: background 0.18s, transform 0.06s, box-shadow 0.18s;
}

.btn:hover {
  background: linear-gradient(180deg, #b8472b, var(--wax-bright));
  box-shadow: 0 8px 24px rgba(120, 40, 20, 0.45),
    inset 0 1px 0 rgba(255, 220, 180, 0.45);
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(1px);
}

/* --- Returning-winner shortcut on the homepage --- */
.bypass {
  margin: 1.6rem 0 0;
  font-family: 'IM Fell English', Georgia, serif;
  font-style: italic;
  font-size: 0.95rem;
  color: var(--ink-dim);
}

.bypass-link {
  display: block;
  width: fit-content;
  margin: 0.5rem auto 0;
  font-style: normal;
  font-family: 'Cinzel', serif;
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  color: var(--wax);
  text-decoration: none;
  border-bottom: 1px solid rgba(126, 44, 28, 0.35);
  padding-bottom: 1px;
  transition: color 0.18s, border-color 0.18s, letter-spacing 0.18s;
}

.bypass-link:hover {
  color: var(--wax-bright);
  border-color: var(--wax-bright);
  letter-spacing: 0.07em;
}

.foot {
  position: relative;
  z-index: 1;
  margin-top: 2.5rem;
  font-family: 'Cinzel', serif;
  font-size: 0.7rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: rgba(90, 70, 44, 0.7);
}

/* --- Portal: the lone "Welcome to Elandis" button at zero --- */
.portal {
  display: flex;
  justify-content: center;
  padding: 1rem 0;
}

.portal-btn {
  position: relative;
  overflow: hidden;
  display: inline-block;
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: clamp(1.25rem, 4vw, 1.7rem);
  letter-spacing: 0.08em;
  text-decoration: none;
  color: #f5e8c8;
  padding: 1.35rem 3.2rem;
  border-radius: 7px;
  background: linear-gradient(180deg, #a23a23, #6f2616);
  border: 2px solid var(--gold-bright);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45), 0 0 16px rgba(202, 161, 74, 0.45);
  box-shadow: 0 12px 34px rgba(90, 30, 15, 0.45),
    0 0 30px rgba(202, 161, 74, 0.25);
  transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.25, 1),
    box-shadow 0.3s, letter-spacing 0.3s, border-color 0.3s;
  animation: portal-glow 3.6s ease-in-out infinite;
}

/* inner gilt line */
.portal-btn::after {
  content: '';
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(245, 232, 200, 0.4);
  border-radius: 4px;
  pointer-events: none;
}

/* sweeping shine */
.portal-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -140%;
  width: 65%;
  height: 100%;
  background: linear-gradient(
    100deg,
    transparent,
    rgba(255, 244, 214, 0.55),
    transparent
  );
  transform: skewX(-20deg);
  transition: left 0.7s ease;
  pointer-events: none;
}

.portal-btn:hover {
  transform: translateY(-3px) scale(1.045);
  letter-spacing: 0.15em;
  border-color: #e6c878;
  box-shadow: 0 18px 48px rgba(120, 40, 20, 0.55),
    0 0 70px rgba(202, 161, 74, 0.6);
}

.portal-btn:hover::before {
  left: 140%;
}

.portal-btn:active {
  transform: translateY(-1px) scale(1.02);
}

@keyframes portal-glow {
  0%,
  100% {
    box-shadow: 0 12px 34px rgba(90, 30, 15, 0.45),
      0 0 26px rgba(202, 161, 74, 0.22);
  }
  50% {
    box-shadow: 0 14px 40px rgba(90, 30, 15, 0.5),
      0 0 48px rgba(202, 161, 74, 0.5);
  }
}

@media (prefers-reduced-motion: reduce) {
  .portal-btn {
    animation: none;
  }
  .portal-btn::before {
    display: none;
  }
}

/* --- Countdown (used on the open page) --- */
.countdown {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  margin: 1.5rem 0 0.5rem;
}

.unit {
  display: flex;
  flex-direction: column;
  min-width: 3.5rem;
}

.unit span {
  font-family: 'Caveat', cursive;
  font-size: 3rem;
  font-weight: 700;
  color: var(--wax);
  line-height: 1;
}

.unit label {
  font-family: 'Cinzel', serif;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  font-size: 0.6rem;
  color: var(--ink-dim);
  margin-top: 0.45rem;
}

@media (prefers-reduced-motion: reduce) {
  body::before,
  body::after,
  .board,
  .mark,
  .prompt,
  .option.wrong {
    animation: none !important;
  }
}
