/* ============================================================
   GLOBAL RESET & BASE
   ============================================================ */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #0a0a0a url("assets/stone-bg.jpg") repeat;
  background-size: 512px;
  color: #e6e2d3;
  font-family: "Cinzel", serif;
  overflow: hidden;
}

/* ============================================================
   APP CONTAINER
   ============================================================ */
.app-container {
  max-width: 480px;
  margin: 0 auto;
  height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
}

/* ============================================================
   SCREENS (only one visible at a time)
   ============================================================ */
.screen {
  display: none;
  flex: 1;
  overflow: hidden;
  padding: 1rem;
}

.screen.active {
  display: block;
}

/* ============================================================
   CHARACTER SCREEN
   ============================================================ */
.character-header {
  display: flex;
  gap: 1rem;
  background: #1a1a1a url("assets/iron-texture.jpg") repeat;
  border: 3px solid #5a4a2f;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}

.portrait-frame {
  width: 96px;
  height: 96px;
  border: 4px solid #bfa76f;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 0 12px rgba(255, 215, 100, 0.3);
}

.portrait-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.character-info {
  flex: 1;
}

.character-name {
  font-size: 1.2rem;
  color: #f4e7c2;
  text-shadow: 0 0 6px #8b6f3a;
  margin-bottom: 0.5rem;
}

.character-stats {
  display: flex;
  gap: 1rem;
  margin-bottom: 0.5rem;
}

.stat-block {
  text-align: center;
}

.stat-label {
  display: block;
  font-size: 0.7rem;
  color: #c9b89a;
}

.stat-value {
  font-size: 1rem;
  font-weight: bold;
  color: #f4e7c2;
}

/* XP BAR */
.xp-bar-frame {
  width: 100%;
  height: 12px;
  background: #3a1a1a;
  border: 2px solid #bfa76f;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 0.25rem;
}

.xp-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #7a0000, #d10000);
  transition: width 0.3s ease-out;
}

.xp-bar-text {
  font-size: 0.75rem;
  color: #c9b89a;
  display: flex;
  justify-content: space-between;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn-holy {
  width: 100%;
  background: #bfa76f;
  color: #1a1a1a;
  border: 2px solid #e6d7a8;
  padding: 0.75rem;
  border-radius: 6px;
  font-weight: bold;
  cursor: pointer;
  transition: 0.2s;
  margin-bottom: 1rem;
}

.btn-holy:hover {
  background: #d8c48a;
}

.btn-iron {
  background: #3a2f1f;
  border: 2px solid #bfa76f;
  color: #f4e7c2;
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-family: "Cinzel", serif;
  cursor: pointer;
  transition: 0.2s;
  margin-bottom: 0.5rem;
}

.btn-iron:hover {
  background: #4a3a26;
}

.btn-import input {
  display: none;
}

/* ============================================================
   QUEST SCREEN
   ============================================================ */
.quest-tabs {
  display: flex;
  overflow-x: auto;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.quest-tab {
  flex: 1;
  padding: 0.5rem;
  background: #3a2f1f;
  border: 2px solid #5a4a2f;
  border-radius: 6px;
  color: #e6e2d3;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
}

.quest-tab.active {
  background: #bfa76f;
  color: #1a1a1a;
  border-color: #e6d7a8;
}

/* Scrollable quest log */
.quest-scroll {
  flex: 1;
  overflow-y: auto;
  padding-right: 0.5rem;
}

/* Quest panels */
.quest-panel {
  display: none;
  background: #2a2418 url("assets/parchment.jpg") repeat;
  border: 3px solid #5a4a2f;
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.4);
}

.quest-panel.active {
  display: block;
}

.quest-title {
  font-size: 1rem;
  color: #f4e7c2;
  margin-bottom: 0.5rem;
  text-shadow: 0 0 4px #8b6f3a;
}

.quest-list {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.quest-item {
  font-size: 0.85rem;
  color: #e6e2d3;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.quest-item input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #bfa76f;
}

/* Auto-hide animation */
.quest-item.completed {
  opacity: 0;
  height: 0;
  margin: 0;
  padding: 0;
  overflow: hidden;
  transition: all 0.3s ease-out;
}

/* ============================================================
   LEDGER SCREEN
   ============================================================ */
.ledger-title {
  font-size: 1rem;
  color: #f4e7c2;
  margin-bottom: 0.5rem;
}

.ledger-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.75rem;
  margin-bottom: 0.5rem;
}

.ledger-table th,
.ledger-table td {
  padding: 0.25rem;
  border-bottom: 1px solid #4a3a26;
  text-align: right;
}

.ledger-table th:first-child,
.ledger-table td:first-child {
  text-align: left;
}

.ledger-bars {
  display: flex;
  gap: 0.25rem;
  height: 40px;
  margin-bottom: 0.5rem;
}

.ledger-bar {
  flex: 1;
  background: #2a1a1a;
  border: 1px solid #5a4a2f;
  border-radius: 4px;
  position: relative;
  overflow: hidden;
}

.ledger-bar-fill {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(180deg, #d10000, #7a0000);
  height: 0%;
  transition: height 0.3s ease-out;
}

.ledger-bar-label {
  position: absolute;
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.6rem;
  color: #e6e2d3;
}

.ledger-summary {
  font-size: 0.75rem;
  color: #c9b89a;
}

/* ============================================================
   INVENTORY SCREEN
   ============================================================ */
.inventory-title {
  font-size: 1rem;
  color: #f4e7c2;
  margin-bottom: 0.5rem;
}

.loot-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.5rem;
  overflow-y: auto;
  max-height: calc(100vh - 150px);
}

.loot-card {
  display: flex;
  gap: 0.5rem;
  background: #1a1a1a;
  border: 2px solid #5a4a2f;
  border-radius: 6px;
  padding: 0.5rem;
}

.loot-card img {
  width: 64px;
  height: 64px;
  object-fit: cover;
  border: 2px solid #bfa76f;
  border-radius: 4px;
}

.loot-info {
  flex: 1;
}

.loot-name {
  font-size: 0.85rem;
  font-weight: bold;
  color: #f4e7c2;
}

.loot-meta {
  font-size: 0.75rem;
  color: #c9b89a;
}

.loot-link {
  font-size: 0.75rem;
  color: #d8c48a;
  text-decoration: none;
}

/* ============================================================
   SETTINGS SCREEN
   ============================================================ */
.settings-title {
  font-size: 1rem;
  color: #f4e7c2;
  margin-bottom: 1rem;
}

/* ============================================================
   BOTTOM NAV BAR (Diablo II Stone Style)
   ============================================================ */
.bottom-nav {
  display: flex;
  justify-content: space-between;
  background: #1a1a1a url("assets/stone-bg.jpg") repeat;
  border-top: 3px solid #5a4a2f;
  padding: 0.5rem;
  position: sticky;
  bottom: 0;
}

.nav-btn {
  flex: 1;
  background: #3a2f1f;
  border: 2px solid #5a4a2f;
  border-radius: 6px;
  color: #e6e2d3;
  padding: 0.5rem 0.25rem;
  font-size: 0.7rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  transition: 0.2s;
}

.nav-btn.active {
  background: #bfa76f;
  color: #1a1a1a;
  border-color: #e6d7a8;
}

.nav-icon {
  font-size: 1.1rem;
  margin-bottom: 0.15rem;
}

.nav-label {
  font-size: 0.65rem;
}