/* ============================================================
   Nintendo Switch Prod Keys — prodkeys.anydoor.cc
   Dark GitHub-style theme
   ============================================================ */

/* ---- CSS Variables ---- */
:root {
  --bg-primary: #0d1117;
  --bg-secondary: #161b22;
  --bg-tertiary: #21262d;
  --bg-hover: #30363d40;
  --text-primary: #e6edf3;
  --text-secondary: #8b949e;
  --text-muted: #656d76;
  --accent-blue: #58a6ff;
  --accent-blue-dark: #1f6feb;
  --accent-green: #3fb950;
  --accent-green-dark: #238636;
  --accent-orange: #d29922;
  --border: #30363d;
  --border-light: #21262d;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --shadow: 0 0 0 1px var(--border);
}

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

html {
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  font-size: 15px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

main {
  flex: 1;
  max-width: 900px;
  width: 100%;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

a {
  color: var(--accent-blue);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  max-width: 100%;
  height: auto;
}

code {
  font-family: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', ui-monospace, monospace;
  font-size: 0.875em;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.1em 0.4em;
  color: var(--text-primary);
}

/* ---- Container ---- */
.container {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ---- Site Header ---- */
.site-header {
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.site-header .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 56px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1rem;
  color: var(--text-primary);
  text-decoration: none;
}

.logo:hover {
  color: var(--accent-blue);
  text-decoration: none;
}

.logo-icon {
  width: 22px;
  height: 22px;
  color: var(--accent-blue);
}

.nav-links {
  display: flex;
  gap: 0.25rem;
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.15s, background 0.15s;
}

.nav-links a:hover,
.nav-links a[aria-current="page"] {
  color: var(--text-primary);
  background: var(--bg-hover);
}

/* ---- Section Base ---- */
.section {
  margin-top: 3.5rem;
}

.section h2 {
  font-size: 1.375rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.section-desc {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
}

.section-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1rem;
}

.section-header h2 {
  margin-bottom: 0;
}

.version-count {
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  border: 1px solid var(--border);
}

/* ---- Hero ---- */
.hero {
  padding: 3.5rem 0 2rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(63, 185, 80, 0.1);
  border: 1px solid rgba(63, 185, 80, 0.3);
  color: var(--accent-green);
  font-size: 0.8125rem;
  font-weight: 600;
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  margin-bottom: 1.25rem;
  font-family: 'JetBrains Mono', monospace;
}

.badge-dot {
  width: 7px;
  height: 7px;
  background: var(--accent-green);
  border-radius: 50%;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.hero h1 {
  font-size: clamp(1.875rem, 5vw, 2.75rem);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
  color: var(--text-primary);
}

.hero-lead {
  font-size: 1.0625rem;
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto 2rem;
  line-height: 1.7;
}

/* ---- Buttons ---- */
.hero-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 1.75rem;
}

.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--accent-green-dark);
  color: #fff;
  font-weight: 600;
  font-size: 0.9375rem;
  padding: 0.625rem 1.5rem;
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: background 0.15s, transform 0.1s;
  border: 1px solid rgba(63, 185, 80, 0.4);
}

.btn-download:hover {
  background: #2ea043;
  transform: translateY(-1px);
  text-decoration: none;
  color: #fff;
}

.btn-download svg {
  width: 18px;
  height: 18px;
}

.btn-download-lg {
  font-size: 1rem;
  padding: 0.75rem 2rem;
  margin-top: 1rem;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.9375rem;
  padding: 0.625rem 1.25rem;
  border-radius: var(--radius-md);
  text-decoration: none;
  border: 1px solid var(--border);
  transition: background 0.15s, border-color 0.15s;
}

.btn-secondary:hover {
  background: #30363d;
  border-color: #8b949e;
  text-decoration: none;
  color: var(--text-primary);
}

/* ---- Hero Meta ---- */
.hero-meta {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.hero-meta span {
  display: flex;
  align-items: center;
  gap: 5px;
}

.hero-meta svg {
  width: 14px;
  height: 14px;
  opacity: 0.7;
}

/* ---- Features ---- */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 1rem;
}

.feature-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.feature-icon {
  width: 36px;
  height: 36px;
  background: rgba(88, 166, 255, 0.1);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.875rem;
  color: var(--accent-blue);
}

.feature-icon svg {
  width: 20px;
  height: 20px;
}

.feature-card h3 {
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: 0.375rem;
  color: var(--text-primary);
}

.feature-card p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.6;
}

/* ---- Emulators Grid ---- */
.emulator-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.625rem;
  list-style: none;
}

.emulator-item {
  display: flex;
  flex-direction: column;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.875rem 1rem;
}

.emulator-name {
  font-weight: 600;
  font-size: 0.9375rem;
  color: var(--text-primary);
}

.emulator-platform {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-top: 0.25rem;
}

/* ---- Version Table ---- */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.version-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.version-table th {
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.version-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  vertical-align: middle;
}

.version-table tbody tr:last-child td {
  border-bottom: none;
}

.version-table tbody tr:hover td {
  background: var(--bg-hover);
}

.latest-row td {
  background: rgba(63, 185, 80, 0.04);
}

.version-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.version-link:hover {
  text-decoration: none;
}

.version-num {
  background: rgba(88, 166, 255, 0.1);
  border-color: rgba(88, 166, 255, 0.2);
  color: var(--accent-blue);
  font-weight: 600;
}

.source-cell {
  color: var(--text-secondary);
}

.size-cell {
  color: var(--text-muted);
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.8125rem;
}

/* ---- Badges ---- */
.badge-latest {
  display: inline-block;
  background: rgba(63, 185, 80, 0.15);
  color: var(--accent-green);
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.1rem 0.5rem;
  border-radius: 20px;
  border: 1px solid rgba(63, 185, 80, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  vertical-align: middle;
}

.badge-latest-sm {
  font-size: 0.625rem;
  padding: 0.05rem 0.35rem;
  background: rgba(63, 185, 80, 0.15);
  color: var(--accent-green);
  border-radius: 10px;
  border: 1px solid rgba(63, 185, 80, 0.3);
  margin-left: 4px;
}

/* ---- Download Button (table) ---- */
.btn-dl {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  border: 1px solid var(--border);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  white-space: nowrap;
}

.btn-dl:hover {
  background: var(--accent-green-dark);
  border-color: var(--accent-green-dark);
  color: #fff;
  text-decoration: none;
}

.btn-dl svg {
  width: 13px;
  height: 13px;
}

/* ---- Install Guide ---- */
.guide-tabs {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
}

.guide-tab {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.guide-tab h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9375rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--accent-blue);
}

.guide-tab h3 svg {
  width: 18px;
  height: 18px;
}

.steps {
  list-style: none;
  counter-reset: step;
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.steps li {
  counter-increment: step;
  display: flex;
  gap: 10px;
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.5;
  padding-left: 0;
}

.steps li::before {
  content: counter(step);
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  background: var(--accent-blue-dark);
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  border-radius: 50%;
  margin-top: 1px;
  flex-shrink: 0;
}

/* ---- FAQ ---- */
.faq-list {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.faq-item {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 0.15s;
}

.faq-item:hover {
  border-color: #444c56;
}

.faq-item[open] {
  border-color: #444c56;
}

.faq-item summary {
  padding: 1rem 1.25rem;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9375rem;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  user-select: none;
}

.faq-item summary::-webkit-details-marker { display: none; }

.faq-item summary::after {
  content: '';
  width: 18px;
  height: 18px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%238b949e'%3E%3Cpath d='M1.75 8a.75.75 0 0 1 .75-.75h4.75V2.75a.75.75 0 0 1 1.5 0v4.5h4.75a.75.75 0 0 1 0 1.5H8.75v4.75a.75.75 0 0 1-1.5 0V8.75H2.5A.75.75 0 0 1 1.75 8z'/%3E%3C/svg%3E") center/16px no-repeat;
  flex-shrink: 0;
  transition: transform 0.2s;
}

.faq-item[open] summary::after {
  transform: rotate(45deg);
}

.faq-body {
  padding: 0 1.25rem 1.25rem;
  border-top: 1px solid var(--border);
}

.faq-body p {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.7;
  padding-top: 0.875rem;
}

/* ---- Breadcrumb ---- */
.breadcrumb {
  margin-bottom: 1.75rem;
}

.breadcrumb ol {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  list-style: none;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.breadcrumb a {
  color: var(--text-secondary);
}

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

.breadcrumb [aria-current="page"] {
  color: var(--text-primary);
}

/* ---- Version Page ---- */
.version-hero {
  border-bottom: 1px solid var(--border);
  padding-bottom: 2rem;
  margin-bottom: 0;
}

.version-tag {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.875rem;
}

.version-tag code {
  font-size: 0.875rem;
  padding: 0.2rem 0.6rem;
}

.version-hero h1 {
  font-size: 2rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
  letter-spacing: -0.03em;
}

.version-desc {
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
  max-width: 520px;
}

.version-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}

.meta-item strong {
  color: var(--text-primary);
}

/* ---- Install Steps (Version Page) ---- */
.install-steps {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
}

.step {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.step-num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  min-width: 28px;
  background: var(--accent-blue-dark);
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 700;
  border-radius: 50%;
}

.step strong {
  display: block;
  font-size: 0.9375rem;
  margin-bottom: 0.25rem;
  color: var(--text-primary);
}

.step p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.6;
}

/* ---- Version Nav Grid ---- */
.version-nav-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.version-nav-item {
  display: inline-flex;
  align-items: center;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.3rem 0.7rem;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-family: 'JetBrains Mono', monospace;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.version-nav-item:hover {
  background: var(--bg-tertiary);
  border-color: var(--accent-blue);
  color: var(--accent-blue);
  text-decoration: none;
}

/* ---- Footer ---- */
.site-footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 2fr;
  gap: 2rem;
  padding: 2rem 0 1.5rem;
}

.footer-brand .logo-text {
  font-weight: 700;
  font-size: 1rem;
  display: block;
  margin-bottom: 0.5rem;
}

.footer-brand p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.6;
}

.footer-nav h3,
.footer-note h3 {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 0.75rem;
}

.footer-nav ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.footer-nav a {
  color: var(--text-secondary);
  font-size: 0.875rem;
  text-decoration: none;
}

.footer-nav a:hover {
  color: var(--accent-blue);
}

.footer-note p {
  color: var(--text-muted);
  font-size: 0.8125rem;
  line-height: 1.6;
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding: 1rem 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.footer-bottom a {
  color: var(--text-secondary);
}

.footer-bottom a:hover {
  color: var(--accent-blue);
}

/* ---- Responsive ---- */
@media (max-width: 768px) {
  .nav-links a:not([href="/"]) {
    display: none;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 1.5rem;
    padding: 1.5rem 0 1rem;
  }

  .features-grid {
    grid-template-columns: 1fr;
  }

  .guide-tabs {
    grid-template-columns: 1fr;
  }

  .version-table th:nth-child(2),
  .version-table td:nth-child(2) {
    display: none;
  }

  .hero h1 {
    font-size: 1.875rem;
  }
}

@media (max-width: 480px) {
  main {
    padding: 1.5rem 1rem 2rem;
  }

  .hero {
    padding: 2.5rem 0 1.5rem;
  }

  .hero-meta span:last-child {
    display: none;
  }

  .version-table th:nth-child(3),
  .version-table td:nth-child(3) {
    display: none;
  }
}
