* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  scroll-behavior: smooth;
  font-family: 'Radio Canada Big', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    sans-serif;
}

:root {
  --primary-color: #d97706;
  --primary-dark: #b45309;
  --secondary-color: #c2410c;
  --accent-color: #f97316;
  --bg-primary: #0b0a0a;
  --bg-secondary: #1b1410;
  --bg-tertiary: #2b1f18;
  --text-primary: #f7f3ef;
  --text-secondary: #d6c7bd;
  --text-muted: #b8a89a;
  --border-color: rgba(255, 255, 255, 0.04);
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --error-color: #ef4444;
  --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  --shadow-lg: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  --site-inner-max: 1440px;
  --sidebar-width: 260px;
  --site-header-height: 64px;
  --scrollbar-gap: 0px;
  --z-header: 1400;
  --z-drawer: 1300;
  --z-backdrop: 1200;
  --z-modal: 1500;
  --z-scroll-top: 1450;
  --sidebar-top-desktop: 200px;
  --sidebar-top-short: 84px;
}

/* Custom .cur cursors (use percent-encoded filenames for paths with spaces) */
:root {
  /* Provide both percent-encoded and quoted paths to handle different file:// resolution behaviors */
  --cursor-normal: url('./cursors/normal%20cursor.cur'), url('./cursors/normal cursor.cur'), auto;
  --cursor-text: url('./cursors/text.cur'), text;
  --cursor-link: url('./cursors/link%20select.cur'), url('./cursors/link select.cur'), pointer;
  --cursor-busy: url('./cursors/busy.cur'), progress;
  --cursor-alt: url('./cursors/alternate%20select.cur'), url('./cursors/alternate select.cur'),
    pointer;
  --cursor-wib: url('./cursors/wib.cur'), auto;
}

/* Apply default cursors */
html,
body {
  cursor: var(--cursor-normal);
}

/* Text inputs */
input,
textarea,
select {
  cursor: var(--cursor-text);
}

/* Links and actionable elements */
a,
button,
.side-link,
.header-btn {
  cursor: var(--cursor-link);
}

/* Busy state utility */
.busy,
html[aria-busy='true'] * {
  cursor: var(--cursor-busy) !important;
}

/* Alternate cursor utility */
.cursor-alt {
  cursor: var(--cursor-alt) !important;
}

/* Small decorative cursor */
.cursor-wib {
  cursor: var(--cursor-wib) !important;
}

body {
  font-family: 'Radio Canada Big', 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
    sans-serif;
  background: linear-gradient(180deg, var(--bg-primary) 0%, #0f0b09 100%);
  background-color: #0f0b09; /* fallback */
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
}

html,
body,
input,
button,
select,
textarea {
  font-family: inherit;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: 'Radio Canada Big', 'Inter', sans-serif;
  font-weight: 600;
}

.site-wrapper {
  width: 100%;
  background: transparent;
}

.site-inner {
  max-width: var(--site-inner-max);
  margin: 0 auto;
  padding: 0 1rem 0 calc(var(--sidebar-width) + 48px);
  position: relative;
}
.layout {
  display: flex;
  min-height: 100vh;
  align-items: flex-start;
  gap: 32px;
}

.sidebar {
  position: fixed;
  left: max(16px, calc((100vw - var(--site-inner-max)) / 2 + 16px));
  top: var(--site-header-height);
  bottom: 0;
  width: var(--sidebar-width);
  background: linear-gradient(180deg, var(--bg-secondary), var(--bg-tertiary));
  border-right: 1px solid var(--border-color);
  padding: 0;
  display: block;
  margin-right: 48px;
  overflow: hidden;
}
.sidebar-content {
  height: 100%;
  padding: 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  border-radius: 0;
  box-shadow: none;
  background: transparent;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
}

.sidebar-content .side-nav {
  -webkit-overflow-scrolling: touch;
  overflow: auto;
  max-height: calc(100vh - var(--site-header-height) - 40px);
  padding-bottom: 1rem;
}

.sidebar-content .side-nav-list {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sidebar-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 1.25rem;
  padding: 0.25rem 0.5rem;
  margin-left: 0.5rem;
  cursor: var(--cursor-link);
  z-index: var(--z-header);
}

.sidebar .logo i {
  font-size: 1.75rem;
  color: var(--primary-color);
}

.site-logo {
  width: 32px;
  height: 32px;
  object-fit: contain;
  display: inline-block;
}

.sidebar .logo h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.side-nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.side-link {
  display: block;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.6rem 0.75rem;

  width: 100%;
  border-radius: 8px;
  transition: background 0.15s ease, color 0.15s ease;
  font-weight: 600;
}

.side-link:hover,
.side-link.active {
  background: rgba(217, 119, 6, 0.12);
  color: var(--text-primary);
}

.side-link.active {
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  color: white;
}

.side-link:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.12);
}

.sidebar-bottom {
  margin-top: auto;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-align: center;
}

.main-area {
  flex: 1;
  display: block;

  margin-left: 0;
}

.header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  width: 100%;
  padding: 0;
  background: linear-gradient(180deg, #1b1410e6, var(--bg-tertiary));
}

.header .site-inner {
  padding-left: 1rem;
  padding-right: 1rem;
}

.header-container {
  max-width: var(--site-inner-max);
  margin: 0 auto;
  padding: 0.5rem 1rem;
  display: block;
}

.header-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 0;
  gap: 4rem;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 0 0 auto;
}

.header-center {
  flex: 1 1 60%;
  display: flex;
  justify-content: center;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex: 0 0 auto;
}

.header-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.45rem 0.8rem;
  border-radius: 8px;
  color: var(--text-secondary);
  text-decoration: none;
  font-weight: 600;
  transition: background 160ms ease, color 120ms ease, transform 120ms ease;
}

.header-btn:hover,
.header-btn:focus {
  transition: background 160ms ease, color 120ms ease, transform 120ms ease;
  color: var(--text-primary);
}

.header-btn-discord {
  transition: background 160ms ease, color 120ms ease, transform 120ms ease;
  background: linear-gradient(180deg, #5865f2, #4752c4);
  color: white;
}
.header-btn-discord:hover,
.header-btn-discord:focus {
  transition: background 160ms ease, color 120ms ease, transform 120ms ease;
  background: linear-gradient(180deg, #4752c4, #393e4a);
}

@media (max-width: 900px) {
  .header-center {
    flex: 1 1 50%;
  }
}

.main-area {
  margin-left: 0;
}

@media (max-width: 640px) {
  .sidebar-toggle {
    display: inline-flex;
  }
}

.logo {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.logo i {
  font-size: 1.5rem;
  color: var(--primary-color);
}

.logo h1 {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.nav-list {
  display: flex;
  list-style: none;
  gap: 0.5rem;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  transition: all 0.2s ease;
  font-weight: 500;
  position: relative;
}

.nav-link:hover,
.nav-link.active {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.nav-link.active:not(.logo)::after {
  content: '';
  position: absolute;
  bottom: -0.5rem;
  left: 50%;
  transform: translateX(-50%);
  width: 4px;
  height: 4px;
  background: var(--primary-color);
  border-radius: 8px;
}

.nav-link.logo,
.nav-link.logo:hover,
.nav-link.logo.active {
  color: inherit;
  background: transparent;
}

.main {
  padding: 2rem 0;
  min-height: calc(100vh - 200px);
}

.search-section {
  margin-bottom: 2rem;
}

.search-container {
  max-width: 900px;
  margin: 0 auto;
}

.search-box {
  width: 100%;
  position: relative;
}

.search-icon {
  position: absolute;
  left: 1rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1.1rem;
}

.search-input {
  width: 100%;
  padding: 1rem 1rem 1rem 3rem;
  background: var(--bg-secondary);
  border: 2px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 1rem;
  transition: all 0.2s ease;
}

.search-input:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 3px rgba(217, 119, 6, 0.08);
}

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

.clear-search {
  position: absolute;
  right: 1rem;

  width: 36px;
  height: 36px;
  top: calc(50% - 18px);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: var(--cursor-link);
  padding: 0;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}

.clear-search:hover {
  color: var(--text-primary);
  background: var(--bg-tertiary);
}

.search-filters {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.filter-select {
  padding: 0.5rem 2.25rem 0.5rem 1rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 0.875rem;
  cursor: var(--cursor-link);
  transition: all 0.2s ease;
  width: 100%;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
}

.filter-select:focus {
  outline: none;
  border-color: var(--primary-color);
}

.filter-select::-ms-expand {
  display: none;
}

.select-wrap {
  position: relative;
  display: inline-block;
}

.select-wrap::after {
  content: '';
  position: absolute;
  right: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path fill='%23d6c7bd' d='M7.41 8.58L12 13.17l4.59-4.59L18 10l-6 6-6-6z'/></svg>");
  background-repeat: no-repeat;
  background-size: 14px 14px;
  transition: transform 250ms ease;
  pointer-events: none;
}

.select-wrap.open::after {
  transform: translateY(-50%) rotate(180deg);
}

.results-info {
  margin-bottom: 1.5rem;
}

.results-heading h2 {
  font-size: 1.75rem;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.results-count {
  color: var(--text-secondary);
  font-size: 0.875rem;
}

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

.guide-card {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), rgba(0, 0, 0, 0.02));
  border: 1px solid rgba(255, 255, 255, 0.03);
  border-radius: 8px;
  padding: 1.5rem;
  transition: all 0.3s ease;
  cursor: var(--cursor-alt);
  position: relative;
  overflow: hidden;

  min-height: 160px;
}

.guide-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.guide-card:hover::before {
  transform: scaleX(1);
}

.guide-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
  border-color: var(--primary-color);
}

.guide-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.guide-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  line-height: 1.4;
}

.guide-category {
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  color: white;
  padding: 0.25rem 0.75rem;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.guide-description {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.guide-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.difficulty-badge {
  padding: 0.25rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 500;
}

.difficulty-beginner {
  background: rgba(16, 185, 129, 0.2);
  color: var(--success-color);
}

.difficulty-intermediate {
  background: rgba(245, 158, 11, 0.2);
  color: var(--warning-color);
}

.difficulty-advanced {
  background: rgba(239, 68, 68, 0.2);
  color: var(--error-color);
}

.modal {
  display: none;
  position: fixed;

  z-index: var(--z-modal);
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(5px);
}

.modal-content {
  background: var(--bg-secondary);
  margin: 4% auto;
  border-radius: 8px;
  width: 95%;
  max-height: 80vh;
  overflow: hidden;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  position: relative;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.modal-header h2 {
  color: var(--text-primary);
  font-size: 1.5rem;
  font-weight: 600;
}

.close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1rem;
  cursor: var(--cursor-link);

  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border-radius: 8px;
  transition: background 0.15s ease, color 0.15s ease, transform 0.08s ease;
}

.close-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.03);
}

.close-btn:focus {
  outline: 3px solid rgba(217, 119, 6, 0.12);
  outline-offset: 2px;
}

.modal-body {
  padding: 1.5rem;
  max-height: 60vh;
  overflow-y: auto;
}

.modal-body h3 {
  color: var(--text-primary);
  margin-bottom: 1rem;
  font-size: 1.25rem;
}

.modal-body p {
  color: var(--text-secondary);
  margin-bottom: 1rem;
  line-height: 1.6;
}

/* Content-specific styles: images, figures, and links inside guide content */
.modal-body img,
.guide-content img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0.75rem 0;
  border-radius: 6px;
  object-fit: cover;
}

.modal-body figure,
.guide-content figure {
  margin: 0.75rem 0;
}

.modal-body figcaption,
.guide-content figcaption {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 0.35rem;
}

/* Utility class for inline thumbnails */
.thumb {
  max-width: 220px;
  width: 100%;
  height: auto;
  border-radius: 6px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}

/* Links within guide content */
.modal-body a,
.guide-content a {
  color: var(--accent-color);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.2s ease, text-decoration 0.2s ease;
}

.modal-body a:hover,
.guide-content a:hover,
.modal-body a:focus,
.guide-content a:focus {
  color: var(--text-primary);
  text-decoration: none;
}

/* External link indicator */
.guide-content a.external::after,
.modal-body a.external::after {
  content: '\00a0↗';
  font-size: 0.85em;
  opacity: 0.9;
}

/* Responsive figures with caption spacing */
.modal-body .figure-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.75rem;
}

.modal-body ul,
.modal-body ol {
  color: var(--text-secondary);
  margin-left: 1.5rem;
  margin-bottom: 1rem;
}

.modal-body li {
  margin-bottom: 0.5rem;
}

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

.loading i,
.no-results i {
  font-size: 3rem;
  margin-bottom: 1rem;
  color: var(--primary-color);
}

.no-results h3 {
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  padding: 2rem 0;
  margin-top: 4rem;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

.footer-links {
  display: flex;
  gap: 1.5rem;
}

.footer-link {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.2s ease;
}

.footer-link:hover {
  color: var(--text-primary);
}

@media (max-width: 768px) {
  :root {
    --mobile-header-height: 56px;

    --site-header-height: var(--mobile-header-height);
  }

  .header-content {
    flex-direction: row;
    align-items: center;
    padding: 0.5rem 0;
    gap: 1rem;
  }

  .nav-list {
    flex-wrap: wrap;
    justify-content: center;
  }

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

  .search-filters {
    flex-direction: column;
    align-items: stretch;
  }

  .footer-content {
    flex-direction: column;
    gap: 1rem;
    text-align: center;
  }

  .modal-content {
    margin: 10% auto;
    width: 95%;
  }

  .layout {
    flex-direction: column;
  }

  [class~='sidebar'] {
    width: auto;
    position: fixed;
    top: 0;
    left: 0;

    right: calc(0px - var(--scrollbar-gap, 0px));
    height: var(--mobile-header-height);
    display: flex;
    flex-direction: row;
    align-items: center;
    gap: 1rem;
    padding: 0 1rem;
    z-index: var(--z-header);

    background: linear-gradient(180deg, var(--bg-secondary), var(--bg-tertiary));
    border-bottom: 1px solid var(--border-color);

    border-radius: 0;
    transform: none;
  }

  .sidebar-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-right: 0;
    margin-left: 0.5rem;
    order: 2;

    position: relative;
    right: 0;
    top: 0;

    padding: 0.6rem;
    margin-right: 0;
  }

  .header-menu-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
  }

  .header-globe {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
    cursor: var(--cursor-link);
    transition: background 160ms ease, color 120ms ease, transform 120ms ease;
  }

  .header-globe:hover,
  .header-globe:focus {
    color: var(--text-primary);
    background: linear-gradient(180deg, rgba(217, 119, 6, 0.08), rgba(194, 65, 12, 0.04));
    transition: background 160ms ease, color 120ms ease, transform 120ms ease;
  }

  .header-globe-menu {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.5rem;
    display: none;
    min-width: 160px;
    box-shadow: var(--shadow);
    z-index: calc(var(--z-header) + 10);
  }

  .header-globe-menu .menu-link {
    display: block;
    color: var(--text-secondary);
    padding: 0.5rem 0.75rem;
    text-decoration: none;
    border-radius: 8px;
  }

  .header-globe-menu .menu-link:hover {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-primary);
  }

  .header-globe-menu {
    display: none;
  }

  @media (max-width: 768px) {
    .header-globe[aria-expanded='true'] + .header-globe-menu,
    .header-globe-menu[aria-hidden='false'] {
      display: block;
    }
  }

  .header-desktop-link {
    display: inline-flex;
  }

  .header-mobile-only {
    display: none;
  }

  @media (max-width: 768px) {
    .header-desktop-link {
      display: none;
    }
    .header-mobile-only {
      display: inline-flex;
    }
  }

  .sidebar-toggle {
    transition: background-color 180ms ease, color 120ms ease, transform 150ms ease;
    border-radius: 8px;
  }

  .sidebar-toggle:hover,
  .sidebar-toggle:focus {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-primary);
    outline: none;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
  }

  .sidebar-top {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    width: 100%;
    justify-content: space-between;
    padding: 0.6rem 0;
  }

  .sidebar-content {
    padding: 0 0.5rem;
    flex-direction: row;
    align-items: center;
    gap: 0.75rem;
    border-radius: 0;
    box-shadow: none;
    background: transparent;
    width: 100%;
  }

  .layout.sidebar-open .side-nav-list {
    padding: 0.5rem;
    gap: 0.5rem;
  }

  .sidebar-top .logo {
    flex: 1 1 auto;
    order: 1;
  }

  .side-nav-list {
    flex-direction: column;
    gap: 0.5rem;
    overflow-x: auto;
  }

  .main-area {
    width: 100%;

    margin-left: 0;
  }

  .site-inner {
    padding: 0 1rem;
  }

  [class~='sidebar'] {
    margin-right: 0;
  }

  .layout.sidebar-collapsed .side-nav-list {
    display: none;
  }

  .layout .side-nav-list {
    position: fixed;
    left: 0;
    right: 0;
    top: var(--site-header-height);
    z-index: var(--z-drawer);
    display: flex;
    flex-direction: column;

    transition: max-height 0.22s cubic-bezier(0.2, 0.9, 0.3, 1),
      transform 0.18s cubic-bezier(0.2, 0.9, 0.3, 1), opacity 0.14s ease;
    max-height: 0;
    opacity: 0;
    transform: translateY(-8px);
    overflow: hidden;

    background: linear-gradient(180deg, var(--bg-secondary), var(--bg-tertiary));
    padding: 0;
    pointer-events: none;
    will-change: transform, opacity, max-height;
  }

  .layout.sidebar-open .side-nav-list {
    opacity: 1;
    transform: translateY(0);
    max-height: calc(100vh - var(--site-header-height) - 24px);
    overflow: auto;
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    pointer-events: auto;
  }

  .mobile-drawer {
    display: none;
    position: fixed;
    left: 0;
    right: 0;
    top: var(--site-header-height);
    z-index: var(--z-drawer);
    background: linear-gradient(180deg, var(--bg-secondary), var(--bg-tertiary));
    border-top: 1px solid var(--border-color);
    padding: 0.75rem 1rem;
    max-height: calc(100vh - var(--site-header-height));
    overflow: auto;
  }

  .layout.sidebar-open ~ .mobile-drawer {
    display: block;
  }

  .sidebar {
    display: none;
  }

  .nav-backdrop {
    display: none;
    position: fixed;
    left: 0;
    right: 0;

    top: var(--site-header-height);
    bottom: 0;
    background: rgba(0, 0, 0, 0.45);

    z-index: var(--z-backdrop);
  }

  .layout.sidebar-open ~ .nav-backdrop {
    display: block;
  }

  .sidebar-bottom {
    display: none;
  }

  .modal {
    z-index: var(--z-modal);
  }

  .modal-content {
    margin: 0.5rem auto;
    position: absolute;
    left: 0.5rem;
    right: 0.5rem;
    top: calc(var(--site-header-height) + 8px);
    max-height: calc(100vh - var(--site-header-height) - 32px);
    width: auto;
    border-radius: 8px;
  }
}

@media (min-width: 769px) {
  .header-mobile-only,
  .header-globe,
  .header-globe-menu {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }

  .header-desktop-link {
    display: inline-flex !important;
  }

  .header-menu-wrap {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    position: relative;
  }

  .header-menu-item {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
  }

  .header-menu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.35rem 0.6rem;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-secondary);
    font-weight: 600;
    cursor: var(--cursor-link);
    transition: background 140ms ease, color 120ms ease, transform 120ms ease;
  }

  .header-menu-btn:hover,
  .header-menu-btn:focus {
    background: linear-gradient(180deg, rgba(217, 119, 6, 0.08), rgba(194, 65, 12, 0.04));
    color: var(--text-primary);
    transform: translateY(-1px);
  }

  .header-desktop-menu {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 0.25rem;
    display: none;
    min-width: 180px;
    box-shadow: var(--shadow);
    z-index: calc(var(--z-header) + 10);
  }

  .header-menu-item:hover > .header-desktop-menu,
  .header-menu-item:focus-within > .header-desktop-menu,
  .header-desktop-menu[aria-hidden='false'] {
    display: block;
  }

  .header-desktop-menu .menu-link {
    display: block;
    color: var(--text-secondary);
    padding: 0.5rem 0.75rem;
    text-decoration: none;
    border-radius: 8px;
    white-space: nowrap;
  }

  .header-desktop-menu .menu-link:hover,
  .header-desktop-menu .menu-link:focus {
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-primary);
  }

  .header-desktop-menu .menu-separator {
    height: 1px;
    background: rgba(255, 255, 255, 0.03);
    margin: 0.25rem 0;
  }
}

@media (max-width: 480px) {
  .container {
    padding: 0 0.75rem;
  }

  .logo h1 {
    font-size: 1.5rem;
  }

  .guide-card {
    padding: 0.9rem;
    min-height: 140px;
  }

  .guide-title {
    font-size: 1.125rem;
  }
}

::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 8px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-color);
}

::-webkit-scrollbar-corner {
  background: transparent;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.guide-card {
  animation: fadeIn 0.5s ease forwards;
}

.loot-table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  background: var(--bg-primary);
  border-radius: 8px;
  overflow: hidden;
}

.loot-table th,
.loot-table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.loot-table th {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-weight: 600;
}

.loot-table td {
  color: var(--text-secondary);
}

.loot-table tr:hover {
  background: var(--bg-secondary);
}

/* Apply loot-table styles to modal tables that don't explicitly opt-out with their own class */
.modal-body table:not(.loot-table) {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  background: var(--bg-primary);
  border-radius: 8px;
  overflow: hidden;
}

.modal-body table:not(.loot-table) th,
.modal-body table:not(.loot-table) td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.modal-body table:not(.loot-table) th {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-weight: 600;
}

.modal-body table:not(.loot-table) td {
  color: var(--text-secondary);
}

.modal-body table:not(.loot-table) tr:hover {
  background: var(--bg-secondary);
}

/* Table wrapper for horizontal scrolling on small screens */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0.75rem 0;
}

.table-wrap table {
  min-width: 720px; /* keep a reasonable desktop layout but allow scrolling on mobile */
  width: 100%;
}

/* Make cells wrap long content on small screens */
.table-wrap td,
.table-wrap th {
  white-space: normal;
  word-break: break-word;
}

@media (max-width: 720px) {
  .table-wrap table {
    min-width: 560px;
  }

  /* Slightly reduce padding for cramped mobile view */
  .table-wrap td,
  .table-wrap th {
    padding: 0.5rem;
  }
}

.stat-bar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.25rem 0;
}

.stat-name {
  min-width: 80px;
  font-size: 0.875rem;
  color: var(--text-muted);
}

.stat-value {
  flex: 1;
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
}

.stat-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary-color), var(--secondary-color));
  border-radius: 2px;
  transition: width 0.3s ease;
}

.scroll-top {
  position: fixed;
  right: 20px;
  bottom: 24px;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: linear-gradient(180deg, var(--primary-color), var(--secondary-color));
  color: white;
  border: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow);
  cursor: var(--cursor-link);
  z-index: var(--z-scroll-top);
  opacity: 0;
  transform: translateY(8px) scale(0.98);
  transition: opacity 180ms ease, transform 180ms ease;
}

.scroll-top.show {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.scroll-top {
  transition: opacity 180ms ease, transform 160ms cubic-bezier(0.2, 0.9, 0.3, 1),
    box-shadow 160ms ease, filter 160ms ease;
}

.scroll-top.show:hover,
.scroll-top.show:focus {
  transform: translateY(0) scale(1.06);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.28);
  filter: brightness(1.02);
}

.scroll-top:active {
  transform: translateY(0) scale(0.98);
}

.scroll-top i {
  font-size: 14px;
}
