/* The demo window around the real preview: a Mac document window like the app's, with a guided
   tour above it and a caption below. Light and dark, like the app. */
:root {
  --bg: transparent; --win: #ffffff; --bar: #ecebe7; --bar-line: #d9d7d0; --ink: #1e2030; --muted: #6a6e85;
  --seg: #dedcd6; --seg-on: #ffffff; --accent: #4b47e0; --accent-soft: #eeeefc; --editor: #ffffff;
  --chip: #ffffff; --chip-line: #dcdad3; --shadow: 0 1px 2px rgba(24, 26, 48, .08), 0 22px 60px rgba(24, 26, 48, .16);
  --term: #15161c; --term-ink: #d9dbe6;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --win: #1b1c22; --bar: #2a2b31; --bar-line: #3a3b42; --ink: #e7e8f0; --muted: #9a9db2;
    --seg: #3a3b42; --seg-on: #5a5b63; --accent: #8f8cff; --accent-soft: #2a2950; --editor: #1e1f25;
    --chip: #24252b; --chip-line: #3a3b42; --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 22px 60px rgba(0, 0, 0, .45);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 13px/1.4 var(--sans); -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.demo { position: relative; padding: 14px 14px 10px; }

/* Tour chips */
.tour { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; margin: 0 0 14px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; }
.chip { border: 1px solid var(--chip-line); background: var(--chip); border-radius: 999px; padding: 6px 13px; font-size: 12.5px; color: var(--muted); transition: background .2s, color .2s, border-color .2s; }
.chip:hover { color: var(--ink); border-color: var(--accent); }
.chip[aria-current="step"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.play { border: 1px solid var(--chip-line); background: var(--chip); color: var(--ink); border-radius: 7px; padding: 4px 10px; font-size: 12px; }
.tour { display: none !important; }

/* The window */
.window { border-radius: 12px; overflow: hidden; background: var(--win); box-shadow: var(--shadow); border: 1px solid var(--bar-line); }
.titlebar { position: relative; height: 52px; display: flex; align-items: center; gap: 14px; padding: 0 14px 0 16px; background: var(--bar); border-bottom: 1px solid var(--bar-line); }
.lights { display: flex; gap: 8px; }
.lights i { width: 12px; height: 12px; border-radius: 50%; background: #ff5f57; box-shadow: inset 0 0 0 .5px rgba(0,0,0,.15); }
.lights i:nth-child(2) { background: #febc2e; } .lights i:nth-child(3) { background: #28c840; }
.title { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; margin-left: 6px; }
.title strong { font-size: 13px; font-weight: 650; }
.title span { font-size: 11px; color: var(--muted); }
.modes { position: absolute; left: 50%; transform: translateX(-50%); display: flex; padding: 2px; border-radius: 8px; background: var(--seg); }
.modes button { display: inline-flex; align-items: center; gap: 5px; border: 0; background: none; padding: 4px 12px; border-radius: 6px; font-size: 12.5px; color: var(--ink); }
.modes button[aria-pressed="true"] { background: var(--seg-on); box-shadow: 0 1px 2px rgba(0,0,0,.14); }
.modes svg, .icon svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.changes { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--bar-line); background: var(--win); border-radius: 7px; padding: 4px 10px; font-size: 12.5px; color: var(--accent); font-weight: 600; }
.changes .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.changes:disabled { color: var(--muted); font-weight: 400; cursor: default; }
.changes:disabled .dot { background: none; width: 13px; height: 13px; border: 1.4px solid currentColor; position: relative; }
.changes:disabled .dot::after { content: ""; position: absolute; left: 3.4px; top: 1.2px; width: 3px; height: 6px; border: solid currentColor; border-width: 0 1.4px 1.4px 0; transform: rotate(45deg); }
.icon { border: 0; background: none; padding: 4px; border-radius: 6px; color: var(--ink); display: inline-flex; }
.icon:hover { background: var(--seg); }

/* Content: editor, preview, or both */
.content { position: relative; height: 560px; display: flex; background: var(--win); }
.editor { flex: 1 1 50%; display: none; border-right: 1px solid var(--bar-line); background: var(--editor); }
.editor textarea { width: 100%; height: 100%; resize: none; border: 0; outline: none; padding: 26px 32px; background: transparent; color: var(--ink); font: 12.5px/1.65 var(--mono); tab-size: 4; }
.content iframe { flex: 1 1 50%; border: 0; width: 100%; height: 100%; display: block; min-width: 0; background: #eeeff5; }
@media (prefers-color-scheme: dark) { .content iframe { background: #121317; } }
.content[data-mode="edit"] .editor { display: block; flex-basis: 100%; border-right: 0; }
.content[data-mode="edit"] iframe { display: none; }
.content[data-mode="split"] .editor { display: block; }

/* The agent's terminal, shown while an agent edits the file */
.agent { position: absolute; left: 18px; bottom: 18px; z-index: 5; width: 430px; max-width: calc(100% - 36px); background: var(--term); color: var(--term-ink); border-radius: 10px; box-shadow: 0 12px 34px rgba(0,0,0,.35); overflow: hidden; animation: rise .25s ease-out; }
.agent[hidden] { display: none; }
.agent-head { padding: 7px 12px; font-size: 11.5px; color: #9ea2bb; border-bottom: 1px solid #2a2c36; display: flex; align-items: center; gap: 7px; }
.agent-dot { width: 7px; height: 7px; border-radius: 50%; background: #34c759; box-shadow: 0 0 0 3px rgba(52,199,89,.2); }
.agent pre { margin: 0; padding: 10px 12px 12px; font: 11.5px/1.55 var(--mono); white-space: pre-wrap; min-height: 74px; }
.agent .ok { color: #7ee2a0; } .agent .dim { color: #8b8fa8; } .agent .cmd { color: #fff; }
@keyframes rise { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }

.keycap { position: absolute; top: 18px; left: 50%; transform: translateX(-50%); z-index: 6; padding: 6px 14px; border-radius: 9px; background: rgba(30, 32, 48, .86); color: #fff; font: 600 15px/1.2 var(--sans); letter-spacing: .02em; box-shadow: 0 6px 20px rgba(0,0,0,.25); animation: rise .2s ease-out; }
.keycap[hidden] { display: none; }

/* Caption */
.caption { display: flex; align-items: center; gap: 16px; margin-top: 12px; height: 40px; padding: 0 4px; }
.caption-text { flex: 1; min-width: 0; font-size: 13.5px; line-height: 1.5; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.caption-text b { color: var(--ink); font-weight: 650; }
.caption-side { display: flex; align-items: center; gap: 12px; flex: none; }
.progress { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.reset { border: 1px solid var(--chip-line); background: var(--chip); border-radius: 7px; padding: 4px 10px; font-size: 12px; color: var(--ink); }
.caption .resume { border: 0; background: none; color: var(--accent); font-weight: 600; padding: 0; text-decoration: underline; text-underline-offset: 3px; }


/* A Finder window, shown over the app at the start: the session begins by opening a .md file. */
.window { position: relative; }
.finder { position: absolute; inset: 0; z-index: 10; background: var(--win); display: flex; flex-direction: column; transition: opacity .45s ease; }
.finder.closing { opacity: 0; }
.f-bar { height: 52px; flex: none; display: flex; align-items: center; gap: 16px; padding: 0 16px; background: var(--bar); border-bottom: 1px solid var(--bar-line); }
.f-nav { color: var(--muted); letter-spacing: 6px; font-size: 15px; }
.f-search { margin-left: auto; border: 1px solid var(--bar-line); background: var(--win); border-radius: 7px; padding: 3px 12px 3px 10px; color: var(--muted); font-size: 12px; min-width: 150px; }
.f-body { flex: 1; display: flex; min-height: 0; }
.f-side { width: 180px; flex: none; padding: 12px 10px; display: flex; flex-direction: column; gap: 2px; background: var(--bar); border-right: 1px solid var(--bar-line); font-size: 12.5px; }
.f-side small { font-size: 10.5px; font-weight: 600; color: var(--muted); margin: 10px 8px 4px; }
.f-side span { padding: 3px 8px; border-radius: 6px; }
.f-side span.on { background: var(--seg); }
.f-main { flex: 1; padding: 6px 0; font-size: 12.5px; }
.f-row { display: grid; grid-template-columns: 1.4fr 1fr .8fr; align-items: center; padding: 5px 18px; margin: 0 8px; border-radius: 6px; }
.f-row:nth-child(even) { background: color-mix(in srgb, var(--bar) 55%, transparent); }
.f-row.f-head { background: none; color: var(--muted); font-size: 11.5px; border-bottom: 1px solid var(--bar-line); border-radius: 0; margin: 0 8px 4px; }
.f-row > span:first-child { display: flex; align-items: center; gap: 8px; }
.f-row > span:not(:first-child) { color: var(--muted); }
.f-row.sel { background: var(--accent); color: #fff; }
.f-row.sel > span { color: #fff; }
.f-ic { width: 18px; height: 22px; flex: none; border-radius: 3px; display: inline-grid; place-items: center; font: 700 6.5px/1 var(--sans); font-style: normal; color: #fff; background: #6a6e85; }
.f-ic.md { background: #4b47e0; } .f-ic.csv { background: #1f9d55; } .f-ic.pdf { background: #d64545; }
.f-ic.app { width: 16px; height: 16px; border-radius: 4px; background: #4b47e0; font-size: 7.5px; }
.f-menu { position: absolute; z-index: 11; width: 210px; padding: 5px; border-radius: 8px; background: color-mix(in srgb, var(--win) 94%, transparent); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); border: 1px solid var(--bar-line); box-shadow: 0 12px 34px rgba(0,0,0,.22); font-size: 12.5px; }
.f-menu[hidden], .f-sub[hidden] { display: none; }
.f-menu > span, .f-sub > span { display: flex; align-items: center; gap: 7px; padding: 3px 10px; border-radius: 5px; }
.f-menu > span b { margin-left: auto; font-weight: 400; }
.f-menu hr, .f-sub hr { border: 0; border-top: 1px solid var(--bar-line); margin: 4px 6px; }
.f-menu > span.hot, .f-sub > span.hot { background: var(--accent); color: #fff; }
.f-sub > span em { font-style: normal; opacity: .75; }
.f-sub { position: absolute; left: 202px; top: 22px; width: 200px; padding: 5px; border-radius: 8px; background: color-mix(in srgb, var(--win) 94%, transparent); -webkit-backdrop-filter: blur(20px); backdrop-filter: blur(20px); border: 1px solid var(--bar-line); box-shadow: 0 12px 34px rgba(0,0,0,.22); }

/* The tour's pointer */
.cursor { position: absolute; left: 0; top: 0; z-index: 20; width: 22px; height: 22px; pointer-events: none; opacity: 0; transition: opacity .25s;
  background: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 3l13 7.5-6 1.4 3.4 6.6-2.6 1.3-3.4-6.6L5 17.5z' fill='%23111' stroke='%23fff' stroke-width='1.4' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.cursor.on { opacity: 1; }
.cursor.moving { transition: opacity .25s, left .55s cubic-bezier(.3,.7,.2,1), top .55s cubic-bezier(.3,.7,.2,1); }
.cursor.click::after { content: ""; position: absolute; left: -9px; top: -9px; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--accent); animation: ping .45s ease-out forwards; }
@keyframes ping { from { transform: scale(.4); opacity: .9; } to { transform: scale(1.6); opacity: 0; } }

@media (prefers-reduced-motion: reduce) { .cursor.moving { transition: opacity .25s; } .agent, .keycap { animation: none; } }
