/* Layout: a full-screen sky that darkens with altitude; the only elements are the meters and settings bottom right, notes bottom left, the icon collection top right and a card (falling, paused, flight over) top center. */
:root {
  --bg: #ffffff;
  --ink: #141414;
  --ink-2: #555555;
  --muted: #9a9a9a;
  --line: #e6e6e6;
  --line-2: #cfcfcf;
  --soft: #f4f4f4;
  --btn-h: #2c2c2c;
  --accent: #ff4f2e;
  --f-ui: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-num: 'Geist Mono', ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  color-scheme: light;
}
/* high up in the dark sky the interface switches to light text */
.game.dark {
  --bg: #0f1117;
  --ink: #f1f1f1;
  --ink-2: #b4b8c0;
  --muted: #7c818b;
  --line: #2a2e37;
  --line-2: #464b56;
  --soft: #1b1e25;
  --btn-h: #d4d4d4;
  color-scheme: dark;
}
html, body { height: 100%; margin: 0; background: var(--bg); color: var(--ink); }
body { font-family: var(--f-ui); font-size: 14px; line-height: 1.45; overflow: hidden; }
[hidden] { display: none !important; }
.game { position: relative; height: 100%; overflow: hidden; background: var(--bg); color: var(--ink); touch-action: manipulation; user-select: none; -webkit-user-select: none; }
canvas { display: block; width: 100%; height: 100%; }
.alt, .w, .gear, .icons, .sheet, .card { transition: color .8s ease, background-color .8s ease, border-color .8s ease; }

.icons {
  position: absolute; top: 16px; right: max(16px, env(safe-area-inset-right, 0px));
  display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 12px; max-width: 60%;
  color: var(--ink); pointer-events: none;
}
.icons span { display: block; width: 20px; height: 20px; animation: arrive 1.2s ease both; }
.icons svg { width: 20px; height: 20px; display: block; }
@keyframes arrive { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }

.bar {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 20px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 16px; pointer-events: none;
}
.note {
  flex: 1 1 300px; min-width: 0; max-width: 36ch; margin: 0;
  color: var(--ink-2); font-size: 21px; line-height: 1.35;
  opacity: 0; transform: translateY(3px); transition: opacity 1s ease, transform 1s ease, color .8s ease;
}
.note.on { opacity: 1; transform: none; }
.nt { color: var(--ink); font-weight: 500; }
.meter { margin-left: auto; display: flex; align-items: center; gap: 16px; pointer-events: auto; }
.alt { font-family: var(--f-num); font-weight: 500; font-size: 28px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1; white-space: nowrap; }
.alt .unit { font-size: 15px; font-weight: 400; letter-spacing: 0; color: var(--ink-2); }
.w { font-family: var(--f-num); font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; line-height: 1; }
.gear {
  width: 34px; height: 34px; padding: 0; border-radius: 50%; border: 1px solid var(--line);
  background: var(--bg); color: var(--ink-2); display: grid; place-items: center; cursor: pointer;
}
.gear:hover, .gear[aria-expanded="true"] { color: var(--ink); border-color: var(--line-2); }
.gear svg { width: 17px; height: 17px; }

.sheet {
  position: absolute; right: max(16px, env(safe-area-inset-right, 0px)); bottom: 64px;
  width: min(320px, calc(100% - 32px)); max-height: calc(100% - 96px); overflow: auto;
  background: var(--bg); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 14px 44px rgba(0, 0, 0, .08); padding: 16px;
  display: flex; flex-direction: column; gap: 18px;
}
.sh-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.sh-title { font-weight: 600; font-size: 15px; }
.sh-sec { display: flex; flex-direction: column; gap: 8px; }
.sh-lbl { font-size: 12px; color: var(--muted); }
.sh-val { font-family: var(--f-num); font-size: 13px; font-variant-numeric: tabular-nums; }
.sh-hint { margin: 0; font-size: 12.5px; color: var(--ink-2); max-width: 48ch; }
.sh-hint a { color: var(--ink); text-underline-offset: 2px; }
.x { border: 0; background: transparent; color: var(--muted); cursor: pointer; padding: 2px; border-radius: 6px; line-height: 0; }
.x:hover { color: var(--ink); }
.x svg { width: 16px; height: 16px; }
.btn {
  border: 1px solid var(--ink); background: var(--ink); color: var(--bg); font: 500 13.5px var(--f-ui);
  padding: 9px 14px; border-radius: 9px; cursor: pointer; text-align: center;
}
.btn:hover { background: var(--btn-h); }
.btn.ghost { background: var(--bg); color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--line-2); }
.btns { display: flex; flex-wrap: wrap; gap: 8px; }
.seg { display: flex; gap: 3px; background: var(--soft); padding: 3px; border-radius: 9px; }
.seg button { flex: 1 1 0; border: 0; background: transparent; color: var(--ink-2); font: 500 13px var(--f-ui); padding: 7px 8px; border-radius: 7px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: var(--bg); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .08); }
.sh-row label { font-size: 13px; }
.sh-row output { font-family: var(--f-num); font-size: 13px; }
input[type=range] { width: 100%; margin: 0; accent-color: var(--ink); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.card {
  position: absolute; left: 16px; right: 16px; top: max(84px, 15%); margin-inline: auto; max-width: 340px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 14px;
  box-shadow: 0 14px 44px rgba(0, 0, 0, .1); padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
  animation: arrive .5s ease both;
}
.card .sh-hint { margin-top: -6px; }
.card .btns .btn { flex: 1 1 0; padding-block: 11px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; margin: 0; }
.stats dt { font-size: 12px; color: var(--muted); }
.stats dd { margin: 2px 0 0; font-family: var(--f-num); font-size: 16px; font-variant-numeric: tabular-nums; }
.field {
  width: 100%; box-sizing: border-box; min-width: 0; font: 14px var(--f-ui); color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; user-select: text; -webkit-user-select: text;
}
.field:focus { outline: none; border-color: var(--line-2); }
.name-form { display: flex; gap: 8px; margin: 0; }
.card .name-form .btn { flex: 0 0 auto; padding-block: 9px; }
.lb-list { list-style: none; margin: 0; padding: 0; }
.lb-list li {
  display: grid; grid-template-columns: 2.4ch minmax(0, 1fr) auto 5.5ch; gap: 10px; align-items: baseline;
  padding: 7px 0; border-top: 1px solid var(--line); font-size: 13.5px;
}
.lb-list li:first-child { border-top: 0; padding-top: 0; color: var(--muted); font-size: 12px; }
.lb-list .r, .lb-list .s { font-family: var(--f-num); font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.lb-list .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-list .a { font-family: var(--f-num); font-variant-numeric: tabular-nums; text-align: right; }
.lb-list .s { text-align: right; }
.lb-list li.me .n, .lb-list li.me .a { font-weight: 600; }
.lb-list li.me .r { color: var(--accent); }

@media (max-width: 460px) {
  .alt { font-size: 24px; }
  .note { font-size: 20px; }
}
