:root {
  --bg: #0b0b0c;
  --panel: #151517;
  --panel-2: #1d1d20;
  --panel-3: #26262a;
  --ink: #f2f0e8;
  --muted: #a7a198;
  --dim: #6f6b65;
  --line: rgba(242, 240, 232, 0.13);
  --red: #d64234;
  --red-soft: rgba(214, 66, 52, 0.18);
  --warm: #d8b16a;
  --green: #66d18f;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.42);
  color-scheme: dark;
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: #080809;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    radial-gradient(circle at 22% 0, rgba(214, 66, 52, 0.16), transparent 34%),
    linear-gradient(145deg, #060607, #111113 48%, #080809);
  background-size: 26px 26px, auto, auto;
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #0e0e10;
  color: var(--ink);
  padding: 11px 12px;
  outline: none;
}

textarea {
  min-height: 180px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus,
button:focus-visible {
  border-color: rgba(214, 66, 52, 0.8);
  box-shadow: 0 0 0 3px var(--red-soft);
}

.visually-hidden {
  position: fixed;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  grid-template-rows: auto 1fr;
  padding: max(16px, env(safe-area-inset-top)) 14px calc(96px + max(10px, env(safe-area-inset-bottom)));
}

.performance-shell {
  display: block;
  padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom));
}

.performance-shell .topbar,
.performance-shell .bottom-nav {
  display: none;
}

.performance-shell .screen {
  width: min(100%, 980px);
  height: calc(100vh - max(10px, env(safe-area-inset-top)) - max(10px, env(safe-area-inset-bottom)) - 2px);
  height: calc(100dvh - max(10px, env(safe-area-inset-top)) - max(10px, env(safe-area-inset-bottom)) - 2px);
  padding-bottom: 0;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: min(100%, 880px);
  margin: 0 auto 14px;
}

.brand {
  min-width: 0;
}

.brand h1 {
  margin: 0;
  font-size: clamp(1.7rem, 7vw, 3rem);
  letter-spacing: 0;
  line-height: 0.95;
}

.brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.status-chip {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  padding: 8px 10px;
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.screen {
  width: min(100%, 880px);
  margin: 0 auto;
  padding-bottom: 16px;
}

.module-panel {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background:
    linear-gradient(90deg, rgba(170, 126, 67, 0.08), transparent 18%, transparent 82%, rgba(170, 126, 67, 0.08)),
    repeating-linear-gradient(110deg, rgba(255, 255, 255, 0.032) 0 1px, transparent 1px 8px),
    linear-gradient(160deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.02)),
    var(--panel);
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(255, 255, 255, 0.03);
  padding: 16px;
}

.module-panel::before {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent, rgba(214, 66, 52, 0.16), transparent) 0 0 / 100% 2px no-repeat,
    radial-gradient(circle at 96% 4%, rgba(216, 177, 106, 0.16), transparent 18%);
  content: "";
  pointer-events: none;
}

.module-panel > * {
  position: relative;
}

.tuner-screen {
  min-height: calc(100vh - 130px);
  overflow: hidden;
  border: 1px solid rgba(242, 240, 232, 0.08);
  border-radius: 18px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    linear-gradient(0deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    radial-gradient(circle at 50% 18%, rgba(38, 198, 151, 0.08), transparent 28%),
    #17191b;
  background-size: 28px 28px, 28px 28px, auto, auto;
  padding: 18px 16px 14px;
}

.tuner-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.tuner-head h2 {
  margin: 0;
  color: #f7f7f2;
  font-size: clamp(2rem, 10vw, 3.1rem);
  line-height: 0.95;
}

.tuner-mode-title {
  display: block;
  margin-top: 14px;
  background: transparent;
  color: var(--ink);
  padding: 0;
  font-size: 1.02rem;
  font-weight: 800;
  text-align: left;
}

.tuner-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 700;
}

.auto-pill {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-size: 0.8rem;
  font-weight: 900;
  white-space: nowrap;
}

.auto-pill i {
  position: relative;
  display: block;
  width: 58px;
  height: 34px;
  border-radius: 999px;
  background: #2b2d31;
}

.auto-pill i::after {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: #f3f2eb;
  content: "";
  transition: transform 180ms ease;
}

.auto-pill i.on {
  background: #17c994;
}

.auto-pill i.on::after {
  transform: translateX(24px);
}

.tuna-meter {
  position: relative;
  height: 310px;
  margin: 12px -16px 8px;
  overflow: hidden;
}

.pitch-grid {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(242, 240, 232, 0.045) 1px, transparent 1px),
    linear-gradient(0deg, rgba(242, 240, 232, 0.04) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: linear-gradient(to bottom, black 10%, transparent 92%);
}

.flat-sign,
.sharp-sign {
  position: absolute;
  top: 44px;
  color: #d4d4d0;
  font-size: 2rem;
}

.flat-sign {
  left: 20px;
}

.sharp-sign {
  right: 24px;
}

.center-line {
  position: absolute;
  top: -18px;
  bottom: 0;
  left: 50%;
  width: 1px;
  background: linear-gradient(to bottom, transparent, rgba(242, 240, 232, 0.16), transparent);
}

.smooth-pointer {
  position: absolute;
  top: 54px;
  left: 50%;
  display: grid;
  width: 54px;
  height: 54px;
  place-items: center;
  border: 3px solid #f2f0e8;
  border-radius: 999px;
  background: #17191b;
  transform: translateX(0);
  transition: transform 180ms cubic-bezier(0.22, 0.9, 0.28, 1);
  will-change: transform;
}

.smooth-pointer::after {
  position: absolute;
  bottom: -10px;
  left: 50%;
  width: 0;
  height: 0;
  border-right: 6px solid transparent;
  border-left: 6px solid transparent;
  border-top: 10px solid #f2f0e8;
  content: "";
  transform: translateX(-50%);
}

.smooth-pointer span {
  display: none;
}

.tuner-message {
  position: absolute;
  right: 28px;
  bottom: 62px;
  left: 28px;
  border-radius: 999px;
  background: #2d2f34;
  color: var(--ink);
  padding: 15px 18px;
  text-align: center;
  font-weight: 800;
}

.peg-tuner {
  display: grid;
  grid-template-columns: 74px 1fr 74px;
  gap: 12px;
  align-items: center;
  margin-top: -70px;
}

.peg-column {
  display: grid;
  gap: 18px;
  z-index: 1;
}

.peg {
  display: grid;
  grid-template-columns: 44px 1fr;
  align-items: center;
  gap: 10px;
  min-height: 56px;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0;
}

.peg-column.right .peg {
  grid-template-columns: 1fr 44px;
}

.peg-column.right .peg-label {
  order: 2;
}

.peg-column.right .peg-post {
  order: 1;
}

.peg-label {
  display: grid;
  width: 50px;
  height: 50px;
  place-items: center;
  border-radius: 999px;
  background: #292c31;
  color: #f4f2ec;
  font-size: 1.08rem;
  font-weight: 900;
}

.peg.active .peg-label {
  background: #17c994;
  color: #081714;
}

.peg-post {
  display: block;
  width: 44px;
  height: 36px;
  border-radius: 16px 999px 999px 16px;
  background: linear-gradient(90deg, #4e5255, #f0f1ec 46%, #656a6e);
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.55);
}

.peg-post.right {
  border-radius: 999px 16px 16px 999px;
}

.headstock-lite {
  position: relative;
  min-height: 360px;
  border: 2px solid rgba(242, 240, 232, 0.65);
  border-radius: 44% 44% 18px 18px / 14% 14% 10px 10px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.08), transparent 24%, transparent 76%, rgba(255, 255, 255, 0.06)),
    repeating-linear-gradient(90deg, #5a301c 0 6px, #7e4528 6px 12px, #3c2116 12px 18px);
  box-shadow: inset 0 0 26px rgba(0, 0, 0, 0.45), 0 22px 50px rgba(0, 0, 0, 0.34);
}

.string-line {
  position: absolute;
  top: 32px;
  bottom: -22px;
  width: 2px;
  background: linear-gradient(#dfe4e1, #7f8585);
  opacity: 0.74;
  transform-origin: top center;
}

.string-line.active {
  background: #17c994;
  box-shadow: 0 0 12px rgba(23, 201, 148, 0.8);
  opacity: 1;
}

.s1 { left: 24%; transform: rotate(-8deg); }
.s2 { left: 34%; transform: rotate(-4deg); }
.s3 { left: 44%; transform: rotate(-1deg); }
.s4 { right: 44%; transform: rotate(1deg); }
.s5 { right: 34%; transform: rotate(4deg); }
.s6 { right: 24%; transform: rotate(8deg); }

.target-note {
  position: absolute;
  right: 18px;
  bottom: 56px;
  left: 18px;
  text-align: center;
  color: #f7f4ea;
  font-size: clamp(3.6rem, 18vw, 5.4rem);
  font-weight: 950;
  line-height: 1;
  text-shadow: 0 2px 18px rgba(0, 0, 0, 0.55);
}

.target-frequency {
  position: absolute;
  right: 0;
  bottom: 24px;
  left: 0;
  color: var(--muted);
  text-align: center;
  font-weight: 800;
}

.chromatic-readout {
  display: grid;
  gap: 22px;
  margin-top: -48px;
  padding: 0 18px 16px;
  text-align: center;
}

.chromatic-readout span {
  display: block;
  color: var(--muted);
  font-size: 1.1rem;
  font-weight: 900;
  text-transform: uppercase;
}

.chromatic-readout strong {
  display: block;
  margin-top: 8px;
  color: #17c994;
  font-size: 1.7rem;
}

.chromatic-note {
  color: #f7f4ea;
  font-size: clamp(4rem, 20vw, 6rem);
  font-weight: 950;
}

.tuner-modes {
  margin-top: 16px;
}

.a4-strip {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  margin-top: 12px;
  border-top: 1px solid rgba(242, 240, 232, 0.08);
  padding-top: 12px;
}

.section-title {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-title h2 {
  margin: 0;
  font-size: clamp(1.25rem, 5vw, 2rem);
}

.section-title p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.schema-title {
  align-items: stretch;
}

.schema-active-song-title {
  display: block;
  margin-top: 4px;
  color: var(--warm);
  font-size: clamp(1.05rem, 4.8vw, 1.55rem);
  font-weight: 950;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.schema-context-chip {
  min-width: min(220px, 100%);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  padding: 10px 12px;
}

.schema-context-chip strong {
  display: block;
  color: var(--ink);
  font-size: 0.92rem;
  line-height: 1.2;
  overflow-wrap: anywhere;
}

.grid {
  display: grid;
  gap: 12px;
}

.two-col {
  grid-template-columns: 1fr 1fr;
}

.three-col {
  grid-template-columns: repeat(3, 1fr);
}

.btn,
.chip,
.icon-btn {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(#27272b, #121214);
  color: var(--ink);
  min-height: 44px;
  padding: 10px 12px;
  font-weight: 900;
}

.btn.primary,
.chip.active {
  border-color: rgba(214, 66, 52, 0.74);
  background: linear-gradient(#d64234, #782018);
  color: white;
}

.btn.ghost {
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
}

.btn.danger {
  color: #ffd5ce;
}

.chip {
  min-width: 0;
  min-height: 40px;
  padding: 8px 10px;
  font-size: 0.84rem;
}

.mini-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.library-controls,
.schema-picker {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.library-controls .wide {
  grid-column: 1 / -1;
}

.library-stats,
.arranger-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 12px 0;
}

.library-stats div,
.arranger-summary div {
  display: grid;
  gap: 2px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  padding: 10px;
}

.library-stats strong,
.arranger-summary strong {
  color: var(--ink);
  font-size: 1.12rem;
}

.library-stats span,
.arranger-summary span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  text-transform: uppercase;
}

.project-song-list,
.program-editor,
.rehearsal-order {
  display: grid;
  gap: 10px;
}

.project-song-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
  padding: 8px;
}

.project-song-card.active {
  border-color: rgba(216, 177, 106, 0.78);
  background: rgba(216, 177, 106, 0.12);
}

.song-card-main {
  display: grid;
  min-width: 0;
  gap: 5px;
  border: 0;
  border-radius: 10px;
  background: rgba(10, 10, 11, 0.58);
  color: var(--ink);
  padding: 10px;
  text-align: left;
}

.song-card-main strong,
.song-card-main input,
.program-song-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.song-title-inline {
  width: 100%;
  min-height: 42px;
  font-weight: 900;
}

.song-card-main span,
.song-card-main em {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.program-editor.locked {
  opacity: 0.82;
}

.add-program-song,
.program-edit-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.schema-floating-actions {
  position: sticky;
  z-index: 45;
  bottom: calc(88px + max(10px, env(safe-area-inset-bottom)));
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin: 10px 0 14px;
  border: 1px solid rgba(242, 240, 232, 0.1);
  border-radius: 16px;
  background: rgba(12, 12, 13, 0.88);
  padding: 8px;
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(12px);
}

.bottom-nav {
  position: fixed;
  z-index: 50;
  right: auto;
  bottom: max(10px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: min(calc(100% - 28px), 880px);
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(12, 12, 13, 0.92);
  padding: 8px;
  box-shadow: 0 -12px 36px rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(12px);
}

.nav-btn {
  display: grid;
  min-width: 0;
  min-height: 56px;
  place-items: center;
  gap: 4px;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 900;
}

.nav-btn svg {
  width: 21px;
  height: 21px;
  stroke-width: 2.2;
}

.nav-btn.active {
  background: var(--red-soft);
  color: var(--ink);
}

.tuner-meter {
  display: grid;
  gap: 14px;
}

.note-card {
  display: grid;
  min-height: 230px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.025)),
    #101012;
  padding: 18px;
}

.note-main {
  font-size: clamp(5rem, 28vw, 8rem);
  font-weight: 950;
  line-height: 0.86;
}

.needle-track {
  position: relative;
  width: min(100%, 360px);
  height: 56px;
  margin-top: 8px;
}

.needle-track::before {
  position: absolute;
  top: 26px;
  right: 0;
  left: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--red), var(--warm), var(--green), var(--warm), var(--red));
  content: "";
}

.needle-track::after {
  position: absolute;
  top: 9px;
  left: 50%;
  width: 2px;
  height: 36px;
  background: var(--ink);
  content: "";
}

.needle {
  position: absolute;
  top: 2px;
  left: calc(50% - 2px);
  width: 4px;
  height: 48px;
  border-radius: 999px;
  background: var(--red);
  transform: translateX(0);
  transition: transform 110ms ease-out;
}

.meter-copy {
  display: flex;
  justify-content: space-between;
  width: min(100%, 360px);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
}

.readouts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.readout {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
  padding: 12px;
}

.readout strong {
  display: block;
  margin-top: 4px;
  font-size: 1.45rem;
}

.string-bank,
.mode-bank,
.duration-bank {
  display: grid;
  gap: 8px;
}

.string-bank {
  grid-template-columns: repeat(6, 1fr);
}

.mode-bank {
  grid-template-columns: repeat(3, 1fr);
}

.duration-bank {
  grid-template-columns: repeat(3, 1fr);
}

.metronome-display {
  display: grid;
  gap: 14px;
  text-align: center;
}

.bpm {
  font-size: clamp(4.8rem, 28vw, 8rem);
  font-weight: 950;
  letter-spacing: 0;
  line-height: 0.85;
}

.bpm small {
  color: var(--muted);
  font-size: 1rem;
  font-weight: 900;
}

.beat-numbers {
  display: grid;
  grid-template-columns: repeat(var(--beats, 4), 1fr);
  gap: 8px;
}

.beat-number {
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #101012;
  color: var(--muted);
  font-size: 1.1rem;
  font-weight: 950;
}

.beat-number.accent {
  border-color: rgba(216, 177, 106, 0.8);
  color: var(--warm);
}

.beat-number.active {
  background: var(--red);
  color: white;
  transform: translateY(-2px);
}

.tap-button {
  width: min(74vw, 260px);
  aspect-ratio: 1;
  border: 2px solid rgba(214, 66, 52, 0.72);
  border-radius: 999px;
  background:
    radial-gradient(circle at 50% 34%, rgba(255, 255, 255, 0.12), transparent 32%),
    linear-gradient(#242428, #0c0c0d);
  color: var(--ink);
  font-size: clamp(2.4rem, 14vw, 4.2rem);
  font-weight: 950;
  letter-spacing: 0;
  margin: 0 auto;
  box-shadow: 0 24px 55px rgba(0, 0, 0, 0.38), inset 0 0 0 8px rgba(255, 255, 255, 0.03);
}

.tap-button.flash {
  background:
    radial-gradient(circle at 50% 34%, rgba(255, 255, 255, 0.22), transparent 32%),
    linear-gradient(#d64234, #5e1711);
}

.metro-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.setlist-layout {
  display: grid;
  gap: 12px;
}

.performance-stage {
  display: grid;
  height: 100%;
  grid-template-rows: auto auto auto auto minmax(0, 1fr);
  gap: 10px;
  overflow: hidden;
  border: 1px solid rgba(216, 177, 106, 0.22);
  border-radius: 18px;
  background:
    radial-gradient(circle at 84% 0, rgba(216, 177, 106, 0.16), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.018)),
    #0d0d0f;
  padding: 10px;
}

.performance-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(112px, 34%);
  gap: 10px;
  align-items: stretch;
}

.performance-song,
.performance-current,
.performance-lyrics,
.metronome-lamp {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
}

.performance-song {
  min-width: 0;
  padding: 12px;
}

.performance-song h2 {
  overflow: hidden;
  margin: 0;
  font-size: clamp(1.7rem, 8vw, 3.6rem);
  line-height: 0.96;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.performance-song p,
.performance-current span:not(.now-badge) {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 850;
}

.emergency-stop {
  min-height: 78px;
  border: 1px solid rgba(255, 210, 200, 0.34);
  border-radius: 16px;
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 255, 255, 0.2), transparent 36%),
    linear-gradient(#ff5b4e, #8f2018);
  color: white;
  font-size: clamp(1.8rem, 9vw, 3rem);
  font-weight: 950;
  letter-spacing: 0;
  box-shadow: 0 20px 42px rgba(214, 66, 52, 0.25);
}

.performance-map {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(30px, 1fr));
  gap: 5px;
  overflow: hidden;
  max-height: 116px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
  padding: 7px;
}

.performance-map .song-map-item {
  min-height: 34px;
  padding: 4px;
}

.performance-map .song-map-gap {
  display: grid;
  min-height: 34px;
  place-items: center;
  border: 1px dashed rgba(242, 240, 232, 0.22);
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 950;
}

.performance-map .song-map-item.now {
  border-color: rgba(255, 218, 128, 1);
  background: linear-gradient(180deg, rgba(216, 177, 106, 0.34), rgba(214, 66, 52, 0.18));
  box-shadow: 0 0 18px rgba(216, 177, 106, 0.3);
}

.performance-now {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(84px, 22%);
  gap: 10px;
}

.performance-current {
  display: grid;
  min-width: 0;
  gap: 7px;
  padding: 12px;
  border-color: rgba(255, 218, 128, 0.72);
  background:
    linear-gradient(90deg, rgba(216, 177, 106, 0.18), rgba(255, 255, 255, 0.035)),
    rgba(255, 255, 255, 0.04);
}

.performance-current strong {
  overflow: hidden;
  font-size: clamp(1.6rem, 8vw, 3.4rem);
  line-height: 0.98;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.performance-bars {
  margin-top: 3px;
}

.metronome-lamp {
  display: grid;
  place-items: center;
  gap: 4px;
  padding: 10px;
}

.metronome-lamp i {
  display: block;
  width: min(19vw, 74px);
  aspect-ratio: 1;
  border-radius: 999px;
  background: #321915;
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.54);
}

.metronome-lamp.on i {
  background: radial-gradient(circle at 38% 32%, #fff7d1, var(--warm) 42%, #9b4b20 76%);
  box-shadow: 0 0 30px rgba(216, 177, 106, 0.62), inset 0 0 12px rgba(255, 255, 255, 0.32);
}

.metronome-lamp.accent i {
  background: radial-gradient(circle at 38% 32%, #fff2dd, #ff6355 44%, #8e2018 78%);
  box-shadow: 0 0 34px rgba(214, 66, 52, 0.72), inset 0 0 12px rgba(255, 255, 255, 0.32);
}

.metronome-lamp span {
  color: var(--ink);
  font-size: 1.2rem;
  font-weight: 950;
}

.performance-progress {
  overflow: hidden;
  height: 11px;
  border-radius: 999px;
  background: rgba(242, 240, 232, 0.14);
}

.performance-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--red), var(--warm));
  transition: width 120ms linear;
}

.performance-lyrics {
  overflow: hidden;
  min-height: 0;
  padding: clamp(14px, 3.5vw, 26px);
  line-height: 1.28;
}

.performance-lyrics strong {
  display: block;
  margin-bottom: 0.45em;
  color: var(--ink);
  font-size: clamp(1.55rem, 6.4vw, 3.2rem);
  line-height: 1.12;
}

.performance-lyrics p {
  margin: 0.25em 0;
  color: var(--ink);
  font-size: clamp(1.28rem, 5.6vw, 2.65rem);
  font-weight: 780;
}

.arranger-panel {
  display: grid;
  gap: 14px;
}

.arranger-transport,
.arranger-library,
.arranger-lock-note,
.sync-panel,
.arranger-summary,
.arranger-now,
.song-map,
.arranger-section,
.arranger-editor,
.karaoke-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
}

.arranger-transport {
  display: grid;
  gap: 12px;
  padding: 0;
  border: 0;
  background: transparent;
}

.arranger-library {
  display: grid;
  gap: 10px;
  padding: 12px;
}

.project-program {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(216, 177, 106, 0.2);
  border-radius: 14px;
  background:
    linear-gradient(90deg, rgba(216, 177, 106, 0.09), rgba(255, 255, 255, 0.03)),
    rgba(8, 8, 9, 0.42);
  padding: 10px;
}

.project-program.locked {
  opacity: 0.72;
}

.schema-onboarding {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(216, 177, 106, 0.24);
  border-radius: 14px;
  background: rgba(216, 177, 106, 0.08);
  padding: 10px;
}

.schema-onboarding div {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 6px;
}

.schema-onboarding span:not(.mini-label) {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(8, 8, 9, 0.32);
  color: var(--muted);
  padding: 8px;
  font-size: 0.76rem;
  font-weight: 900;
}

.schema-onboarding .done {
  color: var(--green);
}

.compact-textarea {
  min-height: 58px;
  resize: vertical;
}

.program-toolbar,
.program-edit-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.program-song-list {
  display: grid;
  gap: 7px;
}

.program-song {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.24);
  padding: 6px;
}

.program-song.active {
  border-color: rgba(216, 177, 106, 0.72);
  background: rgba(216, 177, 106, 0.12);
}

.program-song-main {
  display: grid;
  min-width: 0;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 5px;
  text-align: left;
}

.program-song-main span {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--warm);
  font-size: 0.72rem;
  font-weight: 950;
}

.program-song-main strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.program-song-main em {
  color: var(--muted);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 900;
  white-space: nowrap;
}

.program-song-actions {
  display: grid;
  grid-template-columns: repeat(2, 34px);
  gap: 5px;
}

.play-song-btn {
  border-color: rgba(216, 177, 106, 0.48);
  background: rgba(216, 177, 106, 0.12);
  color: var(--warm);
}

.program-drag-handle {
  align-self: center;
  width: 34px;
  height: 34px;
  min-height: 34px;
  touch-action: none;
}

.program-song.dragging {
  opacity: 0.56;
}

.program-song.drop-before {
  box-shadow: inset 0 4px 0 rgba(255, 218, 128, 0.98), 0 0 0 2px rgba(216, 177, 106, 0.24);
}

.program-song.drop-after {
  box-shadow: inset 0 -4px 0 rgba(255, 218, 128, 0.98), 0 0 0 2px rgba(216, 177, 106, 0.24);
}

.empty.compact {
  margin: 0;
  font-size: 0.82rem;
}

.sync-panel {
  display: grid;
  gap: 12px;
  padding: 12px;
}

.sync-panel.active {
  border-color: rgba(216, 177, 106, 0.5);
  background:
    radial-gradient(circle at 100% 0, rgba(216, 177, 106, 0.14), transparent 32%),
    rgba(255, 255, 255, 0.04);
}

.sync-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
}

.sync-head h3 {
  margin: 0;
  font-size: clamp(1.15rem, 5vw, 1.8rem);
}

.sync-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.35;
}

.sync-led {
  display: block;
  width: 20px;
  aspect-ratio: 1;
  border-radius: 999px;
  background: #3a2a22;
  box-shadow: inset 0 0 8px rgba(0, 0, 0, 0.5);
}

.sync-led.ready {
  background: var(--warm);
  box-shadow: 0 0 18px rgba(216, 177, 106, 0.45), inset 0 0 8px rgba(255, 255, 255, 0.22);
}

.sync-led.on {
  background: var(--red);
  box-shadow: 0 0 22px rgba(214, 66, 52, 0.6), inset 0 0 8px rgba(255, 255, 255, 0.22);
}

.sync-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 0.8fr;
  gap: 8px;
}

.sync-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.library-sync-block .sync-actions {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.sync-transfer-block {
  display: grid;
  gap: 10px;
  border: 1px solid rgba(242, 240, 232, 0.12);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.018)),
    rgba(0, 0, 0, 0.18);
  padding: 12px;
}

.sync-transfer-block p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.35;
}

.sync-transfer-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.sync-participants {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(128px, 1fr));
  gap: 8px;
}

.sync-participant {
  display: grid;
  gap: 3px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(8, 8, 9, 0.42);
  padding: 9px;
}

.sync-participant.ready {
  border-color: rgba(102, 209, 143, 0.36);
}

.sync-participant span,
.sync-participant strong,
.sync-participant em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sync-participant span {
  color: var(--ink);
  font-weight: 950;
}

.sync-participant strong {
  color: var(--warm);
  font-size: 0.74rem;
}

.sync-participant em {
  color: var(--muted);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 800;
}

.sync-session-song {
  display: grid;
  gap: 4px;
  border: 1px solid rgba(216, 177, 106, 0.22);
  border-radius: 12px;
  background: rgba(216, 177, 106, 0.07);
  padding: 10px;
}

.sync-session-song strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sync-session-song p {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.35;
}

.sync-block {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(8, 8, 9, 0.32);
  padding: 12px;
}

.sync-block-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
}

.sync-block-head h3 {
  margin: 0;
  font-size: clamp(1.05rem, 4.8vw, 1.55rem);
}

.sync-block-head p,
.sync-note {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  line-height: 1.35;
}

.provider-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  padding: 7px 9px;
  font-size: 0.68rem;
  font-weight: 950;
  text-transform: uppercase;
  white-space: nowrap;
}

.provider-pill.connected {
  border-color: rgba(102, 209, 143, 0.48);
  color: var(--green);
}

.library-grid {
  grid-template-columns: 1fr 1fr 1.15fr;
}

.secret-field input {
  font-family: ui-monospace, "SFMono-Regular", Consolas, monospace;
  letter-spacing: 0;
}

.sync-token-note,
.sync-backup-note {
  margin: -4px 0 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1.35;
}

.sync-backup-note {
  border-left: 3px solid var(--warm);
  background: rgba(216, 177, 106, 0.07);
  padding: 8px 10px;
}

.sync-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.sync-stats div {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  padding: 10px 8px;
  text-align: center;
}

.sync-stats strong {
  display: block;
  font-size: 1.35rem;
  line-height: 1;
}

.sync-stats span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 950;
  text-transform: uppercase;
}

.sync-operation-status {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  padding: 10px;
}

.sync-operation-status i {
  width: 12px;
  height: 12px;
  margin-top: 4px;
  border-radius: 999px;
  background: var(--muted);
  box-shadow: inset 0 0 5px rgba(255, 255, 255, 0.2);
}

.sync-operation-status.busy i {
  background: var(--warm);
  box-shadow: 0 0 18px rgba(216, 177, 106, 0.55), inset 0 0 6px rgba(255, 255, 255, 0.28);
  animation: syncPulse 0.9s ease-in-out infinite;
}

.sync-operation-status.ok i {
  background: var(--green);
  box-shadow: 0 0 16px rgba(102, 209, 143, 0.45), inset 0 0 6px rgba(255, 255, 255, 0.22);
}

.sync-operation-status.warning i,
.sync-operation-status.error i {
  background: var(--red);
  box-shadow: 0 0 16px rgba(214, 66, 52, 0.42), inset 0 0 6px rgba(255, 255, 255, 0.22);
}

.sync-operation-status div {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.sync-operation-status strong,
.sync-operation-status span,
.sync-operation-status em {
  min-width: 0;
  overflow-wrap: anywhere;
}

.sync-operation-status strong {
  color: var(--ink);
  font-weight: 950;
}

.sync-operation-status span {
  color: var(--warm);
  font-size: 0.82rem;
  font-weight: 850;
  line-height: 1.35;
}

.sync-operation-status em {
  color: var(--muted);
  font-size: 0.7rem;
  font-style: normal;
  font-weight: 800;
}

.sync-result-banner {
  display: grid;
  gap: 4px;
  border: 1px solid rgba(242, 240, 232, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  padding: 12px;
}

.sync-result-banner.ok {
  border-color: rgba(102, 209, 143, 0.46);
  background: rgba(102, 209, 143, 0.1);
}

.sync-result-banner.error,
.sync-result-banner.warning {
  border-color: rgba(214, 66, 52, 0.42);
  background: rgba(214, 66, 52, 0.1);
}

.sync-result-banner strong {
  color: var(--ink);
  font-size: 1rem;
  font-weight: 950;
}

.sync-result-banner span {
  color: var(--warm);
  font-size: 0.84rem;
  font-weight: 850;
  line-height: 1.35;
}

.sync-result-banner em {
  color: var(--muted);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 800;
}

@keyframes syncPulse {
  0%,
  100% {
    transform: scale(0.92);
    opacity: 0.72;
  }

  50% {
    transform: scale(1.16);
    opacity: 1;
  }
}

.sync-note strong {
  color: var(--warm);
}

.sync-diagnostics {
  border-top: 1px solid var(--line);
  padding-top: 8px;
}

.conflict-list {
  display: grid;
  gap: 8px;
  border: 1px solid rgba(216, 177, 106, 0.34);
  border-radius: 14px;
  background: rgba(216, 177, 106, 0.08);
  padding: 10px;
}

.conflict-card {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(8, 8, 9, 0.42);
  padding: 10px;
}

.conflict-card strong,
.conflict-card span {
  display: block;
}

.conflict-card span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.conflict-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.conflict-actions .btn {
  min-height: 38px;
  padding: 8px;
  font-size: 0.72rem;
}

.revision-history {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
  padding: 10px;
}

.revision-history summary {
  color: var(--ink);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 950;
  text-transform: uppercase;
}

.revision-history-body {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.revision-history-body p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1.35;
}

.revision-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(8, 8, 9, 0.36);
  padding: 8px;
}

.revision-row strong,
.revision-row span,
.revision-row em {
  display: block;
}

.revision-row span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.revision-row em {
  margin-top: 2px;
  color: var(--warm);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 850;
}

.sync-log {
  display: grid;
  gap: 6px;
  margin-top: 10px;
}

.sync-log-row,
.sync-log-empty {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(8, 8, 9, 0.32);
  padding: 8px;
}

.sync-log-row span {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
}

.sync-log-row strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: 0.76rem;
}

.sync-log-empty {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
}

.sync-diagnostics summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 950;
  text-transform: uppercase;
}

.diagnostic-grid {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 6px 10px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.76rem;
}

.diagnostic-grid strong {
  overflow: hidden;
  color: var(--ink);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sync-modal {
  position: fixed;
  z-index: 120;
  inset: 0;
  display: grid;
  place-items: center;
  padding: max(18px, env(safe-area-inset-top)) 14px max(18px, env(safe-area-inset-bottom));
}

.sync-modal-backdrop {
  position: absolute;
  inset: 0;
  width: 100%;
  min-height: 100%;
  border: 0;
  border-radius: 0;
  background: rgba(4, 4, 5, 0.62);
  backdrop-filter: blur(14px);
}

.sync-dialog {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 12px;
  width: min(100%, 720px);
  max-height: min(86vh, 760px);
  overflow: auto;
  border: 1px solid rgba(242, 240, 232, 0.18);
  border-radius: 18px;
  background:
    radial-gradient(circle at 100% 0, rgba(216, 177, 106, 0.16), transparent 32%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.028)),
    #111113;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.66);
  padding: 14px;
}

.sync-modal-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.sync-modal-head h2 {
  margin: 0;
  font-size: clamp(1.35rem, 6vw, 2.2rem);
}

.sync-modal-close {
  flex: 0 0 auto;
}

.sync-dialog .sync-panel {
  border-color: rgba(242, 240, 232, 0.12);
  background: rgba(255, 255, 255, 0.035);
}

.transport-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 14px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.02)),
    rgba(255, 255, 255, 0.035);
  padding: 12px;
}

.arranger-transport.split {
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.18fr);
}

.arranger-lock-note {
  display: none;
  border-color: rgba(216, 177, 106, 0.58);
  background: rgba(216, 177, 106, 0.11);
  color: var(--warm);
  padding: 10px 12px;
  font-size: 0.82rem;
  font-weight: 900;
}

.arranger-lock-note.show {
  display: block;
}

.arranger-song-title {
  min-width: 0;
}

.arranger-metro {
  display: grid;
  gap: 10px;
}

.mini-beats {
  display: grid;
  grid-template-columns: repeat(var(--beats, 4), 1fr);
  gap: 6px;
}

.mini-beat {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #101012;
  color: var(--muted);
  font-weight: 950;
}

.mini-beat.accent {
  border-color: rgba(216, 177, 106, 0.78);
  color: var(--warm);
}

.mini-beat.active {
  background: var(--red);
  color: white;
  transform: translateY(-2px);
}

.arranger-bpm {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.arranger-bpm span {
  color: var(--muted);
  font-weight: 950;
}

.arranger-tap {
  min-height: 52px;
  border: 1px solid rgba(214, 66, 52, 0.62);
  border-radius: 14px;
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 255, 255, 0.1), transparent 36%),
    linear-gradient(#2b2b2f, #121214);
  color: var(--ink);
  font-size: 1.05rem;
  font-weight: 950;
  letter-spacing: 0;
  box-shadow: inset 0 0 0 5px rgba(255, 255, 255, 0.025);
}

.arranger-tap:active {
  transform: translateY(1px);
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 255, 255, 0.16), transparent 36%),
    linear-gradient(#d64234, #681c15);
}

.arranger-tap:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.arranger-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 12px;
  text-align: center;
}

.arranger-summary strong {
  display: block;
  font-size: clamp(1.8rem, 8vw, 3rem);
  line-height: 0.95;
}

.arranger-summary span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.arranger-now {
  position: sticky;
  top: max(8px, env(safe-area-inset-top));
  z-index: 8;
  display: grid;
  gap: 10px;
  padding: 12px;
  background:
    radial-gradient(circle at 100% 0, rgba(214, 66, 52, 0.24), transparent 34%),
    rgba(15, 15, 17, 0.96);
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(14px);
}

.arranger-now.playing {
  border-color: rgba(214, 66, 52, 0.82);
}

.arranger-now strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: clamp(1.45rem, 7vw, 2.4rem);
  line-height: 1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.arranger-now p,
.save-note {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.playhead-meter {
  overflow: hidden;
  height: 10px;
  border-radius: 99px;
  background: rgba(242, 240, 232, 0.14);
}

.playhead-meter span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--red), var(--warm));
  transition: width 120ms linear;
}

.song-map {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(46px, 1fr));
  gap: 6px;
  padding: 8px;
}

.song-map-item {
  display: grid;
  min-width: 0;
  min-height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(8, 8, 9, 0.58);
  color: var(--muted);
  padding: 5px;
}

.song-map-item.now {
  border-color: rgba(216, 177, 106, 0.9);
  background: rgba(216, 177, 106, 0.16);
  color: var(--ink);
}

.song-map-item span {
  font-size: 0.62rem;
  font-weight: 950;
}

.song-map-item strong {
  overflow: hidden;
  max-width: 100%;
  font-size: 0.72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.arranger-layout {
  display: grid;
  gap: 14px;
}

.arranger-board {
  display: grid;
  gap: 10px;
}

.arranger-section {
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: stretch;
  padding: 8px;
}

.arranger-section.active {
  border-color: rgba(214, 66, 52, 0.72);
  background: var(--red-soft);
}

.arranger-section.now {
  border-color: rgba(255, 218, 128, 0.98);
  background:
    linear-gradient(90deg, rgba(216, 177, 106, 0.24), rgba(214, 66, 52, 0.09) 38%, rgba(255, 255, 255, 0.04)),
    rgba(255, 255, 255, 0.035);
  box-shadow:
    0 0 0 2px rgba(216, 177, 106, 0.38),
    0 0 34px rgba(216, 177, 106, 0.22),
    0 16px 34px rgba(0, 0, 0, 0.32);
}

.arranger-section.now::before {
  position: absolute;
  inset: 0 auto 0 0;
  width: 8px;
  background: linear-gradient(180deg, var(--warm), var(--red));
  content: "";
}

.arranger-section.now::after {
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, rgba(216, 177, 106, 0.18), transparent 42%);
  pointer-events: none;
  content: "";
}

.arranger-now.playing + .song-map + .arranger-layout .arranger-section.now {
  animation: current-section-pulse 1.05s ease-in-out infinite alternate;
}

.arranger-section.dragging {
  opacity: 0.55;
  transform: scale(0.992);
}

.arranger-section.locked {
  cursor: default;
}

.arranger-section.drop-before {
  box-shadow:
    inset 0 4px 0 rgba(255, 218, 128, 0.98),
    0 0 0 2px rgba(216, 177, 106, 0.28),
    0 16px 34px rgba(0, 0, 0, 0.32);
}

.arranger-section.drop-after {
  box-shadow:
    inset 0 -4px 0 rgba(255, 218, 128, 0.98),
    0 0 0 2px rgba(216, 177, 106, 0.28),
    0 16px 34px rgba(0, 0, 0, 0.32);
}

.section-dragging-active,
.section-dragging-active * {
  cursor: grabbing !important;
  user-select: none;
}

.section-card {
  position: relative;
  z-index: 1;
  display: grid;
  min-width: 0;
  gap: 6px;
  padding: 10px;
  border: 0;
  border-radius: 10px;
  background: rgba(10, 10, 11, 0.58);
  color: var(--ink);
  text-align: left;
}

.section-card:disabled,
.song-map-item:disabled {
  cursor: default;
}

.section-card strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 1rem;
}

.section-card span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.section-card .section-type {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--warm);
  font-size: 0.68rem;
  text-transform: uppercase;
}

.now-badge {
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: linear-gradient(#d64234, #7a1f17);
  color: white;
  padding: 4px 7px;
  font-size: 0.62rem;
  letter-spacing: 0;
}

.bar-strip {
  display: grid;
  grid-template-columns: repeat(var(--bars, 4), 1fr);
  gap: 3px;
  margin-top: 2px;
}

.bar-strip i {
  display: block;
  min-height: 8px;
  border-radius: 99px;
  background: rgba(242, 240, 232, 0.2);
}

.arranger-section.active .bar-strip i {
  background: rgba(214, 66, 52, 0.9);
}

.bar-strip i.played {
  background: rgba(216, 177, 106, 0.55);
}

.bar-strip i.current {
  min-height: 14px;
  background: #fff1bd;
  box-shadow: 0 0 0 2px rgba(216, 177, 106, 0.3), 0 0 20px rgba(255, 241, 189, 0.72);
}

.arranger-section.now .bar-strip i.current {
  background: #fff1bd;
  box-shadow: 0 0 0 2px rgba(216, 177, 106, 0.34), 0 0 22px rgba(255, 241, 189, 0.82);
}

@keyframes current-section-pulse {
  from {
    box-shadow:
      0 0 0 2px rgba(216, 177, 106, 0.32),
      0 0 24px rgba(216, 177, 106, 0.18),
      0 16px 34px rgba(0, 0, 0, 0.32);
  }
  to {
    box-shadow:
      0 0 0 3px rgba(255, 218, 128, 0.62),
      0 0 42px rgba(216, 177, 106, 0.34),
      0 16px 34px rgba(0, 0, 0, 0.32);
  }
}

.section-actions {
  display: grid;
  grid-template-columns: repeat(3, 40px);
  gap: 6px;
  align-content: center;
}

.section-actions .icon-btn {
  align-self: center;
  height: 40px;
}

.drag-handle {
  touch-action: none;
  cursor: grab;
}

.drag-handle:not(:disabled) {
  border-color: rgba(216, 177, 106, 0.45);
  background: rgba(216, 177, 106, 0.12);
  color: var(--warm);
}

.arranger-editor {
  display: grid;
  gap: 12px;
  padding: 12px;
}

.section-title.compact {
  margin-bottom: 0;
}

.section-title.compact h3 {
  margin: 0;
  font-size: 1.1rem;
}

.arranger-add {
  grid-template-columns: 1fr 90px;
}

.karaoke-card {
  display: grid;
  gap: 8px;
  padding: 14px;
  line-height: 1.45;
}

.karaoke-card strong {
  color: var(--ink);
  font-size: 1.08rem;
}

.karaoke-card span:not(.mini-label) {
  color: var(--muted);
}

.program-row,
.song-row,
.lyrics-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
  padding: 12px;
}

.program-row.active,
.song-row.active,
.lyrics-row.active {
  border-color: rgba(214, 66, 52, 0.68);
  background: var(--red-soft);
}

.row-title {
  min-width: 0;
}

.row-title strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-title span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.82rem;
}

.inline-actions {
  display: flex;
  gap: 6px;
}

.sync-open-btn {
  display: inline-grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 7px;
}

.sync-open-btn.active {
  border-color: rgba(216, 177, 106, 0.58);
  color: var(--warm);
}

.sync-dot {
  display: block;
  width: 9px;
  aspect-ratio: 1;
  border-radius: 999px;
  background: var(--dim);
}

.sync-open-btn.active .sync-dot {
  background: var(--warm);
  box-shadow: 0 0 12px rgba(216, 177, 106, 0.52);
}

.icon-btn {
  display: grid;
  width: 40px;
  min-height: 40px;
  place-items: center;
  padding: 0;
}

.icon-btn:disabled {
  cursor: not-allowed;
  opacity: 0.38;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 96px;
  gap: 8px;
}

.markdown-preview {
  overflow: auto;
  max-height: 42vh;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
  padding: 14px;
  line-height: 1.55;
}

.markdown-preview h1,
.markdown-preview h2,
.markdown-preview h3 {
  margin: 0.7em 0 0.35em;
}

.markdown-preview p,
.markdown-preview ul,
.markdown-preview ol {
  margin: 0.5em 0;
}

.empty {
  border: 1px dashed rgba(242, 240, 232, 0.22);
  border-radius: 14px;
  color: var(--muted);
  padding: 18px;
  text-align: center;
}

.recorder-layout {
  display: grid;
  gap: 14px;
}

.recorder-display {
  display: grid;
  place-items: center;
  gap: 10px;
  min-height: 260px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background:
    radial-gradient(circle at 50% 38%, rgba(214, 66, 52, 0.16), transparent 34%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.065), rgba(255, 255, 255, 0.02)),
    #101012;
  text-align: center;
}

.record-ring {
  display: grid;
  width: min(54vw, 180px);
  aspect-ratio: 1;
  place-items: center;
  border: 2px solid rgba(242, 240, 232, 0.16);
  border-radius: 999px;
  background: linear-gradient(#202024, #0c0c0d);
  box-shadow: inset 0 0 0 10px rgba(255, 255, 255, 0.03), 0 18px 42px rgba(0, 0, 0, 0.36);
}

.record-ring span {
  display: block;
  width: 42%;
  aspect-ratio: 1;
  border-radius: 999px;
  background: var(--dim);
}

.record-ring.recording {
  border-color: rgba(214, 66, 52, 0.86);
  box-shadow: 0 0 42px rgba(214, 66, 52, 0.24), inset 0 0 0 10px rgba(255, 255, 255, 0.03);
}

.record-ring.recording span {
  background: var(--red);
}

.recorder-display strong {
  font-size: clamp(3rem, 16vw, 5rem);
  line-height: 0.9;
}

.recorder-display p {
  margin: 0;
  color: var(--muted);
  font-weight: 800;
}

.recording-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.035);
  padding: 12px;
}

#recordingPlayer {
  width: 100%;
}

@media (min-width: 760px) {
  .module-panel {
    padding: 22px;
  }

  .arranger-transport {
    grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.18fr);
    align-items: end;
  }

  .arranger-library {
    grid-template-columns: 1fr auto;
    align-items: end;
  }

  .arranger-metro {
    grid-template-columns: 1fr 110px 86px auto;
    align-items: end;
  }

  .arranger-layout {
    grid-template-columns: 1.08fr 0.92fr;
    align-items: start;
  }

  .setlist-layout,
  .lyrics-layout {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 14px;
    align-items: start;
  }

  .recorder-layout {
    grid-template-columns: 300px 1fr;
    align-items: start;
  }
}

@media (max-width: 420px) {
  .app-shell {
    padding-right: 10px;
    padding-left: 10px;
  }

  .module-panel {
    border-radius: 16px;
    padding: 13px;
  }

  .brand h1 {
    font-size: 1.8rem;
  }

  .bottom-nav {
    gap: 5px;
    width: calc(100% - 20px);
    padding: 6px;
  }

  .nav-btn {
    min-height: 54px;
    font-size: 0.5rem;
  }

  .nav-btn svg {
    width: 18px;
    height: 18px;
  }

  .string-bank {
    grid-template-columns: repeat(3, 1fr);
  }

  .duration-bank,
  .mode-bank {
    grid-template-columns: 1fr;
  }

  .metro-controls,
  .readouts,
  .form-grid,
  .sync-grid,
  .arranger-add {
    grid-template-columns: 1fr;
  }

  .sync-actions {
    grid-template-columns: 1fr;
  }

  .library-sync-block .sync-actions,
  .sync-transfer-actions,
  .conflict-actions {
    grid-template-columns: 1fr;
  }

  .revision-row {
    grid-template-columns: 1fr;
  }

  .sync-block-head,
  .library-grid {
    grid-template-columns: 1fr;
  }

  .provider-pill {
    justify-self: start;
  }

  .sync-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .arranger-summary {
    padding: 10px 8px;
  }

  .arranger-panel > .section-title {
    display: grid;
    gap: 10px;
  }

  .arranger-panel > .section-title .inline-actions {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .program-toolbar,
  .program-edit-row {
    grid-template-columns: 1fr;
  }

  .program-toolbar .inline-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .program-song-main {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .program-song-main em {
    grid-column: 2;
  }

  .arranger-transport.split {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .schema-floating-actions {
    bottom: calc(82px + max(10px, env(safe-area-inset-bottom)));
    grid-template-columns: 1fr;
  }

  .transport-card {
    padding: 9px;
  }

  .arranger-metro {
    gap: 7px;
    grid-template-columns: minmax(0, 1fr) minmax(74px, 0.72fr);
    align-items: stretch;
  }

  .arranger-metro .mini-beats {
    grid-column: 1 / -1;
  }

  .arranger-bpm {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .arranger-tap {
    min-height: 48px;
  }

  #arrangerSound {
    grid-column: 1 / -1;
    min-height: 40px;
  }

  .section-actions {
    grid-template-columns: repeat(3, 34px);
  }

  .section-actions .icon-btn {
    width: 34px;
    height: 34px;
    min-height: 34px;
  }
}
