:root {
  --bg: #0E0828;
  --bg-2: #150D33;
  --surface: #1B1240;
  --surface-2: #251A50;
  --surface-3: #2F2462;
  --text: #F4F0FF;
  --text-2: #B8B0D8;
  --text-3: #807898;
  --text-4: #555068;
  --border: #2F2562;
  --border-strong: #3F3578;
  --accent: #EE5523;
  --accent-hover: #FF6A3D;
  --accent-soft: #3A1B0F;
  --accent-fg: #FFF4EE;
  --danger: #F08488;

  --font-ui: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", "Cascadia Mono", ui-monospace, monospace;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 14px;

  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --dur: 160ms;

  --container: 1200px;
  --gutter: 28px;
  --header-h: 64px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

html {
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  min-height: 100vh;
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.55;
  color: var(--text);
  background:
    radial-gradient(1200px 700px at 80% -10%, rgba(238, 85, 35, 0.08) 0%, transparent 55%),
    radial-gradient(900px 600px at 10% 90%, rgba(190, 0, 92, 0.06) 0%, transparent 60%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-feature-settings: "kern", "liga", "calt", "ss01";
  overflow-x: hidden;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--dur) var(--ease);
}

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

::selection { background: rgba(238, 85, 35, 0.32); }

img { max-width: 100%; }

/* ============ Fixed site header ============ */

.site-header {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 50;
  background: rgba(14, 8, 40, 0.72);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--border);
}

.site-header__inner {
  max-width: var(--container);
  margin: 0 auto;
  height: var(--header-h);
  padding: 0 var(--gutter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.site-header__brand {
  display: inline-flex;
  align-items: center;
  min-width: 0;
}

.site-header__brand img {
  height: 26px;
  width: auto;
  display: block;
  filter: drop-shadow(0 2px 10px rgba(238, 85, 35, 0.22));
}

.site-header__nav {
  display: flex;
  gap: 20px;
  align-items: center;
  font-size: 14px;
}

.site-header__link {
  color: var(--text-2);
  font-weight: 500;
  padding: 8px 4px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
}

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

/* ============ Page ============ */

.page {
  max-width: var(--container);
  margin: 0 auto;
  padding: calc(var(--header-h) + 64px) var(--gutter) 96px;
  display: flex;
  flex-direction: column;
  gap: 64px;
}

/* ============ Hero ============ */

.hero {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 720px;
}

.hero__title {
  margin: 0;
  font-size: clamp(34px, 5.2vw, 52px);
  font-weight: 700;
  letter-spacing: -0.028em;
  color: var(--text);
  line-height: 1.02;
}

.hero__subtitle {
  margin: 0;
  font-size: clamp(15px, 1.6vw, 17px);
  color: var(--text-2);
  letter-spacing: -0.005em;
  max-width: 580px;
}

/* ============ Sections ============ */

.sections {
  display: flex;
  flex-direction: column;
  gap: 64px;
}

.sections__loading,
.sections__error {
  margin: 0;
  padding: 40px;
  text-align: center;
  color: var(--text-3);
  font-style: italic;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.sections__error {
  color: var(--danger);
  font-style: normal;
}

.section {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.section__header {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.section__title {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-2);
}

.section__description {
  margin: 0;
  font-size: 13px;
  color: var(--text-3);
}

.section__body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

@media (min-width: 640px) {
  .section__body {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1024px) {
  .section__body {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.section__empty {
  grid-column: 1 / -1;
  margin: 0;
  padding: 36px 24px;
  text-align: center;
  color: var(--text-3);
  font-size: 14px;
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
}

/* ============ App card ============ */

.app {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease);
  min-width: 0;
}

.app:hover {
  border-color: var(--border-strong);
}

.app__top {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  min-width: 0;
}

.app__icon {
  width: 52px;
  height: 52px;
  flex-shrink: 0;
  border-radius: 12px;
  background: var(--surface-2);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.app__icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.app__heading {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  flex: 1;
}

.app__name {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.012em;
  color: var(--text);
  line-height: 1.22;
  overflow-wrap: anywhere;
}

.app__badges {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.app__version {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: 0.01em;
}

.app__version--missing {
  background: rgba(240, 132, 136, 0.12);
  color: var(--danger);
}

.app__date {
  font-size: 12px;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
}

.app__tagline {
  margin: 0;
  font-size: 13px;
  color: var(--text-2);
  font-style: italic;
}

.app__description {
  margin: 0;
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.55;
  flex: 1;
}

.app__downloads {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.app__download {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  transition:
    background var(--dur) var(--ease),
    border-color var(--dur) var(--ease),
    color var(--dur) var(--ease),
    transform var(--dur) var(--ease);
}

.app__download:hover {
  background: var(--surface-3);
  border-color: var(--border-strong);
  color: var(--text);
}

.app__download:active { transform: translateY(1px); }

.app__download--primary {
  background: var(--accent);
  color: var(--accent-fg);
  border-color: var(--accent);
}

.app__download--primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--accent-fg);
}

.app__download--disabled {
  pointer-events: none;
  opacity: 0.45;
  color: var(--text-3);
}

.app__download-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  color: currentColor;
}

.app__download-icon svg {
  width: 100%;
  height: 100%;
  display: block;
  fill: currentColor;
}

.app__download-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
  min-width: 0;
}

.app__download-platform {
  font-weight: 600;
  font-size: 13px;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app__download-compat {
  font-size: 11px;
  line-height: 1.2;
  opacity: 0.6;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app__download-meta {
  font-size: 11px;
  opacity: 0.7;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.app__download--primary .app__download-meta { opacity: 0.85; }

.app__download--primary .app__download-compat { opacity: 0.75; }

/* ============ Placeholder card ============ */

.app--placeholder {
  display: none;
  background: transparent;
  border-style: dashed;
  border-color: var(--border);
  min-height: 220px;
}

.app--placeholder:hover { border-color: var(--border); }

@media (max-width: 639px) {
  .app--placeholder.ph-show-mobile { display: block; }
}

@media (min-width: 640px) and (max-width: 1023px) {
  .app--placeholder.ph-show-tablet { display: block; }
}

@media (min-width: 1024px) {
  .app--placeholder.ph-show-desktop { display: block; }
}

/* ============ Site footer ============ */

.site-footer {
  margin-top: 48px;
  border-top: 1px solid var(--border);
  background: var(--bg-2);
}

.site-footer__top {
  max-width: var(--container);
  margin: 0 auto;
  padding: 64px var(--gutter) 40px;
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 48px;
}

.site-footer__brand p {
  margin: 14px 0 18px;
  font-size: 14px;
  color: var(--text-3);
  max-width: 360px;
}

.site-footer__cta {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  min-height: 40px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition:
    background var(--dur) var(--ease),
    border-color var(--dur) var(--ease),
    color var(--dur) var(--ease),
    transform var(--dur) var(--ease);
}

.site-footer__cta:hover {
  background: var(--surface-2);
  border-color: var(--accent);
  color: var(--accent);
}

.site-footer__cta:active { transform: translateY(1px); }

.site-footer__cta svg {
  transition: transform var(--dur) var(--ease);
}

.site-footer__cta:hover svg {
  transform: translate(2px, -2px);
}

.site-footer__logo {
  height: 28px;
  width: auto;
  display: block;
  filter: drop-shadow(0 4px 18px rgba(238, 85, 35, 0.22));
}

.site-footer__heading {
  margin: 0 0 14px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
}

.site-footer__col ul {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 14px;
  color: var(--text-2);
}

.site-footer__col a {
  color: var(--text-2);
}

.site-footer__col a:hover {
  color: var(--text);
}

.site-footer__bottom {
  max-width: var(--container);
  margin: 0 auto;
  padding: 24px var(--gutter) 32px;
  border-top: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-4);
}

.site-footer__bottom p { margin: 0; }

/* ============ Responsive ============ */

@media (max-width: 1023px) {
  .site-footer__top {
    grid-template-columns: 1fr 1fr;
    gap: 40px;
  }

  .site-footer__brand {
    grid-column: 1 / -1;
  }
}

@media (max-width: 639px) {
  :root {
    --header-h: 56px;
    --gutter: 20px;
  }

  .page {
    padding: calc(var(--header-h) + 32px) var(--gutter) 64px;
    gap: 48px;
  }

  .site-header__brand img { height: 22px; }

  .site-header__nav { gap: 12px; }

  .site-header__link {
    font-size: 13px;
    padding: 8px 4px;
  }

  .sections { gap: 48px; }

  .section { gap: 18px; }

  .section__body { gap: 16px; }

  .app {
    padding: 18px;
    gap: 12px;
  }

  .app__icon {
    width: 44px;
    height: 44px;
    border-radius: 10px;
  }

  .app__name { font-size: 16px; }

  .app__tagline,
  .app__description { font-size: 13px; }

  .app__download {
    min-height: 44px;
  }

  .app__download-platform { font-size: 13px; }

  .site-footer__top {
    grid-template-columns: 1fr;
    gap: 28px;
    padding: 40px var(--gutter) 28px;
  }

  .site-footer__bottom {
    padding: 20px var(--gutter) 28px;
    text-align: center;
  }
}

/* ============ Light theme ============ */

@media (prefers-color-scheme: light) {
  :root {
    --bg: #FBF7F0;
    --bg-2: #FFFFFF;
    --surface: #FFFFFF;
    --surface-2: #F4EFE3;
    --surface-3: #EBE3D0;
    --text: #1C0D53;
    --text-2: #4A3B7A;
    --text-3: #7C709A;
    --text-4: #A8A0BE;
    --border: #E6DDC8;
    --border-strong: #D2C5A8;
    --accent: #DC4818;
    --accent-hover: #C13D11;
    --accent-soft: #FDE7DC;
    --accent-fg: #FFFFFF;
    --danger: #C24A50;
  }

  body {
    background:
      radial-gradient(1200px 700px at 80% -10%, rgba(238, 85, 35, 0.10) 0%, transparent 55%),
      radial-gradient(900px 600px at 10% 90%, rgba(190, 0, 92, 0.08) 0%, transparent 60%),
      var(--bg);
  }

  .site-header {
    background: rgba(251, 247, 240, 0.80);
  }

  .site-header__brand img,
  .site-footer__logo {
    filter: drop-shadow(0 4px 16px rgba(238, 85, 35, 0.14));
  }
}
