.world-page {
  min-height: 100vh;
  overflow: hidden;
  background:
    linear-gradient(140deg, rgba(7, 11, 18, 0.76), rgba(10, 18, 27, 0.66)),
    #0c1320;
}

.world-page::before {
  inset: 0;
  background:
    linear-gradient(135deg, rgba(5, 10, 18, 0.42), rgba(9, 16, 24, 0.32)),
    url("/assets/world_bg.webp") center center / cover no-repeat;
  filter: none;
  animation: none;
}

.world-page::after {
  opacity: 0.56;
}

.page-shell-world {
  min-height: 100vh;
  display: block;
  padding: 0 0 0 256px;
}

.world-page .site-footer {
  display: none;
}

.world-page .topbar {
  grid-template-rows: auto auto minmax(0, 1fr);
  background:
    linear-gradient(180deg, rgba(248, 243, 233, 0.1), rgba(248, 243, 233, 0.05));
  border-right: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.06);
}

.world-page .searchbar {
  display: flex;
}

.world-page .nav-link.active {
  background: linear-gradient(98deg, rgba(120, 217, 198, 0.18), rgba(89, 216, 255, 0.16));
  color: var(--paper);
}

.world-main,
.world-shell,
.world-map-card {
  width: 100%;
  height: 100vh;
  min-height: 100vh;
}

.world-main {
  display: block;
  padding: 0;
  overflow: hidden;
}

.world-shell {
  position: relative;
  overflow: hidden;
}

.world-map-card {
  position: relative;
  overflow: hidden;
  background:
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(180deg, rgba(4, 12, 22, 0.1), rgba(4, 12, 22, 0.28)),
    url("/assets/world_bg.webp") center center / cover no-repeat,
    radial-gradient(circle at 18% 26%, rgba(89, 216, 255, 0.18), transparent 34%),
    radial-gradient(circle at 76% 62%, rgba(126, 230, 199, 0.14), transparent 36%),
    radial-gradient(circle at center, rgba(7, 14, 24, 0.32), rgba(2, 8, 14, 0.68) 100%);
  background-size: 64px 64px, 64px 64px, 100% 100%, cover, 100% 100%, 100% 100%, 100% 100%;
}

.world-map-card::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(circle at 16% 18%, rgba(255, 211, 109, 0.07), transparent 24%),
    radial-gradient(circle at 74% 18%, rgba(89, 216, 255, 0.12), transparent 30%),
    radial-gradient(circle at 42% 76%, rgba(126, 230, 199, 0.1), transparent 30%);
  mix-blend-mode: screen;
}

.world-map-toolbar {
  position: absolute;
  top: 22px;
  left: 24px;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
}

.world-mobile-switcher {
  display: none;
}

.world-tool-button,
.world-switch-button,
.detail-action,
.detail-close {
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(135deg, rgba(126, 230, 199, 0.22), rgba(89, 216, 255, 0.2));
  color: var(--paper);
  font-family: var(--font-ui);
  font-weight: 800;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.world-tool-button {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  padding: 0;
  font-size: 1.15rem;
  line-height: 1;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.world-tool-reset {
  width: auto;
  padding: 0 13px;
  font-size: 0.78rem;
}

.world-tool-button:hover,
.world-switch-button:hover,
.detail-action:hover,
.detail-close:hover {
  transform: translateY(-1px);
  border-color: rgba(126, 230, 199, 0.44);
  background: linear-gradient(135deg, rgba(126, 230, 199, 0.28), rgba(89, 216, 255, 0.28));
}

.world-switch-label {
  min-width: 128px;
  padding: 9px 14px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  background: rgba(7, 14, 24, 0.54);
  color: var(--paper);
  font-family: var(--font-ui);
  font-size: 0.84rem;
  font-weight: 800;
  text-align: center;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.knowledge-map {
  position: relative;
  z-index: 2;
  display: block;
  width: 100%;
  height: 100%;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.knowledge-map.is-panning {
  cursor: grabbing;
}

.region-shadow {
  fill: rgba(2, 8, 14, 0.28);
  filter: blur(12px);
}

.region-island-image {
  filter: drop-shadow(0 24px 32px rgba(0, 0, 0, 0.32)) drop-shadow(0 0 18px rgba(89, 216, 255, 0.12));
}

.region-label {
  fill: rgba(244, 239, 231, 0.88);
  font-family: var(--font-ui);
  font-size: 24px;
  font-weight: 800;
  letter-spacing: 4px;
  text-anchor: middle;
  paint-order: stroke;
  stroke: rgba(5, 10, 18, 0.72);
  stroke-width: 5px;
}

.knowledge-edge {
  stroke: rgba(89, 216, 255, 0.52);
  stroke-width: 3;
  stroke-linecap: round;
  filter: url("#edgeGlow");
}

.knowledge-edge.related {
  stroke: rgba(126, 230, 199, 0.38);
  stroke-dasharray: 8 10;
}

.node-hit {
  fill: transparent;
  cursor: pointer;
}

.node-halo {
  fill: rgba(89, 216, 255, 0.16);
  filter: url("#nodeGlow");
  pointer-events: none;
}

.node-core {
  fill: url("#nodeCore");
  stroke: rgba(255, 255, 255, 0.88);
  stroke-width: 1.4;
  filter: url("#nodeGlow");
  pointer-events: none;
}

.node-label {
  fill: rgba(244, 239, 231, 0.88);
  font-family: var(--font-ui);
  font-size: 15px;
  font-weight: 800;
  text-anchor: middle;
  pointer-events: none;
  paint-order: stroke;
  stroke: rgba(3, 8, 16, 0.82);
  stroke-width: 4px;
}

.knowledge-node {
  transition: opacity 160ms ease;
}

.knowledge-node.is-muted {
  opacity: 0.28;
}

.knowledge-region.is-mobile-hidden,
.knowledge-node.is-mobile-hidden,
.knowledge-edge.is-mobile-hidden {
  opacity: 0;
  pointer-events: none;
}

.knowledge-node.is-active .node-halo,
.knowledge-node.is-highlighted .node-halo {
  fill: rgba(255, 211, 109, 0.26);
}

.knowledge-node.is-active .node-core,
.knowledge-node.is-highlighted .node-core {
  fill: #ffd36d;
  stroke: #ffffff;
}

.world-tooltip {
  position: absolute;
  z-index: 6;
  left: 0;
  top: 0;
  max-width: 260px;
  padding: 10px 12px;
  border: 1px solid rgba(126, 230, 199, 0.28);
  border-radius: 12px;
  background: rgba(7, 14, 24, 0.92);
  color: var(--paper);
  font-family: var(--font-ui);
  font-size: 0.82rem;
  line-height: 1.45;
  box-shadow: 0 16px 38px rgba(0, 0, 0, 0.36);
  opacity: 0;
  pointer-events: none;
  transform: translate(14px, 14px);
  transition: opacity 120ms ease;
}

.world-tooltip.is-visible {
  opacity: 1;
}

.world-detail-panel {
  position: fixed;
  top: 24px;
  right: 0;
  bottom: 24px;
  z-index: 180;
  width: min(380px, calc(100vw - 304px));
  padding: 24px;
  display: grid;
  align-content: start;
  gap: 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius-lg) 0 0 var(--radius-lg);
  border-right: 0;
  background:
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(180deg, rgba(248, 243, 233, 0.13), rgba(248, 243, 233, 0.08));
  background-size: 42px 42px, 42px 42px, 100% 100%;
  box-shadow:
    inset 0 1px 0 var(--glass-highlight),
    0 24px 70px rgba(5, 10, 18, 0.34);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  opacity: 0;
  pointer-events: none;
  transform: translateX(calc(100% + 32px));
  transition: opacity 220ms ease, transform 220ms ease;
}

.world-detail-panel.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.detail-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: start;
  gap: 12px;
}

.detail-kicker {
  margin: 0 0 8px;
  color: rgba(126, 230, 199, 0.78);
  font-family: var(--font-ui);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.detail-close {
  width: 36px;
  height: 36px;
  padding: 0;
  border-radius: 12px;
  font-size: 1.1rem;
  line-height: 1;
}

.world-detail-panel h2 {
  margin: 0;
  color: var(--paper);
  font-family: var(--font-display);
  font-size: 2rem;
  line-height: 1.12;
}

.detail-description {
  margin: 0;
  color: rgba(244, 239, 231, 0.72);
}

.detail-meta {
  display: grid;
  gap: 12px;
}

.detail-row {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.detail-row span {
  color: rgba(244, 239, 231, 0.52);
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.detail-row strong,
.detail-prerequisites {
  color: var(--paper);
  font-family: var(--font-ui);
}

.difficulty-stars {
  color: #ffd36d;
  letter-spacing: 3px;
}

.detail-prerequisites {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.detail-chip {
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(89, 216, 255, 0.12);
  border: 1px solid rgba(89, 216, 255, 0.18);
  color: rgba(244, 239, 231, 0.9);
  font-size: 0.78rem;
}

.detail-action {
  width: 100%;
  min-height: 46px;
  border-radius: 14px;
}

@media (max-width: 1024px) {
  .world-page {
    overflow: auto;
  }

  .page-shell-world {
    padding: 82px 0 calc(92px + env(safe-area-inset-bottom, 0px));
  }

  .world-page .topbar {
    display: block;
    height: 82px;
  }

  .world-page .searchbar {
    display: none;
  }

  .world-main,
  .world-shell,
  .world-map-card {
    height: calc(100vh - 82px);
    min-height: 620px;
  }

  .world-detail-panel {
    top: 96px;
    right: 0;
    bottom: calc(92px + env(safe-area-inset-bottom, 0px));
    width: min(380px, calc(100vw - 16px));
  }
}

@media (max-width: 680px) {
  .page-shell-world {
    padding-top: 72px;
  }

  .world-main,
  .world-shell,
  .world-map-card {
    height: calc(100vh - 72px);
    min-height: 560px;
  }

  .world-map-toolbar {
    display: none;
  }

  .world-mobile-switcher {
    position: absolute;
    inset: 0;
    z-index: 8;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    pointer-events: none;
  }

  .world-switch-button {
    width: 42px;
    height: 42px;
    padding: 0;
    border-radius: 50%;
    font-size: 1.7rem;
    line-height: 1;
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    pointer-events: auto;
  }

  .world-switch-label {
    position: absolute;
    left: 50%;
    bottom: calc(104px + env(safe-area-inset-bottom, 0px));
    transform: translateX(-50%);
    pointer-events: none;
  }

  .world-detail-panel {
    top: auto;
    right: 10px;
    bottom: calc(94px + env(safe-area-inset-bottom, 0px));
    left: 10px;
    width: auto;
    max-height: min(70vh, 560px);
    overflow: auto;
    padding: 18px;
    border-radius: 22px 22px 0 0;
    border-right: 1px solid rgba(255, 255, 255, 0.14);
    transform: translateY(calc(100% + 24px));
  }

  .world-detail-panel.is-open {
    transform: translateY(0);
  }
}
