/* ============================================================
   CrossGames – Estilo Principal
   ============================================================ */

:root {
  --gold: #d4a843;
  --gold-light: #f0c96a;
  --gold-dark: #a07820;
  --brown: #3d1f0a;
  --brown-light: #5c3317;
  --cream: #fdf6e3;
  --cream-dark: #f5e8c0;
  --dark: #1a1a2e;
  --dark2: #16213e;
  --dark3: #0f3460;
  --text: #2d2d2d;
  --text-light: #666;
  --white: #ffffff;
  --success: #27ae60;
  --danger: #e74c3c;
  --warning: #f39c12;
  --radius: 12px;
  --radius-lg: 20px;
  --shadow: 0 4px 20px rgba(0,0,0,.12);
  --shadow-lg: 0 8px 40px rgba(0,0,0,.2);
  --transition: .25s ease;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Nunito', sans-serif;
  background: var(--cream);
  color: var(--text);
  line-height: 1.6;
}

/* ---- Typography ---- */
h1,h2,h3 { font-family: 'Cinzel', serif; }
a { color: var(--gold-dark); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Utilities ---- */
.container { max-width: 1200px; margin: 0 auto; padding: 0 1.5rem; }
.hidden { display: none !important; }
.section { padding: 5rem 0; }
.section-dark { background: var(--dark); color: var(--white); }
.section-dark .section-header p { color: #aaa; }

.section-header { text-align: center; margin-bottom: 3rem; }
.section-header h2 { font-size: 2.2rem; color: var(--gold); margin-bottom: .5rem; }
.section-header p { color: var(--text-light); font-size: 1.1rem; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .6rem 1.4rem; border-radius: 8px; font-family: 'Nunito', sans-serif;
  font-weight: 700; font-size: .95rem; cursor: pointer; border: 2px solid transparent;
  transition: all var(--transition); text-decoration: none;
}
.btn-primary { background: var(--gold); color: var(--brown); border-color: var(--gold); }
.btn-primary:hover { background: var(--gold-light); border-color: var(--gold-light); transform: translateY(-1px); }
.btn-outline { background: transparent; color: var(--gold); border-color: var(--gold); }
.btn-outline:hover { background: var(--gold); color: var(--brown); }
.btn-sm { padding: .4rem 1rem; font-size: .85rem; }
.btn-lg { padding: .9rem 2rem; font-size: 1.05rem; }
.btn-full { width: 100%; }
.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-success { background: var(--success); color: #fff; border-color: var(--success); }

/* ---- Cookie Banner ---- */
.cookie-banner {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 9999;
  background: var(--dark); color: var(--white);
  padding: 1rem 1.5rem; box-shadow: 0 -4px 20px rgba(0,0,0,.3);
  animation: slideUp .4s ease;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
.cookie-content {
  max-width: 1200px; margin: 0 auto; display: flex; align-items: center;
  gap: 1.2rem; flex-wrap: wrap;
}
.cookie-icon { font-size: 2rem; flex-shrink: 0; }
.cookie-content > div:nth-child(2) { flex: 1; min-width: 200px; }
.cookie-content strong { color: var(--gold); }
.cookie-content p { font-size: .9rem; color: #ccc; margin-top: .2rem; }
.cookie-content a { color: var(--gold-light); }
.cookie-btns { display: flex; gap: .6rem; flex-shrink: 0; }

/* ---- Navbar ---- */
.navbar {
  position: sticky; top: 0; z-index: 1000;
  background: rgba(26,26,46,.95); backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(212,168,67,.2);
}
.nav-inner {
  display: flex; align-items: center; gap: 1.5rem;
  padding: .9rem 1.5rem; max-width: 1200px; margin: 0 auto;
}
.logo {
  display: flex; align-items: center; gap: .5rem;
  font-family: 'Cinzel', serif; font-size: 1.4rem;
  color: var(--white); text-decoration: none;
}
.logo strong { color: var(--gold); }
.logo-cross { color: var(--gold); font-size: 1.6rem; }
.nav-links { display: flex; gap: 1.5rem; margin-left: auto; }
.nav-links a { color: #ccc; font-weight: 600; transition: color var(--transition); }
.nav-links a:hover { color: var(--gold); text-decoration: none; }
.nav-auth, .nav-user { display: flex; gap: .6rem; align-items: center; }
.nav-username { color: var(--gold); font-weight: 700; font-size: .95rem; }
.nav-toggle { display: none; background: none; border: none; color: var(--white); font-size: 1.5rem; cursor: pointer; }

/* ---- Hero ---- */
.hero {
  position: relative; min-height: 90vh; display: flex; align-items: center;
  overflow: hidden;
}
.hero-bg {
  position: absolute; inset: 0;
  background: linear-gradient(135deg, var(--dark) 0%, var(--dark2) 40%, var(--dark3) 100%);
}
.hero-bg::after {
  content: '✝ ✡ ☩ ✝ ✡ ☩ ✝ ✡ ☩ ✝ ✡ ☩';
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 8rem; color: rgba(212,168,67,.04); letter-spacing: 4rem;
  overflow: hidden; word-break: break-all; line-height: 1.2;
  pointer-events: none;
}
.hero-content {
  position: relative; z-index: 1; text-align: center;
  padding: 4rem 1.5rem; color: var(--white);
}
.hero-badge {
  display: inline-block; background: rgba(212,168,67,.15); border: 1px solid var(--gold);
  color: var(--gold); padding: .4rem 1.2rem; border-radius: 50px;
  font-size: .9rem; font-weight: 700; margin-bottom: 1.5rem; letter-spacing: .05em;
}
.hero-content h1 {
  font-size: clamp(3rem, 8vw, 6rem); font-weight: 700;
  color: var(--white); margin-bottom: 1rem; text-shadow: 0 2px 20px rgba(0,0,0,.5);
}
.hero-content h1 span { color: var(--gold); }
.hero-subtitle { font-size: clamp(1rem, 2.5vw, 1.3rem); color: #ccc; margin-bottom: 2.5rem; max-width: 600px; margin-inline: auto; }
.hero-btns { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; margin-bottom: 3rem; }
.hero-stats {
  display: flex; gap: 3rem; justify-content: center; flex-wrap: wrap;
}
.hero-stats > div { text-align: center; }
.hero-stats strong { display: block; font-size: 2rem; color: var(--gold); font-family: 'Cinzel', serif; }
.hero-stats span { font-size: .9rem; color: #aaa; text-transform: uppercase; letter-spacing: .1em; }

/* ---- Filter Bar ---- */
.filter-bar { display: flex; gap: .6rem; flex-wrap: wrap; margin-bottom: 2rem; justify-content: center; }
.filter-btn {
  padding: .5rem 1.2rem; border: 2px solid var(--cream-dark); border-radius: 50px;
  background: var(--white); color: var(--text-light); font-weight: 700; cursor: pointer;
  transition: all var(--transition);
}
.filter-btn.active, .filter-btn:hover {
  border-color: var(--gold); background: var(--gold); color: var(--brown);
}

/* ---- Games Grid ---- */
.games-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1.5rem;
}
.game-card {
  background: var(--white); border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: var(--shadow); transition: all var(--transition); cursor: pointer;
  border: 2px solid transparent; text-decoration: none; color: inherit;
  display: flex; flex-direction: column;
}
.game-card:hover {
  transform: translateY(-6px); box-shadow: var(--shadow-lg);
  border-color: var(--gold); text-decoration: none;
}
.game-card-header {
  background: linear-gradient(135deg, var(--dark) 0%, var(--dark3) 100%);
  padding: 1.8rem; text-align: center; position: relative; overflow: hidden;
}
.game-card-header::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(circle at 50% 50%, rgba(212,168,67,.15) 0%, transparent 70%);
}
.game-icon { font-size: 2.8rem; display: block; margin-bottom: .5rem; position: relative; }
.game-difficulty {
  position: absolute; top: .8rem; right: .8rem;
  padding: .2rem .7rem; border-radius: 50px; font-size: .75rem; font-weight: 700;
}
.diff-facil { background: rgba(39,174,96,.2); color: #27ae60; border: 1px solid #27ae60; }
.diff-medio { background: rgba(243,156,18,.2); color: #f39c12; border: 1px solid #f39c12; }
.diff-dificil { background: rgba(231,76,60,.2); color: #e74c3c; border: 1px solid #e74c3c; }
.game-card-body { padding: 1.2rem 1.4rem; flex: 1; display: flex; flex-direction: column; }
.game-card-body h3 { font-size: 1.05rem; color: var(--dark); margin-bottom: .4rem; }
.game-card-body p { font-size: .85rem; color: var(--text-light); flex: 1; }
.game-card-footer {
  padding: .8rem 1.4rem; border-top: 1px solid var(--cream-dark);
  display: flex; align-items: center; justify-content: space-between;
}
.game-category { font-size: .8rem; color: var(--gold-dark); font-weight: 700; }
.game-score { font-size: .8rem; color: var(--text-light); }

/* ---- Ranking Table ---- */
.ranking-table-wrap { overflow-x: auto; }
.ranking-table { width: 100%; border-collapse: collapse; }
.ranking-table th {
  padding: 1rem 1.2rem; text-align: left; background: rgba(212,168,67,.1);
  color: var(--gold); font-family: 'Cinzel', serif; font-size: .9rem; letter-spacing: .05em;
}
.ranking-table td { padding: .9rem 1.2rem; border-bottom: 1px solid rgba(255,255,255,.05); color: #ddd; }
.ranking-table tr:hover td { background: rgba(212,168,67,.05); }
.rank-medal { font-size: 1.2rem; }
.loading-cell { text-align: center; color: #888; padding: 2rem; }

/* ---- Features ---- */
.features-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.5rem; }
.feature-card {
  background: var(--white); border-radius: var(--radius-lg); padding: 2rem 1.5rem;
  text-align: center; box-shadow: var(--shadow); border-top: 4px solid var(--gold);
  transition: transform var(--transition);
}
.feature-card:hover { transform: translateY(-4px); }
.feature-icon { font-size: 2.5rem; margin-bottom: 1rem; }
.feature-card h3 { font-size: 1.1rem; margin-bottom: .6rem; color: var(--dark); }
.feature-card p { font-size: .9rem; color: var(--text-light); }

/* ---- Footer ---- */
.footer {
  background: var(--dark); color: var(--white);
  padding: 2.5rem 0; margin-top: 0; border-top: 2px solid rgba(212,168,67,.3);
}
.footer-inner { display: flex; flex-direction: column; align-items: center; gap: 1rem; text-align: center; }
.footer-brand { display: flex; align-items: center; gap: .5rem; font-family: 'Cinzel', serif; font-size: 1.3rem; }
.footer-brand strong { color: var(--gold); }
.footer-links { display: flex; gap: 1.5rem; flex-wrap: wrap; justify-content: center; }
.footer-links a { color: #aaa; font-size: .9rem; }
.footer-links a:hover { color: var(--gold); }
.footer-copy { font-size: .82rem; color: #666; }

/* ---- Modals ---- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(0,0,0,.7); display: flex; align-items: center; justify-content: center;
  padding: 1rem; backdrop-filter: blur(4px);
  animation: fadeIn .2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: var(--white); border-radius: var(--radius-lg); padding: 2.5rem 2rem;
  width: 100%; max-width: 420px; position: relative;
  animation: slideDown .3s ease;
  box-shadow: 0 20px 60px rgba(0,0,0,.4);
}
@keyframes slideDown { from { transform: translateY(-20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-close {
  position: absolute; top: 1rem; right: 1rem;
  background: none; border: none; font-size: 1.2rem; cursor: pointer; color: var(--text-light);
  width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: var(--cream-dark); }
.modal-header { text-align: center; margin-bottom: 1.8rem; }
.modal-icon { display: block; font-size: 2.5rem; color: var(--gold); margin-bottom: .8rem; }
.modal-header h2 { font-size: 1.6rem; color: var(--dark); }
.modal-header p { color: var(--text-light); font-size: .95rem; }
.modal-form { display: flex; flex-direction: column; gap: 1rem; }
.form-group { display: flex; flex-direction: column; gap: .4rem; }
.form-group label { font-weight: 700; font-size: .9rem; color: var(--dark); }
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"] {
  padding: .7rem 1rem; border: 2px solid var(--cream-dark); border-radius: 8px;
  font-family: 'Nunito', sans-serif; font-size: .95rem; transition: border var(--transition);
}
.form-group input:focus { outline: none; border-color: var(--gold); }
.checkbox-group label { display: flex; align-items: flex-start; gap: .5rem; font-weight: 400; cursor: pointer; }
.checkbox-group input { margin-top: .2rem; accent-color: var(--gold); }
.form-error {
  background: rgba(231,76,60,.1); border: 1px solid var(--danger);
  color: var(--danger); padding: .6rem 1rem; border-radius: 8px; font-size: .9rem;
}
.form-success {
  background: rgba(39,174,96,.1); border: 1px solid var(--success);
  color: var(--success); padding: .6rem 1rem; border-radius: 8px; font-size: .9rem;
}
.modal-switch { text-align: center; margin-top: 1rem; font-size: .9rem; color: var(--text-light); }
.modal-switch button {
  background: none; border: none; color: var(--gold-dark); font-weight: 700;
  cursor: pointer; font-size: .9rem; font-family: 'Nunito', sans-serif;
}
.modal-switch button:hover { text-decoration: underline; }

/* ---- Game Pages ---- */
.game-page { min-height: 100vh; background: var(--cream); }
.game-header {
  background: linear-gradient(135deg, var(--dark) 0%, var(--dark3) 100%);
  color: var(--white); padding: 2rem 0;
}
.game-header-inner {
  max-width: 900px; margin: 0 auto; padding: 0 1.5rem;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
}
.game-back { color: var(--gold); font-size: 1.5rem; text-decoration: none; }
.game-title { flex: 1; }
.game-title h1 { font-size: 1.8rem; color: var(--white); }
.game-title p { color: #aaa; font-size: .9rem; }
.game-score-bar {
  display: flex; gap: 1.5rem; align-items: center;
}
.score-item { text-align: center; }
.score-item span { display: block; font-size: 1.4rem; font-weight: 800; color: var(--gold); }
.score-item small { font-size: .75rem; color: #aaa; }

.game-container { max-width: 900px; margin: 2rem auto; padding: 0 1.5rem; }
.game-box {
  background: var(--white); border-radius: var(--radius-lg); padding: 2rem;
  box-shadow: var(--shadow);
}

/* ---- Progress Bar ---- */
.progress-bar-wrap { background: var(--cream-dark); border-radius: 50px; height: 10px; overflow: hidden; margin: 1rem 0; }
.progress-bar { height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-light)); border-radius: 50px; transition: width .5s ease; }

/* ---- Result Screen ---- */
.result-screen { text-align: center; padding: 2rem 0; }
.result-score { font-size: 4rem; font-weight: 800; color: var(--gold); font-family: 'Cinzel', serif; }
.result-label { font-size: 1.1rem; color: var(--text-light); margin-bottom: 1rem; }
.result-stars { font-size: 2.5rem; margin-bottom: 1.5rem; }

/* ---- Toast notifications ---- */
.toast-container { position: fixed; top: 5rem; right: 1rem; z-index: 9998; display: flex; flex-direction: column; gap: .6rem; }
.toast {
  padding: .8rem 1.4rem; border-radius: 10px; font-weight: 700; font-size: .9rem;
  box-shadow: var(--shadow-lg); animation: slideLeft .3s ease;
  max-width: 320px;
}
@keyframes slideLeft { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }
.toast-success { background: #27ae60; color: #fff; }
.toast-error { background: var(--danger); color: #fff; }
.toast-info { background: var(--dark3); color: #fff; }

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-toggle { display: block; }
  .nav-links.open {
    display: flex; flex-direction: column; position: absolute;
    top: 100%; left: 0; right: 0; background: var(--dark);
    padding: 1rem 1.5rem; gap: .8rem; border-bottom: 1px solid rgba(212,168,67,.2);
  }
  .navbar { position: relative; }
  .hero-content h1 { font-size: 3rem; }
  .hero-stats { gap: 1.5rem; }
  .cookie-content { flex-direction: column; align-items: flex-start; }
}

@media (max-width: 480px) {
  .hero-btns { flex-direction: column; align-items: center; }
  .modal { padding: 2rem 1.2rem; }
}
