.prototype-tools {
  position: fixed;
  z-index: 100;
  bottom: 16px;
  left: 20px;
  font-family: var(--font);
}

.prototype-tools button,
.prototype-tools input,
.prototype-tools select {
  font: inherit;
}

.prototype-tools__trigger {
  display: inline-flex;
  width: 132px;
  height: 42px;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 14px;
  border: 1px solid #344054;
  border-radius: 999px;
  color: #172033;
  background: #ffffff;
  box-shadow: 0 6px 18px rgb(15 23 42 / 14%);
  cursor: pointer;
}

.prototype-tools__trigger svg {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.prototype-tools__trigger span {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.prototype-tools__trigger:hover {
  background: #f8fafc;
  box-shadow: 0 8px 22px rgb(15 23 42 / 17%);
}

.prototype-tools--open .prototype-tools__trigger,
.prototype-tools__trigger:focus-visible {
  outline: 2px solid #ffffff;
  box-shadow:
    0 0 0 4px #f59e0b,
    0 8px 22px rgb(15 23 42 / 17%);
}

.prototype-tools__panel {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  display: flex;
  width: 320px;
  max-height: min(520px, calc(100dvh - 88px));
  flex-direction: column;
  overflow: visible;
  border: 1px solid #dce3ec;
  border-radius: 12px;
  color: #0f172a;
  background: #ffffff;
  box-shadow: 0 22px 55px rgb(15 23 42 / 18%);
  animation: prototype-tools-in 160ms ease-out;
}

.prototype-tools__panel::after {
  position: absolute;
  bottom: -6px;
  left: 20px;
  width: 10px;
  height: 10px;
  border-right: 1px solid #dce3ec;
  border-bottom: 1px solid #dce3ec;
  background: #ffffff;
  content: "";
  transform: rotate(45deg);
}

.prototype-tools__header {
  display: grid;
  min-height: 48px;
  flex: 0 0 48px;
  grid-template-columns: 18px minmax(0, 1fr) auto 34px;
  align-items: center;
  gap: 8px;
  padding: 0 10px 0 14px;
  border-bottom: 1px solid #e8edf3;
  background: #ffffff;
}

.prototype-tools__brand-icon {
  display: grid;
  width: 16px;
  height: 16px;
  place-items: center;
  color: #f59e0b;
}

.prototype-tools__brand-icon svg,
.prototype-tools__close svg,
.prototype-tools__footer svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.prototype-tools__header h2 {
  margin: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  line-height: 1;
  text-transform: uppercase;
}

.prototype-tools__environment {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: #64748b;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.prototype-tools__environment span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #21abb5;
}

.prototype-tools__close {
  display: grid;
  width: 34px;
  height: 34px;
  padding: 8px;
  place-items: center;
  border: 0;
  border-radius: 7px;
  color: #94a3b8;
  background: transparent;
  cursor: pointer;
}

.prototype-tools__close:hover {
  color: #334155;
  background: #f1f5f9;
}

.prototype-tools__close:focus-visible,
.prototype-tools__field :is(input, select):focus-visible,
.prototype-tools__footer button:focus-visible {
  outline: 3px solid rgb(33 171 181 / 25%);
  outline-offset: 1px;
}

.prototype-tools__form {
  display: flex;
  min-height: 0;
  flex: 1;
  flex-direction: column;
}

.prototype-tools__body {
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.prototype-tools__field {
  display: grid;
  min-height: 40px;
  grid-template-columns: minmax(0, 1fr) 142px;
  align-items: center;
  gap: 12px;
  padding: 4px 16px;
  border-bottom: 1px solid #eef2f6;
  color: #475569;
  font-size: 12px;
  font-weight: 500;
}

.prototype-tools__field[hidden] {
  display: none;
}

.prototype-tools__field :is(input, select) {
  width: 100%;
  height: 30px;
  min-width: 0;
  padding: 0 9px;
  border: 1px solid #e2e8f0;
  border-radius: 7px;
  color: #0f172a;
  background: #f8fafc;
  font-size: 13px;
  font-weight: 500;
}

.prototype-tools__field input {
  width: 104px;
  justify-self: end;
  text-align: right;
}

.prototype-tools__section {
  margin: 0;
}

.prototype-tools__section summary {
  display: flex;
  min-height: 32px;
  align-items: center;
  gap: 9px;
  padding: 0 16px;
  color: #94a3b8;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
  list-style: none;
  text-transform: uppercase;
  cursor: pointer;
}

.prototype-tools__section summary::-webkit-details-marker {
  display: none;
}

.prototype-tools__section summary::before {
  width: 5px;
  height: 5px;
  border-right: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  content: "";
  transform: rotate(-45deg);
  transition: transform 140ms ease;
}

.prototype-tools__section[open] summary::before {
  transform: rotate(45deg) translate(-1px, -1px);
}

.prototype-tools__section summary::after {
  height: 1px;
  flex: 1;
  background: #eef2f6;
  content: "";
}

.prototype-tools__section summary:focus-visible {
  outline: 3px solid rgb(33 171 181 / 25%);
  outline-offset: -3px;
}

.prototype-tools__footer {
  display: flex;
  min-height: 44px;
  flex: 0 0 44px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  border-top: 1px solid #e8edf3;
  background: #ffffff;
}

.prototype-tools__footer button {
  display: inline-flex;
  min-height: 32px;
  align-items: center;
  gap: 7px;
  padding: 0 4px;
  border: 0;
  color: #64748b;
  background: transparent;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
}

.prototype-tools__footer button:hover {
  color: #198892;
}

.prototype-tools__footer button svg {
  width: 15px;
  height: 15px;
}

#prototype-tools-status {
  color: #198892;
  font-size: 10px;
  font-weight: 600;
}

@keyframes prototype-tools-in {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 480px) {
  .prototype-tools {
    right: 12px;
    bottom: calc(12px + env(safe-area-inset-bottom));
    left: 12px;
  }

  .prototype-tools__panel {
    right: 0;
    bottom: calc(100% + 10px);
    width: auto;
    max-height: calc(100dvh - 90px);
  }

  .prototype-tools__trigger {
    width: 132px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .prototype-tools__panel {
    animation: none;
  }

  .prototype-tools__section summary::before {
    transition: none;
  }
}
