/* yc-collab — mobile-first. Base styles are the phone layout; min-width queries widen it. */
:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --ink: #1d1b18;
  --muted: #6f6a62;
  --line: #e7e3dc;
  --accent: #e8590c;
  --accent-ink: #ffffff;
  --accent-soft: #fff1e8;
  --danger: #c92a2a;
  --ok: #2f9e44;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
  --font: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151412; --surface: #1e1d1a; --ink: #f1eee8; --muted: #a29c92; --line: #34312c;
    --accent-soft: #3a2316; --shadow: 0 1px 2px rgba(0,0,0,.3), 0 8px 24px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 140px; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.5 var(--font); }
body.sheet-open { overflow: hidden; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
p { margin: 0 0 .75rem; }
a { color: var(--accent); }
button { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.center { text-align: center; }
.pad { padding: 3rem 1rem; }
.error { color: var(--danger); font-size: .9rem; margin: 0; }
.label { font-size: .8rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin: .75rem 0 .35rem; display: block; }
.stack { display: flex; flex-direction: column; gap: .6rem; }
.row { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.row .field-input { flex: 1 1 180px; }

/* ---------- controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  min-height: 44px; padding: 0 1rem; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); font-weight: 600; text-decoration: none; color: var(--ink); cursor: pointer;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.block { width: 100%; }
.btn.small { min-height: 36px; padding: 0 .8rem; font-size: .9rem; }
.btn:disabled { opacity: .6; }
.link { background: none; border: 0; color: var(--accent); padding: .25rem 0; cursor: pointer; font-weight: 600; }
.field-input, .answer, .comment-form textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: .7rem .8rem; min-height: 44px;
}
.field-input:focus, .answer:focus, .comment-form textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.chip {
  display: inline-flex; align-items: center; gap: .3rem; min-height: 36px; padding: 0 .65rem;
  border-radius: 999px; border: 1px solid var(--line); background: var(--surface); font-size: .85rem; cursor: pointer; white-space: nowrap;
}
.chip svg, .tool svg { width: 16px; height: 16px; flex: none; }
.chip.has { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.chip:disabled { opacity: .4; cursor: default; }

.avatar {
  --c: var(--accent);
  display: inline-grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: var(--c); color: #fff; font-size: .72rem; font-weight: 700; flex: none;
  border: 2px solid var(--surface);
}
.avatar.xs { width: 22px; height: 22px; font-size: .6rem; border-width: 0; }
.avatar.me { box-shadow: 0 0 0 2px var(--c); }

.logo-mark {
  display: inline-grid; place-items: center; width: 48px; height: 48px; border-radius: 12px;
  background: var(--accent); color: #fff; font-weight: 800; letter-spacing: -.02em; text-decoration: none;
}
.logo-mark.small { width: 34px; height: 34px; border-radius: 9px; font-size: .85rem; flex: none; }

/* ---------- landing ---------- */
.landing-main { max-width: 560px; margin: 0 auto; padding: 2rem 1rem 3rem; display: flex; flex-direction: column; gap: 1.25rem; }
.landing h1 { font-size: 2rem; letter-spacing: -.02em; margin-top: .5rem; }
.lede { font-size: 1.1rem; color: var(--muted); }
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: .6rem; }
.steps li { display: flex; gap: .75rem; align-items: center; }
.steps b { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); flex: none; font-size: .85rem; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; box-shadow: var(--shadow); }
.panel h2 { font-size: 1.15rem; }
.recent-list { display: grid; gap: .5rem; }
.recent { display: flex; flex-direction: column; padding: .75rem; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: var(--ink); }

.center-card { max-width: 420px; margin: 12vh auto 0; padding: 1.5rem 1rem; display: flex; flex-direction: column; gap: .75rem; }

/* ---------- editor chrome ---------- */
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: .6rem;
  padding: .6rem .75rem; padding-top: max(.6rem, env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.title { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.title strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conn { display: inline-flex; align-items: center; gap: .3rem; font-size: .75rem; color: var(--muted); }
.conn i { width: 7px; height: 7px; border-radius: 50%; background: #adb5bd; }
.conn[data-status="connected"] i { background: var(--ok); }
.conn[data-status="disconnected"] i { background: var(--danger); }
.presence { display: flex; align-items: center; }
.presence .avatar + .avatar { margin-left: -8px; }
.me-btn { display: none; margin-left: .5rem; background: none; border: 1px solid var(--line); border-radius: 999px; padding: .25rem .7rem; min-height: 32px; cursor: pointer; font-size: .85rem; }

.toolbar {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: .35rem; padding: .5rem .75rem;
  border-bottom: 1px solid var(--line); background: var(--bg);
}
.tool {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: .15rem; min-height: 48px;
  border: 0; background: none; border-radius: 10px; font-size: .75rem; color: var(--muted); cursor: pointer; padding: .3rem 0;
}
.tool:active, .tool:hover { background: var(--accent-soft); color: var(--accent); }
.tool svg { width: 20px; height: 20px; }
.count { position: absolute; top: 2px; right: calc(50% - 22px); background: var(--accent); color: #fff; font-size: .65rem; border-radius: 999px; padding: 0 .35rem; line-height: 1.4; }

.section-nav {
  position: sticky; top: 55px; z-index: 4; display: flex; gap: .35rem; overflow-x: auto; scrollbar-width: none;
  padding: .5rem .75rem; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.section-nav::-webkit-scrollbar { display: none; }
.section-nav a { flex: none; padding: .35rem .75rem; border-radius: 999px; border: 1px solid var(--line); text-decoration: none; color: var(--ink); font-size: .85rem; background: var(--surface); }

.form { padding: .75rem .75rem 5rem; max-width: 760px; margin: 0 auto; }
.section { margin: 1rem 0 1.75rem; }
.section h2 { font-size: 1.35rem; margin: .5rem .25rem .75rem; }
.card {
  --edit: transparent;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: .9rem; margin-bottom: .75rem; box-shadow: var(--shadow); transition: box-shadow .2s, border-color .2s;
}
.card.live { border-color: var(--edit); box-shadow: 0 0 0 2px color-mix(in srgb, var(--edit) 25%, transparent), var(--shadow); }
.card.flash { box-shadow: 0 0 0 3px var(--accent); }
.q { display: block; font-weight: 600; margin-bottom: .5rem; }
.q em { font-weight: 400; color: var(--muted); font-style: normal; }
textarea.answer { resize: none; overflow: hidden; line-height: 1.55; min-height: 92px; }
.card-foot { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem; margin-top: .5rem; }
.spacer { flex: 1; }
.counter { font-size: .8rem; color: var(--muted); }
.counter.over { color: var(--danger); font-weight: 600; }
.editors { display: flex; gap: .3rem; flex-wrap: wrap; }
.editing { --c: var(--accent); font-size: .75rem; color: #fff; background: var(--c); padding: .1rem .5rem; border-radius: 999px; }

/* ---------- form controls added for the full YC form ---------- */
.sub { font-size: .88rem; color: var(--muted); margin: -.25rem 0 .6rem; }
.req { color: var(--accent); font-weight: 700; }
.upload-note { font-size: .85rem; background: var(--accent-soft); border-radius: 8px; padding: .5rem .65rem; margin: 0 0 .6rem; }
.card.conditional { border-left: 3px solid var(--accent); }
.seg { display: flex; flex-wrap: wrap; gap: .4rem; }
.seg button {
  flex: 1 1 120px; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  font-weight: 600; cursor: pointer; padding: .4rem .8rem;
}
.seg button.on { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.money-wrap { display: flex; align-items: center; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding-left: .7rem; }
.money-wrap > span { color: var(--muted); }
.money-wrap .answer { border: 0; }
.money-wrap:focus-within { outline: 2px solid var(--accent); outline-offset: -1px; }
.money-wrap .answer:focus { outline: none; }
.rev-grid { display: grid; gap: .5rem; }
.rev-row { display: grid; grid-template-columns: 6.5rem 1fr; align-items: center; gap: .5rem; font-size: .92rem; }
.btn.dashed { border-style: dashed; color: var(--accent); background: transparent; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; color: var(--muted); }
.icon-btn svg { width: 17px; height: 17px; }
.danger-link { color: var(--danger); }

.founders-wrap { display: grid; gap: .75rem; margin-bottom: .75rem; }
.founders { display: grid; gap: .75rem; }
.founder { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.founder > summary { display: flex; align-items: center; gap: .65rem; padding: .8rem .9rem; cursor: pointer; list-style: none; min-height: 60px; }
.founder > summary::-webkit-details-marker { display: none; }
.founder > summary::after { content: '▾'; color: var(--muted); margin-left: .25rem; transition: transform .2s; }
.founder[open] > summary::after { transform: rotate(180deg); }
.founder-title { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.founder-title strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.badge { font-size: .75rem; color: var(--danger); }
.badge.done { color: var(--ok); }
.founder-body { padding: 0 .6rem .8rem; border-top: 1px solid var(--line); }
.founder-body .card { box-shadow: none; }
.sub-h { font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 1.1rem .3rem .5rem; }
.entries-block { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem; margin-bottom: .75rem; display: grid; gap: .6rem; }
.entries { display: grid; gap: .6rem; }
.entry { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: .75rem; display: grid; gap: .4rem; }
.entry-grid { display: grid; gap: .6rem; }
.entry-field { display: grid; gap: .25rem; font-size: .85rem; font-weight: 600; }
.with-copy { display: flex; gap: .4rem; align-items: flex-start; }
.with-copy .answer { flex: 1; min-width: 0; }
.check { display: flex; gap: .5rem; align-items: center; font-size: .9rem; min-height: 40px; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }
.entry .danger-link { justify-self: start; }
.missing summary { cursor: pointer; color: var(--danger); font-weight: 600; min-height: 36px; }
.missing ul { margin: .4rem 0 0; padding-left: 1.2rem; font-size: .88rem; }
.ok { color: var(--ok); font-weight: 600; }

/* Single-line answers: icon-only actions beside the input, so profiles don't sprawl on phones. */
.card.is-short { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: .4rem; align-items: center; }
.card.is-short > :not(.answer):not(.money-wrap):not(.card-foot) { grid-column: 1 / -1; }
.card.is-short > .card-foot { margin-top: 0; flex-wrap: nowrap; gap: .3rem; }
.card.is-short .card-foot .chip { min-height: 44px; min-width: 44px; justify-content: center; padding: 0 .55rem; }
.card.is-short .card-foot .chip > span { display: none; }
.card.is-short .card-foot .chip.has > span { display: inline; }
.card.is-short .card-foot .editors, .card.is-short .card-foot .counter, .card.is-short .card-foot .spacer { display: none; }
.founder-body .card { padding: .75rem; margin-bottom: .5rem; }

/* ---------- comments ---------- */
.thread { margin-top: .75rem; padding-top: .75rem; border-top: 1px dashed var(--line); display: grid; gap: .6rem; }
.comment { background: var(--bg); border-radius: 10px; padding: .6rem .7rem; }
.comment.resolved { opacity: .6; }
.comment p { margin: .3rem 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.comment-head { display: flex; align-items: center; gap: .4rem; font-size: .85rem; flex-wrap: wrap; }
.comment-actions { display: flex; gap: .75rem; }
.comment-actions button { background: none; border: 0; padding: .3rem 0; color: var(--accent); font-size: .85rem; font-weight: 600; cursor: pointer; min-height: 32px; }
.tag { font-size: .7rem; background: var(--line); border-radius: 999px; padding: 0 .4rem; }
.comment-form { display: flex; gap: .5rem; align-items: flex-end; }
.comment-form textarea { resize: vertical; }
.group { margin-bottom: 1.25rem; display: grid; gap: .5rem; }
.jump { text-align: left; background: none; border: 0; padding: 0; font-weight: 600; cursor: pointer; color: var(--ink); }

/* ---------- sheet (bottom sheet on phones, side panel on desktop) ---------- */
.scrim { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 20; }
.sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 21; max-height: 88vh; max-height: 88dvh;
  display: flex; flex-direction: column; background: var(--surface); border-radius: 18px 18px 0 0;
  box-shadow: 0 -10px 40px rgba(0,0,0,.2); animation: up .2s ease-out;
}
@keyframes up { from { transform: translateY(30px); opacity: 0; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1rem 1rem .5rem; }
.sheet-head h2 { font-size: 1.15rem; margin: 0; }
.sheet-close { width: 44px; height: 44px; border: 0; background: var(--bg); border-radius: 50%; font-size: 1.5rem; line-height: 1; cursor: pointer; flex: none; }
.sheet-body { overflow-y: auto; padding: .25rem 1rem calc(1.5rem + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: .6rem; }
.sheet-body h3 { margin: 1rem 0 0; font-size: 1rem; }
.name-list { display: grid; gap: .5rem; }
.name-btn { display: flex; align-items: center; gap: .6rem; min-height: 52px; padding: 0 .75rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; font-weight: 600; text-align: left; }

.versions { display: grid; gap: .4rem; }
.version { display: flex; flex-direction: column; align-items: flex-start; gap: .1rem; text-align: left; padding: .65rem .75rem; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; }
.version .muted { font-size: .8rem; }
.version.auto strong { font-weight: 500; color: var(--muted); }
.legend { font-size: .85rem; }
.diff-card { border: 1px solid var(--line); border-radius: 10px; padding: .75rem; display: grid; gap: .5rem; }
.diff { white-space: pre-wrap; overflow-wrap: anywhere; font-size: .92rem; background: var(--bg); padding: .6rem; border-radius: 8px; }
del { background: #ffe3e3; color: #a51111; text-decoration: line-through; }
ins { background: #d3f9d8; color: #1b6b2a; text-decoration: none; }
@media (prefers-color-scheme: dark) { del { background: #4a1d1d; color: #ffb3b3; } ins { background: #183d22; color: #b2f2bb; } }

.export-item { display: flex; gap: .75rem; align-items: flex-start; border-bottom: 1px solid var(--line); padding: .6rem 0; }
.export-text { flex: 1; min-width: 0; }
.export-text .q { font-size: .85rem; color: var(--muted); font-weight: 500; margin-bottom: .2rem; }
.export-text .a { white-space: pre-wrap; overflow-wrap: anywhere; margin: 0; }
.export-item.empty .a { color: var(--muted); font-style: italic; }
.copy-row { display: flex; gap: .5rem; align-items: center; }
.copy-row code { flex: 1; min-width: 0; overflow-wrap: anywhere; background: var(--bg); padding: .6rem; border-radius: 8px; font-size: .9rem; }

#toast {
  position: fixed; left: 50%; bottom: calc(1.25rem + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); z-index: 30;
  background: var(--ink); color: var(--bg); padding: .6rem 1rem; border-radius: 999px; font-size: .9rem;
  opacity: 0; pointer-events: none; transition: .2s; max-width: calc(100vw - 2rem); text-align: center;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- wider screens ---------- */
@media (min-width: 720px) {
  .landing-main { padding-top: 4rem; }
  .landing h1 { font-size: 2.6rem; }
  .topbar { padding: .7rem 1.25rem; }
  .me-btn { display: inline-block; }
  .toolbar { display: flex; justify-content: center; gap: .5rem; padding: .5rem 1.25rem; }
  .tool { flex-direction: row; gap: .4rem; padding: 0 .9rem; font-size: .9rem; min-height: 40px; color: var(--ink); }
  .tool svg { width: 17px; height: 17px; }
  .count { position: static; }
  .section-nav { justify-content: center; top: 57px; }
  .form { padding: 1rem 1.25rem 6rem; }
  .card { padding: 1.1rem 1.2rem; }
  .entry-grid { grid-template-columns: 1fr 1fr; }
  .entry-grid .wide { grid-column: 1 / -1; }
  .rev-grid { grid-template-columns: 1fr 1fr; column-gap: 1.25rem; }
  .founder-body { padding: 0 1rem 1rem; }
  .sheet { left: auto; top: 0; width: 460px; max-height: none; border-radius: 0; animation-name: side; }
  @keyframes side { from { transform: translateX(30px); opacity: 0; } }
}
