:root {
  color-scheme: light;
  background: #f6f5ef;
  color: #566e49;
  font-family: Arial, Helvetica, sans-serif;
  --ease-settle: cubic-bezier(.22, 1, .36, 1);
  --ease-flow: cubic-bezier(.4, 0, .2, 1);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; overflow-x: clip; }
html, body { overscroll-behavior-y: none; }
html { --pull-offset: 0px; --pull-progress: 0; --pull-opacity: 0; --pull-duration: 360ms; }
html[data-pull-state='pulling'], html[data-pull-state='ready'] { --pull-duration: 0ms; user-select: none; -webkit-user-select: none; }
.pull-refresh { position: fixed; z-index: 6; top: max(12px, env(safe-area-inset-top)); left: 50%; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; visibility: hidden; opacity: var(--pull-opacity); transform: translate(-50%, calc(var(--pull-offset) - 60px)); transition: transform var(--pull-duration) var(--ease-settle), opacity 180ms var(--ease-flow); }
html[data-pull-state] .pull-refresh { visibility: visible; }
.refresh-symbol { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid #aebba5; border-radius: 50%; color: #566e49; background: #f6f5ef; transition: background-color 220ms var(--ease-flow), color 220ms var(--ease-flow), border-color 220ms var(--ease-flow); }
.refresh-symbol svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; transform: rotate(calc(var(--pull-progress) * 180deg)); }
html[data-pull-state='ready'] .refresh-symbol, html[data-pull-state='refreshing'] .refresh-symbol { background: #566e49; border-color: #566e49; color: #f6f5ef; }
#pull-refresh-label { font-size: 10px; line-height: 1.4; letter-spacing: .03em; white-space: nowrap; }
@keyframes refresh-turn { from { transform: rotate(180deg); } to { transform: rotate(540deg); } }
html[data-pull-state='refreshing'] .refresh-symbol svg { animation: refresh-turn 900ms linear infinite; }
.gate-indicators { position: absolute; top: -16px; left: 50%; z-index: 3; transform: translateX(-50%); display: flex; align-items: center; gap: 9px; visibility: hidden; }
.gate-indicators[data-ready='true'] { visibility: visible; }
.gate-indicators span { width: 8px; height: 8px; border: 1px solid #566e49; border-radius: 50%; background: #f6f5ef; transition: background-color 320ms var(--ease-flow); }
.gate-indicators span[data-active='true'] { background: #566e49; }
/* Animate wrappers, leaving the existing screen and control transitions independent. */
@keyframes arrive { from { opacity: 0; translate: 0 8px; } to { opacity: 1; translate: 0 0; } }
@keyframes appear { from { opacity: 0; } to { opacity: 1; } }
.app-title { animation: arrive 900ms var(--ease-settle) 80ms both; }
.gate-indicators { animation: appear 800ms var(--ease-flow) 220ms both; }
.visual-stage { animation: arrive 1100ms var(--ease-settle) 160ms both; }
.playback, .session-timers { animation: arrive 900ms var(--ease-settle) 380ms both; }
.about-controls, .install-controls { animation: appear 900ms var(--ease-flow) 480ms both; }
.app-screen { position: relative; translate: 0 var(--pull-offset); transform: translate3d(0, 0, 0); opacity: 1; visibility: visible; transition: transform 640ms var(--ease-settle), opacity 380ms var(--ease-flow), visibility 0s, translate var(--pull-duration) var(--ease-settle); }
body[data-about-open='true'] { overflow: hidden; }
body[data-about-open='true'] .app-screen { transform: translate3d(100%, 0, 0); opacity: 0; visibility: hidden; transition-delay: 0s, 0s, 640ms; pointer-events: none; }
.corner-button { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; border: 1px solid #aebba5; border-radius: 50%; background: #f6f5ef; color: inherit; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; transition: background-color 280ms var(--ease-flow), border-color 280ms var(--ease-flow), scale 360ms var(--ease-settle); }
.corner-button svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.corner-button .question-dot { fill: currentColor; stroke: none; }
.corner-button:active { scale: .93; }
.corner-button:focus-visible { outline: 2px solid #657e58; outline-offset: 4px; }
/* Keep navigation outside the transformed screens so it stays fixed to the viewport. */
.about-controls { position: fixed; bottom: max(18px, env(safe-area-inset-bottom)); left: max(18px, env(safe-area-inset-left)); z-index: 4; display: grid; }
.install-controls { position: fixed; bottom: max(18px, env(safe-area-inset-bottom)); right: max(18px, env(safe-area-inset-right)); z-index: 4; }
.install-dialog { position: fixed; inset: auto max(18px, env(safe-area-inset-right)) calc(80px + env(safe-area-inset-bottom)) auto; width: min(352px, calc(100vw - 36px)); max-height: calc(100dvh - 112px - env(safe-area-inset-top) - env(safe-area-inset-bottom)); margin: 0; padding: 24px; overflow-y: auto; overscroll-behavior: contain; border: 1px solid #cbd2c3; border-radius: 24px; color: #566e49; background: #f6f5ef; box-shadow: 0 16px 60px #34462c14; opacity: 0; transform: translateY(12px) scale(.98); transition: opacity 220ms var(--ease-flow), transform 380ms var(--ease-settle); }
.install-dialog[data-visible='true'] { opacity: 1; transform: translateY(0) scale(1); }
.install-dialog::backdrop { background: #f6f5efb3; opacity: 0; transition: opacity 220ms var(--ease-flow); }
.install-dialog[data-visible='true']::backdrop { opacity: 1; }
.install-heading { display: flex; align-items: center; gap: 12px; justify-content: space-between; }
.install-heading h2 { margin: 0; font-size: 20px; font-weight: 400; letter-spacing: -.02em; }
.install-heading .corner-button { flex: none; width: 36px; height: 36px; }
.install-dialog p, .install-dialog ol { font-size: 13px; line-height: 1.7; }
.install-dialog ol { margin: 20px 0; padding-left: 20px; }
.install-dialog li + li { margin-top: 10px; }
.install-confirm { width: 100%; min-height: 44px; margin: 8px 0; padding: 10px 18px; border: 1px solid #566e49; border-radius: 24px; color: #f6f5ef; background: #566e49; font: inherit; font-size: 13px; cursor: pointer; transition: opacity 200ms var(--ease-flow), scale 250ms var(--ease-settle); }
.install-confirm:active { scale: .98; }
.install-confirm:disabled { opacity: .5; cursor: default; }
.install-dialog .offline-status { min-height: calc(5.1em + 17px); margin: 24px 0 0; padding-top: 16px; border-top: 1px solid #d8ddcf; font-size: 11px; color: #687c5e; }
.install-retry { padding: 10px 0; border: 0; background: transparent; color: inherit; font: inherit; font-size: 12px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.install-confirm:focus-visible, .install-retry:focus-visible { outline: 2px solid #657e58; outline-offset: 4px; }
@media (display-mode: standalone), (display-mode: fullscreen) { .install-controls { display: none; } }
.about-controls .corner-button { grid-area: 1 / 1; transition: opacity 240ms var(--ease-flow), transform 400ms var(--ease-settle), visibility 0s linear 240ms, background-color 280ms var(--ease-flow), border-color 280ms var(--ease-flow), scale 360ms var(--ease-settle); }
#about-toggle { opacity: 1; visibility: visible; transform: rotate(0deg) scale(1); transition-delay: 0s; }
#about-close { opacity: 0; visibility: hidden; pointer-events: none; transform: rotate(-45deg) scale(.8); }
body[data-about-open='true'] #about-toggle { opacity: 0; visibility: hidden; pointer-events: none; transform: rotate(30deg) scale(.8); transition-delay: 0s, 0s, 240ms, 0s, 0s, 0s; }
body[data-about-open='true'] #about-close { opacity: 1; visibility: visible; pointer-events: auto; transform: rotate(0deg) scale(1); transition-delay: 0s; }
.about-screen { position: fixed; inset: 0; z-index: 3; overflow-y: auto; overscroll-behavior: contain; background: #f6f5ef; translate: 0 var(--pull-offset); transform: translate3d(-100%, 0, 0); opacity: 0; visibility: hidden; pointer-events: none; transition: transform 640ms var(--ease-settle), opacity 380ms var(--ease-flow), visibility 0s linear 640ms, translate var(--pull-duration) var(--ease-settle); }
body[data-about-open='true'] .about-screen { transform: translate3d(0, 0, 0); opacity: 1; visibility: visible; pointer-events: auto; transition-delay: 0s; }
.about-content { width: min(540px, 100%); margin: 0 auto; padding: max(40px, env(safe-area-inset-top)) 24px calc(96px + env(safe-area-inset-bottom)); font-size: 14px; line-height: 1.75; }
.about-content h1 { margin: 0; font-size: clamp(28px, 4vw, 34px); line-height: 1.15; letter-spacing: -.025em; font-weight: 400; }
.about-content h1:focus { outline: none; }
.about-content h2 { margin: 0 0 10px; font-size: 16px; line-height: 1.4; font-weight: 400; }
.about-content p { margin: 0 0 14px; }
.about-content .about-intro { margin: 18px 0 36px; font-size: 16px; line-height: 1.6; }
.about-content section + section { margin-top: 32px; }
.about-content a { color: inherit; text-decoration-color: #aebba5; text-underline-offset: 3px; }
.about-content a:focus-visible { outline: 2px solid #657e58; outline-offset: 3px; }
.gate-frequency-table { width: 100%; margin: 20px 0; border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; }
.gate-frequency-table caption { text-align: left; font-size: 11px; color: #687c5e; padding-bottom: 8px; }
.gate-frequency-table th, .gate-frequency-table td { padding: 9px 4px; border-bottom: 1px solid #d8ddcf; text-align: right; font-weight: 400; }
.gate-frequency-table th:first-child, .gate-frequency-table td:first-child { text-align: left; padding-left: 0; }
.gate-frequency-table th:last-child, .gate-frequency-table td:last-child { padding-right: 0; }
.gate-frequency-table thead { color: #687c5e; }
.about-disclaimer { margin-top: 36px; padding-top: 24px; border-top: 1px solid #cbd2c3; color: #687c5e; font-size: 12px; }
.earth-player {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: clamp(8px, 2vh, 20px);
  padding: max(24px, env(safe-area-inset-top)) 16px max(80px, calc(64px + env(safe-area-inset-bottom)));
}
.app-title {
  flex: none;
  margin: 0;
  text-align: center;
  font-size: clamp(28px, 4vw, 34px);
  font-weight: 400;
  letter-spacing: -.025em;
  line-height: 1.15;
}
.visual-stage {
  --stage-height: clamp(250px, min(max(416px, calc((100vw - 32px) * 2 / 3)), calc(100svh - 312px)), 560px);
  position: relative;
  width: min(840px, 100%);
  height: var(--stage-height);
  overflow: hidden;
}
.earth-visual, .session-options {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  transition: transform 640ms var(--ease-settle), opacity 380ms var(--ease-flow), visibility 0s linear 640ms;
}
.earth-visual { transform: translate3d(0, 0, 0) scale(1); opacity: 1; visibility: visible; transition-delay: 0s; }
.session-options {
  display: block;
  width: min(388px, 100%);
  margin-inline: auto;
  padding-block: 16px 56px;
  transform: translate3d(105%, 0, 0) scale(.97);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #7c8f70 #e8eddf;
  scrollbar-gutter: stable both-edges;
  scroll-padding-block: 20px 56px;
}
.session-options::-webkit-scrollbar { width: 5px; }
.session-options::-webkit-scrollbar-track { background: #e8eddf; border-radius: 5px; }
.session-options::-webkit-scrollbar-thumb { background: #7c8f70; border-radius: 5px; }
body[data-settings-open='true'] .earth-visual { transform: translate3d(-90%, 0, 0) scale(.95); opacity: 0; visibility: hidden; transition-delay: 0s, 0s, 640ms; pointer-events: none; }
body[data-settings-open='true'] .session-options { transform: translate3d(0, 0, 0) scale(1); opacity: 1; visibility: visible; transition-delay: 0s; pointer-events: auto; }
.settings-content { width: min(340px, calc(100% - 32px)); margin: 0 auto; }
.settings-content > * { transform: translate3d(0, 7px, 0); opacity: 0; transition: transform 520ms var(--ease-settle), opacity 320ms var(--ease-flow); }
body[data-settings-open='true'] .settings-content > * { transform: translate3d(0, 0, 0); opacity: 1; transition-delay: 55ms; }
body[data-settings-open='true'] .settings-content > :nth-child(2) { transition-delay: 85ms; }
body[data-settings-open='true'] .settings-content > :nth-child(3) { transition-delay: 115ms; }
body[data-settings-open='true'] .settings-content > :nth-child(4) { transition-delay: 145ms; }
body[data-settings-open='true'] .settings-content > :nth-child(5) { transition-delay: 175ms; }
.settings-content #settings-title { margin: 0 0 32px; font-size: clamp(28px, 4vw, 34px); line-height: 1.15; font-weight: 400; text-align: center; letter-spacing: -.025em; }
.layer-toggles { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: clamp(5px, 1.5vw, 9px); margin-top: 12px; }
.layer-toggles button { display: grid; place-items: center; width: 100%; aspect-ratio: 1; padding: 0; border: 1px solid #aebba5; border-radius: 50%; background: transparent; color: inherit; font: inherit; font-size: 16px; font-variant-numeric: tabular-nums; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; transition: background-color 320ms var(--ease-flow), color 320ms var(--ease-flow), border-color 320ms var(--ease-flow), scale 360ms var(--ease-settle); }
.layer-toggles button[aria-pressed='true'] { background: #566e49; border-color: #566e49; color: #f6f5ef; }
.layer-toggles button:active { scale: .95; transition-duration: 100ms; }
.layer-toggles button:focus-visible { outline: 2px solid #657e58; outline-offset: 3px; }
.setting + .setting { margin-top: 36px; }
.setting-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0; font-size: 16px; font-weight: 400; line-height: 1.4; }
.setting-heading output { min-height: 19px; font-size: 16px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.range-control { --progress: 0; --position: 0%; position: relative; height: 36px; margin-top: 8px; }
.range-rail { position: absolute; top: 17px; left: 8.5px; right: 8.5px; height: 2px; border-radius: 2px; background: #cbd2c3; pointer-events: none; }
.range-fill { display: block; width: 100%; height: 100%; background: #6b805e; transform: scaleX(var(--progress)); transform-origin: left center; }
.range-position { position: absolute; inset: 0; transform: translateX(var(--position)); }
.range-fill, .range-position { transition: transform 160ms var(--ease-settle); }
.range-control[data-dragging='true'] .range-fill, .range-control[data-dragging='true'] .range-position { transition-duration: 45ms; transition-timing-function: linear; }
.range-thumb { position: absolute; left: 0; top: 50%; width: 17px; height: 17px; border: 1px solid #7c8f70; border-radius: 50%; background: #f6f5ef; transform: translate(-50%, -50%); box-shadow: 0 0 0 0 #657e5800; transition: box-shadow 240ms var(--ease-flow), background-color 240ms var(--ease-flow); }
.range-control[data-dragging='true'] .range-thumb { box-shadow: 0 0 0 5px #657e5814; background: #edf0e5; }
.setting input[type='range'] { position: absolute; inset: -4px 0; width: 100%; height: 44px; margin: 0; padding: 0; opacity: 0; appearance: none; -webkit-appearance: none; cursor: pointer; touch-action: pan-y; }
.setting input[type='range']::-webkit-slider-thumb { width: 17px; height: 17px; appearance: none; -webkit-appearance: none; }
.setting input[type='range']::-moz-range-thumb { width: 17px; height: 17px; border: 0; }
.range-control:has(input:focus-visible) .range-thumb { outline: 2px solid #657e58; outline-offset: 4px; }
.range-limits { display: flex; justify-content: space-between; font-size: 10px; color: #687c5e; }
.gong-preview { display: flex; align-items: center; gap: 6px; margin: 8px 0 0; padding: 8px 0; border: 0; background: transparent; font: inherit; font-size: 11px; color: inherit; cursor: pointer; transition: opacity 240ms var(--ease-flow), transform 260ms var(--ease-settle); }
.gong-preview:active { transform: translateX(2px); }
.gong-preview svg { width: 12px; height: 12px; fill: currentColor; }
.gong-preview:focus-visible { outline: 1px solid #657e58; outline-offset: 4px; }
.gong-preview:disabled { opacity: .5; }
.settings-note { display: grid; align-items: center; min-height: 3.2em; margin: 28px 0 0; font-size: 11px; line-height: 1.6; text-align: center; color: #687c5e; }
/* All notes share a grid cell, so the longest message reserves its space at every width. */
.settings-note > span { grid-area: 1 / 1; opacity: 0; transform: translateY(3px); transition: opacity 220ms var(--ease-flow), transform 300ms var(--ease-settle); pointer-events: none; }
.settings-note > span[aria-hidden='false'] { opacity: 1; transform: translateY(0); }
.session-timers { display: flex; flex-direction: column; align-items: center; gap: 4px; margin-top: -4px; font-variant-numeric: tabular-nums; letter-spacing: .06em; }
.session-countdown { height: 18px; margin: 0; font-size: 13px; line-height: 18px; }
.gong-countdown { height: 14px; margin: 0; font-size: 11px; line-height: 14px; color: #65755d; }
.session-countdown:empty, .gong-countdown:empty { visibility: hidden; }
.home-controls { grid-area: 1 / 1; display: flex; align-items: center; justify-content: center; gap: 16px; opacity: 1; transform: translate3d(0, 0, 0) scale(1); visibility: visible; transition: opacity 280ms var(--ease-flow), transform 440ms var(--ease-settle), visibility 0s; transition-delay: 100ms, 100ms, 0s; }
body[data-settings-open='true'] .home-controls { opacity: 0; transform: translate3d(0, -9px, 0) scale(.94); visibility: hidden; pointer-events: none; transition-delay: 0s, 0s, 280ms; }
.earth-visual {
  --indicator-space: 24px;
  padding-top: var(--indicator-space);
  width: 100%;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
}
/* Keep the indicators anchored to the artwork, including when it is letterboxed. */
.earth-scene {
  position: relative;
  isolation: isolate;
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  width: min(100%, calc((var(--stage-height) - var(--indicator-space)) * 1.5));
  aspect-ratio: 3 / 2;
  min-width: 0;
  min-height: 0;
}
.earth {
  grid-area: 1 / 1;
  display: block;
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}
.earth-poster { z-index: 0; }
.earth-video { z-index: 1; opacity: 0; pointer-events: none; }
.earth-visual[data-video-ready='true'] .earth-video { opacity: 1; }
.earth-visual[data-video-ready='true'] .earth-poster { visibility: hidden; }
/* The globe radius is one quarter of the artwork height. Leave that circle clear
   while fading the surrounding waves, using the same continuously playing video. */
.earth-wave-veil {
  /* Explicit stacking keeps WebKit's composited video below the cover even
     after the opacity transition ends or the app returns from the background. */
  position: relative;
  z-index: 2;
  grid-area: 1 / 1;
  width: 100%;
  height: 100%;
  pointer-events: none;
  background: radial-gradient(circle closest-side, transparent calc(50% - .5px), #f6f5ef calc(50% + .5px));
  opacity: 1;
  transition: opacity 1800ms var(--ease-flow);
}
body[data-tones-playing='true'] .earth-wave-veil { opacity: 0; }
.playback { display: grid; place-items: center; flex: none; height: 64px; min-width: 232px; }
.playback button {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 1px solid #aebba5;
  border-radius: 50%;
  color: inherit;
  background: transparent;
  cursor: pointer;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 280ms var(--ease-flow), border-color 280ms var(--ease-flow), opacity 280ms var(--ease-flow), scale 360ms var(--ease-settle);
}
.playback button:active:not(:disabled) { scale: .93; }
@media (hover: hover) {
  .corner-button:hover { background: #e8eddf; border-color: #657e58; }
  .playback button:hover:not(:disabled) { background: #e8eddf; border-color: #657e58; }
  .layer-toggles button:hover { border-color: #405336; }
}
.playback button:focus-visible { outline: 2px solid #657e58; outline-offset: 5px; }
.playback button:disabled { opacity: .3; cursor: default; }
.playback svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
#playback-toggle { width: 64px; height: 64px; }
#playback-toggle svg { width: 24px; height: 24px; }
#session-stop svg { fill: currentColor; stroke: none; }
#playback-toggle .play-icon, #playback-toggle .pause-icon { transform-origin: 50% 50%; transition: opacity 220ms var(--ease-flow), transform 360ms var(--ease-settle); }
#playback-toggle .play-icon { fill: currentColor; stroke: none; opacity: 1; transform: scale(1) rotate(0deg); }
#playback-toggle .pause-icon { opacity: 0; transform: scale(.65) rotate(-12deg); }
#playback-toggle[data-action='pause'] .play-icon { opacity: 0; transform: scale(.65) rotate(12deg); }
#playback-toggle[data-action='pause'] .pause-icon { opacity: 1; transform: scale(1) rotate(0deg); }
#settings-toggle svg { transition: transform 480ms var(--ease-settle); }
body[data-settings-open='true'] #settings-toggle svg { transform: rotate(60deg); }
#settings-close { grid-area: 1 / 1; opacity: 0; transform: translate3d(0, 9px, 0) rotate(-45deg) scale(.85); visibility: hidden; pointer-events: none; transition: opacity 240ms var(--ease-flow), transform 480ms var(--ease-settle), visibility 0s linear 280ms, scale 360ms var(--ease-settle), background-color 280ms var(--ease-flow), border-color 280ms var(--ease-flow); }
body[data-settings-open='true'] #settings-close { opacity: 1; transform: translate3d(0, 0, 0) rotate(0deg) scale(1); visibility: visible; pointer-events: auto; transition-delay: 100ms, 80ms, 0s, 0s, 0s, 0s; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; transition-delay: 0s !important; animation: none !important; }
  .playback button:active:not(:disabled), .layer-toggles button:active, .corner-button:active { scale: 1; }
}

/* A zero-width position marker cannot push the slider beyond its container. */
.range-position { right: auto; width: 0; left: var(--position); transform: none; transition-property: left; }
.amplitude-modes, .peak-gates { min-width: 0; padding: 0; border: 0; }
.amplitude-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 18px 0 14px; }
.amplitude-modes label, .peak-gates label { position: relative; display: grid; place-items: center; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.amplitude-modes input, .peak-gates input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.amplitude-modes span { display: grid; place-items: center; width: 100%; min-height: 44px; border: 1px solid #aebba5; border-radius: 24px; font-size: 16px; }
.amplitude-modes span, .peak-gates span { background: #f6f5ef; transition: background-color 320ms var(--ease-flow), color 320ms var(--ease-flow), border-color 320ms var(--ease-flow), scale 250ms var(--ease-settle); }
.amplitude-modes input:checked + span, .peak-gates input:checked + span { background: #566e49; color: #f6f5ef; border-color: #566e49; }
.amplitude-modes input:focus-visible + span, .peak-gates input:focus-visible + span { outline: 2px solid #657e58; outline-offset: 3px; }
.amplitude-modes label:active span, .peak-gates:not(:disabled) label:active span { scale: .94; }
.peak-gates { position: relative; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); margin: 0 -4px; opacity: 1; transition: opacity 300ms var(--ease-flow); }
.peak-gates::before { content: ''; position: absolute; left: calc(100% / 14); right: calc(100% / 14); top: 50%; height: 2px; background: #cbd2c3; }
.peak-gates label { min-height: 44px; }
.peak-gates span { z-index: 1; display: grid; place-items: center; width: 25px; height: 25px; border: 1px solid #7c8f70; border-radius: 50%; font-size: 11px; font-variant-numeric: tabular-nums; }
.peak-gates:disabled { opacity: .35; }
.peak-gates:disabled label { cursor: default; }
.peak-gates:disabled input:checked + span { background: #f6f5ef; color: inherit; border-color: #7c8f70; }
.amplitude-description { min-height: 3.2em; margin: 6px 0 0; color: #687c5e; font-size: 10px; line-height: 1.6; text-align: center; }
@media (prefers-reduced-motion: reduce) { .amplitude-modes label:active span, .peak-gates:not(:disabled) label:active span { scale: 1; } }

/* The listening area fills the space between the title and fixed bottom controls. */
:root { --screen-top: max(26px, env(safe-area-inset-top)); --controls-bottom: max(18px, env(safe-area-inset-bottom)); }
.earth-player { height: 100svh; min-height: 0; padding: var(--screen-top) 16px calc(138px + var(--controls-bottom)); justify-content: flex-start; gap: 18px; }
.visual-stage { --stage-height: calc(100svh - var(--screen-top) - var(--controls-bottom) - 196px); flex: 1; min-height: 0; height: var(--stage-height); width: min(960px, 100%); }
.earth-scene { max-width: 840px; }
.session-controls { position: fixed; bottom: var(--controls-bottom); left: 50%; z-index: 3; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 10px; transition: opacity 320ms var(--ease-flow), visibility 0s; }
body[data-about-open='true'] .session-controls { opacity: 0; visibility: hidden; pointer-events: none; transition-delay: 0s, 320ms; }
.session-controls .playback { height: 76px; min-width: 220px; }
.session-controls .playback button { width: 54px; height: 54px; }
.session-controls #playback-toggle { width: 76px; height: 76px; background: #e8eddf; border-color: #7c8f70; }
.session-controls #playback-toggle svg { width: 28px; height: 28px; }
.home-controls { gap: 14px; }
.about-controls, .install-controls { bottom: calc(var(--controls-bottom) + 22px); }
.about-controls { left: max(12px, env(safe-area-inset-left)); }
.install-controls { right: max(12px, env(safe-area-inset-right)); }
.about-controls .corner-button, .install-controls .corner-button { width: 32px; height: 32px; border-color: #cbd2c3; color: #687c5e; }
.about-controls .corner-button svg, .install-controls .corner-button svg { width: 16px; height: 16px; }
.amplitude-description { position: absolute; width: 1px; height: 1px; min-height: 0; overflow: hidden; clip-path: inset(50%); }
@media (max-height: 800px) {
  .earth-player { gap: 12px; padding-bottom: calc(120px + var(--controls-bottom)); }
  .visual-stage { --stage-height: calc(100svh - var(--screen-top) - var(--controls-bottom) - 172px); }
}
@media (max-height: 680px) {
  :root { --screen-top: max(18px, env(safe-area-inset-top)); --controls-bottom: max(12px, env(safe-area-inset-bottom)); }
  .earth-player { gap: 8px; padding-bottom: calc(104px + var(--controls-bottom)); }
  .visual-stage { --stage-height: calc(100svh - var(--screen-top) - var(--controls-bottom) - 152px); }
  .session-controls { gap: 4px; }
  .session-controls .playback, .session-controls #playback-toggle { height: 68px; }
  .session-controls #playback-toggle { width: 68px; }
  .about-controls, .install-controls { bottom: calc(var(--controls-bottom) + 18px); }
}
@media (max-height: 500px) and (min-width: 500px) {
  .earth-player { padding-bottom: calc(68px + var(--controls-bottom)); }
  .visual-stage { --stage-height: calc(100svh - var(--screen-top) - var(--controls-bottom) - 116px); }
  .session-controls .session-timers { position: absolute; right: calc(100% + 16px); bottom: 16px; width: 100px; }
}
@media (max-height: 360px) and (min-width: 500px) {
  :root { --screen-top: max(10px, env(safe-area-inset-top)); --controls-bottom: max(8px, env(safe-area-inset-bottom)); }
  .app-title { font-size: 24px; }
  .earth-player { gap: 6px; padding-bottom: calc(60px + var(--controls-bottom)); }
  .visual-stage { --stage-height: calc(100svh - var(--screen-top) - var(--controls-bottom) - 94px); }
  .session-controls .playback, .session-controls #playback-toggle { height: 56px; }
  .session-controls #playback-toggle { width: 56px; }
  .session-controls .playback button { width: 46px; height: 46px; }
  .about-controls, .install-controls { bottom: calc(var(--controls-bottom) + 12px); }
}
.temperament-options { margin: 18px 0 0; }

/* Detail screens scroll edge to edge; only their close button floats above them. */
.session-options, .about-screen {
  position: fixed;
  inset: 0;
  width: 100%;
  margin: 0;
  background: #f6f5ef;
  scrollbar-width: thin;
  scrollbar-color: #7c8f70 #e8eddf;
  scrollbar-gutter: auto;
  overflow-x: hidden;
  overflow-y: auto;
  scroll-padding-block: 24px 100px;
}
.session-options { z-index: 2; padding: max(40px, env(safe-area-inset-top)) 16px calc(110px + env(safe-area-inset-bottom)); translate: 0 var(--pull-offset); transition: transform 640ms var(--ease-settle), opacity 380ms var(--ease-flow), visibility 0s linear 640ms, translate var(--pull-duration) var(--ease-settle); }
.session-options::-webkit-scrollbar, .about-screen::-webkit-scrollbar { width: 5px; }
.session-options::-webkit-scrollbar-track, .about-screen::-webkit-scrollbar-track { background: #e8eddf; }
.session-options::-webkit-scrollbar-thumb, .about-screen::-webkit-scrollbar-thumb { background: #7c8f70; border-radius: 5px; }
body[data-settings-open='true'] .app-screen { transform: translate3d(-100%, 0, 0); opacity: 0; visibility: hidden; transition-delay: 0s, 0s, 640ms; pointer-events: none; }
body[data-settings-open='true'] .session-timers { display: none; }
body[data-settings-open='true'] .about-controls,
body[data-settings-open='true'] #about-toggle,
body[data-settings-open='true'] .install-controls,
body[data-about-open='true'] .install-controls { visibility: hidden; pointer-events: none; }
body[data-settings-open='true'] .session-controls { pointer-events: none; }
body[data-settings-open='true'] .session-controls .playback { height: 54px; grid-template-rows: minmax(0, 1fr); pointer-events: none; }
body[data-settings-open='true'] .session-controls #settings-close { width: 54px; height: 54px; pointer-events: auto; }
#settings-close, #about-close { background: #f6f5ef; }
#about-close { position: fixed; bottom: var(--controls-bottom); left: 50%; translate: -50% 0; z-index: 4; width: 54px; height: 54px; transition: opacity 240ms var(--ease-flow), transform 480ms var(--ease-settle), visibility 0s linear 280ms, background-color 280ms var(--ease-flow), border-color 280ms var(--ease-flow); }
#about-close svg { width: 21px; height: 21px; }
