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

:root {
  --bg: #0f0f0f;
  --surface: #1a1a1a;
  --surface-2: #242424;
  --border: #2e2e2e;
  --text: #f0f0f0;
  --text-muted: #888;
  --accent: #7c3aed;
  --accent-hover: #6d28d9;
  --success: #16a34a;
  --error: #dc2626;
  --radius: 12px;
  --radius-sm: 6px;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 16px 80px;
}

/* ---- Card ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px 36px;
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.card__badge {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 20px;
  align-self: flex-start;
}

.card__badge--success {
  background: var(--success);
}

.card__icon {
  font-size: 40px;
  line-height: 1;
}

.card__title {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.3;
}

.card__subtitle {
  color: var(--text-muted);
  font-size: 15px;
}

.card__footer {
  font-size: 14px;
  color: var(--text-muted);
  text-align: center;
  padding-top: 4px;
}

/* ---- Form fields ---- */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field__label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
}

.field__input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 16px;
  padding: 10px 14px;
  width: 100%;
  transition: border-color 0.15s;
}

.field__input:focus {
  outline: none;
  border-color: var(--accent);
}

.field__input::placeholder {
  color: var(--text-muted);
}

/* ---- Consent checkbox ---- */
.consent {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  cursor: pointer;
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.5;
}

.consent input[type="checkbox"] {
  flex-shrink: 0;
  margin-top: 3px;
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ---- Buttons ---- */
.btn {
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  padding: 12px 20px;
  transition: background 0.15s, opacity 0.15s;
  width: 100%;
}

.btn--primary {
  background: var(--accent);
  color: #fff;
}

.btn--primary:hover:not(:disabled) {
  background: var(--accent-hover);
}

.btn--primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn--secondary {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
}

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

.link-btn {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: inherit;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.link-btn:hover {
  color: var(--accent-hover);
}

/* ---- Alerts ---- */
.alert {
  border-radius: var(--radius-sm);
  font-size: 14px;
  padding: 10px 14px;
}

.alert--error {
  background: rgba(220, 38, 38, 0.12);
  border: 1px solid rgba(220, 38, 38, 0.3);
  color: #fca5a5;
}

/* ---- Download list ---- */
.file-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.file-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
}

.file-item__name {
  font-size: 14px;
  word-break: break-all;
}

.file-item__size {
  color: var(--text-muted);
  font-size: 12px;
  white-space: nowrap;
}

.file-item__btn {
  background: var(--accent);
  border: none;
  border-radius: var(--radius-sm);
  color: #fff;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  padding: 6px 14px;
  text-decoration: none;
  white-space: nowrap;
}

.file-item__btn:hover {
  background: var(--accent-hover);
}

.loading {
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
  padding: 16px 0;
}

/* ---- Footer ---- */
.site-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: center;
  gap: 16px;
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-muted);
}

/* ---- Modals ---- */
.modal-overlay {
  background: rgba(0, 0, 0, 0.7);
  inset: 0;
  position: fixed;
  z-index: 10;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  left: 50%;
  max-height: 85vh;
  max-width: 560px;
  overflow-y: auto;
  padding: 32px 28px;
  position: fixed;
  top: 50%;
  transform: translate(-50%, -50%);
  width: calc(100% - 32px);
  z-index: 20;
}

.modal h2 {
  font-size: 20px;
  margin-bottom: 16px;
}

.modal h3 {
  font-size: 15px;
  font-weight: 600;
  margin-top: 16px;
  margin-bottom: 6px;
}

.modal p, .modal small {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.7;
  margin-bottom: 8px;
}

.modal a {
  color: var(--accent);
}

.modal__close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 24px;
  line-height: 1;
  padding: 0;
  position: absolute;
  right: 20px;
  top: 16px;
}

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

/* ---- Downloads state — wide layout ---- */

body[data-state="downloads"] {
  justify-content: flex-start;
  padding-top: 48px;
}

.downloads-wrap {
  width: 100%;
  max-width: 880px;
  display: flex;
  flex-direction: column;
  gap: 40px;
}

.downloads-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
}

.downloads-title {
  font-size: 26px;
  font-weight: 700;
  line-height: 1.3;
}

.downloads-subtitle {
  color: var(--text-muted);
  font-size: 15px;
}

.downloads-footer {
  text-align: center;
  font-size: 14px;
  color: var(--text-muted);
}

/* ---- Category sections ---- */

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

.category-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

.category-icon {
  color: var(--accent);
  display: flex;
  align-items: center;
}

/* ---- Download cards ---- */

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

.dl-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.dl-card:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.dl-card__icon {
  font-size: 28px;
  line-height: 1;
}

.dl-card__name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
  flex: 1;
}

.dl-card__size {
  font-size: 12px;
  color: var(--text-muted);
}

.dl-card__btn {
  display: block;
  text-align: center;
  background: var(--accent);
  color: #fff;
  border-radius: var(--radius-sm);
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  margin-top: 4px;
  transition: background 0.15s;
}

.dl-card__btn:hover {
  background: var(--accent-hover);
}

/* ---- Utility ---- */
[hidden] { display: none !important; }

@media (max-width: 480px) {
  .card {
    padding: 28px 20px;
  }

  .category-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }
}
