
:root {
  --bg-dark: #0f1014;
  --bg-panel: rgba(22, 23, 28, 0.92);
  --text-main: #d0d6de; /* Softer than stark white */
  --text-muted: #8b9bb4;
  --gold: #bd9b5e; /* Slightly softer gold */
  --gold-glow: rgba(189, 155, 94, 0.3);
  --border: rgba(189, 155, 94, 0.15);
  --danger: #a54646;
}

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

body {
  background-color: var(--bg-dark);
  background-image: url('../img/bg-main.png');
  background-size: cover;
  background-position: center;
  background-attachment: fixed;
  color: var(--text-main);
  font-family: 'Lora', serif;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

#game-container {
  width: 100%;
  max-width: 1200px;
  height: 90vh;
  background: var(--bg-panel);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  box-shadow: 0 10px 40px rgba(0,0,0,0.6);
  position: relative;
  border-radius: 12px;
  overflow: hidden;
}




h1, h2, h3, h4, button {
  font-family: 'Cinzel', serif;
}



.screen {
  display: none;
  width: 100%;
  height: 100%;
  padding: 2rem;
  flex-direction: column;
}

.screen.active {
  display: flex;
}

/* Menu Styles */
#main-menu {
  justify-content: center;
  align-items: center;
  text-align: center;
}

#main-menu h1 {
  font-size: 5rem;
  color: var(--gold);
  text-shadow: 0 0 20px var(--gold-glow);
  margin-bottom: 0.5rem;
}

.subtitle {
  color: var(--text-muted);
  font-size: 1.2rem;
  font-style: italic;
  margin-bottom: 3rem;
}

button {
  background: transparent;
  color: var(--gold);
  border: 1px solid var(--border);
  padding: 1rem 2rem;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.3s;
  margin: 0.5rem;
  border-radius: 5px;
}

button:hover {
  background: rgba(197, 160, 89, 0.1);
  box-shadow: 0 0 15px var(--gold-glow);
}

/* Forms */
.char-form {
  max-width: 500px;
  margin: 2rem auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

input, select, textarea {
  background: rgba(0,0,0,0.5);
  border: 1px solid var(--border);
  color: var(--text-main);
  padding: 0.8rem;
  font-family: 'Lora', serif;
  font-size: 1rem;
}

.desc-box {
  font-size: 0.9rem;
  color: var(--text-muted);
  padding: 0.5rem;
  background: rgba(0,0,0,0.3);
  border-left: 3px solid var(--gold);
}

/* Game UI Layout */
#game-ui {
  flex-direction: row;
  padding: 0;
}

#sidebar {
  width: 300px;
  background: rgba(0,0,0,0.4);
  border-right: 1px solid var(--border);
  padding: 1.5rem;
  overflow-y: auto;
}

#sidebar h3 {
  color: var(--gold);
  font-size: 1.5rem;
  margin-bottom: 1rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

#story-area {
  flex-grow: 1;
  padding: 2rem 3rem;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

#story-text {
  flex-grow: 1;
  font-size: 1.25rem; font-weight: 400; letter-spacing: 0.3px;
  line-height: 1.85;
  margin-bottom: 2rem;
}

#choices-area {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.choice-btn {
  text-align: left;
  background: rgba(0,0,0,0.3);
}

/* Modal */
.modal {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.modal-content {
  background: var(--bg-panel);
  padding: 2rem;
  border: 1px solid var(--gold);
  border-radius: 10px;
  width: 90%;
  max-width: 500px;
  text-align: center;
}

#save-code-output {
  width: 100%;
  height: 100px;
  margin: 1rem 0;
  font-family: monospace;
  font-size: 1.2rem;
  text-align: center;
}


/* --- MOBILE RESPONSIVENESS --- */
@media (max-width: 768px) {
  body {
    align-items: flex-start;
  }
  
  #game-container {
    height: 100%;
    border-radius: 0;
    border: none;
    box-shadow: none;
  }
  
  #main-menu h1 {
    font-size: 3rem;
  }
  
  .menu-buttons button {
    width: 100%;
    margin: 0.5rem 0;
  }

  /* Game UI: Stack sidebar on top */
  #game-ui {
    flex-direction: column;
  }

  #sidebar {
    width: 100%;
    max-height: 250px;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 1rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    justify-content: space-between;
  }

  #sidebar h3 {
    width: 100%;
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    border-bottom: none;
    padding-bottom: 0;
  }

  .stat-row, .stats-grid, #inventory, .save-btn {
    flex: 1;
    min-width: 100px;
    font-size: 0.85rem;
  }
  
  .stats-grid {
    margin-bottom: 0;
  }
  
  #inventory {
    display: none; /* Hide inventory to save space on mobile, or make it a dropdown. Let's just keep it small */
  }

  #story-area {
    padding: 1.5rem 1rem;
  }

  #story-text {
    font-size: 1rem;
  }
  
  button {
    font-size: 1rem;
    padding: 0.8rem 1rem;
  }
}
