:host {
  --paper: #f2f4f5;
  --paper-2: #e6eaed;
  --ink: #0d2240;
  --soft: #4b5c73;
  --blue: #1565c0;
  --blue-dark: #0f4f99;
  --sticky-top: var(--uz3d-sticky-top, 0px);
  --sans: 'Uzay3D Archivo', 'Archivo Variable', system-ui, sans-serif;
  --mono: 'Uzay3D Plex Mono', 'IBM Plex Mono', ui-monospace, monospace;
  color-scheme: only light;
  display: block;
  container-type: inline-size;
  background: var(--paper);
  color: var(--ink);
  font: 400 16.5px/1.5 var(--sans);
  text-align: left;
  -webkit-font-smoothing: antialiased;
}

*, *::before, *::after { box-sizing: border-box; }
h2, p, dl, dd, fieldset { margin: 0; padding: 0; border: 0; }
button, input, textarea { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
[hidden] { display: none !important; }

.wrap { display: grid; grid-template-columns: minmax(0, 1fr) 420px; align-items: start; }

.stage {
  position: sticky; top: var(--sticky-top); height: calc(100vh - var(--sticky-top));
  height: calc(100svh - var(--sticky-top)); min-height: 520px; overflow: hidden; background: var(--paper);
}
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; cursor: grab; touch-action: pan-y; }
.stage canvas.is-grabbing { cursor: grabbing; }

.chip {
  position: absolute; left: 0; top: 0; z-index: 2; padding: 3px 7px; border: 0;
  background: var(--paper); color: var(--ink); font: 500 13px/1.2 var(--mono);
  font-variant-numeric: tabular-nums; white-space: nowrap; cursor: grab; touch-action: none;
  transition: background-color .15s, color .15s;
}
.chip:hover, .chip.is-dragging { background: var(--blue); color: #fff; }
.chip.is-dragging { cursor: grabbing; }

.antet {
  position: absolute; left: 20px; top: 20px; z-index: 2; width: 300px;
  border: 1.5px solid var(--ink); background: var(--paper);
  font: 400 12.5px/1.3 var(--mono); font-variant-numeric: tabular-nums;
}
.antet > div { padding: 7px 10px; }
.antet > div + div { display: grid; grid-template-columns: 74px 1fr; border-top: 1px solid var(--ink); }
.antet-name { font: 600 14px/1.2 var(--sans); }
.antet dt { color: var(--soft); }

.views {
  position: absolute; left: 20px; bottom: 20px; z-index: 2; display: flex;
  background: var(--paper); border: 1.5px solid var(--ink);
}
.views button {
  min-height: 40px; padding: 0 13px; border: 0; background: transparent; cursor: pointer;
  font-size: 14px; font-weight: 500; transition: background-color .15s, color .15s;
}
.views button:hover { background: var(--paper-2); }
.views button[aria-pressed='true'] { background: var(--ink); color: #fff; }
.views .zoom { width: 40px; padding: 0; font-size: 20px; }
.no-webgl { position: absolute; left: 20px; top: 40%; max-width: 40ch; font-size: 18px; }

.panel { padding: 28px; background: var(--paper-2); }
.panel h1, .panel h2 { font-size: 34px; line-height: 1.05; letter-spacing: -.02em; font-weight: 600; font-stretch: 108%; margin-bottom: 10px; }
.send-title { margin-top: 44px; }
.panel p { max-width: 46ch; }

legend, .slide label { font-weight: 600; font-size: 15px; }
fieldset { margin-top: 26px; min-width: 0; }
legend { margin-bottom: 8px; padding: 0; }

.form-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.form-opt { position: relative; display: block; cursor: pointer; }
.form-opt input { position: absolute; opacity: 0; inset: 0; margin: 0; }
.form-opt svg { display: block; width: 100%; padding: 8px 6px; background: var(--paper); transition: background-color .15s; }
.form-opt path { fill: none; stroke: var(--ink); stroke-width: 1.2; transition: stroke .15s; }
.form-opt span { display: block; padding-top: 5px; font-size: 13px; line-height: 1.2; }
.form-opt:hover svg { background: #fff; }
.form-opt input:checked + svg { background: var(--blue); }
.form-opt input:checked + svg path { stroke: #fff; }
.form-opt input:focus-visible + svg { outline: 2px solid var(--blue); outline-offset: 2px; }

.sliders { margin-top: 24px; display: grid; gap: 16px; }
.slide { display: grid; grid-template-columns: 1fr auto; align-items: center; row-gap: 4px; transition: opacity .2s; }
.slide.is-off { opacity: .4; }
.num { display: inline-flex; align-items: baseline; gap: 4px; font: 500 15px var(--mono); }
.num input {
  width: 66px; padding: 4px 6px; border: 0; background: var(--paper); text-align: right;
  font: inherit; font-variant-numeric: tabular-nums; appearance: textfield; -moz-appearance: textfield;
}
.num input::-webkit-outer-spin-button, .num input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.slide input[type='range'] {
  grid-column: 1 / -1; width: 100%; height: 28px; margin: 0; background: transparent;
  -webkit-appearance: none; appearance: none; cursor: ew-resize;
}
.slide input[type='range']::-webkit-slider-runnable-track { height: 2px; background: var(--ink); }
.slide input[type='range']::-moz-range-track { height: 2px; background: var(--ink); }
.slide input[type='range']::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 22px; margin-top: -10px; background: var(--blue); border: 0; border-radius: 0; }
.slide input[type='range']::-moz-range-thumb { width: 12px; height: 22px; background: var(--blue); border: 0; border-radius: 0; }

.clad-list { display: flex; flex-wrap: wrap; gap: 6px; }
.clad-list label { position: relative; cursor: pointer; }
.clad-list input { position: absolute; opacity: 0; inset: 0; margin: 0; }
.clad-list span { display: block; padding: 7px 11px; background: var(--paper); font-size: 14.5px; transition: background-color .15s, color .15s; }
.clad-list label:hover span { background: #fff; }
.clad-list input:checked + span { background: var(--blue); color: #fff; }
.clad-list input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }

.hint { margin-top: 16px; font-size: 14px; color: var(--soft); }

.fields { margin-top: 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px 10px; }
.f { display: grid; gap: 4px; font-size: 14.5px; font-weight: 500; min-width: 0; }
.f-wide { grid-column: 1 / -1; }
.f input, .f textarea { width: 100%; padding: 10px; border: 0; border-bottom: 2px solid var(--ink); border-radius: 0; background: var(--paper); font-weight: 400; font-size: 16px; }
.f textarea { resize: vertical; }
.f small { font-weight: 400; font-size: 13.5px; color: var(--soft); }
.consent { display: grid; grid-template-columns: 20px 1fr; gap: 8px; margin-top: 16px; font-size: 14px; line-height: 1.4; }
.consent input { width: 18px; height: 18px; margin: 1px 0 0; accent-color: var(--blue); }
.hp { position: absolute; left: -9999px; }

.actions { display: grid; gap: 8px; margin-top: 18px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 52px; padding: 0 28px;
  border: 2px solid var(--blue); border-radius: 0; background: var(--blue); color: #fff;
  font-weight: 600; text-decoration: none; cursor: pointer;
  transition: background-color .18s, border-color .18s, transform .12s;
}
.btn:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .6; cursor: wait; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--ink); }
.btn-ghost:hover { background: var(--ink); border-color: var(--ink); color: #fff; }

@container (max-width: 859.98px) {
  .wrap { display: block; }
  .stage { z-index: 3; height: 50vh; height: 50svh; min-height: 300px; }
  .antet { display: none; }
  .views { left: 8px; right: 8px; bottom: 8px; border-width: 1px; }
  .views button { flex: 1; padding: 0 2px; font-size: 13px; }
  .views .zoom { flex: 0 0 34px; }
  .panel { padding: 24px 16px 40px; }
}
