* {
  box-sizing: border-box;
}

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

body {
  background:
    radial-gradient(circle at 50% 18%, rgb(255 255 255 / 10%), transparent 26%),
    radial-gradient(circle at 50% 86%, rgb(107 160 205 / 12%), transparent 32%),
    linear-gradient(145deg, #14171b, #050607 72%);
  color: #f1f1ed;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

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

.shell {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 100svh;
  overflow: auto;
  padding: 24px;
}

.plugin {
  background:
    radial-gradient(circle at 50% 16%, rgb(255 255 255 / 8%), transparent 34%),
    linear-gradient(180deg, #30343a, #15181d 52%, #08090b);
  border: 1px solid #565d66;
  border-radius: 8px;
  box-shadow:
    inset 0 1px 0 rgb(255 255 255 / 18%),
    inset 0 -14px 30px rgb(0 0 0 / 46%),
    0 28px 80px rgb(0 0 0 / 52%);
  display: grid;
  gap: 16px;
  grid-template-rows: auto auto auto auto auto;
  max-width: 560px;
  padding: 26px 32px 24px;
  position: relative;
  width: min(92vw, 560px);
}

.plugin::before,
.plugin::after {
  background:
    radial-gradient(ellipse at 42% 8%, rgb(255 226 164 / 34%), transparent 22%),
    radial-gradient(ellipse at 70% 62%, rgb(58 26 9 / 45%), transparent 28%),
    repeating-radial-gradient(ellipse at 18% 24%, rgb(66 31 11 / 32%) 0 3px, transparent 4px 15px),
    repeating-linear-gradient(91deg, rgb(255 226 164 / 18%) 0 2px, transparent 2px 8px),
    linear-gradient(100deg, #693216 0%, #a7602a 22%, #cf8d45 48%, #793d1a 76%, #3c1a0c 100%);
  border: 1px solid rgb(16 8 3 / 80%);
  border-radius: 6px;
  box-shadow:
    inset 6px 0 12px rgb(255 226 165 / 20%),
    inset -8px 0 18px rgb(28 11 3 / 64%),
    0 0 0 1px rgb(255 255 255 / 8%);
  content: "";
  height: calc(100% - 58px);
  position: absolute;
  top: 29px;
  width: 44px;
}

.plugin::before {
  left: -17px;
}

.plugin::after {
  right: -17px;
}

.brand-row {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 44px;
  position: relative;
}

.brand {
  color: #fff;
  font-family: "Product Sans", "Google Sans", "Arial Rounded MT Bold", "Trebuchet MS", system-ui, sans-serif;
  font-size: 38px;
  font-weight: 800;
  line-height: 1;
  text-shadow: 0 2px 0 rgb(0 0 0 / 55%), 0 0 18px rgb(255 255 255 / 14%);
}

.knob-grid {
  display: grid;
  gap: 14px 10px;
  grid-template-columns: repeat(3, 1fr);
  justify-items: center;
  min-height: 132px;
}

.knob-placeholder {
  align-self: center;
  color: #8b8f93;
  font-size: 12px;
  grid-column: 1 / -1;
  text-transform: uppercase;
}

.knob-cell {
  display: grid;
  gap: 4px;
  justify-items: center;
}

.knob-wrap {
  display: grid;
  height: 84px;
  place-items: center;
  position: relative;
  width: 84px;
}

.knob {
  align-items: center;
  background:
    radial-gradient(circle at 38% 32%, #5c626b, transparent 22%),
    radial-gradient(circle at 62% 72%, #050607, transparent 34%),
    linear-gradient(135deg, #30353d, #070809);
  border: 2px solid #0d0e0f;
  border-radius: 50%;
  box-shadow:
    inset 0 5px 9px rgb(255 255 255 / 7%),
    inset 0 -9px 15px rgb(0 0 0 / 62%),
    0 8px 14px rgb(0 0 0 / 62%);
  cursor: grab;
  display: flex;
  height: 76px;
  justify-content: center;
  position: relative;
  /* Claim vertical-drag gestures so touch devices steer the knob
     instead of scrolling the page. */
  touch-action: none;
  user-select: none;
  width: 76px;
}

.knob:focus-visible {
  outline: 2px solid #6ba0cd;
  outline-offset: 3px;
}

.knob.dragging {
  cursor: ns-resize;
}

/* While dragging, kill the rotor's settle animation so the pointer
   tracks the cursor 1:1 instead of easing behind it. */
.knob.dragging .pointer-rotor {
  transition: none;
}

/* A drag started on a knob can travel anywhere via pointer capture;
   pin the resize cursor and suppress text selection page-wide. */
body.knob-dragging {
  cursor: ns-resize;
  user-select: none;
}

.knob::before {
  border: 2px solid rgb(255 255 255 / 74%);
  border-radius: 50%;
  content: "";
  height: 34px;
  position: absolute;
  width: 34px;
}

.pointer-rotor {
  inset: 0;
  position: absolute;
  transition: transform 90ms linear;
}

.knob-pointer {
  background: linear-gradient(180deg, #fff, #c9e0ee);
  border-radius: 999px;
  box-shadow: 0 0 6px rgb(255 255 255 / 34%);
  height: 20px;
  left: calc(50% - 2px);
  position: absolute;
  top: 6px;
  width: 4px;
}

.knob-value {
  color: #f6f7f7;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
}

.knob-label {
  color: #d3d3cc;
  font-size: 10px;
  font-weight: 900;
  text-align: center;
  text-transform: uppercase;
}

.select-knob,
.bool-knob {
  align-items: center;
  background: #101112;
  border: 1px solid rgb(255 255 255 / 16%);
  border-radius: 4px;
  color: #eee;
  display: flex;
  min-height: 40px;
  padding: 7px 9px;
}

.select-knob {
  width: 100%;
}

.bool-knob input {
  accent-color: #6ba0cd;
  height: 18px;
  width: 18px;
}

.controls {
  display: grid;
  gap: 10px;
}

.field-slot {
  display: grid;
  gap: 5px;
}

.field-slot span {
  color: #d3d3cc;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
}

.field-slot textarea,
.field-slot select,
.field-slot input {
  background: #101112;
  border: 1px solid rgb(255 255 255 / 16%);
  border-radius: 4px;
  color: #eeeeea;
  font-size: 13px;
  padding: 7px 9px;
}

.field-slot textarea {
  resize: vertical;
}

.field-slot select:disabled,
.field-slot input:disabled {
  opacity: 0.55;
}

.source-row {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr 110px;
}

.duration-slot input {
  font-variant-numeric: tabular-nums;
}

.blend-slot input {
  appearance: none;
  background: transparent;
  border: none;
  cursor: pointer;
  height: 22px;
  padding: 0;
}

.blend-slot input:disabled {
  cursor: default;
  opacity: 0.45;
}

.blend-slot input::-webkit-slider-runnable-track {
  background: linear-gradient(180deg, #0c0d0e, #181a1d);
  border: 1px solid rgb(255 255 255 / 16%);
  border-radius: 3px;
  height: 6px;
}

.blend-slot input::-webkit-slider-thumb {
  appearance: none;
  background: linear-gradient(180deg, #2c3037, #14171b);
  border: 1px solid rgb(255 255 255 / 30%);
  border-radius: 3px;
  height: 16px;
  margin-top: -6px;
  width: 10px;
}

.blend-slot input::-moz-range-track {
  background: linear-gradient(180deg, #0c0d0e, #181a1d);
  border: 1px solid rgb(255 255 255 / 16%);
  border-radius: 3px;
  height: 6px;
}

.blend-slot input::-moz-range-thumb {
  background: linear-gradient(180deg, #2c3037, #14171b);
  border: 1px solid rgb(255 255 255 / 30%);
  border-radius: 3px;
  height: 16px;
  width: 10px;
}

.blend-slot > span {
  display: flex;
  justify-content: space-between;
}

.blend-value {
  color: #8f938f;
  font-style: normal;
  font-variant-numeric: tabular-nums;
  font-weight: 400;
  text-transform: none;
}

.send-btn,
.power-btn {
  background: linear-gradient(180deg, #2c3037, #14171b);
  border: 1px solid rgb(255 255 255 / 22%);
  border-radius: 5px;
  color: #f1f1ed;
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
  min-height: 32px;
  text-transform: uppercase;
}

.send-btn {
  justify-self: end;
  padding: 0 16px;
}

.send-btn:disabled,
.power-btn:disabled {
  cursor: default;
  opacity: 0.45;
}

.title {
  color: #fff;
  font-size: 30px;
  font-weight: 900;
  justify-self: center;
  line-height: 1;
  text-shadow: 0 2px 0 rgb(0 0 0 / 50%);
}

.transport {
  align-items: center;
  display: flex;
  gap: 10px;
  justify-content: center;
  min-height: 36px;
}

.power-btn {
  min-width: 88px;
}

.power-on {
  border-color: rgb(107 160 205 / 70%);
  box-shadow: 0 0 12px rgb(107 160 205 / 30%);
}

.tick-readout {
  align-items: baseline;
  background: #101112;
  border: 1px solid rgb(255 255 255 / 14%);
  border-radius: 4px;
  color: #f1f1ed;
  display: inline-flex;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  gap: 4px;
  justify-content: center;
  min-height: 30px;
  min-width: 92px;
  padding: 7px 8px 0;
}

.tick-readout b,
.tick-readout small {
  color: #8f938f;
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
}

.status-dot {
  border-radius: 50%;
  height: 9px;
  width: 9px;
}

.status-idle {
  background: #5a5f66;
}

.status-connecting {
  animation: sa3-pulse 1.1s ease-in-out infinite;
  background: #d9b54a;
}

.status-ready {
  background: #5fd97e;
  box-shadow: 0 0 8px rgb(95 217 126 / 55%);
}

.status-error {
  background: #e0524d;
  box-shadow: 0 0 8px rgb(224 82 77 / 55%);
}

.status-text {
  color: #c9cbc6;
  font-size: 12px;
}

@keyframes sa3-pulse {
  50% {
    opacity: 0.35;
  }
}

@media (max-width: 620px) {
  .shell {
    padding: 10px;
  }

  .plugin {
    padding: 18px 22px;
    width: min(94vw, 430px);
  }

  .plugin::before,
  .plugin::after {
    width: 28px;
  }

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