:root {
  --bg-primary: #0f172a;
  --bg-card: #1e293b;
  --bg-card-hover: #233449;
  --accent: #22d3ee;
  --accent-hover: #06b6d4;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --border: #334155;
  --shadow: 0 4px 6px -1px rgb(0 0 0 / 0.4);
  --shadow-lg: 0 10px 25px -5px rgb(0 0 0 / 0.5);
  --radius-card: 12px;
  --radius-btn: 8px;
  --radius-badge: 4px;
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, system-ui, sans-serif;
  background: var(--bg-primary);
  color: var(--text);
  line-height: 1.55;
  font-size: 16px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

img {
  max-width: 100%;
  height: auto;
  display: block;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover { color: var(--accent-hover); }

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.container {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 0 16px;
}

@media (min-width: 640px) {
  .container { max-width: 720px; }
}

@media (min-width: 1024px) {
  .container {
    max-width: 1200px;
    padding: 0 24px;
  }
}

.site-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow);
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.logo {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
}

.logo:hover {
  color: var(--text);
}

.logo-img {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  display: block;
}

.logo-text {
  letter-spacing: -0.3px;
  background: linear-gradient(135deg, #f5c869 0%, #d4a857 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}



.lang-toggle {
  display: flex;
  background: var(--bg-primary);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  overflow: hidden;
}

.lang-toggle button {
  padding: 6px 12px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-muted);
  transition: all 0.2s;
}

.lang-toggle button.active {
  background: var(--accent);
  color: var(--bg-primary);
}

.lang-toggle button:not(.active):hover {
  color: var(--text);
}

main {
  flex: 1;
  padding: 24px 0;
}

.site-footer {
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  padding: 24px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.site-footer a { color: var(--accent); }

.intro {
  margin-bottom: 16px;
}

.intro h1 {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.intro p {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.controls {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}

.search-input {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-btn);
  color: var(--text);
  font-size: 0.875rem;
  transition: border-color 0.2s;
}

.search-input::placeholder { color: var(--text-muted); }
.search-input:focus { outline: none; border-color: var(--accent); }

.filter-bar {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.filter-btn {
  padding: 6px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.2s;
}

.filter-btn:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

.filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--bg-primary);
}

.games-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 640px) {
  .games-grid { grid-template-columns: repeat(2, 1fr); gap: 20px; }
}

@media (min-width: 1024px) {
  .games-grid { grid-template-columns: repeat(3, 1fr); gap: 24px; }
}

@media (min-width: 1400px) {
  .games-grid { grid-template-columns: repeat(4, 1fr); gap: 20px; }
}

.game-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow);
}

.game-card:hover {
  transform: translateY(-2px);
  border-color: var(--accent);
  background: var(--bg-card-hover);
}

.game-card-cover {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
  background: var(--bg-primary);
}

.game-card-body {
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.game-card-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.game-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 8px;
  border-radius: var(--radius-badge);
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.badge-platform {
  background: var(--bg-primary);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.badge-gratis {
  background: var(--success);
  color: #022c22;
}

.badge-warning {
  background: var(--warning);
  color: #451a03;
}

.badge-danger {
  background: var(--danger);
  color: #450a0a;
}

.empty-state,
.error-state {
  text-align: center;
  padding: 48px 16px;
  color: var(--text-muted);
}

.empty-state h2,
.error-state h2 {
  color: var(--text);
  margin-bottom: 8px;
}

.retry-btn {
  margin-top: 16px;
  padding: 10px 20px;
  background: var(--accent);
  color: var(--bg-primary);
  border-radius: var(--radius-btn);
  font-weight: 600;
  transition: background 0.2s;
}

.retry-btn:hover { background: var(--accent-hover); color: var(--bg-primary); }

.detalle {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.detalle-cover-wrap {
  position: relative;
  border-radius: var(--radius-card);
  overflow: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border);
}

.detalle-cover {
  width: 100%;
  aspect-ratio: 16/9;
  object-fit: cover;
}

.detalle-badges {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.detalle-info {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.detalle-title {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
}

.detalle-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}

.meta-item {
  background: var(--bg-card);
  padding: 8px 12px;
  border-radius: var(--radius-btn);
  border: 1px solid var(--border);
}

.meta-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.meta-value {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
}

.detalle-descripcion {
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.6;
}

.countdown-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  padding: 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.countdown-circle {
  width: 120px;
  height: 120px;
  position: relative;
}

.countdown-circle svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.countdown-bg {
  fill: none;
  stroke: var(--bg-primary);
  stroke-width: 8;
}

.countdown-progress {
  fill: none;
  stroke: var(--accent);
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s linear;
}

.countdown-number {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.countdown-text {
  color: var(--text-muted);
  font-size: 0.875rem;
}

.download-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 24px;
  background: var(--success);
  color: #022c22;
  border-radius: var(--radius-btn);
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  transition: all 0.2s;
  min-height: 56px;
}

.btn-primary:hover {
  background: #059669;
  color: #022c22;
  filter: brightness(1.1);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  background: var(--bg-card);
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: var(--radius-btn);
  font-size: 0.9375rem;
  font-weight: 600;
  text-align: center;
  transition: all 0.2s;
  min-height: 48px;
}

.btn-secondary:hover {
  background: var(--accent);
  color: var(--bg-primary);
}

.ad-slot {
  margin: 24px auto;
  text-align: center;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ad-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  border: 2px dashed var(--border);
  border-radius: var(--radius-btn);
  color: var(--text-muted);
  font-size: 0.75rem;
  text-align: center;
  padding: 16px;
  width: 100%;
  max-width: 320px;
  min-height: 60px;
}

.ad-mobile, .ad-tablet { display: none; }
.ad-desktop { display: flex; }

@media (max-width: 1024px) {
  .ad-desktop { display: none; }
  .ad-tablet { display: flex; }
}

@media (max-width: 640px) {
  .ad-tablet { display: none; }
  .ad-mobile { display: flex; }
}

#sticky-bottom {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--bg-card);
  padding: 6px;
  border-top: 1px solid var(--border);
  justify-content: center;
  align-items: center;
  min-height: 60px;
}

@media (max-width: 640px) {
  #sticky-bottom.mobile-active { display: flex; }
}

.ad-sidebar {
  display: none;
}

@media (min-width: 1600px) {
  .ad-sidebar {
    display: block;
    position: fixed;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    width: 160px;
  }

  .ad-sidebar-left {
    left: max(16px, calc(50% - 784px));
  }

  .ad-sidebar-right {
    right: max(16px, calc(50% - 784px));
  }

  .ad-sidebar .ad-placeholder {
    width: 160px;
    height: 600px;
    max-width: 160px;
    font-size: 11px;
    margin: 0;
  }
}

.sidebar-widgets {
  display: none;
}

@media (min-width: 1600px) and (min-height: 700px) {
  .sidebar-widgets {
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: fixed;
    top: 80px;
    left: max(16px, calc(50% - 784px));
    width: 160px;
    z-index: 5;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
  }

  .sidebar-widgets::-webkit-scrollbar { display: none; }
}

.widget {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 10px;
  text-align: center;
  color: var(--text);
  box-shadow: var(--shadow);
}

.widget-icon {
  font-size: 22px;
  display: block;
  margin-bottom: 4px;
  line-height: 1;
}

.widget-title {
  font-size: 11px;
  font-weight: 700;
  margin-bottom: 4px;
  line-height: 1.2;
  color: var(--text);
}

.widget-text {
  font-size: 10px;
  color: var(--text-muted);
  line-height: 1.3;
  margin-bottom: 6px;
}

.widget-telegram {
  background: linear-gradient(135deg, #0088cc 0%, #229ed9 100%);
  border-color: transparent;
  color: white;
}

.widget-telegram .widget-title,
.widget-telegram .widget-text {
  color: white;
}

.widget-telegram .widget-cta {
  display: inline-block;
  margin-top: 4px;
  padding: 5px 10px;
  background: rgba(255, 255, 255, 0.95);
  color: #0088cc;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.2s;
}

.widget-telegram .widget-cta:hover {
  background: white;
  color: #0088cc;
}

.widget-countdown {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.widget-countdown-number {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  line-height: 1;
  margin: 4px 0 2px 0;
}

.widget-countdown-label {
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.widget-list {
  list-style: none;
  padding: 0;
  margin: 0;
  text-align: left;
}

.widget-list li {
  display: flex;
  flex-direction: column;
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
  font-size: 10px;
  gap: 2px;
}

.widget-list li:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.widget-list li:first-child {
  padding-top: 0;
}

.widget-trending-title {
  color: var(--text);
  font-weight: 600;
  line-height: 1.2;
  font-size: 10px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.widget-trending-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 9px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.widget-trending-days {
  color: var(--success);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.lang-hidden { display: none !important; }
