body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(1200px 650px at 15% -20%, rgba(45, 112, 255, 0.22), transparent 60%),
    radial-gradient(900px 600px at 90% 120%, rgba(255, 138, 37, 0.14), transparent 60%),
    #070d17;
  color: #eef4ff;
}

.app-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid rgba(91, 127, 194, 0.28);
  background: rgba(8, 13, 22, 0.72);
  backdrop-filter: blur(6px);
  position: relative;
  z-index: 800;
}

.ligo-tool-chooser-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 32px;
  border: 1px solid transparent;
  background: transparent;
  color: #d5e0ff;
  border-radius: 7px;
  padding: 6px 9px;
  cursor: pointer;
}

.ligo-tool-chooser-btn img {
  width: auto;
  height: 22px;
  object-fit: contain;
  display: block;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

.ligo-tool-chooser-btn:hover {
  border-color: #2a3348;
  background: #1c2332;
}

.ligo-app-switcher {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.ligo-app-switcher::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  height: 10px;
}

.ligo-app-switcher-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 194px;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(20, 20, 20, 0.96);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.45);
  display: none;
  flex-direction: column;
  gap: 6px;
  z-index: 1200;
}

.ligo-app-switcher:hover .ligo-app-switcher-menu,
.ligo-app-switcher:focus-within .ligo-app-switcher-menu {
  display: flex;
}

.ligo-app-switcher-link {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 56px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: #eaf0ff;
  text-decoration: none;
}

.ligo-app-switcher-link:hover {
  border-color: #6ba8ff;
  background: rgba(107, 168, 255, 0.12);
}

.ligo-app-switcher-link img {
  max-width: 170px;
  max-height: 44px;
  width: auto;
  height: auto;
  display: block;
}

.ligo-app-switcher-link-fallback {
  font-size: 0.86rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.tool-header-logo {
  height: 36px;
  width: auto;
  max-width: min(50vw, 340px);
  display: block;
  object-fit: contain;
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

.app-subtitle {
  margin-left: auto;
  color: #8ca4d6;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.container {
  padding: 18px 16px;
  max-width: 980px;
}

.card {
  border: 1px solid rgba(74, 104, 168, 0.34);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(15, 24, 40, 0.92) 0%, rgba(9, 15, 27, 0.95) 100%);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow:
    inset 0 1px 0 rgba(148, 187, 255, 0.14),
    0 14px 26px rgba(0, 0, 0, 0.4);
}

.card-premium {
  position: relative;
  overflow: hidden;
}

.card-premium::before {
  content: "";
  position: absolute;
  left: -20%;
  right: -20%;
  top: -130px;
  height: 170px;
  background: radial-gradient(closest-side, rgba(79, 136, 255, 0.16), transparent 72%);
  pointer-events: none;
}

.section-title {
  margin: 0 0 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 21px;
  line-height: 1.2;
  letter-spacing: 0.01em;
}

.step-pill {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: #dfeeff;
  border: 1px solid rgba(136, 174, 242, 0.8);
  box-shadow: inset 0 0 0 1px rgba(180, 206, 255, 0.25);
}

.step-one {
  background: linear-gradient(180deg, #1f66ff 0%, #0942bc 100%);
}

.step-two {
  background: linear-gradient(180deg, #f7a527 0%, #cb6e00 100%);
}

.controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.controls button {
  flex: 0 0 auto;
}

button {
  font-family: inherit;
  border: 1px solid #3e5f9e;
  background: #204379;
  color: #eef4ff;
  border-radius: 9px;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

button:hover:not(:disabled) {
  border-color: #76a6ff;
  transform: translateY(-1px);
}

button.secondary {
  background: rgba(20, 31, 53, 0.7);
  border-color: rgba(74, 96, 137, 0.8);
}

button.secondary.toggle-btn.active {
  border-color: #66a2ff;
  background: linear-gradient(180deg, rgba(53, 118, 245, 0.45) 0%, rgba(40, 85, 175, 0.45) 100%);
  color: #eef4ff;
  box-shadow: 0 0 0 1px rgba(146, 187, 255, 0.25);
}

button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
  transform: none;
}

.btn-premium {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  display: inline-block;
  flex: 0 0 auto;
  background: currentColor;
  opacity: 0.96;
}

.icon-load {
  width: 44px;
  height: 44px;
  background: var(--synctrace-load-icon, url("../static/load_sequence.png")) center / contain no-repeat;
}

.icon-generate {
  width: 42px;
  height: 42px;
  background: var(--synctrace-generate-icon, url("../static/create_sequence.png")) center / contain no-repeat;
}

.btn-load {
  min-width: 294px;
  justify-content: center;
  background: linear-gradient(180deg, #2d7dff 0%, #1f4fba 100%);
  border-color: rgba(113, 162, 255, 0.92);
  box-shadow:
    inset 0 1px 0 rgba(197, 220, 255, 0.4),
    0 8px 18px rgba(21, 74, 180, 0.38);
}

.btn-generate {
  justify-content: center;
  min-width: 288px;
  background: linear-gradient(90deg, #1f74ff 0%, #ff9f1c 100%);
  border-color: rgba(136, 172, 255, 0.9);
  box-shadow:
    inset 0 1px 0 rgba(255, 238, 204, 0.25),
    0 10px 20px rgba(17, 53, 128, 0.45);
}

.sequence-input-row {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(280px, 1.6fr);
  gap: 12px;
}

.drop-area {
  margin-top: 0;
  border: 1px solid rgba(80, 106, 153, 0.65);
  border-radius: 10px;
  padding: 12px;
  text-align: center;
  color: #acc4f2;
  background: rgba(10, 18, 33, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 56px;
}

.drop-icon {
  width: 56px;
  height: 56px;
  display: inline-block;
  flex: 0 0 auto;
  background: var(--synctrace-drag-icon, url("../static/icon_drag.png")) center / 130% no-repeat;
  opacity: 0.96;
  transform: translateY(4px);
}

.drop-area.drag-over {
  border-color: #80b6ff;
  background: rgba(25, 46, 83, 0.9);
  box-shadow: inset 0 0 0 1px rgba(125, 173, 255, 0.22);
}

.sequence-selection {
  margin-top: 12px;
  border: 1px solid rgba(68, 91, 132, 0.75);
  border-radius: 10px;
  background: rgba(8, 15, 28, 0.78);
  padding: 10px 12px;
}

.sequence-selection-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #8eaadf;
}

.sequence-selection-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sequence-selection-name {
  margin-top: 4px;
  font-size: 20px;
  color: #eef4ff;
  font-weight: 700;
  letter-spacing: 0.01em;
  overflow-wrap: anywhere;
}

.selection-check {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid rgba(88, 140, 245, 0.85);
  box-shadow: inset 0 0 0 1px rgba(144, 187, 255, 0.28);
  position: relative;
}

.selection-check::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 3px;
  width: 6px;
  height: 11px;
  border-right: 2px solid #7eb3ff;
  border-bottom: 2px solid #7eb3ff;
  transform: rotate(40deg);
}

.pipeline-progress {
  margin-top: 14px;
}

.pipeline-progress-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  font-weight: 600;
  color: #c0d2f5;
}

.pipeline-progress-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}

.pipeline-progress-track {
  margin-top: 6px;
  width: 100%;
  height: 12px;
  border-radius: 999px;
  background: rgba(7, 14, 26, 0.85);
  border: 1px solid rgba(70, 95, 141, 0.86);
  overflow: hidden;
}

.pipeline-progress-fill {
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #2674ff 0%, #5ea0ff 45%, #ff9819 100%);
  transition: width 280ms ease;
  position: relative;
}

.pipeline-progress.is-running .pipeline-progress-fill::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 20%, rgba(255, 255, 255, 0.22) 50%, transparent 80%);
  animation: synctrace-progress-scan 1.1s linear infinite;
}

@keyframes synctrace-progress-scan {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}

.pipeline-progress-done {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 1px solid rgba(240, 170, 60, 0.9);
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(255, 214, 151, 0.3);
}

.pipeline-progress-done::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 3px;
  width: 5px;
  height: 9px;
  border-right: 2px solid #ffbe62;
  border-bottom: 2px solid #ffbe62;
  transform: rotate(40deg);
}

.status {
  margin-top: 10px;
  font-size: 12px;
  color: #91a7d2;
  white-space: normal;
  line-height: 1.4;
}

.pipeline-action-row {
  margin-top: 12px;
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
}

.action-connect {
  margin-top: 0;
  min-width: 210px;
}

.action-arrow {
  width: 0;
  height: 0;
  border-top: 10px solid transparent;
  border-bottom: 10px solid transparent;
  border-left: 14px solid #2b75e8;
  opacity: 0.92;
  margin-bottom: 11px;
}

.field-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 10px;
}

.toggle-group {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border: 1px solid rgba(67, 94, 141, 0.82);
  border-radius: 11px;
  background: rgba(12, 20, 35, 0.78);
}

label {
  font-size: 13px;
  color: #adc3ec;
  font-weight: 600;
}

input[type="text"] {
  width: 100%;
  box-sizing: border-box;
  border-radius: 7px;
  border: 1px solid #2f3a52;
  background: #111726;
  color: #eef4ff;
  padding: 8px 10px;
}

select {
  width: 100%;
  box-sizing: border-box;
  border-radius: 7px;
  border: 1px solid #2f3a52;
  background: #111726;
  color: #eef4ff;
  padding: 8px 10px;
}

.small {
  margin-top: 6px;
  color: #7088ba;
  font-size: 12px;
}

@media (max-width: 880px) {
  .sequence-input-row {
    grid-template-columns: 1fr;
  }

  .btn-load,
  .btn-generate {
    width: 100%;
    min-width: 0;
  }

  .action-arrow {
    display: none;
  }
}

.synctrace-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(4, 8, 16, 0.78);
  backdrop-filter: blur(4px);
}

.synctrace-modal-backdrop[hidden] {
  display: none !important;
}

.synctrace-modal-card {
  width: min(520px, 100%);
  border: 1px solid rgba(91, 127, 194, 0.45);
  border-radius: 12px;
  padding: 18px 18px 16px;
  background: linear-gradient(180deg, rgba(14, 22, 38, 0.98) 0%, rgba(8, 13, 22, 0.98) 100%);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.synctrace-modal-card h3 {
  margin: 0 0 10px;
  font-size: 1.05rem;
  color: #eef4ff;
}

.synctrace-modal-message {
  margin: 0 0 10px;
  color: #c8d6f5;
  font-size: 13px;
  line-height: 1.45;
}

.synctrace-modal-list {
  margin: 0 0 12px;
  padding-left: 18px;
  color: #9fb4dc;
  font-size: 12px;
  line-height: 1.5;
}

.synctrace-modal-list:empty {
  display: none;
}

.synctrace-modal-hint {
  margin: 0 0 16px;
  color: #7088ba;
  font-size: 12px;
  line-height: 1.45;
}

.synctrace-modal-actions {
  display: flex;
  justify-content: flex-end;
}

.synctrace-modal-actions .btn-premium {
  min-width: 96px;
}

body.synctrace-modal-open {
  overflow: hidden;
}
