:root {
  color-scheme: dark;
  --bg: #09090b;
  --panel: rgba(17, 17, 20, 0.88);
  --panel-raised: rgba(35, 35, 40, 0.72);
  --surface: #111114;
  --surface-hover: rgba(63, 63, 70, 0.58);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --faint: #71717a;
  --accent: #2563eb;
  --accent-hover: #3173f3;
  --accent-deep: #1746b6;
  --accent-cyan: #5ee7ff;
  --accent-soft: rgba(48, 179, 255, 0.16);
  --danger: #f87171;
  --radius: 10px;
  font-family: "DM Sans", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  overflow: hidden;
  color: var(--text);
  background:
    radial-gradient(circle at 50% -30%, rgba(255, 255, 255, 0.055), transparent 42%),
    var(--bg);
  font-size: 14px;
}

button,
input,
select {
  font: inherit;
}

button,
a,
input,
select {
  -webkit-tap-highlight-color: transparent;
}

button,
a {
  color: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.editor-shell {
  height: 100%;
  display: grid;
  grid-template-rows: 56px minmax(0, 1fr);
}

.editor-commandbar {
  z-index: 10;
  display: grid;
  grid-template-columns: auto minmax(280px, 720px) minmax(max-content, 1fr);
  align-items: center;
  gap: 18px;
  min-width: 0;
  padding: 0 14px 0 16px;
  background: rgba(12, 12, 15, 0.8);
  border-bottom: 1px solid var(--border);
  box-shadow: inset 0 -1px 0 rgba(255, 255, 255, 0.025);
  backdrop-filter: blur(18px) saturate(135%);
  -webkit-backdrop-filter: blur(18px) saturate(135%);
}

.brand-mark {
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.035em;
  text-decoration: none;
}

.brand-mark span {
  color: var(--accent-cyan);
}

.command-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  width: 100%;
}

.command-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
}

.input-shell {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  height: 34px;
  padding: 0 10px;
  color: var(--muted);
  background: linear-gradient(180deg, rgba(45, 45, 51, 0.72), rgba(24, 24, 28, 0.76));
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    inset 0 -1px 0 rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(12px) saturate(125%);
  -webkit-backdrop-filter: blur(12px) saturate(125%);
  transition: border-color 120ms ease, box-shadow 120ms ease, background 120ms ease;
}

.input-shell:focus-within {
  color: var(--text);
  border-color: rgba(94, 231, 255, 0.72);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.09),
    inset 0 -1px 0 rgba(0, 0, 0, 0.24),
    0 0 0 3px rgba(37, 140, 255, 0.15);
}

.input-shell svg,
.btn svg,
.preview-top svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.input-shell input {
  width: 100%;
  min-width: 0;
  padding: 0;
  color: var(--text);
  background: transparent;
  border: 0;
  outline: 0;
}

.command-url input {
  font-family: "DM Mono", monospace;
  font-size: 12px;
}

input::placeholder {
  color: var(--faint);
}

.btn {
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.16),
    inset 0 -1px 0 rgba(0, 0, 0, 0.36),
    0 2px 5px rgba(0, 0, 0, 0.22);
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease, transform 120ms ease, box-shadow 120ms ease;
}

.btn-primary {
  color: #ffffff;
  background: linear-gradient(180deg, #3478f2 0%, var(--accent) 54%, var(--accent-deep) 100%);
  border-color: rgba(125, 211, 252, 0.52);
}

.btn-primary:hover {
  background: linear-gradient(180deg, #4388ff 0%, var(--accent-hover) 54%, #1a4fc2 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.24),
    inset 0 -1px 0 rgba(0, 0, 0, 0.34),
    0 3px 9px rgba(0, 87, 214, 0.34);
}

.btn-secondary {
  color: #e8eef8;
  background: linear-gradient(180deg, rgba(48, 48, 54, 0.84), rgba(27, 27, 31, 0.9));
  border-color: var(--border-strong);
}

.btn-secondary:hover {
  color: var(--text);
  background: linear-gradient(180deg, rgba(61, 61, 68, 0.9), rgba(34, 34, 39, 0.92));
}

.btn:active {
  transform: translateY(1px);
  box-shadow:
    inset 0 2px 3px rgba(0, 0, 0, 0.28),
    inset 0 -1px 0 rgba(255, 255, 255, 0.08);
}

.btn:disabled,
.btn.disabled {
  opacity: 0.38;
  cursor: not-allowed;
  pointer-events: none;
}

.editor-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 264px;
  min-width: 0;
  min-height: 0;
}

.editor-canvas-pane {
  display: grid;
  grid-template-rows: minmax(0, 1fr) 30px;
  min-width: 0;
  min-height: 0;
  background: #0b0b0d;
}

.capture-surface {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background-color: #111114;
  background-image:
    linear-gradient(45deg, rgba(255, 255, 255, 0.018) 25%, transparent 25%),
    linear-gradient(-45deg, rgba(255, 255, 255, 0.018) 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, rgba(255, 255, 255, 0.018) 75%),
    linear-gradient(-45deg, transparent 75%, rgba(255, 255, 255, 0.018) 75%);
  background-size: 20px 20px;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}

.state-panel {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 32px;
  text-align: center;
}

.state-panel h1,
.state-panel h2 {
  margin: 9px 0 0;
  font-size: 14px;
  font-weight: 600;
}

.state-panel p {
  max-width: 300px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.empty-mark {
  width: 36px;
  height: 28px;
  border: 1px solid var(--border-strong);
  border-radius: 5px;
  box-shadow: inset 0 6px 0 rgba(255,255,255,0.035);
}

.empty-mark::after {
  content: "";
  display: block;
  width: 8px;
  height: 8px;
  margin: 10px auto 0;
  border: 1px solid var(--faint);
  border-radius: 50%;
}

.loading-mark {
  width: 28px;
  height: 28px;
  border: 2px solid var(--border-strong);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

.error-mark {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  color: var(--danger);
  border: 1px solid rgba(248, 113, 113, 0.35);
  border-radius: 50%;
  font-weight: 700;
}

.error-state h2 {
  color: #fecaca;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.single-frame,
.split-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  overflow-anchor: none;
  overscroll-behavior: contain;
  scrollbar-color: #3f3f46 transparent;
  scrollbar-width: thin;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.single-frame.is-panning,
.split-frame.is-panning {
  cursor: grabbing;
}

.single-frame {
  padding: 32px;
  background: #18181b;
}

#screenshotMount {
  width: auto;
  min-width: 1px;
  margin: 0 auto;
  overflow: hidden;
  overflow-anchor: none;
  background: #fff;
  border-radius: 5px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.36);
  line-height: 0;
}

#screenshotMount img {
  display: block;
  width: 100%;
  height: auto;
  margin: 0;
  pointer-events: none;
  user-select: none;
}

.split-frame {
  padding: 24px;
  background: #141416;
}

#showcaseCanvas {
  display: block;
  width: auto;
  max-width: none;
  height: auto;
  margin: 0 auto;
  border-radius: 8px;
  box-shadow: 0 16px 50px rgba(0, 0, 0, 0.28);
  pointer-events: none;
}

.preview-top {
  position: sticky;
  z-index: 4;
  top: 12px;
  float: right;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  margin: 12px 12px -42px 0;
  padding: 0 9px;
  color: var(--text);
  background: rgba(30, 30, 34, 0.78);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.10),
    inset 0 -1px 0 rgba(0, 0, 0, 0.28),
    0 3px 10px rgba(0, 0, 0, 0.24);
  font-size: 11px;
  cursor: pointer;
  backdrop-filter: blur(8px);
}

.editor-statusbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  padding: 0 11px;
  color: #777780;
  background: rgba(12, 12, 14, 0.9);
  border-top: 1px solid var(--border);
  font-family: "DM Mono", monospace;
  font-size: 10px;
  white-space: nowrap;
}

.editor-statusbar span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-link {
  flex: 0 0 auto;
  color: var(--muted);
  text-decoration: none;
}

.status-link:hover {
  color: var(--text);
}

.editor-inspector {
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  background: var(--panel);
  border-left: 1px solid var(--border);
  box-shadow: inset 1px 0 0 rgba(255, 255, 255, 0.018);
  backdrop-filter: blur(18px) saturate(130%);
  -webkit-backdrop-filter: blur(18px) saturate(130%);
  scrollbar-color: #3f3f46 transparent;
  scrollbar-width: thin;
}

.inspector-section {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.inspector-title {
  margin: 0 0 12px;
  color: #b4b4bd;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.045em;
  text-transform: uppercase;
}

.segmented-control {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  gap: 2px;
  width: 100%;
  padding: 3px;
  background: linear-gradient(180deg, rgba(31, 31, 35, 0.8), rgba(18, 18, 21, 0.86));
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow:
    inset 0 1px 2px rgba(0, 0, 0, 0.34),
    0 1px 0 rgba(255, 255, 255, 0.025);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.segmented-item,
.toggle-item {
  min-width: 0;
  height: 28px;
  padding: 0 8px;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 7px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
}

.segmented-item:hover,
.toggle-item:hover {
  color: var(--text);
}

.segmented-item.active,
.toggle-item.active {
  color: var(--text);
  background: linear-gradient(180deg, rgba(50, 72, 105, 0.82), rgba(27, 42, 65, 0.88));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.13),
    inset 0 -1px 0 rgba(0, 0, 0, 0.28),
    0 1px 3px rgba(0, 0, 0, 0.24);
}

.inspector-field {
  margin-bottom: 15px;
}

.field-heading,
.property-label,
.property-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.field-heading {
  margin-bottom: 7px;
}

.field-heading label,
.property-label,
.property-row > span {
  color: #d4d4d8;
  font-size: 12px;
  font-weight: 500;
}

.field-heading > span,
.property-label output {
  color: var(--faint);
  font-family: "DM Mono", monospace;
  font-size: 10px;
  font-weight: 400;
}

.selector-shell {
  height: 33px;
}

.selector-shell input {
  font-family: "DM Mono", monospace;
  font-size: 11px;
}

.inspector-field p {
  margin: 6px 0 0;
  color: var(--faint);
  font-size: 10px;
}

.capture-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  cursor: pointer;
}

.capture-option > span:first-of-type {
  min-width: 0;
  flex: 1;
}

.capture-option strong,
.capture-option small {
  display: block;
}

.capture-option strong {
  color: #d4d4d8;
  font-size: 12px;
  font-weight: 500;
}

.capture-option small {
  margin-top: 2px;
  color: var(--faint);
  font-size: 10px;
}

.capture-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch {
  position: relative;
  width: 30px;
  height: 17px;
  flex: 0 0 auto;
  background: linear-gradient(180deg, rgba(58, 58, 65, 0.9), rgba(33, 33, 38, 0.94));
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  transition: background 120ms ease;
}

.switch::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 11px;
  height: 11px;
  background: #e4e4e7;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.88),
    0 1px 3px rgba(0, 0, 0, 0.44);
  border-radius: 50%;
  transition: transform 120ms ease, background 120ms ease;
}

.capture-option input:checked + .switch {
  background: linear-gradient(180deg, #258cff, var(--accent-deep));
  border-color: rgba(94, 231, 255, 0.64);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.18),
    0 0 8px rgba(22, 119, 255, 0.18);
}

.capture-option input:checked + .switch::after {
  background: #f4fbff;
  box-shadow:
    inset 0 0 0 1px rgba(94, 231, 255, 0.4),
    0 0 5px rgba(94, 231, 255, 0.72),
    0 1px 3px rgba(0, 0, 0, 0.35);
  transform: translateX(13px);
}

.capture-option:has(input:focus-visible) .switch {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.capture-option.is-disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.property-row,
.property-stack {
  padding: 12px 0;
  border-top: 1px solid var(--border);
}

.property-row:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.property-row select {
  height: 29px;
  min-width: 58px;
  padding: 0 24px 0 8px;
  color: var(--text);
  background: linear-gradient(180deg, rgba(45, 45, 51, 0.78), rgba(24, 24, 28, 0.82));
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    inset 0 -1px 0 rgba(0, 0, 0, 0.25);
  font-family: "DM Mono", monospace;
  font-size: 11px;
}

.zoom-stepper {
  display: grid;
  grid-template-columns: 28px 48px 28px;
  align-items: center;
  height: 29px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(45, 45, 51, 0.78), rgba(24, 24, 28, 0.82));
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.07),
    inset 0 -1px 0 rgba(0, 0, 0, 0.28);
}

.zoom-stepper button {
  height: 100%;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  cursor: pointer;
}

.zoom-stepper button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
}

.zoom-stepper button:disabled {
  color: var(--faint);
  cursor: not-allowed;
  opacity: 0.45;
}

.zoom-stepper output {
  display: grid;
  height: 100%;
  place-items: center;
  color: var(--text);
  border-right: 1px solid var(--border);
  border-left: 1px solid var(--border);
  font-family: "DM Mono", monospace;
  font-size: 10px;
}

.inspector-action {
  width: 100%;
  height: 31px;
  margin-top: 10px;
  color: var(--muted);
  background: linear-gradient(180deg, rgba(46, 46, 52, 0.76), rgba(25, 25, 29, 0.82));
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 -1px 0 rgba(0, 0, 0, 0.30),
    0 2px 5px rgba(0, 0, 0, 0.18);
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
}

.inspector-action:hover,
.inspector-action.active {
  color: var(--text);
  background: linear-gradient(180deg, rgba(45, 105, 174, 0.72), rgba(17, 56, 101, 0.78));
}

.inspector-action.active {
  border-color: rgba(94, 231, 255, 0.46);
}

.inspector-action:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.interaction-hint {
  margin: 8px 0 0;
  color: var(--faint);
  font-size: 10px;
  line-height: 1.45;
}

.property-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

input[type="range"] {
  width: 100%;
  height: 3px;
  margin: 5px 0;
  accent-color: var(--accent);
  cursor: pointer;
}

.info-page {
  min-height: 100%;
  overflow: auto;
  background:
    radial-gradient(circle at 72% -25%, rgba(255, 255, 255, 0.055), transparent 38%),
    var(--bg);
}

.info-header,
.info-footer {
  width: min(100% - 40px, 1040px);
  margin: 0 auto;
}

.info-header {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid var(--border);
}

.info-main {
  width: min(100% - 40px, 1040px);
  min-height: calc(100vh - 128px);
  margin: 0 auto;
  padding: 76px 0 96px;
}

.info-content {
  width: min(100%, 680px);
}

.info-kicker {
  margin: 0 0 14px;
  color: var(--accent-cyan);
  font-family: "DM Mono", monospace;
  font-size: 11px;
}

.info-content h1 {
  max-width: 12ch;
  margin: 0;
  font-size: clamp(40px, 7vw, 72px);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 0.98;
}

.info-lede {
  max-width: 62ch;
  margin: 28px 0 64px;
  color: #c6c6cc;
  font-size: 17px;
  line-height: 1.65;
}

.info-section {
  padding: 28px 0 32px;
  border-top: 1px solid var(--border);
}

.info-section h2 {
  margin: 0 0 10px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.015em;
}

.info-section p {
  max-width: 66ch;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.info-action {
  width: max-content;
  margin-top: 20px;
}

.info-section .info-secondary-action {
  margin-top: 14px;
  font-size: 13px;
}

.info-secondary-action a {
  color: var(--muted);
  text-underline-offset: 3px;
}

.info-secondary-action a:hover {
  color: var(--text);
}

.info-footer {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  color: var(--faint);
  border-top: 1px solid var(--border);
  font-family: "DM Mono", monospace;
  font-size: 10px;
}

.info-footer a {
  color: var(--muted);
  text-decoration: none;
}

.info-footer a:hover {
  color: var(--text);
}

@media (max-width: 900px) {
  body {
    overflow: auto;
  }

  .editor-shell {
    min-height: 100%;
    height: auto;
    grid-template-rows: auto auto;
  }

  .editor-commandbar {
    position: sticky;
    top: 0;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 10px;
    padding: 10px 12px;
  }

  .command-form {
    order: 3;
    grid-column: 1 / -1;
  }

  .command-actions {
    grid-column: 2;
    grid-row: 1;
  }

  .editor-body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(480px, 68vh) auto;
  }

  .editor-inspector {
    border-top: 1px solid var(--border);
    border-left: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .inspector-section {
    min-height: 100%;
    border-right: 1px solid var(--border);
  }
}

@media (max-width: 600px) {
  .editor-commandbar {
    padding: 9px 10px;
  }

  .command-actions .btn span {
    display: none;
  }

  .command-actions .btn {
    width: 34px;
    padding: 0;
  }

  .editor-body {
    grid-template-rows: minmax(420px, 62vh) auto;
  }

  .editor-inspector {
    display: block;
  }

  .inspector-section {
    min-height: auto;
    border-right: 0;
  }

  .split-frame {
    padding: 14px;
  }

  .single-frame {
    padding: 20px;
  }

  .editor-statusbar {
    font-size: 9px;
  }

  .editor-statusbar #formatMeta {
    display: none;
  }

  .info-header,
  .info-main,
  .info-footer {
    width: min(100% - 28px, 1040px);
  }

  .info-header {
    min-height: 64px;
  }

  .info-header .btn span {
    display: inline;
  }

  .info-main {
    padding: 56px 0 72px;
  }

  .info-lede {
    margin-bottom: 48px;
    font-size: 16px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
