* { box-sizing: border-box; }

:root {
  --bg-1: #3b1a16;
  --bg-2: #1f0d0c;
  --card: #2b1810;
  --card-2: #33200f;
  --line: rgba(244, 236, 221, 0.16);
  --cream: #f4ecdd;
  --muted: #c9ad82;
  --gold: #e8caa0;
  --common: #b7a98f;
  --uncommon: #8fae7a;
  --rare: #7ea3c9;
  --epic: #b083c9;
  --legendary: #e8caa0;
}

html, body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 30% 0%, rgba(255, 190, 130, 0.18), transparent 55%),
    linear-gradient(160deg, var(--bg-1), var(--bg-2));
  color: var(--cream);
  font-family: 'Cormorant Garamond', serif;
}

button {
  font-family: 'Special Elite', monospace;
}

.hidden { display: none !important; }

/* ===== HEADER ===== */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 30px;
  border-bottom: 1px solid var(--line);
  background: rgba(0, 0, 0, 0.18);
  flex-wrap: wrap;
}

#back-link {
  font-family: 'Special Elite', monospace;
  font-size: 0.75em;
  letter-spacing: 0.08em;
  padding: 8px 16px;
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(244, 236, 221, 0.25);
  color: var(--cream);
  text-decoration: none;
  transition: background 0.25s ease, border-color 0.25s ease;
}
#back-link:hover { background: rgba(0, 0, 0, 0.55); border-color: rgba(244, 236, 221, 0.5); }

.scene-title {
  text-align: center;
  display: flex;
  flex-direction: column;
}
.title-small {
  font-family: 'Special Elite', monospace;
  font-size: 0.6em;
  letter-spacing: 0.3em;
  opacity: 0.55;
}
.title-main {
  font-size: 1.5em;
  letter-spacing: 0.05em;
}

.seed-counter {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Special Elite', monospace;
  font-size: 0.75em;
  letter-spacing: 0.05em;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--line);
  padding: 8px 16px;
  border-radius: 20px;
}
.seed-symbol { color: var(--gold); }
.seed-label { opacity: 0.6; }

/* ===== LAYOUT ===== */

.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 30px 24px 70px;
}

.tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 26px;
}

.tab-btn {
  flex: 1;
  padding: 12px 10px;
  font-size: 0.72em;
  letter-spacing: 0.1em;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--line);
  color: var(--muted);
  border-radius: 10px;
  cursor: pointer;
  transition: background 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}
.tab-btn:hover { color: var(--cream); }
.tab-btn.active {
  background: rgba(232, 202, 160, 0.14);
  border-color: rgba(232, 202, 160, 0.5);
  color: var(--gold);
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 10px;
}
.eyebrow {
  display: block;
  font-family: 'Special Elite', monospace;
  font-size: 0.65em;
  letter-spacing: 0.25em;
  opacity: 0.5;
  margin-bottom: 6px;
}
.panel-heading h1 {
  margin: 0;
  font-weight: 500;
  font-size: 1.7em;
  letter-spacing: 0.02em;
}
.pull-counter, .collection-count {
  font-family: 'Special Elite', monospace;
  font-size: 0.7em;
  letter-spacing: 0.05em;
  opacity: 0.7;
}
.pull-counter strong, .collection-count strong { color: var(--gold); font-size: 1.3em; }

/* ===== MAQUINA ===== */

.gacha-layout {
  display: flex;
  gap: 30px;
  flex-wrap: wrap;
}

.machine {
  flex: 1 1 260px;
  background: linear-gradient(160deg, var(--card-2), var(--card));
  border-radius: 20px;
  padding: 20px;
  box-shadow: inset 0 0 0 2px rgba(0,0,0,0.4), 0 25px 60px rgba(0,0,0,0.6);
  text-align: center;
}

.machine-top {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.machine-light {
  width: 8px; height: 8px; border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, var(--gold), #8a6a34);
}
.machine-label {
  font-family: 'Special Elite', monospace;
  font-size: 0.65em;
  letter-spacing: 0.2em;
  opacity: 0.7;
}

.machine-screen {
  background: rgba(0,0,0,0.4);
  border-radius: 12px;
  padding: 26px 14px;
  margin-bottom: 16px;
}
.screen-stars { color: var(--gold); letter-spacing: 0.3em; margin-bottom: 10px; opacity: 0.8; }
.screen-title { font-size: 1.3em; line-height: 1.3; }
.screen-sub {
  margin-top: 8px;
  font-family: 'Special Elite', monospace;
  font-size: 0.65em;
  opacity: 0.5;
  letter-spacing: 0.1em;
}

.machine-slot {
  display: flex;
  justify-content: center;
  margin-bottom: 14px;
}
.capsule {
  width: 34px; height: 34px; border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, var(--gold), #8a6a34);
  box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}
.machine-bottom {
  font-family: 'Special Elite', monospace;
  font-size: 0.6em;
  letter-spacing: 0.2em;
  opacity: 0.4;
  display: flex;
  justify-content: center;
  gap: 6px;
}

.gacha-controls {
  flex: 1 1 260px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.balance-box {
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  text-align: center;
}
.balance-label {
  display: block;
  font-family: 'Special Elite', monospace;
  font-size: 0.6em;
  letter-spacing: 0.2em;
  opacity: 0.55;
  margin-bottom: 6px;
}
.balance-box strong { font-size: 1.6em; }
.pink-seed { color: var(--gold); margin-right: 4px; }
.balance-sub {
  display: block;
  font-size: 0.85em;
  opacity: 0.6;
  margin-top: 4px;
}

.pull-buttons { display: flex; gap: 12px; flex-wrap: wrap; }
.pull-btn {
  flex: 1 1 120px;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--line);
  color: var(--cream);
  border-radius: 12px;
  padding: 14px 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: background 0.25s ease, border-color 0.25s ease, opacity 0.25s ease;
}
.pull-btn:hover:not(:disabled) { background: rgba(232,202,160,0.12); border-color: rgba(232,202,160,0.5); }
.pull-btn:disabled { opacity: 0.4; cursor: default; }
.pull-btn.primary { background: rgba(232,202,160,0.16); border-color: rgba(232,202,160,0.55); }
.pull-title { font-size: 0.75em; letter-spacing: 0.08em; }
.pull-cost { font-size: 0.7em; opacity: 0.6; font-family: 'Cormorant Garamond', serif; }
.discount {
  font-family: 'Special Elite', monospace;
  font-size: 0.55em;
  letter-spacing: 0.05em;
  color: var(--uncommon);
}

.pity-box {
  background: rgba(0,0,0,0.22);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
}
.pity-title {
  font-family: 'Special Elite', monospace;
  font-size: 0.6em;
  letter-spacing: 0.15em;
  opacity: 0.55;
  margin-bottom: 10px;
}
.pity-row {
  display: grid;
  grid-template-columns: 70px 1fr 55px;
  align-items: center;
  gap: 10px;
  font-size: 0.75em;
  margin-bottom: 8px;
}
.pity-bar {
  height: 6px;
  border-radius: 4px;
  background: rgba(255,255,255,0.08);
  overflow: hidden;
}
.pity-bar > div {
  height: 100%;
  width: 0%;
  background: var(--gold);
  transition: width 0.4s ease;
}

/* ===== RAREZAS ===== */

.rarity-guide {
  margin-top: 26px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  font-family: 'Special Elite', monospace;
  font-size: 0.65em;
  letter-spacing: 0.05em;
}
.guide-title { opacity: 0.5; margin-right: 6px; }
.rarity {
  padding: 5px 12px;
  border-radius: 14px;
  background: rgba(255,255,255,0.06);
}
.rarity.common { color: var(--common); }
.rarity.uncommon { color: var(--uncommon); }
.rarity.rare { color: var(--rare); }
.rarity.epic { color: var(--epic); }
.rarity.legendary { color: var(--legendary); }

/* ===== COLECCION ===== */

.collection-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}
.collection-card {
  background: rgba(0,0,0,0.22);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 18px 16px;
  text-align: center;
}
.collection-card.locked { opacity: 0.45; }
.item-symbol { font-size: 1.8em; margin-bottom: 6px; }
.item-rarity {
  font-family: 'Special Elite', monospace;
  font-size: 0.6em;
  letter-spacing: 0.1em;
  margin-bottom: 6px;
}
.item-name { font-size: 1.05em; margin-bottom: 4px; }
.item-description { font-size: 0.85em; opacity: 0.6; line-height: 1.4; }
.item-count {
  margin-top: 8px;
  font-family: 'Special Elite', monospace;
  font-size: 0.7em;
  color: var(--gold);
}

/* ===== MISIONES ===== */

.mission-grid { display: flex; flex-direction: column; gap: 14px; }
.mission-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: rgba(0,0,0,0.22);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 20px;
}
.mission-icon { font-size: 1.4em; color: var(--gold); }
.mission-info { flex: 1; }
.mission-info h2 { margin: 0 0 4px; font-size: 1.1em; font-weight: 500; }
.mission-info p { margin: 0 0 6px; font-size: 0.9em; opacity: 0.65; }
.mission-reward {
  font-family: 'Special Elite', monospace;
  font-size: 0.6em;
  letter-spacing: 0.05em;
  color: var(--uncommon);
}
.mission-status {
  font-family: 'Special Elite', monospace;
  font-size: 0.75em;
  opacity: 0.7;
  white-space: nowrap;
}

/* ===== RESULTADO ===== */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 3, 2, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.result-box {
  position: relative;
  background: linear-gradient(160deg, var(--card-2), var(--card));
  border-radius: 20px;
  padding: 40px 36px;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 40px 100px rgba(0,0,0,0.7);
}
.close-btn {
  position: absolute;
  top: 12px; right: 16px;
  background: none;
  border: none;
  color: var(--cream);
  font-size: 22px;
  cursor: pointer;
  opacity: 0.6;
  font-family: 'Cormorant Garamond', serif;
}
.close-btn:hover { opacity: 1; }
.result-eyebrow {
  font-family: 'Special Elite', monospace;
  font-size: 0.65em;
  letter-spacing: 0.25em;
  opacity: 0.5;
  margin-bottom: 10px;
}
.result-rarity {
  font-family: 'Special Elite', monospace;
  font-size: 0.85em;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
}
.result-name { font-size: 1.5em; margin-bottom: 10px; }
.result-description { font-size: 0.95em; opacity: 0.65; margin-bottom: 14px; }
.result-duplicate {
  font-family: 'Special Elite', monospace;
  font-size: 0.65em;
  letter-spacing: 0.05em;
  color: var(--uncommon);
  margin-bottom: 14px;
}
.result-continue {
  background: rgba(232,202,160,0.16);
  border: 1px solid rgba(232,202,160,0.5);
  color: var(--cream);
  padding: 10px 26px;
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.75em;
  letter-spacing: 0.08em;
}
.result-continue:hover { background: rgba(232,202,160,0.28); }

@media (max-width: 640px) {
  .topbar { justify-content: center; text-align: center; }
  .gacha-layout { flex-direction: column; }
}

/* ===== importar progreso ===== */
.import-box {
  max-width: 960px;
  margin: 0 auto 40px;
  padding: 0 24px;
}
.import-toggle {
  width: 100%;
  background: rgba(0,0,0,0.2);
  border: 1px dashed rgba(232,202,160,0.35);
  color: var(--muted);
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 0.7em;
  letter-spacing: 0.05em;
  cursor: pointer;
}
.import-toggle:hover { color: var(--gold); border-color: rgba(232,202,160,0.6); }
.import-panel {
  margin-top: 12px;
  background: rgba(0,0,0,0.25);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
}
.import-panel p { margin: 0 0 8px; font-size: 0.85em; opacity: 0.7; }
.import-panel textarea {
  width: 100%;
  height: 70px;
  background: rgba(0,0,0,0.4);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--cream);
  font-family: monospace;
  font-size: 0.8em;
  padding: 8px;
  resize: vertical;
}
.import-panel button {
  margin-top: 10px;
  background: rgba(232,202,160,0.16);
  border: 1px solid rgba(232,202,160,0.5);
  color: var(--cream);
  padding: 8px 20px;
  border-radius: 16px;
  cursor: pointer;
  font-size: 0.75em;
}
.import-panel button:hover { background: rgba(232,202,160,0.28); }
#importResult { margin-top: 8px; font-size: 0.8em; opacity: 0.75; }