/* Look Up and Down: the camera (or a dark backdrop), the sky drawn over it, the inside of the globe
   below the horizon, names, a small reticle, a heads-up bar on top and one card at the bottom. */
:root {
	--cyan: #4cf2ff;
	--amber: #ffb547;
	--ink: #e9f6ff;
	--muted: #8fb3c4;
	--glass: rgba(4, 10, 16, 0.78);
	--line: rgba(76, 242, 255, 0.28);
	--mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, "Roboto Mono", monospace;
	--sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
/* The hidden attribute always wins, whatever display a class sets (the card's Try again is a .plain block). */
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: radial-gradient(ellipse at 50% 45%, #0d2036, #03070d 72%) fixed; color: var(--ink); font-family: var(--sans); overflow: hidden; overscroll-behavior: none; }
button, select, input { font: inherit; color: inherit; }
a { color: var(--cyan); }

#stage { position: fixed; inset: 0; }
#cam { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.4s; }
#cam.on { opacity: 1; }
#view { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
#labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.pl {
	position: absolute; left: 0; top: 0; white-space: nowrap; font-size: 13px; font-weight: 600; color: #fff;
	text-shadow: 0 0 3px #000, 0 0 6px rgba(0, 0, 0, 0.9), 0 1px 2px #000; will-change: transform, opacity;
}
.pl.big { font-size: 15px; letter-spacing: 0.02em; }
.pl.sea { font-weight: 500; font-style: italic; color: #a9dcff; letter-spacing: 0.08em; text-transform: uppercase; font-size: 11px; }
/* The opposite-side marker: tte.js puts the element's top-left 7 px left of and 8 px above the
   point, so the 14 px ring (in a 16 px line) is centred exactly on it; the words start past the
   reticle's edge. */
.pl.opp { color: var(--amber); font-size: 12px; line-height: 16px; padding-left: 30px; }
.pl.opp::before { content: ""; position: absolute; left: 0; top: 1px; width: 14px; height: 14px; border: 2px solid var(--amber); border-radius: 50%; }
/* The sky's names, as on orrery.live's night sky (sky.css); skyview.js measures them with these fonts. */
.b-label, .s-label, .c-label, .k-label {
	position: absolute; left: 0; top: 0; white-space: nowrap; will-change: transform;
	text-shadow: 0 0 4px rgba(0, 0, 0, 0.95), 0 1px 3px rgba(0, 0, 0, 0.9);
}
.b-label { font: 650 12.5px/1 var(--sans); letter-spacing: .02em; }
.b-label.below { opacity: .5; }
.s-label { font: 500 10.5px/1 var(--sans); color: #a9bce6; opacity: .8; letter-spacing: .03em; }
.s-label.d { font-size: 9.5px; opacity: .6; color: #9db0da; letter-spacing: .02em; }
.c-label { font: 600 9.5px/1 var(--sans); color: rgba(150, 178, 235, 0.55); letter-spacing: .16em; text-transform: uppercase; }
.k-label { font: 700 14px/1 var(--sans); color: #d2ddf7; letter-spacing: .04em; }
.k-label.minor { font-size: 11px; font-weight: 600; color: rgba(210, 221, 247, 0.6); }
.k-label.n { color: #ff9c86; }
#reticle {
	position: absolute; left: 50%; top: 50%; width: 34px; height: 34px; margin: -17px 0 0 -17px; border-radius: 50%;
	border: 2px solid rgba(76, 242, 255, 0.85); box-shadow: 0 0 10px rgba(76, 242, 255, 0.6); pointer-events: none;
}
#reticle::after { content: ""; position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px 0 0 -2px; border-radius: 50%; background: var(--cyan); }
/* Find: an amber ring on the target when it's in view, else an arrow at the edge showing the way. */
#targetMark {
	position: absolute; left: -22px; top: -22px; width: 44px; height: 44px; border-radius: 50%; pointer-events: none;
	border: 2px dashed var(--amber); box-shadow: 0 0 12px rgba(255, 181, 71, 0.45); will-change: transform;
}
#targetArrow {
	position: absolute; left: 0; top: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; pointer-events: none;
	margin: -11px 0 0 -45px; width: 90px; will-change: transform; /* the arrowhead's middle on the anchor point */
}
#targetArrowHead { display: block; font-size: 22px; line-height: 22px; color: var(--amber); text-shadow: 0 0 8px rgba(0, 0, 0, 0.9); }
#targetArrowName { max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; font-weight: 600; color: #ffe3b5; text-shadow: 0 0 3px #000, 0 1px 2px #000; }

/* ---- Top bar ---- */
#hudTop {
	position: fixed; left: 0; right: 0; top: 0; z-index: 5;
	padding: calc(env(safe-area-inset-top) + 8px) 12px 6px;
	display: grid; grid-template-columns: 1fr auto; gap: 6px 8px; align-items: center;
	background: linear-gradient(rgba(3, 7, 11, 0.8), rgba(3, 7, 11, 0));
	pointer-events: none;
}
#hudTop button { pointer-events: auto; }
#hudTop .right { display: flex; gap: 6px; }
.aimRow { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; }
#aimText { margin: 0; min-width: 0; font-family: var(--mono); font-size: 13px; color: var(--cyan); text-shadow: 0 0 6px rgba(76, 242, 255, 0.6); }
#calib { grid-column: 1 / -1; margin: 0; padding: 6px 10px; border-radius: 8px; background: rgba(255, 181, 71, 0.16); border: 1px solid rgba(255, 181, 71, 0.5); color: #ffd9a0; font-size: 13px; }
.chip, .icon {
	border: 1px solid var(--line); background: var(--glass); border-radius: 999px; padding: 6px 12px; cursor: pointer;
	backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); font-size: 14px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.chip .lbl { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; }
.icon { min-width: 40px; padding: 6px 10px; font-family: var(--mono); font-size: 13px; }
.icon[aria-pressed="true"] { border-color: var(--amber); color: var(--amber); box-shadow: 0 0 10px rgba(255, 181, 71, 0.35); }
#placeBtn { justify-self: start; }
#modeBtn { flex: none; font-size: 13px; padding: 4px 12px; }
#targetChip { grid-column: 1 / -1; justify-self: start; border-color: rgba(255, 181, 71, 0.6); color: #ffe3b5; font-size: 13px; padding: 4px 12px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---- The card ---- */
#card {
	position: fixed; z-index: 5; left: 12px; right: 12px; bottom: calc(env(safe-area-inset-bottom) + 12px);
	margin: 0 auto; max-width: 460px; padding: 12px 16px; border-radius: 16px;
	background: var(--glass); border: 1px solid var(--line); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
	box-shadow: 0 8px 30px rgba(0, 0, 0, 0.45);
}
#card p { margin: 0; }
#card .kicker { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; }
#card .name { margin-top: 2px; font-size: 24px; font-weight: 700; color: var(--amber); line-height: 1.15; }
#card .detail { margin-top: 4px; font-family: var(--mono); font-size: 13px; color: var(--ink); line-height: 1.4; }
#card.sky .name { font-size: 22px; }
#card .retry { width: auto; margin-top: 10px; padding: 8px 16px; border-color: var(--amber); color: #ffe3b5; }

/* ---- Toast ---- */
#toast {
	position: fixed; z-index: 6; left: 50%; transform: translate(-50%, -8px); top: calc(env(safe-area-inset-top) + 92px);
	max-width: min(92vw, 520px); margin: 0; padding: 8px 14px; border-radius: 12px;
	background: rgba(4, 10, 16, 0.92); border: 1px solid var(--amber); color: #ffe3b5; font-size: 14px; text-align: center;
	opacity: 0; transition: opacity 0.3s, transform 0.3s; pointer-events: none;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---- Sheets ---- */
/* Native modal dialogs: the browser centres them, traps focus and makes the rest inert. */
dialog.sheet { padding: 0; border: 0; margin: auto; background: transparent; color: var(--ink); width: min(100% - 32px, 520px); max-width: none; max-height: calc(100dvh - 32px); overflow: visible; }
dialog.sheet::backdrop { background: rgba(2, 5, 8, 0.72); }
.sheet .inner {
	position: relative; width: 100%; max-height: calc(100dvh - 32px); overflow: auto; padding: 22px 20px;
	background: #08121a; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 0 40px rgba(76, 242, 255, 0.15);
}
.sheet h1 { margin: 0 0 8px; font-size: 28px; letter-spacing: 0.04em; text-transform: uppercase; color: var(--cyan); text-shadow: 0 0 12px rgba(76, 242, 255, 0.5); }
.sheet h2 { margin: 0 0 12px; font-size: 20px; color: var(--cyan); }
.sheet h3 { margin: 16px 0 4px; font-size: 16px; }
.sheet h4 { margin: 12px 0 2px; font-size: 15px; color: var(--cyan); }
.faq p { margin-top: 0; }
.sheet p { line-height: 1.5; }
.sheet .lead { font-size: 17px; }
.sheet .hint { color: #ffd9a0; font-size: 14px; }
.sheet .small, .sheet .note { color: var(--muted); font-size: 13px; }
.sheet .close { position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line); background: transparent; cursor: pointer; }
.sheet label { display: block; margin: 16px 0 6px; color: var(--muted); font-size: 13px; }
.sheet input[type="search"] { width: 100%; min-width: 0; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: #0c1a24; font-size: 16px; }
.sheet input[type="search"]:focus { outline: 2px solid var(--cyan); outline-offset: 1px; }
.srow { display: flex; gap: 8px; }
.sbtn { flex: none; padding: 0 16px; border-radius: 10px; border: 1px solid var(--cyan); background: #12424b; cursor: pointer; font-weight: 600; }
.results { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.res { display: block; width: 100%; text-align: left; padding: 9px 12px; border-radius: 10px; border: 1px solid var(--line); background: #0c1a24; cursor: pointer; }
.res:hover, .res:focus-visible { border-color: var(--cyan); }
.res .rn { display: block; font-weight: 650; }
.res .rw { display: block; margin-top: 2px; color: var(--muted); font-size: 13px; }
.go { display: block; width: 100%; margin: 14px 0 8px; padding: 14px; border-radius: 12px; cursor: pointer; font-weight: 700; font-size: 17px; letter-spacing: 0.04em;
	border: 1px solid var(--cyan); background: linear-gradient(#1b6d7a, #0d3c45); box-shadow: 0 0 16px rgba(76, 242, 255, 0.35); }
.plain { display: block; width: 100%; padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: transparent; cursor: pointer; }

@media (prefers-reduced-motion: reduce) {
	#toast, #cam { transition: none; }
}
