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

:root {
  --bg-deep: #0a0a0f;
  --bg-mid: #12121f;
  --gold: #c8a84e;
  --gold-dim: #8a6f2e;
  --blood: #8b1a1a;
  --frost: #a8d5e2;
  --text: #d4cbb8;
  --text-dim: #7a7468;
  --ember: #e85d26;
  --shadow: #1a1a2e;
}

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

body {
  background: var(--bg-deep);
  color: var(--text);
  font-family: 'Crimson Text', Georgia, serif;
  min-height: 100vh;
  overflow-x: hidden;
}

.screen { display: none; min-height: 100vh; }
.screen.active { display: flex; }

/* ===== TITLE SCREEN ===== */
#title-screen {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: 
    radial-gradient(ellipse at 50% 0%, rgba(200,168,78,0.08) 0%, transparent 60%),
    radial-gradient(ellipse at 50% 100%, rgba(139,26,26,0.1) 0%, transparent 60%),
    var(--bg-deep);
  position: relative;
  overflow: hidden;
}

.title-content {
  text-align: center;
  z-index: 2;
  animation: fadeIn 2s ease;
}

.rune-border {
  font-size: 1.2rem;
  letter-spacing: 0.5rem;
  color: var(--gold-dim);
  opacity: 0.6;
  margin: 1rem 0;
  animation: runeGlow 4s ease-in-out infinite;
}

.title-glow {
  font-family: 'Cinzel', serif;
  font-size: clamp(3rem, 8vw, 6rem);
  font-weight: 900;
  color: var(--gold);
  text-shadow: 
    0 0 20px rgba(200,168,78,0.4),
    0 0 60px rgba(200,168,78,0.15),
    0 4px 8px rgba(0,0,0,0.8);
  letter-spacing: 0.3em;
  margin: 0.5rem 0;
}

.subtitle {
  font-family: 'Cinzel', serif;
  font-size: 1.2rem;
  color: var(--text-dim);
  letter-spacing: 0.2em;
  margin-bottom: 1rem;
}

.title-buttons {
  margin: 2rem 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  align-items: center;
}

.hint {
  font-style: italic;
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-top: 1rem;
}

/* Floating runes background */
.floating-runes {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.floating-rune {
  position: absolute;
  color: var(--gold-dim);
  opacity: 0.1;
  font-size: 2rem;
  animation: float linear infinite;
}

@keyframes float {
  0% { transform: translateY(100vh) rotate(0deg); opacity: 0; }
  10% { opacity: 0.1; }
  90% { opacity: 0.1; }
  100% { transform: translateY(-10vh) rotate(360deg); opacity: 0; }
}

/* ===== BUTTONS ===== */
.btn-rune {
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  padding: 0.8rem 2rem;
  background: linear-gradient(135deg, var(--gold-dim), var(--gold));
  color: var(--bg-deep);
  border: 2px solid var(--gold);
  cursor: pointer;
  letter-spacing: 0.1em;
  transition: all 0.3s;
  min-width: 260px;
}

.btn-rune:hover {
  background: var(--gold);
  box-shadow: 0 0 20px rgba(200,168,78,0.4);
  transform: translateY(-2px);
}

.btn-secondary {
  background: transparent;
  color: var(--gold);
}

.btn-secondary:hover {
  background: rgba(200,168,78,0.1);
}

.btn-combat {
  background: linear-gradient(135deg, var(--blood), #c0392b);
  border-color: var(--ember);
  color: #fff;
  font-size: 1.2rem;
  animation: combatPulse 2s ease-in-out infinite;
}

.btn-combat:hover {
  background: var(--ember);
  box-shadow: 0 0 30px rgba(232,93,38,0.5);
}

.btn-small {
  font-family: 'Cinzel', serif;
  font-size: 0.8rem;
  padding: 0.4rem 0.8rem;
  background: transparent;
  color: var(--text-dim);
  border: 1px solid var(--text-dim);
  cursor: pointer;
  transition: all 0.3s;
}

.btn-small:hover {
  color: var(--gold);
  border-color: var(--gold);
}

/* ===== GAME SCREEN ===== */
#game-screen {
  flex-direction: column;
  padding: 1rem;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
  background: 
    radial-gradient(ellipse at 50% 30%, rgba(200,168,78,0.03) 0%, transparent 50%),
    var(--bg-deep);
  position: relative;
}

#realm-indicator {
  text-align: center;
  padding: 0.5rem;
  font-family: 'Cinzel', serif;
  color: var(--gold);
  font-size: 1.1rem;
  letter-spacing: 0.15em;
  border-bottom: 1px solid rgba(200,168,78,0.2);
  margin-bottom: 0.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

#stats-bar {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  padding: 0.5rem;
  margin-bottom: 1rem;
}

.stat {
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.stat-icon { font-size: 1.1rem; }

#story-container {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  background: rgba(18,18,31,0.6);
  border: 1px solid rgba(200,168,78,0.1);
  border-radius: 4px;
  margin-bottom: 1rem;
  min-height: 300px;
  max-height: 50vh;
  line-height: 1.8;
  font-size: 1.15rem;
}

#story-text .paragraph {
  margin-bottom: 1rem;
  opacity: 0;
  animation: textAppear 0.5s ease forwards;
}

#story-text .paragraph.narrator {
  color: var(--text);
}

#story-text .paragraph.dialogue {
  color: var(--frost);
  font-style: italic;
  padding-left: 1rem;
  border-left: 2px solid var(--frost);
}

#story-text .paragraph.dramatic {
  color: var(--gold);
  font-family: 'Cinzel', serif;
  text-align: center;
  font-size: 1.3rem;
  margin: 1.5rem 0;
}

#story-text .paragraph.combat-text {
  color: var(--ember);
  font-weight: 600;
}

@keyframes textAppear {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== CHOICES ===== */
#choices-container {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.choice-btn {
  font-family: 'Crimson Text', serif;
  font-size: 1.1rem;
  padding: 0.8rem 1.2rem;
  background: rgba(200,168,78,0.05);
  color: var(--text);
  border: 1px solid rgba(200,168,78,0.2);
  cursor: pointer;
  text-align: left;
  transition: all 0.3s;
  line-height: 1.4;
}

.choice-btn:hover {
  background: rgba(200,168,78,0.15);
  border-color: var(--gold);
  color: var(--gold);
  transform: translateX(5px);
}

.choice-btn .choice-cost {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-left: 0.5rem;
}

/* ===== COMBAT ===== */
#combat-container {
  text-align: center;
  padding: 1.5rem;
  background: rgba(139,26,26,0.1);
  border: 1px solid rgba(139,26,26,0.3);
  border-radius: 4px;
  margin-bottom: 1rem;
}

#combat-info {
  font-family: 'Cinzel', serif;
  font-size: 1.1rem;
  margin-bottom: 1rem;
  color: var(--ember);
}

#dice-result {
  font-size: 2rem;
  margin-top: 1rem;
  min-height: 3rem;
}

.hidden { display: none !important; }

@keyframes combatPulse {
  0%, 100% { box-shadow: 0 0 5px rgba(232,93,38,0.3); }
  50% { box-shadow: 0 0 25px rgba(232,93,38,0.6); }
}

/* ===== MINIMAP ===== */
#minimap {
  position: fixed;
  bottom: 60px;
  right: 10px;
  opacity: 0.7;
  transition: opacity 0.3s;
  border: 1px solid rgba(200,168,78,0.3);
  border-radius: 4px;
  background: rgba(10,10,15,0.9);
}

#minimap:hover { opacity: 1; }

/* ===== MAP OVERLAY ===== */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.overlay-content {
  text-align: center;
}

.overlay-content h2 {
  font-family: 'Cinzel', serif;
  color: var(--gold);
  margin-bottom: 1rem;
  font-size: 1.8rem;
}

/* ===== GAME CONTROLS ===== */
#game-controls {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem;
}

/* ===== ENDING SCREEN ===== */
#ending-screen {
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
}

.ending-content { max-width: 600px; }

#ending-title {
  font-family: 'Cinzel', serif;
  font-size: 2.5rem;
  color: var(--gold);
  margin-bottom: 1.5rem;
}

#ending-text {
  font-size: 1.2rem;
  line-height: 1.8;
  margin-bottom: 2rem;
}

#ending-stats {
  font-family: 'Cinzel', serif;
  color: var(--text-dim);
  margin-bottom: 2rem;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes runeGlow {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.8; text-shadow: 0 0 10px rgba(200,168,78,0.3); }
}

/* ===== TYPEWRITER ===== */
.typewriter { overflow: hidden; white-space: pre-wrap; }
.typewriter .cursor {
  display: inline-block;
  width: 2px;
  height: 1.2em;
  background: var(--gold);
  margin-left: 2px;
  animation: blink 0.8s step-end infinite;
  vertical-align: text-bottom;
}

@keyframes blink {
  50% { opacity: 0; }
}

/* ===== ATMOSPHERE ===== */
.atmosphere-fire { 
  background: radial-gradient(ellipse at 50% 80%, rgba(232,93,38,0.08) 0%, transparent 50%), var(--bg-deep); 
}
.atmosphere-frost { 
  background: radial-gradient(ellipse at 50% 30%, rgba(168,213,226,0.06) 0%, transparent 50%), var(--bg-deep); 
}
.atmosphere-dark { 
  background: radial-gradient(ellipse at 50% 50%, rgba(26,26,46,0.3) 0%, var(--bg-deep) 50%), #050508; 
}
.atmosphere-golden { 
  background: radial-gradient(ellipse at 50% 20%, rgba(200,168,78,0.08) 0%, transparent 50%), var(--bg-deep); 
}
.atmosphere-ragnarok {
  background: 
    radial-gradient(ellipse at 30% 80%, rgba(232,93,38,0.12) 0%, transparent 40%),
    radial-gradient(ellipse at 70% 20%, rgba(139,26,26,0.1) 0%, transparent 40%),
    var(--bg-deep);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  #minimap { display: none; }
  #story-container { max-height: 40vh; padding: 1rem; }
  .title-glow { letter-spacing: 0.15em; }
  #stats-bar { gap: 0.8rem; font-size: 0.85rem; }
}

/* Scrollbar */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg-deep); }
::-webkit-scrollbar-thumb { background: var(--gold-dim); border-radius: 3px; }
