/* ==========================================================================
   QuestBoard — The Family Adventurer's Guild
   Leather & Gold RPG theme · self-hosted fonts · Pi-friendly animations
   ========================================================================== */

/* —— Fonts (self-hosted, SIL OFL) —— */
@font-face {
  font-family: "Cinzel";
  src: url("/static/fonts/cinzel-var.woff2") format("woff2");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Cinzel Decorative";
  src: url("/static/fonts/cinzel-decorative-700.woff2") format("woff2");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Alegreya";
  src: url("/static/fonts/alegreya-var.woff2") format("woff2");
  font-weight: 400 900;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Alegreya";
  src: url("/static/fonts/alegreya-italic-var.woff2") format("woff2");
  font-weight: 400 900;
  font-style: italic;
  font-display: swap;
}

/* —— Palette —— */
:root {
  /* leather & wine */
  --leather-950: #150807;
  --leather-900: #221010;
  --leather-850: #2a1412;
  --leather-800: #341a16;
  --leather-700: #452319;
  --leather-600: #58301f;
  --wine-900: #2e0f16;
  --wine-800: #40161e;

  /* metals */
  --bronze: #8a5a28;
  --bronze-dark: #5f3d1c;
  --gold: #d9a441;
  --gold-bright: #f2c464;
  --gold-blaze: #ffd97a;
  --gold-dim: #a87a2e;
  --gold-line: rgba(217, 164, 65, 0.4);
  --amber-glow: rgba(255, 170, 60, 0.5);
  --ember: #ff9d3d;

  /* text */
  --cream: #f3e2c0;
  --cream-dim: #cfb691;
  --cream-faint: #a68d66;
  --ink: #1a0e06;

  /* sparing accents */
  --quest-green: #57c078;
  --quest-green-deep: #1c4a2e;
  --steel-blue: #7fb2d9;
  --steel-blue-deep: #1f3a52;
  --danger: #c2571b;

  --radius: 0.7rem;

  /* subtle leather grain (static SVG noise — cheap to composite) */
  --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix type='saturate' values='0'/><feComponentTransfer><feFuncA type='linear' slope='0.05'/></feComponentTransfer></filter><rect width='140' height='140' filter='url(%23n)'/></svg>");
  /* four-point star used for card corners */
  --corner-star: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 18 18'><path d='M9 0 L11 7 L18 9 L11 11 L9 18 L7 11 L0 9 L7 7 Z' fill='%23d9a441' fill-opacity='0.8'/></svg>");
}

* { box-sizing: border-box; }

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

body.qb-body {
  font-family: "Alegreya", Georgia, "Times New Roman", serif;
  font-size: 1.02rem;
  color: var(--cream);
  background:
    var(--grain),
    radial-gradient(ellipse 90% 55% at 50% -5%, rgba(255, 160, 60, 0.10), transparent 60%),
    radial-gradient(ellipse 120% 90% at 50% 115%, rgba(0, 0, 0, 0.55), transparent 55%),
    radial-gradient(ellipse 70% 60% at 12% 40%, rgba(64, 22, 30, 0.55), transparent 65%),
    radial-gradient(ellipse 70% 60% at 88% 60%, rgba(69, 35, 25, 0.5), transparent 65%),
    linear-gradient(180deg, #1c0d0b 0%, var(--leather-900) 30%, #1b0c0e 100%);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

::selection { background: rgba(217, 164, 65, 0.35); color: var(--cream); }

/* ==========================================================================
   Floating embers — a handful of GPU-composited dots drifting upward
   ========================================================================== */
.qb-embers {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  overflow: hidden;
}
.qb-embers i {
  position: absolute;
  bottom: -3vh;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--gold-blaze) 0%, var(--ember) 45%, transparent 72%);
  opacity: 0;
  will-change: transform, opacity;
  animation: ember-rise 11s linear infinite;
}
.qb-embers i:nth-child(1)  { left: 6%;  animation-duration: 13s; animation-delay: 0s;   transform: scale(0.7); }
.qb-embers i:nth-child(2)  { left: 15%; animation-duration: 17s; animation-delay: 4s;   transform: scale(1.1); }
.qb-embers i:nth-child(3)  { left: 24%; animation-duration: 12s; animation-delay: 8s;   transform: scale(0.6); }
.qb-embers i:nth-child(4)  { left: 33%; animation-duration: 18s; animation-delay: 2s;   transform: scale(0.9); }
.qb-embers i:nth-child(5)  { left: 44%; animation-duration: 14s; animation-delay: 10s;  transform: scale(0.7); }
.qb-embers i:nth-child(6)  { left: 55%; animation-duration: 16s; animation-delay: 6s;   transform: scale(1.2); }
.qb-embers i:nth-child(7)  { left: 64%; animation-duration: 12.5s; animation-delay: 1s; transform: scale(0.8); }
.qb-embers i:nth-child(8)  { left: 73%; animation-duration: 19s; animation-delay: 9s;   transform: scale(0.6); }
.qb-embers i:nth-child(9)  { left: 84%; animation-duration: 15s; animation-delay: 3s;   transform: scale(1.0); }
.qb-embers i:nth-child(10) { left: 92%; animation-duration: 13.5s; animation-delay: 7s; transform: scale(0.75); }

@keyframes ember-rise {
  0%   { transform: translate3d(0, 0, 0);            opacity: 0; }
  8%   { opacity: 0.85; }
  55%  { opacity: 0.5; }
  100% { transform: translate3d(2.5rem, -108vh, 0);  opacity: 0; }
}

/* Everything real sits above the embers */
.qb-topbar, .qb-shell { position: relative; z-index: 2; }

/* ==========================================================================
   Top bar — carved tavern beam
   ========================================================================== */
.qb-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  background:
    var(--grain),
    linear-gradient(180deg, #2b1310 0%, #1d0c0a 100%);
  border-bottom: 1px solid var(--bronze-dark);
  box-shadow:
    inset 0 -2px 0 rgba(217, 164, 65, 0.25),
    0 6px 24px rgba(0, 0, 0, 0.6);
}

.qb-topbar-inner {
  max-width: 74rem;
  margin: 0 auto;
  padding: 0.7rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.qb-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--gold-bright);
  text-decoration: none;
  font-family: "Cinzel Decorative", "Cinzel", Georgia, serif;
  font-weight: 700;
  letter-spacing: 0.03em;
  font-size: 1.12rem;
  text-shadow: 0 0 18px rgba(255, 190, 80, 0.35), 0 2px 4px rgba(0, 0, 0, 0.8);
}

.qb-brand span.sub {
  font-family: "Alegreya", Georgia, serif;
  color: var(--cream-dim);
  font-weight: 500;
  font-style: italic;
  font-size: 0.85rem;
  letter-spacing: 0;
  text-shadow: none;
}

.qb-brand-icon {
  width: 2.35rem;
  height: 2.35rem;
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 28%, #ffe9ad, var(--gold) 55%, #8a5a28 100%);
  border: 1px solid var(--gold-bright);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  font-size: 1.15rem;
  box-shadow:
    0 0 14px var(--amber-glow),
    inset 0 -2px 4px rgba(90, 50, 10, 0.6);
  overflow: hidden;
}
.qb-brand-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.qb-nav {
  display: flex;
  gap: 0.3rem;
  flex-wrap: wrap;
  margin-left: auto;
}

.qb-nav a,
.qb-nav button.nav-link {
  appearance: none;
  border: 1px solid transparent;
  background: transparent;
  color: var(--cream-dim);
  font-family: "Cinzel", Georgia, serif;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 0.45rem 0.8rem;
  border-radius: 0.5rem;
  text-decoration: none;
  cursor: pointer;
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  transition: color 0.15s, background 0.15s, box-shadow 0.15s;
}

.qb-nav a:hover,
.qb-nav button.nav-link:hover {
  background: rgba(217, 164, 65, 0.1);
  color: var(--gold-bright);
}

.qb-nav a.active {
  background: linear-gradient(180deg, rgba(217, 164, 65, 0.22), rgba(217, 164, 65, 0.08));
  border-color: var(--gold-line);
  color: var(--gold-bright);
  box-shadow: inset 0 1px 0 rgba(255, 217, 122, 0.25), 0 0 12px rgba(255, 170, 60, 0.15);
}

/* ==========================================================================
   Shell, flash, footer
   ========================================================================== */
.qb-shell {
  max-width: 74rem;
  margin: 0 auto;
  padding: 0 1rem 3rem;
}

.qb-flash {
  margin: 1.1rem 0 0;
  padding: 0.8rem 1.2rem;
  border-radius: var(--radius);
  background: linear-gradient(135deg, var(--leather-800), var(--wine-800));
  border: 1px solid var(--gold-line);
  box-shadow: inset 0 1px 0 rgba(255, 217, 122, 0.15), 0 0 22px rgba(255, 170, 60, 0.12);
  color: var(--gold-bright);
  font-family: "Cinzel", Georgia, serif;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-align: center;
  animation: flash-in 0.5s ease-out both;
}
.qb-flash::before { content: "✦ "; color: var(--gold); }
.qb-flash::after  { content: " ✦"; color: var(--gold); }

@keyframes flash-in {
  0%   { opacity: 0; transform: translateY(-0.5rem); }
  60%  { opacity: 1; }
  100% { opacity: 1; transform: translateY(0); }
}

.qb-footer {
  margin-top: 3rem;
  text-align: center;
  font-style: italic;
  font-size: 0.78rem;
  color: var(--cream-faint);
}
.qb-footer::before {
  content: "";
  display: block;
  width: min(18rem, 60%);
  height: 1px;
  margin: 0 auto 0.8rem;
  background: linear-gradient(90deg, transparent, var(--gold-line), transparent);
}

/* ==========================================================================
   Section titles — gilded chapter headings with flanking rule-lines
   ========================================================================== */
.qb-section-title {
  font-family: "Cinzel", Georgia, serif;
  font-weight: 800;
  font-size: clamp(1.3rem, 2.6vw, 1.65rem);
  color: var(--gold-bright);
  letter-spacing: 0.06em;
  margin: 2rem 0 1rem;
  text-align: center;
  text-shadow: 0 0 22px rgba(255, 180, 70, 0.35), 0 2px 4px rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.9rem;
}
.qb-section-title {
  flex-wrap: wrap;
}
.qb-section-title::after {
  content: "";
  flex-basis: 100%;
  height: 1.15rem;
  margin-top: 0.45rem;
  background: url("/static/art/divider.png") center / auto 100% no-repeat;
  filter: drop-shadow(0 0 8px rgba(255, 170, 60, 0.3));
}

/* Blessings Awaiting — heading mounted on the hanging velvet banner */
#bless-title {
  width: min(30rem, 94%);
  aspect-ratio: 800 / 458;
  background: url("/static/art/banner.png") center / 100% 100% no-repeat;
  padding: 1.6rem 3.6rem 2.6rem;
  margin: 1.6rem auto 0.4rem;
  font-size: clamp(1.05rem, 2vw, 1.3rem);
  filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.4));
}
#bless-title::after { display: none; }

/* ==========================================================================
   Role picker — character select tokens
   ========================================================================== */
.qb-role-bar {
  margin: 1.4rem 0 1.2rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.qb-role-bar .label {
  color: var(--cream-dim);
  font-family: "Cinzel", Georgia, serif;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  width: 100%;
}

.qb-role-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  min-height: 3.1rem;
  padding: 0.45rem 1.15rem 0.45rem 0.55rem;
  border-radius: 999px;
  border: 2px solid var(--bronze-dark);
  background:
    var(--grain),
    linear-gradient(180deg, var(--leather-700), var(--leather-850));
  color: var(--cream);
  font-family: "Cinzel", Georgia, serif;
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: 0.03em;
  cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(243, 226, 192, 0.08), 0 3px 8px rgba(0, 0, 0, 0.45);
  transition: transform 0.12s, border-color 0.15s, box-shadow 0.2s, color 0.15s;
}

.qb-role-face {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--gold-dim);
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.55);
  flex: none;
}
.qb-role-btn.selected .qb-role-face {
  border-color: var(--gold-bright);
  box-shadow: 0 0 10px var(--amber-glow);
}

.qb-role-btn:hover { border-color: var(--gold-dim); }
.qb-role-btn:active { transform: scale(0.96); }
.qb-role-btn.selected {
  border-color: var(--gold);
  color: var(--gold-blaze);
  background:
    var(--grain),
    linear-gradient(180deg, #4d2a17, var(--leather-800));
  box-shadow:
    0 0 0 1px rgba(255, 217, 122, 0.35),
    0 0 18px var(--amber-glow),
    inset 0 1px 0 rgba(255, 217, 122, 0.2);
  animation: token-pop 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.qb-role-btn.elder-role.selected {
  box-shadow:
    0 0 0 1px rgba(255, 217, 122, 0.5),
    0 0 24px rgba(87, 192, 120, 0.35),
    0 0 18px var(--amber-glow);
}

@keyframes token-pop {
  0%   { transform: scale(0.92); }
  60%  { transform: scale(1.05); }
  100% { transform: scale(1); }
}

/* ==========================================================================
   Hoard strip — treasure ledgers with liquid-gold bars
   ========================================================================== */
.qb-hoard {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.9rem;
  margin-bottom: 1.4rem;
}

.qb-hoard-card {
  position: relative;
  background:
    var(--grain),
    linear-gradient(160deg, var(--leather-800), var(--leather-900));
  border: 1px solid var(--bronze);
  border-radius: var(--radius);
  padding: 0.95rem 1.1rem 0.95rem 4.6rem;
  color: var(--cream);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(243, 226, 192, 0.07),
    0 6px 18px rgba(0, 0, 0, 0.45);
}
.qb-hoard-card::before {
  content: "";
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(217, 164, 65, 0.22);
  border-radius: calc(var(--radius) - 3px);
  pointer-events: none;
}

.qb-hoard-face {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  width: 3.1rem;
  height: 3.1rem;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--gold-dim);
  box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.4), 0 0 10px rgba(0, 0, 0, 0.5);
}
.qb-hoard-pouch {
  position: absolute;
  right: 0.85rem;
  top: 0.8rem;
  width: 2.4rem;
  height: auto;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.5));
}

.qb-hoard-card .name {
  font-family: "Cinzel", Georgia, serif;
  font-weight: 700;
  font-size: 0.95rem;
  letter-spacing: 0.04em;
  color: var(--cream-dim);
}
.qb-hoard-card .amount {
  font-family: "Cinzel", Georgia, serif;
  font-size: 1.55rem;
  font-weight: 800;
  color: var(--gold-bright);
  margin-top: 0.25rem;
  text-shadow: 0 0 16px rgba(255, 180, 70, 0.35);
}
.qb-hoard-card .cap {
  font-size: 0.78rem;
  font-style: italic;
  color: var(--cream-faint);
  margin-top: 0.2rem;
}
.qb-hoard-card.over .amount { color: var(--gold-blaze); }
.qb-hoard-card .bar {
  height: 0.5rem;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(217, 164, 65, 0.25);
  border-radius: 99px;
  margin-top: 0.55rem;
  overflow: hidden;
}
.qb-hoard-card .bar > i {
  display: block;
  height: 100%;
  border-radius: 99px;
  max-width: 100%;
  background:
    linear-gradient(90deg, var(--gold-dim), var(--gold-bright) 55%, var(--gold-blaze));
  background-size: 200% 100%;
  box-shadow: 0 0 8px var(--amber-glow);
  animation: gold-flow 3.5s linear infinite;
}
@keyframes gold-flow {
  from { background-position: 0% 0; }
  to   { background-position: -200% 0; }
}

/* ==========================================================================
   Quest cards — engraved leather plaques with wax seals
   ========================================================================== */
.qb-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.15rem;
}
@media (min-width: 640px)  { .qb-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 980px)  { .qb-grid { grid-template-columns: repeat(3, 1fr); } }

.qb-card {
  position: relative;
  background:
    var(--grain),
    radial-gradient(ellipse 120% 90% at 50% -10%, rgba(255, 170, 60, 0.06), transparent 55%),
    linear-gradient(168deg, var(--leather-800) 0%, var(--leather-850) 55%, #241010 100%);
  border: 2px solid var(--bronze);
  border-radius: var(--radius);
  padding: 1.8rem 1.15rem 1.15rem;
  margin-top: 1.5rem; /* room for the seal to overhang */
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(243, 226, 192, 0.06),
    0 10px 26px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  color: var(--cream);
  transition: transform 0.18s ease, box-shadow 0.25s ease, border-color 0.2s;
}

/* inner gilded frame + corner stars */
.qb-card::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(217, 164, 65, 0.3);
  border-radius: calc(var(--radius) - 4px);
  pointer-events: none;
  background-image: var(--corner-star), var(--corner-star), var(--corner-star), var(--corner-star);
  background-repeat: no-repeat;
  background-size: 11px 11px;
  background-position: -5px -5px, calc(100% + 5px) -5px, -5px calc(100% + 5px), calc(100% + 5px) calc(100% + 5px);
}

@media (hover: hover) {
  .qb-card:hover {
    transform: translateY(-4px);
    border-color: var(--gold-dim);
    box-shadow:
      inset 0 0 0 1px rgba(0, 0, 0, 0.5),
      0 0 18px rgba(255, 170, 60, 0.18),
      0 16px 34px rgba(0, 0, 0, 0.55);
  }
}

/* Wax-seal medallion overhanging the top edge */
.qb-seal {
  position: absolute;
  top: -1.4rem;
  left: 50%;
  transform: translateX(-50%);
  width: 2.8rem;
  height: 2.8rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.05rem;
  background:
    radial-gradient(circle at 32% 28%, #5d2f22, var(--leather-850) 70%);
  border: 2px solid var(--bronze);
  box-shadow:
    0 0 0 3px var(--leather-900),
    0 0 0 4px rgba(217, 164, 65, 0.35),
    0 4px 10px rgba(0, 0, 0, 0.6);
  z-index: 1;
  overflow: hidden;
}
.qb-seal img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.qb-card.awaiting {
  border-color: var(--gold);
  background:
    var(--grain),
    radial-gradient(ellipse 130% 100% at 50% -10%, rgba(255, 180, 70, 0.16), transparent 60%),
    linear-gradient(168deg, #4a2413 0%, var(--leather-800) 60%, var(--leather-900) 100%);
  animation: blessing-pulse 2.6s ease-in-out infinite;
}
.qb-card.awaiting::before { border-color: rgba(255, 217, 122, 0.45); }
.qb-card.awaiting .qb-seal {
  border-color: var(--gold);
  background: radial-gradient(circle at 32% 28%, #ffdf96, var(--gold) 55%, #8a5a28 100%);
  box-shadow:
    0 0 0 3px var(--leather-900),
    0 0 0 4px rgba(255, 217, 122, 0.5),
    0 0 16px var(--amber-glow);
}

@keyframes blessing-pulse {
  0%, 100% {
    box-shadow:
      0 0 0 1px rgba(255, 217, 122, 0.35),
      0 0 20px rgba(255, 170, 60, 0.3),
      0 10px 26px rgba(0, 0, 0, 0.5);
  }
  50% {
    box-shadow:
      0 0 0 1px rgba(255, 217, 122, 0.55),
      0 0 36px rgba(255, 170, 60, 0.55),
      0 10px 26px rgba(0, 0, 0, 0.5);
  }
}

.qb-card.in-progress { border-color: #3f6484; }
.qb-card.in-progress::before { border-color: rgba(127, 178, 217, 0.3); }
.qb-card.in-progress .qb-seal { border-color: #3f6484; }

.qb-card-title {
  font-family: "Cinzel", Georgia, serif;
  font-size: 1.18rem;
  font-weight: 700;
  line-height: 1.28;
  letter-spacing: 0.02em;
  margin: 0;
  padding-right: 0.25rem;
  color: var(--gold-bright);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
}

.qb-card-desc {
  font-size: 0.95rem;
  color: var(--cream-dim);
  line-height: 1.45;
  margin: 0;
  flex: 1;
}

.qb-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  align-items: center;
}

/* —— Pills: engraved badges —— */
.qb-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--bronze-dark);
  color: var(--cream-dim);
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5);
}

.qb-pill.reward {
  background: linear-gradient(180deg, var(--gold-bright), var(--gold-dim));
  border-color: var(--gold);
  color: var(--ink);
  box-shadow: inset 0 1px 0 rgba(255, 236, 170, 0.7), 0 0 10px rgba(255, 170, 60, 0.25);
}
.qb-pill.freq { border-color: rgba(127, 178, 217, 0.35); color: var(--steel-blue); }
.qb-pill.status-available { border-color: rgba(87, 192, 120, 0.4); color: var(--quest-green); }
.qb-pill.status-in_progress { border-color: rgba(127, 178, 217, 0.45); color: var(--steel-blue); }
.qb-pill.status-awaiting_blessing {
  border-color: var(--gold);
  color: var(--gold-blaze);
  background: rgba(255, 170, 60, 0.12);
}

/* —— Submitter / reward plaques (blessing cards) —— */
.qb-submitter {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-top: 0.25rem;
}
.qb-submitter .box {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--gold-line);
  border-radius: 0.5rem;
  padding: 0.5rem 0.55rem;
  text-align: center;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
}
.qb-submitter .box .k {
  font-family: "Cinzel", Georgia, serif;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--cream-faint);
  font-weight: 700;
}
.qb-submitter .box .v {
  font-weight: 800;
  font-size: 1rem;
  margin-top: 0.15rem;
  color: var(--gold-bright);
}

/* ==========================================================================
   Buttons — gilded, embossed, with a light-sweep shimmer
   ========================================================================== */
.qb-btn {
  appearance: none;
  position: relative;
  overflow: hidden;
  border: 1px solid transparent;
  cursor: pointer;
  font-family: "Cinzel", Georgia, serif;
  font-weight: 700;
  font-size: 0.92rem;
  letter-spacing: 0.03em;
  min-height: 3rem;
  border-radius: 0.55rem;
  padding: 0.65rem 0.9rem;
  width: 100%;
  text-align: center;
  transition: transform 0.1s, filter 0.15s, box-shadow 0.2s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
}
.qb-btn:active { transform: scale(0.97); }
.qb-btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
@media (hover: hover) {
  .qb-btn:not(:disabled):hover { filter: brightness(1.08); }
}

/* light sweep across gold buttons */
.qb-btn-bless::after,
.qb-btn-gold::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -80%;
  width: 55%;
  background: linear-gradient(105deg, transparent, rgba(255, 250, 220, 0.55), transparent);
  transform: skewX(-20deg);
  animation: btn-sheen 4.5s ease-in-out infinite;
}
@keyframes btn-sheen {
  0%, 68% { left: -80%; }
  88%, 100% { left: 130%; }
}

.qb-btn-bless,
.qb-btn-gold {
  background: linear-gradient(180deg, #ffe19a 0%, var(--gold) 55%, #b07f2c 100%);
  color: var(--ink);
  border-color: #8a5a28;
  text-shadow: 0 1px 0 rgba(255, 240, 200, 0.6);
  box-shadow:
    inset 0 1px 0 rgba(255, 244, 210, 0.8),
    inset 0 -3px 6px rgba(120, 70, 15, 0.45),
    0 3px 0 #6b4a1c,
    0 0 16px rgba(255, 170, 60, 0.3);
}
.qb-btn-bless:not(:disabled):active,
.qb-btn-gold:not(:disabled):active {
  box-shadow:
    inset 0 1px 0 rgba(255, 244, 210, 0.8),
    inset 0 -2px 4px rgba(120, 70, 15, 0.45),
    0 1px 0 #6b4a1c;
}

.qb-btn-embark {
  background: linear-gradient(180deg, #3f9c62 0%, #2a7347 60%, #1c4a2e 100%);
  color: #eafff0;
  border-color: #1c4a2e;
  text-shadow: 0 1px 2px rgba(0, 40, 15, 0.6);
  box-shadow:
    inset 0 1px 0 rgba(180, 255, 205, 0.35),
    0 3px 0 #143622,
    0 0 14px rgba(87, 192, 120, 0.2);
}

.qb-btn-submit {
  background: linear-gradient(180deg, #4a86b8 0%, #35618c 60%, #1f3a52 100%);
  color: #eaf4ff;
  border-color: #1f3a52;
  text-shadow: 0 1px 2px rgba(0, 20, 40, 0.6);
  box-shadow:
    inset 0 1px 0 rgba(190, 225, 255, 0.35),
    0 3px 0 #16293a,
    0 0 14px rgba(127, 178, 217, 0.2);
}

.qb-btn-muted {
  background: linear-gradient(180deg, var(--leather-700), var(--leather-850));
  color: var(--cream-faint);
  border-color: var(--bronze-dark);
  box-shadow: inset 0 1px 0 rgba(243, 226, 192, 0.07);
}

.qb-btn-dark {
  background: linear-gradient(180deg, var(--leather-700), var(--leather-900));
  color: var(--cream);
  border-color: var(--bronze);
  box-shadow: inset 0 1px 0 rgba(243, 226, 192, 0.08), 0 2px 0 rgba(0, 0, 0, 0.5);
}

.qb-btn-danger {
  background: linear-gradient(180deg, #d96a24, #a34314 65%, #7c320f 100%);
  color: #fff3e8;
  border-color: #7c320f;
  text-shadow: 0 1px 2px rgba(60, 20, 0, 0.6);
  box-shadow: inset 0 1px 0 rgba(255, 200, 150, 0.35), 0 3px 0 #58230a;
}

.qb-empty {
  text-align: center;
  color: var(--cream-faint);
  padding: 1.5rem 1rem;
  font-style: italic;
  font-size: 0.95rem;
}

/* Sleeping dragon for peaceful empty states */
.qb-empty-art::before {
  content: "";
  display: block;
  width: 10rem;
  height: 7.6rem;
  margin: 0 auto 0.7rem;
  background: url("/static/art/dragon.png") center / contain no-repeat;
  filter: drop-shadow(0 0 16px rgba(255, 140, 50, 0.18));
}

/* ==========================================================================
   Sanctum — panels as carved chests
   ========================================================================== */
.qb-page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
}
.qb-page-head .qb-section-title { margin: 0; }
.qb-page-head .qb-section-title::after { display: none; }
.qb-page-head .qb-btn { width: auto; min-height: 2.75rem; padding: 0.5rem 1rem; font-size: 0.8rem; }

.qb-sanctum-grid {
  display: grid;
  gap: 1.25rem;
  margin-top: 1.1rem;
}
@media (min-width: 860px) {
  .qb-sanctum-grid {
    grid-template-columns: 1fr 1.15fr;
    align-items: start;
  }
}

.qb-panel {
  position: relative;
  background:
    var(--grain),
    radial-gradient(ellipse 120% 80% at 50% -10%, rgba(255, 170, 60, 0.07), transparent 55%),
    linear-gradient(165deg, var(--leather-800), var(--leather-900));
  border: 2px solid var(--bronze);
  border-radius: var(--radius);
  padding: 1.25rem;
  color: var(--cream);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(243, 226, 192, 0.06),
    0 10px 26px rgba(0, 0, 0, 0.5);
}
.qb-panel::before {
  content: "";
  position: absolute;
  inset: 6px;
  border: 1px solid rgba(217, 164, 65, 0.25);
  border-radius: calc(var(--radius) - 4px);
  pointer-events: none;
  background-image: var(--corner-star), var(--corner-star), var(--corner-star), var(--corner-star);
  background-repeat: no-repeat;
  background-size: 11px 11px;
  background-position: -5px -5px, calc(100% + 5px) -5px, -5px calc(100% + 5px), calc(100% + 5px) calc(100% + 5px);
}
.qb-panel > * { position: relative; }

.qb-panel h2 {
  font-family: "Cinzel", Georgia, serif;
  margin: 0 0 1rem;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--gold-bright);
  text-shadow: 0 0 16px rgba(255, 180, 70, 0.25), 0 1px 3px rgba(0, 0, 0, 0.7);
}

.qb-panel .muted-note { color: var(--cream-faint); font-size: 0.85rem; font-style: italic; }

/* legacy alias — dark panel is now the default look */
.qb-panel-dark h2 { color: var(--gold-bright); }

/* —— Form fields: engraved input slabs —— */
.qb-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  margin-bottom: 0.85rem;
}
.qb-field label {
  font-family: "Cinzel", Georgia, serif;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--cream-dim);
}
.qb-panel-dark .qb-field label { color: var(--cream-dim); }

.qb-field input,
.qb-field textarea,
.qb-field select {
  font: inherit;
  font-size: 1.02rem;
  padding: 0.65rem 0.8rem;
  min-height: 2.9rem;
  border-radius: 0.5rem;
  border: 1px solid var(--bronze-dark);
  background: rgba(0, 0, 0, 0.35);
  color: var(--cream);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.45);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.qb-field input::placeholder,
.qb-field textarea::placeholder { color: var(--cream-faint); opacity: 0.8; font-style: italic; }
.qb-field input:focus,
.qb-field textarea:focus,
.qb-field select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: inset 0 2px 5px rgba(0, 0, 0, 0.45), 0 0 0 2px rgba(255, 170, 60, 0.25);
}
.qb-field textarea { min-height: 5rem; resize: vertical; }

.qb-freq-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}
.qb-freq-row label.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.75rem;
  min-height: 2.75rem;
  border-radius: 0.5rem;
  border: 1px solid var(--bronze-dark);
  background: rgba(0, 0, 0, 0.3);
  color: var(--cream-dim);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, box-shadow 0.15s;
}
.qb-freq-row label.chip:hover { border-color: var(--gold-dim); }
.qb-freq-row label.chip:has(input:checked) {
  border-color: var(--gold);
  color: var(--gold-bright);
  box-shadow: 0 0 10px rgba(255, 170, 60, 0.2), inset 0 0 8px rgba(255, 170, 60, 0.08);
}
.qb-freq-row input {
  /* undo the engraved input-slab styling inherited from .qb-field input */
  appearance: auto;
  width: 1.1rem;
  height: 1.1rem;
  min-height: 0;
  padding: 0;
  margin: 0;
  background: none;
  border: none;
  box-shadow: none;
  accent-color: var(--gold);
}

/* —— Quest ledger rows —— */
.qb-quest-list {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.qb-quest-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem;
  padding: 0.65rem 0.75rem;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(217, 164, 65, 0.22);
  border-left: 3px solid var(--bronze);
  border-radius: 0.5rem;
  transition: border-color 0.15s, background 0.15s;
}
.qb-quest-row:hover { border-color: var(--gold-line); background: rgba(0, 0, 0, 0.4); }
.qb-quest-row .title {
  flex: 1 1 9rem;
  font-family: "Cinzel", Georgia, serif;
  font-weight: 700;
  font-size: 0.92rem;
  color: var(--cream);
}
.qb-quest-row .meta {
  font-size: 0.78rem;
  font-style: italic;
  color: var(--cream-faint);
  width: 100%;
}
.qb-quest-row form { display: inline; }
.qb-quest-row .mini {
  min-height: 2.5rem;
  padding: 0.35rem 0.65rem;
  font-size: 0.72rem;
  width: auto;
  border-radius: 0.4rem;
}

/* —— Young heroes list —— */
.qb-heroes-panel { margin-top: 1.25rem; }
.qb-heroes-list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.qb-heroes-list li {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: "Cinzel", Georgia, serif;
  font-weight: 700;
  padding: 0.4rem 0.95rem 0.4rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--bronze-dark);
  background: rgba(0, 0, 0, 0.3);
  color: var(--cream);
}
.qb-heroes-list img {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid var(--gold-dim);
}

/* ==========================================================================
   Login — the sanctum gate
   ========================================================================== */
.qb-login-wrap {
  max-width: 24rem;
  margin: 3.5rem auto;
}
.qb-login-wrap .qb-panel { text-align: center; }
.qb-login-crest {
  display: block;
  width: 6rem;
  height: 6rem;
  margin: 0.25rem auto 0.85rem;
  filter: drop-shadow(0 0 20px rgba(255, 170, 60, 0.35));
}
.qb-login-wrap .qb-field input {
  text-align: center;
  font-family: "Cinzel", Georgia, serif;
  font-size: 1.4rem;
  letter-spacing: 0.5em;
  font-weight: 700;
}
.qb-login-note { margin: 0 0 1rem; color: var(--cream-dim); font-size: 0.92rem; }
.qb-login-back { margin: 1.1rem 0 0; text-align: center; }
.qb-login-back a { color: var(--cream-faint); text-decoration: none; }
.qb-login-back a:hover { color: var(--gold-bright); }

.hidden { display: none !important; }

/* ==========================================================================
   Edit modal — leather scroll
   ========================================================================== */
.qb-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(12, 5, 4, 0.8);
  backdrop-filter: blur(2px);
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.qb-modal {
  width: 100%;
  max-width: 26rem;
  background:
    var(--grain),
    linear-gradient(165deg, var(--leather-800), var(--leather-900));
  border: 2px solid var(--gold-dim);
  border-radius: var(--radius);
  padding: 1.25rem;
  max-height: 90vh;
  overflow: auto;
  color: var(--cream);
  box-shadow: 0 0 40px rgba(255, 170, 60, 0.15), 0 20px 60px rgba(0, 0, 0, 0.7);
  animation: modal-in 0.25s cubic-bezier(0.34, 1.4, 0.64, 1) both;
}
.qb-modal h2 {
  font-family: "Cinzel", Georgia, serif;
  color: var(--gold-bright);
  margin: 0 0 0.85rem;
}
@keyframes modal-in {
  from { opacity: 0; transform: scale(0.94) translateY(0.6rem); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.qb-modal-actions { display: flex; gap: 0.5rem; }

/* ==========================================================================
   Accessibility — honor reduced motion
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  .qb-embers { display: none; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
