:root {
  --bg: #0e0f0b;
  --rail: #16180f;
  --board: #10120c;
  --card: #1c1f16;
  --inset: #0c0d0a;
  --line: rgba(243, 240, 230, 0.1);
  --line-strong: rgba(243, 240, 230, 0.18);
  --text: #f4f1e8;
  --muted: #b7b2a4;
  --accent: #dff25a;
  --accent-ink: #17180f;
  --accent-2: #8ee0c8;
  --pain: #ff8d86;
  --question: #9ec4ff;
  --objection: #ffc56b;
  --praise: #8ee0c8;
  --request: #ddb6ff;
  --other: #c4bfb2;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --sans: system-ui, "Segoe UI", sans-serif;
  --serif: "Iowan Old Style", Palatino, "Palatino Linotype", Georgia, "Liberation Serif", serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
  font: 100%/1.5 var(--sans);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
html {
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}
body {
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
::selection { background: rgba(223, 242, 90, 0.28); color: var(--text); }
button, textarea, input { font: inherit; color: inherit; }
button, .chip, .type-pill {
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.skip {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 8;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 650;
  text-decoration: none;
  transform: translateY(-160%);
}
.skip:focus { transform: translateY(0); }
.app { min-height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr); }
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  border-top: 3px solid var(--accent);
  background: rgba(14, 15, 11, 0.92);
  position: sticky;
  top: 0;
  z-index: 4;
  backdrop-filter: blur(16px) saturate(140%);
}
.topbar::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 2px;
  background: var(--accent);
  transform: scaleX(0);
  transform-origin: left center;
  pointer-events: none;
}
.is-loading .topbar::after { animation: loadbar 640ms linear infinite; }
@keyframes loadbar {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}
.brand { display: flex; gap: 12px; align-items: center; min-width: 0; }
.mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  display: grid;
  place-items: center;
  flex: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45);
}
.brand h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.05;
}
.brand p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  letter-spacing: 0.01em;
}
.count { margin-left: auto; }
.top-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; justify-content: flex-end; }
.count {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--text);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 6px 11px;
  background: rgba(255, 255, 255, 0.03);
  white-space: nowrap;
}
.btn {
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.03);
  padding: 0 16px;
  border-radius: 999px;
  font-size: 13.5px;
  letter-spacing: -0.011em;
  min-height: 40px;
  transition: transform 160ms var(--ease-out), background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; cursor: progress; }
.btn:disabled:active { transform: none; }
.btn.primary {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
  font-weight: 650;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), 0 8px 22px rgba(223, 242, 90, 0.14);
}
.btn.primary:focus-visible { outline-color: #fff; }
.btn.ghost { background: transparent; }
.layout {
  display: grid;
  grid-template-columns: minmax(340px, 420px) minmax(0, 1fr) minmax(300px, 360px);
  min-height: 0;
}
.pane { min-width: 0; min-height: 0; overflow: auto; overscroll-behavior: contain; }
.pane.intake, .pane.right { background: var(--rail); }
.pane.board { background: var(--board); }
.pane.intake { border-right: 1px solid var(--line); }
.pane.right { border-left: 1px solid var(--line); }
.pane-inner { padding: 22px 22px 28px; }
.pane h2 {
  margin: 0 0 16px;
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.section-gap {
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}
#themes { max-height: 34vh; overflow: auto; overscroll-behavior: contain; }
.pane.right .row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.pane.right .row .btn.primary { grid-column: 1 / -1; }
textarea, .field input, .search {
  width: 100%;
  background: var(--inset);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  font-size: 16px;
}
textarea { min-height: 168px; padding: 12px 14px; resize: vertical; line-height: 1.5; }
.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 6px;
}
.field input { padding: 0 12px; min-height: 44px; border-radius: 12px; }
.field input:focus-visible, textarea:focus-visible, .search:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(223, 242, 90, 0.18);
}
::placeholder { color: #9c978a; opacity: 1; }
.row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }
.row .btn { min-height: 44px; }
.row .btn.primary { min-width: 7.5rem; }
.hint { color: var(--muted); font-size: 13px; margin: 14px 0 0; line-height: 1.5; max-width: 42ch; }
.status {
  min-height: 0;
  margin: 12px 0 0;
  color: var(--accent-2);
  font-size: 13px;
  line-height: 1.4;
}
.status:empty { display: none; }
.status:not(:empty) {
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(142, 224, 200, 0.1);
  box-shadow: inset 0 0 0 1px rgba(142, 224, 200, 0.2);
}
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; align-items: center; }
.chip {
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--muted);
  border-radius: 999px;
  padding: 0 12px;
  font-size: 13px;
  min-height: 36px;
  font-variant-numeric: tabular-nums;
  transition: transform 160ms var(--ease-out), background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}
.chip:active, .type-pill:active { transform: scale(0.97); }
.chip.active {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
  font-weight: 650;
}
.search {
  flex: 1 0 100%;
  width: 100%;
  border-radius: 999px;
  padding: 0 14px;
  min-height: 40px;
}
.cards { display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.card {
  background: var(--card);
  border-radius: 16px;
  padding: 14px 16px 12px;
  box-shadow: 0 0 0 1px rgba(243, 240, 230, 0.07), 0 14px 34px rgba(0, 0, 0, 0.24);
}
.card.is-entering { animation: card-in 220ms var(--ease-out) both; }
@keyframes card-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}
.card .meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  letter-spacing: 0.01em;
  color: var(--muted);
  margin-bottom: 8px;
  font-variant-numeric: tabular-nums;
}
.card .text {
  margin: 0;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.45;
  letter-spacing: -0.015em;
  overflow-wrap: anywhere;
}
.type-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }
.type-pill {
  font-size: 11px;
  border-radius: 999px;
  padding: 0 9px;
  min-height: 30px;
  border: 1px solid var(--line-strong);
  background: transparent;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: transform 160ms var(--ease-out), background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}
.type-pill.on.pain { background: #3a1c1a; color: var(--pain); border-color: #6a3330; }
.type-pill.on.question { background: #16243a; color: var(--question); border-color: #2a466c; }
.type-pill.on.objection { background: #3a2a12; color: var(--objection); border-color: #5c431c; }
.type-pill.on.praise { background: #14332c; color: var(--praise); border-color: #21594c; }
.type-pill.on.request { background: #2e1c3c; color: var(--request); border-color: #4a3260; }
.type-pill.on.other { background: #2a2924; color: var(--other); border-color: #4a463c; }
.intensity { font-family: var(--mono); color: var(--accent); white-space: nowrap; font-variant-numeric: tabular-nums; }
.theme-item { padding: 11px 0; border-bottom: 1px solid var(--line); }
.theme-item h3 { margin: 0 0 4px; font-size: 15px; font-weight: 600; letter-spacing: -0.015em; line-height: 1.3; overflow-wrap: anywhere; }
.theme-item p { margin: 0; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.bar { height: 5px; background: rgba(255, 255, 255, 0.06); border-radius: 99px; margin-top: 8px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent-2), var(--accent)); border-radius: inherit; }
.brief {
  background: var(--inset);
  border: 0;
  border-radius: 14px;
  padding: 14px;
  white-space: pre-wrap;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.6;
  min-height: 128px;
  max-height: 42vh;
  overflow: auto;
  overflow-wrap: anywhere;
  margin: 12px 0 0;
  box-shadow: inset 0 0 0 1px var(--line-strong);
  color: var(--text);
}
.brief.is-placeholder { color: var(--muted); min-height: 96px; }
.brief.is-entering { animation: brief-in 200ms var(--ease-out); }
@keyframes brief-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.empty {
  width: min(440px, 100%);
  margin: 8vh auto;
  color: var(--muted);
  padding: 36px 28px 32px;
  text-align: center;
  border-radius: 20px;
  background:
    radial-gradient(140px 80px at 50% 0%, rgba(223, 242, 90, 0.1), transparent 70%),
    rgba(255, 255, 255, 0.025);
  box-shadow: inset 0 0 0 1px var(--line-strong);
}
.empty-mark {
  width: 48px;
  height: 48px;
  margin: 0 auto 14px;
  background: url("favicon.svg") center / contain no-repeat;
}
.empty p { margin: 0 auto; color: var(--text); font-family: var(--serif); font-size: 22px; letter-spacing: -0.02em; line-height: 1.2; text-wrap: balance; }
.empty p + p {
  margin-top: 10px;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 14px;
  letter-spacing: 0;
  line-height: 1.5;
  max-width: 36ch;
}
.empty-note { margin: 0; }
@media (min-width: 1101px) {
  .app { height: 100dvh; }
  .pane.intake .pane-inner,
  .pane.board .pane-inner,
  .pane.right .pane-inner {
    min-height: 100%;
    display: flex;
    flex-direction: column;
  }
  .pane.intake .field-grow { flex: 1; display: flex; flex-direction: column; min-height: 0; }
  .pane.intake .field-grow textarea { flex: 1; min-height: 160px; }
  .pane.board .cards { flex: 1; }
  .pane.board .cards > .empty { margin-top: auto; margin-bottom: auto; }
}
@media (max-width: 1100px) {
  .layout { grid-template-columns: 1fr; }
  .pane.intake, .pane.right { border: 0; border-bottom: 1px solid var(--line); }
  #themes { max-height: none; }
  .brief { max-height: 42vh; }
}
@media (max-width: 720px) {
  .topbar {
    display: block;
    padding: calc(12px + env(safe-area-inset-top, 0px)) 16px 12px;
  }
  .count {
    position: absolute;
    top: calc(14px + env(safe-area-inset-top, 0px));
    right: 16px;
    margin-left: 0;
  }
  .brand { width: 100%; }
  .brand h1 { padding-right: 108px; }
  .brand p { text-wrap: balance; }
  .top-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
  .top-actions .btn { width: 100%; min-height: 44px; text-align: center; }
  .top-actions #clear { grid-column: 1 / -1; }
  .pane-inner { padding: 18px 16px calc(24px + env(safe-area-inset-bottom, 0px)); }
  .brand h1 { font-size: 26px; }
  textarea { min-height: 148px; }
  .chip, .search { min-height: 44px; }
  .row .btn { flex: 1; }
  .empty { margin: 28px auto; padding: 28px 18px; }
  .empty p { font-size: 20px; }
}
@media (hover: hover) and (pointer: fine) {
  .btn:hover { background: rgba(255, 255, 255, 0.06); border-color: rgba(243, 240, 230, 0.28); }
  .btn.primary:hover { background: var(--accent); border-color: transparent; }
  .btn.ghost:hover { background: rgba(255, 255, 255, 0.04); }
  .btn.danger:hover { color: var(--pain); border-color: rgba(255, 141, 134, 0.45); }
  .chip:hover { border-color: rgba(243, 240, 230, 0.3); color: var(--text); }
  .chip.active:hover { color: var(--accent-ink); }
  .type-pill:hover { border-color: rgba(243, 240, 230, 0.32); color: var(--text); }
  .card:hover { box-shadow: 0 0 0 1px rgba(243, 240, 230, 0.14), 0 16px 36px rgba(0, 0, 0, 0.28); }
}
@media (prefers-reduced-motion: reduce) {
  .skip { transform: none; clip-path: inset(100%); }
  .skip:focus { clip-path: none; }
  .btn, .chip, .type-pill { transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease; }
  .btn:active, .chip:active, .type-pill:active { transform: none; }
  .is-loading .topbar::after { animation: none; transform: scaleX(0.4); }
  .card.is-entering { animation: fade-in 180ms ease both; }
  .brief.is-entering { animation: fade-in 180ms ease; }
}
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
@media (prefers-reduced-transparency: reduce) {
  .topbar { background: var(--bg); backdrop-filter: none; }
}
@media (prefers-contrast: more) {
  :root { --line: rgba(243, 240, 230, 0.45); --line-strong: rgba(243, 240, 230, 0.7); --muted: #ddd8cc; }
  .card, .brief, .empty { box-shadow: inset 0 0 0 1px var(--line-strong); }
}
