:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f4f6f8;
  color: #111827;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  overflow: hidden;
  min-height: 100vh;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: minmax(260px, var(--left-panel, 1fr)) 8px minmax(320px, var(--center-panel, 420px)) 8px minmax(260px, var(--right-panel, 1fr));
  gap: 0;
  width: 100vw;
  height: 100vh;
  margin: 0;
  padding: 12px;
  overflow: hidden;
}

.resize-handle {
  position: relative;
  cursor: col-resize;
  touch-action: none;
}

.preview-frame {
  position: relative;
  min-width: 0;
}

.preview-resize-handle {
  position: absolute;
  right: 0;
  top: -8px;
  left: 0;
  z-index: 2;
  height: 8px;
  cursor: row-resize;
  touch-action: none;
}

.resize-handle::before {
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 50%;
  width: 2px;
  border-radius: 999px;
  background: #cbd3dd;
  content: "";
  transform: translateX(-50%);
}

.preview-resize-handle::before {
  position: absolute;
  top: 0;
  right: 8px;
  left: 8px;
  height: 1px;
  border-radius: 999px;
  background: #cbd3dd;
  content: "";
}

.resize-handle:hover::before,
.resize-handle:focus-visible::before,
.resizing-panels .resize-handle::before {
  background: #176b87;
}

.preview-resize-handle:hover::before,
.preview-resize-handle:focus-visible::before,
.resizing-preview .preview-resize-handle::before {
  background: #176b87;
}

.resizing-panels {
  cursor: col-resize;
  user-select: none;
}

.resizing-preview {
  cursor: row-resize;
  user-select: none;
}

.capture-panel,
.response-column {
  background: #ffffff;
  border: 1px solid #d7dde5;
  border-radius: 8px;
  min-width: 0;
  min-height: 0;
}

.capture-panel {
  display: grid;
  grid-template-rows: auto auto auto auto auto;
  overflow: auto;
  padding: 12px;
}

.topbar,
.account-strip,
.toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
}

.topbar {
  justify-content: flex-end;
  min-height: 30px;
}

.eyebrow {
  margin: 0 0 3px;
  color: #566174;
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 1.55rem;
}

h2 {
  font-size: 1.1rem;
}

.account-strip {
  min-width: 0;
  justify-content: flex-end;
  color: #3f4b5f;
  font-size: 0.82rem;
}

.toolbar {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 38px;
  margin: 0 0 12px;
}

.button,
.icon-button {
  border: 1px solid #c6ced8;
  border-radius: 7px;
  background: #ffffff;
  color: #172033;
  cursor: pointer;
  font-weight: 700;
}

.button {
  min-height: 40px;
  padding: 0 14px;
}

.button.primary {
  border-color: #176b87;
  background: #176b87;
  color: #ffffff;
}

.button.secondary {
  min-height: 34px;
}

.icon-button {
  width: 38px;
  height: 38px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.preview-video {
  width: 100%;
  height: var(--preview-height, 320px);
  display: block;
  object-fit: contain;
  background: #101720;
  border: 1px solid #cbd3dd;
  border-radius: 8px;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

label {
  display: grid;
  gap: 6px;
  color: #4b5565;
  font-size: 0.82rem;
  font-weight: 700;
}

label:first-child,
label:last-child {
  grid-column: 1 / -1;
}

input,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid #c6ced8;
  border-radius: 7px;
  padding: 0 10px;
  background: #ffffff;
  color: #111827;
}

.status {
  min-height: 22px;
  margin: 14px 0 0;
  color: #566174;
  font-size: 0.92rem;
}

.status.error {
  color: #b42318;
}

.account-link {
  min-width: 0;
  overflow: hidden;
  border: 1px solid #d8dde6;
  border-radius: 999px;
  padding: 5px 8px;
  color: #176b87;
  font-size: 0.78rem;
  font-weight: 800;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-link:hover,
.account-link:focus {
  text-decoration: underline;
}

.response-column {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  overflow: hidden;
}

.column-heading {
  padding: 12px 18px;
  border-bottom: 1px solid #e4e8ee;
  background: #fbfcfe;
}

.column-heading h3 {
  font-size: 0.96rem;
}

.markdown-body {
  min-width: 0;
  max-width: 100%;
  overflow: auto;
  padding: 18px;
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.markdown-body > :first-child {
  margin-top: 0;
}

.markdown-body > :last-child {
  margin-bottom: 0;
}

.markdown-body p,
.markdown-body ul {
  margin: 0 0 14px;
}

.markdown-body ul {
  padding-left: 20px;
}

.markdown-body li + li {
  margin-top: 6px;
}

.markdown-body h2,
.markdown-body h3,
.markdown-body h4 {
  margin: 18px 0 8px;
}

.markdown-body a {
  color: #176b87;
  font-weight: 700;
}

.inline-code {
  border: 1px solid #d8dee8;
  border-radius: 5px;
  padding: 1px 5px;
  background: #f1f5f9;
  color: #111827;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.92em;
}

.code-block {
  max-width: 100%;
  overflow: hidden;
  margin: 14px 0;
  padding: 10px;
  border-radius: 8px;
  background: #111827;
  color: #f9fafb;
  font-size: 0.9rem;
  line-height: 1.5;
}

.code-block code {
  display: block;
  min-width: 0;
}

.code-line {
  display: grid;
  grid-template-columns: 3ch minmax(0, 1fr);
  gap: 10px;
  min-width: 0;
  min-height: 1.45em;
}

.line-number {
  user-select: none;
  color: #8a93a5;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.line-code {
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.hidden {
  display: none !important;
}

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

  .app-shell {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  .capture-panel {
    order: -1;
  }

  .resize-handle {
    display: none;
  }

  .preview-resize-handle {
    display: none;
  }

  .preview-video {
    height: auto;
    aspect-ratio: 16 / 11;
  }
}

@media (max-width: 540px) {
  .app-shell {
    width: 100%;
    margin: 0;
    padding: 10px;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .settings-grid {
    grid-template-columns: 1fr;
  }
}
