:root {
  --bg: #1e1f22;
  --surface: #2b2d31;
  --surface-hover: #35373c;
  --surface-active: #404249;
  --input: #1e1f22;
  --line: #3f4147;
  --text: #f2f3f5;
  --muted: #b5bac1;
  --subtle: #949ba4;
  --blurple: #5865f2;
  --blurple-hover: #4752c4;
  --green: #23a55a;
  --danger: #f23f42;
  color-scheme: dark;
  font-family: "gg sans", "Noto Sans", "Helvetica Neue", Helvetica, Arial, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--bg); }

body {
  min-height: 100vh;
  margin: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
}

button,
input { font: inherit; }

button,
a { -webkit-tap-highlight-color: transparent; }

.skip-link {
  position: fixed;
  z-index: 30;
  top: 10px;
  left: 10px;
  padding: 10px 14px;
  border-radius: 5px;
  background: var(--blurple);
  color: white;
  transform: translateY(-150%);
}

.skip-link:focus { transform: translateY(0); }

.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(18px, 4vw, 48px);
  background: #2b2d31;
  border-bottom: 1px solid #191a1d;
  box-shadow: 0 1px 0 rgba(0, 0, 0, .2);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  text-decoration: none;
}

.brand-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--blurple);
  color: white;
  font-size: 16px;
  font-weight: 800;
}

.brand strong { font-size: 15px; letter-spacing: .01em; }

.online {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.online i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px rgba(35, 165, 90, .15);
}

main {
  width: min(980px, calc(100% - 32px));
  margin-inline: auto;
}

.view { animation: view-in 180ms ease-out; }

.home-view {
  min-height: calc(100vh - 126px);
  display: grid;
  align-content: center;
  gap: 28px;
  padding: 44px 0;
}

.home-title { text-align: center; }

h1 {
  margin: 0;
  color: var(--text);
  font-size: clamp(28px, 5vw, 40px);
  line-height: 1.15;
  letter-spacing: -.025em;
}

.home-title p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.category-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.category-button {
  min-height: 188px;
  position: relative;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 16px;
  padding: 28px 20px;
  border: 1px solid transparent;
  border-radius: 12px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-align: center;
  transition: background 150ms ease, border-color 150ms ease, transform 150ms ease;
}

.category-button:hover {
  background: var(--surface-hover);
  border-color: #4e5058;
  transform: translateY(-2px);
}

.category-button:active {
  background: var(--surface-active);
  transform: translateY(0);
}

.category-icon {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  border-radius: 20px;
  background: var(--blurple);
  color: white;
}

.category-button[data-category="live-spars"] .category-icon { background: #3ba55c; }
.category-button[data-category="otros"] .category-icon { background: #4e5058; }

.category-icon svg {
  width: 34px;
  height: 34px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.category-label strong,
.category-label span { display: block; }

.category-label strong { font-size: 17px; }

.category-label span {
  margin-top: 3px;
  color: var(--subtle);
  font-size: 12px;
  font-weight: 600;
}

.category-arrow {
  position: absolute;
  right: 15px;
  top: 15px;
  width: 20px;
  color: var(--subtle);
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.files-view { padding: clamp(30px, 6vw, 64px) 0 70px; }

.files-top {
  display: grid;
  grid-template-columns: 1fr minmax(210px, 300px);
  gap: 20px;
  align-items: end;
  margin-bottom: 22px;
}

.back-button {
  grid-column: 1 / -1;
  width: max-content;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 38px;
  padding: 0 10px 0 6px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}

.back-button:hover { background: var(--surface); color: var(--text); }

.back-button svg {
  width: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.category-title-row {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.count {
  color: var(--subtle);
  font-size: 12px;
  font-weight: 700;
}

.search {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 0 12px;
  border-radius: 5px;
  background: var(--input);
  border: 1px solid #17181a;
}

.search:focus-within {
  border-color: var(--blurple);
  box-shadow: 0 0 0 1px var(--blurple);
}

.search svg {
  width: 18px;
  fill: none;
  stroke: var(--subtle);
  stroke-width: 2;
  stroke-linecap: round;
}

.search input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 14px;
}

.search input::placeholder { color: var(--subtle); }

.file-list {
  overflow: hidden;
  border-radius: 8px;
  background: var(--surface);
}

.file-row {
  min-height: 76px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto auto;
  gap: 14px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.file-row:last-child { border-bottom: 0; }
.file-row:hover { background: var(--surface-hover); }

.file-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: #404249;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
}

.file-main { min-width: 0; }

.file-main strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recommended {
  display: inline-block;
  margin-left: 6px;
  padding: 2px 5px;
  border-radius: 3px;
  background: var(--blurple);
  color: white;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
  vertical-align: 2px;
}

.file-main span,
.file-size {
  color: var(--subtle);
  font-size: 11px;
  font-weight: 600;
}

.file-main span { display: block; margin-top: 3px; }

.download-button {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 14px;
  border-radius: 4px;
  background: var(--blurple);
  color: white;
  text-decoration: none;
  font-size: 12px;
  font-weight: 700;
  transition: background 150ms ease;
}

.download-button:hover { background: var(--blurple-hover); }

.download-button svg {
  width: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.category-button:focus-visible,
.back-button:focus-visible,
.download-button:focus-visible,
.brand:focus-visible {
  outline: 3px solid white;
  outline-offset: 3px;
}

.empty-state,
.loading,
.error {
  min-height: 280px;
  display: grid;
  place-content: center;
  justify-items: center;
  color: var(--subtle);
  text-align: center;
}

.empty-state svg {
  width: 48px;
  fill: none;
  stroke: #4e5058;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.empty-state p { margin: 10px 0 0; font-size: 13px; font-weight: 700; }

.loading {
  position: fixed;
  inset: 64px 0 38px;
  background: var(--bg);
}

.loading span {
  width: 24px;
  height: 24px;
  border: 3px solid #4e5058;
  border-top-color: var(--blurple);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

footer {
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: #6d6f78;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
}

footer span + span::before { content: "·"; margin-right: 7px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

[hidden] { display: none !important; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes view-in { from { opacity: 0; transform: translateY(5px); } }

@media (max-width: 680px) {
  .topbar { height: 58px; padding-inline: 14px; }
  .brand strong { font-size: 13px; }
  .brand-icon { width: 32px; height: 32px; }
  .online { font-size: 0; gap: 0; }
  main { width: min(100% - 22px, 980px); }
  .home-view { min-height: calc(100vh - 100px); align-content: start; padding-top: 58px; }
  .category-grid { grid-template-columns: 1fr; gap: 10px; }
  .category-button {
    min-height: 104px;
    grid-template-columns: 58px 1fr;
    align-content: center;
    justify-items: start;
    gap: 14px;
    padding: 18px;
    text-align: left;
  }
  .category-icon { width: 56px; height: 56px; border-radius: 17px; }
  .category-icon svg { width: 28px; }
  .category-arrow { top: 50%; transform: translateY(-50%); }
  .files-view { padding-top: 24px; }
  .files-top { grid-template-columns: 1fr; gap: 14px; }
  .back-button { grid-column: auto; }
  .file-row { grid-template-columns: 42px minmax(0, 1fr) auto; gap: 11px; }
  .file-size { display: none; }
  .download-button { width: 40px; padding: 0; font-size: 0; }
  .download-button svg { width: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
