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

:root[data-theme="dark"] {
  --bg: #000; --fg: #fff; --muted: #888; --border: #222; --card: #111;
}
:root[data-theme="light"] {
  --bg: #fff; --fg: #000; --muted: #666; --border: #ddd; --card: #f5f5f5;
}

body {
  background: var(--bg);
  color: var(--fg);
  font-family: "Roboto Mono", monospace;
  transition: background 0.3s, color 0.3s;
}

header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2rem 2rem 1rem;
  max-width: 1200px;
  margin: 0 auto;
}

header h1 {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

header h1 a {
  color: var(--fg);
  text-decoration: none;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.nav-links a {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.02em;
  transition: color 0.2s;
}

.nav-links a:hover {
  color: var(--fg);
}

.nav-links a.nav-active {
  color: var(--fg);
}

.deck-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.7rem;
  font-weight: 500;
  color: #3ecf8e;
  text-decoration: none;
  letter-spacing: 0.02em;
  padding: 0.2rem 0.5rem;
  border: 1px solid rgba(62, 207, 142, 0.25);
  border-radius: 4px;
  transition: background 0.2s, border-color 0.2s;
  margin-top: 0.35rem;
}

.deck-badge:hover {
  background: rgba(62, 207, 142, 0.1);
  border-color: rgba(62, 207, 142, 0.5);
}

.toggle {
  background: none;
  border: 1px solid var(--border);
  color: var(--fg);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.3s, background 0.2s;
}
.toggle:hover { border-color: var(--fg); background: rgba(128,128,128,0.1); }
.toggle svg { width: 18px; height: 18px; }
:root[data-theme="dark"] .theme-icon--moon { display: none; }
:root[data-theme="light"] .theme-icon--sun { display: none; }

.page-intro {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem 1rem;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.5;
  letter-spacing: 0.02em;
}

.page-intro a {
  color: var(--muted);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.page-intro a:hover {
  color: var(--fg);
  border-bottom-color: var(--border);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 1.5rem;
  padding: 1.5rem 2rem 4rem;
  max-width: 1200px;
  margin: 0 auto;
  align-items: start;
}

/* Guides: grid row height = tallest card; stretch must continue through nested flex (see .item-cta below) */
.grid.grid--guides {
  align-items: stretch;
}

.grid.grid--guides > .card.guide {
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.grid.grid--guides > .card.guide > .guide-preview {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.grid.grid--guides .guide-preview .item-tagline {
  flex: 1 1 auto;
  min-height: 0;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  transition: background 0.3s, border-color 0.3s;
}

.card .video-wrap {
  position: relative;
  padding-bottom: 56.25%;
  height: 0;
}

.card .video-wrap iframe {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  border: none;
}

.card .title {
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.4;
  color: var(--fg);
  transition: color 0.3s;
}

.card.app,
.card.guide {
  display: flex;
  flex-direction: column;
}

.card .app-preview,
.card .guide-preview {
  position: relative;
  width: 100%;
  min-height: 0;
  padding: 1.35rem 1.25rem 1.45rem;
  background: linear-gradient(145deg, rgba(62, 207, 142, 0.08) 0%, var(--card) 55%);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
  gap: 0.5rem;
  text-decoration: none;
  color: inherit;
  transition: background 0.25s, border-color 0.25s;
}

.card .guide-preview {
  background: linear-gradient(145deg, rgba(62, 130, 207, 0.1) 0%, var(--card) 55%);
}

.card .app-preview:hover {
  background: linear-gradient(145deg, rgba(62, 207, 142, 0.14) 0%, var(--card) 50%);
}

.card .guide-preview:hover {
  background: linear-gradient(145deg, rgba(62, 130, 207, 0.16) 0%, var(--card) 50%);
}

.card .app-preview .item-name,
.card .guide-preview .item-name {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.card .app-preview .item-tagline,
.card .guide-preview .item-tagline {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.5;
  max-width: 100%;
}

.card .app-preview .item-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.35rem;
  font-size: 0.7rem;
  font-weight: 500;
  color: #3ecf8e;
  letter-spacing: 0.02em;
}

.card .guide-preview .item-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.35rem;
  font-size: 0.7rem;
  font-weight: 500;
  color: #6eb3f0;
  letter-spacing: 0.02em;
}

.card .app-preview .item-cta svg,
.card .guide-preview .item-cta svg {
  width: 0.85em;
  height: 0.85em;
}

@media (max-width: 768px) {
  header {
    padding: 1.5rem 1.25rem 0.85rem;
  }
  .grid {
    padding: 1.25rem 1.25rem 3rem;
    gap: 1.25rem;
  }
  .page-intro {
    padding: 0 1.25rem 0.85rem;
  }
}

@media (max-width: 480px) {
  header { padding: 1.25rem 1rem 0.75rem; }
  .grid { padding: 1rem 1rem 2.5rem; gap: 1rem; }
  .page-intro { padding: 0 1rem 0.75rem; }
  .card .app-preview,
  .card .guide-preview {
    padding: 1.15rem 1rem 1.25rem;
  }
  .card .app-preview .item-name,
  .card .guide-preview .item-name {
    font-size: 0.95rem;
  }
}

/* After .card .guide-preview .item-cta { margin-top: 0.35rem } — guides need CTA pinned to bottom */
.grid.grid--guides > .card.guide > .guide-preview > .item-cta {
  margin-top: auto;
}

/* 404 */
.error-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 2rem 4rem;
  min-height: calc(100vh - 10rem);
  display: flex;
  align-items: center;
  justify-content: center;
}

.error-card {
  width: 100%;
  max-width: 28rem;
  padding: 2rem 1.75rem;
  text-align: center;
  background: linear-gradient(160deg, rgba(62, 207, 142, 0.07) 0%, var(--card) 42%, var(--card) 100%);
}

.error-code {
  font-size: 2.5rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  color: var(--muted);
  line-height: 1;
  margin-bottom: 0.65rem;
}

.error-title {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin-bottom: 0.75rem;
}

.error-desc {
  font-size: 0.75rem;
  font-weight: 400;
  color: var(--muted);
  line-height: 1.55;
  letter-spacing: 0.02em;
  margin-bottom: 1.5rem;
}

.error-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 0.85rem;
  justify-content: center;
  align-items: center;
}

.error-actions a {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted);
  text-decoration: none;
  letter-spacing: 0.02em;
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.error-actions a:hover {
  color: var(--fg);
  border-bottom-color: var(--border);
}

.error-actions a.error-actions--primary {
  color: #3ecf8e;
  border: 1px solid rgba(62, 207, 142, 0.35);
  border-radius: 4px;
  padding: 0.4rem 0.85rem;
}

.error-actions a.error-actions--primary:hover {
  background: rgba(62, 207, 142, 0.1);
  border-color: rgba(62, 207, 142, 0.5);
  border-bottom-color: rgba(62, 207, 142, 0.5);
}

@media (max-width: 768px) {
  .error-main {
    padding: 0.75rem 1.25rem 3rem;
    min-height: calc(100vh - 9rem);
  }
}

@media (max-width: 480px) {
  .error-main {
    padding: 0.5rem 1rem 2.5rem;
  }
  .error-card {
    padding: 1.65rem 1.25rem;
  }
  .error-code {
    font-size: 2rem;
  }
}
