:root { --ink: #000; --accent: #5FC8D0; --sand: #fbdab7; --line: rgba(60, 35, 10, .12); }
* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { height: 100%; overflow: hidden; }
body {
  position: fixed; inset: 0; background: var(--sand); color: var(--ink);
  font: 15px/1.3 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
#svg { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; user-select: none; -webkit-user-select: none; }

/* The menu: a frosted, sand-tinted panel floating over the bottom-left of the map. */
#ui {
  position: absolute; left: calc(10px + env(safe-area-inset-left)); bottom: calc(10px + env(safe-area-inset-bottom));
  width: max-content; max-width: min(300px, calc(100% - 20px));
  max-height: calc(100% - 20px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); overflow-y: auto;
  padding: 4px 14px 12px; border-radius: 18px;
  background: rgba(255, 244, 230, .74);
  -webkit-backdrop-filter: blur(12px) saturate(1.2); backdrop-filter: blur(12px) saturate(1.2);
  border: 1px solid var(--line); box-shadow: 0 8px 28px rgba(60, 35, 10, .18);
}
button { background: none; border: 0; font: inherit; color: inherit; text-align: left; cursor: pointer; }
a { color: inherit; }

.root { display: flex; align-items: center; width: 100%; min-height: 48px; font-size: 20px; font-weight: 800; letter-spacing: -.01em; }
#ui ul { list-style: none; }
#tree { margin-bottom: 6px; border-top: 1px solid var(--line); }
#tree > li { border-bottom: 1px solid var(--line); }
.t { display: flex; align-items: center; width: 100%; min-height: 44px; font-size: 16px; font-weight: 650; }
.t[aria-expanded="true"] { font-weight: 800; }
#go { text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: 3px; text-underline-offset: 4px; }
/* Sub menu: a sand inset; its own sub menu: a lighter inset inside that. */
#tree ul { margin: 0 0 8px; padding: 2px 10px; border-radius: 12px; background: rgba(251, 218, 183, .7); }
#tree ul ul { margin: 0 0 6px; padding: 0 10px; border-radius: 10px; background: rgba(255, 255, 255, .7); }
#tree ul > li + li { border-top: 1px solid var(--line); }
[aria-expanded]::after { content: "›"; margin-left: auto; padding-left: 14px; font-size: 20px; font-weight: 400; line-height: 1; transition: transform .15s; }
[aria-expanded="true"]::after { transform: rotate(90deg); }
#tree a { display: flex; align-items: center; min-height: 44px; font-size: 15px; font-weight: 600; text-decoration: none; }
#tree a::after { content: "↗"; margin-left: auto; padding-left: 14px; font-weight: 400; }
#tree li.tiny { padding: 6px 0; }
/* Sources: small, at the very bottom of the panel, below the river conditions. */
.src { display: flex; align-items: center; min-height: 24px; margin-top: 2px; font-size: 10px; font-weight: 700; }
.src::after { margin-left: 0; padding-left: 5px; font-size: 13px; }
.srcs li { font-size: 9px; line-height: 1.3; margin-top: 2px; }

.pos { display: block; font-size: 17px; font-weight: 800; padding: 6px 0 0; white-space: pre-line; }
.flow { display: block; margin-top: 4px; font-size: 13px; font-weight: 700; }
.flow b { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.tiny { font-size: 10px; line-height: 1.3; margin-top: 2px; font-weight: 500; }

#strip { display: none; }
.track { position: relative; height: 22px; margin: 8px 4px 2px; }
.track::before { content: ""; position: absolute; left: 0; right: 0; top: 10px; height: 2px; background: var(--ink); }
#ticks i { position: absolute; top: 6px; width: 2px; height: 10px; margin-left: -1px; background: var(--ink); }
#stripDot { position: absolute; top: 3px; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; background: var(--ink); box-shadow: 0 0 0 3px #fff; }
.ends { display: flex; justify-content: space-between; font-size: 10px; }

/* Watch-size screens: the art is too small to read, so text only. */
@media (max-width: 320px) {
  html, body { height: auto; overflow: auto; }
  body { position: static; background: #fff; }
  #svg { display: none; }
  #ui { position: static; width: auto; max-width: none; max-height: none; padding: 14px 12%; text-align: center; border: 0; border-radius: 0; box-shadow: none; background: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .root { justify-content: center; min-height: 32px; font-size: 13px; }
  #tree { text-align: left; }
  .pos { width: 100%; font-size: 14px; }
  #strip { display: block; }
  .flow { width: 100%; text-align: center; }
  .flow b { font-size: 30px; }
}

/* 3-second intro: the SRRC mark on white, then the map. Tap to skip. */
#splash { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; background: #fff; animation: srrc-out .5s ease-in 2.5s forwards; }
#splash svg { width: min(72vw, 340px); height: auto; animation: srrc-in .6s ease-out both; }
#splash .op { position: absolute; left: 0; right: 0; bottom: calc(18px + env(safe-area-inset-bottom)); text-align: center; color: #666; }
#splash.skip { animation: srrc-out .2s ease-in forwards; }
@keyframes srrc-in { from { opacity: 0; transform: scale(.94); } }
@keyframes srrc-out { to { opacity: 0; visibility: hidden; } }
@media (prefers-reduced-motion: reduce) { #splash svg { animation: none; } #splash { animation-duration: .01s; } }
