/* ============================================
   ELDARDO.NET - App Styles
   Material Design 3 - Dark Theme
   ============================================ */

/* === CSS Variables === */
:root {
  /* Dark Theme (default) - Original eldardo colors */
  --bg: #0b0e10;
  --bg-elevated: #12161a;
  --panel: #1a1f24;
  --surface: #22282e;
  --fg: #e3e3e3;
  --fg-dim: #a0a5aa;
  --muted: #6e7378;
  --border: #2a3038;
  --border-subtle: #1e2328;
  --brand: #ff914d;
  --brand-dim: rgba(255, 145, 77, 0.15);
  --brand-hover: #ffab70;
  --success: #4ade80;
  --error: #f87171;
  --warning: #fbbf24;

  /* Elevation shadows */
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3), 0 1px 2px rgba(0, 0, 0, 0.24);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.35), 0 2px 4px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.4), 0 4px 8px rgba(0, 0, 0, 0.3);

  /* MD3 Radii - More rounded */
  --radius-xs: 8px;
  --radius-sm: 12px;
  --radius-md: 16px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --radius-full: 9999px;

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 16px;
  --space-lg: 24px;
  --space-xl: 32px;

  /* Layout */
  --topbar-h: 60px;
  --theme-overlay: rgba(11, 14, 16, 0.92);
}

/* Light Theme */
html[data-theme='light'] {
  --bg: #f8f9fa;
  --bg-elevated: #ffffff;
  --panel: #ffffff;
  --surface: #f1f3f5;
  --fg: #1a1a1a;
  --fg-dim: #555555;
  --muted: #888888;
  --border: #e1e4e8;
  --border-subtle: #f0f0f0;
  --brand-dim: rgba(255, 145, 77, 0.12);
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.08), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.1), 0 2px 4px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.12), 0 4px 8px rgba(0, 0, 0, 0.06);
  --theme-overlay: rgba(255, 255, 255, 0.95);
}

/* === Base Reset === */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: 'Inter', 'SF Pro Display', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  padding-top: var(--topbar-h);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* === Topbar === */
.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  height: var(--topbar-h);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  transition: background 0.3s ease, border-color 0.3s ease;
}

/* Header transparente al hacer scroll */
.topbar.scrolled {
  background: rgba(18, 22, 26, 0.85);
  border-color: rgba(42, 48, 56, 0.5);
}

html[data-theme='light'] .topbar.scrolled {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(225, 228, 232, 0.5);
}

.topbar .left img {
  height: 32px;
  transition: transform 0.2s ease;
  cursor: pointer;
}

.topbar .left img:hover {
  transform: scale(1.05);
}

.topbar .right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  position: relative;
  white-space: nowrap;
}

/* User Chip - MD3 Style */
.user-chip {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-full);
  padding: 6px 14px 6px 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.user-chip:hover {
  background: var(--brand-dim);
  border-color: var(--brand);
}

.user-chip img {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}

.user-chip .username {
  max-width: 140px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--fg);
  font-weight: 600;
  font-size: 13px;
}

/* Profile Menu - MD3 */
.topbar .menu {
  position: absolute;
  right: 0;
  top: 56px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  min-width: 240px;
  box-shadow: var(--shadow-lg);
  display: none;
  padding: var(--space-sm);
  animation: menuFadeIn 0.15s ease;
}

@keyframes menuFadeIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.topbar .menu.open {
  display: block;
}

.menu .menu-item {
  width: 100%;
  display: flex;
  gap: var(--space-sm);
  align-items: center;
  padding: var(--space-sm) var(--space-md);
  background: transparent;
  border: 0;
  color: var(--fg);
  cursor: pointer;
  text-decoration: none;
  border-radius: var(--radius-sm);
  outline: none;
  font-size: 14px;
  transition: all 0.15s ease;
}

.menu .menu-item:hover,
.menu .menu-item:focus-visible {
  background: var(--brand-dim);
  color: var(--brand);
}

/* Register Button - MD3 Filled */
.register {
  background: var(--brand);
  color: white;
  border: none;
  border-radius: var(--radius-xl);
  padding: 10px 18px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.register:hover {
  background: var(--brand-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

/* DardoPoints Chip */
.dp-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-full);
  padding: 6px 12px;
  cursor: pointer;
  margin-right: var(--space-sm);
  transition: all 0.2s ease;
}

.dp-chip:hover {
  background: var(--brand-dim);
  border-color: var(--brand);
}

.dp-chip img {
  width: 18px;
  height: 18px;
  display: block;
}

.dp-chip #dpAmount {
  color: #ffd166;
  font-weight: 800;
  font-size: 14px;
  min-width: 24px;
  text-align: right;
}

/* === Marquee === */
.marquee {
  flex: 1;
  overflow: hidden;
  display: flex;
  align-items: center;
}

.marquee .scrolling-wrapper {
  --speed: 50s;
  display: flex;
  animation: scroll-infinite var(--speed) linear infinite;
  will-change: transform;
  color: var(--fg-dim);
}

.marquee:hover .scrolling-wrapper {
  animation-play-state: paused;
}

.marquee .scrolling-text {
  color: inherit;
  font-weight: inherit;
  font-style: inherit;
  white-space: pre;
}

@keyframes scroll-infinite {
  0% {
    transform: translateX(0);
  }

  100% {
    transform: translateX(-50%);
  }
}

/* === Container === */
.container {
  max-width: 1360px;
  margin: 0 auto;
  padding: var(--space-md);
}

/* === Search Bar - MD3 === */
.searchbar {
  display: flex;
  justify-content: center;
  margin: var(--space-md) 0;
}

.search-form {
  display: flex;
  gap: var(--space-sm);
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
}

.search-form .input-group {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: var(--radius-xl);
  overflow: hidden;
  transition: all 0.2s ease;
}

.search-form .input-group:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-dim);
}

.search-form .input-group input {
  border: 0;
  background: transparent;
  color: var(--fg);
  padding: 12px 16px;
  min-width: 320px;
  font-size: 15px;
}

.search-form .input-group input::placeholder {
  color: var(--muted);
}

.search-form .input-group input:focus {
  outline: none;
}

.search-form .input-group .btn {
  border-radius: 0;
  border: 0;
  border-left: 1px solid var(--border);
}

/* === Buttons - MD3 === */
.btn {
  background: var(--brand);
  border: none;
  color: #fff;
  padding: 12px 18px;
  border-radius: var(--radius-xl);
  cursor: pointer;
  font-weight: 600;
  font-size: 14px;
  display: inline-flex;
  align-items: center;
  gap: var(--space-xs);
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.btn:hover {
  background: var(--brand-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.btn:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--fg);
  box-shadow: none;
}

.btn-secondary:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-dim);
}

/* Searchbar actions container */
.searchbar-actions {
  display: flex;
  gap: var(--space-sm);
}

/* Searchbar favorite button - hidden on desktop (shown in sidebar) */
.searchbar-fav-btn {
  display: none;
  text-decoration: none;
}

.searchbar-fav-btn.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.searchbar-fav-btn.active:hover {
  background: var(--brand-hover);
}

/* === Layout === */
.layout {
  display: block;
}

@media(min-width: 1024px) {
  .filters {
    float: left;
    width: 260px;
    margin-right: var(--space-lg);
  }

  .layout::after {
    content: "";
    display: block;
    clear: both;
  }
}

/* === Filters - MD3 Cards === */
.filters .box {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--panel);
  padding: var(--space-md);
  margin-bottom: var(--space-md);
  box-shadow: var(--shadow-sm);
}

.box-title {
  font-weight: 700;
  margin-bottom: var(--space-sm);
  color: var(--fg);
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Chips - MD3 Input Chips */
.chip {
  display: inline-block;
  border: 1px solid var(--border);
  background: var(--surface);
  padding: var(--space-sm) 14px;
  border-radius: var(--radius-full);
  margin: var(--space-xs) var(--space-xs) 0 0;
  text-decoration: none;
  color: var(--fg-dim);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.15s ease;
}

.chip:hover {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-dim);
}

.chip.active {
  border-color: var(--brand);
  color: #fff;
  background: var(--brand);
}

.tags {
  display: flex;
  flex-wrap: wrap;
}

.tags .chip {
  font-size: 12px;
  padding: 6px 10px;
}

/* === Game Grid - MD3 === */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-md);
}

@media(max-width: 500px) {
  .grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: var(--space-sm);
  }
}

.grid-below {
  clear: both;
  margin-top: var(--space-md);
}

/* === Game Cards - MD3 === */
.card {
  position: relative;
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: var(--radius-lg);
  overflow: hidden;
  aspect-ratio: 5/6;
  transition: all 0.25s ease;
  box-shadow: var(--shadow-sm);
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
  border-color: var(--brand);
}

.card-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.card-bg img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.card:hover .card-bg img {
  transform: scale(1.05);
}

.card-overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-sm);
  background: linear-gradient(to top,
      rgba(0, 0, 0, 0.85) 0%,
      rgba(0, 0, 0, 0.5) 60%,
      transparent 100%);
  display: flex;
  align-items: flex-end;
}

.card-actions {
  display: flex;
  align-items: center;
  width: 100%;
  gap: var(--space-sm);
}

/* Play Button - MD3 */
.play-btn {
  flex: 1;
  min-width: 0;
  /* Allow shrinking */
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  background: var(--brand);
  border: none;
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.play-btn:hover {
  background: var(--brand-hover);
  transform: translateY(-1px);
}

.play-btn span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  font-size: 13px;
}

.card-icons {
  display: flex;
  flex-shrink: 0;
  /* Never shrink icons */
  gap: 4px;
}

.icon-btn {
  border: none;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  border-radius: var(--radius-sm);
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: var(--brand);
  transform: scale(1.1);
}

/* Card Top Actions - Info & Favorite buttons */
.card-top-actions {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  display: flex;
  gap: 6px;
  z-index: 5;
  opacity: 0;
  transform: translateY(-8px);
  transition: all 0.25s ease;
}

.card:hover .card-top-actions {
  opacity: 1;
  transform: translateY(0);
}

.card-top-actions .icon-btn {
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.card-top-actions .icon-btn:hover {
  background: var(--brand);
  border-color: var(--brand);
}

.card-top-actions .icon-btn.active {
  color: var(--brand);
}

.icon-btn.favorite.active .material-symbols-outlined {
  color: #ff3b30;
  font-variation-settings: 'FILL' 1;
}

/* === Game Info Modal - MD3 === */
.game-info-modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.game-info-modal.open {
  opacity: 1;
  pointer-events: auto;
}

.game-info-content {
  position: relative;
  width: min(90vw, 480px);
  max-height: min(85vh, 600px);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modalSlideIn 0.25s ease;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: scale(0.95) translateY(16px);
  }

  to {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.game-info-header {
  position: relative;
  height: 150px;
  overflow: hidden;
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--surface);
}

.game-info-header img {
  width: 120px;
  height: 120px;
  object-fit: cover;
  border-radius: var(--radius-md);
  border: 2px solid var(--border);
  box-shadow: var(--shadow-md);
}

.game-info-body {
  padding: var(--space-lg);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.game-info-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 var(--space-md);
  text-align: center;
  color: var(--fg);
}

.game-info-desc {
  color: var(--fg-dim);
  line-height: 1.6;
  white-space: pre-line;
  margin-bottom: var(--space-lg);
}

.game-info-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: auto;
}

.game-info-tag {
  font-size: 12px;
  color: var(--brand);
  background: var(--brand-dim);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-weight: 500;
}

.game-info-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 20px;
  transition: all 0.2s ease;
}

.game-info-close:hover {
  background: var(--brand);
  transform: scale(1.1);
}

/* === General Modals - MD3 === */
.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  overflow: hidden;
  cursor: pointer;
}

.modal[hidden] {
  display: none;
}

.modal-content {
  position: relative;
  width: min(95vw, 400px);
  max-width: 95vw;
  max-height: 85vh;
  background: var(--panel);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  cursor: default;
  animation: modalSlideIn 0.25s ease;
}

.modal-content iframe#addGameFrame {
  min-height: 380px;
}

.modal .close {
  position: absolute;
  top: 8px;
  right: 10px;
  background: transparent;
  border: 0;
  color: var(--fg);
  font-size: 28px;
  cursor: pointer;
  z-index: 2;
  transition: color 0.2s ease;
}

.modal .close:hover {
  color: var(--brand);
}

.modal iframe {
  width: 100%;
  height: auto;
  border: 0;
  background: transparent;
  display: block;
  min-height: 300px;
  max-width: 100%;
}

body:has(.modal:not([hidden])) {
  overflow: hidden;
}

/* DardoPoints & Auth modal: always white */
#dpModal .modal-content,
#authModal .modal-content {
  background: #ffffff !important;
  color: #1a1a1a !important;
  border-color: #e1e4e8 !important;
}

#dpModal .close,
#authModal .close {
  color: #1a1a1a !important;
}

#authModal iframe {
  background: #ffffff;
}

/* === Footer - MD3 === */
.site-footer {
  margin-top: var(--space-xl);
  border-top: 1px solid var(--border);
  background: var(--bg-elevated);
  padding: var(--space-lg) var(--space-md);
}

.site-footer-inner {
  max-width: 1360px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  text-align: center;
}

.site-footer .footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: var(--space-sm) var(--space-lg);
}

.site-footer .footer-links a {
  color: var(--fg-dim);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  transition: color 0.2s ease;
}

.site-footer .footer-links a:hover {
  color: var(--brand);
}

.site-footer .legal {
  font-size: 13px;
  color: var(--muted);
}

.site-footer .legal a.brand {
  color: var(--brand);
  text-decoration: none;
  font-weight: 600;
}

.site-footer .version-box {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  color: var(--fg-dim);
  font-size: 12px;
  white-space: nowrap;
  background: var(--surface);
}

/* Footer Settings (Theme & Language selectors) */
.footer-settings {
  display: flex;
  gap: var(--space-lg);
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
}

.footer-settings .setting-group {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.footer-settings label {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--fg-dim);
  font-size: 13px;
  font-weight: 500;
}

.footer-settings select {
  background: var(--surface);
  color: var(--fg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.footer-settings select:hover {
  border-color: var(--brand);
}

.footer-settings select:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-dim);
}

@media(max-width: 600px) {
  .site-footer .footer-links {
    flex-direction: column;
    gap: var(--space-sm);
  }

  .footer-settings {
    flex-direction: column;
    gap: var(--space-sm);
  }
}

/* === Language Switcher - MD3 FAB === */
.lang-switcher {
  position: fixed;
  right: var(--space-md);
  bottom: var(--space-md);
  z-index: 50;
}

.lang-switcher .lang-btn {
  background: var(--brand);
  color: #fff;
  border: 0;
  border-radius: var(--radius-full);
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: all 0.2s ease;
}

.lang-switcher .lang-btn:hover {
  background: var(--brand-hover);
  transform: scale(1.1);
  box-shadow: var(--shadow-lg);
}

.lang-menu {
  position: absolute;
  bottom: 56px;
  right: 0;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--space-xs);
  min-width: 150px;
  animation: menuFadeIn 0.15s ease;
}

.lang-option {
  width: 100%;
  display: flex;
  align-items: center;
  padding: var(--space-sm) var(--space-md);
  background: transparent;
  border: 0;
  color: var(--fg);
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: 14px;
  transition: all 0.15s ease;
}

.lang-option:hover {
  background: var(--brand-dim);
  color: var(--brand);
}

/* === Ad/Promo Card === */
.ad-card,
.promo-card {
  border-style: dashed;
  border-color: var(--border);
}

.ad-card .ad-wrapper,
.promo-card .card-bg {
  background: var(--surface);
}

.promo-badge {
  position: absolute;
  top: var(--space-sm);
  left: var(--space-sm);
  background: var(--brand);
  color: #fff;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
}

/* === Empty State === */
.empty {
  opacity: 0.7;
  padding: var(--space-xl) 0;
  text-align: center;
  color: var(--muted);
}

/* === Loader Spinner === */
#gridLoader svg circle[stroke-opacity] {
  stroke: var(--brand);
}

#gridLoader svg path {
  stroke: var(--brand);
}

/* === Scrollbar Styling (for WebKit browsers) === */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: var(--bg);
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: var(--radius-full);
  border: 2px solid var(--bg);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted);
}

/* === Focus States for Accessibility === */
*:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

/* === Transitions for Theme Switch === */
body,
.topbar,
.filters .box,
.card,
.modal-content,
.site-footer {
  transition: background-color 0.3s ease, border-color 0.3s ease;
}

/* ============================================
   MOBILE RESPONSIVE STYLES
   ============================================ */

/* Tablets and below */
@media (max-width: 768px) {
  :root {
    --topbar-h: 56px;
  }

  .container {
    padding: var(--space-sm);
  }

  /* Topbar mobile */
  .topbar {
    padding: var(--space-xs) var(--space-sm);
    gap: var(--space-sm);
  }

  .topbar .left img {
    height: 32px;
  }

  /* Hide username on mobile, show only avatar */
  .user-chip .username {
    display: none;
  }

  .user-chip {
    padding: 4px;
    border-radius: 50%;
  }

  .user-chip img {
    width: 32px;
    height: 32px;
  }

  /* DardoPoints chip compact */
  .dp-chip {
    padding: 4px 8px;
    gap: 4px;
  }

  .dp-chip img {
    width: 18px;
    height: 18px;
  }

  .dp-chip span {
    font-size: 12px;
  }

  /* Register button compact */
  .register {
    padding: 6px 12px;
    font-size: 12px;
  }

  /* Search bar mobile */
  .searchbar {
    flex-direction: column;
    gap: var(--space-sm);
  }

  .search-form {
    flex-direction: column;
    gap: var(--space-sm);
  }

  .search-form .input-group {
    width: 100%;
    border-radius: var(--radius-md);
  }

  .search-form .input-group input {
    min-width: 0;
    flex: 1;
    padding: 10px 12px;
    font-size: 14px;
  }

  .search-form .btn {
    padding: 10px 14px;
    font-size: 13px;
  }

  /* Show favorite button in searchbar on mobile */
  .searchbar-fav-btn {
    display: inline-flex;
  }

  /* Hide button text on mobile, show only icons */
  .searchbar-actions .btn .btn-text {
    display: none;
  }

  .searchbar-actions .btn {
    padding: 10px 12px;
  }

  /* Filters sidebar on mobile */
  .filters {
    margin-bottom: var(--space-md);
  }

  /* Hide tags and favorites box on mobile (fav is in searchbar now) */
  .filters .box[data-box="tags"],
  .filters .box[data-box="favorites"] {
    display: none;
  }

  /* Order box with more padding */
  .filters .box[data-box="order"] {
    padding: var(--space-md);
    margin-bottom: var(--space-sm);
  }

  .filters .box {
    padding: var(--space-sm);
    margin-bottom: var(--space-sm);
  }

  .box-title {
    font-size: 12px;
  }

  .chip {
    padding: 6px 10px;
    font-size: 12px;
  }

  .tags .chip {
    font-size: 11px;
    padding: 4px 8px;
  }

  /* Cards on mobile */
  .card {
    border-radius: var(--radius-md);
  }

  /* Always show card-top-actions on mobile (no hover) */
  .card-top-actions {
    opacity: 1;
    transform: translateY(0);
  }

  .card-top-actions .icon-btn {
    width: 30px;
    height: 30px;
  }

  .card-top-actions .icon-btn .material-symbols-outlined {
    font-size: 18px;
  }

  .play-btn {
    padding: 8px 10px;
  }

  .play-btn span {
    font-size: 12px;
  }

  /* Modals on mobile */
  .modal-content {
    width: 95vw;
    max-height: 90vh;
    border-radius: var(--radius-md);
  }

  .game-info-content {
    width: 95vw;
    max-height: 90vh;
  }

  .game-info-header {
    height: 120px;
  }

  .game-info-header img {
    width: 90px;
    height: 90px;
  }

  .game-info-body {
    padding: var(--space-md);
  }

  .game-info-title {
    font-size: 18px;
  }

  /* Menu dropdown mobile */
  .menu {
    right: 0;
    left: auto;
    min-width: 180px;
  }

  .menu-item {
    padding: 10px 14px;
    font-size: 13px;
  }

  /* Footer mobile */
  .site-footer {
    padding: var(--space-md) var(--space-sm);
  }

  .footer-settings .setting-group {
    flex-direction: column;
    gap: 4px;
    align-items: flex-start;
  }

  .footer-settings label {
    font-size: 12px;
  }

  .footer-settings select {
    width: 100%;
    padding: 8px 10px;
  }
}

/* Small phones */
@media (max-width: 400px) {
  .container {
    padding: var(--space-xs);
  }

  .grid {
    grid-template-columns: repeat(2, 1fr);
    gap: var(--space-xs);
  }

  .card {
    aspect-ratio: 4/5;
  }

  .card-top-actions {
    top: 4px;
    right: 4px;
    gap: 4px;
  }

  .card-top-actions .icon-btn {
    width: 26px;
    height: 26px;
  }

  .card-top-actions .icon-btn .material-symbols-outlined {
    font-size: 16px;
  }

  .card-overlay {
    padding: var(--space-xs);
  }

  .play-btn {
    padding: 6px 8px;
  }

  .play-btn span {
    font-size: 11px;
  }

  .filters .box {
    padding: var(--space-xs);
  }

  .chip {
    padding: 5px 8px;
    font-size: 11px;
  }

  .btn {
    padding: 8px 12px;
    font-size: 12px;
  }

  .topbar .left img {
    height: 28px;
  }

  .dp-chip {
    padding: 3px 6px;
  }

  .dp-chip img {
    width: 16px;
    height: 16px;
  }

  .register {
    padding: 5px 10px;
    font-size: 11px;
  }

  .site-footer .footer-links {
    gap: var(--space-xs);
  }

  .site-footer .footer-links a {
    font-size: 12px;
  }

  .site-footer .legal {
    font-size: 11px;
  }

  .site-footer .version-box {
    font-size: 11px;
    padding: 4px 8px;
  }
}

/* Touch-friendly improvements */
@media (hover: none) and (pointer: coarse) {

  /* Cards: always show action buttons on touch devices */
  .card-top-actions {
    opacity: 1;
    transform: translateY(0);
  }

  /* No hover scale effects on touch */
  .card:hover {
    transform: none;
  }

  .card:active {
    transform: scale(0.98);
  }

  /* Larger touch targets */
  .icon-btn {
    min-width: 44px;
    min-height: 44px;
  }

  .chip {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
  }

  .btn {
    min-height: 44px;
  }

  /* Remove hover background changes that look stuck on touch */
  .chip:hover {
    background: var(--surface);
    border-color: var(--border);
    color: var(--fg-dim);
  }

  .chip.active:hover {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
  }
}

/* === Ad Card Styles === */
.card.ad-card {
  background: var(--panel);
  border: 2px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}

.card.ad-card:hover {
  transform: none;
  border-color: var(--muted);
}

.card.ad-card .card-bg.ad-card-bg {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}

.card.ad-card .ad-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  padding: var(--space-sm);
}

.card.ad-card .ad-label {
  position: absolute;
  top: var(--space-sm);
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  background: var(--surface);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  z-index: 5;
}

.card.ad-card .ad-content {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.card.ad-card .ad-content iframe {
  max-width: 100%;
  max-height: 100%;
  border: none;
}

/* Light theme adjustments */
html[data-theme='light'] .card.ad-card {
  background: var(--surface);
  border-color: var(--border);
}

html[data-theme='light'] .card.ad-card .ad-label {
  background: var(--panel);
  color: var(--muted);
}