:root {
  --ink: #23314d;
  --panel: rgba(255, 255, 255, .94);
  --sun: #ffcf3f;
  --sky: #7cc8ff;
  --font: "Baloo 2", ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
}
* { box-sizing: border-box; }
/* The radar is fixed full screen; the page itself scrolls so the details sheet
   can slide up over it. pan-y lets a swipe on the radar scroll the page. */
html, body {
  margin: 0; overflow-x: hidden; overscroll-behavior-y: none;
  background: linear-gradient(#57b4ff, #a9dcff 70%, #d8f0ff);
  color: var(--ink); font: 600 17px/1.3 var(--font);
  -webkit-user-select: none; user-select: none; touch-action: pan-y;
}
#sky { position: fixed; inset: 0; width: 100%; height: 100%; }
#hud {
  position: fixed; top: calc(env(safe-area-inset-top) + 10px); left: 0; right: 0;
  display: flex; flex-direction: column; align-items: center; gap: 2px; pointer-events: none;
}
#looking {
  background: var(--panel); border-radius: 999px; padding: 4px 18px;
  font-size: 20px; font-weight: 800; box-shadow: 0 3px 10px rgba(0,0,0,.15);
}
#looking:empty { display: none; }
#status { font-size: 14px; color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.6); }
#range {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(env(safe-area-inset-bottom) + 106px);
  display: flex; background: var(--panel); border-radius: 999px; padding: 4px; box-shadow: 0 3px 10px rgba(0,0,0,.18);
}
#range button { box-shadow: none; background: transparent; padding: 6px 16px; font-size: 17px; }
#range button.on { background: var(--sun); }
#tools {
  position: fixed; left: 0; right: 0; bottom: calc(env(safe-area-inset-bottom) + 46px);
  display: flex; gap: 10px; justify-content: center;
}
button {
  background: var(--panel); color: var(--ink); border: 0; border-radius: 999px;
  padding: 10px 20px; font: 800 18px var(--font); box-shadow: 0 3px 10px rgba(0,0,0,.18);
}
button.big { background: var(--sun); font-size: 24px; padding: 14px 40px; }
button.ghost { background: transparent; box-shadow: none; color: #fff; font-size: 15px; text-decoration: underline; }
#card, #list {
  position: fixed; left: 12px; right: 12px; bottom: calc(env(safe-area-inset-bottom) + 162px);
  background: var(--panel); border-radius: 24px; padding: 18px;
  box-shadow: 0 6px 24px rgba(0,0,0,.25);
}
[hidden] { display: none !important; }
#cardClose { position: absolute; right: 10px; top: 10px; padding: 4px 12px; box-shadow: none; background: #eef3fb; }
#cardBody .emoji { font-size: 54px; line-height: 1; }
#cardBody h2 { margin: 2px 0 8px; font-size: 28px; font-weight: 800; line-height: 1.1; }
#cardBody .fact { font-size: 21px; margin: 4px 0; }
#cardBody .small { font-size: 14px; color: #6b7891; margin-top: 10px; }
#list { max-height: 55vh; overflow-y: auto; touch-action: pan-y; padding: 8px; }
#list .it { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 16px; }
#list .it:nth-child(odd) { background: #f1f6fd; }
#list .it .e { font-size: 30px; }
#list .it b { display: block; font-size: 19px; }
#list .it span { color: #6b7891; font-size: 15px; }
#start {
  position: fixed; inset: 0; display: flex; flex-direction: column; justify-content: center;
  align-items: center; text-align: center; padding: 24px; gap: 14px;
  background: linear-gradient(#57b4ff, #a9dcff 70%, #d8f0ff); color: #fff;
}
#start .hero { font-size: 96px; animation: fly 3s ease-in-out infinite; }
@keyframes fly { 50% { transform: translate(14px, -12px) rotate(-6deg); } }
#start h1 { margin: 0; font-size: 46px; font-weight: 800; text-shadow: 0 3px 0 rgba(35,49,77,.25); }
#start p { max-width: 340px; margin: 0 0 8px; font-size: 19px; text-shadow: 0 1px 2px rgba(0,0,0,.25); }
#tools button.on { background: var(--sun); }
#compassBtn { position: fixed; z-index: 2; left: 50%; transform: translateX(-50%); top: calc(env(safe-area-inset-top) + 70px); background: var(--sun); }
#card { z-index: 3; max-height: 70vh; overflow-y: auto; touch-action: pan-y; }
.nerdbtn { margin-top: 12px; width: 100%; background: #23314d; color: #fff; }
.nerd h3 { margin: 14px 0 4px; font-size: 15px; text-transform: uppercase; letter-spacing: .06em; color: #2f8cff; }
.nerd dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 0; font-size: 14px; }
.nerd dt { color: #6b7891; }
.nerd dd { margin: 0; font: 600 13px ui-monospace, SFMono-Regular, Menlo, monospace; text-align: right; }
.nerd .small { font-size: 12px; color: #6b7891; }
#status { max-width: 92vw; text-align: center; }
@media (orientation: landscape) and (max-height: 600px) {
  #range { left: auto; right: 12px; transform: none; bottom: calc(env(safe-area-inset-bottom) + 100px); }
  #tools { left: auto; right: 12px; flex-direction: row; }
  #card, #list { left: auto; right: 12px; width: min(420px, 55vw); bottom: 12px; top: 12px; max-height: none; }
}
.photo { display: block; margin: -4px -4px 10px; border-radius: 16px; overflow: hidden; position: relative; text-decoration: none; }
.photo img { display: block; width: 100%; aspect-ratio: 3 / 2; object-fit: cover; background: #dbe9f7; }
.photo span { position: absolute; left: 0; right: 0; bottom: 0; padding: 4px 10px; font-size: 11px; color: #fff; background: linear-gradient(transparent, rgba(0,0,0,.6)); }
#card, #list { -webkit-user-select: text; user-select: text; }
.logbook { margin-top: 12px; padding: 12px; border-radius: 16px; background: #fff7d6; }
.logbook h3 { margin: 0 0 4px; font-size: 18px; }
.logbook p { margin: 4px 0; font-size: 16px; }
.logbook ul { margin: 4px 0 0; padding-left: 18px; font-size: 15px; }
.kindpill { display: inline-block; color: #fff; border-radius: 999px; padding: 3px 12px; margin: 0 0 8px; font-size: 15px; }
.chooser { padding: 2px 2px 8px; }
.legend { display: flex; flex-wrap: wrap; gap: 8px; padding: 4px 2px; font-size: 16px; }
.legend b { opacity: .75; }
.chip { box-shadow: none; background: #fff; color: #8a96ab; border: 2px dashed #c5d3e6; padding: 5px 12px; font-size: 16px; text-decoration: line-through; }
.chip.on { background: var(--c); border: 2px solid var(--c); color: #fff; text-decoration: none; }
.chip i { background: var(--c); opacity: .5; }
.hint { padding: 4px 6px 0; font-size: 14px; color: #6b7891; }
.hint .link { box-shadow: none; background: none; padding: 0; font-size: 14px; color: #2f8cff; text-decoration: underline; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 50%; margin-right: 5px; vertical-align: -1px; }
.specs { margin-top: 12px; padding: 12px; border-radius: 16px; background: #eaf4ff; }
.specs h3 { margin: 0 0 4px; font-size: 18px; }
.specs .fun { margin: 4px 0 8px; font-size: 16px; }
.specs dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 0; font-size: 15px; }
.specs dt { color: #6b7891; }
.specs dd { margin: 0; }
.specs a { color: #2f8cff; }
.links { display: flex; flex-direction: column; gap: 6px; margin-top: 12px; }
.links a { display: block; padding: 9px 14px; border-radius: 14px; background: #eaf4ff; color: #2f8cff; text-decoration: none; font-size: 16px; }
#toast {
  position: fixed; z-index: 4; left: 12px; right: 12px; top: calc(env(safe-area-inset-top) + 64px);
  background: var(--sun); border-radius: 18px; padding: 10px 16px; font-size: 17px; text-align: center;
  box-shadow: 0 6px 18px rgba(0,0,0,.25); animation: pop .25s ease-out;
}
@keyframes pop { from { transform: translateY(-12px); opacity: 0; } }
#cardBody .tag { background: #fff6d1; border-left: 5px solid var(--sun); border-radius: 12px; padding: 8px 12px; margin: 6px 0; font-size: 16px; }
#cardBody .tag b { display: block; font-size: 19px; }
#list .it.hot { background: #fff6d1; }
#list a.it { color: inherit; text-decoration: none; }
#list .ptitle { margin: 2px 6px 8px; font-size: 22px; }
#list .small { font-size: 14px; color: #6b7891; margin: 8px 6px; }
#appShare { position: fixed; z-index: 2; top: calc(env(safe-area-inset-top) + 10px); right: 12px; padding: 6px 12px; font-size: 20px; }
.sharebtn { margin-top: 12px; width: 100%; background: var(--sun); }
/* Details sheet: starts just below the fold with its tab peeking up. */
#details {
  position: relative; z-index: 1; margin-top: calc(100svh - 34px); min-height: 60svh;
  background: #fbfdff; border-radius: 24px 24px 0 0; box-shadow: 0 -6px 24px rgba(0,0,0,.2);
  padding: 0 12px calc(env(safe-area-inset-bottom) + 24px); -webkit-user-select: text; user-select: text;
}
#details .grab { height: 34px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 15px; color: #6b7891; }
#details .grab::before { content: ""; width: 36px; height: 5px; border-radius: 3px; background: #c5d3e6; }
#details h2 { margin: 4px 4px 0; font-size: 24px; }
#details .small { margin: 2px 4px 10px; font-size: 14px; color: #6b7891; }
.drow { display: flex; gap: 10px; padding: 10px 6px; border-top: 1px solid #e3ebf5; align-items: flex-start; }
.drow.hot { background: #fff6d1; border-radius: 12px; }
.drow .e { font-size: 26px; width: 32px; text-align: center; }
.drow .dmain { flex: 1; min-width: 0; font-size: 15px; }
.drow .dmain b { font-size: 17px; }
.drow .reg { color: #6b7891; font-size: 14px; }
.drow .own { font-weight: 800; }
.drow .dside { text-align: right; font-size: 13px; color: #6b7891; white-space: nowrap; display: flex; flex-direction: column; }
.drow .dside b { font-size: 16px; color: var(--ink); }
#tools, #range, #appShare { transition: opacity .2s; }
body.scrolled #tools, body.scrolled #range, body.scrolled #appShare { opacity: 0; pointer-events: none; }
#card, #list { overscroll-behavior: contain; }
/* Desktop-sized window: a right-hand column holds the buttons and the card,
   and radarBox() in app.js keeps the radar left of it (see wideLayout()). */
@media (orientation: landscape) and (min-width: 900px) and (min-height: 601px) {
  #hud { right: 460px; }
  #range { left: auto; right: 230px; transform: translateX(50%); }
  #tools { left: auto; right: 12px; width: 436px; }
  #card, #list { left: auto; right: 12px; width: 436px; top: calc(env(safe-area-inset-top) + 64px); bottom: 162px; max-height: none; }
  #toast { left: auto; right: 12px; width: 436px; }
  #details { max-width: 900px; margin-left: auto; margin-right: auto; }
}
