/* ════════════════════════════════════════════════════════════════════
   RobloCodes – estilos compartidos (home + páginas de juego)
══════════════════════════════════════════════════════════════════════ */

:root {
  --bg:           #fafafa;
  --surface:      #ffffff;
  --surface-2:    #f4f4f5;
  --border:       #e4e4e7;
  --border-strong:#d4d4d8;
  --text:         #18181b;
  --text-muted:   #71717a;
  --text-faint:   #a1a1aa;
  --accent:       #2563eb;
  --accent-soft:  #eff6ff;
  --green:        #16a34a;
  --green-soft:   #dcfce7;
  --orange:       #ea580c;
  --orange-soft:  #fff7ed;
  --red:          #dc2626;
  --red-soft:     #fef2f2;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:           #0a0a0a;
    --surface:      #111113;
    --surface-2:    #1a1a1d;
    --border:       #27272a;
    --border-strong:#3f3f46;
    --text:         #fafafa;
    --text-muted:   #a1a1aa;
    --text-faint:   #71717a;
    --accent:       #3b82f6;
    --accent-soft:  rgba(59,130,246,0.12);
    --green-soft:   rgba(22,163,74,0.15);
    --orange-soft:  rgba(234,88,12,0.15);
    --red-soft:     rgba(220,38,38,0.15);
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  }
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── NAVBAR ─────────────────────────────────────────────────────────── */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(250,250,250,0.85);
  backdrop-filter: saturate(180%) blur(12px);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}
@media (prefers-color-scheme: dark) {
  .nav { background: rgba(10,10,10,0.85); }
}
.nav-inner {
  max-width: 1100px; margin: 0 auto;
  padding: 14px 24px;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 17px;
  color: var(--text);
}
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px;
  background: var(--text);
  color: var(--bg);
  border-radius: 7px;
  display: grid; place-items: center;
  font-size: 15px; font-weight: 800;
}
.nav-links { display: flex; align-items: center; gap: 22px; }
.nav-links a {
  color: var(--text-muted);
  font-size: 14px; font-weight: 500;
}
.nav-links a:hover { color: var(--text); text-decoration: none; }
.nav-links a.active { color: var(--text); }
@media (max-width: 640px) {
  .nav-links { gap: 14px; font-size: 13px; }
  .nav-links a { font-size: 13px; }
}

/* ── BREADCRUMB ─────────────────────────────────────────────────────── */
.crumbs {
  max-width: 1100px;
  margin: 0 auto;
  padding: 18px 24px 0;
  font-size: 13px;
  color: var(--text-muted);
}
.crumbs a { color: var(--text-muted); }
.crumbs a:hover { color: var(--text); text-decoration: none; }
.crumbs .sep { margin: 0 8px; opacity: 0.5; }
.crumbs .current { color: var(--text); font-weight: 500; }

/* ── HERO ───────────────────────────────────────────────────────────── */
.hero {
  max-width: 1100px; margin: 0 auto;
  padding: 56px 24px 32px;
  text-align: center;
}
.hero h1 {
  font-size: clamp(2rem, 5vw, 3.25rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.1;
  margin-bottom: 16px;
}
.hero h1 .accent { color: var(--accent); }
.hero p {
  font-size: clamp(1rem, 1.8vw, 1.15rem);
  color: var(--text-muted);
  max-width: 620px;
  margin: 0 auto 28px;
}
.live-badge {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--green-soft);
  color: var(--green);
  padding: 6px 12px;
  border-radius: 100px;
  font-size: 13px; font-weight: 600;
  margin-bottom: 22px;
}
.live-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green);
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}
.stat-row {
  display: flex; justify-content: center; gap: 32px;
  flex-wrap: wrap;
}
.stat {
  display: flex; flex-direction: column;
  align-items: center; gap: 2px;
}
.stat-num { font-size: 1.5rem; font-weight: 700; color: var(--text); }
.stat-label { font-size: 13px; color: var(--text-muted); }

/* ── CONTAINER ──────────────────────────────────────────────────────── */
.container {
  max-width: 1100px; margin: 0 auto;
  padding: 0 24px;
}

/* ── ADSENSE SLOT ───────────────────────────────────────────────────── */
.ad-slot {
  margin: 32px auto;
  max-width: 728px;
  min-height: 90px;
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  border-radius: var(--r-md);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-faint);
  font-size: 12px;
  overflow: hidden;
}

/* ── TOOLBAR ────────────────────────────────────────────────────────── */
.toolbar {
  margin: 24px 0 28px;
}
.search-wrap {
  position: relative;
  width: 100%;
}
.search-wrap svg {
  position: absolute; left: 14px; top: 50%;
  transform: translateY(-50%);
  width: 16px; height: 16px;
  color: var(--text-faint);
  pointer-events: none;
}
.search-input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 14px 12px 40px;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.search-input::placeholder { color: var(--text-faint); }
.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

/* ── SECTION ────────────────────────────────────────────────────────── */
section { margin-top: 48px; }

.section-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 18px;
  flex-wrap: wrap; gap: 8px;
}
.section-head h2 {
  font-size: 1.3rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.section-head .meta {
  font-size: 13px;
  color: var(--text-muted);
}

.copy-all-btn {
  background: var(--text);
  color: var(--bg);
  border: none;
  border-radius: var(--r-sm);
  padding: 8px 14px;
  font-family: inherit;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: opacity .15s;
}
.copy-all-btn:hover { opacity: 0.85; }
.copy-all-btn svg { width: 14px; height: 14px; }

/* ── GRID ───────────────────────────────────────────────────────────── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

/* ── CODE CARD ──────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 18px;
  display: flex; flex-direction: column;
  gap: 14px;
  transition: border-color .15s, box-shadow .15s, transform .15s;
}
.card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.card.expired { opacity: 0.65; }

.card-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 8px;
}
.reward {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
}
.game-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 4px;
}

.badge {
  flex-shrink: 0;
  font-size: 11px; font-weight: 700;
  padding: 3px 8px;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge.new {
  background: var(--green-soft);
  color: var(--green);
}
.badge.expired {
  background: var(--red-soft);
  color: var(--red);
}

.code-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 12px 14px;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--text);
  word-break: break-all;
  user-select: all;
}

.card-foot {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
}
.card-foot .expires {
  font-size: 12px;
  color: var(--text-faint);
}

.btn-copy {
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 7px 14px;
  font-family: inherit;
  font-size: 13px; font-weight: 600;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: all .12s;
}
.btn-copy:hover {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}
.btn-copy.done {
  background: var(--green-soft);
  color: var(--green);
  border-color: var(--green-soft);
}
.btn-copy svg { width: 13px; height: 13px; }

/* ── EMPTY / LOADING ────────────────────────────────────────────────── */
.state-box {
  grid-column: 1 / -1;
  padding: 56px 24px;
  text-align: center;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
}
.state-box h3 {
  font-size: 1.05rem;
  color: var(--text);
  margin-bottom: 6px;
}
.state-box p { font-size: 14px; }

.skel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  height: 180px;
  position: relative;
  overflow: hidden;
}
.skel::after {
  content: '';
  position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, var(--surface-2), transparent);
  animation: shimmer 1.4s infinite;
}
@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

/* ── GAME GRID (home) ───────────────────────────────────────────────── */
.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  margin-top: 24px;
}
.game-card {
  display: flex; flex-direction: column;
  gap: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 22px;
  color: var(--text);
  transition: all .15s;
  position: relative;
  overflow: hidden;
}
.game-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
  text-decoration: none;
}
.game-card-head {
  display: flex; align-items: center;
  gap: 12px;
}
.game-icon {
  width: 44px; height: 44px;
  border-radius: 10px;
  background: var(--surface-2);
  display: grid; place-items: center;
  font-size: 22px;
  flex-shrink: 0;
}
.game-card h3 {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 1px;
}
.game-card .game-sub {
  font-size: 12px;
  color: var(--text-muted);
}
.game-card-stats {
  display: flex; gap: 18px;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 12px;
  margin-top: auto;
}
.game-card-stats b {
  display: block;
  color: var(--text);
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 1px;
}
.game-card .arrow {
  position: absolute; top: 22px; right: 22px;
  opacity: 0.4;
  transition: transform .15s, opacity .15s;
}
.game-card:hover .arrow {
  opacity: 1;
  transform: translateX(3px);
}

/* ── FAQ / PROSE ────────────────────────────────────────────────────── */
.prose {
  max-width: 720px;
  margin: 0 auto;
  color: var(--text);
}
.prose p {
  color: var(--text-muted);
  margin-bottom: 14px;
}
.prose h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 24px 0 8px;
}
.prose ol, .prose ul { margin: 8px 0 14px 20px; color: var(--text-muted); }
.prose li { margin-bottom: 4px; }

.faq-item {
  border-bottom: 1px solid var(--border);
  padding: 16px 0;
}
.faq-item summary {
  list-style: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after {
  content: '+';
  font-size: 20px; font-weight: 400;
  color: var(--text-muted);
  transition: transform .2s;
}
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item p {
  margin-top: 10px;
  color: var(--text-muted);
  font-size: 14px;
}

/* ── POST LIST (estilo blog) ────────────────────────────────────────── */
.post-list {
  margin-top: 12px;
}
.post-item {
  display: flex;
  gap: 22px;
  padding: 22px 0;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  transition: background .15s;
}
.post-item:hover {
  text-decoration: none;
  background: var(--surface);
  border-radius: var(--r-md);
  padding-left: 14px;
  padding-right: 14px;
  margin-left: -14px;
  margin-right: -14px;
}
.post-item:last-child { border-bottom: 0; }

.post-thumb {
  flex-shrink: 0;
  width: 200px;
  height: 120px;
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface-2);
}
.post-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.post-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
}
.post-title {
  font-size: 1.2rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.25;
  margin: 0;
  color: var(--text);
}
.post-item:hover .post-title { color: var(--accent); }
.post-excerpt {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
  margin: 0;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}
.post-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 2px;
  flex-wrap: wrap;
}
.post-meta .meta-tag {
  font-size: 11px; font-weight: 700;
  padding: 2px 8px;
  border-radius: 100px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.post-meta .meta-tag.new {
  background: var(--green-soft);
  color: var(--green);
}
.post-meta .meta-dot::before {
  content: '·';
  margin-right: 10px;
  opacity: 0.5;
}
.post-meta .meta-dot:first-child::before { display: none; }

@media (max-width: 640px) {
  .post-item { flex-direction: column; gap: 12px; }
  .post-thumb { width: 100%; height: 180px; }
  .post-title { font-size: 1.05rem; }
}

/* ── DETALLE DE JUEGO ─────────────────────────────────────────────── */
.detail-hero {
  display: flex;
  gap: 28px;
  align-items: center;
  padding: 32px 0;
}
.detail-thumb {
  flex-shrink: 0;
  width: 240px;
  height: 240px;
  border-radius: var(--r-lg);
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: var(--shadow-md);
}
.detail-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.detail-info { flex: 1; min-width: 0; }
.detail-info h1 {
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 12px;
}
.detail-info p {
  color: var(--text-muted);
  font-size: 1rem;
  margin-bottom: 16px;
  max-width: 560px;
}
.detail-stats {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  font-size: 14px;
  color: var(--text-muted);
}
.detail-stats strong {
  display: inline-block;
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
  margin-right: 5px;
}

@media (max-width: 720px) {
  .detail-hero { flex-direction: column; align-items: flex-start; padding: 22px 0; }
  .detail-thumb { width: 100%; height: 220px; }
}

.back-row { margin: 40px 0; text-align: center; }
.back-link {
  display: inline-block;
  padding: 10px 18px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  font-weight: 600;
  font-size: 14px;
}
.back-link:hover {
  background: var(--surface);
  border-color: var(--border-strong);
  text-decoration: none;
}

.expired-wrap { margin-top: 18px; }

/* ── EXPIRED SECTION ────────────────────────────────────────────────── */
.expired-toggle {
  display: inline-flex; align-items: center; gap: 6px;
  background: none; border: none;
  color: var(--text-muted);
  font-family: inherit; font-size: 14px; font-weight: 500;
  cursor: pointer;
  padding: 4px 0;
}
.expired-toggle:hover { color: var(--text); }
.expired-toggle svg { width: 14px; height: 14px; transition: transform .2s; }
.expired-toggle.open svg { transform: rotate(180deg); }

.expired-grid {
  display: none;
  margin-top: 18px;
}
.expired-grid.show { display: grid; }

/* ── FOOTER ─────────────────────────────────────────────────────────── */
footer {
  margin-top: 80px;
  padding: 40px 24px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.footer-inner {
  max-width: 1100px; margin: 0 auto;
  display: flex; flex-wrap: wrap; gap: 24px;
  justify-content: space-between;
  align-items: flex-start;
}
.footer-col h4 {
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.footer-col a {
  display: block;
  color: var(--text);
  font-size: 14px;
  padding: 3px 0;
}
.footer-bottom {
  max-width: 1100px;
  margin: 24px auto 0;
  padding-top: 20px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-faint);
  text-align: center;
}

/* ── TOAST ──────────────────────────────────────────────────────────── */
#toast {
  position: fixed; bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: var(--bg);
  padding: 10px 18px;
  border-radius: 100px;
  font-size: 13px; font-weight: 600;
  box-shadow: var(--shadow-md);
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .25s;
  z-index: 100;
}
#toast.show {
  opacity: 1; transform: translateX(-50%) translateY(0);
}

/* ── LEGAL / STATIC PAGES (privacy, terms, about) ─────────────────── */
.legal-page {
  max-width: 760px;
  padding: 48px 24px 80px;
}
.legal-header {
  margin-bottom: 40px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
}
.legal-header h1 {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin: 0 0 8px;
}
.legal-updated {
  color: var(--text-faint);
  font-size: 14px;
  margin: 0;
}
.legal-page .prose h2 {
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-top: 36px;
  margin-bottom: 12px;
}
.legal-page .prose h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-top: 24px;
  margin-bottom: 8px;
  color: var(--text);
}
.legal-page .prose p,
.legal-page .prose ul,
.legal-page .prose ol {
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.7;
}
.legal-page .prose a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}
.legal-page .prose strong { color: var(--text); }

.nav-links a[aria-current="page"] {
  color: var(--text);
  font-weight: 600;
}

/* ── TIER LIST ─────────────────────────────────────────────────────── */
.tier-section { margin-top: 48px; }
.tier-intro {
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.6;
  margin: 0 0 20px;
  max-width: 720px;
}
.tier-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  border-radius: var(--r-md);
  overflow: hidden;
  border: 1px solid var(--border);
}
.tier-row {
  display: flex;
  align-items: stretch;
  background: var(--panel);
  min-height: 72px;
}
.tier-label {
  width: 110px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  text-align: center;
  padding: 8px 6px;
}
.tier-letter {
  font-size: 28px;
  line-height: 1;
  letter-spacing: -0.02em;
}
.tier-sublabel {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 4px;
  opacity: 0.85;
}
.tier-S { background: linear-gradient(135deg, #ffd93d 0%, #ff9505 100%); color: #2a1500; }
.tier-A { background: linear-gradient(135deg, #ff8855 0%, #ff4d4d 100%); color: #fff; }
.tier-B { background: linear-gradient(135deg, #5dadec 0%, #3a7bd5 100%); color: #fff; }
.tier-C { background: linear-gradient(135deg, #4ecdc4 0%, #2bb673 100%); color: #fff; }
.tier-D { background: linear-gradient(135deg, #9aa1ab 0%, #6c757d 100%); color: #fff; }

.tier-items {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 14px 18px;
  flex: 1;
}
.tier-item {
  padding: 7px 14px;
  background: var(--panel-2, var(--bg));
  border: 1px solid var(--border);
  border-radius: 100px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
}
.tier-disclaimer {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 14px;
}

@media (max-width: 640px) {
  .tier-label { width: 72px; }
  .tier-letter { font-size: 22px; }
  .tier-sublabel { font-size: 9px; }
  .tier-items { padding: 10px 12px; gap: 6px; }
  .tier-item { padding: 5px 10px; font-size: 12px; }
}

/* ── RESPONSIVE ─────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .hero { padding: 40px 20px 24px; }
  .container { padding: 0 20px; }
  .stat-row { gap: 20px; }
}
