@import url('https://fonts.googleapis.com/css2?family=MedievalSharp&family=Cinzel:wght@400;600;700;900&family=Crimson+Text:ital,wght@0,400;0,600;1,400&display=swap');

:root {
  --parchment: #f8f0dc;
  --parchment-dark: #edd9ac;
  --parchment-shadow: #d4b47a;
  --ink: #2a1a0e;
  --ink-light: #4a2f1a;
  --blood: #8b1a1a;
  --blood-bright: #e04030;
  --gold: #d4a832;
  --gold-bright: #f5c518;
  --stone: #6a6a7e;
  --stone-dark: #2c2c3e;
  --stone-light: #b0b0c4;
  --torch: #ff6b1a;
  --torch-glow: rgba(255, 107, 26, 0.3);
  --shadow: rgba(0,0,0,0.7);
  --emerald: #1a6b3a;
  --emerald-bright: #2ecc71;
}

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

body {
  background-color: #1a1520;
  background-image: 
    radial-gradient(ellipse at 20% 20%, rgba(139, 26, 26, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(42, 26, 14, 0.15) 0%, transparent 50%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='100' height='100'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  color: var(--parchment);
  font-family: 'Crimson Text', serif;
  font-size: 17px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* NAV */
nav {
  background: linear-gradient(180deg, #0d0a10 0%, #1a1520 100%);
  border-bottom: 2px solid var(--gold);
  padding: 0 2rem;
  display: flex;
  align-items: center;
  gap: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 20px rgba(201, 162, 39, 0.2);
}

nav .nav-brand {
  font-family: 'Cinzel', serif;
  font-weight: 900;
  font-size: 1.3rem;
  color: var(--gold);
  text-decoration: none;
  padding: 1rem 1.5rem 1rem 0;
  margin-right: 1rem;
  border-right: 1px solid rgba(201,162,39,0.3);
  text-shadow: 0 0 20px rgba(201,162,39,0.5);
  letter-spacing: 0.1em;
}

nav a {
  color: #d8d0e8;
  text-decoration: none;
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  padding: 1.1rem 1.2rem;
  transition: all 0.2s;
  border-bottom: 3px solid transparent;
  text-transform: uppercase;
}

nav a:hover, nav a.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
  background: rgba(201,162,39,0.05);
}

/* FOOTER */
footer {
  background: linear-gradient(180deg, #1a1520 0%, #0d0a10 100%);
  border-top: 2px solid var(--gold);
  padding: 1.2rem 2rem;
  text-align: center;
  font-family: 'Crimson Text', serif;
  font-size: 0.95rem;
  color: #b0b0c4;
  margin-top: auto;
}

footer .copyright {
  color: #b0b0c4;
  text-decoration: none;
  cursor: default;
  transition: color 0.3s;
}
footer .copyright:hover { color: var(--gold); }

/* BUTTONS */
.btn {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 0.6rem 1.4rem;
  border: 2px solid var(--gold);
  background: transparent;
  color: var(--gold);
  cursor: pointer;
  transition: all 0.2s;
  clip-path: polygon(8px 0%, 100% 0%, calc(100% - 8px) 100%, 0% 100%);
}
.btn:hover {
  background: var(--gold);
  color: var(--ink);
}
.btn-danger {
  border-color: var(--blood-bright);
  color: var(--blood-bright);
}
.btn-danger:hover {
  background: var(--blood-bright);
  color: white;
}
.btn-success {
  border-color: var(--emerald-bright);
  color: var(--emerald-bright);
}
.btn-success:hover {
  background: var(--emerald-bright);
  color: white;
}
.btn-sm {
  font-size: 0.72rem;
  padding: 0.4rem 0.9rem;
}

/* PANELS */
.panel {
  background: linear-gradient(135deg, rgba(30,24,40,0.95), rgba(20,16,28,0.98));
  border: 1px solid rgba(201,162,39,0.3);
  border-radius: 2px;
  padding: 1.5rem;
  box-shadow: 0 4px 24px rgba(0,0,0,0.5), inset 0 1px 0 rgba(201,162,39,0.1);
}

.panel-title {
  font-family: 'Cinzel', serif;
  font-size: 1rem;
  color: var(--gold);
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(201,162,39,0.3);
}

/* INPUTS */
input, select, textarea {
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(212,168,50,0.35);
  color: #f8f0dc;
  font-family: 'Crimson Text', serif;
  font-size: 1rem;
  padding: 0.5rem 0.75rem;
  border-radius: 2px;
  outline: none;
  width: 100%;
  transition: border-color 0.2s;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--gold);
}
select option { background: #1a1520; color: #f8f0dc; }
label {
  font-family: 'Cinzel', serif;
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  color: #b0b0c4;
  text-transform: uppercase;
  display: block;
  margin-bottom: 0.3rem;
}

/* MODAL */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(4px);
}
.modal-box {
  background: linear-gradient(135deg, #1e1828, #14101c);
  border: 2px solid var(--gold);
  padding: 2.5rem;
  max-width: 480px;
  width: 90%;
  text-align: center;
  box-shadow: 0 0 60px rgba(201,162,39,0.3);
  position: relative;
}
.modal-box h2 {
  font-family: 'Cinzel', serif;
  font-size: 1.8rem;
  color: var(--gold);
  margin-bottom: 1rem;
}
.modal-box p { font-size: 1.1rem; margin-bottom: 1.5rem; line-height: 1.6; color: #f0e8d0; }

/* DICE */
.dice-display {
  font-size: 2.5rem;
  line-height: 1;
  display: inline-block;
  transition: transform 0.1s;
}
.dice-display.rolling {
  animation: diceRoll 0.6s ease-out;
}
@keyframes diceRoll {
  0% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(90deg) scale(1.2); }
  50% { transform: rotate(180deg) scale(0.9); }
  75% { transform: rotate(270deg) scale(1.1); }
  100% { transform: rotate(360deg) scale(1); }
}

/* SCROLLBAR */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: #0d0a10; }
::-webkit-scrollbar-thumb { background: var(--gold); border-radius: 4px; }

/* TORCH FLICKER */
@keyframes torchFlicker {
  0%, 100% { opacity: 1; text-shadow: 0 0 10px var(--torch), 0 0 30px rgba(255,107,26,0.4); }
  50% { opacity: 0.9; text-shadow: 0 0 6px var(--torch), 0 0 20px rgba(255,107,26,0.2); }
}

/* FADE IN */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.fade-in { animation: fadeIn 0.4s ease-out forwards; }

/* HP BAR */
.hp-bar-bg {
  height: 10px;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(201,162,39,0.2);
  border-radius: 2px;
  overflow: hidden;
}
.hp-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--blood), var(--blood-bright));
  transition: width 0.5s ease;
}

/* TAG */
.tag {
  display: inline-block;
  font-family: 'Cinzel', serif;
  font-size: 0.65rem;
  letter-spacing: 0.1em;
  padding: 0.2rem 0.6rem;
  border: 1px solid currentColor;
  border-radius: 2px;
  text-transform: uppercase;
}
.tag-gold { color: var(--gold); }
.tag-blood { color: var(--blood-bright); }
.tag-emerald { color: var(--emerald-bright); }

/* DIVIDER */
.divider {
  border: none;
  border-top: 1px solid rgba(201,162,39,0.2);
  margin: 1rem 0;
}
