/* Inkling. Mobile first: one column on phones, more room on bigger screens. */
:root {
  color-scheme: light;
  --ink: #12302c; --muted: #5f726d; --line: #dbe4dc; --paper: #f6f7f1; --card: #ffffff;
  --green: #0f766e; --green-soft: #e6f6f2; --lime: #c3f192; --violet: #6d28d9; --violet-soft: #f3efff;
  --amber: #b45309; --amber-soft: #fff7e6; --blue-pencil: #4f8fe6;
  --radius: 16px; --radius-sm: 10px; --shadow: 0 1px 2px #0b24220a, 0 8px 24px #0b242212;
  --ease: cubic-bezier(.2, .8, .2, 1); --spring: cubic-bezier(.34, 1.56, .64, 1);
  --pad: clamp(14px, 4vw, 32px);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; color: var(--ink); background: var(--paper); font: 15px/1.5 ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
button:disabled { opacity: .4; cursor: not-allowed; }
a { color: inherit; }
:focus-visible { outline: 3px solid #d5a12b; outline-offset: 3px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); margin: 4px 0 0; font-size: 13px; }
.eyebrow { margin: 0 0 4px; font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--green); }

/* Tap feedback everywhere: a small press, a springy release. */
button:not(:disabled) { transition: transform .18s var(--spring), background-color .2s, color .2s, box-shadow .2s, border-color .2s; }
button:not(:disabled):active { transform: scale(.95); }

/* ---------- Header + hero ---------- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 10px var(--pad); padding-top: max(10px, env(safe-area-inset-top)); background: #0b2422f2; backdrop-filter: blur(10px); color: #e9f2ec; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; margin-right: auto; }
.brand-mark { width: 26px; height: 26px; fill: #e9f2ec; }
.brand-spark { fill: var(--lime); transform-origin: 25px 7.5px; animation: twinkle 4s var(--ease) infinite; }
@keyframes twinkle { 0%, 86%, 100% { transform: scale(1) rotate(0); } 92% { transform: scale(1.35) rotate(45deg); } }
.wordmark { font: 600 22px/1 Georgia, serif; letter-spacing: -.5px; }
.connection { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: #b9cbc3; white-space: nowrap; }
@media (max-width: 359px) { .ai-modes button { padding: 0 7px; font-size: 12px; } .ai-modes .long { display: none; } .ink-dot { width: 24px; height: 24px; } }
@media (max-width: 359px) { #connection { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); } }
.dot { width: 8px; height: 8px; border-radius: 50%; background: #d4a237; }
.dot.online { background: #34d399; box-shadow: 0 0 0 0 #34d39966; animation: ping 2.4s infinite; }
@keyframes ping { 0% { box-shadow: 0 0 0 0 #34d39966; } 70%, 100% { box-shadow: 0 0 0 7px #34d39900; } }
.help-button { width: 32px; height: 32px; border-radius: 50%; border: 1px solid #3b5e57; background: transparent; color: #e9f2ec; font-weight: 700; }
.help-button:hover { background: #17403b; }
main { max-width: 1320px; margin: 0 auto; padding: 0 var(--pad) 40px; }
.hero { padding: clamp(18px, 4vw, 36px) 0 clamp(12px, 2.5vw, 20px); animation: rise .6s var(--ease) both; }
.hero h1 { margin: 0; font: 600 clamp(32px, 6.4vw, 60px)/1.02 Georgia, serif; letter-spacing: -.03em; }
.hero h1 span { display: block; color: #7c968a; }
.lede { margin: 12px 0 0; font-size: clamp(15px, 2.4vw, 19px); color: var(--muted); max-width: 40ch; }
.lede b { color: var(--ink); font-weight: 650; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- How it works (4 steps) ---------- */
.guide { margin-bottom: 18px; animation: rise .6s .08s var(--ease) both; }
.guide[hidden] { display: none; }
.guide-steps { list-style: none; display: flex; gap: 8px; margin: 0; padding: 2px 2px 6px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.guide-steps::-webkit-scrollbar { display: none; }
.guide-step { flex: 0 0 min(78%, 260px); scroll-snap-align: start; display: grid; grid-template-columns: 28px 1fr; gap: 2px 10px; align-items: start; padding: 12px; border-radius: var(--radius-sm); background: var(--card); border: 1px solid var(--line); transition: border-color .3s, box-shadow .3s, opacity .3s; }
.guide-step.next { border-color: var(--green); box-shadow: 0 6px 18px #0f766e1f; }
.guide-step.done { opacity: .6; }
.guide-num { grid-row: span 2; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: #e7efe4; font-size: 12px; font-weight: 700; }
.guide-step.next .guide-num { background: var(--green); color: white; }
.guide-step.done .guide-num { background: var(--lime); animation: pop .5s var(--spring); }
@keyframes pop { 0% { transform: scale(.4); } 100% { transform: scale(1); } }
.guide-body b { display: block; font-size: 14px; }
.guide-body span { display: block; font-size: 12.5px; color: var(--muted); }
.guide-step .mini { grid-column: 2; justify-self: start; margin-top: 6px; }
.guide-foot { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); padding: 2px 2px 0; }

/* ---------- Studio: canvas + save ---------- */
/* backwards, not both: a lingering transform would trap the phone sketch sheet (position: fixed) inside .studio */
.studio { display: grid; gap: 14px; animation: rise .6s .14s var(--ease) backwards; }
.canvas-card, .save-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.canvas-card { overflow: hidden; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px; border-bottom: 1px solid var(--line); background: #fbfcf8; }
.tools { display: flex; gap: 2px; padding: 3px; border-radius: 12px; background: #eef3ec; overflow-x: auto; scrollbar-width: none; }
.tool { display: grid; place-items: center; min-width: 38px; height: 36px; border: 0; border-radius: 9px; background: none; color: var(--muted); font-size: 15px; }
.tool svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tool[aria-pressed="true"] { background: white; color: var(--ink); box-shadow: 0 1px 3px #0b242222; }
.tool.spark-tool { color: var(--violet); }
.tool.spark-tool[aria-pressed="true"] { background: var(--violet); color: white; }
@keyframes shine { 0%, 70% { transform: translateX(-100%); } 100% { transform: translateX(100%); } }
.toolbar-row { flex: 1 1 100%; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar-spacer { flex: 1; }
.swatch input[type="color"], .fill-control input[type="color"] { width: 34px; height: 34px; padding: 2px; border: 1px solid var(--line); border-radius: 9px; background: white; cursor: pointer; }
.fill-control { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.fill-control input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--green); margin: 0; }
.size-control { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
input[type="range"] { width: 88px; accent-color: var(--green); }
.icon-button { min-width: 36px; height: 36px; padding: 0 8px; border: 1px solid transparent; border-radius: 9px; background: none; color: var(--ink); font-size: 16px; }
.icon-button:hover:not(:disabled) { background: #eef3ec; }
.guide-controls { display: inline-flex; }
.guide-controls[hidden] { display: none; }
#guides-toggle { font-size: 12px; }
#guides-toggle[aria-pressed="false"] { opacity: .5; text-decoration: line-through; }
.layers-toggle { border-color: var(--line); font-size: 13px; }
@media (max-width: 639px) {
  /* Phones: tools + Focus / colors / fill, size, history, layers */
  .tools { flex: 1 1 0; min-width: 0; }
  .tool { min-width: 34px; flex: 1 0 34px; }
  .focus-button { flex: none; padding: 0 11px; }
  .focus-button span, .fill-control span { display: none; } /* icons only: the row needs the room */
  .tool.spark-tool { display: none; } /* phones use Ask AI > Fix a spot */
  .size-control input { flex: 1; width: auto; min-width: 0; }
  .size-control { flex: 1 1 50px; min-width: 0; }
  .size-control output { display: none; }
  .toolbar-row { gap: 5px; }
  .toolbar-row .icon-button { min-width: 34px; padding: 0 5px; }
  .swatches { flex: 1 1 100%; justify-content: space-between; }
  .layers-toggle { margin-left: auto; }
}
.layers-toggle[aria-expanded="true"] { background: var(--green-soft); border-color: #99e0d2; }

.canvas-body { display: grid; }
.canvas-frame { position: relative; margin: 10px; border: 1px solid #e6ece5; border-radius: 10px; overflow: hidden; background: white; }
canvas { display: block; width: 100%; height: auto; aspect-ratio: 1000 / 650; touch-action: none; cursor: crosshair; }
#overlay { position: absolute; inset: 0; pointer-events: none; }
canvas.spark-mode, canvas.eraser-mode { cursor: cell; }
canvas.place-mode { cursor: copy; }
.canvas-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 0 14px 12px; font-size: 12px; color: var(--muted); }

/* Popovers (fix a spot, AI sketch) and the AI tray */
.popover { position: absolute; z-index: 3; width: min(360px, calc(100% - 16px)); padding: 12px; border-radius: 14px; background: #fffffff5; backdrop-filter: blur(8px); border: 1px solid #e4dcff; box-shadow: 0 16px 40px #2e106522; animation: popIn .22s var(--spring) both; }
.popover[hidden] { display: none; }
@keyframes popIn { from { opacity: 0; transform: translateY(6px) scale(.97); } to { opacity: 1; transform: none; } }
.popover-title { margin: 0; font-weight: 700; color: var(--violet); }
.popover-sub { margin: 2px 0 10px; font-size: 12.5px; color: var(--muted); }
.popover input { width: 100%; padding: 11px 12px; border: 1px solid #ddd6fe; border-radius: 10px; background: white; font-size: 15px; }
.examples { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.example { padding: 6px 10px; border: 1px solid #e4dcff; border-radius: 999px; background: var(--violet-soft); color: #4c1d95; font-size: 12.5px; }
.example:hover { background: #e9e1ff; }
.popover-actions { display: flex; gap: 6px; margin-top: 10px; }
.pill { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 38px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: white; font-size: 13.5px; font-weight: 650; }
.pill.primary { background: var(--violet); border-color: var(--violet); color: white; }
.pill.ghost { margin-left: auto; border-color: transparent; color: var(--muted); }
.wu-group .pill.primary, .help-foot .pill.primary { background: var(--green); border-color: var(--green); }
kbd { font: 10px inherit; opacity: .7; }
.tray { position: absolute; z-index: 2; left: 8px; right: 8px; bottom: 8px; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 8px 8px 14px; border-radius: 14px; background: #1e1b4bf2; color: #ede9fe; font-size: 13px; box-shadow: 0 10px 28px #1e1b4b40; animation: slideUp .3s var(--spring) both; }
.tray[hidden] { display: none; }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
.tray.error { background: #7f1d1df2; color: #fee2e2; }
.tray button { min-height: 34px; padding: 0 12px; border: 0; border-radius: 999px; background: #ffffff22; color: white; font-size: 13px; font-weight: 650; }
.tray button:first-of-type { background: var(--lime); color: #1a2e05; }
.tray-note { flex: 1 1 140px; font-weight: 650; overflow-wrap: anywhere; }
.tray-note.pending { animation: breathe 1.4s ease-in-out infinite; }
@keyframes breathe { 50% { opacity: .5; } }
.tray-more { opacity: .7; font-size: 12px; }

/* Layers: a drawer on phones, a side panel on wide screens */
.layers { display: none; padding: 12px; border-top: 1px solid var(--line); background: #fbfcf8; }
.layers.open { display: block; animation: rise .25s var(--ease) both; }
.layers-head { display: flex; align-items: center; justify-content: space-between; }
.layers h3 { margin: 0; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.layer-list { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 4px; }
.layer { display: grid; grid-template-columns: 30px 44px minmax(0, 1fr); align-items: center; gap: 8px; padding: 5px; border: 1px solid transparent; border-radius: 10px; animation: rise .25s var(--ease) both; }
.layer.active { background: white; border-color: #b7d3c6; box-shadow: 0 1px 3px #0b242212; }
.layer.hidden-layer .layer-thumb, .layer.hidden-layer .layer-name { opacity: .45; }
.layer-eye { width: 30px; height: 30px; display: grid; place-items: center; border: 0; border-radius: 8px; background: none; color: var(--muted); }
.layer-eye svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.layer-thumb { width: 44px; height: 29px; border: 1px solid var(--line); border-radius: 4px; background: white; }
.layer-name { min-height: 30px; border: 0; background: none; text-align: left; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.layer.active .layer-name { font-weight: 650; }
.layer.linked .layer-name { color: var(--green); }
.layer-rename { min-width: 0; padding: 4px 6px; border: 1px solid #b7d3c6; border-radius: 6px; font-size: 13px; }
.asset-badge { display: inline-block; margin-right: 5px; padding: 1px 6px; border-radius: 999px; background: #ccfbf1; color: var(--green); font-size: 10px; font-weight: 700; }
.layer-props { display: grid; gap: 6px; padding-top: 8px; border-top: 1px solid var(--line); }
.layer-props label { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); }
.layer-props input[type="range"] { width: 100%; }
.layer-actions { display: flex; gap: 6px; }
.layer-actions button { flex: 1; min-height: 34px; border: 1px solid var(--line); border-radius: 8px; background: white; font-size: 13px; }

/* Save card */
.save-card { padding: 16px; }
.save-card h2 { margin: 0 0 8px; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.kind-switch { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; padding: 3px; border-radius: 12px; background: #e9efe6; }
.kind-switch button { min-height: 40px; border: 0; border-radius: 9px; background: none; color: var(--muted); font-weight: 650; font-size: 14px; }
.kind-switch button[aria-checked="true"] { background: white; color: var(--ink); box-shadow: 0 1px 3px #0b242222; }
.kind-hint { margin: 10px 0 14px; font-size: 13px; color: var(--muted); min-height: 2.6em; }
.kind-hint i { color: var(--ink); font-style: normal; font-weight: 600; }
.save-card label { display: block; margin-bottom: 5px; font-size: 13px; font-weight: 600; }
.save-card label span { color: var(--muted); font-weight: 400; }
.save-card input:not([type]), .save-card input[type="text"], .save-card select, .save-card textarea, #title, #shot-project, #shot-sequence, #shot-assignee, #description { display: block; width: 100%; margin-bottom: 12px; padding: 11px 12px; border: 1px solid #cfdccf; border-radius: 10px; background: #fbfcf8; font-size: 15px; transition: border-color .2s, box-shadow .2s; }
.save-card input:focus, .save-card select:focus, .save-card textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px #0f766e22; outline: none; }
.kind-fields[hidden] { display: none; }
.kind-fields:not([hidden]) { animation: rise .25s var(--ease) both; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.shot-links { margin: -2px 0 12px; font-size: 12.5px; color: var(--green); overflow-wrap: anywhere; }
.more-fields { margin: 2px 0 14px; }
.more-fields summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--muted); padding: 4px 0; list-style-position: inside; }
.more-fields[open] summary { margin-bottom: 8px; }
textarea { resize: vertical; min-height: 64px; }
.tag-label { display: flex; justify-content: space-between; align-items: baseline; }
.tag-editor { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; margin-bottom: 4px; padding: 6px; border: 1px solid #cfdccf; border-radius: 10px; background: #fbfcf8; }
.chips { display: contents; }
.chip { display: inline-flex; align-items: center; gap: 2px; padding: 3px 4px 3px 10px; border-radius: 999px; background: #e3ece0; font-size: 12.5px; animation: pop .25s var(--spring); }
.chip button { border: 0; background: none; color: var(--muted); font-size: 15px; line-height: 1; padding: 0 4px; }
#tag-input { flex: 1; min-width: 90px; border: 0; margin: 0; padding: 5px; background: transparent; font-size: 14px; outline: none; }
.save-button { width: 100%; min-height: 50px; border: 0; border-radius: 12px; background: var(--green); color: white; font-weight: 700; font-size: 16px; box-shadow: 0 8px 20px #0f766e33; }
.save-button:hover:not(:disabled) { background: #0b5f59; }
.save-button.saved { animation: saved .9s var(--ease); }
@keyframes saved { 0% { box-shadow: 0 0 0 0 #34d39988; } 100% { box-shadow: 0 0 0 16px #34d39900; } }
.save-new { display: block; margin: 10px auto 0; }
.save-new[hidden] { display: none; }
.link-button { border: 0; background: none; padding: 4px 2px; color: var(--green); font-size: 13px; font-weight: 650; text-decoration: underline; text-underline-offset: 3px; }
.status { min-height: 20px; margin: 12px 0 0; font-size: 13.5px; color: var(--muted); overflow-wrap: anywhere; }
.status:not(:empty) { animation: rise .25s var(--ease) both; }
.status.error { color: #a53226; }
.next-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.next-action { min-height: 36px; padding: 0 13px; border: 1px solid var(--green); border-radius: 999px; background: var(--green-soft); color: var(--green); font-size: 13px; font-weight: 650; }
.fine-print { margin: 14px 0 0; font-size: 11.5px; color: var(--muted); cursor: help; }

/* ---------- Library ---------- */
.library { margin-top: 28px; animation: rise .6s .2s var(--ease) both; }
.library-head { display: flex; justify-content: space-between; align-items: baseline; }
.library-head h2 { margin: 0; font: 600 clamp(24px, 5vw, 34px)/1.1 Georgia, serif; letter-spacing: -.02em; }
.library-tabs { display: flex; gap: 4px; margin-top: 12px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.library-tabs button { position: relative; flex: 0 0 auto; min-height: 44px; padding: 0 14px; border: 0; background: none; color: var(--muted); font-weight: 650; }
.library-tabs button::after { content: ""; position: absolute; left: 10px; right: 10px; bottom: -1px; height: 2.5px; border-radius: 2px; background: var(--green); transform: scaleX(0); transition: transform .3s var(--spring); }
.library-tabs button[aria-selected="true"] { color: var(--ink); }
.library-tabs button[aria-selected="true"]::after { transform: scaleX(1); }
.search-bar { display: flex; gap: 8px; margin-top: 12px; padding: 5px 5px 5px 14px; border: 1px solid var(--line); border-radius: 14px; background: white; transition: border-color .2s, box-shadow .2s; }
.search-bar:focus-within { border-color: var(--green); box-shadow: 0 0 0 3px #0f766e1f; }
.search-bar input { flex: 1; min-width: 0; border: 0; background: none; font-size: 16px; outline: none; }
.search-go { width: 42px; height: 42px; border: 0; border-radius: 10px; background: var(--green); color: white; font-size: 18px; }
.filters { display: flex; gap: 6px; margin-top: 10px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.filters[hidden] { display: none; }
.filter-chip { flex: 0 0 auto; min-height: 34px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: white; font-size: 13px; }
.filter-chip span { margin-left: 5px; color: var(--muted); font-size: 11px; }
.filter-chip[aria-pressed="true"] { background: var(--green); border-color: var(--green); color: white; }
.filter-chip[aria-pressed="true"] span { color: var(--lime); }
.results { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 12px; }
.card { --i: 0; display: flex; flex-direction: column; text-align: left; overflow: hidden; padding: 0; border: 1px solid var(--line); border-radius: 14px; background: white; color: var(--ink); animation: cardIn .45s var(--ease) both; animation-delay: calc(var(--i) * 40ms); transition: transform .25s var(--ease), box-shadow .25s var(--ease); }
@keyframes cardIn { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
@media (hover: hover) { .card:hover { transform: translateY(-3px); box-shadow: 0 12px 28px #0b24221f; } }
.card img { display: block; width: 100%; aspect-ratio: 1000 / 650; object-fit: contain; background: white; border-bottom: 1px solid var(--line); }
.thumb-button { display: block; width: 100%; padding: 0; border: 0; background: white; }
.card-text { display: block; padding: 10px 12px 4px; }
.card strong { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 14px; overflow-wrap: anywhere; }
.card small { display: block; margin-top: 3px; font-size: 12px; color: var(--muted); }
.placed-assets { color: var(--green) !important; }
.card-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px 12px; margin-top: auto; }
.mini { min-height: 34px; padding: 0 11px; border: 1px solid var(--line); border-radius: 999px; background: white; font-size: 12.5px; font-weight: 650; }
.mini.primary-mini { background: var(--green); border-color: var(--green); color: white; }
.mini.confirm-mini { background: var(--violet); border-color: var(--violet); color: white; }
.empty { grid-column: 1 / -1; padding: 28px 16px; text-align: center; color: var(--muted); border: 1.5px dashed var(--line); border-radius: 14px; font-size: 14px; }
.status-select { min-height: 32px; padding: 0 10px; border: 0; border-radius: 999px; font-size: 12.5px; font-weight: 650; }
.status-todo { background: #e2e8f0; color: #334155; }
.status-in_progress { background: #dbeafe; color: #1d4ed8; }
.status-review { background: #fef3c7; color: #92400e; }
.status-approved { background: #dcfce7; color: #166534; }
.status-pill { padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 650; }

/* ---------- Sheets (where used, help): bottom sheet on phones, centered on desktop ---------- */
.sheet { width: 100%; max-width: 100%; max-height: 92vh; margin: auto 0 0; padding: 18px var(--pad) calc(18px + env(safe-area-inset-bottom)); border: 0; border-radius: 22px 22px 0 0; background: var(--card); color: var(--ink); box-shadow: 0 -20px 60px #0b24224d; overflow-y: auto; }
.sheet[open] { animation: sheetUp .38s var(--ease) both; }
@keyframes sheetUp { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet::backdrop { background: #071e20a8; backdrop-filter: blur(3px); animation: fade .3s both; }
@keyframes fade { from { opacity: 0; } }
.sheet-head { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: start; }
.sheet-head:has(img) { grid-template-columns: 76px 1fr auto; }
.sheet-head img { width: 76px; aspect-ratio: 1000 / 650; object-fit: contain; border: 1px solid var(--line); border-radius: 10px; background: white; }
.sheet-head h2 { margin: 0; font: 600 clamp(22px, 5vw, 30px)/1.1 Georgia, serif; letter-spacing: -.02em; }
.close { width: 38px; height: 38px; border: 0; border-radius: 50%; background: #eef3ec; font-size: 22px; line-height: 1; }
.wu-summary { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.summary-chip { display: inline-flex; align-items: baseline; gap: 6px; padding: 7px 12px; border-radius: 12px; border: 1px solid var(--line); background: white; font-size: 13px; animation: pop .35s var(--spring) both; }
.summary-chip:nth-child(2) { animation-delay: .05s; } .summary-chip:nth-child(3) { animation-delay: .1s; } .summary-chip:nth-child(4) { animation-delay: .15s; }
.summary-chip b { font-size: 16px; }
.summary-chip.linked { background: var(--green-soft); border-color: #99e0d2; }
.summary-chip.warn { background: var(--amber-soft); border-color: #fcd34d; color: #92400e; }
.summary-chip.ok { color: var(--muted); }
.summary-chip.similar { background: var(--violet-soft); border-color: #ddd6fe; }
.summary-chip.assets { background: #eef6ff; border-color: #c7dcfa; }
.wu-filters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; align-items: end; margin-top: 14px; padding: 10px; border-radius: 12px; background: var(--paper); }
.wu-filters label { display: grid; gap: 4px; font-size: 12px; color: var(--muted); }
.wu-filters label:first-child { grid-column: 1 / -1; }
.wu-filters select, .wu-filters input { width: 100%; min-width: 0; min-height: 38px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: white; font-size: 14px; }
.wu-filters .pill { grid-column: 1 / -1; }
.wu-group { margin-top: 20px; }
.wu-group-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.wu-group h3 { margin: 0; font-size: 17px; }
.wu-group h3 span { color: var(--muted); font-weight: 500; }
.wu-explain { margin: 4px 0 10px; font-size: 13px; color: var(--muted); }
.wu-explain b { color: var(--ink); }
.wu-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.wu-card { --i: 0; display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: white; animation: cardIn .4s var(--ease) both; animation-delay: calc(var(--i) * 50ms); }
.wu-card.outdated { border-color: #fcd34d; }
.wu-figure { position: relative; display: block; overflow: hidden; width: 100%; padding: 0; border: 0; border-bottom: 1px solid var(--line); background: white; }
.wu-figure img { display: block; width: 100%; aspect-ratio: 1000 / 650; object-fit: contain; }
.wu-box { position: absolute; border: 2.5px solid #0d9488; border-radius: 5px; box-shadow: 0 0 0 999px #ffffff70; animation: boxIn .6s .15s var(--spring) both; }
.wu-card.similar .wu-box { border-color: var(--violet); border-style: dashed; }
@keyframes boxIn { from { opacity: 0; transform: scale(1.4); } to { opacity: 1; transform: none; } }
.wu-card .card-text { padding: 10px 12px 2px; }
.wu-card strong { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 14px; }
.wu-card small { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }
.why { margin: 6px 0 0; font-size: 12.5px; color: var(--muted); }
.why.outdated { color: var(--amber); font-weight: 650; }
.why.current { color: var(--green); font-weight: 650; }
.meter { display: flex; align-items: center; gap: 8px; margin-top: 6px; font-size: 12px; font-weight: 650; cursor: help; }
.meter-bar { flex: 1; height: 6px; border-radius: 999px; background: #ede9fe; overflow: hidden; }
.meter-fill { display: block; height: 100%; border-radius: inherit; background: #a78bfa; transform-origin: left; animation: grow .8s .2s var(--ease) both; }
@keyframes grow { from { transform: scaleX(0); } }
.meter.strong .meter-fill { background: var(--violet); }
.meter.strong .meter-label, .meter.possible .meter-label { color: var(--violet); }
.wu-actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px 12px; margin-top: auto; }
.wu-empty { display: grid; gap: 2px; padding: 14px; text-align: center; font-size: 13px; color: var(--muted); border: 1.5px dashed var(--line); border-radius: 12px; }
.wu-empty b { color: var(--ink); }

.help-flow { list-style: none; display: grid; gap: 8px; margin: 16px 0; padding: 0; counter-reset: step; }
.help-flow li { counter-increment: step; display: grid; gap: 2px; padding: 12px 12px 12px 44px; position: relative; border-radius: 12px; background: var(--paper); font-size: 13.5px; animation: rise .4s var(--ease) both; }
.help-flow li:nth-child(2) { animation-delay: .05s; } .help-flow li:nth-child(3) { animation-delay: .1s; } .help-flow li:nth-child(4) { animation-delay: .15s; }
.help-flow li::before { content: counter(step); position: absolute; left: 12px; top: 12px; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: var(--green); color: white; font-size: 11px; font-weight: 700; }
.help-flow span { color: var(--muted); }
.help-flow i { color: var(--violet); font-size: 12.5px; }
.glossary { display: grid; grid-template-columns: 1fr; margin: 0; }
.glossary div { padding: 10px 0; border-top: 1px solid var(--line); }
.glossary dt { font-weight: 700; font-size: 14px; }
.glossary dd { margin: 1px 0 0; font-size: 13px; color: var(--muted); }
.help-foot { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

/* Tooltip */
.tooltip { position: fixed; z-index: 1000; max-width: min(280px, calc(100vw - 16px)); padding: 9px 12px; border-radius: 10px; background: #0b2422; color: #eef5ef; font-size: 12.5px; line-height: 1.45; box-shadow: 0 10px 30px #0b242244; pointer-events: none; animation: popIn .15s var(--ease) both; }
.tooltip[hidden] { display: none; }
.tooltip strong { display: block; color: var(--lime); font-size: 12.5px; }
.tooltip.single strong { color: #eef5ef; }

@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 #0f766e00; } 40% { box-shadow: 0 0 0 7px #0f766e44; } }
.pulse { animation: pulse 1s ease-in-out 3; }

footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; max-width: 1320px; margin: 0 auto; padding: 20px var(--pad) calc(24px + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
footer b { font-family: Georgia, serif; color: var(--ink); font-size: 15px; }

/* ---------- Focus + swatches: drawing comes first ---------- */
.focus-button { display: inline-flex; align-items: center; gap: 6px; height: 42px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px; background: white; color: var(--ink); font-weight: 700; font-size: 14px; }
.focus-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.focus-button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: white; }
.swatches { display: flex; align-items: center; gap: 5px; }
.ink-dot { width: 28px; height: 28px; padding: 0; border: 2px solid white; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 1px #cfdccf; }
.ink-dot[aria-pressed="true"] { box-shadow: 0 0 0 2.5px var(--green); transform: scale(1.12); }
.swatches .swatch input[type="color"] { width: 30px; height: 30px; border-radius: 50%; padding: 1px; }
body.focus-mode { overflow: hidden; overscroll-behavior: none; }
.focus-mode .canvas-card { position: fixed; inset: 0; z-index: 70; display: flex; flex-direction: column; border: 0; border-radius: 0; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); background: #e9efe6; animation: fade .25s both; }
.focus-mode .toolbar { flex: none; }
.focus-mode .canvas-body { flex: 1 1 auto; min-height: 0; display: grid; place-items: center; overflow: hidden; }
.focus-mode .canvas-frame { margin: 10px; box-shadow: 0 10px 40px #0b24222b; animation: popIn .3s var(--spring) both; }
.focus-mode .canvas-foot, .focus-mode .ai-examples, .focus-mode .ai-hint, .focus-mode .frames:not(.animating) { display: none; }
.focus-mode .ai-bar { flex: none; width: min(100%, 880px); margin: 0 auto; background: transparent; border-top: 0; }
.focus-mode .layers.open { position: fixed; top: 0; right: 0; bottom: 0; z-index: 75; width: min(300px, 84vw); overflow-y: auto; box-shadow: -20px 0 50px #0b242233; animation: slideIn .25s var(--ease) both; }
@keyframes slideIn { from { transform: translateX(30px); opacity: 0; } }

/* ---------- Ask AI: one text box, three methodical modes ---------- */
.ai-bar { display: grid; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid var(--line); }
.ai-modes { display: flex; gap: 3px; padding: 3px; border-radius: 12px; background: var(--violet-soft); overflow-x: auto; scrollbar-width: none; }
.ai-modes button { flex: 1 0 auto; min-height: 36px; padding: 0 12px; border: 0; border-radius: 9px; background: none; color: #5b21b6; font-size: 13px; font-weight: 650; white-space: nowrap; }
.ai-modes button::first-letter { text-transform: uppercase; }
.ai-modes button[aria-checked="true"] { background: white; color: #4c1d95; box-shadow: 0 1px 3px #2e106522; }
.ai-input { display: flex; align-items: center; gap: 6px; padding: 4px 4px 4px 12px; border: 2px solid transparent; border-radius: 14px; background: linear-gradient(white, white) padding-box, linear-gradient(110deg, #7c3aed, #4f8fe6) border-box; transition: box-shadow .25s; }
.ai-input:focus-within { box-shadow: 0 0 0 4px #7c3aed22; }
.ai-spark { color: var(--violet); font-size: 16px; }
.ai-input input { flex: 1; min-width: 0; min-height: 40px; border: 0; background: none; font-size: 16px; outline: none; }
.ai-go { flex: none; width: 42px; height: 42px; border: 0; border-radius: 11px; background: linear-gradient(110deg, #6d28d9, #4f8fe6); color: white; font-size: 18px; box-shadow: 0 6px 16px #6d28d933; }
.ai-examples { flex-wrap: nowrap; margin-top: 0; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.ai-examples::-webkit-scrollbar { display: none; }
.ai-examples .example { flex: none; }
.ai-hint { margin: 0; font-size: 12px; color: var(--muted); }

/* ---------- Starters: never face a blank page ---------- */
.starter-strip { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; padding: 8px 0 10px; background: linear-gradient(transparent, #ffffffee 28%); opacity: 0; transform: translateY(14px); pointer-events: none; transition: opacity .3s var(--ease), transform .35s var(--ease); }
.starter-strip.show { opacity: 1; transform: none; }
.starter-strip.show .starter-list, .starter-strip.show .starter-skip { pointer-events: auto; }
.starter-strip-head { display: flex; align-items: center; justify-content: space-between; padding: 0 10px 4px; font-size: 12px; color: var(--muted); }
.starter-skip { width: 26px; height: 26px; border: 0; border-radius: 50%; background: #eef3ec; color: var(--muted); font-size: 16px; line-height: 1; }
.starter-list { display: flex; gap: 8px; padding: 2px 10px 4px; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: none; }
.starter-list::-webkit-scrollbar { display: none; }
.starter { --i: 0; flex: none; display: grid; gap: 4px; padding: 4px; border: 1px solid var(--line); border-radius: 12px; background: white; text-align: left; scroll-snap-align: start; box-shadow: 0 4px 14px #0b242214; }
.starter-strip.show .starter { animation: cardIn .4s var(--ease) both; }
.starter-strip.show .starter:nth-child(2) { animation-delay: .04s; } .starter-strip.show .starter:nth-child(3) { animation-delay: .08s; }
.starter-strip.show .starter:nth-child(4) { animation-delay: .12s; } .starter-strip.show .starter:nth-child(5) { animation-delay: .16s; }
.starter-thumb img { display: block; width: 96px; aspect-ratio: 1000 / 650; border-radius: 8px; border: 1px solid #eef3ec; }
.starter-name { font-size: 12px; font-weight: 650; white-space: nowrap; padding: 0 2px; }
.starters-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 14px; }
.starter.big { padding: 6px; box-shadow: none; }
.starter.big .starter-thumb img { width: 100%; }
.starter.big .starter-name { font-size: 14px; white-space: normal; }
.starter-hint { font-size: 12px; color: var(--muted); padding: 0 2px 2px; }
@media (min-width: 640px) { .starters-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } .starter-thumb img { width: 120px; } }

/* ---------- Find: words, a sketch, or an asset ---------- */
.library-sub { margin: 4px 0 0; font-size: 13px; color: var(--muted); }
.search-sketch { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid #ddd6fe; border-radius: 10px; background: var(--violet-soft); color: var(--violet); }
.search-sketch svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.asset-filters { align-items: center; }
.asset-filters[hidden] { display: none; }
.color-chip { flex: none; width: 30px; height: 30px; padding: 0; border: 2px solid white; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 1px #cfdccf; }
.color-chip[aria-pressed="true"] { box-shadow: 0 0 0 2.5px var(--ink); transform: scale(1.1); }
.made-line { display: flex !important; align-items: center; gap: 3px; cursor: help; }
.mini-dot { width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 0 1px #0b242222; }
.mini-dot:first-of-type { margin-left: 4px; }
.frame-filters { align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.frame-filters select { min-height: 34px; max-width: 70vw; padding: 0 10px; border: 1px solid var(--line); border-radius: 999px; background: white; font-size: 13px; font-weight: 600; }
.thumb-button { position: relative; }
.frame-badge { position: absolute; left: 8px; top: 8px; padding: 2px 8px; border-radius: 999px; background: #0b2422d9; color: white; font-size: 11px; font-weight: 700; }
/* Frames are scenes in miniature: give them room (one per row on phones, ~300px each on wider screens). */
.results:has(.frame-card) { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); }
.frame-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 6px; }
.frame-chips small { margin: 0 4px 0 0 !important; }
.mini.frame-chip { min-width: 30px; min-height: 28px; padding: 0 8px; font-size: 12px; }
.mini.frame-chip.best { border-color: var(--green); background: var(--green-soft); color: var(--green); }

/* ---------- Frames: a flipbook strip under the canvas ---------- */
.frames { display: flex; align-items: center; gap: 8px; padding: 0 10px 10px; }
.frames.animating { padding-top: 2px; }
.frame-play { flex: none; width: 40px; height: 40px; border: 0; border-radius: 50%; background: var(--ink); color: white; font-size: 14px; }
.frame-play[hidden] { display: none; }
.frame-list { flex: 1 1 auto; min-width: 0; display: flex; gap: 6px; margin: 0; padding: 4px 2px; list-style: none; overflow-x: auto; scroll-snap-type: x proximity; scrollbar-width: thin; }
.frame-list:empty { display: none; }
.frame { position: relative; display: block; padding: 0; border: 2px solid var(--line); border-radius: 8px; background: white; scroll-snap-align: center; animation: pop .3s var(--spring) both; }
.frame canvas { display: block; width: 72px; height: auto; border-radius: 6px; }
.frame.current { border-color: var(--green); box-shadow: 0 4px 12px #0f766e33; }
.frame.playing { border-color: #ef4444; }
.frame-number { position: absolute; left: 3px; bottom: 2px; padding: 0 5px; border-radius: 6px; background: #0b2422cc; color: white; font-size: 10px; font-weight: 700; }
.frame-add { flex: none; min-height: 36px; padding: 0 12px; border: 1.5px dashed #9fc3b6; border-radius: 10px; background: var(--green-soft); color: var(--green); font-size: 13px; font-weight: 700; }
.frames:not(.animating) { justify-content: flex-end; padding-bottom: 4px; }
.frames:not(.animating) .frame-add { min-height: 28px; padding: 0 4px; border: 0; background: none; color: var(--muted); font-size: 12px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.frame-tools { flex: none; display: inline-flex; align-items: center; gap: 6px; }
.frame-tools[hidden] { display: none; }
.onion { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: #b91c1c; font-weight: 650; }
.onion input { accent-color: #ef4444; margin: 0; }
#fps { min-height: 34px; padding: 0 6px; border: 1px solid var(--line); border-radius: 8px; background: white; font-size: 12px; }
.foot-actions { display: inline-flex; gap: 12px; }
@media (max-width: 639px) {
  .frames { flex-wrap: wrap; }
  .frame-list { flex-basis: calc(100% - 48px); }
  .frame-tools { margin-left: auto; }
  .canvas-foot { flex-wrap: wrap; }
}

/* ---------- Lineage + AI marks on cards ---------- */
.mini.ai-mini { border-color: #ddd6fe; background: var(--violet-soft); color: #5b21b6; }
.lineage { color: var(--violet) !important; }
.frames-note { color: var(--ink) !important; font-weight: 600; }
.summary-chip.family { background: #f0fdf4; border-color: #bbf7d0; }
.wu-head-actions { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 0; }
.wu-card.kin { border-color: #bbf7d0; }

/* ---------- Variations sheet ---------- */
.var-step { margin-top: 16px; animation: rise .35s var(--ease) both; }
.var-step[hidden] { display: none; }
.var-step-title { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-weight: 700; }
.step-dot { width: 22px; height: 22px; display: inline-grid; place-items: center; border-radius: 50%; background: var(--violet); color: white; font-size: 11px; }
.var-goal-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.var-goal-row input, .var-goal-row select { min-height: 44px; padding: 0 12px; border: 1px solid #ddd6fe; border-radius: 10px; background: white; font-size: 15px; }
.var-goal-row input { grid-column: 1 / -1; }
.var-goal-row .pill { min-height: 44px; }
.var-plan-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; counter-reset: plan; }
.var-plan-row { --i: 0; counter-increment: plan; display: grid; grid-template-columns: minmax(0, 1fr) 36px; gap: 6px; padding: 10px; border: 1px solid #e4dcff; border-radius: 12px; background: #fcfbff; animation: cardIn .35s var(--ease) both; animation-delay: calc(var(--i) * 45ms); }
.var-plan-row input, .var-plan-row textarea { min-width: 0; min-height: 38px; padding: 0 10px; border: 1px solid #e4dcff; border-radius: 8px; background: white; font-size: 14px; }
.var-plan-row textarea { min-height: 0; padding: 8px 10px; resize: vertical; line-height: 1.35; }
.var-name { font-weight: 700; }
.var-brief { grid-column: 1 / 2; }
.var-remove { grid-row: 1; grid-column: 2; padding: 0; font-size: 18px; }
.var-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.var-results-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.var-results-head .var-actions { margin-top: 0; }
.var-results-head .pill[hidden] { display: none; }
.var-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.var-card { --i: 0; display: flex; flex-direction: column; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: white; animation: cardIn .4s var(--ease) both; animation-delay: calc(var(--i) * 50ms); }
.var-card.kept { border-color: var(--green); box-shadow: 0 0 0 2px #0f766e22; }
.var-card.error { border-color: #fca5a5; }
.var-figure { position: relative; display: grid; place-items: center; aspect-ratio: 1000 / 650; border-bottom: 1px solid var(--line); background: white; }
.var-figure canvas { display: block; width: 100%; height: auto; animation: fade .5s both; }
.var-card.pending .var-figure { background: linear-gradient(100deg, #f5f3ff 30%, #ede9fe 50%, #f5f3ff 70%) 0 0 / 200% 100%; animation: shimmer 1.4s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }
.var-wait { color: var(--violet); font-weight: 700; font-size: 13px; animation: breathe 1.4s ease-in-out infinite; }
.var-card small { display: block; margin-top: 2px; font-size: 12px; color: var(--muted); }
.var-stats { display: flex; flex-wrap: wrap; gap: 4px 10px; margin: 6px 0 0; font-size: 11.5px; cursor: help; }
.var-stats .hand { color: var(--green); }
.var-stats .ai { color: var(--violet); }
.kept-note { align-self: center; color: var(--green); font-weight: 700; font-size: 13px; }

/* ---------- Breakdown sheet ---------- */
.bd-top { display: grid; gap: 14px; margin-top: 14px; }
.bd-player { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: white; }
.bd-player canvas { display: block; width: 100%; height: auto; }
.bd-player-bar { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-top: 1px solid var(--line); background: #fbfcf8; }
.bd-player-bar input { flex: 1; width: auto; }
.bd-player-bar output { min-width: 48px; text-align: right; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bd-made h3 { margin: 0 0 8px; font-size: 15px; }
.made-bar { display: flex; height: 14px; overflow: hidden; border-radius: 999px; background: #eef3ec; }
.made-bar span { width: var(--share); transform-origin: left; animation: grow .9s .1s var(--ease) both; }
.made-hand, .made-legend .made-hand::before { background: var(--green); }
.made-ai, .made-legend .made-ai::before { background: var(--violet); }
.made-placed, .made-legend .made-placed::before { background: #38bdf8; }
.made-legend { display: grid; gap: 6px; margin: 10px 0 0; padding: 0; list-style: none; font-size: 13px; }
.made-legend li { display: flex; align-items: baseline; gap: 8px; background: none; }
.made-legend li::before { content: ""; width: 10px; height: 10px; border-radius: 3px; flex: none; transform: translateY(1px); }
.made-legend b { min-width: 38px; font-variant-numeric: tabular-nums; }
.made-legend span { color: var(--muted); }
.bd-replay-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; padding: 8px 10px 10px; background: #fbfcf8; }
.bd-caption { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bd-math-title { margin: 16px 0 8px; font-size: 15px; }
.art-math { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.math-tile { display: grid; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: white; cursor: help; animation: pop .35s var(--spring) both; }
.math-tile b { font-size: 18px; font-variant-numeric: tabular-nums; }
.math-tile span { font-size: 11.5px; color: var(--muted); }
.math-palette { grid-column: 1 / -1; display: flex; gap: 6px; padding: 6px 2px; cursor: help; }
.swatch-dot { width: 24px; height: 24px; border-radius: 50%; border: 2px solid white; box-shadow: 0 0 0 1px #cfdccf; }
.made-kit, .made-legend .made-kit::before { background: #fbbf24; }
.evolution { display: flex; gap: 8px; overflow-x: auto; padding: 2px 2px 8px; scroll-snap-type: x proximity; }
.evo-card { --i: 0; flex: none; display: grid; gap: 2px; width: 150px; padding: 6px; border: 1px solid var(--line); border-radius: 12px; background: white; text-align: left; scroll-snap-align: start; animation: cardIn .4s var(--ease) both; animation-delay: calc(var(--i) * 60ms); }
.evo-card img { width: 100%; aspect-ratio: 1000 / 650; object-fit: contain; border-radius: 8px; border: 1px solid #eef3ec; background: white; }
.evo-card b { font-size: 13px; }
.evo-card small { font-size: 11.5px; color: var(--muted); }
.bd-origin { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 12px 0 0; padding: 10px 12px; border-radius: 12px; background: var(--violet-soft); color: #4c1d95; font-size: 13px; }
.bd-origin[hidden] { display: none; }
.xsheet-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; background: white; }
.xsheet { border-collapse: separate; border-spacing: 0; font-size: 12px; }
.xsheet th, .xsheet td { padding: 4px; border-bottom: 1px solid #eef3ec; border-right: 1px solid #eef3ec; text-align: center; vertical-align: middle; }
.xsheet thead th { position: sticky; top: 0; background: #fbfcf8; color: var(--muted); font-weight: 700; }
.xsheet .corner, .xsheet .row-head { position: sticky; left: 0; z-index: 1; background: #fbfcf8; text-align: left; }
.xsheet .row-head { min-width: 120px; max-width: 160px; }
.xsheet .row-head b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xsheet td { cursor: pointer; transition: background-color .2s; }
.xsheet td canvas { display: block; width: 72px; height: auto; border-radius: 4px; }
.xsheet .now { background: var(--green-soft); }
.xsheet .none { color: #c3cec6; }
.badges { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 3px; }
.badge { padding: 1px 6px; border-radius: 999px; font-size: 10px; font-weight: 700; }
.badge.asset { background: #ccfbf1; color: var(--green); }
.badge.ai { background: var(--violet-soft); color: var(--violet); }
.badge.hidden { background: #eef3ec; color: var(--muted); }
.bd-assets { display: grid; gap: 8px; }
.bd-asset { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; }
.bd-asset .card-text { padding: 0; }
.bd-asset strong { font-size: 14px; }
.bd-asset small { display: block; font-size: 12px; color: var(--muted); }
.timeline { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
.event { --i: 0; display: grid; grid-template-columns: 30px 1fr; gap: 10px; padding: 8px 0; border-top: 1px solid #eef3ec; animation: rise .3s var(--ease) both; animation-delay: calc(var(--i) * 30ms); }
.event-icon { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: #eef3ec; font-size: 13px; }
.by-ai .event-icon { background: var(--violet-soft); color: var(--violet); }
.by-artist .event-icon { background: var(--green-soft); color: var(--green); }
.event-body p { margin: 0; font-size: 13px; overflow-wrap: anywhere; }
.event-body small { color: var(--muted); font-size: 11.5px; }
.event.pending small { color: var(--amber); font-weight: 650; }

/* ---------- Phones: get to the paper fast ---------- */
@media (max-width: 639px) {
  .hero { padding: 14px 0 10px; }
  .hero h1 { font-size: clamp(26px, 7.6vw, 34px); }
  .lede { display: none; } /* the headline tells the story; the paper comes first */
  .guide { margin-bottom: 10px; }
  .guide-steps { display: block; }
  .guide-step:not(.next) { display: none; } /* just the next step, one card */
  .guide-step.next { max-width: none; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: center; }
  .guide-step.next .mini { grid-column: 3; grid-row: 1 / span 2; margin: 0; }
  .guide-body span { font-size: 12px; }
  .guide-foot { padding-top: 0; }
  .guide-step { padding: 10px; }
  .canvas-frame { margin: 8px; }
  .library { margin-top: 20px; }
}
/* Fingers need bigger targets than mice. */
@media (pointer: coarse) {
  .tool { height: 42px; }
  .toolbar-row .icon-button, .layers-toggle { height: 40px; }
  .layer-eye, .layer-name { min-height: 38px; }
  .mini { min-height: 38px; }
}

/* ---------- Bigger screens ---------- */
@media (min-width: 640px) {
  .var-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .var-goal-row { grid-template-columns: minmax(0, 1fr) auto auto; }
  .var-goal-row input { grid-column: auto; }
  .var-plan-row { grid-template-columns: minmax(0, 200px) minmax(0, 1fr) 36px; }
  .var-brief { grid-column: auto; }
  .var-remove { grid-column: auto; }
  .bd-top { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: start; }
  .results { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
  .wu-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .glossary { grid-template-columns: 1fr 1fr; column-gap: 20px; }
  .help-flow { grid-template-columns: 1fr 1fr; }
  .wu-filters { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr) auto; }
  .wu-filters label:first-child, .wu-filters .pill { grid-column: auto; }
  .toolbar-row { flex: 1 1 auto; }
  .sheet { width: min(980px, calc(100vw - 48px)); max-height: calc(100vh - 64px); margin: auto; border-radius: 22px; padding: 26px 28px; }
  .sheet[open] { animation-name: sheetIn; }
  @keyframes sheetIn { from { transform: translateY(12px) scale(.98); opacity: 0; } to { transform: none; opacity: 1; } }
  .sheet-head:has(img) { grid-template-columns: 110px 1fr auto; }
  .sheet-head img { width: 110px; }
  .guide-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); overflow: visible; }
}
@media (min-width: 1024px) {
  .studio { grid-template-columns: minmax(0, 1fr) 330px; align-items: start; }
  .save-card { position: sticky; top: 72px; }
  .canvas-body { grid-template-columns: minmax(0, 1fr) 200px; }
  .layers, .layers.open { display: block; border-top: 0; border-left: 1px solid var(--line); animation: none; }
  .layers-toggle { display: none; }
  .focus-mode .canvas-body { grid-template-columns: minmax(0, 1fr) 220px; }
  .focus-mode .layers, .focus-mode .layers.open { position: static; width: auto; align-self: stretch; overflow-y: auto; box-shadow: none; animation: none; }
  .results { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .wu-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .help-flow { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 1400px) { .results { grid-template-columns: repeat(5, minmax(0, 1fr)); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .pulse { outline: 3px solid var(--green); }
}

/* ---------- Accounts: the gate, the account menu, the welcome sheet ---------- */
.account-button { width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--lime); color: #0b2422; font: 700 14px/1 ui-sans-serif, system-ui, sans-serif; text-transform: uppercase; box-shadow: 0 0 0 2px #0b2422, 0 0 0 3px #c3f19255; }
.account-button[aria-expanded="true"] { box-shadow: 0 0 0 2px #0b2422, 0 0 0 4px var(--lime); }
.account-menu { position: absolute; top: calc(100% + 6px); right: var(--pad); width: min(280px, calc(100vw - 2 * var(--pad))); padding: 14px; border-radius: var(--radius); background: var(--card); color: var(--ink); box-shadow: 0 18px 50px #0b242240; animation: popIn .22s var(--ease) both; }
.account-menu p { margin: 0 0 4px; }
.account-email { font-weight: 700; font-size: 14px; line-height: 1.3; overflow-wrap: anywhere; }
.account-counts { font-size: 13px; color: var(--muted); }
.account-budget { font-size: 12.5px; color: var(--violet); }
.account-note { font-size: 12px; color: var(--green); margin-bottom: 12px !important; }
.account-menu .pill { width: 100%; justify-content: center; }

.gate { width: 100%; max-width: none; height: 100%; max-height: none; margin: 0; padding: 0; border: 0; background: radial-gradient(120% 80% at 80% 0%, #164e47 0%, #0b2422 55%, #071a19 100%); color: #e9f2ec; overflow-y: auto; }
.gate[open] { display: grid; place-items: center; animation: fade .35s both; }
.gate::backdrop { background: #071a19; }
.gate-art { position: fixed; inset: auto 0 0 0; height: 30vh; pointer-events: none; opacity: .22; }
.gate-art svg { width: 100%; height: 100%; }
.gate-line { fill: none; stroke: var(--lime); stroke-width: 3; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 1; animation: drawIn 3.2s .3s var(--ease) forwards; }
.gate-line.two { stroke: #7dd3c0; stroke-width: 2; animation-delay: 1.6s; animation-duration: 1.6s; }
.gate-dot { fill: #fbbf24; transform-origin: 300px 64px; transform: scale(0); animation: pop .5s 3.2s var(--spring) forwards; }
@keyframes drawIn { to { stroke-dashoffset: 0; } }
.gate-card { position: relative; width: min(420px, 100%); margin: 0 auto; padding: max(28px, env(safe-area-inset-top)) var(--pad) calc(28px + env(safe-area-inset-bottom)); }
.gate-brand { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; }
.gate-card h2 { margin: 0; font: 600 clamp(30px, 8vw, 40px)/1.05 Georgia, serif; letter-spacing: -.03em; }
.gate-card h2 span { display: block; color: #8fb3a8; }
.gate-promise { margin: 10px 0 22px; color: var(--lime); font-weight: 600; }
.gate-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; border-radius: 999px; background: #ffffff14; }
.gate-tabs button { min-height: 40px; border: 0; border-radius: 999px; background: transparent; color: #b9cbc3; font-weight: 600; }
.gate-tabs button[aria-selected="true"] { background: #e9f2ec; color: #0b2422; }
.gate-form { display: grid; gap: 6px; margin-top: 16px; }
.gate-form label { margin-top: 8px; font-size: 13px; font-weight: 600; color: #cfe0d8; }
.gate-form label small { font-weight: 400; color: #8fb3a8; }
.gate-form input { width: 100%; min-height: 48px; padding: 0 14px; border: 1px solid #ffffff2e; border-radius: 12px; background: #ffffff10; color: #fff; font-size: 16px; }
.gate-form input::placeholder { color: #8fb3a888; }
.gate-form input:focus { outline: none; border-color: var(--lime); background: #ffffff18; }
.gate-pw { position: relative; }
.gate-pw input { padding-right: 64px; }
.gate-reveal { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); min-height: 36px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: #b9cbc3; font-size: 13px; }
.gate-submit { position: relative; overflow: hidden; margin-top: 14px; min-height: 52px; border: 0; border-radius: 14px; background: var(--lime); color: #0b2422; font-weight: 700; font-size: 16px; }
.gate-submit[aria-busy="true"]::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, #ffffff88, transparent); animation: shine 1.1s linear infinite; }
.gate-status { min-height: 1.4em; margin: 6px 0 0; font-size: 13px; color: #b9cbc3; }
.gate-status.error { color: #fca5a5; }
.gate-form.shake { animation: shake .4s var(--ease); }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.gate-perks { display: grid; gap: 8px; margin: 22px 0 0; padding: 0; list-style: none; font-size: 13px; color: #cfe0d8; }
.gate-perks li { display: grid; grid-template-columns: 22px 1fr; gap: 8px; align-items: start; opacity: 0; animation: rise .5s var(--ease) forwards; }
.gate-perks li:nth-child(2) { animation-delay: .12s; }
.gate-perks li:nth-child(3) { animation-delay: .24s; }
.gate-perks li > b { color: var(--lime); text-align: center; }
.gate-fine { margin: 18px 0 0; font-size: 11.5px; color: #8fb3a8; }

.welcome-choices { display: grid; gap: 10px; margin-top: 14px; }
@media (min-width: 640px) { .welcome-choices { grid-template-columns: 1fr 1fr; } }
.welcome-choice { display: grid; gap: 4px; justify-items: start; text-align: left; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
.welcome-choice.primary { border-color: var(--green); background: var(--green-soft); }
.welcome-choice:hover { box-shadow: var(--shadow); }
.welcome-choice b { font-size: 16px; }
.welcome-choice span:last-child { font-size: 13px; color: var(--muted); }
.welcome-icon { font-size: 26px; line-height: 1; }
.welcome-choice[aria-busy="true"] { opacity: .7; }
@media (prefers-reduced-motion: reduce) {
  .gate-line { stroke-dashoffset: 0; animation: none; }
  .gate-dot { transform: none; animation: none; }
  .gate-perks li { opacity: 1; animation: none; }
}

.bd-player-bar[hidden] { display: none; }
