/* The start screen (index.html, step 3, user 2026-11-14) — Figma 1097:2684
   direction B + Start B 5a / 5e. Loads after styles.css (tokens, dialogs,
   buttons, the status pill) and lifts the player's page lock. */

html:has(body.start-page) { overflow: auto; height: auto; }
body.start-page {
  height: auto;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: auto;
  margin: 0;
  background-color: var(--color-bg-canvas);
  /* The canvas dot grid (Figma: 50 px). */
  background-image: radial-gradient(circle, var(--color-input) 1.5px, transparent 1.5px);
  background-size: 50px 50px;
  background-position: 25px 25px;
  color: var(--color-off-white);
  font: 500 13.5px/1.3 var(--font-display);
}

.start {
  min-height: 100vh;
  min-height: 100dvh;
  box-sizing: border-box;
  /* The PLAYER's page padding (user 2026-11-17): 20 px all round and a 55 px
     top row, so the logo sits exactly where the player's does (styles.css
     .app-corner: top / left 20, min-height 55; phones 12 / 44 below). */
  padding: 20px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 402px);
  grid-template-rows: auto 1fr auto;
  grid-template-areas:
    "top  top"
    "main side"
    "opts opts";
  column-gap: 48px;
}

/* ── Top bar ── */
.start-top {
  grid-area: top;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 55px;
}
/* .start-brand / .start-mark (the logo) live in styles.css — the player
   shows the same logo top-left (user 2026-11-16). */
/* Buttons are the PLAYER's (user 2026-11-15): the pill = styles.css
   .ratio-pill (56 px, 600 13.6 / 17, UI/Input → Highlight + wash + 1.1 on
   hover, 0.94 press), Generate = .btn-ctrl like the player's Run. Only
   layout glue here. */
.start-top-actions { display: flex; gap: 8px; align-self: flex-start; }   /* 56 px pills in the 55 px row: top-aligned on whole px (20), not centred at 19.5 */
.ratio-pill.start-pill { gap: 8px; }
/* Red while there's no key, green once one is saved (user 2026-11-16). */
.start-key-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--color-accent-red); transition: none; }
.start-key.has-key .start-key-dot { background: var(--color-accent-green); }
.ratio-pill.start-open { color: var(--color-off-white); }
.start-key-pop {
  position: fixed;
  z-index: 60;
  width: 320px;
  padding: 16px;
  gap: 10px;
}
.start-key-title { font: 600 13.6px/17px var(--font-display); color: var(--color-off-white); }
.start-key-note { font: 500 11.5px/15px var(--font-display); letter-spacing: 0.4px; color: var(--color-text); }

/* ── Side column: restore card, Recent, the generating frame ── */
.start-side {
  grid-area: side;
  padding-top: 56px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}
.start-caption { font: 500 13.5px/1 var(--font-display); color: var(--color-highlight-plus); padding: 0 14px 10px; }
.start-recent-rows { display: flex; flex-direction: column; gap: 2px; }
.start-recent-row {
  appearance: none;
  position: relative;
  border: none;
  background: transparent;
  text-align: left;
  padding: 8px 14px 10px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  transition: none;
}
.start-recent-row:hover { background: var(--color-panel); }
.start-recent-name { font: 500 17px/1.25 var(--font-display); color: var(--color-off-white); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-right: 64px; }
.start-recent-row.needs-permission .start-recent-name,
.start-recent-row.is-missing .start-recent-name { color: var(--color-text); }
.start-recent-meta { font: 500 12.5px/1.2 var(--font-display); color: var(--color-highlight-plus); display: inline-flex; align-items: center; gap: 6px; min-height: 15px; }
.start-recent-row.needs-permission .start-recent-meta { color: var(--color-text); }
.start-lock { display: inline-flex; }
.start-lock svg { width: 8px; height: auto; display: block; }

.start-restore {
  display: flex;
  gap: 16px;
  padding: 14px;
  border-radius: 20px;
  background: var(--color-panel);
  box-shadow: var(--shadow-frame);
}
.start-restore[hidden] { display: none; }
/* Top-left (Figma 5e), above the statement at the bottom. */
.start-main .start-restore { align-self: flex-start; width: min(520px, 100%); box-sizing: border-box; margin: 16px 0 auto; }
.start-restore-still.is-empty { display: none; }
.start-restore-still {
  flex: 0 0 72px;
  height: 90px;
  border-radius: 6px;
  background: var(--color-input) center / cover no-repeat;
}
.start-restore-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.start-restore-title { font: 600 16px/20px var(--font-display); color: var(--color-off-white); }
.start-restore-name { font: 500 13.5px/17px var(--font-display); color: var(--color-text); }
.start-restore-when { font: 500 12px/16px var(--font-display); color: var(--color-highlight-plus); }
.start-restore-buttons { display: flex; gap: 8px; margin-top: 8px; }

/* The frame a new tool is written into and test-run in (B2). */
.start-frame {
  position: relative;
  width: 100%;
  max-height: 62vh;
  aspect-ratio: 4 / 5;
  margin-left: auto;
  border-radius: 8px;
  background: var(--color-panel);
  box-shadow: inset 0 0 0 0.5px var(--color-stroke-hi);
  overflow: hidden;
}
.start-frame[hidden] { display: none; }
.start-frame:not(.is-wide) { width: auto; height: 62vh; max-width: 100%; }
.start-frame .tool-root { position: absolute; inset: 0; overflow: hidden; border-radius: 8px; }
.start-frame-veil {
  position: absolute;
  inset: 0;
  background: var(--color-panel);
  overflow: hidden;
  transition: opacity 0.4s ease;
}
.start-frame-veil::after {
  content: "";
  position: absolute;
  inset: -50%;
  background: linear-gradient(115deg, transparent 40%, rgba(255, 255, 255, 0.07) 50%, transparent 60%);
  animation: start-shimmer 1.8s linear infinite;
}
@keyframes start-shimmer { from { transform: translateX(-30%); } to { transform: translateX(30%); } }
@media (prefers-reduced-motion: reduce) { .start-frame-veil::after { animation: none; } }
.start-frame.is-ready .start-frame-veil { opacity: 0; }
.start-frame-pill {
  position: absolute;
  top: 12px;
  left: 12px;
  height: 22px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--color-off-white);
  color: var(--color-off-black);
  font: 500 11.5px/22px var(--font-display);
  letter-spacing: 0.5px;
}
body.is-generating .start-restore,
body.is-generating .start-recent { display: none; }

/* ── Statement ── */
.start-main {
  grid-area: main;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-width: 0;
  /* The statement's gaps (user 2026-11-17: "imbalanced"): the prompts row →
     headline and the input → the options row are the SAME --start-gap, so
     the visible gaps match too (the text sits the same distance inside its
     boxes at both ends). */
  --start-gap: 48px;
  padding: 40px 0 var(--start-gap);
}
.start-statement { display: flex; flex-direction: column; max-width: 920px; }
.start-headline,
.start-input {
  font: 500 clamp(38px, 4.4vw, 64px) / 1.0625 var(--font-display);
  letter-spacing: -0.04em;
}
.start-headline { color: var(--color-off-white); }
.start-headline-ext { color: var(--color-text); }   /* ".cimble" in UI/Text — lighter (user 2026-11-17: back from the placeholder's UI/Highlight) */
.start-input {
  width: 100%;
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border: none;
  outline: none;
  resize: none;
  overflow: hidden;
  background: transparent;
  color: var(--color-off-white);
  caret-color: var(--color-off-white);
  transition: none;
}
.start-input::placeholder { color: var(--color-stroke-hi); }
body.is-generating .start-input,
body.is-generating .start-headline { color: var(--color-highlight-plus); }
body.is-dragging .start-headline { color: var(--color-off-white); }
.start-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 20px;
  font: 500 17px/1 var(--font-display);
  color: var(--color-text);
}
.start-progress[hidden] { display: none; }
.start-progress-time { font-variant-numeric: tabular-nums; color: var(--color-off-white); }
.start-spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--color-stroke-hi);
  border-top-color: var(--color-off-white);
  animation: start-spin 0.9s linear infinite;
}
@keyframes start-spin { to { transform: rotate(360deg); } }

/* ── Options row ── */
.start-options { grid-area: opts; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
body.is-generating .start-options { opacity: 0.4; pointer-events: none; }
.start-refs { display: flex; align-items: center; gap: 8px; }
/* The reference button: the player pill as a 56 px disc. */
.ratio-pill.start-round { width: var(--btn-h); min-width: var(--btn-h); padding: 0; }
.start-round[hidden] { display: none; }
.start-round svg { width: 17px; height: 17px; }
/* Reference chips = the Iterate composer's (.prompt-chip / -x). */
.start-chip {
  position: relative;
  width: 44px;
  height: 44px;
  border-radius: 6px;
  background: var(--color-input) center / cover no-repeat;
  box-shadow: inset 0 0 0 1px rgba(247, 247, 247, 0.25);
}
.start-chip-x {
  position: absolute;
  top: -5px;
  right: -5px;
  width: 16px;
  height: 16px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: var(--color-highlight-plus);
  color: var(--color-off-white);
  font: 600 11px/16px var(--font-display);
  cursor: pointer;
  transition: transform 0.15s ease;
}
.start-chip-x:hover { transform: scale(1.15); }
.start-ratios { display: flex; gap: 8px; }
/* The labels' slot (as wide as the widest three — start.js) + the chevron
   at its right end: the chevron never moves (user 2026-11-17). */
.start-try-wrap {
  flex: none;
  margin: 0 0 var(--start-gap, 48px);   /* above the headline, the same gap as below the input (user 2026-11-17) */
  display: flex; align-items: baseline;
  width: calc(var(--try-slot, 260px) + 8px + 28px);
  max-width: 100%;
}
/* Hidden while the field has text — invisible, keeping its room, so the
   headline under it never jumps. */
.start-try-wrap[hidden] { display: flex; visibility: hidden; }
.start-try-wrap[hidden] * { pointer-events: none; }
/* The labels 3 px lower: their lowercase text sits optically level with
   the chevron (user 2026-11-17; the underline doesn't count). */
.start-try-wrap .start-try { margin-left: 0; position: relative; top: 3px; }
.start-try {
  color: var(--color-highlight-plus);
  margin-left: 12px;
  /* THREE labels at a time (user 2026-11-17): this is a window exactly as
     wide as the three on show (start.js sets the width); the strip inside
     slides left to the next three. */
  flex: none;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
}
.start-try-track { display: flex; flex-wrap: nowrap; gap: 10px; align-items: baseline; width: max-content; }
.start-sep { flex: none; }
.start-sep { color: var(--color-highlight-plus); }
.start-try[hidden], .start-try [hidden] { display: none; }
.start-link {
  appearance: none;
  border: none;
  background: none;
  padding: 0;
  font: inherit;
  color: var(--color-text);
  text-decoration: none;
  cursor: pointer;
}
.start-link:hover { color: var(--color-off-white); }
/* The label being typed in the field (user 2026-11-17): lit, with an
   underline growing left → right over its time on screen (a Web Animation,
   start.js#lightLink); hovering any label draws its underline in full. */
.start-link { position: relative; flex: none; padding-bottom: 4px; transition: none; }
.start-link.is-active { color: var(--color-off-white); }
.start-link-line {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left center;
  pointer-events: none;
}
/* Hover line: start.js lineIn / lineOut (Web Animations) — grows in from the
   left; leaving, an unfinished line completes, then sweeps out left → right. */
/* Generate = the player's Run (.btn-ctrl): Off-White when it can run (wash
   + 1.1 on hover), UI/Input with a dim label while the field is empty. */
.btn-ctrl.start-generate {
  align-self: auto;
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: var(--color-off-white);
  color: var(--color-off-black);
}
.btn-ctrl.start-generate:disabled { opacity: 1; cursor: default; background: var(--color-panel); color: var(--color-stroke-hi); }   /* greyed: Panel fill (user 2026-11-17; was UI/Input) */
/* Greyed is aria-disabled now (its hint explains why): no wash, no grow —
   the id beats .btn-ctrl's hover / press rules. */
#startGenerate[aria-disabled="true"],
#startGenerate[aria-disabled="true"]:hover,
#startGenerate[aria-disabled="true"]:active { opacity: 1; cursor: default; background: var(--color-panel); color: var(--color-stroke-hi); transform: none; box-shadow: none; }   /* no wash either (user 2026-11-17) */
.start-generate kbd {
  font: 600 11px/1 var(--font-display);
  padding: 3px 5px;
  border-radius: 4px;
  background: rgba(15, 16, 17, 0.08);
}
.start-generate:disabled kbd { background: transparent; }

/* ── Drag-over (B3): the whole window is the target ── */
.start-drop {
  position: fixed;
  inset: 12px;
  z-index: 40;
  border: 1.5px dashed var(--color-text);
  border-radius: 20px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease;
}
body.is-dragging .start-drop { opacity: 1; }

/* ── Phones: one column ── */
@media (max-width: 820px) {
  .start {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "top" "main" "opts" "side";
    grid-template-rows: auto auto auto auto;
    padding: 20px;
    column-gap: 0;
  }
  .start-key-label { display: none; }
  .ratio-pill.start-key { width: var(--btn-h); min-width: var(--btn-h); padding: 0; }
  .start-main { --start-gap: 28px; padding: 30vh 0 var(--start-gap); }   /* phones: both gaps 28 */
  .start-side { padding-top: 32px; }
  .start-frame, .start-frame:not(.is-wide) { width: 100%; height: auto; max-height: none; }
  body.is-generating .start-main { padding-top: 24px; }
  .start-try, .start-try-wrap { margin-left: 0; }   /* its width = the three on show (start.js) */
  .btn-ctrl.start-generate { margin-left: 0; flex: 1 0 100%; justify-content: center; }   /* full width, like the player's phone Run */
}
/* Touch phones: the player's corner moves to 12 px with a 44 px row (styles.css
   .app-corner) — the start screen follows. */
@media (pointer: coarse) and (max-width: 900px) {
  .start { padding: 12px; }
  .start-top { height: 44px; }
}

/* Generate without a working key → the options row is ONE key step (design
   2D, the companion of 2E — user 2026-11-17). The prompt + ratio stay. */
.start-options.is-keystep > :not(.start-keystep) { display: none; }
.start-keystep {
  flex: 1 1 100%;
  display: flex; flex-direction: column; gap: 10px;
  padding: 14px 16px 16px;
  border-radius: 14px;
  background: var(--color-panel);
}
.start-keystep-lead { font: 500 12px/16px var(--font-display); letter-spacing: 0.3px; color: var(--color-text); }
.start-keystep-title { color: var(--color-off-white); font-weight: 600; }
.start-keystep-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.start-keystep-row .key-field { flex: 0 1 420px; min-width: 220px; }   /* 48 px tall like every key field (styles.css .key-field) */
.start-keystep-facts { flex: 1 1 200px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.start-keystep-facts .key-note { padding: 0; }
.start-keystep-get { font: 500 12px/16px var(--font-display); letter-spacing: 0.3px; color: var(--color-text); text-decoration: none; }
.start-keystep-get:hover { color: var(--color-off-white); }
.start-keystep-later { margin-left: auto; }
.start-key.key-pill { gap: 8px; }

/* ── Recent + unsaved work: the board (design 3·M3, user 2026-11-17) ──
   Cards scattered over the page, each running its cimble live; drag one
   anywhere, a click opens it. start.js renderBoard. */
.start-board { position: fixed; inset: 0; pointer-events: none; z-index: 2; }
body.is-generating .start-board { display: none; }
.start-card {
  position: fixed;
  pointer-events: auto;
  display: flex; flex-direction: column;
  cursor: grab;
  user-select: none;
  touch-action: none;
}
.start-card.is-dragging { cursor: grabbing; }
.start-card-view {
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  background: var(--color-input);
  box-shadow: var(--shadow-frame);
  isolation: isolate;
}
.start-card-empty {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 10px; box-sizing: border-box; text-align: center;
  font: 500 12px/15px var(--font-display); letter-spacing: 0.3px;
  color: var(--color-highlight-plus);
}
.start-card-view.is-live .start-card-empty { display: none; }
.start-card-tool { position: absolute; inset: 0; overflow: hidden; z-index: 1; }
.start-card-root { position: absolute; left: 0; top: 0; transform-origin: 0 0; pointer-events: none; }
/* The tool draws at the card's small pixel density (start.js runLive), so
   its canvas's pixel size is smaller than its layout size — stretch it to
   the root, as a density-1 page would show it. */
.start-card-root canvas { display: block; width: 100% !important; height: 100% !important; }
.start-card-layer { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.start-card-layer.is-below { z-index: 0; }
.start-card-layer.is-above { z-index: 2; }
/* "Open" = the system's small pill (.c1-pill: 22 px, UI/Input, 6 px radius),
   its label Off-White; shown while the card is hovered. */
.start-card-open {
  position: absolute; right: 6px; bottom: 6px; z-index: 3;
  color: var(--color-off-white);
  opacity: 0; transition: opacity 0.15s ease, transform 0.15s ease;
  pointer-events: none;
}
.start-card:not(.is-dragging):hover .start-card-open { opacity: 1; pointer-events: auto; cursor: pointer; }
.start-card.is-dragging .start-card-open { opacity: 1; }   /* stays while the card is dragged (user 2026-11-17) */
/* Hovering "Open" itself: the system's pill hover (the zoom pill's —
   UI/Highlight fill, at once; user 2026-11-17). A click opens the card. */
/* …and it's a BUTTON: the system's hover scale-up (a round button's few px,
   hover-grow.js), a press dips (user 2026-11-17). */
.start-card-open:hover { background: var(--color-stroke-hi); transform: scale(var(--hover-grow, 1.1)); }
.start-card-open:hover:active { transform: scale(0.94); }
.start-card-badge {
  position: absolute; left: 6px; top: 6px; z-index: 3;
  padding: 2px 7px 3px; border-radius: 999px;
  background: var(--color-panel); color: var(--color-off-white);
  font: 500 11px/14px var(--font-display); letter-spacing: 0.3px;
}
.start-card-name {
  margin-top: 8px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font: 500 12.5px/16px var(--font-display); letter-spacing: 0.3px;
  color: var(--color-off-white);
}
.start-card-meta {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font: 500 11px/14px var(--font-display); letter-spacing: 0.3px;
  color: var(--color-text);
}
.start-card-buttons { display: flex; gap: 6px; margin-top: 8px; }
.start-card-btn {
  appearance: none; border: 0; cursor: pointer;
  height: 28px; padding: 0 12px; border-radius: 999px;
  background: var(--color-input); color: var(--color-off-white);
  font: 600 12px/16px var(--font-display); letter-spacing: 0.3px;
  transition: transform 0.15s ease;
}
.start-card-btn.is-primary { background: var(--color-off-white); color: var(--color-off-black); }
.start-card-btn:hover { transform: scale(1.06); }
.start-card-btn:active { transform: scale(0.94); }
.start-board-all {
  position: fixed; right: 28px; bottom: 116px;
  pointer-events: auto;
  appearance: none; border: 0; background: transparent; cursor: pointer;
  padding: 4px 6px 5px; border-radius: 6px;
  font: 500 12.5px/16px var(--font-display); letter-spacing: 0.3px;
  color: var(--color-text);
}
.start-board-all:hover, .start-board-all[aria-expanded="true"] { color: var(--color-off-white); }
.start-all-menu { position: fixed; width: 280px; max-height: 60vh; overflow-y: auto; }

/* Transform controls (user 2026-11-17: resize the Recent cards, the
   controls on hover): the player frame's square handles — 8 px Off-White, a
   UI/Text hairline + the handle shadow — on the picture's corners, a 24 px
   hit area. A corner drag scales from the opposite corner (start.js). */
.start-card-handle {
  position: absolute; z-index: 4;
  width: 8px; height: 8px; margin: -4px 0 0 -4px;
  box-sizing: border-box;
  background: var(--color-off-white);
  border: 0.5px solid var(--color-text);
  box-shadow: var(--shadow-handle);
  opacity: 0; pointer-events: none;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
/* The system's hover scale-up for a small control (the × badges' 1.2),
   kept while it's dragged (user 2026-11-17). */
.start-card-handle:hover, .start-card-handle.is-active { transform: scale(1.2); }
.start-card-handle::before { content: ""; position: absolute; inset: -8px; }
/* Like a layer in the player (user 2026-11-17): hovered → the blue outline;
   clicked → selected: the blue stroke + its corner handles, until a click
   elsewhere (or Esc). Only "Open" opens it. */
.start-card.is-selected .start-card-handle,
.start-card.is-resizing .start-card-handle { opacity: 1; pointer-events: auto; }
.start-card-view::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  outline: 1px solid var(--color-accent);
  outline-offset: -1px;
  opacity: 0;
  pointer-events: none;
  z-index: 2;
}
.start-card:hover .start-card-view::after,
.start-card.is-selected .start-card-view::after { opacity: 1; }
.start-card-handle[data-corner="nw"], .start-card-handle[data-corner="se"] { cursor: nwse-resize; }
.start-card-handle[data-corner="ne"], .start-card-handle[data-corner="sw"] { cursor: nesw-resize; }
.start-card.is-resizing, .start-card.is-resizing * { cursor: inherit; }
.start-card.is-resizing .start-card-open { opacity: 0; }
@media (max-width: 759px) { .start-card-handle { display: none; } }

/* Next example (user 2026-11-17): the dropdowns' chevron square — no fill at
   rest, UI/Input on hover (at once), the glyph Off-White; a press dips. */
.start-try-next {
  appearance: none; border: 0; padding: 0; cursor: pointer;
  transition: transform 0.15s ease;   /* the square-button hover: the WHOLE button grows (user 2026-11-17) */
  flex: none;
  width: 28px; height: 28px; margin-left: auto;
  align-self: center;
  position: relative; top: -2px;   /* 2 px up (user 2026-11-17) */
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 8px;
  background: transparent;
  color: var(--color-text);
}
.start-try-next svg { transform: rotate(-90deg); }
.start-try-next:hover { background: var(--color-input); color: var(--color-off-white); transform: scale(1.1); }
.start-try-next:active, .start-try-next:hover:active { transform: scale(0.94); }
.start-try-next[hidden] { display: none; }

