.canvas-open-button {
  width: 100%;
  min-height: 45px;
  padding: 12px 15px;
  border: 0;
  border-radius: 12px;
  background: var(--selected-bg);
  color: var(--selected-ink);
  font: inherit;
  font-weight: 650;
  font-size: 13px;
  margin: 0 0 20px;
  text-align: left;
}
.canvas-open-button:focus-visible {
  background: var(--focus-bg);
  color: var(--focus-ink);
}
dialog.canvas-editor {
  position: fixed;
  inset: 0;
  margin: 0;
  width: 100dvw;
  max-width: none;
  height: 100dvh;
  max-height: none;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: var(--bg);
  color: var(--ink);
  overflow: auto;
  overscroll-behavior: contain;
}
.canvas-editor::backdrop {
  background: #0009;
}
.ce-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  position: sticky;
  top: 0;
  z-index: 20;
  padding: calc(16px + env(safe-area-inset-top)) 28px 14px;
  background: var(--paper);
}
.ce-header h2 {
  font-size: 21px;
  letter-spacing: -0.7px;
}
.ce-header p {
  margin: 4px 0 0;
  font-size: 11px;
  line-height: 1.4;
  color: var(--muted);
  max-width: 65vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ce-header button {
  min-width: 80px;
}
.ce-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(330px, 1.1fr);
  gap: 35px;
  max-width: 1060px;
  margin: 0 auto;
  padding: 24px 30px calc(28px + env(safe-area-inset-bottom));
}
.ce-view {
  align-self: start;
  position: sticky;
  top: 105px;
  min-width: 0;
}
.ce-frame {
  position: relative;
  isolation: isolate;
  width: min(100%, 36svh, 360px);
  aspect-ratio: 9/16;
  margin: 0 auto;
  border-radius: 17px;
  overflow: hidden;
  background: #151317;
}
.ce-frame > #ce-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: cover;
  border-radius: 0;
  background: #151317;
}
.ce-frame > #ce-elements {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.ce-element {
  position: absolute;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: grab;
  transform: translate(-50%, -50%);
  z-index: 3;
  max-width: 86.6%;
}
.ce-element:active {
  cursor: grabbing;
}
.ce-element.is-dragging,
.ce-block.is-dragging {
  will-change: transform;
  transition: none !important;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.ce-element.is-dragging * {
  animation-play-state: paused !important;
}
.ce-block {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
.ce-element img,
.ce-element video {
  -webkit-user-drag: none;
}
.ce-element.is-selected::after,
.ce-element:focus-visible::after {
  content: "↔";
  position: absolute;
  top: -23px;
  right: 0;
  display: grid;
  place-items: center;
  min-width: 27px;
  height: 20px;
  border-radius: 6px;
  background: var(--selected-bg);
  color: var(--selected-ink);
  font-family: Arial, sans-serif;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  text-shadow: none;
}
.ce-element:focus-visible {
  outline: none;
  box-shadow: none;
}
.ce-caption {
  width: max-content;
  --caption-base-size: 24px;
  font-size: var(--caption-base-size);
  text-align: center;
  line-height: 1.25;
  z-index: 6;
}
.ce-caption.caption-render {
  font-size: var(--caption-base-size);
}
.ce-card {
  width: 75.55%;
  font-size: clamp(11px, 1.1vw, 17px);
  font-weight: 750;
  line-height: 1.25;
  text-align: center;
  padding: 11px 9px;
  border-radius: 8px;
  overflow-wrap: anywhere;
  box-shadow: 0 3px 14px #0002;
  background: #252722;
  color: #fffefa;
}
.ce-card-number {
  background: #e2ed9b;
  color: #252722;
}
.ce-card-quote {
  background: #d5b9f4;
  color: #252722;
}
.ce-insert {
  width: 59.26%;
  max-height: 31.77%;
  height: auto;
  max-width: 59.26%;
  background: #fffefa;
  padding: 3px;
  border-radius: 4px;
  box-shadow: 0 3px 15px #0003;
}
.ce-insert img,
.ce-insert video {
  display: block;
  width: 100%;
  height: auto;
  max-height: calc(31svh);
  object-fit: contain;
  border-radius: 1px;
  pointer-events: none;
}
.ce-title {
  position: absolute;
  top: 8%;
  left: 8%;
  right: 8%;
  font-size: clamp(12px, 1.4vw, 18px);
  font-weight: 750;
  line-height: 1.25;
  overflow-wrap: anywhere;
  text-align: center;
  padding: 9px 10px;
  border-radius: 7px;
  background: #fffefa;
  color: #252722;
  pointer-events: none;
  z-index: 2;
}
.ce-frame > .ce-title-render {
  right: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  font-weight: 700;
  transform: translateX(-50%);
  paint-order: stroke fill;
  overflow-wrap: normal;
  word-break: normal;
}
.ce-title-render .ce-title-line,
.ce-card-render .ce-card-line {
  display: block;
  white-space: pre;
}
.ce-card.ce-card-render {
  flex-direction: column;
  overflow-wrap: normal;
  word-break: normal;
}
.ce-transport {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  max-width: 440px;
  margin: 15px auto 0;
}
.ce-transport button {
  width: 44px;
  min-width: 44px;
  height: 44px;
  border: 0;
  border-radius: 12px;
  background: var(--surface-3);
  color: var(--ink);
  font-size: 23px;
}
.ce-transport input {
  min-width: 0;
  flex: 1;
  accent-color: var(--ink);
  height: 34px;
  background: transparent;
}
.ce-transport output {
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  color: var(--muted);
}
.ce-tools {
  min-width: 0;
}
.ce-tools-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.ce-tools-heading h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 650;
  letter-spacing: -0.4px;
}
.ce-tools-heading .quiet {
  font-size: 11px;
}
.ce-hint,
.ce-key-hint {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  margin: 8px 0 18px;
}
.ce-selection {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  margin: 16px 0 12px;
  min-height: 22px;
  overflow-wrap: anywhere;
}
.ce-selection-actions {
  display: flex;
  gap: 9px;
  margin: 13px 0;
}
.ce-selection-actions button {
  flex: 1;
}
.ce-selection-tools .control-label {
  margin: 12px 0 8px;
}
#ce-duration {
  width: 100%;
  height: 34px;
  accent-color: var(--ink);
}
.ce-timeline {
  margin-top: 24px;
  min-width: 0;
}
.ce-track-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.ce-track-label {
  flex: 0 0 45px;
  font-size: 10px;
  color: var(--muted);
}
.ce-track {
  flex: 1;
  position: relative;
  min-width: 0;
  height: 45px;
  overflow: hidden;
  background: var(--input-bg);
  border-radius: 8px;
}
.ce-track::after {
  content: "";
  position: absolute;
  left: var(--playhead, 0%);
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--ink);
  opacity: 0.5;
  pointer-events: none;
  z-index: 4;
}
.ce-track-empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 11px;
}
.ce-block {
  position: absolute;
  top: 5px;
  height: 35px;
  min-width: 20px;
  border: 0;
  border-radius: 5px;
  background: var(--surface-3);
  color: var(--ink);
  font-size: 10px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 6px 8px;
  text-align: left;
  touch-action: none;
  cursor: grab;
}
.ce-block[aria-pressed="true"] {
  background: var(--selected-bg);
  color: var(--selected-ink);
}
.ce-block:focus-visible,
.ce-transport button:focus-visible {
  outline: none;
  background: var(--focus-bg);
  color: var(--focus-ink);
  box-shadow: none;
}
.ce-key-hint {
  font-size: 11px;
}
.ce-save {
  margin-top: 25px;
}
.ce-save .primary {
  min-height: 52px;
}
.ce-loading {
  padding: 60px 20px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}
.ce-error {
  margin: 16px auto;
  padding: 13px 17px;
  border-radius: 12px;
  max-width: 900px;
  background: var(--error-bg);
  color: var(--error-ink);
  font-size: 13px;
  line-height: 1.5;
}
.ce-error:empty {
  display: none;
}
:root[data-variant="glass"] .ce-header {
  background: var(--panel-bg);
  backdrop-filter: blur(20px) saturate(1.15);
  -webkit-backdrop-filter: blur(20px) saturate(1.15);
}
:root[data-variant="glass"] .ce-tools {
  padding: 24px;
  border-radius: 22px;
  background: var(--panel-bg);
}
:root[data-variant="classic"] .ce-tools {
  padding: 24px;
  border-radius: 18px;
  background: var(--paper);
}
@media (max-width: 680px) {
  .ce-header {
    padding: calc(11px + env(safe-area-inset-top)) 18px 10px;
  }
  .ce-header h2 {
    font-size: 19px;
  }
  .ce-header p {
    font-size: 10px;
  }
  .ce-layout {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 16px 18px calc(25px + env(safe-area-inset-bottom));
  }
  .ce-view {
    position: static;
    width: 100%;
  }
  .ce-frame {
    width: min(100%, 24.75svh, 260px);
  }
  .ce-transport {
    gap: 10px;
    margin-top: 12px;
  }
  .ce-transport output {
    font-size: 10px;
  }
  .ce-tools-heading h3 {
    font-size: 16px;
  }
  :root[data-variant] .ce-tools {
    padding: 17px;
  }
  .ce-hint {
    font-size: 11px;
    margin: 5px 0 12px;
  }
  .ce-key-hint {
    font-size: 10px;
    line-height: 1.5;
  }
  .ce-timeline {
    margin-top: 19px;
  }
  .ce-track-row {
    gap: 8px;
    margin-bottom: 9px;
  }
  .ce-track-label {
    flex-basis: 40px;
    font-size: 9px;
  }
  .ce-selection {
    margin-top: 10px;
    font-size: 12px;
  }
  .ce-frame .ce-card {
    font-size: 12px;
    padding: 8px;
  }
  .ce-title {
    font-size: 12px;
    padding: 6px;
  }
  .ce-save {
    margin-top: 18px;
  }
}
@media (prefers-reduced-transparency: reduce) {
  :root[data-variant] .ce-header,
  :root[data-variant] .ce-tools {
    background: var(--paper);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
}
.ce-insert {
  max-height: none;
  overflow: visible;
}
.ce-insert img,
.ce-insert video {
  max-height: none;
  object-fit: contain;
}
.canvas-editor input[type="range"]:focus-visible {
  outline: none;
  box-shadow: none;
  background: var(--focus-bg);
  border-radius: 8px;
}
.ce-transport input:focus-visible {
  outline: none;
  box-shadow: none;
  background: var(--focus-bg);
  border-radius: 8px;
}
.ce-card {
  overflow-wrap: normal;
  word-break: normal;
  line-height: 1.25;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: visible;
}
.ce-element::before {
  content: "";
  position: absolute;
  inset: -10px;
}
.ce-insert img,
.ce-insert video {
  max-width: 100%;
  object-fit: contain;
}
.ce-add {
  position: relative;
  margin: 8px 0 15px;
}
.ce-add > #ce-add-toggle {
  min-width: 120px;
}
.ce-add-menu {
  position: absolute;
  z-index: 25;
  top: 48px;
  left: 0;
  min-width: 200px;
  max-width: calc(100vw - 72px);
  background: var(--menu-bg);
  color: var(--ink);
  border-radius: 14px;
  padding: 8px;
  display: grid;
  gap: 8px;
  box-shadow: 0 12px 30px #0002;
}
.ce-add-menu button {
  border: 0;
  border-radius: 9px;
  min-height: 44px;
  background: var(--surface-2);
  color: var(--ink);
  font: inherit;
  font-size: 13px;
  text-align: left;
  padding: 10px 12px;
}
.ce-add-menu button:focus-visible {
  outline: none;
  box-shadow: none;
  background: var(--focus-bg);
  color: var(--focus-ink);
}
#ce-upload-status {
  font-size: 12px;
  color: var(--muted);
  margin: 8px 0;
}
.ce-card-kinds {
  display: flex;
  gap: 6px;
  margin: 10px 0;
}
.ce-card-kinds button {
  flex: 1;
  min-height: 38px;
  border: 0;
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--ink);
  font-size: 11px;
  padding: 8px;
}
.ce-card-kinds button[aria-pressed="true"] {
  background: var(--selected-bg);
  color: var(--selected-ink);
}
.ce-card-kinds button:focus-visible {
  outline: none;
  box-shadow: none;
  background: var(--focus-bg);
  color: var(--focus-ink);
}
