/* ===== CSS Custom Properties ===== */
:root {
  --bg-deep: #0f1117;
  --bg-surface: #191c24;
  --bg-card: #1f2329;
  --bg-input: #272b33;
  --border: #2e333c;
  --border-light: #3a3f4a;
  --text: #e2dfd9;
  --text-secondary: #8a909b;
  --text-muted: #5e6470;
  --accent: #3a6fa8;
  --accent-hover: #4d85be;
  --accent-dim: rgba(58, 111, 168, 0.14);
  --danger: #d45e5e;
  --radius: 6px;
  --radius-lg: 10px;
}

/* ===== Base ===== */
a {
  text-decoration: none;
  color: var(--accent);
  transition: color 0.15s;
}
a:hover {
  color: var(--accent-hover);
}

/* ===== Sidebar ===== */
.sidebar {
  font-family: "DM Sans", "M PLUS 1", system-ui, sans-serif;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  scrollbar-width: thin;
  scrollbar-color: var(--border-light) transparent;
}
.sidebar::-webkit-scrollbar {
  width: 6px;
}
.sidebar::-webkit-scrollbar-track {
  background: transparent;
}
.sidebar::-webkit-scrollbar-thumb {
  background: var(--border-light);
  border-radius: 3px;
}
.sidebar::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ===== Section cards ===== */
.bordered-box {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px;
}
.bordered-box:not(:last-child) {
  margin-bottom: 10px;
}
.bordered-box > .bordered-box-section:not(:last-child) {
  margin-bottom: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

/* ===== Section headers ===== */
.section-header {
  font-family: "Chakra Petch", "M PLUS 1", system-ui, sans-serif;
  font-weight: 600;
  font-size: 1.05rem;
  letter-spacing: 0.02em;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  user-select: none;
}
.section-header .chevron {
  width: 18px;
  height: 18px;
  fill: var(--text-secondary);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}
.section-header .chevron.open {
  transform: rotate(180deg);
}
.section-header .section-icon {
  width: 20px;
  height: 20px;
  fill: var(--accent);
  flex-shrink: 0;
  opacity: 0.85;
}

/* Sub-section headers */
.subsection-header {
  font-family: "Chakra Petch", "M PLUS 1", system-ui, sans-serif;
  font-weight: 500;
  font-size: 0.92rem;
  letter-spacing: 0.01em;
  color: var(--text);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
  flex-shrink: 0;
}
.subsection-header .chevron {
  width: 16px;
  height: 16px;
  fill: var(--text-muted);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  flex-shrink: 0;
}
.subsection-header .chevron.open {
  transform: rotate(180deg);
}

/* Toggle all link */
.toggle-all-link {
  font-size: 0.75rem;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s;
  user-select: none;
}
.toggle-all-link:hover {
  color: var(--accent);
}

/* Section separator line */
.section-divider {
  flex: 1 1 0;
  min-width: 12px;
  height: 1px;
  background: var(--border);
  margin: 0 8px;
}

/* ===== Buttons ===== */
.tw-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 0.75rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 0.8rem;
  font-family: "DM Sans", "M PLUS 1", system-ui, sans-serif;
  cursor: pointer;
  transition: all 0.15s;
}

.tw-btn-primary {
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 0.75rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 0.8rem;
  font-family: "DM Sans", "M PLUS 1", system-ui, sans-serif;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  font-weight: 500;
  transition: all 0.15s;
}
.tw-btn-primary:hover {
  background: var(--accent-hover);
}
.tw-btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.tw-btn-outline {
  display: inline-flex;
  align-items: center;
  padding: 0.375rem 0.75rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  font-size: 0.8rem;
  font-family: "DM Sans", "M PLUS 1", system-ui, sans-serif;
  cursor: pointer;
  background: transparent;
  color: var(--accent);
  transition: all 0.15s;
}
.tw-btn-outline:hover {
  background: var(--accent-dim);
}

.tw-btn-sm {
  display: inline-flex;
  align-items: center;
  padding: 0.2rem 0.5rem;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 0.72rem;
  font-family: "DM Sans", "M PLUS 1", system-ui, sans-serif;
  cursor: pointer;
  transition: all 0.15s;
}
.tw-btn-sm:hover {
  filter: brightness(1.12);
}

.tw-btn-toggle {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  font-size: 0.8rem;
  font-family: "DM Sans", "M PLUS 1", system-ui, sans-serif;
  cursor: pointer;
  background: transparent;
  color: var(--accent);
  position: relative;
  transition: all 0.2s;
}
.tw-btn-toggle:hover {
  background: var(--accent-dim);
}
.tw-btn-toggle-active,
.peer:checked ~ .tw-btn-toggle {
  background: var(--accent);
  color: #fff;
  font-weight: 500;
  border-color: var(--accent);
}

/* ===== Form elements ===== */
.tw-input-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
  font-family: "DM Sans", "M PLUS 1", system-ui, sans-serif;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  background: var(--bg-input);
  color: var(--text);
  transition: border-color 0.15s;
}
.tw-input-sm:focus {
  outline: none;
  border-color: var(--accent);
}

.tw-range {
  flex: 1;
  height: 4px;
  cursor: pointer;
  accent-color: var(--accent);
  border-radius: 2px;
}

.tw-checkbox {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent);
  cursor: pointer;
}

.tw-switch {
  appearance: none;
  width: 2rem;
  height: 1rem;
  background-color: var(--border-light);
  border-radius: 9999px;
  position: relative;
  cursor: pointer;
  transition: background-color 0.2s;
}
.tw-switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 0.75rem;
  height: 0.75rem;
  background-color: white;
  border-radius: 50%;
  transition: transform 0.2s;
}
.tw-switch:checked {
  background-color: var(--accent);
}
.tw-switch:checked::after {
  transform: translateX(1rem);
}

/* ===== Tooltip ===== */
.tw-tooltip {
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-deep);
  color: var(--text);
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: 0.72rem;
  white-space: normal;
  z-index: 50;
  pointer-events: none;
  text-align: left;
  margin-bottom: 6px;
  max-width: 280px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

/* ===== Layout ===== */
#mouse-position {
  position: absolute;
  bottom: 0;
  right: 0;
  color: var(--text);
  background: rgba(15, 17, 23, 0.8);
  backdrop-filter: blur(4px);
  padding: 4px 8px;
  text-align: right;
  font-family: "Chakra Petch", "M PLUS 1", monospace;
  font-size: 0.8rem;
  border-radius: var(--radius) 0 0 0;
}

#curtain {
  position: absolute;
  inset: 0;
  z-index: 10000;
  background-color: var(--bg-deep);
  opacity: 1;
  transition: opacity 400ms ease-in-out;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Chakra Petch", "M PLUS 1", system-ui, sans-serif;
  color: var(--text-secondary);
}
#curtain.hidden {
  opacity: 0;
  pointer-events: none;
}

#mapcanvas {
  z-index: -2;
}
#overlaycanvas {
  z-index: 1;
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Sidebar close button */
.sidebar-close-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: var(--radius);
  transition: background 0.15s;
}
.sidebar-close-btn:hover {
  background: rgba(255, 255, 255, 0.08);
}

/* ===== FAQ ===== */
.question .inline-block {
  font-size: 0.6em;
}
.question h6 {
  font-family: "Chakra Petch", "M PLUS 1", system-ui, sans-serif;
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--text);
  cursor: pointer;
  padding: 4px 0;
  display: flex;
  align-items: center;
  gap: 4px;
}
.question p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
  padding-left: 20px;
  margin-bottom: 8px;
}

/* ===== Credits ===== */
.credits .contributor {
  margin-bottom: 8px;
}
.credits .contributor p {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-top: 2px;
}
.credits .socials {
  display: flex;
  align-items: center;
}
.credits .socials a:not(:last-child)::after {
  content: ", ";
}
.credits .socials a:not(:last-child) {
  margin-right: 4px;
}

/* ===== Misc legacy ===== */
#feedback {
  position: absolute;
  top: 4px;
  right: 4px;
  z-index: 1;
}

#directions ol {
  padding-left: 18px;
}

.movement-nav {
  margin-bottom: 0px;
}

.transparency-slider {
  width: 200px;
  height: 25px;
  background-color: #aaa;
}
.transparency-knob,
.ring-transparency-knob {
  position: relative;
  height: 25px;
  width: 25px;
  left: 25px;
  top: 0px;
  background-color: #66f;
}
.ring-transparency-knob {
  left: 120px;
}

.highlight-label {
  margin-bottom: 2px;
  margin-right: 2px;
  margin-top: 2px;
  padding: 8px 12px;
}

.nav_controls_container {
  position: absolute;
  top: 4px;
  left: 4px;
  z-index: 1;
  font-family: "DM Sans", "M PLUS 1", system-ui, sans-serif;
}

.highlight-container {
  position: absolute;
  top: 200px;
  left: 10px;
  z-index: 1;
  background: #fffc;
  padding: 10px;
  font-family: sans-serif;
  overflow: auto;
  max-height: calc(100vh - 180px);
}

.legend-container {
  position: absolute;
  bottom: 4px;
  right: 4px;
  z-index: -1;
  padding-left: 25px;
  font-family: sans-serif;
}

#legendAccordion {
  position: absolute;
  bottom: 4px;
  right: 4px;
  z-index: 1;
  font-family: sans-serif;
  width: auto;
}

.collapsable-menu {
  cursor: pointer;
  user-select: none;
  color: var(--accent);
  padding: 5px;
}

.collapsable-menu-ul {
  list-style-type: none;
  display: none;
}

.toggle-switch {
  cursor: pointer;
  box-shadow: var(--accent) -15px 0px;
  color: var(--accent);
  border-radius: 5px;
  display: inline;
  padding-left: 5px;
  user-select: none;
}

.toggle-container {
  cursor: pointer;
  display: inline;
  padding-left: 20px;
}

.canvas-container {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}
.canvas-container,
.canvas-container canvas {
  background-color: inherit;
}

/* Legend colors */
.omoroth-legend {
  box-shadow: #9e3f9b -15px 0px;
  margin-right: 20px;
}
.morpha-legend {
  box-shadow: #1898f4 -15px 0px;
  margin-right: 20px;
}
.bowcity-legend {
  box-shadow: #aaaaaa -15px 0px;
  margin-right: 20px;
}
.bowvault-legend {
  box-shadow: #ff6a00 -15px 0px;
  margin-right: 20px;
}
.ivy-legend {
  box-shadow: #ff00ff -15px 0px;
  margin-right: 20px;
}
.mold-legend {
  box-shadow: #6cbbe0 -15px 0px;
  margin-right: 20px;
}
.azeos-legend {
  box-shadow: #3d9b41 -15px 0px;
  margin-right: 20px;
}
.malugaz-legend {
  box-shadow: #678397 -15px 0px;
  margin-right: 20px;
}
.hive-mother-legend {
  box-shadow: #fca694 -15px 0px;
  margin-right: 20px;
}
.ghorm-legend {
  box-shadow: #d95917 -15px 0px;
  margin-right: 20px;
}
.glurch-legend {
  box-shadow: #7f5f30 -15px 0px;
  margin-right: 20px;
}
.large-maze-legend {
  box-shadow: #0f0 -15px 0px;
  margin-right: 20px;
}
.medium-maze-legend {
  box-shadow: #0ff -15px 0px;
  margin-right: 20px;
}
.small-maze-legend {
  box-shadow: #f0f -15px 0px;
  margin-right: 20px;
}

/* ===== POI circle images ===== */
.circle-image {
  width: 22px;
  height: 22px;
  background-position: center;
  background-size: contain;
  background-repeat: no-repeat;
  border-radius: 3px;
}

/* ===== Info links ===== */
.info-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.78rem;
  color: var(--text-secondary);
  transition: color 0.15s;
}
.info-link:hover {
  color: var(--accent);
}
.info-link svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
  flex-shrink: 0;
}

/* ===== "Load map" placeholder ===== */
.load-map-hint {
  text-align: center;
  padding: 16px 12px;
  color: var(--text-muted);
  font-size: 0.85rem;
}
