/* The playable Cutlet editor on the landing page.
   Colours are the app's dark mode (Cutlet/Theme.swift), so it looks like the real thing. */

.cd {
  --cd-bg: #1B1D21;
  --cd-card: #25272C;
  --cd-raised: #30333A;
  --cd-fg: #F5F6F8;
  --cd-muted: #A7ABB3;
  --cd-border: #3A3D44;
  --cd-input: #3A3D44;
  --cd-primary: #F5F6F8;
  --cd-primary-fg: #17191D;
  --cd-track: #25272C;
  --cd-tick: #4A4D55;
  --cd-clip: #3A2427;      --cd-clip-edge: #5A3236;
  --cd-video: #5A2A2E;     --cd-video-edge: #7A363C;
  --cd-zoom: #8E3A3F;      --cd-zoom-edge: #A8474D;
  --cd-text: #2F2326;      --cd-text-edge: #5A3236;
  --cd-selected: #A3302B;
  --cd-playhead: #FF6B61;

  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 248px;
  grid-template-rows: auto 1fr auto;
  height: min(720px, 78vw);
  min-height: 560px;
  background: var(--cd-bg);
  color: var(--cd-fg);
  border-radius: 12px;
  overflow: hidden;
  font: 13px/1.35 var(--font, system-ui);
  box-shadow: 0 30px 60px -20px rgba(23,25,29,.35), 0 0 0 1px rgba(23,25,29,.4);
  user-select: none;
  -webkit-user-select: none;
  outline: none;
}
.cd:focus-visible { box-shadow: 0 0 0 3px var(--red, #D62920), 0 30px 60px -20px rgba(23,25,29,.35); }
.cd button { font: inherit; color: inherit; }
.cd svg { display: block; }

/* Light mode: the app's light tokens (Cutlet/Theme.swift). */
.cd.light {
  --cd-bg: #FFFFFF; --cd-card: #F5F6F8; --cd-raised: #EEF0F3; --cd-fg: #17191D; --cd-muted: #626773;
  --cd-border: #DFE2E8; --cd-input: #DFE2E8; --cd-primary: #17191D; --cd-primary-fg: #FFFFFF;
  --cd-track: #F5F6F8; --cd-tick: #C9CDD5;
  --cd-clip: #FBE6E8; --cd-clip-edge: #F0B8BD; --cd-video: #F6CDD1; --cd-video-edge: #E9A3AA;
  --cd-zoom: #E8868D; --cd-zoom-edge: #D9646C; --cd-text: #FDF1F2; --cd-text-edge: #F0B8BD;
  --cd-selected: #D62920; --cd-playhead: #D62920;
  box-shadow: 0 30px 60px -20px rgba(23,25,29,.25), 0 0 0 1px rgba(23,25,29,.1);
}
.cd.light .cd-btn:hover, .cd.light .cd-btn.ghost:hover { background: #F2F3F5; border-color: #CDD1D8; }
.cd.light .cd-btn.primary:hover { background: #272A30; }
.cd.light .cd-play:hover { background: #E4E6EA; }
.cd.light .cd-seg { box-shadow: inset 0 1px 1px rgba(23,25,29,.08); }
.cd.light .cd-swatches button { border-color: rgba(23,25,29,.15); }
.cd.light input[type="text"]:focus { border-color: #9097A3; }
.cd.light .cd-cut { background: #FFF1DE; color: #C46A00; }
.cd.light .cd-panel { background: #FBFBFC; }
.cd { transition: background .25s, color .25s; }

/* Header */
.cd-header { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; padding: 10px 14px 10px 16px;
             border-bottom: 1px solid var(--cd-border); min-height: 52px; }
.cd-lights { display: flex; gap: 7px; margin-right: 18px; }
.cd-lights i { width: 12px; height: 12px; border-radius: 50%; display: block; }
.cd-lights i:nth-child(1) { background: #FF5F57; } .cd-lights i:nth-child(2) { background: #FEBC2E; } .cd-lights i:nth-child(3) { background: #28C840; }
.cd-mark { width: 24px; height: 24px; border-radius: 6px; }
.cd-title { display: flex; flex-direction: column; line-height: 1.2; }
.cd-title b { font-weight: 600; font-size: 13px; }
.cd-title span { color: var(--cd-muted); font-size: 11.5px; font-family: var(--mono, monospace); white-space: nowrap; }
.cd-spacer { flex: 1; }

.cd-btn { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 7px;
          border: 1px solid var(--cd-input); background: var(--cd-bg); cursor: pointer; font-weight: 500; font-size: 12.5px;
          transition: background .12s ease-out, border-color .12s ease-out; white-space: nowrap; }
.cd-btn:hover { background: #33363D; border-color: #4A4E56; }
.cd-btn.primary { background: var(--cd-primary); color: var(--cd-primary-fg); border-color: transparent; }
.cd-btn.primary:hover { background: #E4E6EA; }
.cd-btn.ghost { border-color: transparent; background: transparent; padding: 0 7px; }
.cd-btn.ghost:hover { background: #33363D; }
.cd-btn.small { height: 26px; font-size: 12px; }
.cd-btn.danger { color: #FF8A82; }
.cd-btn svg { width: 14px; height: 14px; }

/* Preview */
.cd-stage { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; padding: 14px 14px 8px; gap: 8px; }
.cd-canvas-wrap { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; }
.cd-canvas-wrap canvas { display: block; border-radius: 4px; cursor: default; touch-action: pan-y; }
.cd-transport { display: flex; align-items: center; gap: 10px; justify-content: center; }
.cd-play { width: 30px; height: 30px; border-radius: 50%; border: none; background: var(--cd-raised); cursor: pointer;
           display: grid; place-items: center; transition: background .12s; }
.cd-play:hover { background: #3A3D44; }
.cd-play svg { width: 13px; height: 13px; }
.cd-time { font: 500 12px var(--mono, monospace); color: var(--cd-muted); min-width: 120px; }
.cd-time b { color: var(--cd-fg); font-weight: 500; }

/* Side panel */
.cd-panel { grid-row: 2 / 4; grid-column: 2; border-left: 1px solid var(--cd-border); overflow-y: auto; scrollbar-width: none; }
.cd-panel::-webkit-scrollbar { display: none; }
.cd-section { padding: 12px 14px; border-bottom: 1px solid var(--cd-border); display: grid; gap: 10px; }
.cd-section h4 { margin: 0; font-size: 12.5px; font-weight: 600; }
.cd-row { display: grid; grid-template-columns: 72px 1fr; align-items: center; gap: 10px; color: var(--cd-muted); }
.cd-note { color: var(--cd-muted); font-size: 11.5px; margin: 0; }
.cd-seg { display: flex; background: var(--cd-card); border-radius: 8px; padding: 2px; box-shadow: inset 0 1px 0 rgba(0,0,0,.25); }
.cd-seg button { flex: 1; border: 0; background: transparent; padding: 5px 4px; border-radius: 6px; cursor: pointer;
                 color: var(--cd-muted); font-size: 11.5px; font-weight: 500; transition: background .15s, color .15s; }
.cd-seg button:hover { color: var(--cd-fg); }
.cd-seg button[aria-pressed="true"] { background: var(--cd-primary); color: var(--cd-primary-fg); }
.cd input[type="text"] { width: 100%; height: 28px; border-radius: 7px; border: 1px solid var(--cd-input); background: var(--cd-bg);
                         color: var(--cd-fg); padding: 0 9px; font: inherit; font-size: 12.5px; }
.cd input[type="text"]:focus { outline: none; border-color: #6B717D; }
.cd input[type="range"] { width: 100%; accent-color: var(--cd-primary); height: 16px; }
.cd input[type="color"] { width: 34px; height: 20px; border: 1px solid var(--cd-input); border-radius: 10px; padding: 0; background: none; cursor: pointer; }
.cd input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.cd input[type="color"]::-webkit-color-swatch { border: none; border-radius: 9px; }
.cd-swatches { display: flex; gap: 6px; flex-wrap: wrap; }
.cd-swatches button { width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(255,255,255,.25); cursor: pointer; padding: 0; }
.cd-swatches button[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--cd-bg), 0 0 0 4px #9097A3; }
.cd-defaults { width: 100%; justify-content: center; margin: 10px 0 14px; }

/* Timeline */
.cd-timeline { grid-column: 1; border-top: 1px solid var(--cd-border); padding: 6px 12px 10px 0; position: relative; }
.cd-tl-grid { display: grid; grid-template-columns: 30px 1fr; row-gap: 4px; }
.cd-tl-icon { display: grid; place-items: center; color: var(--cd-muted); }
.cd-tl-icon svg { width: 12px; height: 12px; }
.cd-ruler, .cd-lane { position: relative; }
.cd-ruler { height: 20px; cursor: pointer; }
.cd-ruler .tick { position: absolute; bottom: 0; width: 1px; height: 4px; background: var(--cd-tick); }
.cd-ruler .label { position: absolute; top: 2px; transform: translateX(-50%); font: 500 10px var(--mono, monospace); color: var(--cd-muted); }
.cd-lane { height: 22px; background: var(--cd-track); border-radius: 5px; cursor: pointer; touch-action: pan-y; }
.cd-lane.video { height: 34px; }
.cd-block { position: absolute; top: 0; bottom: 0; border-radius: 5px; border: 1px solid; display: flex; align-items: center;
            justify-content: center; gap: 4px; font-size: 10.5px; font-weight: 500; overflow: hidden; white-space: nowrap;
            cursor: grab; touch-action: pan-y; transition: background .12s; }
.cd-block:active { cursor: grabbing; }
.cd-block.clip { background: var(--cd-clip); border-color: var(--cd-clip-edge); justify-content: flex-start; padding-left: 6px; cursor: pointer; }
.cd-block.piece { background: var(--cd-video); border-color: var(--cd-video-edge); cursor: pointer; }
.cd-block.zoom { background: var(--cd-zoom); border-color: var(--cd-zoom-edge); }
.cd-block.card { background: #D62920; border-color: #A3302B; color: #fff; cursor: default; z-index: 1; }
.cd-block.text { background: var(--cd-text); border-color: var(--cd-text-edge); justify-content: flex-start; padding-left: 6px; }
.cd-block.selected { background: var(--cd-selected); border-color: var(--cd-fg); border-width: 1.5px; color: #fff; }
.cd-block svg { width: 10px; height: 10px; flex: none; }
.cd-edge { position: absolute; top: 0; bottom: 0; width: 8px; cursor: ew-resize; }
.cd-edge.l { left: -2px; } .cd-edge.r { right: -2px; }
.cd-cut { position: absolute; top: 50%; transform: translate(-50%, -50%); width: 22px; height: 22px; border-radius: 50%;
          border: 0; background: #3A2A14; color: #FFB65C; display: grid; place-items: center; cursor: pointer; z-index: 2; }
.cd-cut svg { width: 11px; height: 11px; }
.cd-playhead { position: absolute; top: 4px; bottom: 6px; width: 2px; margin-left: -1px; background: var(--cd-playhead); pointer-events: none; z-index: 3; }
.cd-playhead::before { content: ""; position: absolute; top: 0; left: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--cd-playhead); }

/* Messages */
.cd-toast { position: absolute; left: 50%; bottom: 150px; transform: translate(-50%, 8px); background: var(--cd-fg); color: var(--cd-primary-fg);
            padding: 9px 14px; border-radius: 9px; font-weight: 500; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s;
            z-index: 5; max-width: 80%; text-align: center; }
.cd-toast.show { opacity: 1; transform: translate(-50%, 0); }
.cd-hint { text-align: center; margin-top: 18px; font-size: 14px; color: var(--muted, #626773); }
.cd-hint kbd { font: 500 12px var(--mono, monospace); border: 1px solid var(--border, #DFE2E8); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; background: #fff; }

@media (prefers-reduced-motion: reduce) {
  .cd *, .cd-toast { transition: none !important; }
}

/* Narrow screens: the side panel moves under the timeline. */
@media (max-width: 860px) {
  .cd { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(220px, 62vw) auto auto; height: auto; min-height: 0; }
  .cd-header { gap: 6px; padding: 8px 10px; }
  .cd-lights, .cd-title span { display: none; }
  .cd-ruler .label:nth-of-type(even) { display: none; }
  .cd-panel { grid-row: 4; grid-column: 1; border-left: 0; border-top: 1px solid var(--cd-border); max-height: 300px; }
  .cd-header .cd-btn span { display: none; }
  .cd-lights { margin-right: 6px; }
  .cd-toast { bottom: 50%; }
}

/* Phones: vertical swipes on the preview and timeline scroll the page (touch-action: pan-y
   above), and text fields are 16px so iOS doesn't zoom the page in when one is tapped. */
@media (pointer: coarse) {
  .cd input[type="text"] { font-size: 16px; }
}
