/* The world map page (world.html): layout only. Colours, the top bar,
   buttons and the map's canvas come from css/app.css, as in the app. */
/* the page itself never zooms or scrolls on a phone: only the map pans and
   zooms (a stray pinch or double tap used to leave the page zoomed in) */
html,
body {
  touch-action: manipulation;
  overscroll-behavior: none;
}
.world {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding-bottom: env(safe-area-inset-bottom, 0px);
  /* a map page, not a document: taps and double taps never select text (the
     search field and the update list still can) */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}
.world input,
.world-picker {
  -webkit-user-select: text;
  user-select: text;
  -webkit-touch-callout: default;
}
.world-toolbar {
  gap: 0.5rem 0.875rem;
}
.world-pick {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}
.world-release {
  min-width: 8rem;
  font-variant-numeric: tabular-nums;
}
/* wider screens (not a phone on its side): the phones' target sizes, the arrows a size you can see, the year marks
   readable */
@media (min-width: 641px) and (min-height: 521px) {
  .world-toolbar .btn {
    min-height: 2.25rem;
  }
  #world-prev,
  #world-next {
    width: 2.25rem;
    padding: 0 0 0.125rem;
    font-size: 1.375rem;
    line-height: 1;
  }
  .world-release {
    font-size: 0.875rem;
    padding-inline: 0.875rem;
  }
  .world-ticks span.year::after {
    font-size: 0.6875rem;
  }
}
/* the date slider: a filled track to the handle, a tick per update, year
   marks with their year, and a date bubble over the handle while it moves */
.world-slider {
  --pos: 100%;
  position: relative;
  flex: 1;
  min-width: 12.5rem;
  height: 2.5rem;
  display: flex;
  align-items: center;
  padding-bottom: 0.625rem;
}
.world-slider input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 1.375rem;
  margin: 0;
  background: transparent;
  cursor: pointer;
  position: relative;
  z-index: 1;
}
.world-slider input[type='range']:focus-visible {
  outline: none;
}
.world-slider input[type='range']::-webkit-slider-runnable-track {
  height: 0.375rem;
  border-radius: 0.1875rem;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent) var(--pos), var(--bg3) var(--pos));
}
.world-slider input[type='range']::-moz-range-track {
  height: 0.375rem;
  border-radius: 0.1875rem;
  background: var(--bg3);
}
.world-slider input[type='range']::-moz-range-progress {
  height: 0.375rem;
  border-radius: 0.1875rem;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent));
}
.world-slider input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 1.125rem;
  height: 1.125rem;
  margin-top: -0.375rem;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent);
  box-shadow:
    0 0 0 4px rgba(120, 183, 255, 0.18),
    0 2px 6px rgba(0, 0, 0, 0.6);
  transition: box-shadow 0.15s;
}
.world-slider input[type='range']::-moz-range-thumb {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--accent);
  box-shadow:
    0 0 0 4px rgba(120, 183, 255, 0.18),
    0 2px 6px rgba(0, 0, 0, 0.6);
}
.world-slider input[type='range']:hover::-webkit-slider-thumb,
.world-slider input[type='range']:focus-visible::-webkit-slider-thumb {
  box-shadow:
    0 0 0 7px rgba(120, 183, 255, 0.28),
    0 2px 6px rgba(0, 0, 0, 0.6);
}
.world-ticks {
  position: absolute;
  left: 0.5625rem;
  right: 0.5625rem;
  top: 1.625rem;
  height: 0.875rem;
  pointer-events: none;
}
.world-ticks span {
  position: absolute;
  top: 0;
  width: 1px;
  height: 0.25rem;
  background: var(--fg2);
  opacity: 0.55;
}
.world-ticks span.year {
  height: 0.4375rem;
  background: var(--fg1);
  opacity: 0.9;
}
.world-ticks span.year::after {
  content: attr(data-year);
  position: absolute;
  top: 0.375rem;
  left: 0.1875rem;
  font-size: 0.625rem;
  color: var(--fg2);
  letter-spacing: 0.04em;
}
/* the mouse over the slider (wider screens): the update a click picks, its tick lit, and a card under the slider
   with what it changed (anchored as the bubble is, so it never sticks out of the screen); updates that added rooms
   keep a taller green tick once history is here */
@media (min-width: 641px) and (min-height: 521px) {
  .world-toolbar {
    position: relative;
    z-index: 4;
  }
  .world-ticks span.added {
    width: 2px;
    height: 0.5rem;
    background: var(--good);
    opacity: 0.95;
  }
  .world-ticks span.peek {
    width: 2px;
    height: 0.625rem;
    margin-left: -0.5px;
    background: #fff;
    opacity: 1;
  }
}
.world-peek {
  position: absolute;
  top: calc(100% + 0.375rem);
  left: calc(0.5625rem + (100% - 1.125rem) * var(--frac, 1));
  transform: translateX(calc(-100% * var(--frac, 1)));
  width: max-content;
  max-width: 22rem;
  padding: 0.5rem 0.6875rem;
  display: grid;
  gap: 0.3125rem;
  pointer-events: none;
  z-index: 5;
  background: rgba(20, 23, 29, 0.97);
  border: 1px solid var(--line);
  border-radius: 0.625rem;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.55);
  font-size: 0.75rem;
}
.world-peek::before {
  content: '';
  position: absolute;
  top: -0.3125rem;
  left: clamp(0.625rem, calc(100% * var(--frac, 1)), calc(100% - 0.625rem));
  width: 0.5rem;
  height: 0.5rem;
  background: inherit;
  border: solid var(--line);
  border-width: 1px 0 0 1px;
  transform: translateX(-50%) rotate(45deg);
}
/* (as the list of updates writes one: "13-Oct-2026 13:18 UTC (v0.101.8)", the date leading) */
.wp-head {
  white-space: nowrap;
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
}
.wp-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.wp-badge {
  display: inline-flex;
  align-items: center;
  height: 1.125rem;
  padding: 0 0.375rem;
  border-radius: 0.5625rem;
  font-size: 0.6875rem;
  font-weight: 600;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.07);
  color: var(--fg1);
}
.wp-badge.added {
  background: rgba(111, 208, 140, 0.16);
  color: var(--good);
}
.wp-badge.removed {
  background: rgba(232, 112, 112, 0.14);
  color: var(--bad);
}
.wp-note {
  color: var(--fg2);
}
.wp-rooms {
  color: var(--fg1);
  line-height: 1.35;
}
/* anchored at the handle, sliding from left-aligned at the start to right-aligned
   at the end, so it never sticks out of the screen; its pointer follows the handle */
.world-bubble {
  position: absolute;
  bottom: 2.125rem;
  left: calc(0.5625rem + (100% - 1.125rem) * var(--frac, 1));
  transform: translateX(calc(-100% * var(--frac, 1)));
  padding: 0.1875rem 0.5rem;
  border-radius: 0.375rem;
  background: var(--accent);
  color: #0d0f13;
  font-size: 0.75rem;
  font-weight: 650;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 2;
}
.world-bubble::after {
  content: '';
  position: absolute;
  left: clamp(0.5rem, calc(100% * var(--frac, 1)), calc(100% - 0.5rem));
  bottom: -0.25rem;
  width: 0.5rem;
  height: 0.5rem;
  background: var(--accent);
  transform: translateX(-50%) rotate(45deg);
}
.world-slider.dragging .world-bubble {
  opacity: 1;
}
.world-map {
  flex: 1;
  background: #0e1014;
}
.world-map canvas {
  outline: none;
  transition: filter 0.25s ease;
}
/* while another update loads: the current map stays, blurred and dimmed, under a clear notice */
.world-map.loading canvas:not(.wmap-thumb),
.world-map.loading .world-sealed {
  filter: blur(5px) brightness(0.75);
}
/* satellite pictures sit under the map's canvas and take no input */
.world-map canvas.world-satellite {
  pointer-events: none;
}
#world-loading {
  top: 50%;
} /* (the shared .load-card, in the middle of the map) */
/* only a failure has anything to say: on the map, bottom right, above the zoom buttons */
.world-status {
  position: absolute;
  right: 0.625rem;
  bottom: 6.5rem;
  max-width: calc(100% - 1.25rem);
  margin: 0;
  padding: 0.25rem 0.5625rem;
  border-radius: 0.375rem;
  background: rgba(13, 15, 19, 0.8);
  color: var(--bad);
  font-size: 0.75rem;
  pointer-events: none;
}
.world-status:empty {
  display: none;
}
/* bottom left, on the map: the map/satellite switch and the labels switch */
.wmap-corner {
  position: absolute;
  left: 0.625rem;
  bottom: 0.625rem;
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  z-index: 3;
  pointer-events: none;
}
.wmap-corner > * {
  pointer-events: auto;
}
.wmap-labels {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.3125rem 0.6875rem;
  border-radius: 62.4375rem;
  background: rgba(13, 15, 19, 0.72);
  border: 1px solid var(--line);
  color: var(--fg1);
  font-size: 0.75rem;
  cursor: pointer;
  user-select: none;
}
/* the view switch: a small picture of the other view, named under it */
.wmap-view {
  position: relative;
  width: 4.5rem;
  height: 4.5rem;
  padding: 0;
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 0.625rem;
  overflow: hidden;
  background: #0e1014;
  cursor: pointer;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.6);
  transition:
    border-color 0.15s,
    transform 0.15s;
}
.wmap-view[hidden] {
  display: none;
}
.wmap-view:hover:not(:disabled) {
  border-color: var(--accent);
  transform: translateY(-1px);
}
.wmap-view:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.wmap-view:disabled {
  cursor: default;
  opacity: 0.55;
}
.map-canvas-host .wmap-view canvas.wmap-thumb {
  inset: 0;
  cursor: inherit;
  touch-action: auto;
}
.wmap-view span {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0.875rem 0 0.25rem;
  font-size: 0.6875rem;
  font-weight: 650;
  letter-spacing: 0.02em;
  color: #fff;
  text-align: center;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.8));
  text-shadow: 0 1px 2px #000;
}
@media (max-width: 600px) {
  .wmap-view {
    width: 3.75rem;
    height: 3.75rem;
  }
}
/* no satellite pictures of the shown update yet: the picture dimmed, a clock in its corner; a click says why */
.wmap-view.unready {
  border-color: rgba(255, 255, 255, 0.45);
}
.wmap-view.unready canvas.wmap-thumb,
.wmap-view.unready > span {
  opacity: 0.5;
}
.wmap-soon {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  width: 1.125rem;
  height: 1.125rem;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: rgba(13, 15, 19, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.6);
  pointer-events: none;
}
.wmap-soon svg {
  width: 0.75rem;
  height: 0.75rem;
  fill: none;
  stroke: #fff;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.modal.world-soon {
  max-width: 23.75rem;
}
.modal.world-soon p {
  margin: 0 0 0.625rem;
  line-height: 1.5;
}
/* zoom buttons, bottom right: plus over minus */
.wmap-zoom {
  position: absolute;
  right: 0.625rem;
  bottom: 0.625rem;
  display: flex;
  flex-direction: column;
  z-index: 3;
  border-radius: 0.625rem;
  overflow: hidden;
  background: rgba(13, 15, 19, 0.82);
  border: 1px solid var(--line);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}
.wmap-zoom button {
  width: 2.5rem;
  height: 2.5rem;
  padding: 0;
  border: 0;
  background: none;
  color: var(--fg1);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.wmap-zoom button + button {
  border-top: 1px solid var(--line);
}
.wmap-zoom button:hover {
  color: var(--fg0);
  background: rgba(255, 255, 255, 0.06);
}
.wmap-zoom button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
.wmap-zoom svg {
  width: 1rem;
  height: 1rem;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  fill: none;
}
@media (max-width: 600px) {
  .wmap-zoom {
    right: 0.5rem;
    bottom: 0.5rem;
  }
  .wmap-zoom button {
    width: 2.75rem;
    height: 2.75rem;
  }
}
/* a word about the view (no pictures of this update): top middle of the map */
.world-note {
  position: absolute;
  top: 0.625rem;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 1.25rem);
  margin: 0;
  padding: 0.25rem 0.6875rem;
  border-radius: 62.4375rem;
  background: rgba(13, 15, 19, 0.8);
  border: 1px solid var(--line);
  color: var(--fg1);
  font-size: 0.75rem;
  pointer-events: none;
  z-index: 3;
  text-align: center;
}
.world-note:empty {
  display: none;
}
.wmap-labels:hover {
  color: var(--fg0);
  border-color: var(--accent-dim);
}
.wmap-labels input {
  margin: 0;
  accent-color: var(--accent);
}
.wmap-labels[hidden] {
  display: none;
}
/* the way into the viewer: the page's main action */

.world-picker[hidden] {
  display: none;
}
.world-picker {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(5, 7, 10, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
}
.world-picker-card {
  width: min(28.75rem, calc(100% - 1.5rem));
  max-height: 75%;
  display: flex;
  flex-direction: column;
  background: var(--bg1);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.75rem;
}
.world-picker-head {
  display: flex;
  gap: 0.5rem;
}
.world-picker-head input {
  flex: 1;
  min-width: 0;
  background: var(--bg3);
  color: var(--fg0);
  border: 1px solid var(--line);
  border-radius: 0.375rem;
  padding: 0.375rem 0.625rem;
  font: inherit;
}
.world-list {
  list-style: none;
  margin: 0.625rem 0 0;
  padding: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.world-list button {
  width: 100%;
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  text-align: left;
  background: none;
  border: 0;
  border-radius: 0.375rem;
  padding: 0.5rem 0.625rem;
  cursor: pointer;
  color: var(--fg1);
  font-variant-numeric: tabular-nums;
}
.world-list button:hover,
.world-list button.current {
  background: var(--bg3);
  color: var(--fg0);
}
.world-list .when {
  color: var(--fg2);
  font-family: var(--mono);
  font-size: 0.6875rem;
}
/* an update's name, wherever it shows (its button, this list, the slider's card): the date leads, the version follows, quieter */
.rn-date {
  color: var(--fg0);
}
.rn-ver {
  color: var(--fg2);
}
/* (bold where there is room: on the narrowest phones a bold date wraps the list's rows) */
@media (min-width: 641px) and (min-height: 521px) {
  .rn-date {
    font-weight: 600;
  }
}
.world-list .empty {
  color: var(--fg2);
  padding: 0.5rem 0.625rem;
}

/* phones: the toolbar stacks (update controls, then the slider), bigger targets */
@media (max-width: 640px) {
  .world-toolbar {
    padding: 0.5rem 0.625rem;
  }
  .world-toolbar .btn {
    min-height: 2.25rem;
  }
  .world-pick {
    width: 100%;
    min-width: 0;
  }
  /* the release name wraps to a second line on the narrowest phones */
  .world-release {
    flex: 1;
    min-width: 0;
    white-space: normal;
    line-height: 1.25;
  }
  .world-slider {
    min-width: 0;
    width: 100%;
    flex: none;
  }
  .wmap-corner {
    left: 0.5rem;
    bottom: 0.5rem;
  }
  .world-picker {
    align-items: flex-end;
  }
  .world-picker-card {
    width: 100%;
    border-radius: var(--radius) var(--radius) 0 0;
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 0.75rem);
  }
  /* 16px or more: Safari zooms the page into any smaller text field it focuses */
  .world-picker-head input {
    font-size: 1rem;
  }
}

/* sealed areas (src/world-atlas/sealed.ts): the fog canvas and the badges over it */
.world-map canvas.world-fog {
  pointer-events: none;
}
.world-sealed {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.sealed-badge {
  position: absolute;
  left: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.125rem;
  --glow: rgba(150, 190, 255, 0.55);
  animation: sealed-breathe 7s ease-in-out infinite;
}
.sealed-stonemaw {
  --glow: rgba(245, 158, 72, 0.6);
}
.sealed-bleakholm {
  --glow: rgba(92, 184, 250, 0.6);
}
.sealed-badge img {
  width: var(--logo, 4rem);
  height: var(--logo, 4rem);
  object-fit: contain;
  opacity: 0.9;
  filter: grayscale(0.35) brightness(0.85) drop-shadow(0 0 10px var(--glow)) drop-shadow(0 0 2px rgba(0, 0, 0, 0.9));
}
.sealed-name {
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.6875rem;
  color: #d9dde6;
  text-shadow:
    0 0 8px var(--glow),
    0 1px 2px #000;
  white-space: nowrap;
}
.sealed-note {
  font-size: 0.625rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(200, 206, 220, 0.55);
  text-shadow: 0 1px 2px #000;
}
@keyframes sealed-breathe {
  0%,
  100% {
    opacity: 0.82;
  }
  50% {
    opacity: 1;
  }
}
@media (prefers-reduced-motion: reduce) {
  .sealed-badge {
    animation: none;
  }
}

/* a capture view (#ui=0): the map alone, for scripted time-lapses */
:root[data-tool='maps']:has(.world.bare) #topbar,
.world.bare .world-toolbar,
.world.bare .world-status,
.world.bare .wmap-corner,
.world.bare .world-note,
.world.bare .wmap-zoom {
  display: none;
}

/* the view switch before the map knows whether it has pictures: its place kept, nothing shown */
.wmap-view.pending {
  visibility: hidden;
  pointer-events: none;
}
