.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  background: var(--bg, #0a0a0f);
  padding: 0 0 env(safe-area-inset-bottom, 0px);
  z-index: 1000;
  border-top: 1px solid rgba(95, 95, 106, 0.2);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
}
.nav-arc {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 0;
  pointer-events: none;
  z-index: -1;
}
.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 10px 0 6px;
  text-decoration: none;
  color: var(--text-muted, #8a7d6f);
  transition: color 0.25s;
  -webkit-tap-highlight-color: transparent;
  position: relative;
  flex: 1;
  min-height: 56px;
}
.tab-item:hover { color: var(--text-secondary, #b5a88f); }
.tab-item.active { color: var(--accent, #c9a96e); }
.tab-item.active .tab-icon::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--accent-glow-soft, rgba(201, 169, 110, 0.15)) 0%, transparent 70%);
  pointer-events: none;
  z-index: -1;
}
.tab-item.active .tab-dot {
  opacity: 1;
}
.tab-dot {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent, #c9a96e);
  opacity: 0;
  transition: opacity 0.25s;
  margin-top: 1px;
}
.tab-icon {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.tab-icon svg {
  width: 28px;
  height: 28px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.icon-filled .fill-target {
  fill: currentColor;
  fill-opacity: 0.85;
}
.torch-icon {
  fill: none;
  stroke: currentColor;
  stroke-width: 28;
  stroke-linejoin: round;
}
.torch-icon path {
  fill: none;
}
.icon-filled .torch-icon {
  fill: currentColor;
  stroke: none;
}
.icon-filled .torch-icon path {
  fill: currentColor;
  fill-opacity: 0.85;
}
.vault-hole {
  fill: none;
  stroke: currentColor;
  stroke-width: 1.5;
}
.icon-filled .vault-hole {
  fill: var(--bg, #0a0a0f);
  stroke: none;
}
.tab-label {
  font-size: var(--fsu-13);
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1;
}
.tab-item.mythoscope-tab {
  color: var(--accent, #c9a96e);
  flex: 1.1;
}
.tab-item.mythoscope-tab .tab-icon {
  width: 56px;
  height: 56px;
  background: var(--bg, #0a0a0f);
  border: 1.5px solid var(--accent, #c9a96e);
  border-radius: 50%;
  margin-top: -26px;
  transition: box-shadow 0.3s, background 0.3s;
  box-shadow: 0 0 0 5px var(--bg, #0a0a0f), 0 0 10px var(--accent-glow-soft, rgba(201, 169, 110, 0.15));
}
.tab-item.mythoscope-tab .tab-icon svg {
  width: 34px;
  height: 34px;
  stroke: var(--accent, #c9a96e);
  stroke-width: 1.6;
  fill: none;
  filter: drop-shadow(0 0 3px var(--accent-glow-soft, rgba(201, 169, 110, 0.15)));
  animation: gentlePulse 4s ease-in-out infinite;
}
.tab-item.mythoscope-tab .tab-icon::after { display: none; }
@keyframes gentlePulse {
  0%, 100% { filter: drop-shadow(0 0 3px var(--accent-glow-soft, rgba(201, 169, 110, 0.15))); }
  50% { filter: drop-shadow(0 0 7px var(--accent-glow-med, rgba(201, 169, 110, 0.25))); }
}
.tab-item.mythoscope-tab:hover .tab-icon,
.tab-item.mythoscope-tab:active .tab-icon {
  background: var(--accent-dim, rgba(201, 169, 110, 0.15));
  box-shadow: 0 0 0 5px var(--bg, #0a0a0f), 0 0 18px var(--accent-glow-strong, rgba(201, 169, 110, 0.4));
}
.ms-sparkle {
  position: absolute;
  width: 2.5px;
  height: 2.5px;
  background: var(--sparkle-color, rgba(255, 240, 200, 0.8));
  border-radius: 50%;
  pointer-events: none;
  animation: msSparkle 5s ease-in-out infinite;
  opacity: 0;
}
.ms-sparkle:nth-child(2) { top: 4px; right: 8px; animation-delay: 1.5s; }
.ms-sparkle:nth-child(3) { bottom: 6px; left: 10px; animation-delay: 3s; }
@keyframes msSparkle {
  0%, 75%, 100% { opacity: 0; transform: scale(0.5); }
  80% { opacity: 1; transform: scale(1); }
  90% { opacity: 0; transform: scale(0.5); }
}
.side-nav {
  display: none;
}
.side-wordmark { display: none; }
.side-mythoscope-label { display: none; }
.side-collapse-btn { display: none; }
@media (min-width: 768px) {
  .bottom-nav, .nav-arc { display: none !important; }
  .side-nav {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 72px;
    background: var(--bg, #0a0a0f);
    border-right: 1px solid rgba(95, 95, 106, 0.25);
    box-shadow: 4px 0 16px rgba(0, 0, 0, 0.06);
    z-index: 1000;
    padding: 0.75rem 0.5rem 1rem;
    gap: 0.15rem;
    overflow: hidden;
    transition: width 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                box-shadow 0.25s ease;
  }
  .side-nav:hover {
    width: 220px;
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.18);
  }
  .side-nav .side-wordmark {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    height: 44px;
    padding: 0 0 0.35rem 1.25rem;
    margin-bottom: 0.35rem;
    border-bottom: 1px solid transparent;
    text-decoration: none;
    color: var(--text-primary, #e8e0d0);
    cursor: pointer;
    overflow: hidden;
    font-family: 'Cormorant Garamond', serif;
    font-size: var(--fsu-22);
    font-weight: 400;
    letter-spacing: 0.04em;
    white-space: nowrap;
    transition: border-color 0.2s ease 0.1s;
  }
  .side-nav:hover .side-wordmark {
    border-bottom-color: rgba(95, 95, 106, 0.25);
  }
  .side-nav .side-wordmark .wm-rest {
    overflow: hidden;
    max-width: 0;
    opacity: 0;
    transition: max-width 0.25s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.2s ease 0.06s;
  }
  .side-nav:hover .side-wordmark .wm-rest {
    max-width: 160px;
    opacity: 1;
  }
  .side-nav .side-mythoscope {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    height: 42px;
    border: none;
    border-radius: 10px;
    background: transparent;
    margin-bottom: 0.25rem;
    flex-shrink: 0;
    cursor: pointer;
    text-decoration: none;
    color: var(--text-muted, #8a7d6f);
    gap: 0;
    padding: 0 0 0 1.06rem;
    transition: color 0.2s, background 0.2s,
                gap 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .side-nav:hover .side-mythoscope {
    gap: 0.5rem;
  }
  .side-nav .side-mythoscope:hover {
    color: var(--text-secondary, #b5a88f);
    background: var(--accent-dim, rgba(201, 169, 110, 0.15));
  }
  .side-nav .side-mythoscope svg {
    width: 25px; height: 22px;
    flex-shrink: 0;
    stroke: currentColor;
    stroke-width: 1.5;
    stroke-linecap: round;
    fill: none;
    transform: translateY(-1px);
    margin-left: -1.5px;
    margin-right: -1.5px;
  }
  .side-nav .side-mythoscope-label {
    display: block;
    font-family: 'Inter', sans-serif;
    font-size: var(--fsu-14);
    font-weight: 400;
    line-height: 1;
    color: inherit;
    transform: translateY(1px);
    white-space: nowrap;
    overflow: hidden;
    max-width: 0;
    opacity: 0;
    transition: max-width 0.25s ease, opacity 0.2s ease 0.08s;
  }
  .side-nav:hover .side-mythoscope-label {
    max-width: 140px;
    opacity: 1;
  }
  .side-nav .side-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    height: 42px;
    border-radius: 10px;
    text-decoration: none;
    color: var(--text-muted, #8a7d6f);
    cursor: pointer;
    position: relative;
    gap: 0;
    padding: 0 0 0 1.06rem;
    transition: color 0.2s, background 0.2s,
                gap 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .side-nav:hover .side-item {
    gap: 0.6rem;
  }
  .side-nav .side-item:hover {
    color: var(--text-secondary, #b5a88f);
    background: var(--accent-dim, rgba(201, 169, 110, 0.15));
  }
  .side-nav .side-item.active {
    color: var(--accent, #c9a96e);
    background: var(--accent-dim, rgba(201, 169, 110, 0.15));
  }
  .side-nav .side-item.active::before {
    content: '';
    position: absolute;
    left: -1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 20px;
    background: var(--accent, #c9a96e);
    border-radius: 2px;
  }
  .side-nav .side-item svg {
    width: 22px; height: 22px;
    flex-shrink: 0;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  .side-nav .side-item[data-tab="garden"] svg { transform: translateY(1px); }
  .side-nav .side-item[data-tab="guide"] svg { transform: translateY(1px); }
  .side-nav .side-item[data-tab="vault"] svg { transform: translateY(1px); }
  .side-nav .side-item .side-label {
    font-size: var(--fsu-14);
    font-weight: 400;
    line-height: 1;
    transform: translateY(1px);
    white-space: nowrap;
    overflow: hidden;
    max-width: 0;
    opacity: 0;
    transition: max-width 0.25s ease, opacity 0.2s ease 0.08s;
  }
  .side-nav:hover .side-item .side-label {
    max-width: 140px;
    opacity: 1;
  }
  .side-nav .side-item.active .fill-target { fill: currentColor; fill-opacity: 0.85; }
  .side-nav .side-item.active .vault-hole { fill: var(--bg, #0a0a0f); stroke: none; }
  .side-nav .side-item.active .torch-icon { fill: currentColor; stroke: none; }
  .side-nav .side-item.active .torch-icon path { fill: currentColor; fill-opacity: 0.85; }
  .side-nav .side-item .torch-icon { fill: none; stroke: currentColor; stroke-width: 28; stroke-linejoin: round; }
  .side-nav .side-item .torch-icon path { fill: none; }
  .side-nav .side-spacer { flex: 1; }
  .side-nav .side-lumens {
    display: flex;
    flex-direction: row;
    align-items: center;
    height: 32px;
    padding: 0 0 0 1.15rem;
    gap: 0;
    color: var(--accent, #c9a96e);
    font-size: var(--fsu-13);
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    transition: gap 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .side-nav:hover .side-lumens { gap: 0.3rem; }
  .side-nav .side-lumens .star { font-size: var(--fsu-14); flex-shrink: 0; }
  .side-nav .side-lumens .lumen-count {
    overflow: hidden;
    max-width: 0;
    opacity: 0;
    transition: max-width 0.25s ease, opacity 0.2s ease 0.08s;
  }
  .side-nav:hover .side-lumens .lumen-count {
    max-width: 60px;
    opacity: 1;
  }
  .side-nav .side-bottom-item {
    display: flex;
    flex-direction: row;
    align-items: center;
    height: 36px;
    border-radius: 8px;
    color: var(--text-muted, #8a7d6f);
    cursor: pointer;
    border: none;
    background: none;
    text-decoration: none;
    padding: 0 0 0 1.06rem;
    gap: 0;
    font-size: var(--fsu-15);
    font-family: 'Inter', sans-serif;
    transition: color 0.2s, background 0.2s,
                gap 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .side-nav:hover .side-bottom-item { gap: 0.5rem; }
  .side-nav .side-bottom-item:hover {
    color: var(--accent, #c9a96e);
    background: var(--accent-dim, rgba(201, 169, 110, 0.15));
  }
  .side-nav .side-bottom-item svg {
    width: 18px; height: 18px;
    flex-shrink: 0;
    stroke: currentColor;
    fill: none;
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
  .side-nav .side-bottom-item span {
    line-height: 1;
    transform: translateY(1px);
    white-space: nowrap;
    overflow: hidden;
    max-width: 0;
    opacity: 0;
    transition: max-width 0.25s ease, opacity 0.2s ease 0.08s;
  }
  .side-nav:hover .side-bottom-item span {
    max-width: 100px;
    opacity: 1;
  }
}
body.ms-nav-app { padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
@media (min-width: 768px) {
  body.ms-nav-app, body.ms-nav-reading { padding-bottom: 0; padding-left: 72px; }
}

@media (min-width: 1024px) {
  body.ms-rail-open .side-nav { width: 220px; }
  body.ms-rail-open .side-nav .side-wordmark { border-bottom-color: rgba(95, 95, 106, 0.25); }
  body.ms-rail-open .side-nav .side-wordmark .wm-rest { max-width: 160px; opacity: 1; }
  body.ms-rail-open .side-nav .side-mythoscope { gap: 0.5rem; }
  body.ms-rail-open .side-nav .side-mythoscope-label { max-width: 140px; opacity: 1; }
  body.ms-rail-open .side-nav .side-item { gap: 0.6rem; }
  body.ms-rail-open .side-nav .side-item .side-label { max-width: 140px; opacity: 1; }
  body.ms-rail-open .side-nav .side-lumens { gap: 0.3rem; }
  body.ms-rail-open .side-nav .side-lumens .lumen-count { max-width: 60px; opacity: 1; }
  body.ms-rail-open .side-nav .side-bottom-item { gap: 0.5rem; }
  body.ms-rail-open .side-nav .side-bottom-item span { max-width: 100px; opacity: 1; }
  body.ms-rail-open.ms-nav-app, body.ms-rail-open.ms-nav-reading { padding-left: 220px; }
}
