/* THE LIVERAMP CRYPTS - parchment + sword-and-sorcery styling.
   Self-contained. No build step. Placeholder art is CSS/SVG.
*/

:root {
  --parchment: #efe4c8;
  --parchment-dark: #d9c8a0;
  --parchment-shadow: rgba(80, 50, 20, 0.25);
  --ink: #2b1d0e;
  --ink-soft: #5a4220;
  --blood: #8c1f1f;
  --moss: #3d5a2a;
  --gold: #b78a2e;
  --rune: #3a4a7a;
  --bone: #f3ecd9;
  --shadow-deep: rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background: #1b1208;
  color: var(--ink);
  font-family: "IM Fell English", "EB Garamond", Georgia, serif;
  font-size: 17px;
  line-height: 1.5;
}

body {
  background:
    radial-gradient(circle at 20% 20%, rgba(255, 200, 120, 0.05), transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(255, 200, 120, 0.05), transparent 50%),
    linear-gradient(180deg, #1b1208 0%, #0d0805 100%);
  background-attachment: fixed;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem 4rem;
}

h1, h2, h3, .display {
  font-family: "Cinzel", "Trajan Pro", Georgia, serif;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--ink);
  margin: 0 0 0.5rem;
}

h1 { font-size: 2.4rem; text-align: center; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.2rem; }

/* ---------- Parchment frame ---------- */

.parchment {
  background: var(--parchment);
  background-image:
    radial-gradient(circle at 12% 8%, rgba(0, 0, 0, 0.05) 0%, transparent 30%),
    radial-gradient(circle at 88% 20%, rgba(0, 0, 0, 0.04) 0%, transparent 30%),
    radial-gradient(circle at 30% 90%, rgba(0, 0, 0, 0.05) 0%, transparent 30%),
    radial-gradient(circle at 75% 75%, rgba(0, 0, 0, 0.06) 0%, transparent 35%),
    linear-gradient(135deg, var(--parchment) 0%, var(--parchment-dark) 100%);
  border: 1px solid rgba(80, 50, 20, 0.4);
  border-radius: 4px;
  box-shadow:
    0 0 0 6px rgba(60, 40, 20, 0.15),
    0 0 0 7px rgba(0, 0, 0, 0.5),
    0 12px 30px var(--shadow-deep),
    inset 0 0 60px rgba(120, 80, 30, 0.18);
  padding: 2rem 2.25rem;
  position: relative;
  width: min(960px, 100%);
}

.parchment::before, .parchment::after {
  /* burnt-corner illusion */
  content: "";
  position: absolute;
  width: 60px;
  height: 60px;
  background:
    radial-gradient(circle at 0% 0%, rgba(40, 20, 5, 0.6) 0%, transparent 70%);
  pointer-events: none;
}
.parchment::before { top: 0; left: 0; }
.parchment::after  { bottom: 0; right: 0; transform: rotate(180deg); }

/* ---------- Title screen ---------- */

#screen-title { text-align: center; }

.title-banner {
  font-family: "Cinzel", serif;
  font-size: 3rem;
  letter-spacing: 0.12em;
  margin-bottom: 0.25rem;
  text-shadow: 2px 2px 0 rgba(80, 50, 20, 0.2);
}

.title-subline {
  font-style: italic;
  color: var(--ink-soft);
  margin-bottom: 1.5rem;
}

.title-seal {
  /* CSS-only "d20" seal as placeholder for a title illustration. */
  width: 140px;
  height: 140px;
  margin: 1rem auto 1.5rem;
  background:
    radial-gradient(circle at 50% 40%, var(--gold) 0%, #6b4f15 60%, #2b1d0e 100%);
  border-radius: 50%;
  border: 4px double rgba(40, 20, 5, 0.7);
  position: relative;
  display: flex; align-items: center; justify-content: center;
  font-family: "Cinzel", serif; font-size: 2.4rem; color: var(--bone);
  text-shadow: 0 2px 4px black;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.6), 0 4px 10px var(--shadow-deep);
}
.title-seal::after { content: "d20"; }

.name-row {
  display: flex; gap: 0.75rem; justify-content: center;
  margin: 1rem 0 1.5rem; flex-wrap: wrap;
}

input[type="text"] {
  font-family: inherit; font-size: 1.1rem;
  padding: 0.6rem 0.9rem;
  background: var(--bone);
  border: 1px solid rgba(40, 20, 5, 0.5);
  border-radius: 3px;
  color: var(--ink);
  min-width: 240px;
}
input[type="text"]:focus { outline: 2px solid var(--gold); outline-offset: 1px; }

.btn {
  font-family: "Cinzel", serif;
  font-size: 1rem;
  letter-spacing: 0.08em;
  padding: 0.65rem 1.4rem;
  background: linear-gradient(180deg, #5a3a18 0%, #3a230a 100%);
  color: var(--bone);
  border: 1px solid rgba(0, 0, 0, 0.6);
  border-radius: 3px;
  cursor: pointer;
  text-transform: uppercase;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 3px 0 rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.15); }
.btn:active { transform: translateY(1px); box-shadow: 0 0 0 rgba(0, 0, 0, 0.4); }
.btn:focus { outline: 2px solid var(--gold); outline-offset: 2px; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn-ghost:hover { background: rgba(0, 0, 0, 0.05); }
.btn-danger { background: linear-gradient(180deg, var(--blood) 0%, #4a0e0e 100%); }

.lore {
  text-align: left;
  background: rgba(255, 245, 220, 0.4);
  border-left: 4px solid var(--ink-soft);
  padding: 0.75rem 1rem;
  margin: 1rem auto 0;
  max-width: 640px;
  font-style: italic;
  color: var(--ink-soft);
}

.resume-banner {
  background: rgba(60, 40, 10, 0.15);
  border: 1px dashed rgba(60, 40, 10, 0.5);
  padding: 0.75rem 1rem;
  margin: 1rem auto;
  max-width: 640px;
  border-radius: 3px;
  display: flex; gap: 1rem; align-items: center; justify-content: center; flex-wrap: wrap;
}

/* ---------- Game screen ---------- */

#screen-game .game-grid {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 1.25rem;
  align-items: start;
}

@media (max-width: 800px) {
  #screen-game .game-grid { grid-template-columns: 1fr; }
}

.level-banner {
  grid-column: 1 / -1;
  font-family: "Cinzel", serif;
  font-size: 1rem;
  letter-spacing: 0.06em;
  padding: 0.6rem 1rem;
  background: linear-gradient(90deg, rgba(60, 40, 10, 0.2), rgba(60, 40, 10, 0.05));
  border-left: 4px solid var(--gold);
  border-right: 4px solid var(--gold);
}

.panel {
  background: rgba(255, 245, 220, 0.55);
  border: 1px solid rgba(60, 40, 10, 0.3);
  border-radius: 3px;
  padding: 1rem 1.1rem;
}

/* Character sheet */
.panel-sheet h3 { border-bottom: 1px dashed rgba(60, 40, 10, 0.4); padding-bottom: 0.3rem; }
.sheet-row { display: flex; justify-content: space-between; margin: 0.3rem 0; font-size: 0.95rem; }
.sheet-row .k { color: var(--ink-soft); }
.sheet-row .v { font-weight: 600; }

.hp-bar {
  height: 14px;
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(60, 40, 10, 0.5);
  border-radius: 7px;
  overflow: hidden;
  margin: 0.4rem 0 0.8rem;
}
.hp-fill {
  height: 100%;
  background: linear-gradient(90deg, #6a1818 0%, #b73030 100%);
  transition: width 0.3s ease;
}

.shake { animation: shake 0.36s cubic-bezier(.36,.07,.19,.97) both; }
@keyframes shake {
  10%, 90% { transform: translate3d(-1px, 0, 0); }
  20%, 80% { transform: translate3d(2px, 0, 0); }
  30%, 50%, 70% { transform: translate3d(-4px, 0, 0); }
  40%, 60% { transform: translate3d(4px, 0, 0); }
}

/* Encounter panel */

.panel-encounter { max-height: 80vh; overflow-y: auto; }
.encounter-meta {
  font-size: 0.78rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: 0.5rem;
}
.encounter-title { margin-bottom: 0.4rem; }
.encounter-level { color: var(--ink-soft); font-style: italic; margin-bottom: 0.75rem; font-size: 0.9rem; }

.encounter-body {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 1rem;
}

@media (max-width: 600px) {
  .encounter-body { grid-template-columns: 1fr; }
}

.encounter-narration {
  background: rgba(60, 40, 10, 0.07);
  border-left: 3px solid var(--ink-soft);
  padding: 0.6rem 0.8rem;
  font-style: italic;
  margin-bottom: 0.8rem;
}

.encounter-prompt {
  background: rgba(255, 255, 255, 0.5);
  padding: 0.8rem 1rem;
  border: 1px solid rgba(60, 40, 10, 0.25);
  border-radius: 3px;
  margin-bottom: 0.8rem;
  white-space: pre-wrap;
}

.options-grid { display: grid; gap: 0.5rem; }

.option-btn {
  display: flex; align-items: flex-start; gap: 0.8rem;
  background: var(--bone);
  border: 1px solid rgba(60, 40, 10, 0.4);
  border-left: 4px solid var(--ink-soft);
  padding: 0.7rem 0.9rem;
  text-align: left;
  font: inherit;
  color: var(--ink);
  cursor: pointer;
  border-radius: 2px;
  transition: background 0.12s ease, transform 0.08s ease;
}
.option-btn:hover:not(:disabled) { background: #fff8e3; transform: translateX(2px); }
.option-btn:focus { outline: 2px solid var(--gold); outline-offset: 2px; }
.option-btn:disabled { cursor: default; opacity: 0.85; }

.option-letter {
  font-family: "Cinzel", serif;
  font-weight: 700;
  background: var(--ink);
  color: var(--bone);
  width: 1.8rem; height: 1.8rem;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  flex: 0 0 auto;
}
.option-correct { background: rgba(80, 130, 60, 0.25); border-left-color: var(--moss); }
.option-correct .option-letter { background: var(--moss); }
.option-wrong { background: rgba(140, 31, 31, 0.18); border-left-color: var(--blood); }
.option-wrong .option-letter { background: var(--blood); }

.encounter-feedback {
  margin-top: 0.9rem;
  padding: 0.8rem 1rem;
  border-radius: 3px;
  border: 1px solid;
}
.feedback-right { background: rgba(80, 130, 60, 0.15); border-color: var(--moss); }
.feedback-wrong { background: rgba(140, 31, 31, 0.12); border-color: var(--blood); }
.reward { font-weight: 700; margin-left: 0.4rem; color: var(--moss); }
.reward.damage { color: var(--blood); }
.rationale {
  margin-top: 0.5rem; padding-top: 0.5rem;
  border-top: 1px dashed rgba(60, 40, 10, 0.4);
  font-style: italic; color: var(--ink-soft); white-space: pre-wrap;
  font-size: 0.94rem;
}

.encounter-next-row { margin-top: 1rem; text-align: right; }

/* ---------- Monster portrait placeholders (CSS art) ---------- */

.monster {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 3px;
  background-color: #2a1d0a;
  background-image:
    radial-gradient(circle at 50% 35%, rgba(255, 255, 255, 0.08), transparent 60%),
    repeating-linear-gradient(45deg, rgba(0, 0, 0, 0.1) 0 4px, transparent 4px 8px);
  border: 1px solid rgba(0, 0, 0, 0.6);
  box-shadow: inset 0 0 30px rgba(0, 0, 0, 0.7);
  position: relative;
  overflow: hidden;
}
.monster::before {
  content: ""; position: absolute; inset: 12% 18% 30% 18%;
  border-radius: 45% 45% 35% 35% / 55% 55% 45% 45%;
  background: radial-gradient(circle at 35% 35%, #6b4f15 0%, #2b1d0e 70%);
}
.monster::after {
  content: ""; position: absolute;
  left: 28%; right: 28%; top: 30%;
  height: 14%;
  background:
    radial-gradient(ellipse at 25% 50%, var(--gold) 0%, transparent 35%),
    radial-gradient(ellipse at 75% 50%, var(--gold) 0%, transparent 35%);
}
.monster-boss {
  background-color: #1a0808;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.9), 0 0 24px rgba(140, 31, 31, 0.4);
}
.monster-boss::before { background: radial-gradient(circle at 50% 30%, #8c1f1f 0%, #1a0808 70%); }
.monster-boss::after {
  background:
    radial-gradient(ellipse at 25% 50%, var(--blood) 0%, transparent 35%),
    radial-gradient(ellipse at 75% 50%, var(--blood) 0%, transparent 35%);
}

/* Per-slug accents so the 9 reusable monsters feel different at a glance. */
.monster-goblin-scribe::before { background: radial-gradient(circle at 35% 35%, #4d6a25 0%, #1a2a08 70%); }
.monster-slime-archivist::before { background: radial-gradient(circle at 35% 35%, #2a6a55 0%, #062520 70%); border-radius: 50%; }
.monster-imp-apprentice::before { background: radial-gradient(circle at 35% 35%, #7a2a55 0%, #2a0820 70%); }
.monster-kobold-loremaster::before { background: radial-gradient(circle at 35% 35%, #8a5a1a 0%, #2a1808 70%); }
.monster-owlbear-cataloger::before { background: radial-gradient(circle at 35% 35%, #b78a2e 0%, #2a1808 70%); border-radius: 35% 35% 50% 50%; }
.monster-shade-tinker::before { background: radial-gradient(circle at 35% 35%, #444 0%, #0a0a0a 70%); }
.monster-wraith-of-definitions::before { background: radial-gradient(circle at 35% 35%, #cdd 0%, #234 70%); border-radius: 50% 50% 30% 30%; }
.monster-doppelganger::before { background: radial-gradient(circle at 35% 35%, #efe4c8 0%, #555 70%); }
.monster-stone-golem::before { background: radial-gradient(circle at 35% 35%, #999 0%, #333 70%); border-radius: 8%; }
.monster-boss-omniseer::before { background: radial-gradient(circle at 50% 30%, var(--gold) 0%, #1a0808 70%); }
.monster-boss-librarian::before { background: radial-gradient(circle at 50% 30%, #b78a2e 0%, #1a0808 70%); border-radius: 8%; }
.monster-boss-architect::before { background: radial-gradient(circle at 50% 30%, #6b4f15 0%, #1a0808 70%); }
.monster-boss-lich::before { background: radial-gradient(circle at 50% 30%, #cdd 0%, #1a0808 70%); }
.monster-boss-agent-king::before { background: radial-gradient(circle at 50% 30%, var(--rune) 0%, #1a0808 70%); }
.monster-boss-judge::before { background: radial-gradient(circle at 50% 30%, #222 0%, #000 70%); }
.monster-boss-executive::before { background: radial-gradient(circle at 50% 30%, #aaa 0%, #1a0808 70%); border-radius: 8%; }

/* ---------- End screen ---------- */

#screen-end .end-headline {
  text-align: center;
  font-family: "Cinzel", serif;
  font-size: 2rem;
  margin-bottom: 0.5rem;
}
.end-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin: 1rem 0 1.5rem;
}
.end-summary .stat {
  background: rgba(60, 40, 10, 0.08);
  padding: 0.7rem;
  text-align: center;
  border: 1px solid rgba(60, 40, 10, 0.25);
}
.end-summary .stat .k {
  font-family: "Cinzel", serif;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink-soft);
}
.end-summary .stat .v {
  font-size: 1.4rem;
  font-weight: 700;
}

.end-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}
@media (max-width: 720px) { .end-cols { grid-template-columns: 1fr; } }
.end-cols h3 { font-family: "Cinzel", serif; }
.end-cols ul { padding-left: 1.1rem; margin: 0.3rem 0 0; }

.end-actions { margin-top: 1.5rem; display: flex; gap: 0.6rem; flex-wrap: wrap; justify-content: center; }

.footer-note {
  margin-top: 2rem;
  font-size: 0.78rem;
  color: rgba(255, 245, 220, 0.55);
  text-align: center;
  max-width: 720px;
}
.footer-note a { color: rgba(255, 245, 220, 0.85); }

/* ----- AI-generated boss portraits (drop-in from ART.md generation) ----- */
.monster.monster-boss-omniseer,
.monster.monster-boss-librarian,
.monster.monster-boss-architect,
.monster.monster-boss-lich,
.monster.monster-boss-agent-king,
.monster.monster-boss-judge,
.monster.monster-boss-executive {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}
.monster.monster-boss-omniseer  { background-image: url("../img/boss-omniseer.png"); }
.monster.monster-boss-librarian { background-image: url("../img/boss-librarian.png"); }
.monster.monster-boss-architect { background-image: url("../img/boss-architect.png"); }
.monster.monster-boss-lich      { background-image: url("../img/boss-lich.png"); }
.monster.monster-boss-agent-king{ background-image: url("../img/boss-agent-king.png"); }
.monster.monster-boss-judge     { background-image: url("../img/boss-judge.png"); }
.monster.monster-boss-executive { background-image: url("../img/boss-executive.png"); }
/* Hide the CSS-drawn placeholder shapes when a real PNG is loaded */
.monster.monster-boss-omniseer::before,  .monster.monster-boss-omniseer::after,
.monster.monster-boss-librarian::before, .monster.monster-boss-librarian::after,
.monster.monster-boss-architect::before, .monster.monster-boss-architect::after,
.monster.monster-boss-lich::before,      .monster.monster-boss-lich::after,
.monster.monster-boss-agent-king::before,.monster.monster-boss-agent-king::after,
.monster.monster-boss-judge::before,     .monster.monster-boss-judge::after,
.monster.monster-boss-executive::before, .monster.monster-boss-executive::after {
  display: none;
}
