:root {
    --bg: #0e0c0a;
    --sf: #1c1917;
    --sf2: #252220;
    --bd: #3d2b1f;
    --gold: #c9a63c;
    --gold2: #8a6d2a;
    --red: #9b1c1c;
    --text: #e8dcc8;
    --muted: #9b8c7a;
    --link: #e8a23a;
  }

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

  body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
    line-height: 1.6;
  }

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

  a:hover {
    text-decoration: underline;
  }

  /* ── Nav ── */
  nav {
    background: var(--sf);
    border-bottom: 2px solid var(--gold2);
    padding: .85rem 2rem;
    display: flex;
    align-items: center;
    gap: 1rem;
  }

  .brand {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--gold);
    letter-spacing: .05em;
    text-transform: uppercase;
  }

  .brand:hover {
    text-decoration: none;
    color: var(--link);
  }

  .nav-sub {
    color: var(--muted);
    font-size: .8rem;
    flex-direction: column;
    display: flex;
  }

  .nav-enc {
    margin-left: auto;
    color: var(--gold);
    font-size: .85rem;
    font-weight: 600;
    border: 1px solid var(--gold2);
    border-radius: 4px;
    padding: .3rem .75rem;
    white-space: nowrap;
  }

  .nav-enc:hover {
    background: var(--sf2);
    text-decoration: none;
  }

  /* ── Layout ── */
  main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }

  /* ── Footer ── */
  footer {
    background: var(--sf);
    border-top: 1px solid var(--bd);
    padding: 1.5rem 2rem;
    text-align: center;
    color: var(--muted);
    font-size: .85rem;
    margin-top: 3rem;
  }

  footer a {
    color: var(--link);
  }

  /* ── Home ── */
  .hero {
    text-align: center;
    padding: 3rem 0 2rem;
  }

  .hero h1 {
    font-size: 2.4rem;
    color: var(--gold);
    font-family: Georgia, 'Times New Roman', serif;
    margin-bottom: .5rem;
    text-shadow: 0 2px 8px rgba(0, 0, 0, .6);
  }

  .hero p {
    color: var(--muted);
    font-size: 1.05rem;
  }

  .cat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 1rem;
    margin-top: 2rem;
  }

  .cat-card {
    background: var(--sf);
    border: 1px solid var(--bd);
    border-radius: 8px;
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: .5rem;
    color: var(--text);
    transition: border-color .2s, background .2s, transform .2s, box-shadow .2s;
  }

  .cat-card:hover {
    border-color: var(--gold);
    background: var(--sf2);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(201, 166, 60, .15);
    text-decoration: none;
    color: var(--gold);
  }

  .cat-icon {
    font-size: 2.2rem;
  }

  .cat-name {
    font-size: .85rem;
    text-align: center;
    font-weight: 500;
  }

  /* ── Breadcrumb ── */
  .breadcrumb {
    display: flex;
    align-items: center;
    gap: .5rem;
    padding: .75rem 0 1.25rem;
    font-size: .88rem;
    color: var(--muted);
  }

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

  /* ── Category page ── */
  .page-heading {
    font-size: 2rem;
    color: var(--gold);
    font-family: Georgia, serif;
    margin-bottom: .5rem;
  }

  .count-badge {
    background: var(--red);
    color: #fff;
    padding: .2rem .7rem;
    border-radius: 20px;
    font-size: .8rem;
    font-weight: 600;
    vertical-align: middle;
    margin-left: .5rem;
  }

  .search-box {
    display: block;
    width: 100%;
    padding: .7rem 1rem;
    background: var(--sf);
    border: 1px solid var(--bd);
    border-radius: 6px;
    color: var(--text);
    font-size: 1rem;
    margin: 1rem 0 1.5rem;
    outline: none;
  }

  .search-box:focus {
    border-color: var(--gold);
  }

  .search-box::placeholder {
    color: var(--muted);
  }

  .item-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: .5rem;
  }

    .starterGuide-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 3fr));
    gap: .5rem;
  }

  .item-link {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--sf);
    border: 1px solid var(--bd);
    border-radius: 6px;
    padding: .65rem 1rem;
    color: var(--text);
    font-size: .9rem;
    transition: border-color .15s, background .15s, color .15s;
  }

  .item-link:hover {
    border-color: var(--gold2);
    background: var(--sf2);
    color: var(--gold);
    text-decoration: none;
  }

  .lvl-badge {
    font-size: .7rem;
    background: var(--gold2);
    color: var(--bg);
    padding: .1rem .4rem;
    border-radius: 4px;
    font-weight: 700;
    flex-shrink: 0;
  }

  .no-results {
    text-align: center;
    color: var(--muted);
    padding: 3rem;
    grid-column: 1 / -1;
  }

  .center_align {
    align-items: center;
  }

  /* ── Item page ── */
  .item-title {
    font-size: 2.3rem;
    color: var(--gold);
    font-family: Georgia, serif;
    margin-bottom: .2rem;
    line-height: 1.2;
  }

  .item-cat {
    color: var(--muted);
    font-size: .9rem;
    margin-bottom: 1.25rem;
  }

  .api-link {
    display: inline-block;
    margin-bottom: 1.5rem;
    font-size: .8rem;
    color: var(--muted);
    border: 1px solid var(--bd);
    border-radius: 4px;
    padding: .2rem .6rem;
  }

  .api-link:hover {
    color: var(--link);
  }
  .border-light {
    border-top: 1px solid var(--muted);
    border-radius: 4px;
    padding: 1rem;
    margin-top: 1rem;
  }

  .section-title {
    font-size: .82rem;
    color: var(--gold);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    margin-bottom: .75rem;
  }

  .description {
    background: var(--sf);
    border-left: 3px solid var(--red);
    padding: 1rem 1.25rem;
    border-radius: 0 6px 6px 0;
    margin-bottom: 1.5rem;
    font-size: .95rem;
  }

  .description p+p {
    margin-top: .7rem;
  }

  .higher-level {
    background: var(--sf);
    border-left: 3px solid var(--gold2);
    padding: 1rem 1.25rem;
    border-radius: 0 6px 6px 0;
    margin-bottom: 1.5rem;
    font-size: .9rem;
  }

  .higher-level-title {
    font-size: .82rem;
    color: var(--gold);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .07em;
    margin-bottom: .5rem;
  }

  .props-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: .75rem;
    margin-bottom: 1.5rem;
  }

  .prop {
    background: var(--sf);
    border: 1px solid var(--bd);
    border-radius: 6px;
    padding: .75rem 1rem;
  }

  .prop-label {
    font-size: .75rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: .3rem;
  }

  .prop-value {
    color: var(--text);
    font-size: .92rem;
    font-weight: 500;
  }

  .prop-list {
    list-style: none;
    padding: 0;
  }

  .prop-list li {
    color: var(--text);
    font-size: .88rem;
    line-height: 1.7;
  }

  .prop-list li::before {
    content: "• ";
    color: var(--gold2);
  }

  details {
    background: var(--sf);
    border: 1px solid var(--bd);
    border-radius: 6px;
    margin-top: 1.5rem;
  }

  details summary {
    padding: .75rem 1rem;
    cursor: pointer;
    color: var(--muted);
    font-size: .88rem;
    user-select: none;
    list-style: none;
  }

  details summary:hover {
    color: var(--text);
  }

  details[open] summary {
    border-bottom: 1px solid var(--bd);
  }

  details pre {
    padding: 1rem;
    font-size: .78rem;
    overflow-x: auto;
    color: var(--text);
    line-height: 1.55;
    white-space: pre-wrap;
    word-break: break-word;
    font-family: 'Cascadia Code', 'Fira Code', Consolas, monospace;
  }

  /* Base Theme */
.neo-tokyo-theme {
  --bg-primary: #0a0a0f;
  --bg-secondary: #14141e;
  --neon-cyan: #00f0ff;
  --neon-pink: #ff003c;
  --text-main: #e0e0e0;
  --text-muted: #8a8a93;
  --border-color: #2a2a35;
  
  background-color: var(--bg-primary);
  color: var(--text-main);
  font-family: 'Inter', system-ui, sans-serif;
  padding: 2rem;
}

/* Headers */
.category-header {
  border-bottom: 2px solid var(--neon-cyan);
  padding-bottom: 1rem;
  margin-bottom: 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.category-header h1 {
  font-size: 2.5rem;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 2px;
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.3);
}

.badge {
  background: var(--neon-pink);
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 4px;
  font-family: monospace;
  font-weight: bold;
}

/* Recursive Nodes */
.section-node {
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-left: 4px solid var(--neon-cyan);
  margin-bottom: 1rem;
  border-radius: 4px;
  overflow: hidden;
  transition: all 0.2s ease;
}

/* Nested Depth Styling (Crucial for recursion) */
.section-node .section-node {
  background: rgba(0, 0, 0, 0.2);
  border-left-color: var(--neon-pink); /* Alternate color for depth */
  border-top: none;
  border-right: none;
  border-bottom: none;
  margin-left: 1rem;
  margin-right: 0;
  margin-top: 1rem;
}

.section-node .section-node .section-node {
  border-left-color: #fce83a; /* Third level depth */
}

/* Summary / Headers */
.node-header {
  padding: 1rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
  background: rgba(255, 255, 255, 0.02);
}

.node-header:hover {
  background: rgba(0, 240, 255, 0.05);
}

.header-titles {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.node-title {
  margin: 0;
  font-size: 1.25rem;
  color: var(--neon-cyan);
}

.node-subtitle {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: italic;
}

/* Details Open State */
details[open] > .node-header .toggle-icon {
  transform: rotate(180deg);
}

.toggle-icon {
  transition: transform 0.3s ease;
  color: var(--text-muted);
  font-size: 0.8rem;
}

/* Body Content */
.node-body {
  padding: 1rem;
  border-top: 1px solid var(--border-color);
}

.node-description {
  font-size: 1rem;
  line-height: 1.6;
  margin-top: 0;
}

.node-content {
  background: rgba(0, 0, 0, 0.3);
  padding: 1rem;
  border-radius: 4px;
  font-family: monospace;
  white-space: pre-wrap; /* Honors JSON line breaks */
  margin-bottom: 1rem;
}

/* Tags */
.node-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.tag-chip {
  background: transparent;
  border: 1px solid var(--neon-pink);
  color: var(--neon-pink);
  padding: 0.2rem 0.6rem;
  border-radius: 20px;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Attributes Grid */
.node-attributes {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
  background: rgba(0, 0, 0, 0.2);
  padding: 1rem;
  border-radius: 4px;
  margin: 0 0 1rem 0;
}

.attr-row {
  display: flex;
  flex-direction: column;
}

.node-attributes dt {
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  margin-bottom: 0.25rem;
}

.node-attributes dd {
  margin: 0;
  font-weight: 600;
  color: #fff;
}

/* Remove marker in WebKit */
details > summary::-webkit-details-marker {
  display: none;
}


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

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

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

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

  /* Shop Navigation and Header Styles */
  nav {
    display: flex;
    flex-direction: row;
  }

  .header {
    padding: 1rem;
    border-bottom: 1px solid #ccc;
  }

  .title {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
  }

  .description {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 0.5rem;
  }

  .type {
    font-size: 0.9rem;
    font-weight: 500;
    margin-bottom: 0.5rem;
  }

  .owner {
    margin-top: 1rem;
    font-weight: bold;
  }

  .species {
    font-size: 0.9rem;
    color: #666;
  }

  .shop {
    display: flex;
    flex-direction: column;
    gap: 1rem;
  }

  /* Items Container and Item Styles */
  .items {
    display: grid;
    gap: 1rem;
    padding: 1rem;
    grid-template-columns: repeat(3, 1fr);
  }

  .item {
    border: 1px solid #3b2f27;
    padding: 1rem;
    border-radius: 4px;
    background-color: #242020;
    max-width: 500px;
  }

  .itemName {
    font-size: 1.5rem;
    font-weight: bold;
    margin-bottom: 0.5rem;
  }

  .rarity {
    font-size: 0.9rem;
    margin-bottom: 0.25rem;
  }

  .uses {
    font-size: 0.85rem;
    color: #555;
    margin-bottom: 0.25rem;
  }

  .price {
    font-size: 1rem;
    font-weight: bold;
    color: #2c5f2d;
    margin-top: 0.5rem;
  }

  .intro-copy {
    color: var(--muted);
    margin-bottom: 1.5rem;
  }

  .quantity {
    font-size: 0.9rem;
    color: #666;
  }
