:root {
  color-scheme: dark;
  --ink: #fff9fd;
  --muted: #c6bdcf;
  --soft: #8f849f;
  --line: rgba(255, 255, 255, 0.11);
  --paper: #09080d;
  --panel: #17131d;
  --panel-strong: #211a2a;
  --panel-soft: #111017;
  --deep: #0b0a10;
  --pink: #ff6fa8;
  --pink-hot: #ff4f93;
  --lilac: #b68cff;
  --mint: #53f0c3;
  --sun: #ffd66d;
  --blue: #7ca8ff;
  --danger: #ff7a8a;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.36);
  --glow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 14px 34px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    linear-gradient(135deg, rgba(255, 111, 168, 0.13), transparent 24%),
    linear-gradient(210deg, rgba(83, 240, 195, 0.1), transparent 32%),
    linear-gradient(180deg, #130f1b 0%, #09080d 46%, #0f1014 100%);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Hiragino Sans", "Yu Gothic", sans-serif;
  letter-spacing: 0;
}

body::before {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background-image: linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 100% 46px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.78), transparent 78%);
}

button,
input,
select {
  font: inherit;
  letter-spacing: 0;
}

button,
select,
input[type="checkbox"],
input[type="range"] {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--mint);
  outline-offset: 2px;
}

::selection {
  background: rgba(255, 111, 168, 0.38);
}

.appbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 76px;
  padding: 13px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(9, 8, 13, 0.82);
  backdrop-filter: blur(18px) saturate(140%);
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 14px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border-radius: 50%;
  background:
    linear-gradient(145deg, var(--pink), var(--lilac) 52%, var(--mint)),
    var(--pink);
  color: #100b14;
  font-weight: 950;
  box-shadow: 0 12px 28px rgba(255, 111, 168, 0.34);
}

.brand h1 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 20px;
  line-height: 1.1;
}

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

.app-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.primary-button,
.ghost-button,
.variant-tabs button {
  min-height: 40px;
  border: 0;
  border-radius: 9999px;
  padding: 0 16px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 850;
  transition:
    transform 0.18s ease,
    background 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease;
}

.primary-button {
  background: var(--mint);
  color: #06120f;
  box-shadow: 0 12px 24px rgba(83, 240, 195, 0.24);
}

.primary-button:hover,
.ghost-button:hover,
.variant-tabs button:hover {
  transform: translateY(-1px);
}

.primary-button:disabled,
.ghost-button:disabled {
  cursor: not-allowed;
  opacity: 0.42;
  transform: none;
  box-shadow: inset 0 0 0 1px var(--line);
}

.ghost-button,
.variant-tabs button {
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
}

.primary-button.is-dirty {
  background: var(--pink);
  color: #160810;
  box-shadow: 0 12px 24px rgba(255, 111, 168, 0.25);
}

.primary-button.was-clicked,
.ghost-button.was-clicked {
  animation: button-pop 0.28s ease;
}

.action-feedback {
  min-width: 10em;
  color: var(--mint);
  font-size: 12px;
  font-weight: 900;
  opacity: 0;
  transform: translateY(4px);
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
  text-align: right;
}

.action-feedback.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@keyframes button-pop {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(0.96);
  }
  100% {
    transform: scale(1);
  }
}

.workspace {
  display: grid;
  grid-template-columns: minmax(292px, 348px) minmax(0, 1fr);
  min-height: calc(100vh - 76px);
}

.control-panel {
  border-right: 1px solid var(--line);
  background: rgba(13, 12, 18, 0.72);
  padding: 18px;
  backdrop-filter: blur(10px);
}

.control-section {
  padding: 16px 0 18px;
  border-bottom: 1px solid var(--line);
}

.control-section:first-child {
  padding-top: 0;
}

.control-section h2 {
  margin: 0 0 14px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
}

.field,
.range-field,
.switch-row {
  display: grid;
  gap: 8px;
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.field input,
.field select {
  width: 100%;
  min-height: 42px;
  border: 0;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
  padding: 0 14px;
}

.field select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 18px,
    calc(100% - 12px) 18px;
  background-size:
    6px 6px,
    6px 6px;
  background-repeat: no-repeat;
}

.field select option {
  background: var(--panel);
  color: var(--ink);
}

.range-field span,
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.range-field output {
  min-width: 32px;
  color: var(--ink);
  text-align: right;
}

input[type="range"] {
  width: 100%;
  accent-color: var(--pink);
}

input[type="checkbox"] {
  position: relative;
  width: 46px;
  height: 26px;
  appearance: none;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 0 0 1px var(--line);
  transition:
    background 0.18s ease,
    box-shadow 0.18s ease;
}

input[type="checkbox"]::after {
  position: absolute;
  top: 4px;
  left: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  content: "";
  background: var(--muted);
  transition:
    transform 0.18s ease,
    background 0.18s ease;
}

input[type="checkbox"]:checked {
  background: rgba(83, 240, 195, 0.24);
  box-shadow: inset 0 0 0 1px rgba(83, 240, 195, 0.52);
}

input[type="checkbox"]:checked::after {
  transform: translateX(20px);
  background: var(--mint);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.segmented legend {
  grid-column: 1 / -1;
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.segmented label {
  position: relative;
}

.segmented input {
  position: absolute;
  inset: 0;
  opacity: 0;
}

.segmented span {
  display: grid;
  place-items: center;
  min-height: 38px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--muted);
  box-shadow: inset 0 0 0 1px var(--line);
  font-size: 12px;
  font-weight: 850;
  transition:
    background 0.18s ease,
    color 0.18s ease,
    box-shadow 0.18s ease;
}

.segmented input:checked + span {
  background: rgba(255, 111, 168, 0.18);
  color: var(--ink);
  box-shadow:
    inset 0 0 0 1px rgba(255, 111, 168, 0.55),
    0 8px 18px rgba(255, 111, 168, 0.14);
}

.must-song-list {
  display: grid;
  gap: 8px;
  max-height: 390px;
  overflow: auto;
  padding-right: 2px;
}

.must-song-row {
  display: grid;
  gap: 8px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.055);
  box-shadow: inset 0 0 0 1px var(--line);
  padding: 9px;
  transition:
    background 0.18s ease,
    box-shadow 0.18s ease;
}

.must-song-row.is-selected {
  background: rgba(255, 111, 168, 0.12);
  box-shadow: inset 0 0 0 1px rgba(255, 111, 168, 0.44);
}

.must-song-check {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 850;
}

.must-song-check span {
  overflow-wrap: anywhere;
}

.must-song-check input[type="checkbox"] {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.12);
}

.must-song-check input[type="checkbox"]::after {
  top: 5px;
  left: 5px;
  width: 10px;
  height: 6px;
  border: 0;
  border-bottom: 2px solid #06120f;
  border-left: 2px solid #06120f;
  border-radius: 0;
  background: transparent;
  opacity: 0;
  transform: rotate(-45deg);
}

.must-song-check input[type="checkbox"]:checked {
  background: var(--mint);
  box-shadow: 0 8px 18px rgba(83, 240, 195, 0.2);
}

.must-song-check input[type="checkbox"]:checked::after {
  opacity: 1;
  transform: rotate(-45deg);
}

.must-song-row select {
  min-height: 34px;
  border: 0;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
  padding: 0 11px;
  font-size: 12px;
  font-weight: 750;
}

.must-song-row select:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.must-song-row select option {
  background: var(--panel);
  color: var(--ink);
}

.result-area {
  min-width: 0;
  padding: 18px;
}

.result-topline {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--pink);
  font-size: 12px;
  font-weight: 950;
}

.result-topline h2 {
  margin: 0;
  overflow-wrap: anywhere;
  font-size: 26px;
  line-height: 1.1;
}

.active-plan-note {
  min-height: 20px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.active-plan-note.is-dirty {
  color: var(--pink);
}

.variant-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.variant-tabs button[aria-selected="true"] {
  background: var(--ink);
  color: var(--deep);
  box-shadow:
    inset 0 -3px 0 var(--pink),
    0 10px 22px rgba(255, 249, 253, 0.08);
}

.result-area.plan-switched {
  animation: plan-flash 0.42s ease;
}

@keyframes plan-flash {
  0% {
    background: rgba(255, 111, 168, 0.1);
  }
  100% {
    background: transparent;
  }
}

.stage-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  gap: 18px;
  align-items: start;
}

.setlist-board {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr));
  gap: 14px;
}

.block-card {
  overflow: hidden;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(33, 26, 42, 0.96), rgba(20, 17, 25, 0.96));
  box-shadow: var(--glow);
}

.block-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--line);
}

.block-card h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 900;
}

.block-card p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
}

.block-time {
  flex: 0 0 auto;
  border-radius: 9999px;
  background: rgba(83, 240, 195, 0.14);
  color: var(--mint);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 950;
}

.block-items {
  display: grid;
  gap: 1px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.run-item {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 58px;
  padding: 9px 12px;
  background: rgba(255, 255, 255, 0.045);
  cursor: grab;
  transition:
    background 0.18s ease,
    box-shadow 0.18s ease,
    opacity 0.18s ease,
    transform 0.18s ease;
}

.run-item:nth-child(even) {
  background: rgba(255, 255, 255, 0.065);
}

.run-item .seq {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 11px;
  font-weight: 950;
}

.run-item.song .seq {
  background: rgba(83, 240, 195, 0.14);
  color: var(--mint);
}

.run-item.is-main {
  background:
    linear-gradient(90deg, rgba(255, 111, 168, 0.22), transparent 46%),
    rgba(255, 255, 255, 0.06);
}

.run-item.is-main .seq {
  background: var(--pink);
  color: #180a12;
  box-shadow: 0 8px 22px rgba(255, 111, 168, 0.3);
}

.run-item.is-main .run-title {
  color: #ffd7e6;
}

.run-item.is-locked {
  background:
    linear-gradient(90deg, rgba(182, 140, 255, 0.19), transparent 48%),
    rgba(255, 255, 255, 0.055);
}

.run-item.is-locked .seq {
  box-shadow: 0 0 0 2px rgba(182, 140, 255, 0.24);
}

.run-item.is-dragging {
  cursor: grabbing;
  opacity: 0.5;
  transform: scale(0.99);
}

.run-item.is-drop-target,
.block-items.is-drop-target {
  box-shadow: inset 0 0 0 2px rgba(83, 240, 195, 0.72);
}

.run-item.cover .seq {
  background: rgba(182, 140, 255, 0.16);
  color: var(--lilac);
}

.run-item.transition .seq {
  background: rgba(255, 214, 109, 0.16);
  color: var(--sun);
}

.run-main {
  min-width: 0;
}

.run-title {
  display: block;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}

.run-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 11px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  border-radius: 9999px;
  padding: 0 7px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
}

.run-duration {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

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

.insight-panel > section,
.metric-strip {
  overflow: hidden;
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(33, 26, 42, 0.92), rgba(18, 16, 23, 0.96));
  box-shadow: var(--glow);
}

.metric-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.metric {
  min-height: 82px;
  padding: 13px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.metric:nth-child(2n) {
  border-right: 0;
}

.metric:nth-last-child(-n + 2) {
  border-bottom: 0;
}

.metric span {
  display: block;
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.metric strong {
  display: block;
  margin-top: 6px;
  color: var(--ink);
  font-size: 22px;
}

.energy-section,
.insight-panel > section:not(.metric-strip) {
  padding: 13px;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.section-heading h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 900;
}

.section-heading span {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: right;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 8px;
  background: #100f16;
  box-shadow: inset 0 0 0 1px var(--line);
}

.costume-table,
.change-plan-table {
  display: grid;
  gap: 8px;
}

.change-plan-row {
  display: grid;
  grid-template-columns: minmax(92px, 0.9fr) minmax(90px, 1fr) minmax(120px, 1.2fr) minmax(130px, 1.3fr);
  gap: 6px;
  align-items: stretch;
}

.change-plan-row strong,
.change-plan-cell {
  min-height: 34px;
  border-radius: 6px;
  padding: 8px;
  overflow-wrap: anywhere;
  font-size: 11px;
}

.change-plan-row strong {
  background: rgba(255, 255, 255, 0.1);
  color: var(--ink);
}

.change-plan-cell {
  background: rgba(255, 255, 255, 0.06);
  color: var(--muted);
  font-weight: 700;
  line-height: 1.45;
}

.change-plan-cell.is-change {
  background: rgba(83, 240, 195, 0.13);
  color: #caffe9;
}

.reason-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.reason-list li {
  border-left: 3px solid var(--pink);
  padding: 2px 0 2px 9px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.unused-song-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.unused-song,
.unused-empty {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  padding: 0 9px;
  overflow-wrap: anywhere;
  font-size: 12px;
  font-weight: 800;
}

.unused-empty {
  color: var(--mint);
}

@media (max-width: 1180px) {
  .stage-layout {
    grid-template-columns: 1fr;
  }

  .insight-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-strip {
    grid-column: 1 / -1;
  }
}

@media (max-width: 860px) {
  .appbar,
  .result-topline {
    align-items: stretch;
    flex-direction: column;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .control-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .setlist-board,
  .insight-panel {
    grid-template-columns: 1fr;
  }

  .variant-tabs,
  .app-actions {
    justify-content: stretch;
  }

  .app-actions {
    flex-wrap: wrap;
  }

  .action-feedback {
    flex: 1 0 100%;
    min-width: 0;
    text-align: left;
  }

  .variant-tabs button,
  .app-actions button {
    flex: 1 1 0;
  }
}

@media (max-width: 520px) {
  .appbar,
  .control-panel,
  .result-area {
    padding: 14px;
  }

  .brand {
    align-items: flex-start;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
  }

  .brand h1 {
    font-size: 17px;
  }

  .segmented {
    grid-template-columns: 1fr;
  }

  .run-item {
    grid-template-columns: 36px minmax(0, 1fr);
  }

  .run-duration {
    grid-column: 2;
  }

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