html,
body {
  height: 100%;
}

.legal-page { min-height: 100vh; padding: 2rem; background: #f3f6ff; color: #132c56; }
.legal-page main { max-width: 760px; margin: 0 auto; background: #fff; padding: 2rem; border-radius: 16px; box-shadow: 0 4px 20px #132c5622; }
.legal-page code { overflow-wrap: anywhere; }

body {
  margin: 0;
  background: linear-gradient(180deg, #f5f8ff 0%, #eef3ff 55%, #edf7fb 100%);
  color: #1b2d50;
}

.world-header {
  padding: 10px 18px;
  background-color: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid #d7e0f0;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
}

.world-header h1 {
  margin-bottom: 2px;
  font-size: 1.45rem;
}

main {
  overflow: hidden;
}

#worldCanvas {
  touch-action: none;
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  background:
    linear-gradient(90deg, rgba(36, 51, 77, 0.09), rgba(36, 51, 77, 0.02));
}

#worldCanvas.dragging {
  cursor: grabbing;
}

.world-zoom {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 8;
  display: flex;
  flex-direction: column;
  border: 1px solid #b9c6dc;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px #132c5622;
}

.world-zoom button {
  width: 48px;
  height: 48px;
  border: 0;
  background: #fff;
  color: #132c56;
  font: 28px/1 system-ui, sans-serif;
  touch-action: manipulation;
}

.world-zoom button + button { border-top: 1px solid #d7e0f0; }
.world-zoom button:disabled { color: #99a5b8; }
.world-zoom button:focus-visible { outline: 3px solid #3b6ff2; outline-offset: -4px; }

.world-legend {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 5;
  width: 170px;
  font-size: 0.8rem;
  background-color: rgba(255, 255, 255, 0.95);
}

.world-tooltip {
  position: absolute;
  z-index: 6;
  min-width: 220px;
  max-width: 300px;
  display: none;
  pointer-events: none;
  background-color: rgba(255, 255, 255, 0.96);
}

.world-tooltip.show {
  display: block;
}

.legend-box {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid #0a3f61;
  margin-right: 6px;
  vertical-align: middle;
}

.legend-box.checked {
  background-color: rgba(25, 135, 84, 0.85);
}

.legend-box.unchecked {
  background-color: rgba(220, 53, 69, 0.85);
}

.legend-box.orphaned {
  background-color: rgba(108, 117, 125, 0.85);
}

.world-tooltip .card-body {
  padding: 0.65rem 0.8rem;
}

.world-sidebar {
  position: absolute;
  top: 12px;
  right: 12px;
  width: min(360px, 36vw);
  max-height: calc(100% - 24px);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 7;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}

.world-sidebar-card {
  background-color: rgba(255, 255, 255, 0.95);
  pointer-events: auto;
}

.world-stats-list {
  font-size: 0.84rem;
  margin-bottom: 0;
}

.world-stats-list li {
  margin-bottom: 0.25rem;
}

.world-stats-list small {
  color: #58759b;
}

@media (max-width: 1050px) {
  .world-sidebar {
    position: static;
    width: min(100%, 340px);
    max-height: none;
    margin: 10px 12px;
    pointer-events: auto;
  }
}

.world-tooltip { font-size: 0.72rem; line-height: 1.35; min-width: 180px; max-width: min(280px, calc(100vw - 12px)); overflow-wrap: anywhere; }
.world-tooltip h6 { font-size: 0.8rem; }
@media (prefers-color-scheme: dark) {
  body { background: #10151e; color: #e0e7f2; color-scheme: dark; }
  .world-header, .world-tooltip, .world-legend, .world-sidebar-card, .world-zoom button { background: #1b2433; color: #e0e7f2; border-color: #39475d; }
  .world-stats-list small { color: #a9bddb; }
  .world-header a { color: #9abfff; }
  .text-muted { color: #a9bddb !important; }
  .legal-page, .legal-page main { background: #10151e; color: #e0e7f2; }
}
