/* 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-title { color: var(--fg1); font-weight: 600; }
.world-toolbar { gap: 8px 14px; }
.world-pick { display: flex; align-items: center; gap: 6px; }
.world-release { min-width: 128px; font-variant-numeric: tabular-nums; }
/* 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: 200px; height: 40px; display: flex; align-items: center; padding-bottom: 10px; }
.world-slider input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; 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: 6px; border-radius: 3px;
  background: linear-gradient(90deg, var(--accent-dim), var(--accent) var(--pos), var(--bg3) var(--pos)); }
.world-slider input[type=range]::-moz-range-track { height: 6px; border-radius: 3px; background: var(--bg3); }
.world-slider input[type=range]::-moz-range-progress { height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--accent-dim), var(--accent)); }
.world-slider input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: -6px; border-radius: 50%;
  background: #fff; border: 3px solid var(--accent); box-shadow: 0 0 0 4px rgba(120, 183, 255, .18), 0 2px 6px rgba(0, 0, 0, .6); transition: box-shadow .15s; }
.world-slider input[type=range]::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 3px solid var(--accent);
  box-shadow: 0 0 0 4px rgba(120, 183, 255, .18), 0 2px 6px rgba(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, .28), 0 2px 6px rgba(0, 0, 0, .6); }
.world-ticks { position: absolute; left: 9px; right: 9px; top: 26px; height: 14px; pointer-events: none; }
.world-ticks span { position: absolute; top: 0; width: 1px; height: 4px; background: var(--fg2); opacity: .55; }
.world-ticks span.year { height: 7px; background: var(--fg1); opacity: .9; }
.world-ticks span.year::after { content: attr(data-year); position: absolute; top: 6px; left: 3px; font-size: 10px; color: var(--fg2); letter-spacing: .04em; }
/* 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: 34px; left: calc(9px + (100% - 18px) * var(--frac, 1)); transform: translateX(calc(-100% * var(--frac, 1))); padding: 3px 8px;
  border-radius: 6px; background: var(--accent); color: #0d0f13; font-size: 12px; font-weight: 650; white-space: nowrap; pointer-events: none;
  opacity: 0; transition: opacity .15s; z-index: 2; }
.world-bubble::after { content: ""; position: absolute; left: clamp(8px, calc(100% * var(--frac, 1)), calc(100% - 8px)); bottom: -4px; width: 8px; height: 8px; 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 .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(.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: 10px; bottom: 104px; max-width: calc(100% - 20px); margin: 0; padding: 4px 9px;
  border-radius: 6px; background: rgba(13, 15, 19, .8); color: var(--bad); font-size: 12px; 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: 10px; bottom: 10px; display: flex; align-items: flex-end; gap: 8px; z-index: 3; pointer-events: none; }
.wmap-corner > * { pointer-events: auto; }
.wmap-labels { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px;
  border-radius: 999px; background: rgba(13, 15, 19, .72); border: 1px solid var(--line); color: var(--fg1); font-size: 12px; cursor: pointer; user-select: none; }
/* the view switch: a small picture of the other view, named under it */
.wmap-view { position: relative; width: 72px; height: 72px; padding: 0; border: 2px solid rgba(255, 255, 255, .85); border-radius: 10px;
  overflow: hidden; background: #0e1014; cursor: pointer; box-shadow: 0 2px 10px rgba(0, 0, 0, .6); transition: border-color .15s, transform .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: .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: 14px 0 4px; font-size: 11px; font-weight: 650; letter-spacing: .02em;
  color: #fff; text-align: center; background: linear-gradient(transparent, rgba(0, 0, 0, .8)); text-shadow: 0 1px 2px #000; }
@media (max-width: 600px) { .wmap-view { width: 60px; height: 60px; } }
/* 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, .45); }
.wmap-view.unready canvas.wmap-thumb, .wmap-view.unready > span { opacity: .5; }
.wmap-soon { position: absolute; top: 4px; right: 4px; width: 18px; height: 18px; display: grid; place-items: center;
  border-radius: 50%; background: rgba(13, 15, 19, .85); border: 1px solid rgba(255, 255, 255, .6); pointer-events: none; }
.wmap-soon svg { width: 12px; height: 12px; fill: none; stroke: #fff; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.modal.world-soon { max-width: 380px; }
.modal.world-soon p { margin: 0 0 10px; line-height: 1.5; }
/* zoom buttons, bottom right: plus over minus */
.wmap-zoom { position: absolute; right: 10px; bottom: 10px; display: flex; flex-direction: column; z-index: 3;
  border-radius: 10px; overflow: hidden; background: rgba(13, 15, 19, .82); border: 1px solid var(--line); box-shadow: 0 2px 10px rgba(0, 0, 0, .5); }
.wmap-zoom button { width: 40px; height: 40px; 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, .06); }
.wmap-zoom button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.wmap-zoom svg { width: 16px; height: 16px; stroke: currentColor; stroke-width: 2; stroke-linecap: round; fill: none; }
@media (max-width: 600px) { .wmap-zoom { right: 8px; bottom: 8px; } .wmap-zoom button { width: 44px; height: 44px; } }
/* a word about the view (no pictures of this update): top middle of the map */
.world-note { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); max-width: calc(100% - 20px); margin: 0; padding: 4px 11px;
  border-radius: 999px; background: rgba(13, 15, 19, .8); border: 1px solid var(--line); color: var(--fg1); font-size: 12px; 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, .6); display: flex; align-items: center; justify-content: center; }
.world-picker-card { width: min(460px, calc(100% - 24px)); max-height: 75%; display: flex; flex-direction: column;
  background: var(--bg1); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.world-picker-head { display: flex; gap: 8px; }
.world-picker-head input { flex: 1; min-width: 0; background: var(--bg3); color: var(--fg0); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; font: inherit; }
.world-list { list-style: none; margin: 10px 0 0; padding: 0; overflow-y: auto; overscroll-behavior: contain; }
.world-list button { width: 100%; display: flex; justify-content: space-between; gap: 12px; text-align: left; background: none; border: 0;
  border-radius: 6px; padding: 8px 10px; 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: 11px; }
.world-list b { font-weight: 600; color: var(--fg0); }
.world-list .empty { color: var(--fg2); padding: 8px 10px; }

/* phones: the toolbar stacks (update controls, then the slider), bigger targets */
@media (max-width: 640px) {
  #topbar .world-title { display: none; }
  .world-toolbar { padding: 8px 10px; }
  .world-toolbar .btn { min-height: 36px; }
  .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: 8px; bottom: 8px; }
  .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) + 12px); }
  /* 16px or more: Safari zooms the page into any smaller text field it focuses */
  .world-picker-head input { font-size: 16px; }
}

/* 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: 2px;
  --glow: rgba(150, 190, 255, .55); animation: sealed-breathe 7s ease-in-out infinite; }
.sealed-stonemaw { --glow: rgba(245, 158, 72, .6); }
.sealed-bleakholm { --glow: rgba(92, 184, 250, .6); }
.sealed-badge img { width: var(--logo, 64px); height: var(--logo, 64px); object-fit: contain; opacity: .9;
  filter: grayscale(.35) brightness(.85) drop-shadow(0 0 10px var(--glow)) drop-shadow(0 0 2px rgba(0, 0, 0, .9)); }
.sealed-name { font-weight: 650; letter-spacing: .14em; text-transform: uppercase; font-size: 11px; color: #d9dde6;
  text-shadow: 0 0 8px var(--glow), 0 1px 2px #000; white-space: nowrap; }
.sealed-note { font-size: 10px; letter-spacing: .3em; text-transform: uppercase; color: rgba(200, 206, 220, .55); text-shadow: 0 1px 2px #000; }
@keyframes sealed-breathe { 0%, 100% { opacity: .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; }
