:root {
  --bg: #0c0c0b;
  --fg: #efe9dc;
  --fg-dim: rgba(239, 233, 220, .56);
  --line: rgba(255, 255, 255, .12);
  --accent: #e6ff86;
  --glow: .6;
  --bgs: 1.12;

  --p-fg: #ece7da;
  --p-dim: rgba(236, 231, 218, .58);
  --p-line: rgba(255, 255, 255, .1);

  --mono: "JetBrains Mono", ui-monospace, Menlo, monospace;
  --serif: "Instrument Serif", Georgia, serif;
  --pixel: "DotGothic16", "JetBrains Mono", monospace;
}

* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; overflow: hidden; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--mono);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

/* ---------- stage ---------- */
#bg { position: fixed; inset: 0; overflow: hidden; background: var(--bg); transition: background .6s; }
.bg-img {
  position: absolute; inset: -12%;
  background-size: cover; background-position: center;
  filter: blur(28px) saturate(1.3) brightness(.6);
  transform: scale(var(--bgs));
  transition: opacity .8s;
}
canvas#glyphs, canvas#bloom {
  position: fixed; inset: 0; width: 100%; height: 100%;
  pointer-events: none;
}
#bloom { filter: blur(7px) brightness(1.7); mix-blend-mode: screen; opacity: var(--glow); }
.grain {
  position: fixed; inset: -50%; pointer-events: none; z-index: 2;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: .17; mix-blend-mode: overlay;
  animation: grain .9s steps(5) infinite;
}
@keyframes grain {
  0% { transform: translate(0, 0); } 20% { transform: translate(-3%, 2%); }
  40% { transform: translate(2%, -3%); } 60% { transform: translate(-2%, -1%); }
  80% { transform: translate(3%, 3%); } 100% { transform: translate(0, 0); }
}
.vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 2;
  background: radial-gradient(120% 90% at 50% 45%, transparent 50%, rgba(0, 0, 0, .55));
}

body[data-bg="paper"] {
  --bg: #ecebe6; --fg: #27324d; --fg-dim: rgba(39, 50, 77, .55); --line: rgba(39, 50, 77, .2);
}
body[data-bg="paper"] .bg-img, body[data-bg="void"] .bg-img { opacity: 0; }
body[data-bg="paper"] #bloom { mix-blend-mode: multiply; filter: blur(6px); opacity: calc(var(--glow) * .3); }
body[data-bg="paper"] .vignette { background: radial-gradient(130% 100% at 50% 45%, transparent 60%, rgba(60, 60, 50, .12)); }
body[data-bg="paper"] .grain { opacity: .28; mix-blend-mode: multiply; }
body[data-bg="paper"] .lyric { color: #27324d; text-shadow: none; }

/* ---------- top bar ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 6;
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 20px 24px; pointer-events: none;
  transition: opacity .4s;
}
.topbar > * { pointer-events: auto; }
.word { font-family: var(--serif); font-size: 28px; letter-spacing: -.01em; line-height: 1; }
.word em { font-style: italic; }
.word { display: inline-flex; align-items: center; }
.logo { width: .92em; height: .92em; margin-right: .32em; background: currentColor;
  -webkit-mask: url(logo.svg) center / contain no-repeat; mask: url(logo.svg) center / contain no-repeat; }
.fig {
  display: block; margin-top: 8px;
  font-size: 10.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--fg);
}
.fig.dim { margin-top: 3px; color: var(--fg-dim); }
.actions { display: flex; gap: 8px; }
.chip {
  font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase;
  background: rgba(0, 0, 0, .2); border: 1px solid var(--line); color: var(--fg);
  border-radius: 999px; padding: 9px 15px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  transition: background .2s, border-color .2s;
}
.chip:hover { border-color: var(--fg-dim); }
.chip.solid { background: var(--fg); color: var(--bg); border-color: transparent; }
body[data-bg="paper"] .chip { background: rgba(255, 255, 255, .4); }
body[data-bg="paper"] .chip.solid { background: var(--fg); }

/* ---------- hero ---------- */
.hero {
  position: fixed; left: 50%; bottom: 7vh; z-index: 5;
  width: min(700px, calc(100% - 32px));
  transform: translateX(-50%);
  text-align: center;
  transition: opacity .6s, transform .6s;
}
.hero h1 {
  font-family: var(--serif); font-weight: 400;
  font-size: clamp(36px, 5.2vw, 62px); line-height: .98; letter-spacing: -.015em;
}
.hero h1 em { font-style: italic; }
.hero p { color: var(--fg-dim); font-size: 11.5px; margin: 14px 0 20px; letter-spacing: .02em; }
.source-bar {
  display: flex; gap: 8px; padding: 8px;
  background: rgba(10, 10, 9, .48); border: 1px solid var(--line); border-radius: 16px;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.source-bar .field { background: transparent; border-color: transparent; }
.alt { margin-top: 14px; font-size: 11px; color: var(--fg-dim); display: flex; gap: 10px; justify-content: center; }
.link { background: none; border: 0; padding: 0; color: var(--fg); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--fg-dim); }
body.loaded .hero { opacity: 0; pointer-events: none; transform: translate(-50%, 24px); }
body[data-bg="paper"] .source-bar { background: rgba(255, 255, 255, .55); }

/* ---------- shared controls ---------- */
.field {
  width: 100%; min-width: 0;
  background: rgba(255, 255, 255, .05); border: 1px solid var(--p-line);
  border-radius: 10px; padding: 10px 12px; font-size: 12px; outline: none;
}
.field:focus { border-color: rgba(255, 255, 255, .35); }
.field::placeholder { color: rgba(236, 231, 218, .4); }
body[data-bg="paper"] .hero .field::placeholder { color: rgba(39, 50, 77, .45); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  white-space: nowrap; text-decoration: none;
  background: rgba(255, 255, 255, .06); border: 1px solid var(--p-line); color: var(--p-fg);
  border-radius: 10px; padding: 10px 13px;
  font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase;
  transition: background .2s, border-color .2s;
  cursor: pointer;
}
.btn:hover { background: rgba(255, 255, 255, .12); }
.btn.solid { background: #efe9dc; color: #121211; border-color: transparent; }
.btn.solid:hover { background: #fff; }
.btn.wide { width: 100%; }
.hero .btn:not(.solid) { color: var(--fg); border-color: var(--line); }
.link-form { display: flex; gap: 10px; flex: 1; min-width: 0; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > .btn, .row > .field { flex: 1; }

/* ---------- capture card ---------- */
.capture {
  position: fixed; left: 50%; top: 50%; z-index: 9;
  transform: translate(-50%, -50%);
  width: min(460px, calc(100% - 32px));
  display: flex; gap: 16px; padding: 18px;
  background: rgba(14, 14, 13, .82); border: 1px solid var(--p-line); border-radius: 20px;
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  color: var(--p-fg); box-shadow: 0 30px 80px rgba(0, 0, 0, .45);
}
.cap-art { flex: none; width: 92px; height: 92px; border-radius: 12px; background: #2a2a28 center / cover; }
.cap-body { flex: 1; min-width: 0; }
.cap-kicker { font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--p-dim); }
.cap-title { font-family: var(--serif); font-size: 24px; line-height: 1.05; margin: 4px 0 10px; overflow-wrap: anywhere; }
.capture ol { padding-left: 18px; font-size: 11.5px; line-height: 1.7; color: var(--p-dim); margin-bottom: 14px; }
.capture ol b { color: var(--p-fg); font-weight: 500; }
.cap-go { margin-top: 6px; }
.cap-note { font-size: 10.5px; line-height: 1.55; color: var(--p-dim); margin-top: 10px; }
.cap-note:empty { display: none; }

.dock {
  position: fixed; left: 22px; bottom: 124px; z-index: 6; width: 300px;
  background: rgba(14, 14, 13, .8); border: 1px solid var(--p-line); border-radius: 16px; overflow: hidden;
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  box-shadow: 0 14px 44px rgba(0, 0, 0, .3); color: var(--p-fg);
}
.dock-head {
  position: relative; padding: 9px 40px 8px 14px;
  font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--p-dim);
}
.dock-head .x { top: 3px; right: 8px; font-size: 18px; }
.dock-min { all: unset; cursor: pointer; display: flex; align-items: center; gap: 9px; width: 100%; }
.dock-min i { width: 9px; height: 9px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: translateY(-2px) rotate(45deg); transition: transform .3s; }
.dock-min:hover { color: var(--p-fg); }
#dockSlot { overflow: hidden; transition: max-height .35s ease; max-height: 400px; }
/* collapsed: the player keeps running (and the audio keeps flowing) but shrinks to its title bar */
.dock.min #dockSlot { max-height: 0; }
.dock.min .dock-min i { transform: translateY(2px) rotate(-135deg); }
.dock.min { width: 250px; }
#dockLabel { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
#dockSlot iframe { display: block; width: 100%; border: 0; background: #000; }
body.docked #lyricA { top: 22vh; }

.x {
  position: absolute; top: 10px; right: 12px;
  background: none; border: 0; color: var(--p-dim); font-size: 22px; line-height: 1; padding: 4px;
}
.x:hover { color: var(--p-fg); }

/* ---------- lyrics ---------- */
.lyric {
  position: fixed; z-index: 4; pointer-events: none;
  font-family: var(--pixel); font-size: clamp(19px, 2.3vw, 34px); line-height: 1.3;
  color: #fff; letter-spacing: .02em;
  text-shadow: 0 0 14px rgba(255, 255, 255, .55), 0 0 2px rgba(255, 255, 255, .9);
  max-width: min(17em, 38vw);
  opacity: 0; transform: translateY(8px); filter: blur(3px);
  transition: opacity .6s, transform .6s, filter .6s;
}
.lyric.on { opacity: 1; transform: none; filter: none; }
/* lyric typefaces; each is sized so lines read about the same */
body[data-lyricfont="serif"] .lyric { font-family: "Instrument Serif", serif; font-style: italic; font-size: clamp(24px, 3vw, 44px); line-height: 1.12; letter-spacing: 0; }
body[data-lyricfont="script"] .lyric { font-family: "Pinyon Script", cursive; font-size: clamp(26px, 3.2vw, 48px); line-height: 1.2; letter-spacing: 0; }
body[data-lyricfont="mono"] .lyric { font-family: "JetBrains Mono", monospace; font-weight: 300; font-size: clamp(16px, 1.8vw, 26px); letter-spacing: .04em; }
body[data-lyricfont="gothic"] .lyric { font-family: "UnifrakturMaguntia", serif; font-size: clamp(24px, 2.8vw, 42px); line-height: 1.2; letter-spacing: .01em; }
.lyrfont button[data-v="pixel"] { font-family: var(--pixel); }
.lyrfont button[data-v="serif"] { font-family: "Instrument Serif", serif; font-style: italic; font-size: 1.15em; }
.lyrfont button[data-v="script"] { font-family: "Pinyon Script", cursive; font-size: 1.2em; }
.lyrfont button[data-v="gothic"] { font-family: "UnifrakturMaguntia", serif; font-size: 1.1em; }
#lyricA { left: 6vw; top: 36vh; }
#lyricB { right: 6vw; bottom: 17vh; }
body.panel-open #lyricB { right: calc(380px + 3vw); }

/* ---------- player card ---------- */
.player {
  position: fixed; left: 22px; bottom: 22px; z-index: 5;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 20px 12px 12px; min-width: 250px;
  background: rgba(243, 242, 239, .8); color: #1c1c1a;
  border-radius: 24px;
  backdrop-filter: blur(18px) saturate(1.2); -webkit-backdrop-filter: blur(18px) saturate(1.2);
  box-shadow: 0 14px 44px rgba(0, 0, 0, .28), inset 0 0 0 1px rgba(255, 255, 255, .6);
  transition: opacity .4s;
}
.disc {
  position: relative; flex: none; width: 66px; height: 66px; padding: 0; border: 0;
  border-radius: 50%; overflow: hidden; background: #d9d8d3;
  animation: spin 7s linear infinite; animation-play-state: paused;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .18);
}
body.playing .disc { animation-play-state: running; }
@keyframes spin { to { transform: rotate(360deg); } }
.disc-art { position: absolute; inset: 0; background: #bdbcb6 center / cover; }
.hole {
  position: absolute; left: 50%; top: 50%; width: 20px; height: 20px; margin: -10px 0 0 -10px;
  border-radius: 50%; background: #ecebe7;
  box-shadow: 0 0 0 4px rgba(255, 255, 255, .5), 0 0 0 5px rgba(0, 0, 0, .1), inset 0 1px 2px rgba(0, 0, 0, .2);
}
.pp {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: #fff; font-size: 16px; background: rgba(0, 0, 0, .35);
  opacity: 0; transition: opacity .2s;
}
.disc:hover .pp, body:not(.playing) .pp { opacity: 1; }
body.live .pp { display: none; }
.np { min-width: 0; text-align: center; flex: 1; }
.np-artist { font-size: 12px; color: #8d8c86; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 190px; }
.np-title { font-size: 14.5px; font-weight: 500; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 190px; }
.np-bar {
  height: 14px; margin: 3px auto 1px; width: 120px; display: flex; align-items: center; cursor: pointer;
  background: linear-gradient(rgba(0, 0, 0, .13), rgba(0, 0, 0, .13)) center / 100% 2px no-repeat;
}
.np-bar i { display: block; height: 2px; width: 0; background: #1c1c1a; }
.np-time { font-size: 14px; }
.np-time b { font-weight: 500; }
.np-time span { color: #a3a29c; }

/* ---------- panel ---------- */
.panel {
  position: fixed; top: 74px; right: 18px; bottom: 18px; z-index: 8;
  width: 400px; display: flex; flex-direction: column;
  background: rgba(14, 14, 13, .76); color: var(--p-fg);
  border: 1px solid var(--p-line); border-radius: 20px;
  backdrop-filter: blur(24px) saturate(1.2); -webkit-backdrop-filter: blur(24px) saturate(1.2);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .35);
  transform: translateX(calc(100% + 40px));
  transition: transform .5s cubic-bezier(.2, .8, .2, 1);
}
body.panel-open .panel { transform: none; }
.panel-head { position: relative; padding: 14px 44px 10px 16px; border-bottom: 1px solid var(--p-line); }
.panel-head .x { top: 12px; }
.tabs { display: flex; gap: 2px; }
.tab {
  background: none; border: 0; padding: 9px 10px; border-radius: 8px;
  font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--p-dim);
}
.tab.on { color: var(--p-fg); background: rgba(255, 255, 255, .08); }
.panes { flex: 1; overflow-y: auto; padding: 4px 22px 22px; scrollbar-width: thin; }
.pane { display: none; flex-direction: column; gap: 8px; }
.pane.on { display: flex; }
.lbl {
  display: flex; justify-content: space-between; margin: 0 0 8px;
  font-size: 10px; letter-spacing: .14em; text-transform: uppercase; color: var(--p-dim);
}
.lbl output { color: var(--p-fg); }
.hint { font-size: 11px; line-height: 1.6; color: var(--p-dim); margin-top: 6px; }
.hint b, .hint code, .hint kbd { color: var(--p-fg); font-weight: 400; font-family: var(--mono); }
.status { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--p-dim); }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 11.5px; cursor: pointer; }
.check input { accent-color: #efe9dc; }
input[type="range"] { width: 100%; accent-color: #efe9dc; }
textarea.field { min-height: 190px; resize: vertical; line-height: 1.55; font-size: 11.5px; margin-top: 10px; }
.sync span { min-width: 46px; text-align: center; font-size: 11px; }
.keys {
  padding: 10px 16px 12px; border-top: 1px solid var(--p-line);
  font-size: 9.5px; letter-spacing: .1em; text-transform: uppercase; color: rgba(236, 231, 218, .4);
}

.seg { display: flex; gap: 2px; padding: 3px; border: 1px solid var(--p-line); border-radius: 11px; }
.seg.wrap { flex-wrap: wrap; }
.seg button {
  flex: 1 0 auto; background: none; border: 0; border-radius: 8px;
  padding: 8px 8px; font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--p-dim);
}
.seg button:hover { color: var(--p-fg); }
.seg button.on { background: #ece7da; color: #121211; }

.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches button {
  width: 30px; height: 30px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, .2);
  background: var(--c); padding: 0;
}
.swatches button.src { background: conic-gradient(#ffb2c1, #ffe08a, #b9f5a0, #9fd8ff, #d4b4ff, #ffb2c1); }
.swatches button.on { outline: 2px solid #ece7da; outline-offset: 3px; }

.forms { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 10px; }
.form-tile {
  aspect-ratio: 1 / .92; padding: 6px 4px 7px; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  background: rgba(255, 255, 255, .03); border: 1px solid var(--p-line); border-radius: 12px;
  color: inherit;
}
.form-tile:hover { background: rgba(255, 255, 255, .07); }
.form-tile.on { border-color: rgba(236, 231, 218, .75); background: rgba(255, 255, 255, .08); }
.form-tile pre {
  flex: 1; min-height: 0; overflow: hidden; display: grid; place-items: center;
  font-family: var(--mono); font-size: 4.4px; line-height: 1; color: #efe6cf; margin: 0;
}
.form-tile pre.empty { font-size: 9px; color: var(--p-dim); letter-spacing: .06em; }
.form-tile span { flex-shrink: 0; font-size: 9px; letter-spacing: .12em; text-transform: uppercase; color: var(--p-dim); }
.form-tile.on span { color: var(--p-fg); }

/* ---------- misc ---------- */
.drop {
  position: fixed; inset: 14px; z-index: 30; pointer-events: none;
  display: grid; place-items: center;
  border: 1.5px dashed rgba(255, 255, 255, .55); border-radius: 26px;
  background: rgba(0, 0, 0, .3);
  font-family: var(--serif); font-style: italic; font-size: 46px; color: #fff;
  opacity: 0; transition: opacity .2s;
}
body.dragging .drop { opacity: 1; }
.toast {
  position: fixed; left: 50%; bottom: 26px; z-index: 40;
  transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  max-width: min(560px, calc(100% - 32px));
  background: rgba(14, 14, 13, .88); color: var(--p-fg); border: 1px solid var(--p-line);
  padding: 11px 16px; border-radius: 12px; font-size: 11.5px; line-height: 1.5; text-align: center;
  transition: opacity .3s, transform .3s;
}
.toast.on { opacity: 1; transform: translate(-50%, 0); }

body.ui-hidden .dock, body.ui-hidden .topbar, body.ui-hidden .player, body.ui-hidden .panel, body.ui-hidden .hero { opacity: 0; pointer-events: none; }
body.ui-hidden { cursor: none; }

/* ---------- small screens ---------- */
@media (max-width: 720px) {
  .topbar { padding: 14px 16px; }
  .word { font-size: 23px; }
  .chip { padding: 8px 11px; font-size: 9.5px; }
  #btnFull { display: none; }
  .source-bar { flex-direction: column; }
  .hero { bottom: 5vh; }
  .panel {
    left: 8px; right: 8px; top: auto; bottom: 8px; width: auto; height: 64vh;
    transform: translateY(calc(100% + 30px));
  }
  .player { left: 12px; right: 12px; bottom: 12px; min-width: 0; }
  .dock { left: 12px; right: 12px; width: auto; bottom: 112px; }
  .np-artist, .np-title { max-width: none; }
  #lyricA, #lyricB { left: 16px !important; right: 16px !important; max-width: none; text-align: center; translate: none !important; }
  #lyricA { top: 13vh; }
  #lyricB { top: 13vh; bottom: auto; }
  body.panel-open #lyricB { right: 16px; }
}

/* ---------- panel groups ---------- */
.group { border-top: 1px solid var(--p-line); padding: 8px 0 30px; }
/* <details> ignores flex gap in some browsers, so space its children with margins instead */
.group > :not(summary) { margin-top: 18px; }
.group > summary + * { margin-top: 14px; }
.group > .desc + * { margin-top: 14px; }
.group:first-child { border-top: 0; }
.group > summary {
  list-style: none; cursor: pointer; display: flex; align-items: baseline; gap: 10px;
  padding: 20px 0 0; font-family: var(--serif); font-size: 25px; line-height: 1; color: var(--p-fg);
}
.group > summary::-webkit-details-marker { display: none; }
.group > summary small { font-family: var(--mono); font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--p-dim); }
.group > summary::after { content: '+'; margin-left: auto; font-family: var(--mono); font-size: 14px; color: var(--p-dim); }
.group[open] > summary::after { content: '−'; }
.ctl { display: flex; flex-direction: column; }
.ctl > .seg + .desc, .ctl > .swatches + .desc, .ctl > input + .desc { margin-top: 8px; }
.ctl.two { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; }
.ctl #inCustom { margin-top: 10px; }
.desc { font-size: 11px; line-height: 1.6; color: var(--p-dim); }
.desc:empty { display: none; }
.looks { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.look {
  text-align: left; padding: 16px 16px 15px; border-radius: 14px; color: inherit;
  background: rgba(255, 255, 255, .03); border: 1px solid var(--p-line);
}
.look:hover { background: rgba(255, 255, 255, .07); }
.look b { display: block; font-family: var(--serif); font-weight: 400; font-size: 18px; line-height: 1.1; color: var(--p-fg); }
.look span { display: block; margin-top: 6px; font-size: 10px; line-height: 1.45; color: var(--p-dim); }
.look.on { border-color: rgba(236, 231, 218, .75); background: rgba(255, 255, 255, .08); }
.pane-intro { font-size: 11px; line-height: 1.6; color: var(--p-dim); margin-top: 10px; }
.sync-status { font-size: 10.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--p-fg); }
.sync-status:empty { display: none; }
.sync-status.listening { animation: sbBlink 1.8s ease-in-out infinite; }
@keyframes sbBlink { 50% { opacity: .4; } }

/* ---------- dark disc card on dark backgrounds ---------- */
body[data-bg="void"] .player, body[data-bg="video"] .player {
  background: rgba(20, 20, 19, .74); color: #ece7da;
  box-shadow: 0 14px 44px rgba(0, 0, 0, .45), inset 0 0 0 1px rgba(255, 255, 255, .09);
}
body[data-bg="void"] .disc, body[data-bg="video"] .disc { background: #2a2a28; }
body[data-bg="void"] .disc-art, body[data-bg="video"] .disc-art { background-color: #3a3a37; }
body[data-bg="void"] .hole, body[data-bg="video"] .hole { background: #141413; box-shadow: 0 0 0 4px rgba(255, 255, 255, .12), inset 0 1px 2px rgba(0, 0, 0, .5); }
body[data-bg="void"] .np-artist, body[data-bg="video"] .np-artist { color: rgba(236, 231, 218, .5); }
body[data-bg="void"] .np-bar, body[data-bg="video"] .np-bar { background-image: linear-gradient(rgba(255, 255, 255, .18), rgba(255, 255, 255, .18)); }
body[data-bg="void"] .np-bar i, body[data-bg="video"] .np-bar i { background: #ece7da; }
body[data-bg="void"] .np-time span, body[data-bg="video"] .np-time span { color: rgba(236, 231, 218, .45); }

/* ---------- music video as the background ---------- */
/* the same player just moves behind the glyphs — no reload, the audio keeps going */
body[data-bg="video"] #glyphs, body[data-bg="video"] #bloom { z-index: 1; }
body[data-bg="video"].yt .dock {
  inset: 0; width: auto; z-index: 0; border: 0; border-radius: 0; background: #000;
  box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; pointer-events: none;
}
body[data-bg="video"].yt .dock-head { display: none; }
body[data-bg="video"].yt #dockSlot { position: absolute; inset: 0; max-height: none; }
body[data-bg="video"].yt #dockSlot iframe {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) scale(1.22); /* crops away YouTube's title bar and controls */
  width: max(100vw, 177.78vh) !important; height: max(56.25vw, 100vh) !important;
  filter: brightness(.5) saturate(.9);
}
.panel .btn, .panel .field:not(textarea) { padding: 12px 14px; }
.panel .group > .field + .field { margin-top: 10px; }

/* ---------- option cards (replace the old pill rows) ---------- */
.seg.cards {
  display: grid; grid-template-columns: repeat(var(--cols, 3), 1fr); gap: 8px;
  padding: 0; border: 0; border-radius: 0;
}
.seg.cards button {
  display: flex; flex-direction: column; align-items: stretch; gap: 0;
  padding: 6px 6px 9px; border-radius: 12px; text-align: left;
  background: rgba(255, 255, 255, .03); border: 1px solid var(--p-line);
  color: var(--p-fg); text-transform: none; letter-spacing: 0;
}
.seg.cards button:hover { background: rgba(255, 255, 255, .07); }
.seg.cards button.on { background: rgba(255, 255, 255, .09); border-color: rgba(236, 231, 218, .8); color: var(--p-fg); box-shadow: inset 0 0 0 1px rgba(236, 231, 218, .35); }
.seg.cards .pv {
  display: grid; place-items: center; aspect-ratio: 5 / 3; border-radius: 8px; overflow: hidden;
  background: #070707; color: #f3ead2; font-style: normal;
}
.seg.cards .pv canvas { width: 100%; height: 100%; object-fit: contain; display: block; }
.seg.cards .pv svg { width: 78%; height: 78%; }
.seg.cards .pv.chars { font-family: var(--mono); font-size: 15px; letter-spacing: .08em; }
.seg.cards .pv.swatch { border: 1px solid rgba(255, 255, 255, .12); }
.seg.cards .pv.swatch b { color: #f3ead2; font-weight: 400; font-size: 14px; }
.seg.cards .nm { margin: 8px 3px 0; font-size: 10px; letter-spacing: .12em; text-transform: uppercase; }
.seg.cards small { margin: 3px 3px 0; font-size: 10px; line-height: 1.35; color: var(--p-dim); }
.seg.cards button:not(.on) .nm { color: rgba(236, 231, 218, .78); }
.panel .swatches { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.panel .swatches button { width: 100%; height: auto; aspect-ratio: 1; border-radius: 12px; }

/* head maker */
.head-maker .head-pv { display: block; width: 144px; height: 135px; margin: 4px auto 12px; image-rendering: pixelated; }
.head-maker .ctl .lbl { text-transform: capitalize; }
.head-maker .seg.wrap button { padding: 5px 9px; }
.head-maker .btn.wide { margin-top: 6px; }

/* ---- panel v2: tabs Looks / Shape / Style / Motion / Song ---- */
.tabs { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 9px 8px; letter-spacing: .08em; flex-shrink: 0; }
.group.flat { padding-top: 16px; }
.group.flat > :first-child { margin-top: 0; }
.seg.kinds button { flex: 1; }
.form-tile[hidden] { display: none; }
.link.back { align-self: flex-start; color: var(--p-dim); text-decoration: none; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; }
.link.back:hover { color: var(--p-fg); }
.ctl.energy input[type=range] { height: 28px; }
.ctl.energy .lbl { font-size: 11px; }
.ctl.energy .ends { display: flex; justify-content: space-between; margin-top: 2px; font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--p-dim); }
.ctl.energy .desc { margin-top: 10px; }
.look { position: relative; }
.look.mine { border-style: dashed; }
.look .del { position: absolute; top: 6px; right: 8px; font-style: normal; font-size: 14px; line-height: 1; color: var(--p-dim); padding: 2px 4px; border-radius: 6px; }
.look .del:hover { color: var(--p-fg); background: rgba(255, 255, 255, .1); }
.seg.cards button, .swatches button { touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
@media (max-width: 600px) { .tab { padding: 9px 6px; font-size: 9.5px; letter-spacing: .04em; } .panel-head { padding-right: 38px; } }

/* ---- panel v3 ---- */
/* panes whose top stays put while only the list below scrolls */
.panes:has(.pane-split.on) { overflow: hidden; display: flex; flex-direction: column; padding-bottom: 0; }
.pane-split.on { flex: 1; min-height: 0; gap: 0; }
.pane-split .pin { display: flex; flex-direction: column; gap: 12px; padding: 16px 0 12px; border-bottom: 1px solid var(--p-line); }
.pane-split .scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 2px 22px; margin: 0 -2px; scrollbar-width: thin; }
.pane-split .forms { margin-top: 0; }
.pane-split .desc:empty { display: none; }
.row.tight { flex-wrap: nowrap; }
.row.tight .check { flex-shrink: 0; padding: 0 6px; }
#headWrap[hidden] { display: none; }
/* character page */
.head-top { display: grid; grid-template-columns: 144px 1fr; gap: 16px; align-items: start; }
#headPv .head-pv { display: block; width: 144px; height: 135px; image-rendering: pixelated; border-radius: 10px; background: rgba(255, 255, 255, .04); }
.seg.col { flex-direction: column; }
.seg.col button { text-align: left; }
.head-top .desc { margin-top: 8px; }
.head-maker > .ctl { margin-bottom: 14px; }
/* style tab */
.desc.note { padding: 10px 12px; border: 1px dashed var(--p-line); border-radius: 10px; }
.desc.note[hidden] { display: none; }
.swatches { gap: 9px; }
.swatches button { width: 28px; height: 28px; position: relative; }
.swatches button.pick { background: var(--c, #ffb38a); overflow: hidden; }
.swatches button.pick::after { content: '+'; position: absolute; inset: 0; display: grid; place-items: center; font-size: 15px; color: rgba(0, 0, 0, .55); pointer-events: none; }
.swatches button.pick input { position: absolute; inset: -6px; width: 40px; height: 40px; opacity: 0; cursor: pointer; border: 0; padding: 0; }
.ctl > .row { margin-top: 12px; }
.ctl > .desc + .row { margin-top: 14px; }
.group > .ctl + .ctl, .group > .ctl + .desc.note, .group > .desc.note + .ctl { margin-top: 24px; }
.ctl .ends { display: flex; justify-content: space-between; margin-top: 2px; font-size: 9.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--p-dim); }
/* looks: a picture and what's in it */
.look { display: flex; flex-direction: column; padding: 10px 10px 12px; }
.look .lk-pv { display: block; aspect-ratio: 132 / 78; border-radius: 9px; overflow: hidden; background: #000; margin-bottom: 10px; }
.look .lk-pv canvas { width: 100%; height: 100%; display: block; }
.look b { font-size: 17px; padding: 0 2px; }
.look > span { padding: 0 2px; margin-top: 3px; }
.look dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 8px; margin: 10px 2px 0; font-size: 9.5px; line-height: 1.35; }
.look dt { color: var(--p-dim); text-transform: uppercase; letter-spacing: .08em; font-size: 8.5px; padding-top: 1px; }
.look dd { margin: 0; color: var(--p-fg); }
.look dd .sw { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: 0; border: 1px solid rgba(255, 255, 255, .25); }
/* song tab */
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px 16px; border: 1.5px dashed rgba(236, 231, 218, .35); border-radius: 16px; cursor: pointer; text-align: center; transition: background .2s, border-color .2s; }
.dropzone:hover, body.dragging .dropzone { background: rgba(255, 255, 255, .06); border-color: rgba(236, 231, 218, .7); }
.dropzone b { font-family: var(--serif); font-weight: 400; font-size: 24px; color: var(--p-fg); }
.dropzone span { font-size: 10.5px; color: var(--p-dim); }
details.sub { border: 1px solid var(--p-line); border-radius: 12px; padding: 10px 14px; }
details.sub > summary { cursor: pointer; list-style: none; display: flex; gap: 8px; align-items: baseline; font-size: 11.5px; color: var(--p-fg); }
details.sub > summary::-webkit-details-marker { display: none; }
details.sub > summary small { font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--p-dim); }
details.sub > summary::after { content: '+'; margin-left: auto; color: var(--p-dim); }
details.sub[open] > summary::after { content: '−'; }
details.sub > * + * { margin-top: 10px; }
details.sub .field { width: 100%; }
/* caption position: --ls 1 = out at the sides (as before), 0 = centered over the visual */
@media (min-width: 721px) {
#lyricA { left: calc(6vw * var(--ls, 1) + 50vw * (1 - var(--ls, 1))); top: calc(36vh * var(--ls, 1) + 40vh * (1 - var(--ls, 1))); translate: calc(-50% * (1 - var(--ls, 1))) 0; }
#lyricB { right: calc(6vw * var(--ls, 1) + 50vw * (1 - var(--ls, 1))); bottom: calc(17vh * var(--ls, 1) + 40vh * (1 - var(--ls, 1))); translate: calc(50% * (1 - var(--ls, 1))) 0; }
body.panel-open #lyricA { left: calc(6vw * var(--ls, 1) + (50vw - 210px) * (1 - var(--ls, 1))); }
body.panel-open #lyricB { right: calc((380px + 3vw) * var(--ls, 1) + (50vw + 210px) * (1 - var(--ls, 1))); }
body.docked #lyricA { top: calc(22vh * var(--ls, 1) + 40vh * (1 - var(--ls, 1))); }
}
body.lyr-center .lyric { text-align: center; max-width: min(20em, 60vw); }
/* fine-tune meter */
.meter { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; padding: 12px 12px 10px; border: 1px solid var(--p-line); border-radius: 12px; }
.meter > div { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.meter i { display: block; width: 100%; height: 46px; background: linear-gradient(#ece7da, rgba(236, 231, 218, .35)); border-radius: 4px; transform-origin: bottom; transform: scaleY(.02); transition: transform .06s linear; }
.meter span { font-size: 8.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--p-dim); }
.meter p { grid-column: 1 / -1; margin: 2px 0 0; font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--p-fg); text-align: center; }

/* ---------- round 6: save bar, tile previews */
.panel-save { padding: 10px 22px 12px; border-top: 1px solid var(--p-line); }
.panel-save .btn { width: 100%; }
.form-tile .tpv { flex: 1; min-height: 0; width: 100%; display: grid; place-items: center; overflow: hidden; border-radius: 8px; margin-bottom: 6px; }
.form-tile .tpv canvas { width: 100%; height: auto; max-height: 100%; object-fit: contain; display: block; border-radius: 6px; }
