/* Ambiance — palette from "Beyond the Buoys": the sea you know, the deep, the far deep. */
@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 300 700;
  font-display: swap;
  src: url(../fonts/fraunces.woff2) format('woff2');
}
@font-face {
  font-family: 'Fraunces';
  font-style: italic;
  font-weight: 300 700;
  font-display: swap;
  src: url(../fonts/fraunces-italic.woff2) format('woff2');
}
@font-face {
  font-family: 'Nunito';
  font-style: normal;
  font-weight: 400 800;
  font-display: swap;
  src: url(../fonts/nunito.woff2) format('woff2');
}

:root {
  --page: #1B6676;
  --far: #0F4A59;
  --deep: #155868;
  --sea: #2B8A99;
  --ink: #12303A;
  --shadow: #0E4250;
  --text: #FFF6E5;
  --soft: #CFE8EC;
  --cream: #FFF6E5;
  --coin: #FFC53D;
  --buoy: #E4572E;
  --swell: rgba(243, 255, 251, 0.1);
  --ring: rgba(243, 255, 251, 0.16);
  --line: rgba(243, 255, 251, 0.14);
  --card: var(--ink);
  --serif: 'Fraunces', 'Iowan Old Style', 'Palatino Linotype', Georgia, serif;
  --sans: 'Nunito', ui-rounded, 'SF Pro Rounded', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --page: #0A2430;
    --far: #061C25;
    --deep: #0B2F3B;
    --sea: #134A57;
    --ink: #0d2a35;
    --shadow: #041820;
    --soft: #A9CCD4;
    --swell: rgba(243, 255, 251, 0.06);
    --ring: rgba(243, 255, 251, 0.1);
    --line: rgba(243, 255, 251, 0.1);
  }
}
:root[data-theme='dark'] {
  --page: #0A2430;
  --far: #061C25;
  --deep: #0B2F3B;
  --sea: #134A57;
  --ink: #0d2a35;
  --shadow: #041820;
  --soft: #A9CCD4;
  --swell: rgba(243, 255, 251, 0.06);
  --ring: rgba(243, 255, 251, 0.1);
  --line: rgba(243, 255, 251, 0.1);
}

* {
  box-sizing: border-box;
}
html {
  -webkit-text-size-adjust: 100%;
  background: var(--page);
}
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--page);
  color: var(--text);
  font-family: var(--sans);
  font-weight: 500;
  font-size: 17px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}
button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}
[hidden] {
  display: none !important;
}
:focus-visible {
  outline: 3px solid var(--coin);
  outline-offset: 3px;
}

/* ---------- home ---------- */
.home {
  position: relative;
  min-height: 100dvh;
  overflow-x: hidden;
  /* the swell pattern from the sea chart */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='22'%3E%3Cg fill='none' stroke='%23F3FFFB' stroke-opacity='.10' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M4 14 q7 -5 14 0'/%3E%3Cpath d='M26 4 q7 -5 14 0'/%3E%3C/g%3E%3C/svg%3E");
}
.rings {
  position: absolute;
  inset: auto;
  top: calc(var(--safe-t) - 120px);
  right: -160px;
  width: 620px;
  height: 420px;
  pointer-events: none;
  opacity: 0.9;
}
.rings ellipse {
  fill: none;
  stroke: var(--ring);
  stroke-width: 1.4;
  transform-origin: 310px 210px;
  animation: ripple 9s ease-in-out infinite;
}
.rings ellipse:nth-child(2) { animation-delay: -1.5s; }
.rings ellipse:nth-child(3) { animation-delay: -3s; }
.rings ellipse:nth-child(4) { animation-delay: -4.5s; }
.rings ellipse:nth-child(5) { animation-delay: -6s; }
@keyframes ripple {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.04); opacity: 0.55; }
}
@media (prefers-reduced-motion: reduce) {
  .rings ellipse { animation: none; }
}

.wrap {
  position: relative;
  max-width: 1080px;
  margin: 0 auto;
  padding: calc(var(--safe-t) + 28px) calc(16px + var(--safe-r)) calc(var(--safe-b) + 110px) calc(16px + var(--safe-l));
  display: grid;
  gap: 26px;
}
.masthead {
  display: grid;
  gap: 8px;
  padding-top: 18px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--soft);
  font-weight: 800;
  font-size: 0.78rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.brand svg {
  width: 26px;
  height: 26px;
}
h1 {
  margin: 0;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 400;
  font-size: clamp(3.4rem, 16vw, 6rem);
  line-height: 0.95;
  letter-spacing: -0.02em;
}
.lede {
  margin: 4px 0 0;
  max-width: 34ch;
  color: var(--soft);
  font-size: 1.12rem;
}

.scenes {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
@media (min-width: 720px) {
  .scenes { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
}
.card {
  width: 100%;
  display: grid;
  gap: 10px;
  padding: 8px 8px 14px;
  border: 0;
  border-radius: 22px;
  background: var(--card);
  text-align: left;
  box-shadow: 0 10px 28px rgba(4, 22, 29, 0.32);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.card:active {
  transform: scale(0.98);
}
@media (hover: hover) {
  .card:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(4, 22, 29, 0.42); }
}
.thumb {
  display: block;
  width: 100%;
  aspect-ratio: 4 / 3;
  border-radius: 15px;
  overflow: hidden;
  position: relative;
}
.thumb svg {
  display: block;
  width: 100%;
  height: 100%;
}
.card .name {
  padding: 0 6px;
  font-family: var(--serif);
  font-size: 1.28rem;
  font-weight: 500;
  line-height: 1.12;
}
.card .what {
  padding: 0 6px;
  margin-top: -6px;
  color: var(--soft);
  font-size: 0.86rem;
  line-height: 1.35;
}
.card .live {
  position: absolute;
  top: 10px;
  left: 10px;
  display: none;
  align-items: center;
  gap: 6px;
  padding: 3px 10px 3px 8px;
  border-radius: 999px;
  background: var(--cream);
  color: var(--ink);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.card.playing .live {
  display: inline-flex;
}
.live i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--buoy);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  50% { opacity: 0.35; }
}

.settings {
  display: grid;
  gap: 2px;
  background: var(--card);
  border-radius: 20px;
  padding: 6px 16px;
}
.settings h2 {
  margin: 10px 0 4px;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.3rem;
}
.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.row:first-of-type {
  border-top: 0;
}
.row b {
  display: block;
  font-weight: 700;
}
.row span {
  display: block;
  color: var(--soft);
  font-size: 0.86rem;
  line-height: 1.35;
}
.switch {
  flex: none;
  position: relative;
  width: 52px;
  height: 32px;
  border-radius: 999px;
  border: 0;
  background: rgba(243, 255, 251, 0.18);
  transition: background 0.2s;
}
.switch::after {
  content: '';
  position: absolute;
  top: 4px;
  left: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--cream);
  transition: transform 0.2s;
}
.switch[aria-checked='true'] {
  background: var(--coin);
}
.switch[aria-checked='true']::after {
  transform: translateX(20px);
  background: var(--ink);
}
.text-btn {
  flex: none;
  border: 0;
  border-radius: 999px;
  padding: 8px 14px;
  background: rgba(243, 255, 251, 0.12);
  font-weight: 700;
  font-size: 0.9rem;
}
.foot {
  color: var(--soft);
  font-size: 0.86rem;
  max-width: 60ch;
}
.foot p {
  margin: 0 0 6px;
}
.foot a {
  color: var(--text);
}

/* now playing */
.now {
  position: fixed;
  left: calc(12px + var(--safe-l));
  right: calc(12px + var(--safe-r));
  bottom: calc(12px + var(--safe-b));
  max-width: 560px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 8px 16px;
  border-radius: 999px;
  background: var(--cream);
  color: var(--ink);
  box-shadow: 0 12px 30px rgba(4, 22, 29, 0.45);
  z-index: 5;
}
.now .label {
  flex: 1;
  min-width: 0;
  border: 0;
  background: none;
  text-align: left;
  padding: 0;
  font-weight: 800;
  line-height: 1.2;
}
.now .label small {
  display: block;
  font-weight: 600;
  color: #3b5964;
  font-size: 0.78rem;
}
.round {
  flex: none;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 0;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: var(--cream);
}
.round svg {
  width: 20px;
  height: 20px;
}

/* ---------- player ---------- */
.player {
  position: fixed;
  inset: 0;
  background: #000;
  z-index: 10;
  overflow: hidden;
  touch-action: manipulation;
}
#stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}
.veil {
  position: absolute;
  inset: 0;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 2.5s ease;
  z-index: 3;
}
.player.dim .veil {
  opacity: 1;
  pointer-events: auto;
}
.player.dim .bar,
.player.dim .sheet {
  opacity: 0;
  pointer-events: none;
}
.bar {
  position: absolute;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding-left: calc(14px + var(--safe-l));
  padding-right: calc(14px + var(--safe-r));
  z-index: 4;
  transition: opacity 0.6s ease;
}
.bar.top {
  top: 0;
  padding-top: calc(10px + var(--safe-t));
  padding-bottom: 28px;
  background: linear-gradient(rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.25) 60%, rgba(0, 0, 0, 0));
}
.bar.bottom {
  bottom: 0;
  justify-content: center;
  gap: 18px;
  padding-top: 40px;
  padding-bottom: calc(18px + var(--safe-b));
  background: linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.5));
}
.player.idle .bar {
  opacity: 0;
}
.title {
  flex: 1;
  min-width: 0;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.5);
}
.title small {
  display: block;
  color: var(--soft);
  font-weight: 800;
  font-size: 0.7rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.title h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.45rem;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.icon-btn {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 0;
  display: grid;
  place-items: center;
  background: rgba(10, 36, 48, 0.55);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.icon-btn svg {
  width: 22px;
  height: 22px;
}
.play {
  width: 76px;
  height: 76px;
  border-radius: 50%;
  border: 0;
  display: grid;
  place-items: center;
  background: var(--cream);
  color: var(--ink);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.4);
}
.play svg {
  width: 30px;
  height: 30px;
}
.play.busy svg {
  animation: spin 1.2s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}
.pill-btn {
  min-width: 92px;
  height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 999px;
  padding: 0 16px;
  background: rgba(10, 36, 48, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  font-weight: 800;
  font-size: 0.92rem;
}
.pill-btn svg {
  width: 18px;
  height: 18px;
}
.pill-btn.on {
  background: var(--coin);
  color: var(--ink);
}
.status {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(10, 36, 48, 0.7);
  color: var(--soft);
  font-weight: 700;
  font-size: 0.9rem;
  z-index: 4;
  pointer-events: none;
  transition: opacity 0.4s;
}
.status:empty {
  opacity: 0;
}

/* sheets float above the play controls, so you can mix and pause without closing them */
.sheet {
  position: absolute;
  left: calc(10px + var(--safe-l));
  right: calc(10px + var(--safe-r));
  bottom: calc(108px + var(--safe-b));
  max-height: calc(100dvh - 108px - var(--safe-b) - 74px - var(--safe-t));
  overflow-y: auto;
  overscroll-behavior: contain;
  z-index: 6;
  margin: 0 auto;
  max-width: 640px;
  padding: 8px 18px 18px;
  border-radius: 24px;
  background: rgba(10, 36, 48, 0.9);
  backdrop-filter: blur(18px) saturate(1.2);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4);
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.3s;
}
.sheet.closed {
  transform: translateY(calc(100% + 140px));
  opacity: 0;
  pointer-events: none;
}
.grip {
  width: 44px;
  height: 5px;
  margin: 2px auto 10px;
  border-radius: 3px;
  background: rgba(243, 255, 251, 0.3);
}
.sheet h3 {
  margin: 4px 0 2px;
  font-family: var(--serif);
  font-weight: 500;
  font-size: 1.35rem;
}
.sheet .hint {
  margin: 0 0 10px;
  color: var(--soft);
  font-size: 0.86rem;
}
.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.group {
  margin: 14px 0 4px;
  color: var(--coin);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.mixrow {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 12px;
  align-items: center;
  padding: 8px 0;
}
.mixrow .ico {
  grid-row: 1 / span 2;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(243, 255, 251, 0.08);
  color: var(--soft);
  border: 0;
  padding: 0;
}
.mixrow.on .ico {
  background: var(--sea);
  color: var(--cream);
}
.mixrow .ico svg {
  width: 22px;
  height: 22px;
}
.mixrow label {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1.2;
}
.mixrow label small {
  color: var(--soft);
  font-weight: 600;
  font-size: 0.78rem;
}
.mixrow.wait label small::after {
  content: ' · loading';
}
.mixrow.err label small::after {
  content: ' · unavailable';
  color: var(--buoy);
}

input[type='range'] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 32px;
  background: transparent;
  margin: 0;
  --p: 50%;
}
input[type='range']::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--soft) var(--p), rgba(243, 255, 251, 0.16) var(--p));
}
input[type='range']::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: rgba(243, 255, 251, 0.16);
}
input[type='range']::-moz-range-progress {
  height: 6px;
  border-radius: 3px;
  background: var(--soft);
}
input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  margin-top: -9px;
  border-radius: 50%;
  background: var(--cream);
  border: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}
input[type='range']::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--cream);
  border: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 4px;
}
.chip {
  border: 0;
  border-radius: 999px;
  padding: 9px 16px;
  background: rgba(243, 255, 251, 0.1);
  font-weight: 700;
  font-size: 0.92rem;
}
.chip[aria-pressed='true'] {
  background: var(--coin);
  color: var(--ink);
}
.chip.ghost {
  background: transparent;
  box-shadow: inset 0 0 0 1.5px rgba(243, 255, 251, 0.3);
}
.chip .x {
  margin-left: 6px;
  opacity: 0.6;
}

dialog {
  max-width: min(640px, calc(100vw - 24px));
  max-height: 84dvh;
  border: 0;
  border-radius: 22px;
  padding: 20px;
  background: var(--ink);
  color: var(--text);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
dialog::backdrop {
  background: rgba(2, 12, 16, 0.6);
}
dialog h2 {
  margin: 0 0 6px;
  font-family: var(--serif);
  font-weight: 500;
}
dialog ul {
  padding-left: 18px;
  font-size: 0.88rem;
  color: var(--soft);
}
dialog li {
  margin: 0 0 8px;
}
dialog a {
  color: var(--text);
}
dialog input[type='text'] {
  width: 100%;
  margin: 10px 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1.5px solid rgba(243, 255, 251, 0.25);
  background: rgba(0, 0, 0, 0.2);
  color: var(--text);
  font: inherit;
}
.actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}
.btn {
  border: 0;
  border-radius: 999px;
  padding: 10px 18px;
  font-weight: 800;
  background: rgba(243, 255, 251, 0.12);
}
.btn.primary {
  background: var(--cream);
  color: var(--ink);
}
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(90px + var(--safe-b));
  transform: translateX(-50%);
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border-radius: 14px;
  background: var(--cream);
  color: var(--ink);
  font-weight: 700;
  font-size: 0.9rem;
  z-index: 50;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}
