:root {
  --bg: #f5f4f0;
  --surface: #ffffff;
  --surface-2: #eeece7;
  --surface-3: #e3e0d9;
  --text: #1c1b1a;
  --muted: #66645f;
  --faint: #97948d;
  --line: #e2dfd8;
  --line-strong: #cfcbc2;
  --accent: #4a55d6;
  --accent-hover: #3c47c2;
  --accent-soft: #e8eafb;
  --on-accent: #ffffff;
  --good: #1f9254;
  --good-soft: #e2f3e8;
  --better: #b86f0e;
  --better-soft: #fbefdb;
  --actions: #2f6bd0;
  --actions-soft: #e4ecfb;
  --danger: #c93a2d;
  --danger-soft: #fae6e3;
  --av: 70% 88%;
  --av-text: 50% 28%;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / .06);
  --shadow: 0 1px 2px rgb(0 0 0 / .05), 0 6px 16px rgb(0 0 0 / .06);
  --shadow-lg: 0 16px 48px rgb(0 0 0 / .18);
  --radius: 12px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #131315;
    --surface: #1c1c20;
    --surface-2: #232328;
    --surface-3: #2d2d33;
    --text: #ececef;
    --muted: #a3a3aa;
    --faint: #6f6f78;
    --line: #2c2c32;
    --line-strong: #3b3b43;
    --accent: #8189f3;
    --accent-hover: #939af6;
    --accent-soft: #262946;
    --on-accent: #10112a;
    --good: #4fc282;
    --good-soft: #1a2c22;
    --better: #e2a24c;
    --better-soft: #31271a;
    --actions: #6ea2f2;
    --actions-soft: #1b2538;
    --danger: #ef6e62;
    --danger-soft: #3a201e;
    --av: 30% 30%;
    --av-text: 75% 85%;
    --shadow-sm: 0 1px 2px rgb(0 0 0 / .4);
    --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 6px 16px rgb(0 0 0 / .25);
    --shadow-lg: 0 16px 48px rgb(0 0 0 / .55);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #131315;
  --surface: #1c1c20;
  --surface-2: #232328;
  --surface-3: #2d2d33;
  --text: #ececef;
  --muted: #a3a3aa;
  --faint: #6f6f78;
  --line: #2c2c32;
  --line-strong: #3b3b43;
  --accent: #8189f3;
  --accent-hover: #939af6;
  --accent-soft: #262946;
  --on-accent: #10112a;
  --good: #4fc282;
  --good-soft: #1a2c22;
  --better: #e2a24c;
  --better-soft: #31271a;
  --actions: #6ea2f2;
  --actions-soft: #1b2538;
  --danger: #ef6e62;
  --danger-soft: #3a201e;
  --av: 30% 30%;
  --av-text: 75% 85%;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / .4);
  --shadow: 0 1px 2px rgb(0 0 0 / .4), 0 6px 16px rgb(0 0 0 / .25);
  --shadow-lg: 0 16px 48px rgb(0 0 0 / .55);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; }
svg.logo { width: 30px; height: 30px; stroke: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

input, select, textarea {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  padding: 8px 11px;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
kbd { font: 11px ui-monospace, SFMono-Regular, Menlo, monospace; padding: 0 5px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 4px; background: var(--surface-2); }

/* column colours, usable anywhere */
.col-good { --c: var(--good); --c-soft: var(--good-soft); }
.col-better { --c: var(--better); --c-soft: var(--better-soft); }
.col-actions { --c: var(--actions); --c-soft: var(--actions-soft); }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 34px; padding: 0 14px; border-radius: 9px;
  border: 1px solid var(--line-strong); background: var(--surface);
  cursor: pointer; font-weight: 560; white-space: nowrap; text-decoration: none;
  transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn.lg { height: 42px; font-size: 15px; width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px; border-radius: 9px;
  border: 1px solid transparent; background: transparent;
  color: var(--muted); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn.sm { width: 26px; height: 26px; border-radius: 7px; }
.icon-btn.sm svg { width: 14px; height: 14px; }

/* ---------- landing ---------- */

.landing { max-width: 1000px; margin: 0 auto; padding: 22px 22px 48px; }
.landing.narrow { max-width: 460px; }
.landing-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 48px; }
.brand-row { display: flex; align-items: center; gap: 10px; font-weight: 650; font-size: 16px; color: inherit; text-decoration: none; }
.landing-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 48px; align-items: start; }
.hero h1 { font-size: 40px; line-height: 1.1; letter-spacing: -.022em; margin: 0 0 14px; }
.lead { font-size: 16px; color: var(--muted); margin: 0 0 28px; max-width: 470px; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.steps li { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.steps b { display: block; }
.steps span { color: var(--muted); font-size: 13px; }
.step-no { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; font-weight: 700; font-size: 13px; flex: none; }
.step-no.s1 { background: var(--good-soft); color: var(--good); }
.step-no.s2 { background: var(--accent-soft); color: var(--accent); }
.step-no.s3 { background: var(--actions-soft); color: var(--actions); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 24px; box-shadow: var(--shadow); }
.panel h2 { margin: 0 0 18px; font-size: 19px; letter-spacing: -.01em; }
.field { display: grid; gap: 6px; margin-bottom: 14px; font-weight: 560; font-size: 13px; }
.field small { color: var(--muted); font-weight: 400; }
.error { color: var(--danger); min-height: 1.5em; margin: 10px 0 0; font-size: 13px; }
.eyebrow { color: var(--accent); font-weight: 650; font-size: 12px; margin: 0 0 4px; letter-spacing: .03em; }
.muted { color: var(--muted); }
.recent { margin-top: 16px; }
.recent h3 { font-size: 12px; color: var(--faint); font-weight: 650; margin: 0 0 6px 10px; }
.recent a { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: inherit; text-decoration: none; }
.recent a:hover { background: var(--surface); }
.recent a span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.recent small { color: var(--faint); white-space: nowrap; }
.fineprint { color: var(--faint); font-size: 12px; margin-top: 48px; text-align: center; }

@media (max-width: 820px) {
  .landing-grid { grid-template-columns: 1fr; gap: 28px; }
  .hero h1 { font-size: 30px; }
  .landing-top { margin-bottom: 28px; }
}

/* ---------- retro shell ---------- */

.shell { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }

.topbar {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 20px; background: var(--surface);
  border-bottom: 1px solid var(--line); flex-wrap: wrap;
}
.brand { display: flex; border-radius: 9px; }
.title-wrap { min-width: 0; flex: 1 1 160px; display: flex; align-items: center; gap: 10px; }
.title-wrap h1 { font-size: 16px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: -.01em; }
.conn { font-size: 12px; color: var(--better); background: var(--better-soft); padding: 2px 9px; border-radius: 99px; white-space: nowrap; }
.top-actions { display: flex; align-items: center; gap: 8px; }

.seg { display: inline-flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button {
  display: inline-flex; align-items: center; gap: 8px;
  border: 0; background: transparent; padding: 5px 14px 5px 6px;
  border-radius: 8px; cursor: pointer; color: var(--muted); font-weight: 560;
  transition: background .15s, color .15s;
}
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.seg .step { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 6px; background: var(--surface-3); font-size: 11px; font-weight: 700; }
.seg button.on .step { background: var(--accent); color: var(--on-accent); }
.seg.readonly button { cursor: default; }
.seg:not(.readonly) button:not(.on):hover { color: var(--text); background: color-mix(in srgb, var(--surface) 50%, transparent); }

.people {
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 10px 0 5px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--surface); cursor: pointer;
}
.people:hover { background: var(--surface-2); }
.stack { display: inline-flex; }
.stack .avatar { margin-left: -7px; box-shadow: 0 0 0 2px var(--surface); }
.stack .avatar:first-child { margin-left: 0; }
.people-count { font-weight: 650; font-size: 13px; color: var(--muted); }

.avatar {
  display: inline-grid; place-items: center;
  width: 24px; height: 24px; border-radius: 50%;
  font-size: 10px; font-weight: 700; letter-spacing: .02em;
  background: hsl(var(--h) var(--av)); color: hsl(var(--h) var(--av-text));
  flex: none; user-select: none;
}

/* ---------- phase bar ---------- */

.phasebar { display: flex; align-items: center; gap: 12px 20px; justify-content: space-between; padding: 12px 20px 10px; flex-wrap: wrap; }
.phase { display: flex; align-items: center; gap: 10px; color: var(--muted); min-width: 0; flex: 1 1 320px; }
.phase-badge { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-weight: 650; font-size: 12px; white-space: nowrap; }
.phase-badge.collect { background: var(--good-soft); color: var(--good); }
.phase-badge.vote { background: var(--accent-soft); color: var(--accent); }
.phase-tools { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.votes { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.votes:empty { display: none; }
.dots { display: inline-flex; gap: 4px; }
.dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); transition: background .2s, box-shadow .2s; }
.dots i.used { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.sort { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.sort select { padding: 3px 8px; height: 30px; }

/* ---------- board ---------- */

.board {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px; padding: 2px 20px 20px;
}
.column {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--surface-2); border-radius: 16px; padding: 12px;
  border: 1.5px solid transparent;
  transition: border-color .15s, background .15s;
}
.column.drop { border-color: var(--c); background: var(--c-soft); }
.col-head { display: flex; align-items: center; gap: 10px; padding: 2px 4px; }
.col-icon { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; background: var(--c-soft); color: var(--c); }
.col-head h2 { font-size: 15px; margin: 0; flex: 1; letter-spacing: -.01em; }
.count { min-width: 26px; text-align: center; font-size: 12px; font-weight: 700; padding: 1px 8px; border-radius: 99px; background: var(--surface); color: var(--muted); }
.col-hint { margin: 6px 4px 10px; font-size: 12.5px; color: var(--muted); }

.add-card {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 9px 12px; margin-bottom: 10px;
  border: 1.5px dashed var(--line-strong); border-radius: 10px;
  background: transparent; color: var(--muted); cursor: pointer; font-weight: 560;
  transition: border-color .15s, color .15s, background .15s;
}
.add-card:hover { border-color: var(--c); color: var(--c); background: var(--surface); }

.composer {
  background: var(--surface); border-radius: 12px; padding: 10px; margin-bottom: 10px;
  box-shadow: var(--shadow); border: 1px solid var(--line); border-top: 3px solid var(--c);
  animation: enter .18s ease-out;
}
.composer textarea, .card textarea {
  display: block; width: 100%; border: 0; padding: 4px; resize: none;
  background: transparent; min-height: 66px; line-height: 1.5; box-shadow: none;
}
.composer textarea:focus, .card textarea:focus { box-shadow: none; }
.composer-actions { display: flex; align-items: center; gap: 6px; justify-content: flex-end; margin-top: 6px; flex-wrap: wrap; }
.kbd-hint { margin-right: auto; font-size: 11.5px; color: var(--faint); }

.cards { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 2px; margin: -2px; min-height: 48px; }

.card {
  position: relative; flex: none;
  background: var(--surface); border-radius: 12px;
  padding: 12px 12px 8px;
  border: 1px solid var(--line); border-left: 3px solid var(--c);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .15s, opacity .15s;
}
.card:hover { box-shadow: var(--shadow); }
.card[draggable="true"] { cursor: grab; }
.card[draggable="true"]:active { cursor: grabbing; }
.card.dragging { opacity: .4; }
.card.new { animation: enter .28s ease-out; }
.card.editing { box-shadow: var(--shadow); border-color: var(--accent); border-left-color: var(--c); }
@keyframes enter { from { opacity: 0; transform: translateY(-4px) scale(.985); } }

.card-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.card-foot { display: flex; align-items: center; gap: 6px; margin-top: 10px; min-height: 28px; }
.author { display: flex; align-items: center; gap: 7px; min-width: 0; flex: 1; font-size: 12.5px; color: var(--muted); }
.author .avatar { width: 22px; height: 22px; font-size: 9px; }
.author .name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.you { color: var(--faint); }
.card-tools { display: flex; gap: 1px; opacity: 0; transition: opacity .12s; }
.card:hover .card-tools, .card:focus-within .card-tools { opacity: 1; }
@media (hover: none) { .card-tools { opacity: 1; } }
body.is-dragging .card-tools { opacity: 0 !important; }

.vote { display: inline-flex; align-items: center; gap: 1px; border: 1px solid var(--line); border-radius: 99px; padding: 1px; background: var(--surface); transition: background .15s, border-color .15s; }
.vote.voted { border-color: color-mix(in srgb, var(--accent) 55%, transparent); background: var(--accent-soft); }
.vote-btn { display: grid; place-items: center; width: 24px; height: 24px; border: 0; border-radius: 50%; background: transparent; cursor: pointer; color: var(--muted); }
.vote-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
.vote.voted .vote-btn { color: var(--accent); }
.vote.voted .vote-btn:hover:not(:disabled) { background: var(--surface); }
.vote-btn:disabled { opacity: .3; cursor: not-allowed; }
.vote-btn svg { width: 13px; height: 13px; }
.vote-count { display: inline-flex; align-items: center; gap: 4px; min-width: 16px; justify-content: center; font-weight: 700; font-size: 13px; padding: 0 2px; font-variant-numeric: tabular-nums; }
.my-dots { display: inline-flex; gap: 2px; }
.my-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }

.reactions { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.reaction {
  display: inline-flex; align-items: center; gap: 5px;
  height: 26px; padding: 0 8px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--surface-2);
  cursor: pointer; font-size: 13px; line-height: 1;
  transition: transform .08s, background .15s, border-color .15s;
}
.reaction:hover { border-color: var(--line-strong); }
.reaction span { font-size: 12px; font-weight: 650; color: var(--muted); }
.reaction.mine { border-color: color-mix(in srgb, var(--accent) 55%, transparent); background: var(--accent-soft); }
.reaction.mine span { color: var(--accent); }
.reaction.add { color: var(--faint); background: transparent; border-style: dashed; padding: 0 6px; }
.reaction.add:hover { color: var(--text); }
.reaction:active { transform: scale(.92); }

.group { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 650; color: var(--muted); margin: 8px 2px 0; flex: none; }
.group:first-child { margin-top: 0; }
.group .avatar { width: 20px; height: 20px; font-size: 9px; }
.group-count { color: var(--faint); font-weight: 500; }

.empty { padding: 20px 12px; text-align: center; color: var(--faint); font-size: 13px; }

.hidden-stack {
  display: flex; align-items: center; gap: 14px; flex: none;
  padding: 10px 12px; border-radius: 12px;
  background: color-mix(in srgb, var(--surface) 60%, transparent);
  border: 1px dashed var(--line-strong);
  color: var(--muted); font-size: 12.5px;
}
.backs { position: relative; width: 36px; height: 28px; flex: none; }
.backs i {
  position: absolute; inset: 2px 7px; border-radius: 5px;
  background: repeating-linear-gradient(135deg, var(--c) 0 3px, var(--c-soft) 3px 7px);
  border: 1.5px solid var(--surface); box-shadow: var(--shadow-sm);
}
.backs i:nth-child(1) { transform: rotate(-14deg) translateX(-5px); }
.backs i:nth-child(3) { transform: rotate(14deg) translateX(5px); }

/* ---------- merged cards ---------- */

.card.merge-target { border-color: var(--accent); border-left-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow); }
.card.merge-target::after {
  content: attr(data-merge-label); position: absolute; top: -9px; right: 10px;
  font-size: 11px; font-weight: 650; padding: 1px 8px; border-radius: 99px;
  background: var(--accent); color: var(--on-accent); pointer-events: none;
}
.merged { margin-top: 8px; border-top: 1px dashed var(--line-strong); display: grid; }
.merged-item { position: relative; display: flex; gap: 8px; align-items: flex-start; padding: 7px 0 1px; }
.merged-item .avatar { width: 18px; height: 18px; font-size: 8px; margin-top: 1px; }
.merged-item .card-text { flex: 1; min-width: 0; font-size: 13px; color: var(--muted); }
.merged-item .icon-btn.sm { width: 22px; height: 22px; margin: -2px -4px 0 0; opacity: 0; transition: opacity .12s; }
.merged-item:hover .icon-btn.sm, .merged-item:focus-within .icon-btn.sm { opacity: 1; }
@media (hover: none) { .merged-item .icon-btn.sm { opacity: 1; } }
.menu-item .snippet { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- timer ---------- */

.timer:empty { display: none; }
.timer-pill {
  position: relative; overflow: hidden;
  display: inline-flex; align-items: center; gap: 7px;
  height: 34px; padding: 0 13px; border-radius: 99px;
  border: 1px solid color-mix(in srgb, var(--accent) 50%, transparent);
  background: var(--accent-soft); color: var(--accent);
  font-weight: 700; font-variant-numeric: tabular-nums; cursor: pointer;
}
.timer-pill.readonly { cursor: default; }
.timer-pill.warn { border-color: color-mix(in srgb, var(--better) 50%, transparent); background: var(--better-soft); color: var(--better); }
.timer-pill.expired { border-color: color-mix(in srgb, var(--danger) 50%, transparent); background: var(--danger-soft); color: var(--danger); animation: pulse 1.2s ease-in-out 3; }
.timer-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; }
.timer-bar span { display: block; height: 100%; background: currentColor; opacity: .45; transition: width .25s linear; }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--danger) 22%, transparent); } }
.board.flash .column { animation: flash 1.6s ease-out; }
@keyframes flash { 15% { border-color: var(--danger); } }

/* ---------- popover & menus ---------- */

.popover {
  position: fixed; z-index: 50;
  min-width: 220px; max-width: 320px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow-lg);
  padding: 6px; animation: fade .12s ease-out;
}
.popover.compact { min-width: 0; }
.popover.scroll { max-height: 60vh; overflow: auto; }
@keyframes fade { from { opacity: 0; transform: translateY(-3px); } }
.menu-label { padding: 6px 10px 4px; font-size: 12px; font-weight: 650; color: var(--faint); }
.menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 8px 10px; border: 0; border-radius: 8px;
  background: transparent; cursor: pointer; text-align: left;
}
.menu-item:hover { background: var(--surface-2); }
.menu-item.danger { color: var(--danger); }
.menu-item .meta { margin-left: auto; color: var(--faint); font-size: 12px; }
.menu-item svg { color: var(--muted); }
.menu-sep { height: 1px; background: var(--line); margin: 6px 4px; }
.menu-note { padding: 4px 10px 6px; margin: 0; color: var(--faint); font-size: 12px; }
.col-dot { width: 10px; height: 10px; border-radius: 3px; background: var(--c); flex: none; }

.emoji-grid { display: grid; grid-template-columns: repeat(4, 42px); gap: 2px; }
.emoji-grid button { height: 42px; border: 0; border-radius: 8px; background: transparent; font-size: 21px; cursor: pointer; transition: transform .1s, background .1s; }
.emoji-grid button:hover { background: var(--surface-2); transform: scale(1.12); }
.emoji-grid button.mine { background: var(--accent-soft); }
.emoji-grid .more { display: grid; place-items: center; color: var(--faint); }
.emoji-grid .more svg { width: 22px; height: 22px; stroke-width: 1.8; }
.emoji-grid .more:hover { color: var(--muted); }
.emoji-recent { grid-column: 1 / -1; height: 1px; background: var(--line); margin: 2px 4px; }

/* full emoji picker */
.popover.picker { width: 312px; max-width: calc(100vw - 16px); padding: 8px; }
.picker-search { width: 100%; height: 32px; padding: 4px 10px; margin-bottom: 6px; }
.picker-list { height: 272px; overflow-y: auto; margin: 0 -4px; padding: 0 4px; }
.picker-group { position: sticky; top: 0; z-index: 1; padding: 6px 4px 3px; font-size: 11.5px; font-weight: 650; color: var(--faint); background: var(--surface); }
.picker-grid { display: grid; grid-template-columns: repeat(8, 1fr); }
.picker-grid button { height: 34px; border: 0; border-radius: 7px; background: transparent; font-size: 20px; line-height: 1; cursor: pointer; padding: 0; }
.picker-grid button:hover, .picker-grid button.first { background: var(--surface-2); }
.picker-grid button.mine { background: var(--accent-soft); }
.picker-empty { padding: 28px 8px; text-align: center; color: var(--faint); font-size: 13px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 8px 8px; }
.chip { height: 30px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--line-strong); background: var(--surface); cursor: pointer; font-weight: 560; }
.chip:hover { border-color: var(--accent); color: var(--accent); }
.custom { display: flex; align-items: center; gap: 8px; padding: 2px 8px 8px; }
.custom input { width: 72px; height: 30px; padding: 3px 8px; }
.custom span { color: var(--muted); }
.custom .btn { margin-left: auto; }

.person { display: flex; align-items: center; gap: 10px; padding: 7px 10px; }
.person .who { flex: 1; min-width: 0; }
.person .who div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.person small { color: var(--faint); font-size: 12px; }
.online { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); flex: none; }
.online.on { background: var(--good); box-shadow: 0 0 0 3px var(--good-soft); }
.badge { font-size: 11px; font-weight: 650; padding: 1px 7px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; }

/* ---------- modal ---------- */

.modal-wrap { position: fixed; inset: 0; z-index: 60; background: rgb(10 10 14 / .45); display: grid; place-items: center; padding: 20px; animation: fade .12s; }
.modal { width: min(420px, 100%); background: var(--surface); border-radius: 16px; padding: 22px; box-shadow: var(--shadow-lg); border: 1px solid var(--line); }
.modal h3 { margin: 0 0 12px; font-size: 17px; }
.modal p { margin: 0; color: var(--muted); }
.modal .field input { width: 100%; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }

/* ---------- toasts ---------- */

#toasts {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  z-index: 70; display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none; width: min(480px, calc(100% - 32px));
}
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-radius: 12px;
  background: var(--text); color: var(--bg);
  box-shadow: var(--shadow-lg); font-weight: 520;
  animation: toast .22s ease-out;
  transition: opacity .2s, transform .2s;
}
.toast svg { width: 18px; height: 18px; }
.toast.error { background: var(--danger); color: #fff; }
.toast.alert { background: var(--danger); color: #fff; font-weight: 650; padding: 12px 18px; }
.toast.leave { opacity: 0; transform: translateY(6px); }
@keyframes toast { from { opacity: 0; transform: translateY(8px); } }

.loading { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 100vh; color: var(--muted); }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--line-strong); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(1turn); } }

/* ---------- small screens ---------- */

@media (max-width: 900px) {
  .topbar { padding: 10px 14px; gap: 10px; }
  .mode { order: 3; width: 100%; }
  .seg { width: 100%; }
  .seg button { flex: 1; justify-content: center; }
  .top-actions .btn .label { display: none; }
  .top-actions .btn { padding: 0 10px; }
  .phasebar { padding: 10px 14px; }
  .board { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; padding: 2px 14px 14px; }
  .column { flex: 0 0 min(86vw, 380px); scroll-snap-align: center; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
