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

:root {
  --bg: #000000;
  --surface: #12121c;
  --surface-hover: #1a1a2e;
  --border: #1e1e32;
  --border-hover: #2e2e4a;
  --text: #e4e4ec;
  --text-muted: #7a7a8e;
  --accent: #7c5cff;
  --accent-glow: rgba(124, 92, 255, 0.15);
  --accent2: #00d4aa;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 8px 32px rgba(0,0,0,.5);
}

html {
  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

/* Header */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(0,0,0,.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}

header h1 {
  font-size: 1.25rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  color: var(--text);
}

header h1 svg {
  color: var(--text-muted);
  flex-shrink: 0;
}

.header-logo {
  height: 48px;
  width: auto;
  display: block;
}

.search-wrap {
  position: relative;
  flex: 1;
}

.header-social {
  display: flex;
  align-items: center;
  gap: 20px;
  flex-shrink: 0;
}
.header-social a {
  color: var(--text-muted);
  display: flex;
  align-items: center;
  transition: color .15s;
  line-height: 1;
}
.header-social a:hover {
  color: var(--text);
}
.header-social a:hover {
  color: var(--text);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

#search {
  width: 100%;
  padding: 10px 44px 10px 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: .95rem;
  outline: none;
  transition: border .2s, box-shadow .2s;
}

#search:focus {
  border-color: var(--text-muted);
  box-shadow: 0 0 0 3px rgba(255,255,255,.06);
}

#search::placeholder {
  color: var(--text-muted);
}

/* Advanced search button */
.adv-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all .2s;
}

.adv-btn:hover,
.adv-btn.active {
  border-color: var(--text-muted);
  color: var(--text);
  background: rgba(255,255,255,.06);
}

/* Advanced search modal */
.adv-header {
  padding: 24px 32px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.adv-header svg {
  color: var(--text-muted);
  flex-shrink: 0;
}

.adv-header h2 {
  font-size: 1.1rem;
  font-weight: 700;
}

.adv-body {
  padding: 16px 32px 24px;
}

.adv-title-search {
  position: relative;
  margin-bottom: 14px;
}

.adv-title-search svg {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.adv-title-search input {
  width: 100%;
  padding: 9px 14px 9px 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: .88rem;
  outline: none;
  transition: border .2s;
}

.adv-title-search input:focus {
  border-color: var(--text-muted);
  box-shadow: 0 0 0 3px rgba(255,255,255,.06);
}

/* Active filter chips */
.adv-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 14px;
  min-height: 0;
}

.adv-chips:empty {
  display: none;
}

.adv-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px 3px 10px;
  border-radius: 14px;
  font-size: .72rem;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.15);
  color: var(--text);
}

.adv-chip-remove {
  cursor: pointer;
  opacity: .5;
  transition: opacity .15s;
  display: flex;
}

.adv-chip-remove:hover {
  opacity: 1;
}

/* Tabs */
.adv-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0;
}

.adv-tab {
  padding: 7px 16px;
  border: none;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: .8rem;
  cursor: pointer;
  transition: all .15s;
  margin-bottom: -1px;
  white-space: nowrap;
}

.adv-tab:hover {
  color: var(--text);
  border-bottom-color: rgba(255,255,255,.2);
}

.adv-tab.active {
  color: var(--text);
  border-bottom-color: var(--text);
}

.adv-tab .count {
  font-size: .65rem;
  margin-left: 4px;
  opacity: .6;
}

.adv-tab .sel {
  font-size: .65rem;
  margin-left: 3px;
  color: var(--accent2);
}

/* Tab search */
.adv-tab-search {
  position: relative;
  margin-bottom: 10px;
}

.adv-tab-search svg {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

.adv-tab-search input {
  width: 100%;
  padding: 7px 10px 7px 32px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-size: .8rem;
  outline: none;
  transition: border .2s;
}

.adv-tab-search input:focus {
  border-color: var(--text-muted);
}

/* Pills */
.adv-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  max-height: 280px;
  overflow-y: auto;
  padding: 2px 0;
}

.adv-pill {
  padding: 4px 13px;
  border-radius: 14px;
  font-size: .74rem;
  cursor: pointer;
  transition: all .12s;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
  line-height: 1.4;
  white-space: nowrap;
  user-select: none;
}

.adv-pill:hover {
  border-color: var(--text-muted);
  color: var(--text);
  background: rgba(255,255,255,.04);
}

.adv-pill.active {
  background: #2a2a3a;
  border-color: #2a2a3a;
  color: #fff;
}

.adv-pill.hidden {
  display: none;
}

.adv-pill .check {
  margin-right: 3px;
  opacity: 0;
  transition: opacity .1s;
}

.adv-pill.active .check {
  opacity: 1;
}

/* Footer */
.adv-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.adv-footer .count {
  font-size: .82rem;
  color: var(--text-muted);
}

.adv-footer .count strong {
  color: var(--text);
}

.adv-clear {
  padding: 5px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: transparent;
  color: var(--text-muted);
  font-size: .75rem;
  cursor: pointer;
  transition: all .15s;
}

.adv-clear:hover {
  border-color: #ef444466;
  background: rgba(239,68,68,.1);
  color: #ef4444;
}

.adv-footer-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.adv-apply {
  padding: 6px 18px;
  border: none;
  border-radius: var(--radius-sm);
  background: #2a2a3a;
  color: #fff;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
}

.adv-apply:hover {
  background: #3a3a4a;
  box-shadow: none;
}

/* Detail layout */

/* Main */
main {
  flex: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
  width: 100%;
}

/* Grid */
#grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

#genreBar {
  display: none;
  padding: 10px 16px;
  margin-bottom: 16px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.1);
  font-size: .85rem;
  color: var(--text);
}

#genreBar strong {
  color: var(--text);
}

.clear-genre {
  margin-left: 12px;
  padding: 3px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: transparent;
  color: var(--text-muted);
  font-size: .78rem;
  cursor: pointer;
  transition: all .2s;
}

.clear-genre:hover {
  border-color: #ef444466;
  background: rgba(239,68,68,.1);
  color: #ef4444;
}

.game-card {
  position: relative;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: transform .25s cubic-bezier(.22,1,.36,1), border-color .25s, box-shadow .25s;
  aspect-ratio: 3/4;
}

.game-card:hover {
  transform: translateY(-4px);
  border-color: var(--text-muted);
  box-shadow: 0 12px 32px rgba(0,0,0,.4);
}

.game-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform .4s ease;
  background: linear-gradient(110deg, var(--bg) 30%, #1a1a28 50%, var(--bg) 70%);
  background-size: 200% 100%;
  animation: shimmer 1.5s ease-in-out infinite;
}

@keyframes shimmer {
  to { background-position: 200% 0; }
}

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

.game-card .info {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 48px 14px 14px;
  background: linear-gradient(transparent, rgba(0,0,0,.92));
}

.game-card .info h3 {
  font-size: .85rem;
  font-weight: 600;
  line-height: 1.3;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.game-card .info .dev {
  font-size: .75rem;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 4px;
}

.card-dev {
  cursor: pointer;
  transition: color .15s;
}

.card-dev:hover {
  color: var(--accent2);
}

.card-genres {
  display: flex;
  flex-wrap: nowrap;
  gap: 3px;
  overflow: hidden;
}

.card-genre {
  font-size: .6rem;
  padding: 1px 6px;
  border-radius: 8px;
  background: rgba(0,212,170,.1);
  border: 1px solid rgba(0,212,170,.2);
  color: #5eccb0;
  cursor: pointer;
  transition: all .15s;
  line-height: 1.4;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-genre:hover {
  background: rgba(0,212,170,.2);
  border-color: var(--accent2);
  color: #7ddfc6;
}

.card-genre.more {
  background: transparent;
  border-color: var(--border);
  color: var(--text-muted);
  cursor: default;
}

.game-card .rating-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0,0,0,.65);
  backdrop-filter: blur(4px);
  padding: 2px 8px;
  border-radius: 20px;
  font-size: .7rem;
  font-weight: 600;
  color: #ffc107;
}

.game-card .rating-badge::before {
  content: "\2605";
  margin-right: 3px;
  font-size: .75rem;
}

/* Loading */
#loading {
  display: none;
  justify-content: center;
  padding: 60px 0;
}

#loading.active {
  display: flex;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--text-muted);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Pagination */
#pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  padding: 16px 0 40px;
}

#pagination button {
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-size: .85rem;
  cursor: pointer;
  transition: all .2s;
}

#pagination button:hover:not(:disabled) {
  border-color: var(--text-muted);
  background: rgba(255,255,255,.04);
}

#pagination button:disabled {
  opacity: .35;
  cursor: not-allowed;
}

#pagination button.active {
  background: #2a2a3a;
  border-color: #2a2a3a;
  color: #fff;
}

#pagination .page-info {
  font-size: .85rem;
  color: var(--text-muted);
  padding: 0 8px;
}

/* Modal */
.modal {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
}

.modal.hidden {
  display: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  backdrop-filter: blur(6px);
}

.modal-content {
  position: relative;
  width: 100%;
  max-width: 860px;
  margin: auto 0;
  background: #000;
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  animation: modalIn .3s cubic-bezier(.22,1,.36,1);
}

@keyframes modalIn {
  from { opacity: 0; transform: scale(.95) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 10;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: rgba(0,0,0,.75);
  backdrop-filter: blur(4px);
  color: var(--text-muted);
  cursor: pointer;
  transition: all .2s;
}

.modal-close:hover {
  background: var(--surface-hover);
  color: var(--text);
  border-color: var(--border-hover);
}

/* Detail layout */
.detail-header {
  display: flex;
  gap: 20px;
  padding: 24px 32px 16px;
}

.detail-cover {
  flex-shrink: 0;
  width: 180px;
  border-radius: 10px;
  overflow: hidden;
}

.detail-cover img {
  width: 100%;
  height: auto;
  display: block;
  border-radius: 10px;
}

.detail-cover .cover-letter {
  display: none;
  align-items: center;
  justify-content: center;
  aspect-ratio: 3/4;
  font-size: 3rem;
  font-weight: 700;
  color: var(--text-muted);
  background: linear-gradient(135deg, #1a1a2e, #2d1b4e);
  border-radius: 10px;
}

.detail-cover.no-image .cover-letter {
  display: flex;
}

.detail-cover.no-image img {
  display: none;
}

.detail-info {
  flex: 1;
  min-width: 0;
}

.detail-info h2 {
  font-size: 1.35rem;
  font-weight: 700;
  margin-bottom: 2px;
  line-height: 1.3;
}

.detail-info .dev-pub {
  font-size: .85rem;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.detail-info .dev-pub span,
.dev-link {
  color: var(--accent2);
}

.detail-info .dev-pub .pub-link,
.detail-info .dev-pub .year-link {
  color: var(--text-muted);
}

.pub-link {
  cursor: pointer;
  border-bottom: 1px dashed transparent;
  transition: all .15s;
}

.pub-link:hover {
  border-bottom-color: var(--text-muted);
  color: var(--text);
}

.dev-link {
  cursor: pointer;
  border-bottom: 1px dashed transparent;
  transition: all .15s;
}

.dev-link:hover {
  border-bottom-color: var(--accent2);
}

.year-link {
  cursor: pointer;
  border-bottom: 1px dashed transparent;
  transition: all .15s;
  color: var(--text-muted);
}

.year-link:hover {
  border-bottom-color: var(--text-muted);
  color: var(--text);
}

.detail-rating {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
}

.detail-rating .stars {
  color: #ffc107;
  font-size: .85rem;
  letter-spacing: 1px;
}

.detail-rating .rating-num {
  font-size: .82rem;
  color: var(--text-muted);
}

.tag-group {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tag {
  padding: 3px 9px;
  border-radius: 12px;
  font-size: .7rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .2s;
  background: rgba(124,92,255,.12);
  border: 1px solid rgba(124,92,255,.2);
  color: #b3a0ff;
}

.tag:hover {
  background: rgba(124,92,255,.25);
  border-color: var(--accent);
  color: #c4b5ff;
}

.tag.genre {
  background: rgba(0,212,170,.1);
  border-color: rgba(0,212,170,.2);
  color: #5eebcb;
}

.tag.genre:hover {
  background: rgba(0,212,170,.2);
  border-color: var(--accent2);
}

.detail-body {
  padding: 0 32px 28px;
}

.detail-section {
  margin-bottom: 16px;
}

.detail-section h3 {
  font-size: .7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.section-summary {
  font-size: .65rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: normal;
  color: var(--text-muted);
  background: rgba(255,255,255,.05);
  padding: 1px 8px;
  border-radius: 8px;
}

.hoster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 8px;
}

.download-group {
  margin-bottom: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255,255,255,.03);
  overflow: hidden;
}

.download-group h4 {
  font-size: .78rem;
  font-weight: 600;
  color: var(--text);
  padding: 7px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(0,0,0,.2);
  border-bottom: 1px solid var(--border);
}

.download-group h4 .count {
  font-size: .65rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: auto;
}

.download-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 8px 12px;
}

.download-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
  font-size: .75rem;
  transition: all .2s;
  flex: 0 1 auto;
}

.download-btn:hover {
  border-color: var(--accent2);
  background: rgba(0,212,170,.08);
  color: var(--accent2);
}

.download-btn svg,
.magnet-link svg {
  flex-shrink: 0;
  width: 12px;
  height: 12px;
}

.magnet-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border: 1px solid #f59e0b33;
  border-radius: 6px;
  background: rgba(245,158,11,.08);
  color: #fbbf24;
  text-decoration: none;
  font-size: .78rem;
  font-weight: 500;
  transition: all .2s;
}

.magnet-link:hover {
  background: rgba(245,158,11,.15);
  border-color: #f59e0b66;
}

.files-list {
  display: grid;
  gap: 2px;
}

.file-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 8px;
  border-radius: 5px;
  background: rgba(255,255,255,.03);
  border: 1px solid var(--border);
  font-size: .73rem;
  gap: 10px;
}

.file-item .name {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.file-item .size {
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.files-toggle {
  margin-top: 4px;
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: transparent;
  color: var(--text-muted);
  font-size: .73rem;
  cursor: pointer;
  transition: all .2s;
}

.files-toggle:hover {
  border-color: var(--text-muted);
  color: var(--text);
  background: rgba(255,255,255,.06);
}

.files-extra {
  display: none;
}

.files-extra.open {
  display: grid;
  gap: 2px;
}

.no-downloads {
  color: var(--text-muted);
  font-size: .82rem;
  font-style: italic;
}

.links-section {
  padding-top: 0;
}

.link-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ext-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  text-decoration: none;
  font-size: .75rem;
  transition: all .2s;
}

.ext-link:hover {
  border-color: var(--text-muted);
  background: rgba(255,255,255,.05);
}

/* Footer */
footer {
  padding: 24px;
  font-size: .8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  width: 100%;
  box-sizing: border-box;
}

.footer-left,
.footer-center,
.footer-credit {
  flex: 1;
}

.footer-left {
  text-align: left;
}

.footer-sep {
  color: var(--border);
  margin: 0 2px;
}

.footer-center {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.footer-credit {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  justify-content: flex-end;
}

.footer-left a,
.footer-center a,
.footer-credit a {
  color: var(--text-muted);
  text-decoration: none;
}

.footer-left a:visited,
.footer-center a:visited,
.footer-credit a:visited {
  color: var(--text-muted);
}

.footer-left a:hover,
.footer-center a:hover,
.footer-credit a:hover {
  color: var(--text);
}

.footer-logo {
  width: 18px;
  height: 18px;
  border-radius: 3px;
}

/* Responsive — Tablet */
@media (max-width: 900px) {
  #grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  }
  .header-logo {
    height: 36px;
  }
}

/* Responsive — Tablet portrait */
@media (max-width: 768px) {
  .detail-header {
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 16px 20px 12px;
  }
  .detail-cover { width: 140px; }
  .detail-rating { justify-content: center; }
  .tag-group { justify-content: center; }
  .card-genres { justify-content: center; }
  .header-inner { flex-wrap: wrap; }
  .search-wrap { max-width: 100%; }
  .footer-inner { flex-direction: column; text-align: center; }
  .footer-credit { justify-content: center; }
}

/* Responsive — Phone */
@media (max-width: 640px) {
  html { font-size: 14px; }

  .header-inner {
    padding: 10px 12px;
    gap: 10px;
  }
  header h1 { font-size: .88rem; }
  .header-logo { height: 26px; }
  .header-social { gap: 12px; }
  .header-social a svg { width: 18px; height: 18px; }

  #search {
    padding: 8px 36px 8px 34px;
    font-size: .88rem;
  }
  .search-icon { left: 10px; }
  .adv-btn { width: 28px; height: 28px; right: 4px; }

  #grid {
    gap: 6px;
  }

  .game-card .info {
    padding: 28px 6px 8px 6px;
    text-align: left;
  }
  .card-genres {
    justify-content: flex-start;
  }
  .game-card .info h3 {
    font-size: .72rem;
  }
  .game-card .info .dev {
    font-size: .62rem;
    margin-bottom: 2px;
  }
  .card-genre {
    font-size: .5rem;
    padding: 1px 4px;
  }
  .game-card .rating-badge {
    top: 6px;
    right: 6px;
    font-size: .6rem;
    padding: 1px 6px;
  }

  /* Modal — full-screen on phone */
  .modal {
    padding: 0;
  }
  .modal-content {
    max-width: 100%;
    border-radius: 0;
    border: none;
    min-height: 100vh;
    box-shadow: none;
    animation: none;
  }
  .modal-close {
    top: 8px;
    right: 8px;
    width: 44px;
    height: 44px;
  }

  /* Detail header */
  .detail-header {
    padding: 10px 14px 10px;
    gap: 12px;
  }
  .detail-cover { width: 100px; }
  .detail-info h2 { font-size: 1.1rem; }
  .detail-info .dev-pub { font-size: .8rem; }
  .detail-body {
    padding: 0 14px 20px;
  }

  .hoster-grid {
    grid-template-columns: 1fr;
  }

  .download-btn, .magnet-link {
    width: 100%;
    justify-content: center;
  }

  .file-item {
    font-size: .68rem;
    padding: 4px 6px;
  }
  .files-toggle {
    width: 100%;
    text-align: center;
  }

  .links-section .link-group {
    flex-direction: column;
  }
  .links-section .ext-link {
    width: 100%;
    justify-content: center;
  }

  /* Pagination touch targets */
  #pagination {
    gap: 4px;
    padding: 12px 0 24px;
  }
  #pagination button {
    padding: 10px 14px;
    min-width: 44px;
    font-size: .82rem;
  }
  #pagination .page-info {
    font-size: .78rem;
  }

  /* Filter bar */
  #genreBar {
    font-size: .75rem;
    padding: 8px 10px;
  }
  .clear-genre {
    padding: 6px 14px;
    font-size: .72rem;
  }

  /* Reduce main padding so cards fill the screen */
  main {
    padding: 12px;
    margin: 0;
    max-width: 100%;
  }
  #grid {
    gap: 6px;
    grid-template-columns: repeat(2, 1fr);
  }

  /* Footer */
  footer {
    padding: 16px;
    font-size: .75rem;
  }
  .footer-inner {
    padding: 0 12px;
    gap: 6px;
  }
  .footer-left, .footer-center, .footer-credit {
    flex: none;
    width: 100%;
  }
  .footer-center {
    justify-content: center;
    flex-wrap: wrap;
  }

  /* Advanced search modal */
  .adv-header {
    padding: 14px 14px 0;
    flex-wrap: wrap;
  }
  .adv-body {
    padding: 10px 14px 14px;
  }
  .adv-tabs {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .adv-tabs::-webkit-scrollbar { display: none; }
  .adv-tab {
    padding: 7px 12px;
    font-size: .75rem;
  }
  .adv-pills {
    max-height: 220px;
  }
  .adv-pill {
    font-size: .68rem;
    padding: 4px 10px;
  }
  .adv-footer {
    flex-direction: column;
    gap: 8px;
    align-items: stretch;
  }
  .adv-footer-right {
    justify-content: flex-end;
  }
  .adv-apply {
    padding: 8px 20px;
  }
  .adv-clear {
    padding: 6px 14px;
  }
  .adv-chips {
    gap: 4px;
  }
  .adv-chip {
    font-size: .68rem;
  }
}

/* Responsive — Small phone */
@media (max-width: 400px) {
  .header-social { display: none; }

  #grid { gap: 6px; }

  .game-card .info {
    padding: 20px 6px 6px;
    text-align: left;
  }
  .game-card .info h3 {
    font-size: .65rem;
  }
  .game-card .info .dev {
    font-size: .55rem;
  }
  .card-genre {
    display: none;
  }
  .game-card .rating-badge {
    top: 4px;
    right: 4px;
    font-size: .55rem;
    padding: 1px 5px;
  }

  .detail-cover { width: 80px; }
  .detail-header { gap: 10px; }
  .detail-info h2 { font-size: 1rem; }
  .detail-info .dev-pub { font-size: .75rem; }
}

/* Touch devices — disable sticky hover effects */
@media (hover: none) {
  .game-card:hover {
    transform: none;
  }
  .game-card:hover img {
    transform: none;
  }
  .tag:hover, .card-genre:hover, .download-btn:hover, .magnet-link:hover,
  .ext-link:hover, .adv-pill:hover, .adv-tab:hover, .dev-link:hover,
  .pub-link:hover, .year-link:hover, .files-toggle:hover, .clear-genre:hover {
    background: inherit;
    border-color: inherit;
    color: inherit;
  }
}
