/* ============================================================
   PETALIA - Estilos principales
   Paleta: violeta #6C3CE1, rosa #FF6FD8, amarillo #FFD700
   ============================================================ */

:root {
  --primary:    #6C3CE1;
  --primary-dark: #4B29A8;
  --secondary:  #FF6FD8;
  --gold:       #FFD700;
  --bg:         #0D0521;
  --bg2:        #1A0A3E;
  --bg3:        #251655;
  --card:       #1E0D40;
  --text:       #F0E6FF;
  --text-muted: #8A7AAA;
  --success:    #4ADE80;
  --danger:     #F87171;
  --fire:       #FF6B35;
  --water:      #38BDF8;
  --nature:     #4ADE80;
  --lightning:  #FACC15;
  --shadow:     #A78BFA;
  --light:      #FEF08A;
  --radius:     16px;
  --nav-h:      64px;
  --header-h:   56px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overflow: hidden; background: var(--bg); color: var(--text); font-family: 'Segoe UI', system-ui, sans-serif; font-size: 15px; }

/* ---- SCREENS ---- */
.screen { position: fixed; inset: 0; display: none; flex-direction: column; }
.screen.active { display: flex; }

/* ---- LOADING ---- */
#screen-loading { background: var(--bg); align-items: center; justify-content: center; gap: 16px; }
.loading-logo { font-size: 64px; animation: pulse 1.2s ease-in-out infinite; }
.loading-title { font-size: 32px; font-weight: 900; letter-spacing: 6px; background: linear-gradient(135deg, var(--primary), var(--secondary)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.loading-bar { width: 200px; height: 6px; background: var(--bg3); border-radius: 99px; overflow: hidden; }
.loading-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--secondary)); border-radius: 99px; animation: loading 2s ease-in-out; }
@keyframes loading { from { width: 0 } to { width: 100% } }
@keyframes pulse { 0%,100%{ transform:scale(1) } 50%{ transform:scale(1.15) } }

/* ---- AUTH ---- */
#screen-auth { background: radial-gradient(ellipse at 50% 0%, #2A0A6E 0%, var(--bg) 70%); justify-content: center; align-items: center; padding: 20px; }
.auth-bg { width: 100%; max-width: 420px; }
.auth-card { background: var(--card); border-radius: var(--radius); padding: 32px 24px; border: 1px solid rgba(108,60,225,.3); }
.auth-logo { text-align: center; font-size: 28px; font-weight: 900; letter-spacing: 4px; background: linear-gradient(135deg, var(--primary), var(--secondary)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; margin-bottom: 24px; }
.auth-tabs { display: flex; gap: 8px; margin-bottom: 20px; }
.auth-tab { flex: 1; padding: 10px; background: var(--bg3); border: none; border-radius: 10px; color: var(--text-muted); cursor: pointer; font-size: 14px; font-weight: 600; transition: all .2s; }
.auth-tab.active { background: var(--primary); color: white; }
.auth-form { display: flex; flex-direction: column; gap: 12px; }
.auth-form.hidden { display: none; }

/* ---- INPUTS ---- */
.input { width: 100%; padding: 12px 16px; background: var(--bg3); border: 1px solid rgba(108,60,225,.3); border-radius: 12px; color: var(--text); font-size: 15px; outline: none; transition: border-color .2s; }
.input:focus { border-color: var(--primary); }
.input::placeholder { color: var(--text-muted); }

/* ---- BUTTONS ---- */
.btn { width: 100%; padding: 14px; border: none; border-radius: 12px; font-size: 16px; font-weight: 700; cursor: pointer; transition: all .2s; }
.btn-primary { background: linear-gradient(135deg, var(--primary), var(--secondary)); color: white; }
.btn-primary:hover { filter: brightness(1.1); transform: translateY(-1px); }
.btn-outline { background: transparent; border: 2px solid var(--primary); color: var(--primary); border-radius: 12px; }
.error-msg { color: var(--danger); font-size: 13px; text-align: center; min-height: 16px; }

/* ---- GAME LAYOUT ---- */
#screen-game { background: var(--bg); display: flex; flex-direction: column; }
.game-header { height: var(--header-h); display: flex; align-items: center; justify-content: space-between; padding: 0 16px; background: var(--bg2); border-bottom: 1px solid rgba(108,60,225,.2); flex-shrink: 0; }
.header-brand { font-size: 18px; font-weight: 900; letter-spacing: 3px; background: linear-gradient(135deg, var(--primary), var(--secondary)); -webkit-background-clip: text; -webkit-text-fill-color: transparent; }
.header-resources { display: flex; gap: 16px; }
.resource { display: flex; align-items: center; gap: 4px; font-weight: 700; font-size: 15px; }

#game-main { flex: 1; overflow-y: auto; padding: 16px 16px calc(var(--nav-h) + 16px); }

/* ---- BOTTOM NAV ---- */
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; height: var(--nav-h); background: var(--bg2); border-top: 1px solid rgba(108,60,225,.2); display: flex; align-items: center; justify-content: space-around; padding: 0 8px; z-index: 100; }
.nav-btn { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; background: none; border: none; color: var(--text-muted); cursor: pointer; padding: 8px 4px; transition: color .2s; }
.nav-btn.active { color: var(--primary); }
.nav-icon { font-size: 22px; }
.nav-label { font-size: 10px; font-weight: 600; }
.nav-center .nav-icon { font-size: 28px; }

/* ---- TAB CONTENT ---- */
.tab-content { display: none; }
.tab-content.active { display: block; }
.tab-title { font-size: 20px; font-weight: 800; margin-bottom: 16px; }

/* ---- PET DISPLAY CARD ---- */
.pet-display-card { background: linear-gradient(135deg, var(--bg2), var(--bg3)); border: 1px solid rgba(108,60,225,.4); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; align-items: center; gap: 12px; margin-bottom: 16px; }
.pet-sprite { font-size: 80px; animation: float 3s ease-in-out infinite; }
@keyframes float { 0%,100%{ transform:translateY(0) } 50%{ transform:translateY(-8px) } }
.pet-info { text-align: center; }
.pet-name { font-size: 22px; font-weight: 800; }
.pet-level { font-size: 14px; color: var(--text-muted); margin-top: 2px; }
.pet-bars { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.bar-row { display: flex; align-items: center; gap: 8px; }
.bar-row span { font-size: 16px; width: 20px; }
.bar { flex: 1; height: 8px; background: var(--bg); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--danger); border-radius: 99px; transition: width .4s; }
.bar-energy { background: var(--lightning); }
.bar-bond { background: var(--secondary); }

/* ---- QUICK ACTIONS ---- */
.quick-actions { display: flex; gap: 10px; margin-bottom: 16px; }
.action-btn { flex: 1; background: var(--bg3); border: 1px solid rgba(108,60,225,.3); border-radius: 12px; padding: 12px 8px; color: var(--text); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 22px; transition: all .2s; }
.action-btn span { font-size: 11px; color: var(--text-muted); font-weight: 600; }
.action-btn:hover { background: var(--bg2); border-color: var(--primary); }

/* ---- HOME CARDS ---- */
.home-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 20px; }
.home-card { background: var(--card); border: 1px solid rgba(108,60,225,.2); border-radius: var(--radius); padding: 16px; text-align: center; cursor: pointer; transition: all .2s; }
.home-card:hover { border-color: var(--primary); background: var(--bg3); }
.home-card-icon { font-size: 28px; margin-bottom: 6px; }
.home-card-label { font-size: 13px; font-weight: 700; }
.home-card-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ---- CREATURE ROW ---- */
.section-title { font-size: 14px; font-weight: 700; color: var(--text-muted); margin-bottom: 10px; text-transform: uppercase; letter-spacing: 1px; }
.creature-row { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 8px; }
.creature-chip { background: var(--bg3); border: 1px solid rgba(108,60,225,.3); border-radius: 12px; padding: 10px 14px; text-align: center; cursor: pointer; flex-shrink: 0; transition: all .2s; min-width: 80px; }
.creature-chip.active { border-color: var(--primary); background: rgba(108,60,225,.15); }
.creature-chip-icon { font-size: 28px; }
.creature-chip-name { font-size: 10px; color: var(--text-muted); margin-top: 4px; }

/* ---- GAMES GRID ---- */
.energy-display { background: var(--bg3); border-radius: 10px; padding: 10px 16px; margin-bottom: 16px; font-size: 14px; }
.games-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.game-card { background: var(--card); border: 1px solid rgba(108,60,225,.2); border-radius: var(--radius); padding: 20px 16px; text-align: center; cursor: pointer; transition: all .2s; }
.game-card:hover { border-color: var(--primary); transform: translateY(-2px); }
.game-card.coming-soon { opacity: .5; cursor: default; }
.game-icon { font-size: 36px; margin-bottom: 8px; }
.game-name { font-size: 13px; font-weight: 700; margin-bottom: 4px; }
.game-cost { font-size: 11px; color: var(--text-muted); }

/* ---- TERRITORIES ---- */
.territories-grid { display: flex; flex-direction: column; gap: 12px; }
.territory-card { display: flex; align-items: center; gap: 16px; padding: 16px; border-radius: var(--radius); border: 1px solid rgba(255,255,255,.1); cursor: pointer; transition: all .2s; }
.territory-card:hover { transform: translateX(4px); }
.territory-card.fire { background: linear-gradient(135deg, rgba(255,107,53,.15), rgba(255,107,53,.05)); border-color: rgba(255,107,53,.3); }
.territory-card.water { background: linear-gradient(135deg, rgba(56,189,248,.15), rgba(56,189,248,.05)); border-color: rgba(56,189,248,.3); }
.territory-card.nature { background: linear-gradient(135deg, rgba(74,222,128,.15), rgba(74,222,128,.05)); border-color: rgba(74,222,128,.3); }
.territory-card.lightning { background: linear-gradient(135deg, rgba(250,204,21,.15), rgba(250,204,21,.05)); border-color: rgba(250,204,21,.3); }
.territory-card.shadow { background: linear-gradient(135deg, rgba(167,139,250,.15), rgba(167,139,250,.05)); border-color: rgba(167,139,250,.3); }
.territory-icon { font-size: 36px; }
.territory-name { font-size: 16px; font-weight: 700; }
.territory-element { font-size: 13px; color: var(--text-muted); }

/* ---- QUESTS ---- */
.quests-list { display: flex; flex-direction: column; gap: 10px; }
.quest-item { background: var(--card); border: 1px solid rgba(108,60,225,.2); border-radius: var(--radius); padding: 16px; }
.quest-title { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.quest-desc { font-size: 12px; color: var(--text-muted); margin-bottom: 8px; }
.quest-reward { font-size: 12px; color: var(--gold); }

/* ---- PROFILE ---- */
.profile-header { text-align: center; padding: 24px 0; }
.profile-avatar { font-size: 64px; }
.profile-name { font-size: 24px; font-weight: 800; margin-top: 8px; }
.profile-level { font-size: 14px; color: var(--text-muted); margin-top: 4px; }
.profile-stats { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin-top: 20px; }
.stat-box { background: var(--card); border-radius: 12px; padding: 16px; text-align: center; }
.stat-val { font-size: 24px; font-weight: 800; }
.stat-label { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

/* ---- MODAL ---- */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.7); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 999; }
.modal-overlay.hidden { display: none; }
.modal-box { background: var(--card); border: 1px solid rgba(108,60,225,.4); border-radius: var(--radius); padding: 24px; width: 100%; max-width: 380px; }
.modal-title { font-size: 20px; font-weight: 800; margin-bottom: 12px; }
.modal-body { font-size: 14px; color: var(--text-muted); margin-bottom: 20px; line-height: 1.6; }

.hidden { display: none !important; }

/* Scrollbar */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg3); border-radius: 99px; }
