:root {
  --ink: #3a2a1a;
  --ink-soft: #5c4630;
  --gold: #8a6d3b;
  --gold-bright: #b08d3f;
  --parchment: #f4e7c8;
  --parchment-dark: #e9d9b3;
  --crimson: #7a2e2e;
  --shadow: rgba(58, 42, 26, 0.35);
}

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

html,
body {
  min-height: 100%;
}

body {
  font-family: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  color: var(--ink);
  background:
    radial-gradient(ellipse at 50% -10%, rgba(176, 141, 63, 0.25), transparent 60%),
    radial-gradient(ellipse at 50% 110%, rgba(122, 46, 46, 0.18), transparent 60%),
    linear-gradient(160deg, #2b1e12 0%, #3a2a1a 45%, #241809 100%);
  min-height: 100vh;
  padding: 2.5rem 1rem 3rem;
  display: flex;
  justify-content: center;
}

.stage {
  width: 100%;
  max-width: 46rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.75rem;
}

/* ---------- Masthead ---------- */

.masthead {
  text-align: center;
  color: var(--parchment);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

.seal {
  font-size: 2rem;
  color: var(--gold-bright);
  margin-bottom: 0.35rem;
  animation: seal-spin 14s linear infinite;
}

@keyframes seal-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

.title {
  font-family: "IM Fell English SC", "IM Fell English", Georgia, serif;
  font-weight: 400;
  font-size: clamp(2.4rem, 7vw, 4rem);
  letter-spacing: 0.02em;
}

.subtitle {
  font-style: italic;
  font-size: clamp(1.05rem, 2.5vw, 1.3rem);
  color: #d9c9a4;
}

/* ---------- Parchment card ---------- */

.parchment {
  position: relative;
  width: 100%;
  background:
    radial-gradient(ellipse at 20% 10%, rgba(255, 250, 235, 0.6), transparent 55%),
    radial-gradient(ellipse at 85% 90%, rgba(176, 141, 63, 0.15), transparent 55%),
    linear-gradient(150deg, var(--parchment) 0%, var(--parchment-dark) 100%);
  border: 1px solid rgba(122, 92, 50, 0.5);
  border-radius: 4px;
  padding: 2.5rem 1.75rem 2rem;
  box-shadow:
    0 1px 0 rgba(255, 250, 235, 0.6) inset,
    0 24px 48px -18px var(--shadow),
    0 6px 14px rgba(0, 0, 0, 0.4);
  text-align: center;
}

/* Aged-paper speckle via layered background on a pseudo-element */
.parchment::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 4px;
  pointer-events: none;
  opacity: 0.5;
  background-image:
    radial-gradient(rgba(90, 60, 25, 0.08) 1px, transparent 1px),
    radial-gradient(rgba(90, 60, 25, 0.05) 1px, transparent 1px);
  background-size: 24px 24px, 34px 34px;
  background-position: 0 0, 12px 12px;
}

/* ---------- Flourishes ---------- */

.flourish {
  color: var(--gold);
  font-size: 1.4rem;
  line-height: 1;
}

.flourish.top {
  margin-bottom: 0.75rem;
}

.flourish.bottom {
  margin-top: 1.25rem;
}

/* ---------- Insult ---------- */

.insult-area {
  margin: 0.5rem 0 0.25rem;
}

.lede {
  font-style: italic;
  color: var(--ink-soft);
  font-size: 1.1rem;
  margin-bottom: 1rem;
}

.insult {
  font-family: "IM Fell English", Georgia, serif;
  font-size: clamp(1.9rem, 6vw, 3.1rem);
  line-height: 1.18;
  color: var(--crimson);
  text-wrap: balance;
  overflow-wrap: break-word;
}

.insult .thou {
  color: var(--ink);
}

.insult .bang {
  color: var(--gold);
}

/* Pop-in animation for a newly minted insult */
.insult.is-fresh {
  animation: insult-pop 0.55s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}

@keyframes insult-pop {
  0%   { transform: scale(0.92) translateY(6px); opacity: 0; }
  100% { transform: scale(1) translateY(0); opacity: 1; }
}

/* ---------- Countdown ---------- */

.countdown-row {
  margin: 1.25rem 0 0.5rem;
}

.countdown {
  font-size: 1.05rem;
  color: var(--ink-soft);
  letter-spacing: 0.03em;
}

.countdown strong {
  font-family: "IM Fell English SC", Georgia, serif;
  font-weight: 400;
  font-size: 1.25rem;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

/* ---------- Actions ---------- */

.actions {
  margin-top: 1rem;
}

.btn {
  font-family: "IM Fell English SC", Georgia, serif;
  font-size: 1.15rem;
  letter-spacing: 0.04em;
  color: var(--parchment);
  background: linear-gradient(180deg, #6d4b2a 0%, #4a3118 100%);
  border: 1px solid #2c1d0e;
  border-radius: 3px;
  padding: 0.75rem 1.75rem;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.35), 0 1px 0 rgba(255, 250, 235, 0.25) inset;
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

.btn:hover {
  filter: brightness(1.12);
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.4), 0 1px 0 rgba(255, 250, 235, 0.25) inset;
}

.btn:active {
  transform: translateY(1px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}

.btn:focus-visible {
  outline: 2px solid var(--gold-bright);
  outline-offset: 3px;
}

/* ---------- History ---------- */

.history {
  margin-top: 1.75rem;
  border-top: 1px solid rgba(122, 92, 50, 0.35);
  padding-top: 1.25rem;
  text-align: left;
}

.history-title {
  font-family: "IM Fell English SC", Georgia, serif;
  font-weight: 400;
  font-size: 1.15rem;
  color: var(--ink);
  text-align: center;
  margin-bottom: 0.75rem;
}

.history-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 15rem;
  overflow-y: auto;
}

.history-list li {
  font-style: italic;
  font-size: 1.02rem;
  color: var(--ink-soft);
  padding: 0.35rem 0.6rem;
  border-left: 2px solid var(--gold);
  background: rgba(255, 250, 235, 0.35);
  border-radius: 0 3px 3px 0;
}

.history-list li:first-child {
  color: var(--crimson);
  font-weight: 600;
}

.history-list li::before {
  content: "";
  /* numbered markers come from the <ol>, kept subtle below */
}

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

.footer {
  text-align: center;
  color: #cbb78f;
  font-style: italic;
  font-size: 0.95rem;
  max-width: 36rem;
  line-height: 1.5;
}

.footer .credit {
  margin-top: 0.4rem;
  color: #a8905f;
  font-size: 0.85rem;
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .seal {
    animation: none;
  }
  .insult.is-fresh {
    animation: none;
  }
  .btn {
    transition: none;
  }
}
