#prototype-open {
  border: 0;
  background: transparent;
  color: var(--project-muted, #657086);
  font: inherit;
  font-size: 14px;
  padding: 0;
  cursor: pointer;
}
#prototype-open:hover { color: var(--project-accent, #354e9e); }

#prototype-dialog {
  width: min(1320px, calc(100% - 24px));
  height: min(900px, calc(100dvh - 24px));
  max-width: none;
  max-height: none;
  padding: 0;
  border: 1px solid #d9d4e3;
  border-radius: 18px;
  background: #faf9fd;
  color: #273247;
  box-shadow: 0 20px 80px #24203436;
  box-sizing: border-box;
}
#prototype-dialog[open] { display: flex; flex-direction: column; }
#prototype-dialog::backdrop { background: #24203473; }
#prototype-dialog *, #prototype-dialog *::before, #prototype-dialog *::after { box-sizing: border-box; }
#prototype-dialog [hidden] { display: none !important; }

.prototype-top, .prototype-board-bar, .prototype-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.prototype-top, .prototype-board-bar { justify-content: space-between; flex-wrap: wrap; }
.prototype-top { padding: 16px 24px; background: white; border-bottom: 1px solid #e4dfed; }
.prototype-top h1 { margin: 2px 0 0; font-size: 24px; line-height: 1.15; }
.prototype-kicker { font-size: 12px; color: #64588a; }
.prototype-actions { flex-wrap: wrap; }
.prototype-workspace {
  display: grid;
  grid-template-columns: min(320px, 37%) minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  flex: 1;
  min-height: 0;
}
.prototype-content { display: contents; }
.prototype-composer, .prototype-tools {
  background: #fff;
  border-right: 1px solid #e4dfed;
  padding: 20px;
}
.prototype-composer { grid-area: 1 / 1; padding-bottom: 0; }
.prototype-tools { grid-area: 2 / 1; overflow: auto; padding-top: 0; }
#prototype-form, .prototype-controls, #prototype-inspector, #prototype-inspector label {
  display: grid;
  gap: 8px;
}
.prototype-prompt-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 8px; }
.prototype-zoom { display: inline-flex; gap: 4px; align-items: center; }
#prototype-dialog .prototype-zoom button { min-width: 34px; padding-inline: 7px; }
#prototype-dialog #prototype-zoom-reset { min-width: 52px; font-variant-numeric: tabular-nums; }
#prototype-form > label, .prototype-controls > label { font-size: 14px; font-weight: 650; }
.prototype-controls { border-top: 1px solid #e4dfed; padding-top: 16px; }
#prototype-inspector { padding: 10px; margin: 0; min-inline-size: 0; border: 1px solid #e4dfed; border-radius: 8px; font-size: 12px; }
.prototype-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
#prototype-dialog :is(button, select, textarea, input) {
  font: inherit;
  font-size: 13px;
  color: inherit;
  background: white;
  border: 1px solid #d9d4e3;
  border-radius: 8px;
  padding: 8px 10px;
}
#prototype-dialog :is(textarea, input) { width: 100%; min-width: 0; }
#prototype-dialog textarea { resize: vertical; }
@media (min-width: 751px) { #prototype-prompt { min-height: 96px; } }

#prototype-dialog select { max-width: 100%; }
#prototype-dialog button { cursor: pointer; }
#prototype-dialog button:hover:not(:disabled) { border-color: #6450bf; }
#prototype-dialog button:disabled { opacity: .5; cursor: default; }
#prototype-dialog button.prototype-primary { background: #5843b2; color: white; border-color: #5843b2; }
#prototype-dialog button.prototype-link { justify-self: start; padding: 3px 0; border: 0; color: #5843b2; text-decoration: underline; }
#prototype-status, #prototype-storage { font-size: 12px; color: #64588a; margin: 12px 0; min-height: 1em; overflow-wrap: anywhere; }
.prototype-board {
  grid-area: 1 / 2 / 3;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: radial-gradient(#cec6e2 1px, transparent 1px) 0 0 / 18px 18px, #f5f2fb;
}
.prototype-board-bar { padding: 12px 16px; background: #fff; border-bottom: 1px solid #e4dfed; }
.prototype-board-bar h2 { margin: 0; font-size: 15px; overflow-wrap: anywhere; }
#prototype-empty { margin: auto; max-width: 340px; padding: 24px; text-align: center; }
#prototype-empty svg { max-width: 100%; }
#prototype-empty h3 { margin: 8px 0; font-size: 22px; }
#prototype-empty p { margin: 0; color: #64588a; font-size: 14px; line-height: 1.55; }
#prototype-viewport { flex: 1; min-height: 0; overflow: auto; padding: 16px; touch-action: pan-x pan-y; }
#prototype-canvas {
  display: block;
  width: calc(100% * var(--prototype-zoom, 1));
  min-width: calc(var(--sheet-min-width) * var(--prototype-zoom, 1));
  height: auto;
  margin: auto;
  user-select: none;
  box-shadow: 0 4px 18px #24203420;
}
#prototype-canvas [data-element] { cursor: grab; touch-action: none; }
#prototype-canvas [data-type="frame"] { touch-action: auto; }

@media (max-width: 750px) {
  #prototype-open { font-size: 12px; flex-shrink: 0; }
  #prototype-dialog { width: 100%; height: 100dvh; margin: 0; border: 0; border-radius: 0; }
  .prototype-top { padding: 12px 16px; }
  .prototype-workspace { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .prototype-content { grid-area: 1 / 1; display: block; overflow: auto; }
  .prototype-board { min-height: 100%; }
  .prototype-tools { border-right: 0; padding: 16px; }
  .prototype-composer {
    grid-area: 2 / 1;
    border: 0;
    border-top: 1px solid #e4dfed;
    padding: 10px 16px max(10px, env(safe-area-inset-bottom));
    max-height: 48dvh;
    overflow: auto;
  }
  #prototype-dialog #prototype-prompt { font-size: 16px; resize: none; }
  #prototype-form { gap: 5px; }
  #prototype-status { min-height: 0; margin: 6px 0 0; }
  #prototype-status:empty { margin: 0; }
  #prototype-empty { padding: 14px; }
  #prototype-empty svg { height: clamp(76px, 14dvh, 124px); }

  #prototype-viewport { max-height: 50dvh; padding: 12px; }
}
