/* ---------- left column (js/sidebar.js) ---------- */
/* Wide screens: a fixed glass column under the top bar, shown or hidden with
   the ☰ button. Narrow screens: the same column slides in as a drawer.
   It sits above the walking companions (25) and below the menu panel (30). */
.sidebar {
  position: fixed; z-index: 28; left: 0; top: var(--topbar-h, 65px); bottom: 0; width: 200px;
  overflow-y: auto; padding: 18px 12px 150px;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.62), rgba(255, 255, 255, 0.3));
  -webkit-backdrop-filter: blur(10px) saturate(150%); backdrop-filter: blur(10px) saturate(150%);
  border-right: 1px solid rgba(255, 255, 255, 0.65);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.4), 6px 0 24px rgba(40, 30, 90, 0.12);
}
:root[data-theme-now="dark"] .sidebar {
  background: linear-gradient(160deg, rgba(28, 34, 64, 0.7), rgba(14, 18, 40, 0.5));
  border-right-color: rgba(255, 255, 255, 0.14);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.08), 6px 0 24px rgba(0, 0, 0, 0.35);
}
.sidebar[hidden] { display: none; }
.sidebar nav + nav { margin-top: 18px; }
.sidebar h2 {
  margin: 0 10px 6px; font: 11.5px var(--font-pixel); color: var(--accent-soft); letter-spacing: 0.08em;
}
.sidebar ul { list-style: none; margin: 0; padding: 0; }
.sidebar a {
  display: block; padding: 6px 10px; border-radius: 10px;
  color: var(--text); text-decoration: none; font-weight: 600;
}
.sidebar a:hover { background: rgba(255, 255, 255, 0.35); }
:root[data-theme-now="dark"] .sidebar a:hover { background: rgba(255, 255, 255, 0.08); }
.sidebar a[aria-current="page"] { background: var(--code-bg); color: var(--accent); }

/* The ☰ button at the left of the top bar */
.topbar:has(.nav-burger) { justify-content: flex-start; }
.topbar:has(.nav-burger) .topnav { margin-left: auto; }
.nav-burger {
  flex: none; display: grid; place-content: center; gap: 4px; width: 38px; height: 38px; margin-right: 4px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--panel); cursor: pointer;
}
.nav-burger span { display: block; width: 18px; height: 2px; border-radius: 2px; background: var(--text); }
.nav-burger[aria-expanded="true"] { background: var(--code-bg); }

@media (min-width: 1100px) {
  body.has-sidebar { padding-left: 200px; }
  /* The top bar still spans the whole window; the column starts below it */
  body.has-sidebar .topbar { margin-left: -200px; }
}
@media (max-width: 1099px) {
  .sidebar {
    width: min(280px, 82vw); transform: translateX(-105%); visibility: hidden;
    transition: transform 0.25s ease, visibility 0s linear 0.25s;
  }
  .sidebar.open { transform: none; visibility: visible; transition: transform 0.25s ease; }
}
@media (max-width: 560px) {
  /* Phones: ☰ and the logo share the first row, the links wrap below */
  .topbar { flex-direction: row !important; flex-wrap: wrap; align-items: center !important; }
  .topbar .topnav { width: 100%; margin-left: 0; }
}

/* ---------- menu pages (menu.html, js/menu.js) ---------- */
.menu-head { border-top: 0; padding-bottom: 16px; }
.menu-head .lead { margin: 0; font-size: 15.5px; }
.menu-cards {
  display: grid; gap: 14px; padding-bottom: 48px;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
}
.menu-card {
  display: block; padding: 16px 18px; color: var(--text); text-decoration: none;
  background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
}
a.menu-card:hover { border-color: var(--teal-500); }
a.menu-card .menu-card-head h3::after { content: " ›"; color: var(--accent-soft); }
.menu-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.menu-card-head h3 { margin: 0; font-size: 16.5px; color: var(--heading); }
.menu-icon { flex: none; width: 32px; height: 32px; }
.menu-icon:empty { display: none; }
.menu-icon img { width: 32px; height: 32px; image-rendering: pixelated; }
.menu-card p { margin: 0 0 4px; font-size: 13.5px; color: var(--muted); }
.menu-cmd {
  margin-top: 8px; padding: 2px 10px; cursor: pointer;
  font: 17.5px var(--font-mono); color: var(--accent);
  background: var(--code-bg); border: 1px solid var(--teal-500); border-radius: 6px;
}
.menu-empty { color: var(--muted); }


/* 互動教學: the open group's tutorials, indented under it */
.sidebar ul.sub { margin: 2px 0 4px 12px; padding-left: 8px; border-left: 2px solid var(--line); }
/* Folding branches (js/sidebar.js): the ▸ button sits at the right end of the link's row */
.sidebar li.branch { position: relative; }
.sidebar li.branch > a { padding-right: 34px; }
.sidebar .fold {
  position: absolute; right: 2px; top: 3px; width: 28px; height: 28px; padding: 0;
  display: grid; place-items: center; border: 0; border-radius: 8px; background: none; color: var(--muted); cursor: pointer;
}
.sidebar .fold::before { content: ""; width: 7px; height: 7px; border: solid currentColor; border-width: 0 2px 2px 0; rotate: -45deg; transition: rotate 0.15s; }
.sidebar .fold[aria-expanded="true"]::before { rotate: 45deg; }
.sidebar .fold:hover { color: var(--accent); background: var(--code-bg); }
.sidebar .fold:focus-visible { outline: 2px solid var(--gold); }
.sidebar ul.sub .fold { top: 0; height: 26px; }
.sidebar ul.sub a { padding: 4px 10px; font-weight: 400; font-size: 13.5px; }

/* 大廳 / 空島 / 生存 tags (window.TomoServerTags) in the guide and wiki headings */
.srvs { display: inline-flex; flex-wrap: wrap; gap: 4px; margin-left: 6px; vertical-align: middle; text-shadow: none; }
.srv { padding: 0 6px; border-radius: 6px; font: 600 10.5px/1.6 var(--font-body); color: #1d2433; text-shadow: none; white-space: nowrap; }
.srv-hub { background: #9ad7ff; }
.srv-sky { background: #a8f0a0; }
.srv-sur { background: #ffd27a; }
.srv-all { background: #d9c8ff; }
.sidebar a .srv { margin-left: 3px; padding: 0 3px; font-size: 9.5px; }
