/* Brainstorming. Base tokens and controls come from /_shared/live-ui.css. */
:root {
  --n-yellow: #ffe58a; --n-pink: #ffbfd6; --n-blue: #b3dcff; --n-green: #bdf0c6; --n-orange: #ffcc9e; --n-purple: #dcc8ff;
  --note-ink: #1e2433;
}
html, body { height: 100%; }
body { display: flex; flex-direction: column; }
#app { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.linkish { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; }
.row { display: flex; gap: 8px; align-items: center; }
.row > .input { flex: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---- start ---- */
.start { width: 100%; max-width: 1040px; margin: 0 auto; padding: clamp(24px, 5vw, 56px) 16px 40px; }
.start.narrow { max-width: 460px; }
.brand { display: inline-block; font: 400 1rem/1 "Archivo Black", "Archivo", system-ui, sans-serif; letter-spacing: -0.02em; text-decoration: none; margin-bottom: 18px; }
.brand.small { font-size: 0.875rem; margin: 0; color: var(--muted); }
.start-head h1 { font-size: clamp(2rem, 6vw, 3rem); margin: 0; }
.start-head .lead { margin: 10px 0 28px; max-width: 34em; color: var(--muted); font-size: 1.0625rem; }
.start-grid { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 20px; align-items: start; }
.start-side { display: flex; flex-direction: column; gap: 20px; }
.start-form, .join-form, .recent, .start .card { display: flex; flex-direction: column; gap: 16px; }
.card h2 { margin: 0; font-size: 1.15rem; }
.card h1 { margin: 0; font-size: 1.8rem; }
.card p { margin: 0; }
.tpls { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.tpl { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border: 1.5px solid var(--line); border-radius: 10px; cursor: pointer; background: var(--surface); }
.tpl input { position: absolute; opacity: 0; }
.tpl:has(input:checked) { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.tpl:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.tpl-name { font-weight: 700; font-size: 0.9375rem; }
.tpl-cols { display: flex; flex-wrap: wrap; gap: 4px; }
.tpl-cols i { font-style: normal; font-size: 0.75rem; padding: 2px 6px; border-radius: 5px; background: var(--sunk); color: var(--muted); }
.more-opts { display: flex; flex-direction: column; gap: 14px; }
.more-opts[open] { padding-bottom: 4px; }
.more-opts summary { cursor: pointer; font-weight: 700; margin-bottom: 4px; }
.more-opts > * + * { margin-top: 12px; }
.votes-field input { max-width: 120px; }
.code-input { text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700; }
.recent ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.recent li { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.recent a { text-decoration: none; padding: 6px 0; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent a:hover b { text-decoration: underline; }

/* ---- board chrome ---- */
.bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 10px 16px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.bar-title { flex: 1 1 260px; min-width: 0; }
.bar-title h1 { margin: 2px 0 0; font-size: 1.15rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.question { margin: 2px 0 0; color: var(--muted); font-size: 0.9375rem; }
.bar-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.phases { display: flex; border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; }
.phase { display: flex; align-items: center; gap: 6px; padding: 6px 10px; font: 700 0.8125rem/1 "Archivo", system-ui, sans-serif; color: var(--muted); background: var(--surface); border: 0; border-right: 1px solid var(--line); cursor: pointer; }
.phase:last-child { border-right: 0; }
.phase:disabled { cursor: default; }
.phase[aria-current="step"] { background: var(--ink); color: var(--bg); }
.phase-n { display: grid; place-items: center; width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid currentColor; font-size: 0.6875rem; }
.timer { font: 700 0.9375rem/1 "Archivo", system-ui, sans-serif; padding: 8px 10px; border-radius: 8px; background: var(--sunk); font-variant-numeric: tabular-nums; }
.timer.soon { background: #fff1d6; color: #7a4a00; }
.timer.done { background: var(--danger); color: #fff; }
.notice { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 8px 16px; background: var(--sunk); border-bottom: 1px solid var(--line); font-size: 0.9375rem; }
.notice svg { width: 16px; height: 16px; vertical-align: -3px; }
.inline-check { align-items: center; }
.inline-check input { margin: 0; }

/* ---- columns ---- */
.board {
  flex: 1; min-height: 0; display: flex; gap: 14px; align-items: flex-start; overflow: auto; padding: 16px;
  scroll-snap-type: x proximity; overscroll-behavior-x: contain;
}
.col {
  flex: 0 0 clamp(260px, 26vw, 340px); max-height: 100%; display: flex; flex-direction: column;
  background: color-mix(in srgb, var(--surface) 70%, var(--bg)); border: 1px solid var(--line); border-radius: 14px;
  scroll-snap-align: start;
}
.col-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; padding: 12px 14px 8px; }
.col-name { margin: 0; font-size: 1rem; }
.col-count { color: var(--muted); font-size: 0.8125rem; }
.col-body { flex: 1; min-height: 60px; overflow-y: auto; padding: 4px 10px 10px; display: flex; flex-direction: column; gap: 8px; }
.col-empty { margin: 8px 4px; color: var(--muted); font-size: 0.875rem; }
.composer { padding: 10px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.composer-text { width: 100%; resize: none; padding: 9px 11px; font: inherit; color: var(--ink); background: var(--surface); border: 1.5px solid var(--line); border-radius: 10px; }
.composer-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.swatches, .pop-swatches { display: flex; gap: 6px; }
.pop-swatches { padding: 6px 10px; }
.sw { width: 22px; height: 22px; border-radius: 6px; border: 1.5px solid rgb(0 0 0 / 0.15); cursor: pointer; padding: 0; }
.sw[aria-pressed="true"] { outline: 2px solid var(--ink); outline-offset: 2px; }

.c-yellow { --n: var(--n-yellow); } .c-pink { --n: var(--n-pink); } .c-blue { --n: var(--n-blue); }
.c-green { --n: var(--n-green); } .c-orange { --n: var(--n-orange); } .c-purple { --n: var(--n-purple); }
.sw { background: var(--n); }

/* ---- notes ---- */
.note {
  position: relative; padding: 10px 12px 8px; border-radius: 8px; background: var(--n); color: var(--note-ink);
  box-shadow: 0 1px 0 rgb(0 0 0 / 0.08); cursor: grab; touch-action: manipulation; user-select: none; -webkit-user-select: none;
}
.note:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.note.is-hidden { background: repeating-linear-gradient(-45deg, var(--n), var(--n) 8px, color-mix(in srgb, var(--n) 80%, #fff) 8px, color-mix(in srgb, var(--n) 80%, #fff) 16px); }
.note-text { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.4; }
.note-edit { width: 100%; font: inherit; color: var(--note-ink); background: rgb(255 255 255 / 0.6); border: 1.5px solid rgb(0 0 0 / 0.25); border-radius: 6px; padding: 6px; resize: vertical; }
.note-foot { display: flex; align-items: center; gap: 8px; margin-top: 6px; min-height: 24px; font-size: 0.75rem; color: rgb(30 36 51 / 0.72); }
.note-foot .by { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-foot .tag { padding: 2px 6px; border-radius: 5px; background: rgb(255 255 255 / 0.55); }
.note-more { margin-left: auto; display: grid; place-items: center; width: 28px; height: 24px; border: 0; border-radius: 6px; background: transparent; color: inherit; cursor: pointer; }
.note-more:hover, .note-more:focus-visible { background: rgb(0 0 0 / 0.08); }
.note-more svg { width: 18px; height: 18px; }
.vote { display: inline-flex; align-items: center; gap: 4px; }
.vbtn { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; border: 1.5px solid rgb(0 0 0 / 0.2); background: rgb(255 255 255 / 0.6); color: var(--note-ink); cursor: pointer; }
.vbtn:disabled { opacity: 0.35; cursor: default; }
.vbtn svg { width: 16px; height: 16px; }
.dots { min-width: 20px; text-align: center; font-weight: 700; letter-spacing: 1px; }
.score { font-weight: 700; }
.score.big { font-size: 0.9375rem; padding: 2px 8px; border-radius: 6px; background: rgb(255 255 255 / 0.65); }
.note.dragging, .group.dragging { opacity: 0.35; }
.note.ghost, .group.ghost { position: fixed; z-index: 50; pointer-events: none; transform: rotate(-2deg); box-shadow: 0 14px 30px rgb(0 0 0 / 0.28); opacity: 0.95; }
.note.drop-into { outline: 3px dashed var(--ink); outline-offset: 3px; }
.drop-marker { height: 4px; border-radius: 2px; background: var(--ink); margin: -2px 0; }

/* ---- groups ---- */
.group { border: 1.5px dashed var(--muted); border-radius: 12px; padding: 6px 8px 8px; background: color-mix(in srgb, var(--surface) 80%, transparent); }
.group-head { display: flex; align-items: center; gap: 4px; margin-bottom: 6px; }
.group-title { flex: 1; min-width: 0; font: 700 0.9375rem/1.2 "Archivo", system-ui, sans-serif; color: var(--ink); background: transparent; border: 1.5px solid transparent; border-radius: 6px; padding: 4px 6px; }
.group-title:hover { border-color: var(--line); }
.group-title:focus { border-color: var(--ink); outline: none; background: var(--surface); }
.group .score { font-size: 0.8125rem; color: var(--muted); white-space: nowrap; }
.group-body { display: flex; flex-direction: column; gap: 6px; min-height: 36px; }
.grip { display: grid; place-items: center; width: 24px; height: 28px; border: 0; background: none; color: var(--muted); cursor: grab; touch-action: none; border-radius: 6px; }
.grip svg { width: 16px; height: 16px; }

/* ---- column tabs (phones) ---- */
.coltabs { display: none; }

/* ---- dialogs ---- */
.share { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; }
.qr { padding: 10px; background: #fff; border-radius: 12px; border: 1px solid var(--line); line-height: 0; }
.share-info { flex: 1 1 220px; display: flex; flex-direction: column; gap: 8px; }
.share-info p { margin: 0; }
.big-code { font-size: 1.8rem; }
.people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; max-height: 60vh; overflow: auto; }
.people li { display: flex; align-items: center; gap: 10px; padding: 6px 2px; border-bottom: 1px solid var(--line); }
.pname { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--line); flex: none; }
.dot.on { background: var(--ok); }
.tag { font-size: 0.75rem; padding: 2px 7px; border-radius: 999px; background: var(--sunk); border: 1px solid var(--line); }
.col-edit { list-style: none; margin: 0 0 8px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.col-edit li { display: flex; gap: 4px; align-items: center; }
.danger-zone summary { cursor: pointer; font-weight: 700; }
.danger-zone[open] { display: flex; flex-wrap: wrap; gap: 8px; }
.danger-zone[open] summary { flex-basis: 100%; }
.credits { padding-left: 1.1em; margin: 0; }
.credits li { margin-bottom: 6px; }
.dialog h3 { margin: 4px 0 0; font-size: 1rem; }
.dialog p { margin: 0; }

@media (max-width: 860px) {
  .start-grid { grid-template-columns: 1fr; }
}
@media (max-width: 700px) {
  .bar { padding: 8px 12px; gap: 8px; }
  .bar-tools { width: 100%; }
  .phases { order: 5; width: 100%; }
  .phase { flex: 1; justify-content: center; padding: 8px 4px; }
  .phase-l { font-size: 0.75rem; }
  .hide-sm { display: none; }
  .board { padding: 10px; gap: 10px; scroll-snap-type: x mandatory; }
  .col { flex-basis: calc(100vw - 44px); }
  .coltabs { display: flex; gap: 6px; overflow-x: auto; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); scrollbar-width: none; }
  .coltabs[hidden] { display: none; }
  .coltab { flex: none; padding: 7px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: 700 0.8125rem/1 "Archivo", system-ui, sans-serif; }
  .coltab[aria-current="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
}

@media print {
  .bar-tools, .composer, .notice, .coltabs, .note-more, .vote, .grip, .group-head .btn { display: none !important; }
  body, .board { height: auto; overflow: visible; }
  .board { flex-wrap: wrap; }
  .col { max-height: none; break-inside: avoid; }
  .col-body { overflow: visible; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }
