:root {
  --world-bg: #090706;
  --world-ink: #1d130b;
  --world-panel: #1d120b;
  --world-gold: #f1c978;
  --world-cream: #fff2c9;
  --world-muted: #9f8561;
  --world-cyan: #78bfd1;
  --world-font-pixel: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', monospace;
  --world-font-body: 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --world-z-scene: 0;
  --world-z-hotspot: 3;
  --world-z-route: 6;
  --world-z-popover: 7;
  --world-z-hotspot-clear: 30;
}

* {
  box-sizing: border-box;
}

body[data-shell-page="world-entry"] {
  min-height: 100vh;
  margin: 0;
  overflow: hidden;
  color: var(--world-cream);
  background: var(--world-bg);
  font-family: var(--world-font-body);
}

.world-entry-shell {
  width: min(100vw, 1640px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 12px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 10px;
  overflow: hidden;
}

.world-entry-hud {
  min-height: 50px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: #2b1b0f;
  border: 2px solid var(--world-gold);
  box-shadow: 0 0 0 3px rgba(28, 16, 8, 0.92), 0 8px 0 rgba(0, 0, 0, 0.32);
}

.hud-left,
.hud-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.world-entry-hud-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0;
}

.hud-kicker {
  font-size: 12px;
  color: var(--world-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hud-title {
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--world-font-body);
  font-size: clamp(28px, 3.2vw, 34px);
  font-weight: 800;
  line-height: 1;
  color: var(--world-cream);
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.4);
}

.world-entry-hud-chip,
.hud-pill {
  padding: 3px 10px;
  font-size: 12px;
  border: 2px solid rgba(247, 210, 118, 0.74);
}

.world-entry-hud-chip {
  color: #221406;
  background: rgba(255, 239, 178, 0.88);
}

.hud-pill {
  color: var(--world-cream);
  background: rgba(92, 43, 21, 0.82);
}

.world-entry-layout {
  min-height: 0;
  display: grid;
  grid-template-columns: var(--im-scene-rail-width, 220px) minmax(0, 1fr);
  align-items: stretch;
  gap: 10px;
}

.world-entry-rail {
  min-width: 0;
  padding: 10px 8px;
  overflow: auto;
  background:
    linear-gradient(180deg, rgba(45, 28, 15, 0.96), rgba(24, 14, 8, 0.98)),
    repeating-linear-gradient(90deg, rgba(255, 230, 150, 0.07) 0 1px, transparent 1px 22px);
  border: 2px solid var(--world-gold);
  box-shadow: 0 0 0 3px rgba(28, 16, 8, 0.92), 0 8px 0 rgba(0, 0, 0, 0.32);
}

.world-entry-rail .rail-title {
  display: none;
}

.rail-title {
  margin-bottom: 10px;
  font-family: var(--world-font-pixel);
  font-size: 18px;
  text-align: center;
  color: #2a1709;
}

.rail-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rail-item {
  min-height: 50px;
  padding: 6px 4px;
  display: grid;
  place-items: center;
  text-align: center;
  text-decoration: none;
  color: var(--world-cream);
  background: rgba(255, 242, 201, 0.08);
  border: 2px solid rgba(241, 201, 120, 0.62);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.22);
}

.rail-item.is-active {
  color: #23150b;
  background: linear-gradient(180deg, #ffe9a9, #d69d4c);
  border-color: #fff1aa;
}

.rail-item-label {
  font-family: var(--world-font-pixel);
  font-size: 16px;
  line-height: 1.2;
}

.world-entry-stage {
  position: relative;
  min-height: calc(100vh - 86px);
  height: 100%;
  overflow: hidden;
  background: #15130f;
  border: 3px solid #27190f;
  box-shadow: 0 0 0 3px var(--world-gold), 0 12px 0 rgba(0, 0, 0, 0.34);
}

/* Night scene */
.world-entry-scene {
  position: absolute;
  inset: 0;
  z-index: var(--world-z-scene);
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.02), rgba(0, 0, 0, 0) 58%, rgba(0, 0, 0, 0.14)),
    url("assets/pixel/composed/world-metro-station-scene-v1-256.png") center / cover no-repeat;
}

body[data-time-of-day="day"] .world-entry-scene {
  background:
    linear-gradient(180deg, rgba(255, 232, 180, 0.04), rgba(255, 232, 180, 0) 58%, rgba(80, 58, 24, 0.08)),
    url("assets/pixel/composed/world-metro-station-scene-v1-day-256.png") center / cover no-repeat;
}

.world-entry-scene::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 180ms ease;
}

/* Day scenes must come from separate assets; do not add a white/screen tint over the art. */
body[data-time-of-day="day"] .world-entry-scene::after {
  opacity: 0;
  background: none;
  mix-blend-mode: normal;
}

.world-entry-hero {
  position: absolute;
  inset: 14px auto auto 14px;
  z-index: 2;
  pointer-events: none;
}

.world-entry-copy {
  min-width: 190px;
  padding: 8px 11px;
  color: var(--world-cream);
  background: rgba(18, 11, 7, 0.58);
  border: 2px solid rgba(247, 210, 118, 0.90);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.34);
}

.world-entry-kicker,
.world-entry-title,
.world-entry-blurb {
  margin: 0;
}

.world-entry-kicker {
  font-size: 12px;
  color: rgba(255, 242, 201, 0.78);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.world-entry-title {
  margin-top: 3px;
  font-family: var(--world-font-pixel);
  font-size: clamp(30px, 4vw, 48px);
  line-height: 0.92;
  text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.42);
}

.world-entry-blurb {
  margin-top: 8px;
  font-size: 13px;
  color: rgba(255, 242, 201, 0.88);
}

.world-entry-hotspots {
  position: absolute;
  inset: 0;
  z-index: var(--world-z-hotspot);
  pointer-events: none;
}

.scene-hotspot {
  position: absolute;
  display: grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  color: transparent;
  text-decoration: none;
  cursor: pointer;
  background: transparent;
  border: 2px solid transparent;
  pointer-events: none;
}

.scene-hotspot span {
  width: max-content;
  max-width: max-content;
  padding: 2px 6px;
  opacity: 0;
  transition: opacity 0.15s ease;
  color: #fff2c9;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
  background: rgba(20, 12, 7, 0.86);
  border: 1px solid rgba(247, 210, 118, 0.78);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.38);
}

.scene-hotspot:hover,
.scene-hotspot:focus-visible,
.scene-hotspot[aria-expanded="true"] {
  outline: none;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.scene-hotspot:hover span,
.scene-hotspot:focus-visible span,
.scene-hotspot[aria-expanded="true"] span {
  opacity: 1;
}

.world-entry-hotspot--city {
  left: 2%;
  top: 12%;
  width: 25%;
  height: 52%;
}

.world-entry-hotspot--map {
  left: 29%;
  top: 21%;
  width: 15%;
  height: 28%;
}

.world-entry-hotspot--platform {
  left: 30%;
  top: 59%;
  width: 27%;
  height: 28%;
}

.world-entry-hotspot--train {
  left: 58%;
  top: 18%;
  width: 38%;
  height: 58%;
}

.scene-hotspot-popover {
  position: absolute;
  z-index: var(--world-z-popover);
  width: min(260px, calc(100% - 28px));
  transform: translateX(-50%);
  padding: 10px 12px;
  color: #fff2c9;
  background: linear-gradient(180deg, rgba(42, 24, 12, 0.94), rgba(16, 9, 5, 0.96));
  border: 2px solid rgba(247, 210, 118, 0.86);
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.34);
  pointer-events: auto;
}

.scene-hotspot-title {
  margin-bottom: 4px;
  font-size: 15px;
  font-weight: 800;
}

.scene-hotspot-copy {
  font-size: 13px;
  line-height: 1.55;
  color: rgba(255, 242, 201, 0.82);
}

.world-route-panel {
  position: absolute;
  z-index: var(--world-z-route);
  left: 32%;
  top: 18%;
  width: min(360px, calc(100% - 40px));
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
}

.world-route-panel:target {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.world-route-card {
  padding: 14px;
  color: var(--world-ink);
  background:
    linear-gradient(180deg, rgba(255, 240, 190, 0.98), rgba(225, 181, 104, 0.96));
  border: 2px solid #2b1c11;
  box-shadow: 0 0 0 3px rgba(246, 219, 151, 0.50), 0 10px 0 rgba(0, 0, 0, 0.34);
}

.world-route-close {
  float: right;
  padding: 2px 8px;
  color: #fff4c9;
  text-decoration: none;
  background: #8d3d1b;
  border: 2px solid #2b1c11;
}

.world-route-kicker,
.world-route-card h2 {
  margin: 0;
}

.world-route-kicker {
  color: #7f4518;
  font-family: var(--world-font-pixel);
  font-size: 15px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.world-route-card h2 {
  margin-top: 3px;
  font-size: 22px;
  line-height: 1.1;
}

.world-route-list {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.world-route-option {
  padding: 10px 12px;
  display: grid;
  gap: 3px;
  color: #21140b;
  text-decoration: none;
  background: rgba(255, 248, 222, 0.78);
  border: 2px solid rgba(58, 35, 15, 0.78);
  box-shadow: inset 0 -3px 0 rgba(100, 58, 20, 0.18);
}

.world-route-option-square {
  background: rgba(255, 235, 166, 0.92);
  border-color: rgba(141, 61, 27, 0.88);
}

.world-route-option:hover,
.world-route-option:focus-visible {
  outline: none;
  background: rgba(255, 226, 145, 0.94);
}

.world-route-option span {
  color: rgba(33, 20, 11, 0.66);
  font-size: 12px;
  line-height: 1.45;
}

body.scene-clear-mode[data-shell-page="world-entry"] .world-entry-hero,
body.scene-clear-mode[data-shell-page="world-entry"] .world-route-panel {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

@media (max-width: 820px) {
  body[data-shell-page="world-entry"] {
    overflow-y: auto;
    overflow-x: hidden;
  }

  .world-entry-shell {
    min-height: 100svh;
    padding: 8px;
    padding-bottom: max(8px, env(safe-area-inset-bottom));
    gap: 8px;
  }

  .world-entry-hud {
    min-height: 38px;
    padding: 5px 10px;
  }

  .world-entry-hud .hud-title {
    font-size: 20px;
  }

  .world-entry-hud-chip,
  .hud-pill {
    padding: 2px 8px;
    font-size: 11px;
  }

  .world-entry-layout {
    grid-template-columns: 1fr;
    grid-template-rows: auto minmax(0, 1fr);
  }

  .world-entry-rail {
    padding: 6px;
    overflow: hidden;
  }

  .rail-title {
    display: none;
  }

  .rail-actions {
    flex-direction: row;
  }

  .rail-item {
    min-height: 36px;
    flex: 1;
    font-size: 14px;
  }

  .rail-item-label {
    font-size: 14px;
    white-space: nowrap;
  }

  .world-entry-stage {
    min-height: calc(100svh - 116px);
  }

  .world-entry-scene {
    background:
      linear-gradient(180deg, rgba(0, 0, 0, 0.02), rgba(0, 0, 0, 0) 58%, rgba(0, 0, 0, 0.12)),
      url("assets/pixel/composed/world-metro-station-scene-v1-mobile-256.png") center / cover no-repeat;
  }

  body[data-time-of-day="day"] .world-entry-scene {
    background:
      linear-gradient(180deg, rgba(255, 232, 180, 0.04), rgba(255, 232, 180, 0) 58%, rgba(80, 58, 24, 0.08)),
      url("assets/pixel/composed/world-metro-station-scene-v1-mobile-day-256.png") center / cover no-repeat;
  }

  .world-entry-hero {
    inset: 10px auto auto 10px;
  }

  .world-entry-copy {
    min-width: 150px;
    padding: 7px 9px;
  }

  .world-entry-title {
    font-size: 30px;
  }

  .world-route-panel {
    left: 12px;
    top: 78px;
    width: calc(100% - 24px);
  }

  .world-entry-hotspots {
    display: block;
    pointer-events: none;
  }

  .scene-hotspot {
    display: none;
    pointer-events: none;
  }

  .world-entry-hotspot--city,
  .world-entry-hotspot--map,
  .world-entry-hotspot--platform,
  .world-entry-hotspot--train {
    width: auto !important;
    height: auto !important;
    min-width: 0 !important;
    min-height: 0 !important;
    display: none !important;
    background: transparent !important;
    border: 0 !important;
  }

  .world-entry-hotspot--city,
  .world-entry-hotspot--map,
  .world-entry-hotspot--platform,
  .world-entry-hotspot--train {
    display: grid !important;
  }

  .world-entry-hotspot--city {
    left: 7% !important;
    top: 31% !important;
  }

  .world-entry-hotspot--map {
    left: 42% !important;
    top: 33% !important;
  }

  .world-entry-hotspot--train {
    left: 70% !important;
    top: 45% !important;
  }

  .world-entry-hotspot--platform {
    left: 48% !important;
    top: 63% !important;
  }

  .scene-hotspot span {
    opacity: 1;
  }
}

/* Interaction polish: clear-screen mode becomes the explicit scene/hotspot mode. */
.world-entry-stage {
  cursor: zoom-out;
}

body.scene-clear-mode[data-shell-page="world-entry"] .world-entry-stage {
  cursor: zoom-in;
}

body.scene-clear-mode[data-shell-page="world-entry"] .world-entry-hotspots {
  z-index: var(--world-z-hotspot-clear);
  pointer-events: auto !important;
}

body.scene-clear-mode[data-shell-page="world-entry"] .scene-hotspot {
  pointer-events: auto !important;
}

body.scene-clear-mode[data-shell-page="world-entry"] .scene-hotspot span {
  opacity: 0;
}

body.scene-clear-mode[data-shell-page="world-entry"] .scene-hotspot:hover span,
body.scene-clear-mode[data-shell-page="world-entry"] .scene-hotspot:focus-visible span,
body.scene-clear-mode[data-shell-page="world-entry"] .scene-hotspot[aria-expanded="true"] span,
body.scene-clear-mode[data-shell-page="world-entry"] .scene-hotspot.is-near-pointer span,
body.scene-hotspot-labels-visible.scene-clear-mode[data-shell-page="world-entry"] .scene-hotspot span {
  opacity: 1;
}

body[data-shell-page="world-entry"] .scene-hotspot.is-near-pointer span,
body.scene-hotspot-labels-visible[data-shell-page="world-entry"] .scene-hotspot span {
  opacity: 1;
}

/* Keep the world-entry scene consistent with the room/city interaction contract. */
.world-entry-hero {
  display: none !important;
}

.world-entry-hud {
  position: relative;
  justify-content: flex-end;
}

.world-entry-hud .hud-left {
  display: contents;
}

.world-entry-hud-copy {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  align-items: center;
  text-align: center;
}
