/* World chooser ("W3 Star map"): each world is a star of arcane dust on the night sky.
   Built from docs/design/mockups/world-chooser.html. The stars, lines and specks are drawn at runtime
   by web/chooser/; this file only styles them. Colours come from tidewater.css. */

/* The page draws its own glow, so Tidewater's body gradient is switched off here. */
html, body { height: 100%; }
body.chooser { background-image: none; height: 100vh; height: 100dvh; display: flex; flex-direction: column; overflow: hidden; position: relative; -webkit-font-smoothing: antialiased; }
.glow { position: fixed; inset: 0; background: radial-gradient(1100px 520px at 50% -12%, var(--bg-glow), transparent 70%); pointer-events: none; }

/* Top bar */
.top { position: relative; display: flex; align-items: center; justify-content: space-between; min-height: var(--header-h); padding: 0 20px; border-bottom: 1px solid var(--line-soft); font-size: 14px; flex: none; }
.brand { display: inline-flex; align-items: center; gap: 8px; font-size: var(--wordmark-size); font-weight: 600; letter-spacing: .3px; color: var(--text); }
.brand:hover { text-decoration: none; color: var(--title); }
.brand svg { width: 15px; height: 15px; fill: var(--accent); }


/* Heading */
.chooser-main { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.head { position: relative; text-align: center; padding: 36px 24px 0; flex: none; }
.head h1 { font-family: var(--font-serif); font-weight: 400; color: var(--title); font-size: clamp(28px, 4vw, 40px); margin: 0; letter-spacing: -.01em; }
.count { color: var(--text-faint); font-size: 13px; margin: 10px 0 0; min-height: 1.5em; }
body.chooser:not([data-ready]) .head { visibility: hidden; }
.load-error { position: absolute; left: 0; right: 0; bottom: 24px; text-align: center; }

/* The sky. The stars and lines themselves are styled by stars.css. */
.map { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.map svg.sky { position: absolute; left: 50%; top: 50%; width: 100%; height: 100%; transform: translate(-50%, -50%); overflow: visible; }
/* Lines and stars: one set of positions for landscape screens, one for portrait. */
.th.port { display: none; }
@media (orientation: portrait) { .th.land { display: none; } .th.port { display: block; } }
@media (orientation: portrait) { .star { transform: translate(var(--px), var(--py)); } }

/* Labels keep a readable size on every screen: --u (set by web/svg.js) is the sky's user units per CSS pixel, so
   a name is at least 15 px on screen and "+ New world" at least 13 px. A halo of the background keeps lines that
   pass under a label from cutting through it. */
.sky .lbl { font-size: max(15px, calc(15px * var(--u, 1))); dominant-baseline: hanging; paint-order: stroke; stroke: var(--bg); stroke-width: calc(5px * var(--u, 1)); stroke-linejoin: round; }

/* The "+ New world" star: an outline star, dimmed at the limit. */
.sky .neu .lbl { font-family: var(--font-sans); font-size: max(13px, calc(13px * var(--u, 1))); }
.neu .dust path { stroke: var(--text-muted); }
.neu .dust .s2 { stroke: var(--accent); }
.neu .halo { opacity: .5; }
.neu[aria-disabled="true"] { cursor: not-allowed; opacity: .42; }
.neu[aria-disabled="true"]:hover .ring, .neu[aria-disabled="true"].on .ring { transform: none; stroke-opacity: .5; }

/* The card shown on hover, focus or first tap. */
.card { position: absolute; z-index: 3; min-width: 200px; max-width: 260px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; font-size: 13px; line-height: 1.5; color: var(--text-muted); box-shadow: 0 10px 30px rgb(0 0 0 / .35); opacity: 0; visibility: hidden; transform: translateY(4px); transition: opacity .15s ease, transform .15s ease, visibility 0s linear .15s; pointer-events: none; overflow-wrap: anywhere; }
.card.on { opacity: 1; visibility: visible; transform: none; transition: opacity .15s ease, transform .15s ease; }
.card h2 { font-family: var(--font-serif); font-weight: 400; color: var(--title); font-size: 18px; margin: 0 0 4px; }
.card .ai { margin-top: 6px; }
.card .ai.ok { color: var(--accent); }
.card .ai.no { color: var(--text-faint); }
.card .hint { color: var(--text-faint); font-size: 12px; margin-top: 6px; }
.card .limit { color: var(--warning); }

/* The create dialog */
.new-world { width: min(440px, calc(100vw - 32px)); }
.new-world h2 { margin-bottom: var(--space-3); }
.new-world input { width: 100%; margin-bottom: var(--space-2); }
.new-world .faint { margin: 0 0 var(--space-3); overflow-wrap: anywhere; }
.dialog-actions { display: flex; justify-content: flex-end; gap: var(--space-1); }

@media (max-width: 600px) {
  .head { padding-top: 24px; }
  .top { padding: 0 14px; }

  .sky .lbl { font-size: max(17px, calc(15px * var(--u, 1))); }
  .sky .neu .lbl { font-size: max(14px, calc(13px * var(--u, 1))); }

}

/* Reduced motion: the finished picture, without animation. */
@media (prefers-reduced-motion: reduce) {
  .sky * { animation: none !important; }
  .dust path { opacity: 1; transform: none; }
  .card, .ring { transition: none; }
}
