:root {
  color-scheme: dark;
  --bg: #1a1714;
  --surface: #25211d;
  --surface-2: #2d2822;
  --surface-3: #372f27;
  --ink: #eee7dc;
  --muted: #b9aea1;
  --line: #352f29;
  --line-strong: #4d443b;
  --teal: #ff5d64;
  --danger: #ff8066;
  --button-bg: #24201c;
  --button-primary-bg: #eee4d6;
  --button-primary-ink: #181512;
  --start-card-bg: #d9cdbc;
  --start-card-border: #c7b8a6;
  --start-card-ink: #1f1a15;
  --start-card-muted: #6e6257;
  --topbar-bg: rgba(26, 23, 20, 0.96);
  --frame-bg: #f7f2e9;
  --focus: #ff7278;
  --shadow: 0 18px 54px rgba(0, 0, 0, 0.42);
  --radius: 8px;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="day"] {
  color-scheme: light;
  --bg: #f8f4ec;
  --surface: #fffaf2;
  --surface-2: #f1eadf;
  --surface-3: #e8ded1;
  --ink: #171512;
  --muted: #6f655a;
  --line: #ded2c4;
  --line-strong: #c7b7a7;
  --teal: #e94f57;
  --danger: #b84b35;
  --button-bg: #fffaf2;
  --button-primary-bg: #171512;
  --button-primary-ink: #f8f4ec;
  --start-card-bg: #fffaf2;
  --start-card-border: #ded2c4;
  --start-card-ink: #171512;
  --start-card-muted: #6f655a;
  --topbar-bg: rgba(248, 244, 236, 0.96);
  --frame-bg: #ffffff;
  --focus: #8f2635;
  --shadow: 0 18px 54px rgba(88, 68, 45, 0.18);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  letter-spacing: 0;
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
label.button {
  -webkit-tap-highlight-color: transparent;
}

:where(button, a[href], input, textarea, select, [tabindex]:not([tabindex="-1"])):focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

label.button:has(+ #fileInput:focus-visible) {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.skip-link {
  background: var(--button-primary-bg);
  border: 2px solid var(--focus);
  border-radius: 8px;
  color: var(--button-primary-ink);
  font-weight: 800;
  left: 12px;
  padding: 10px 12px;
  position: fixed;
  top: 12px;
  transform: translateY(-160%);
  z-index: 100;
}

.skip-link:focus {
  transform: translateY(0);
}

.app-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  height: 100dvh;
  min-height: 560px;
}

.topbar {
  align-items: center;
  background: var(--topbar-bg);
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(220px, 1fr) auto;
  min-height: 58px;
  padding: 8px 12px;
  position: sticky;
  top: 0;
  z-index: 20;
}

.brand {
  align-items: center;
  display: flex;
  gap: 12px;
  min-width: 0;
}

.brand-mark {
  border-radius: 8px;
  display: block;
  flex: 0 0 auto;
  height: 32px;
  object-fit: contain;
  width: 32px;
}

.brand h1 {
  font-size: 16px;
  line-height: 1.1;
  margin: 0;
}

.brand h1 span {
  color: var(--teal);
}

.brand p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
  margin: 3px 0 0;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.button {
  align-items: center;
  background: var(--button-bg);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  font-size: 14px;
  font-weight: 700;
  gap: 6px;
  justify-content: center;
  line-height: 1;
  min-height: 38px;
  padding: 0 12px;
  text-decoration: none;
  transition: border-color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
  user-select: none;
}

.button:hover {
  border-color: var(--teal);
  box-shadow: 0 6px 18px color-mix(in srgb, var(--teal) 18%, transparent);
}

.button:active {
  transform: translateY(1px);
}

.button-primary {
  background: var(--button-primary-bg);
  border-color: var(--button-primary-bg);
  color: var(--button-primary-ink);
}

.button-danger {
  border-color: rgba(194, 65, 12, 0.35);
  color: var(--danger);
}

.button-small {
  font-size: 12px;
  min-height: 32px;
  padding: 0 10px;
}

.remove-document-button {
  color: var(--muted);
  min-width: 32px;
  padding: 0;
}

.remove-document-button svg {
  fill: none;
  height: 16px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 16px;
}

.remove-document-button:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.icon-button {
  font-size: 18px;
  min-width: 44px;
  padding: 0;
}

.mini-label {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
  padding: 6px 8px;
  white-space: nowrap;
}

.workspace {
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr);
  min-height: 0;
  padding: 12px;
}

.workspace.rail-open {
  grid-template-columns: minmax(0, 1fr) auto;
}

.preview-column,
.side-rail {
  min-height: 0;
}

.preview-column {
  display: grid;
}

.drop-zone,
.preview-host {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.drop-zone {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 100%;
  overflow: hidden;
  padding: 24px;
}

.drop-zone.dragging {
  border-color: var(--teal);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--teal) 28%, transparent);
}

.intake-strip {
  align-items: stretch;
  display: flex;
  flex-direction: column;
  gap: 20px;
  max-width: 620px;
  width: 100%;
}

.intake-copy {
  min-width: 0;
}

.intake-copy h2 {
  font-size: 28px;
  line-height: 1.08;
  margin: 0 0 6px;
}

.intake-copy p {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.35;
  margin: 0;
}

.start-actions {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  width: 100%;
}

.start-card {
  background: var(--start-card-bg);
  border: 1px solid var(--start-card-border);
  border-radius: 8px;
  color: var(--start-card-ink);
  cursor: pointer;
  display: grid;
  gap: 6px;
  min-height: 88px;
  padding: 16px;
  text-align: left;
  text-decoration: none;
}

.start-card:hover {
  border-color: color-mix(in srgb, var(--teal) 28%, var(--start-card-border));
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.18);
  transform: translateY(-1px);
}

.start-card:active {
  transform: translateY(0);
}

.start-card strong {
  font-size: 15px;
  line-height: 1.1;
}

.start-card span {
  color: var(--start-card-muted);
  font-size: 13px;
  line-height: 1.25;
}

.paste-panel {
  background: transparent;
  display: grid;
  gap: 12px;
  padding: 0;
}

.paste-panel label {
  display: grid;
  gap: 8px;
}

.paste-panel label > span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 800;
}

.paste-panel textarea {
  min-height: 220px;
}

.panel-note {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  margin: -2px 0 0;
}

.paste-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

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

.preview-topline {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  min-height: 48px;
  padding: 6px 10px;
}

.preview-topline strong {
  display: inline-block;
  font-size: 14px;
  max-width: 44vw;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: middle;
  white-space: nowrap;
}

#documentMeta {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  margin-left: 8px;
}

.preview-tools {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.view-toggle {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: inline-flex;
  gap: 2px;
  padding: 3px;
}

.view-toggle-button {
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  min-height: 30px;
  padding: 0 9px;
}

.view-toggle-button.selected {
  background: var(--button-primary-bg);
  color: var(--button-primary-ink);
}

.preview-warning {
  background: color-mix(in srgb, var(--danger) 12%, var(--surface-2));
  border-bottom: 1px solid color-mix(in srgb, var(--danger) 38%, var(--line));
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
  padding: 10px 12px;
}

.source-editor-panel {
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 10px;
  padding: 12px;
}

.source-editor-heading {
  align-items: baseline;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
}

.source-editor-heading label {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 800;
}

.source-editor-heading span {
  color: var(--muted);
  font-size: 12px;
}

.source-editor-panel textarea {
  font-family: var(--mono);
  font-size: 13px;
  min-height: min(34dvh, 360px);
  resize: vertical;
}

.source-editor-actions {
  display: flex;
  gap: 8px;
}

.preview-scroller {
  background: var(--surface-2);
  overflow: auto;
  padding: 12px;
}

.scale-stage {
  margin: 0 auto;
  min-height: 1px;
  min-width: 1px;
  position: relative;
}

.frame-stage {
  background: var(--frame-bg);
  box-shadow: var(--shadow);
  left: 0;
  max-width: none;
  position: absolute;
  top: 0;
  transform-origin: top left;
}

#htmlFrame {
  background: var(--frame-bg);
  border: 0;
  display: block;
  min-height: 650px;
  pointer-events: auto;
  width: 100%;
}

.annotation-layer {
  cursor: crosshair;
  inset: 0;
  pointer-events: none;
  position: absolute;
  z-index: 5;
}

.annotation-layer:focus-visible {
  outline: 0;
}

.frame-stage.annotating #htmlFrame {
  pointer-events: none;
}

.frame-stage.annotating .annotation-layer {
  pointer-events: auto;
}

.frame-stage.browsing .annotation-layer {
  cursor: default;
}

.pin {
  align-items: center;
  background: #11100e;
  border: 2px solid #ffffff;
  border-radius: 999px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, 0.22);
  color: #ffffff;
  display: flex;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 900;
  height: 26px;
  justify-content: center;
  left: 0;
  line-height: 1;
  position: absolute;
  top: 0;
  transform: translate(-50%, -50%) scale(var(--preview-inverse-scale, 1));
  transform-origin: center;
  transition: background 140ms ease, transform 140ms ease;
  width: 26px;
}

.pin.selected {
  background: var(--teal);
  color: #11100e;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 38%, transparent), 0 8px 22px rgba(15, 23, 42, 0.22);
}

.keyboard-cursor {
  border: 3px solid #ffffff;
  border-radius: 999px;
  box-shadow: 0 0 0 3px #11100e, 0 0 0 6px rgba(255, 255, 255, 0.92);
  height: 30px;
  pointer-events: none;
  position: absolute;
  transform: translate(-50%, -50%) scale(var(--preview-inverse-scale, 1));
  transform-origin: center;
  width: 30px;
  z-index: 8;
}

.annotation-layer:not(:focus) .keyboard-cursor {
  display: none;
}

.side-rail {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 14px 36px rgba(0, 0, 0, 0.16);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  width: 320px;
}

.rail-header {
  align-items: center;
  background: color-mix(in srgb, var(--surface-2) 72%, var(--surface));
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  min-height: 56px;
  padding: 0 14px;
}

.rail-header-actions {
  align-items: center;
  display: flex;
  gap: 8px;
}

.rail-copy-button,
.rail-clear-button {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
  min-height: 30px;
  padding: 0 6px;
}

.rail-copy-button {
  background: var(--button-primary-bg);
  border-radius: 6px;
  color: var(--button-primary-ink);
  padding: 0 9px;
}

.rail-copy-button:hover {
  background: var(--ink);
  color: var(--bg);
}

.rail-clear-button:hover {
  color: var(--danger);
}

.mobile-rail-toggle {
  display: none;
}

.rail-heading {
  align-items: center;
  display: flex;
  gap: 9px;
}

.rail-heading h2 {
  font-size: 15px;
  line-height: 1;
  margin: 0;
}

.rail-count {
  align-items: center;
  background: var(--surface-3);
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--muted);
  display: inline-flex;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 800;
  height: 24px;
  justify-content: center;
  min-width: 24px;
  padding: 0 6px;
}

.side-rail .panel {
  background: transparent;
  border: 0;
  border-radius: 0;
  min-height: 0;
  overflow: hidden;
}

.side-rail .panel + .panel {
  border-top: 1px solid var(--line);
}

.notes-rail-body {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
}

.support-footer {
  border-top: 1px solid var(--line);
  flex: 0 0 auto;
  padding: 11px 14px;
  text-align: center;
}

.support-footer button {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
  min-height: 32px;
  padding: 0 8px;
  text-decoration-color: color-mix(in srgb, var(--muted) 48%, transparent);
  text-underline-offset: 3px;
}

.support-footer button:hover {
  color: var(--ink);
  text-decoration: underline;
}

.selected-panel {
  background: color-mix(in srgb, var(--teal) 4%, transparent) !important;
  flex: 0 0 auto;
}

.annotations-panel {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
}

.panel-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
  min-height: 44px;
  padding: 0 14px;
}

.packet-heading-actions {
  align-items: center;
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  justify-content: flex-end;
}

.agent-choice-option {
  align-items: flex-start;
  border-top: 1px solid var(--line);
  color: var(--muted);
  cursor: pointer;
  display: grid;
  gap: 10px;
  grid-template-columns: auto minmax(0, 1fr);
  padding: 12px 14px;
}

.agent-choice-option input {
  accent-color: var(--teal);
  margin: 3px 0 0;
}

.agent-choice-option strong {
  color: var(--ink);
  display: block;
  font-size: 12px;
  line-height: 1.2;
}

.agent-choice-option small {
  display: block;
  font-size: 11px;
  line-height: 1.3;
  margin-top: 3px;
}

.panel-heading h2,
.panel-heading h3 {
  font-size: 15px;
  line-height: 1;
  margin: 0;
}

.note-form {
  display: grid;
  gap: 12px;
  overflow: visible;
  padding: 14px;
}

.note-form label {
  display: grid;
  gap: 6px;
}

.note-form label > span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 800;
}

textarea,
input[type="url"],
select {
  background: var(--bg);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--ink);
  outline: none;
  width: 100%;
}

textarea {
  line-height: 1.4;
  min-height: 44px;
  padding: 11px 12px;
  resize: vertical;
}

input[type="url"] {
  min-height: 44px;
  padding: 0 12px;
}

select {
  min-height: 42px;
  padding: 0 11px;
}

textarea:focus,
input[type="url"]:focus,
select:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--teal) 18%, transparent);
}

.note-actions {
  align-items: center;
  display: flex;
  gap: 8px;
}

#deleteButton {
  background: transparent;
  border-color: transparent;
}

.note-save-hint {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 800;
  margin-left: auto;
}

.annotation-list {
  display: grid;
  align-content: start;
  gap: 3px;
  list-style: none;
  margin: 0;
  max-height: none;
  overflow: auto;
  padding: 8px;
}

.annotation-empty {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.45;
  padding: 18px 8px;
}

.annotation-item {
  align-items: center;
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--ink);
  cursor: pointer;
  display: grid;
  gap: 9px;
  grid-template-columns: 30px minmax(0, 1fr);
  padding: 9px 10px;
  text-align: left;
  width: 100%;
}

.annotation-item:hover {
  background: var(--surface-2);
}

.annotation-item.selected {
  background: color-mix(in srgb, var(--teal) 10%, var(--surface-2));
  box-shadow: inset 3px 0 0 var(--teal);
}

.annotation-item strong {
  align-items: center;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 6px;
  display: flex;
  font-family: var(--mono);
  font-size: 11px;
  height: 28px;
  justify-content: center;
}

.annotation-copy {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.annotation-text {
  color: var(--muted);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.packet-panel {
  display: grid;
  flex: 0 0 auto;
  grid-template-rows: auto;
  margin-top: auto;
}

.packet-body {
  border-top: 1px solid var(--line);
  min-height: 0;
}

.packet-output {
  border: 0;
  border-radius: 0;
  font-family: var(--mono);
  font-size: 12px;
  line-height: 1.45;
  max-height: 42dvh;
  min-height: 240px;
  padding: 12px;
  resize: none;
}

.toast {
  background: var(--button-primary-bg);
  border-radius: 8px;
  bottom: 16px;
  color: var(--button-primary-ink);
  font-size: 13px;
  left: 50%;
  opacity: 0;
  padding: 10px 12px;
  pointer-events: none;
  position: fixed;
  transform: translate(-50%, 12px);
  transition: opacity 160ms ease, transform 160ms ease;
  z-index: 50;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

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

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

@media (forced-colors: active) {
  .keyboard-cursor,
  .pin {
    border-color: Highlight;
    box-shadow: none;
    forced-color-adjust: auto;
  }
}

@media (max-width: 1024px) {
  .app-shell {
    min-height: 0;
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .toolbar {
    flex-wrap: nowrap;
  }

  .workspace {
    grid-template-columns: 1fr;
    min-height: 0;
    padding-bottom: calc(104px + env(safe-area-inset-bottom, 0px));
  }

  .workspace.rail-open {
    grid-template-columns: 1fr;
  }

  .preview-column {
    min-height: 0;
  }

  .side-rail {
    bottom: max(16px, env(safe-area-inset-bottom, 0px));
    display: flex;
    height: min(72dvh, calc(100dvh - 104px - env(safe-area-inset-bottom, 0px)));
    left: 0;
    min-height: 320px;
    overflow: hidden;
    position: fixed;
    right: 0;
    transform: translateY(calc(100% - 64px));
    transition: transform 180ms ease;
    width: auto;
    z-index: 40;
  }

  .side-rail.mobile-open {
    transform: translateY(0);
  }

  .rail-header {
    min-height: 64px;
    padding-bottom: 4px;
  }

  .mobile-rail-toggle {
    align-items: center;
    background: transparent;
    border: 0;
    color: var(--muted);
    cursor: pointer;
    display: flex;
    height: 36px;
    justify-content: center;
    padding: 0;
    width: 36px;
  }

  .mobile-rail-toggle span {
    border-right: 2px solid currentColor;
    border-top: 2px solid currentColor;
    height: 9px;
    transform: rotate(-45deg) translate(-1px, 1px);
    transition: transform 180ms ease;
    width: 9px;
  }

  .side-rail.mobile-open .mobile-rail-toggle span {
    transform: rotate(135deg) translate(-1px, 1px);
  }

  .notes-rail-body {
    overflow: auto;
    padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  }

  .note-form {
    max-height: none;
  }
}

@media (max-width: 700px) {
  body {
    font-size: 15px;
  }

  .topbar {
    gap: 8px;
    min-height: 56px;
    padding: 6px 8px;
  }

  .brand-mark {
    height: 30px;
    width: 30px;
  }

  .brand h1 {
    font-size: 16px;
  }

  .brand p {
    font-size: 12px;
  }

  .toolbar .button {
    min-height: 44px;
  }

  .button-small {
    min-height: 38px;
  }

  .workspace {
    gap: 10px;
    padding: 8px 8px calc(104px + env(safe-area-inset-bottom, 0px));
  }

  .workspace:has(#dropZone:not([hidden])) {
    padding-bottom: calc(18px + env(safe-area-inset-bottom, 0px));
  }

  .workspace:has(#dropZone:not([hidden])) .side-rail {
    display: none;
  }

  .preview-column {
    min-height: auto;
  }

  .drop-zone {
    align-items: flex-start;
    align-self: start;
    background: transparent;
    border: 0;
    min-height: auto;
    overflow: visible;
    padding: 24px 16px 18px;
  }

  .intake-strip {
    align-items: stretch;
    flex-direction: column;
    gap: 16px;
    min-height: 0;
  }

  .intake-copy h2 {
    font-size: 19px;
    line-height: 1.15;
    margin-bottom: 8px;
  }

  .intake-copy p {
    font-size: 14px;
    line-height: 1.35;
  }

  .start-actions,
  .paste-actions,
  .source-editor-actions,
  .note-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .button {
    min-height: 44px;
  }

  .start-actions {
    gap: 8px;
  }

  .start-card {
    gap: 5px;
    min-height: 74px;
    padding: 13px 14px;
  }

  .start-card strong {
    font-size: 14px;
  }

  .start-card span {
    font-size: 12px;
  }

  .preview-topline {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
    padding: 10px 12px;
  }

  .preview-tools {
    justify-content: flex-start;
    width: 100%;
  }

  .view-toggle-button {
    padding: 0 6px;
  }

  #documentMeta {
    margin-left: 0;
  }

  .preview-scroller {
    padding: 8px;
  }

  .frame-stage,
  #htmlFrame {
    min-height: 540px;
  }

  .pin {
    font-size: 12px;
    height: 34px;
    width: 34px;
  }

  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
    min-height: 52px;
    padding-bottom: 10px;
    padding-top: 10px;
  }

  .packet-heading-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .packet-output {
    font-size: 12px;
    min-height: 220px;
  }
}

@media (max-width: 560px) {
  .brand {
    gap: 9px;
  }

  .brand p {
    display: none;
  }

  .workspace {
    padding: 8px 8px calc(104px + env(safe-area-inset-bottom, 0px));
  }

  .toolbar {
    gap: 6px;
  }

  .toolbar .button {
    font-size: 13px;
    padding: 0 11px;
  }

  .icon-button {
    min-width: 42px;
  }

  .drop-zone {
    padding: 24px 16px 28px;
  }

  .preview-scroller {
    padding: 10px;
  }

}
