:root {
  --bg: #07080d;
  --surface: rgba(16, 19, 30, 0.82);
  --surface-hover: rgba(24, 29, 46, 0.94);
  --border: rgba(255, 255, 255, 0.09);
  --border-hi: rgba(99, 102, 241, 0.55);
  --text: #f4f4f8;
  --muted: #9ca3b8;
  --accent: #38bdf8;
  --accent-2: #a855f7;
  --mono: 'JetBrains Mono', monospace;
  --display: 'Outfit', sans-serif;
  --sans: 'Space Grotesk', sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  min-height: 100vh;
  overflow-x: hidden;
  background-image:
    radial-gradient(circle at 15% 15%, rgba(56, 189, 248, 0.1), transparent 45%),
    radial-gradient(circle at 85% 20%, rgba(168, 85, 247, 0.1), transparent 45%),
    radial-gradient(circle at 50% 90%, rgba(16, 185, 129, 0.07), transparent 50%);
  background-attachment: fixed;
}

.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: radial-gradient(circle at 50% 30%, black 40%, transparent 90%);
  z-index: 0;
}

.archive-shell {
  position: relative;
  z-index: 1;
  max-width: 1260px;
  margin: 0 auto;
  padding: 40px 24px 96px;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 36px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
  transition: all 0.2s ease;
}

.back-link:hover {
  color: var(--text);
  border-color: rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.07);
}

.back-link.accent {
  color: #e0f2fe;
  border-color: rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.1);
}

.back-link.accent:hover {
  border-color: rgba(56, 189, 248, 0.7);
  background: rgba(56, 189, 248, 0.2);
}

.archive-header {
  text-align: center;
  margin-bottom: 42px;
}

.eyebrow {
  display: inline-block;
  font-family: var(--mono);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
  color: var(--accent);
  border: 1px solid rgba(56, 189, 248, 0.3);
  background: rgba(56, 189, 248, 0.08);
  padding: 5px 14px;
  border-radius: 999px;
  margin-bottom: 14px;
}

.archive-header h1 {
  font-family: var(--display);
  font-size: clamp(2.6rem, 6vw, 4.4rem);
  font-weight: 800;
  margin: 0 0 14px;
  line-height: 1.05;
  background: linear-gradient(120deg, #ffffff 25%, #38bdf8 65%, #a855f7 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.subtitle {
  max-width: 720px;
  margin: 0 auto 28px;
  color: var(--muted);
  font-size: 1.06rem;
  line-height: 1.6;
}

.stats-bar {
  display: inline-flex;
  gap: 28px;
  padding: 12px 26px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--surface);
  margin-bottom: 28px;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat span {
  font-family: var(--display);
  font-size: 1.55rem;
  font-weight: 800;
  color: #fff;
}

.stat label {
  font-family: var(--mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.controls-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  margin-top: 8px;
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pill {
  font-family: var(--sans);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  padding: 8px 15px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pill:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.22);
}

.pill.active {
  color: #07080d;
  background: linear-gradient(135deg, #38bdf8, #a855f7);
  border-color: transparent;
}

.search-input {
  width: 280px;
  max-width: 100%;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(12, 14, 22, 0.9);
  color: var(--text);
  font-family: var(--sans);
  font-size: 0.9rem;
  outline: none;
}

.search-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

.archive-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 22px;
}

.shader-card {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 24px;
  transition: transform 0.22s ease, border-color 0.22s ease, background 0.22s ease;
  backdrop-filter: blur(10px);
}

.shader-card:hover {
  transform: translateY(-3px);
  border-color: var(--border-hi);
  background: var(--surface-hover);
}

.card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.cat-badge {
  font-family: var(--mono);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.12);
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, 0.25);
}

.file-count {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
}

.shader-card h2 {
  font-family: var(--display);
  font-size: 1.35rem;
  margin: 0 0 8px;
  color: #fff;
}

.shader-card p {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.tech-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 18px;
}

.tech-tag {
  font-family: var(--mono);
  font-size: 0.7rem;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 3px 8px;
  border-radius: 6px;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.btn-launch,
.btn-inspect {
  font-family: var(--sans);
  font-size: 0.84rem;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 10px;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-launch {
  background: linear-gradient(135deg, #38bdf8, #818cf8);
  color: #07080d;
  border: none;
}

.btn-launch:hover {
  filter: brightness(1.1);
}

.btn-inspect {
  background: rgba(255, 255, 255, 0.05);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.btn-inspect:hover {
  background: rgba(168, 85, 247, 0.16);
  border-color: rgba(168, 85, 247, 0.5);
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(4, 5, 10, 0.82);
  backdrop-filter: blur(8px);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-panel {
  width: 100%;
  max-width: 960px;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  background: #0d1019;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 30px 70px rgba(0, 0, 0, 0.7);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
}

.modal-path {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--accent);
  margin-bottom: 3px;
}

.modal-header h2 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.25rem;
}

.modal-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-secondary {
  font-family: var(--mono);
  font-size: 0.78rem;
  padding: 7px 12px;
  border-radius: 8px;
  border: 1px solid rgba(56, 189, 248, 0.4);
  background: rgba(56, 189, 248, 0.12);
  color: #e0f2fe;
  cursor: pointer;
}

.btn-close {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
}

.modal-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px 22px;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid var(--border);
}

.file-tab {
  font-family: var(--mono);
  font-size: 0.75rem;
  padding: 5px 10px;
  border-radius: 7px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  cursor: pointer;
}

.file-tab.active {
  color: #fff;
  background: rgba(56, 189, 248, 0.16);
  border-color: rgba(56, 189, 248, 0.45);
}

.code-view {
  margin: 0;
  padding: 20px 22px;
  overflow: auto;
  flex: 1;
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.55;
  color: #dbeafe;
  background: #080a10;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 16px;
}
