:root {
  color-scheme: light dark;
  --accent: #1a7f37;
  --warn: #9a6a00;
  --bad: #b42323;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  font-family: -apple-system, system-ui, Roboto, sans-serif;
  margin: 0;
  padding: 1.2rem;
  line-height: 1.35;
  max-width: 34rem;
  margin-inline: auto;
}
header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}
header h1 { font-size: 1.5rem; margin: 0 0 0.25rem; }
.sub { opacity: 0.7; font-size: 0.85rem; margin-bottom: 1rem; }
.logo {
  width: 56px; height: 56px;
  border-radius: 0.6rem;
  flex-shrink: 0;
  overflow: hidden;
}
/* icon.svg keeps its mountain small for the maskable home screen icon. In the
   header, zoom it and clip the solid green edges so the mountain fills more of
   the box; the shift up re-centers the artwork, which sits below center. */
.logo img {
  display: block;
  width: 100%; height: 100%;
  transform: translateY(-11%) scale(1.4);
}

.status {
  padding: 0.9rem 1rem;
  border-radius: 0.6rem;
  font-weight: 600;
  font-size: 1rem;
  margin-bottom: 1.1rem;
  border: 2px solid #8888;
}
.status.good { background: #1a7f3722; border-color: var(--accent); }
.status.bad  { background: #b4232322; border-color: var(--bad); }
.status.wait { background: #9a6a0022; border-color: var(--warn); }

.card {
  border: 1px solid #8884;
  border-radius: 0.6rem;
  padding: 0.9rem 1rem;
  margin-bottom: 0.9rem;
}
.readout { text-align: center; }
.big {
  font-size: 3rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin: 0.1rem 0;
}
.biglabel {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.6;
}
.accuracy { margin-top: 0.4rem; font-size: 0.9rem; opacity: 0.7; font-variant-numeric: tabular-nums; }

/* Calibration */
button {
  font: inherit;
  padding: 0.6rem 0.9rem;
  border-radius: 0.6rem;
  border: 1px solid #8886;
  background: #8881;
  color: inherit;
  cursor: pointer;
}
button:active { background: #8883; }
button:disabled { opacity: 0.55; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.cal-head { display: flex; justify-content: space-between; align-items: baseline; }
.cal-state { font-size: 0.95rem; font-weight: 600; margin: 0.3rem 0 0.7rem; }
.cal-state.on { color: var(--accent); }
.cal-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.cal-manual { display: flex; gap: 0.5rem; margin-top: 0.6rem; }
.cal-manual input {
  flex: 1; min-width: 0;
  font: inherit; color: inherit;
  padding: 0.6rem 0.7rem;
  border-radius: 0.6rem;
  border: 1px solid #8886;
  background: transparent;
}
.cal-msg { font-size: 0.85rem; opacity: 0.75; margin-top: 0.5rem; min-height: 1em; }
.link-btn {
  border: none; background: none; padding: 0.2rem 0.3rem;
  color: inherit; opacity: 0.7;
  text-decoration: underline; cursor: pointer;
}

/* Elevation log */
.log-state { font-size: 0.85rem; font-weight: 600; opacity: 0.6; }
.log-state.on { color: var(--bad); opacity: 1; }
.log-state.on::before {
  content: '';
  display: inline-block;
  width: 0.55em; height: 0.55em;
  margin-right: 0.35em;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.25; } }
.log-detail { font-size: 0.9rem; opacity: 0.75; margin: 0.3rem 0 0.7rem; font-variant-numeric: tabular-nums; }
button.stop { background: var(--bad); border-color: var(--bad); color: #fff; }

/* Pocket mode. Pure black in both color schemes: on an OLED screen black
   pixels are switched off, so the lit screen costs almost nothing. */
.pocket {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: #000;
  color: #4a4a4a;
  display: flex;
  align-items: center;
  justify-content: center;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.pocket-info {
  text-align: center;
  font-size: 1.1rem;
  font-variant-numeric: tabular-nums;
  white-space: pre-line;
  transition: transform 0.4s ease;
}
/* While the unlock circle is up, park the reading near the top so the two
   never overlap. !important beats the inline drift transform from app.js. */
.pocket.hinting .pocket-info {
  transform: translateY(calc(-50vh + 4rem + env(safe-area-inset-top))) !important;
}
.pocket-unlock {
  position: absolute;
  /* Ring center sits low on the screen, near where a thumb rests (and
     roughly where the S25 Ultra's fingerprint reader is). 80px = ring radius. */
  top: calc(78% - 80px);
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
  font-size: 0.9rem;
  white-space: nowrap;
}
/* The unlock circle is a progress ring that sweeps around the edge, so it
   stays visible around a thumb pressing the middle. app.js sets --progress
   (0 to 100) each frame while the ring is held. */
.pocket-ring {
  --progress: 0;
  position: relative;
  width: 160px; height: 160px;
  margin: 0 auto 0.9rem;
  border-radius: 50%;
  background: conic-gradient(var(--accent) calc(var(--progress) * 1%), #333 0);
}
.pocket-ring::after {
  content: '';
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  background: #000;
}

.band {
  margin-top: 0.7rem;
  padding: 0.5rem 0.8rem;
  border-radius: 0.6rem;
  font-size: 0.9rem;
  font-weight: 600;
  border: 1px solid #8888;
}
.band.caution { background: #9a6a0022; border-color: var(--warn); }
.band.high    { background: #b4560022; border-color: #b45600; }
.band.extreme { background: #b4232322; border-color: var(--bad); }

table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
td { padding: 0.35rem 0; border-bottom: 1px solid #8882; font-size: 0.95rem; }
td:first-child { opacity: 0.65; }
td:last-child { text-align: right; font-weight: 600; }
tr:last-child td { border-bottom: none; }

footer {
  margin-top: 1rem;
  font-size: 0.8rem;
  opacity: 0.6;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.badge {
  background: var(--warn);
  color: #fff;
  border-radius: 0.4rem;
  padding: 0.1rem 0.45rem;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.9;
}
