/* Hear the Food — spring meadow, glossy Frutiger Aero, comic sans. */

:root {
  --sky-top: #9edcf5;
  --sky-mid: #cdeefb;
  --sky-low: #f2fbef;
  --ink: #35402c;
  --ink-dim: #5c6b4e;
  --ink-faint: #8b977f;
  --grass: #6db83a;
  --grass-dark: #4f9427;
  --accent: #ff8f2e;
  --accent-dark: #e2701a;
  --flower: #ff7bac;
  --card: rgba(255, 255, 255, 0.92);
  --line: rgba(88, 120, 60, 0.25);
  --comic: "Comic Sans MS", "Comic Neue", "Chalkboard SE", "Segoe Print", cursive;
  --frutiger: "Frutiger", "Segoe UI", "Trebuchet MS", Verdana, sans-serif;
}

* { box-sizing: border-box; }

html {
  color-scheme: light;
  -webkit-tap-highlight-color: transparent;
}

/* no double-tap zoom delay on buttons */
body { touch-action: manipulation; }

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--frutiger);
  font-size: 16px;
  line-height: 1.5;
  text-transform: lowercase;
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-mid) 46%, var(--sky-low) 100%) fixed;
  -webkit-font-smoothing: antialiased;
}

body > *:not(.scene):not(.bubbles) { position: relative; z-index: 1; }

/* soap bubbles float above everything (very much the vibe) and are the
   only part of the scenery that takes presses */
.bubbles {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}

.mono, .ticker, .vol, th, td { font-family: var(--frutiger); }
button, h1, h2, .tgl-label, .chip, .toggle { font-family: var(--comic); }

/* ---------- background scene ---------- */

.scene {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
  contain: layout paint style;
}

/* background tabs: freeze every scene animation */
.tab-hidden .bubble,
.tab-hidden .petal,
.tab-hidden .cloud {
  animation-play-state: paused;
}

.sun {
  position: absolute;
  top: 4vh;
  right: 6vw;
  width: 130px;
  height: 130px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff6c9 0%, #ffe07a 38%, #ffd34d 62%, #f7b733 100%);
  box-shadow: 0 0 60px 24px rgba(255, 220, 120, 0.55);
}

.cloud { position: absolute; width: 190px; opacity: 0.9; }
.cloud-a { top: 9vh; left: 8vw; animation: drift 70s linear infinite; }
.cloud-b { top: 22vh; left: 46vw; width: 140px; animation: drift 95s linear infinite; animation-delay: -30s; }
.cloud-c { top: 6vh; left: 66vw; width: 110px; opacity: 0.7; animation: drift 120s linear infinite; animation-delay: -70s; }

@keyframes drift {
  from { transform: translateX(-30vw); }
  to { transform: translateX(120vw); }
}

.bubble {
  position: absolute;
  bottom: -60px;
  left: var(--x);
  pointer-events: auto;
  cursor: pointer;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background:
    radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.28) 18%, transparent 34%),
    radial-gradient(circle at 70% 80%, rgba(160, 225, 255, 0.35) 0%, transparent 55%),
    radial-gradient(circle at 50% 50%, rgba(210, 240, 255, 0.10) 0%, rgba(140, 215, 250, 0.30) 78%, rgba(120, 200, 240, 0.5) 100%);
  border: 1px solid rgba(255, 255, 255, 0.75);
  box-shadow: inset -3px -4px 8px rgba(120, 195, 235, 0.35);
  animation: rise var(--d) linear infinite;
  animation-delay: var(--delay);
}

.bubble.pop {
  animation: pop 240ms ease-out forwards;
  pointer-events: none;
}

@keyframes pop {
  55% { transform: scale(1.5) translateY(6px); opacity: 0.85; }
  100% { transform: scale(2.2) translateY(10px); opacity: 0; }
}

@keyframes rise {
  0% { transform: translate(0, 0) scale(0.85); opacity: 0; }
  8% { opacity: 0.9; }
  50% { transform: translate(var(--sway), -55vh) scale(1); }
  92% { opacity: 0.85; }
  100% { transform: translate(calc(var(--sway) * -0.6), -112vh) scale(1.05); opacity: 0; }
}

.petal {
  position: absolute;
  top: -40px;
  left: var(--x);
  width: var(--size);
  height: var(--size);
}
.petal svg { width: 100%; height: 100%; fill: var(--flower); opacity: 0.75; }
.petal:nth-child(3n) svg { fill: #ffd34d; }
.petal:nth-child(4n) svg { fill: #b7e3ff; }

@keyframes fall {
  0% { transform: translate(0, -5vh) rotate(0deg); opacity: 0; }
  10% { opacity: 0.9; }
  50% { transform: translate(var(--sway), 50vh) rotate(var(--spin)); }
  100% { transform: translate(calc(var(--sway) * -0.5), 108vh) rotate(calc(var(--spin) * 1.8)); opacity: 0.2; }
}

.petal { animation: fall var(--d) ease-in-out infinite; animation-delay: var(--delay); }

.grass {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 70px;
}

/* ---------- header ---------- */

.top {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 32px;
  align-items: flex-end;
  justify-content: space-between;
  padding: clamp(18px, 3.5vw, 34px) clamp(16px, 4vw, 48px) 14px;
}

.brand h1 {
  margin: 0;
  font-size: clamp(30px, 5vw, 46px);
  font-weight: 700;
  color: #3f5329;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.8), 0 4px 10px rgba(90, 140, 60, 0.25);
  letter-spacing: 0.5px;
}

.brand .sub {
  margin: 2px 0 0;
  color: var(--ink-dim);
  font-size: 16px;
  font-family: var(--comic);
}

.status { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }

.ticker {
  margin: 0;
  font-size: 14px;
  color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
  background: var(--card);
  padding: 6px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  box-shadow: 0 2px 6px rgba(70, 110, 50, 0.12), inset 0 1px 0 #fff;
}

.ticker output { color: #3f5329; font-weight: 700; font-size: 16px; margin-right: 2px; }

.vol {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--ink-dim);
  font-family: var(--comic);
}

.vol input { accent-color: var(--grass); width: 130px; }

/* ---------- layout ---------- */

.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(320px, 1fr);
  gap: 22px;
  align-items: start;
  padding: 8px clamp(16px, 4vw, 48px) 24px;
  max-width: 1400px;
  margin: 0 auto;
}

.map-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.map-frame {
  background: linear-gradient(180deg, #bfe9fb 0%, #a5def6 40%, #8ed4f2 100%);
  border: 2px solid rgba(255, 255, 255, 0.85);
  border-radius: 26px;
  padding: 14px;
  box-shadow:
    inset 0 2px 6px rgba(255, 255, 255, 0.9),
    inset 0 -8px 18px rgba(60, 140, 190, 0.18),
    0 10px 30px rgba(60, 120, 80, 0.18);
}

#map { display: block; width: 100%; height: auto; }

#map path {
  fill: #9ed35a;
  stroke: #57913a;
  stroke-width: 0.7;
  cursor: pointer;
  transition: fill 140ms ease;
}

#map path:hover { fill: #b9e879; }

#map path[aria-pressed="true"] { fill: #ffc861; }

#map path.playing[aria-pressed="true"] { fill: var(--accent); }

#map path:focus-visible {
  outline: none;
  stroke: #3f5329;
  stroke-width: 1.6;
}

.region-bar { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }

.chip {
  background: linear-gradient(180deg, #ffffff 0%, #eaf7df 100%);
  border: 1.5px solid #a9cf8a;
  color: #4c6234;
  font-size: 14px;
  padding: 7px 15px 6px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(70, 110, 50, 0.15), inset 0 1px 0 #fff;
}

.chip:hover { background: linear-gradient(180deg, #ffffff 0%, #ddf3c8 100%); }

.chip[aria-pressed="true"] {
  background: linear-gradient(180deg, #ffd98f 0%, #ffb04d 100%);
  border-color: var(--accent-dark);
  color: #5c3a10;
  box-shadow: 0 2px 6px rgba(200, 120, 20, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.chip:focus-visible { outline: 2px solid var(--accent-dark); outline-offset: 2px; }


.stop-chip {
  background: linear-gradient(180deg, #ffffff 0%, #ffe3e3 100%);
  border-color: #e3a2a9;
  color: #8c2f39;
}

.stop-chip:hover:not(:disabled) { background: linear-gradient(180deg, #ffffff 0%, #ffd4d4 100%); }

.stop-chip:disabled {
  opacity: 0.45;
  cursor: default;
}

#scope {
  display: block;
  width: 100%;
  height: 64px;
  background: rgba(255, 255, 255, 0.75);
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 18px;
  box-shadow: inset 0 2px 8px rgba(70, 130, 90, 0.12);
}

/* ---------- panel ---------- */

.panel {
  padding: clamp(18px, 2.5vw, 30px);
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.97) 0%, rgba(244, 251, 238, 0.94) 100%);
  border: 2px solid rgba(255, 255, 255, 0.9);
  border-radius: 26px;
  box-shadow:
    inset 0 2px 4px rgba(255, 255, 255, 0.95),
    0 12px 32px rgba(60, 120, 80, 0.2);
}

.panel-head h2 {
  margin: 0;
  font-size: 27px;
  font-weight: 700;
  color: #3f5329;
  line-height: 1.2;
}

#region-sub {
  margin: 6px 0 0;
  color: var(--ink-dim);
  font-size: 13.5px;
  font-variant-numeric: tabular-nums;
}

.toggle-row { display: flex; flex-wrap: wrap; gap: 12px 22px; }

.tgl-label {
  display: block;
  font-size: 12.5px;
  color: var(--ink-faint);
  margin-bottom: 5px;
}

.toggle {
  display: flex;
  border: 1.5px solid #a9cf8a;
  border-radius: 999px;
  overflow: hidden;
  background: #fff;
  box-shadow: inset 0 1px 3px rgba(90, 130, 60, 0.12);
}

.toggle button {
  background: transparent;
  border: 0;
  color: var(--ink-dim);
  font-size: 14px;
  padding: 7px 15px 6px;
  cursor: pointer;
}

.toggle button.on {
  background: linear-gradient(180deg, #b7e86f 0%, #8fd14f 60%, #7cc63e 100%);
  color: #2c421a;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.5);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.toggle button:focus-visible { outline: 2px solid var(--grass-dark); outline-offset: -3px; }

.chord-rows {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.chord-rows li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 7px 10px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid rgba(169, 207, 138, 0.55);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.chord-rows li.root { border-color: #ffbe6b; background: rgba(255, 236, 200, 0.8); }
.chord-rows li.pulse { background: rgba(233, 244, 255, 0.8); }

.chord-rows .a-name { display: flex; align-items: center; gap: 9px; min-width: 0; }

.chord-rows .a-name .icon { flex: none; }

.chord-rows .a-txt { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }

.a-txt .tag {
  color: var(--ink-faint);
  font-size: 10.5px;
  letter-spacing: 0.04em;
}

.vol-bar {
  display: block;
  height: 5px;
  width: var(--w);
  max-width: 100%;
  min-width: 3px;
  margin-top: 4px;
  border-radius: 999px;
  background: linear-gradient(90deg, #8fd14f, #ffb04d);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

.chord-rows .a-rate { color: #3f5329; font-weight: 700; }

.tone-cell { display: flex; align-items: baseline; gap: 7px; color: var(--ink-dim); }
.tone-cell .tone-label { color: var(--accent-dark); font-weight: 700; }
.tone-cell.zero .cents { color: var(--ink-faint); }

.tune-note { margin: 0; color: var(--ink-dim); font-size: 13px; min-height: 2.6em; }

.play {
  margin-top: auto;
  min-width: 130px;
  background: linear-gradient(180deg, #b7e86f 0%, #8fd14f 55%, #79c23a 100%);
  border: 2px solid #6faf31;
  color: #24380f;
  font-size: 17px;
  padding: 12px 18px 11px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(90, 150, 40, 0.35), inset 0 2px 0 rgba(255, 255, 255, 0.65);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.45);
}

.play:hover { filter: brightness(1.05); }

.play.live {
  background: linear-gradient(180deg, #ffcf7a 0%, #ff9d2e 55%, #f5861d 100%);
  border-color: var(--accent-dark);
  color: #4d2c08;
}

.play:disabled { opacity: 0.45; cursor: default; }
.play:focus-visible { outline: 3px solid rgba(111, 175, 49, 0.6); outline-offset: 2px; }

/* ---------- rates table ---------- */

.rates {
  padding: 4px clamp(16px, 4vw, 48px) 8px;
  max-width: 1080px;
  margin: 0 auto;
  width: 100%;
}

#rates-table, #scale-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 6px;
  table-layout: fixed;
}

/* one column grid for both tables, so the sections line up */
#rates-table .c-count, #scale-table .c-count { width: 110px; }
#rates-table .c-rate, #scale-table .c-rate { width: 250px; }
#rates-table .c-play, #scale-table .c-play { width: 104px; }

#rates-table th, #scale-table th {
  text-align: left;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 4px 16px 2px 12px;
  vertical-align: bottom;
}

th.th-title {
  font-family: var(--comic);
  font-size: 22px;
  font-weight: 700;
  text-transform: none;
  letter-spacing: normal;
  color: #3f5329;
  line-height: 1;
  padding: 0 16px 4px 12px;
}

#rates-table td, #scale-table td {
  padding: 8px 16px 8px 12px;
  vertical-align: middle;
  font-size: 14px;
  color: var(--ink-dim);
  font-variant-numeric: tabular-nums;
  vertical-align: middle;
  background: rgba(255, 255, 255, 0.82);
  border-top: 1px solid rgba(169, 207, 138, 0.5);
  border-bottom: 1px solid rgba(169, 207, 138, 0.5);
}

#rates-table td:first-child, #scale-table td:first-child {
  border-left: 1px solid rgba(169, 207, 138, 0.5);
  border-radius: 16px 0 0 16px;
}

#rates-table td:last-child, #scale-table td:last-child,
#rates-table th:last-child, #scale-table th:last-child {
  border-right: 1px solid rgba(169, 207, 138, 0.5);
  width: 104px;
  white-space: nowrap;
}

#rates-table td:last-child, #scale-table td:last-child {
  border-radius: 0 16px 16px 0;
  text-align: right;
}

#rates-table td.a-name, #scale-table td.a-name { color: var(--ink); }
.a-name-inner { display: flex; align-items: center; gap: 10px; min-width: 0; }
.a-name-inner .icon { flex: none; }
.a-name-inner .a-txt { min-width: 0; }
#rates-table td.a-name .tag, #scale-table td.a-name .tag { margin-left: 6px; color: var(--ink-faint); font-size: 11px; }

.r-play {
  background: linear-gradient(180deg, #ffffff 0%, #e4f4d2 100%);
  border: 1.5px solid #a9cf8a;
  color: #4c6234;
  font-family: var(--comic);
  font-size: 13px;
  padding: 5px 0 4px;
  width: 76px; /* one box for "play" and "stop", whatever the fallback font */
  text-align: center;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 2px 4px rgba(70, 110, 50, 0.15), inset 0 1px 0 #fff;
}

.r-play:hover { background: linear-gradient(180deg, #ffffff 0%, #d3eec0 100%); }

.r-play.live {
  background: linear-gradient(180deg, #ffcf7a 0%, #ff9d2e 100%);
  border-color: var(--accent-dark);
  color: #4d2c08;
}

.r-play:disabled { opacity: 0.4; cursor: default; }

/* ---------- footer ---------- */

footer {
  margin: 18px auto 0;
  padding: 20px clamp(16px, 4vw, 48px) 46px;
  max-width: 1080px;
  color: var(--ink-dim);
  font-size: 12.5px;
}

footer a { color: #3c7a1e; }

.vibe {
  margin-top: 10px;
  background: linear-gradient(180deg, #ffd3e2 0%, #ff9ec4 100%);
  border: 1.5px solid #e37ba6;
  color: #7c2c50;
  font-family: var(--comic);
  font-size: 14px;
  padding: 7px 16px 6px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(190, 90, 130, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.7);
}

.vibe:hover { filter: brightness(1.05); }
.vibe:active { transform: scale(0.96); }
footer p { background: rgba(255,255,255,0.6); border-radius: 14px; padding: 8px 14px; }

.scale {
  padding: 10px clamp(16px, 4vw, 48px) 0;
  max-width: 1080px;
  margin: 0 auto;
  width: 100%;
}


/* below-the-fold sections skip rendering until scrolled near */
.rates,
.scale,
footer {
  content-visibility: auto;
  contain-intrinsic-size: auto 700px;
}

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .status { align-items: flex-start; }
}

/* phones: no crunched columns. Each animal becomes a rounded card:
   name + play on the first line, the numbers underneath. */
@media (max-width: 600px) {
  .rates, .scale { padding-left: 12px; padding-right: 12px; }

  #rates-table, #scale-table { border-spacing: 0; }
  #rates-table thead, #scale-table thead { display: block; }
  #rates-table thead tr, #scale-table thead tr { display: block; }
  #rates-table thead th:not(.th-title), #scale-table thead th:not(.th-title) { display: none; }
  th.th-title {
    display: block;
    font-size: 20px;
    padding: 4px 2px 6px;
  }

  #rates-table tbody tr, #scale-table tbody tr {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px 10px;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid rgba(169, 207, 138, 0.5);
    border-radius: 16px;
    padding: 10px 12px;
    margin-bottom: 8px;
    box-shadow: 0 2px 6px rgba(70, 110, 50, 0.12);
  }

  #rates-table tbody td, #scale-table tbody td {
    display: block;
    border: none;
    background: transparent;
    padding: 0;
    font-size: 12.5px;
  }

  #rates-table tbody td:first-child, #scale-table tbody td:first-child { order: 1; flex: 1 1 auto; min-width: 0; }

  #rates-table tbody td:nth-child(2), #scale-table tbody td:nth-child(2) {
    order: 3;
    flex-basis: 100%;
    color: var(--ink-faint);
    font-size: 12px;
  }
  #rates-table tbody td:nth-child(2)::after { content: " in 2024"; }

  #rates-table tbody td:nth-child(3), #scale-table tbody td:nth-child(3) { order: 4; flex-basis: 100%; }

  #scale-table tbody td:last-child, #rates-table tbody td:last-child {
    order: 2;
    flex: 0 0 auto;
    width: auto;
    white-space: normal;
  }

  .a-name-inner { gap: 8px; }
  #rates-table td.a-name .tag, #scale-table td.a-name .tag { font-size: 9.5px; margin-left: 4px; }

  .r-play { width: 60px; font-size: 12px; }
}

@media (pointer: coarse) {
  .chip,
  .toggle button,
  .r-play,
  .play {
    min-height: 44px;
    padding-top: 10px;
    padding-bottom: 9px;
  }

  #map path {
    stroke-width: 1.2;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bubble, .petal, .cloud { animation: none; }
  .bubble { display: none; }
  .petal { display: none; }
  #map path { transition: none; }
}
