@font-face {
  font-family: "Cormorant Garamond";
  src: url("/fonts/cormorant-garamond-var.woff2") format("woff2");
  font-weight: 300 700;
  font-display: swap;
}

:root {
  --ink: #0b0b0c;
  --card: #161617;
  --line: rgba(236, 232, 223, 0.1);
  --moon: #ece8df;
  --dim: #8f8b84;
  --pink: #e7a6c3;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--moon);
  font: 15px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--moon); }
button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { cursor: default; opacity: 0.35; }
:focus-visible { outline: 2px solid var(--pink); outline-offset: 2px; }

/* Header */
.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: max(10px, env(safe-area-inset-top)) 16px 10px;
  height: 60px;
}
.brand { display: flex; align-items: baseline; gap: 8px; text-decoration: none; }
.brand img { align-self: center; width: 34px; height: 34px; border-radius: 50%; }
.word { font: 500 26px/1 var(--serif); letter-spacing: 0.01em; }
.lite { font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--dim); }
.get {
  display: inline-block; padding: 8px 14px; border-radius: 999px;
  background: var(--moon); color: var(--ink); text-decoration: none;
  font-weight: 600; font-size: 13px; white-space: nowrap;
}
.get:hover { background: #fff; }
.get.big { padding: 13px 22px; font-size: 15px; margin: 6px 0 4px; }

/* Layout: the picture on top on a phone, beside the controls on a wide screen. */
.app { display: flex; flex-direction: column; }
/* On a phone the picture fills most of the screen, then shrinks as you scroll into the menus and stays
   pinned at the top while they slide under it (lite.js sets its top and height as you scroll). */
.stage {
  position: fixed; left: 0; right: 0; top: 60px; z-index: 5;
  height: var(--stage-max, 70svh);
  background: var(--ink);
  border-bottom: 1px solid var(--line);
}
.stage canvas { display: block; width: 100%; height: 100%; }
.panel { padding: 16px; display: flex; flex-direction: column; gap: 14px; min-width: 0; margin-top: var(--stage-max, 70svh); }

@media (min-width: 880px) {
  .app {
    flex-direction: row; align-items: flex-start; gap: 28px;
    max-width: 1180px; margin: 0 auto; padding: 0 24px 24px;
  }
  .stage {
    position: sticky; top: 12px; left: auto; right: auto;
    flex: none;
    height: calc(100svh - 84px); max-height: 900px; min-height: 520px;
    width: auto; aspect-ratio: 9 / 16;
    border: 1px solid var(--line); border-radius: 22px; overflow: hidden;
  }
  .panel { flex: 1; padding: 0; margin-top: 0; }
}

/* The big play button over the picture, until the first play. */
.stage-play {
  position: absolute; inset: 0; margin: auto; width: 150px; height: 150px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  background: none; border: 0; transition: opacity 0.4s;
}
.stage-play .ring {
  width: 76px; height: 76px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(236, 232, 223, 0.12);
  border: 1px solid rgba(236, 232, 223, 0.35);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  box-shadow: 0 0 40px rgba(231, 166, 195, 0.25);
}
.stage-play svg { width: 30px; height: 30px; fill: var(--moon); margin-left: 4px; }
.stage-play .hint { font: 500 20px/1 var(--serif); letter-spacing: 0.02em; text-shadow: 0 1px 12px #000; }
.stage.started .stage-play { opacity: 0; pointer-events: none; }

/* Transport */
.transport { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.play {
  width: 54px; height: 54px; border-radius: 50%; border: 0; flex: none;
  background: var(--moon); display: grid; place-items: center;
  box-shadow: 0 0 28px rgba(231, 166, 195, 0.28);
}
.play svg { width: 24px; height: 24px; fill: var(--ink); }
.play .i-play { margin-left: 3px; }
.play .i-pause, .play.playing .i-play { display: none; }
.play.playing .i-pause { display: block; }
.play-label { font: 500 22px/1 var(--serif); min-width: 3.2em; }
.transport .field { margin-left: auto; }

/* Fields */
.field { display: flex; align-items: center; gap: 10px; color: var(--dim); font-size: 13px; }
.field > span:first-child { white-space: nowrap; }
.field b { color: var(--moon); font-weight: 500; margin-left: 4px; }
.field em { font-style: normal; font-size: 12px; color: var(--dim); }
.pair { display: flex; gap: 6px; }
select {
  appearance: none; -webkit-appearance: none;
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238f8b84' stroke-width='1.4'/%3E%3C/svg%3E") no-repeat right 10px center / 10px 6px;
  border: 1px solid var(--line); border-radius: 10px;
  padding: 8px 28px 8px 12px; color: var(--moon); font-size: 15px;
}
.settings { display: grid; gap: 14px; }
.field.wide { display: grid; grid-template-columns: 110px 1fr; align-items: center; }
.field.wide em { grid-column: 2; margin-top: -8px; }
input[type="range"] { width: 100%; accent-color: var(--pink); }

/* Cards */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 14px; min-width: 0; }
.card h2, .cta h2 { margin: 0 0 10px; font: 500 21px/1.1 var(--serif); letter-spacing: 0.01em; }
.card-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.card-head h2 { margin: 0; }
.meta { color: var(--dim); font-size: 12px; }
.link { margin-left: auto; background: none; border: 0; color: var(--dim); font-size: 13px; text-decoration: underline; padding: 4px 0; }
.link:hover { color: var(--moon); }
.sub { margin: 12px 0 6px; color: var(--dim); font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; }
.note { margin: 10px 0 0; color: var(--dim); font-size: 12px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line); background: transparent; border-radius: 999px;
  padding: 6px 12px; font-size: 14px; color: var(--moon);
}
.chip:hover { border-color: rgba(236, 232, 223, 0.35); }
.chip.on { background: var(--moon); color: var(--ink); border-color: var(--moon); }

/* The progression, one slot per chord. */
.strip { position: relative; display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scroll-snap-type: x proximity; scrollbar-width: thin; }
.slot {
  flex: none; scroll-snap-align: start;
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
  min-width: 74px; padding: 8px 10px; border-radius: 12px;
  border: 1px solid var(--line); background: rgba(236, 232, 223, 0.03); text-align: left;
}
.slot .nm, .pal .nm { font: 500 20px/1.05 var(--serif); white-space: nowrap; }
.slot .num, .pal .num { font-size: 11px; color: var(--dim); white-space: nowrap; }
.slot.on { border-color: var(--pink); background: rgba(231, 166, 195, 0.1); }

.edit { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.edit-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.edit-title { font: 500 26px/1 var(--serif); }
.tools { display: flex; gap: 6px; margin-left: auto; }
.tool { border: 1px solid var(--line); background: transparent; border-radius: 10px; padding: 6px 10px; font-size: 13px; }
.tool:hover:not(:disabled) { border-color: rgba(236, 232, 223, 0.35); }

/* The chords of the key. */
.palette { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 8px; }
.pal {
  position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
  padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line);
  background: rgba(236, 232, 223, 0.03); text-align: left;
}
.pal:hover:not(:disabled) { border-color: rgba(236, 232, 223, 0.35); background: rgba(236, 232, 223, 0.06); }
.pal:active:not(:disabled) { transform: scale(0.98); }
.pal.suggested::after {
  content: ""; position: absolute; top: 9px; right: 9px; width: 6px; height: 6px; border-radius: 50%;
  background: var(--pink); box-shadow: 0 0 8px var(--pink);
}

.notice { margin: 0; padding: 10px 12px; border-radius: 12px; background: rgba(231, 166, 195, 0.12); color: var(--moon); font-size: 14px; }

/* App Store */
.cta {
  text-align: center; padding: 26px 18px 22px; border-radius: 18px;
  background: radial-gradient(120% 90% at 50% 0%, rgba(231, 166, 195, 0.16), rgba(231, 166, 195, 0) 70%), var(--card);
  border: 1px solid var(--line);
}
.cta img { width: 64px; height: 64px; border-radius: 50%; box-shadow: 0 0 36px rgba(231, 166, 195, 0.35); }
.cta h2 { margin-top: 10px; font-size: 26px; }
.cta p { margin: 0 auto 12px; max-width: 34em; color: #c9c5bd; }
.cta .small { margin: 8px 0 0; font-size: 12px; color: var(--dim); }

.foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 10px;
  max-width: 1180px; margin: 0 auto; padding: 18px 16px max(22px, env(safe-area-inset-bottom));
  color: var(--dim); font-size: 12px;
}
.foot nav { display: flex; gap: 14px; }
.foot a { color: var(--dim); text-decoration: none; }
.foot a:hover { color: var(--moon); }

@media (max-width: 420px) {
  .get { padding: 7px 11px; font-size: 12px; }
  .word { font-size: 23px; }
  .transport .field { margin-left: 0; width: 100%; }
  .field.wide { grid-template-columns: 112px 1fr; }
}
@media (prefers-reduced-motion: reduce) { .stage-play { transition: none; } }

.get.soon { background: transparent; color: var(--moon); box-shadow: inset 0 0 0 1px rgba(236, 232, 223, 0.35); cursor: default; }
.get.soon:hover { background: transparent; }
[hidden] { display: none !important; }

/* What the full app adds, next to each setting. */
.more { margin: -6px 0 2px; padding-left: 14px; position: relative; color: var(--dim); font-size: 12px; line-height: 1.45; }
.more::before { content: ""; position: absolute; left: 0; top: 0.5em; width: 6px; height: 6px; border-radius: 50%; background: var(--pink); box-shadow: 0 0 6px var(--pink); }
@media (min-width: 421px) { .more { margin-left: 122px; } }

/* Moving through the song */
.stage canvas { cursor: grab; touch-action: pan-y; }
.stage canvas.dragging { cursor: grabbing; }
.seek { display: flex; gap: 6px; }
.seek-btn {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  border: 1px solid var(--line); background: transparent; color: var(--moon);
}
.seek-btn:hover { border-color: rgba(236, 232, 223, 0.35); }
.seek-btn svg { width: 18px; height: 18px; fill: currentColor; }
.scrub-note { margin: -4px 0 0; }
.play-label { min-width: 2.9em; }
@media (max-width: 400px) { .wide-only { display: none; } }
