:root {
  --bg-color: #0d1117;
  --card-bg: rgba(22, 27, 34, 0.6);
  --text-primary: #f0f6fc;
  --text-secondary: #8b949e;
  --accent-red: #ff4d4d;
  --accent-purple: #a371f7;
  --accent-green: #2ea043;
  --border-color: rgba(255, 255, 255, 0.08);
  --accent-orange: #ffa657;
  --accent-blue: #388bfd;
  --glass-bg: rgba(255, 255, 255, 0.03);
}

* {
  box-sizing: border-box;
}

body {
  background: var(--bg-color);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  margin: 0;
  padding: 0;
  -webkit-font-smoothing: antialiased;
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 10px;
}
::-webkit-scrollbar-track {
  background: var(--bg-color);
}
::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 5px;
  border: 3px solid var(--bg-color);
}
::-webkit-scrollbar-thumb:hover {
  background: var(--text-secondary);
}

#container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 60px 20px;
  transition: padding 0.3s ease;
}

#message {
  background: var(--card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: clamp(24px, 5vw, 40px);
  border-radius: 32px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-color);
  position: relative;
  overflow: hidden;
}

#message::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
}

.header {
  display: flex;
  align-items: center;
  margin-bottom: 24px;
}

.site-logo {
  width: clamp(56px, 10vw, 72px);
  height: clamp(56px, 10vw, 72px);
  margin-right: 16px;
  border-radius: 16px;
  border: 2px solid var(--accent-red);
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.site-logo:hover {
  border-color: var(--accent-purple);
  transform: scale(1.05);
}

.header-text {
  display: flex;
  flex-direction: column;
}

h2 {
  color: var(--accent-red);
  font-size: 11px;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-weight: 700;
}

h1 {
  font-size: clamp(24px, 6vw, 32px);
  font-weight: 800;
  color: var(--text-primary);
  margin: 2px 0 0;
  letter-spacing: -1px;
}

.header-text h1 {
  background: linear-gradient(135deg, #a371f7, #ec4899, #388bfd);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.description {
  line-height: 1.5;
  margin-bottom: 24px;
  font-size: 14px;
  color: var(--text-secondary);
}

/* Stats Bar */
.stats-bar {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 16px;
  padding: 16px 24px;
  margin-bottom: 32px;
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  gap: 32px;
  flex-wrap: wrap;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.stats-bar span {
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.5px;
}

/* Filters */
.filters {
  display: flex;
  gap: 12px;
  margin-bottom: 24px;
  overflow-x: auto;
  padding: 0 4px 12px 4px;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-overflow-scrolling: touch;
  flex-wrap: nowrap;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.filters::-webkit-scrollbar {
  display: none;
}

.filter-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  padding: 10px 20px;
  border-radius: 100px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  letter-spacing: 0.5px;
}

.filter-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.filter-btn.active {
  background: linear-gradient(135deg, #a371f7, #ec4899, #388bfd);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 8px 20px rgba(163, 113, 247, 0.3);
}

.filter-separator {
  width: 1px;
  height: 20px;
  background: var(--border-color);
  align-self: center;
  margin: 0 4px;
  flex-shrink: 0;
}

.app-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
  perspective: 1000px; /* For potential 3D effects */
}

.app-link {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  background: var(--glass-bg);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
  text-decoration: none;
  color: var(--text-primary);
  padding: 20px 28px;
  border-radius: 20px;
  transition: background 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    border-color 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: 1px solid rgba(255, 255, 255, 0.05);
  gap: 20px;

  /* Start state for scroll animation. will-change is applied only while a
     card is waiting to animate in, then dropped so the GPU layer is freed. */
  opacity: 0;
  transform: translateY(20px);
}

.app-link.pending-reveal {
  will-change: transform, opacity;
}

.app-link.reveal {
  opacity: 1;
  transform: translateY(0);
  will-change: auto;
}

.app-link:hover {
  background: rgba(255, 255, 255, 0.07);
  border-color: rgba(163, 113, 247, 0.4);
  transform: translateY(-5px);
  box-shadow:
    0 15px 35px rgba(0, 0, 0, 0.4),
    0 0 15px rgba(163, 113, 247, 0.1);
}

/* min-width, not overflow: hidden, lets the column shrink - hidden would clip
   the icon's hover zoom. .app-text-info still clips the text for its ellipsis. */
.app-main-info {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}

.app-icon {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  object-fit: cover;
  /* No background or shadow: either one shows in the icon's transparent corners. */
  flex-shrink: 0;
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.app-link:hover .app-icon {
  transform: scale(1.1);
}

.app-text-info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.app-name {
  /* A bare h2 rule styles the site's small red section labels; these card
     titles are headings for structure only, so they opt out of it. */
  margin: 0;
  color: var(--text-primary);
  text-transform: none;
  letter-spacing: normal;
  font-weight: 700;
  font-size: 17px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-type {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.changelog-text {
  font-size: 11px;
  color: var(--text-secondary);
  opacity: 0.6;
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-data-wrapper {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-end;
}

/* Platform Information Enhancement */
.platform-info-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
}

.platform-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.03);
}

.platform-row:last-child {
  border-bottom: none;
}

/* A platform filter shows one row per card, so no divider is needed. */
.app-grid[data-platform] .platform-row {
  border-bottom: none;
}

.platform-meta {
  display: flex;
  gap: 16px;
}

.meta-group {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.meta-label {
  font-size: 8px;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.meta-value {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-primary);
}

.shared-meta {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 12px;
  margin-top: 4px;
}

/* Status Badges */

.badge {
  font-size: 10px;
  font-weight: 800;
  padding: 6px 14px;
  border-radius: 12px;
  text-transform: uppercase;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid transparent;
  text-decoration: none;
  transition: all 0.3s ease;
  cursor: pointer;
  backdrop-filter: blur(4px);
}

.badge:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.3);
  filter: brightness(1.1);
}

.badge:active {
  transform: translateY(0) scale(1);
}

.badge .ic {
  font-size: 12px;
}

.badge.testing {
  background: rgba(139, 148, 158, 0.1);
  color: var(--text-secondary);
  border-color: var(--border-color);
}

.badge.android {
  background: rgba(46, 160, 67, 0.15);
  color: #7ee787;
  border: 1px solid rgba(46, 160, 67, 0.4);
}

.badge.android:hover {
  background: rgba(46, 160, 67, 0.25);
  border-color: rgba(46, 160, 67, 0.8);
  box-shadow: 0 0 15px rgba(46, 160, 67, 0.3);
}

.badge.ios {
  background: rgba(56, 139, 253, 0.15);
  color: #79c0ff;
  border: 1px solid rgba(56, 139, 253, 0.4);
}

.badge.ios:hover {
  background: rgba(56, 139, 253, 0.25);
  border-color: rgba(56, 139, 253, 0.8);
  box-shadow: 0 0 15px rgba(56, 139, 253, 0.3);
}

.badge.web {
  background: rgba(255, 166, 87, 0.15);
  color: #ffca8e;
  border: 1px solid rgba(255, 166, 87, 0.4);
}

.badge.web:hover {
  background: rgba(255, 166, 87, 0.25);
  border-color: rgba(255, 166, 87, 0.8);
  box-shadow: 0 0 15px rgba(255, 166, 87, 0.3);
}

.badge.mac {
  background: rgba(163, 113, 247, 0.15);
  color: #d2a8ff;
  border: 1px solid rgba(163, 113, 247, 0.4);
}

.badge.mac:hover {
  background: rgba(163, 113, 247, 0.25);
  border-color: rgba(163, 113, 247, 0.8);
  box-shadow: 0 0 15px rgba(163, 113, 247, 0.3);
}

.badge.declined {
  background: var(--accent-red);
  color: white;
}

.badge.timer {
  background: var(--accent-green);
  color: white;
}

.footer-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  margin-top: 40px;
  padding-bottom: 40px;
  color: var(--text-secondary);
  font-size: 11px;
}

.sync-info {
  opacity: 0.6;
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Responsiveness */
@media (max-width: 900px) {
  .app-link {
    padding: 16px 20px;
  }
}

@media (max-width: 768px) {
  #container {
    padding: 24px 12px;
  }

  .app-link {
    grid-template-columns: 1fr;
    padding: 16px;
    gap: 16px;
  }

  .app-main-info {
    width: 100%;
  }

  .app-data-wrapper {
    align-items: flex-start;
    width: 100%;
    border-top: 1px solid var(--border-color);
    padding-top: 12px;
  }

  .platform-row {
    display: grid;
    grid-template-columns: auto 1fr;
    align-items: center;
    gap: 16px 12px;
    padding-bottom: 12px;
  }

  .platform-meta {
    display: contents;
  }

  .platform-row .badge {
    grid-column: 1;
    grid-row: 1;
  }

  /* Initial Release next to badge */
  .platform-row .meta-group:nth-child(3) {
    grid-column: 2;
    grid-row: 1;
    align-items: flex-end;
    justify-content: center;
    height: 100%;
  }

  /* Version and Last Updated on next row */
  .platform-row .meta-group:nth-child(1) {
    grid-column: 1;
    grid-row: 2;
    align-items: flex-start;
  }

  .platform-row .meta-group:nth-child(2) {
    grid-column: 2;
    grid-row: 2;
    align-items: flex-end;
  }

  .meta-group {
    align-items: flex-start;
  }
}

@media (max-width: 480px) {
  .app-name {
    white-space: normal;
    font-size: 16px;
  }

  /* Names already wrap at this width; taglines were left truncating with an
     ellipsis, which hides the end of the longer ones on a phone. */
  .app-type {
    white-space: normal;
  }

  .platform-row {
    gap: 12px 8px;
  }

  .meta-group .meta-label {
    font-size: 7px;
  }

  .meta-group .meta-value {
    font-size: 9px;
  }


  h1 {
    margin-top: 0;
  }
}

/* Modal Styles */
.modal {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
}

.modal-content {
  background-color: rgba(22, 27, 34, 0.72);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  margin: 10% auto;
  padding: 32px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  width: 90%;
  max-width: 500px;
  border-radius: 28px;
  position: relative;
  box-shadow: 0 40px 100px rgba(0, 0, 0, 0.6);
  animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
  from {
    transform: translateY(20px);
    opacity: 0;
  }

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

.close {
  background: none;
  border: 0;
  padding: 0;
  font-family: inherit;
  line-height: 1;
  color: var(--text-secondary);
  position: absolute;
  right: 24px;
  top: 16px;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
}

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

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.form-group input,
.form-group textarea {
  width: 100%;
  background: #0d1117;
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  padding: 12px 16px;
  border-radius: 12px;
  font-family: inherit;
  font-size: 14px;
}

.form-group input:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--accent-blue);
  box-shadow: 0 0 0 2px rgba(56, 139, 253, 0.2);
}

.submit-btn {
  background: var(--text-primary);
  color: var(--bg-color);
  border: none;
  width: 100%;
  padding: 14px;
  border-radius: 12px;
  font-weight: 700;
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}

.submit-btn:hover {
  opacity: 0.9;
  transform: translateY(-1px);
}

.support-btn {
  background: rgba(56, 139, 253, 0.15);
  color: var(--accent-blue);
  border: 1px solid rgba(56, 139, 253, 0.3);
  padding: 8px 18px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  text-transform: uppercase;
  margin-top: 14px;
  letter-spacing: 1px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

a.support-btn {
  text-decoration: none;
}

.support-btn .ic {
  font-size: 12px;
}

.support-btn:hover {
  background: var(--accent-blue);
  color: white;
  box-shadow: 0 6px 20px rgba(56, 139, 253, 0.4);
  transform: translateY(-2px);
  border-color: var(--accent-blue);
}

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

.greyscale {
  filter: grayscale(1);
  opacity: 0.6;
}

.greyscale:hover {
  filter: grayscale(0.5);
  opacity: 0.8;
}

/* Info Modal Modern Aesthetics */
#infoModal .modal-content {
  background: linear-gradient(135deg, rgba(22, 27, 34, 0.72), rgba(13, 17, 23, 0.78));
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border: 1px solid rgba(163, 113, 247, 0.4);
  max-width: 600px;
  padding: 0;
  overflow: hidden;
}

.info-modal-header-banner {
  height: 120px;
  background: linear-gradient(45deg, var(--accent-red), var(--accent-purple));
  position: relative;
}

.info-modal-body {
  padding: 40px 32px 32px;
  position: relative;
}

.info-app-icon-wrapper {
  position: absolute;
  top: -60px;
  left: 32px;
  padding: 6px;
  background: var(--bg-color);
  border-radius: 24px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.info-modal-icon {
  width: 100px;
  height: 100px;
  border-radius: 18px;
  display: block;
}

.info-title-area {
  margin-top: 40px;
  margin-bottom: 24px;
}

#infoAppName {
  font-size: 32px;
  font-weight: 800;
  margin: 0;
  color: var(--text-primary);
}

#infoAppId {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-purple);
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-top: 4px;
  display: block;
}

.info-description-box {
  background: rgba(255, 255, 255, 0.03);
  border-radius: 16px;
  padding: 20px;
  border: 1px solid var(--border-color);
  margin-bottom: 24px;
}

.info-description-box h3 {
  font-size: 13px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 0 0 10px 0;
}

#infoAppDescription {
  color: var(--text-primary);
  line-height: 1.6;
  margin: 0;
  font-size: 15px;
}

.info-custom-content {
  border-top: 1px solid var(--border-color);
  padding-top: 24px;
}

.info-custom-content h4 {
  margin: 0 0 12px 0;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.info-custom-content h4 .ic {
  color: var(--accent-orange);
  font-size: 18px;
}

.close-info {
  border: 0;
  padding: 0;
  color: inherit;
  position: absolute;
  right: 20px;
  top: 20px;
  width: 36px;
  height: 36px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.close-info:hover {
  background: rgba(255, 255, 255, 0.1);
  transform: rotate(90deg);
}

.app-link {
  cursor: pointer;
}

/* Inline SVG icon sprite */
.svg-sprite {
  display: none;
}

.ic {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
}

.app-link:focus-visible,
.badge:focus-visible,
.filter-btn:focus-visible,
.support-btn:focus-visible,
.submit-btn:focus-visible,
.close:focus-visible,
.close-info:focus-visible {
  outline: 2px solid var(--accent-blue);
  outline-offset: 3px;
}

/* ===== Aurora Glass: background ===== */
#aurora {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background: var(--bg-color);
}
#aurora .blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: 0.45;
  will-change: transform;
}
#aurora .b1 { width: 800px; height: 800px; background: #a371f7; top: -300px; left: -200px; animation: auroraDrift1 25s ease-in-out infinite; opacity: 0.25; }
#aurora .b2 { width: 700px; height: 700px; background: #388bfd; bottom: -200px; right: -200px; animation: auroraDrift2 30s ease-in-out infinite; opacity: 0.25; }
#aurora .b3 { width: 600px; height: 600px; background: #ff4d4d; top: 30%; left: 60%; animation: auroraDrift1 35s ease-in-out infinite reverse; opacity: 0.15; }
@keyframes auroraDrift1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(60px, 50px) scale(1.15); }
}
@keyframes auroraDrift2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(-70px, -40px) scale(1.1); }
}

/* Three animated 90px-blurred blobs under a dozen backdrop-filtered cards is
   the most expensive thing on the page. Freeze them on phones. */
@media (max-width: 600px) {
  #aurora .blob {
    animation: none;
    will-change: auto;
    filter: blur(60px);
    opacity: 0.18;
  }
}

/* ===== Respect reduced-motion ===== */
@media (prefers-reduced-motion: reduce) {
  #aurora .blob { animation: none !important; will-change: auto !important; }
  .app-link {
    opacity: 1 !important;
    transform: none !important;
    transition: none !important;
    will-change: auto !important;
  }
  .app-icon { transition: none !important; }
  * { scroll-behavior: auto !important; }
}
