:root {
  --paper: #f3ecdf;
  --card: #fbf7f0;
  --ink: #1c1915;
  --muted: #5e584e;
  --line: #e0d5c4;
  --action: #c2410c;
  --action-ink: #fff8f3;
  --good: #1d6b45;
  --shadow: 0 16px 40px rgba(48, 32, 14, 0.08);
  font-family: Outfit, "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(1200px 500px at 10% -10%, #fff 0%, transparent 50%),
    var(--paper);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
}

button, input, select, textarea { font: inherit; color: inherit; }

button { cursor: pointer; }

#app {
  max-width: 920px;
  margin: 0 auto;
  padding: 28px 20px 64px;
}

.top {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 16px;
}

.top-row {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
}

.mark {
  width: 42px;
  height: 42px;
  flex: none;
}

h1 {
  font-family: Fraunces, Georgia, serif;
  font-size: 32px;
  line-height: 1;
  margin: 0;
  font-weight: 650;
}

.sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.quiet {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  justify-content: flex-end;
}

.quiet button, .text-btn {
  background: transparent;
  border: 0;
  color: var(--muted);
  padding: 6px 2px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.fields {
  display: grid;
  grid-template-columns: 1.3fr repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
}

input, select, textarea {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  font-weight: 500;
  color: var(--ink);
}

select.gap, input.gap { border-color: var(--action); }

input:focus, select:focus, textarea:focus {
  outline: 2px solid #e8a07a;
  border-color: var(--action);
}

.coach {
  position: sticky;
  top: 0;
  z-index: 3;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}

.buddy {
  width: 96px;
  height: 108px;
  flex: none;
  display: grid;
  place-items: end center;
  border-radius: 28px;
  background:
    radial-gradient(circle at 50% 38%, #fff8ee 0%, #f6e4cc 72%, transparent 73%);
}

.coach-figure {
  width: 96px;
  height: 108px;
  overflow: visible;
}

.ground { fill: #1c1915; opacity: 0.12; }
.dots { opacity: 0; }
.mouth-soft, .mouth-o { opacity: 0; }
.mouth-smile { opacity: 1; }

.arm-wave, .arm-point, .head, .coach-body, .eye, .dot {
  transform-box: fill-box;
  transform-origin: center;
}

@media (prefers-reduced-motion: no-preference) {
  .coach-body { animation: bob 2.8s ease-in-out infinite; }
  .eye { animation: blink 5s infinite; }

  .buddy-hello .arm-wave { animation: wave 1.15s ease-in-out infinite; }
  .buddy-hello .coach-body { animation: bob 2.8s ease-in-out infinite; }

  .buddy-point .arm-point { animation: point 1.3s ease-in-out infinite; }
  .buddy-nudge .head { animation: tilt 2.4s ease-in-out infinite; }
  .buddy-nudge .brow-right { transform: translateY(-2px); }

  .buddy-cheer .coach-body { animation: hop 0.7s ease-in-out infinite; }
  .buddy-cheer .arm-wave,
  .buddy-cheer .arm-point { animation: raise 0.7s ease-in-out infinite; }

  .buddy-think .dots { animation: pop 1.4s ease-in-out infinite; }
  .buddy-think .head { animation: tilt 2.2s ease-in-out infinite; }
  .buddy-think .arm-wave { animation: chin 2.2s ease-in-out infinite; }
}

.buddy-think .mouth-smile,
.buddy-nudge .mouth-smile { opacity: 0; }
.buddy-think .mouth-soft,
.buddy-nudge .mouth-soft { opacity: 1; }
.buddy-cheer .mouth-smile { opacity: 0; }
.buddy-cheer .mouth-o { opacity: 1; }
.buddy-think .dots { opacity: 1; }

@keyframes bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-4px); }
}

@keyframes blink {
  0%, 46%, 52%, 100% { transform: scaleY(1); }
  49% { transform: scaleY(0.12); }
}

@keyframes wave {
  0%, 100% { transform: rotate(16deg); }
  50% { transform: rotate(-32deg); }
}

@keyframes point {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(4px); }
}

@keyframes hop {
  0%, 100% { transform: translateY(0) scale(1, 1); }
  40% { transform: translateY(-8px) scale(0.98, 1.04); }
  70% { transform: translateY(0) scale(1.04, 0.96); }
}

@keyframes raise {
  0%, 100% { transform: rotate(8deg); }
  40% { transform: rotate(-18deg); }
}

@keyframes tilt {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-7deg); }
}

@keyframes chin {
  0%, 100% { transform: rotate(8deg); }
  50% { transform: rotate(22deg); }
}

@keyframes pop {
  0%, 100% { opacity: 0.35; transform: translateY(2px); }
  50% { opacity: 1; transform: translateY(-2px); }
}

.kicker {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--action);
}

.coach-line {
  margin: 2px 0 0;
  font-family: Fraunces, Georgia, serif;
  font-size: 20px;
  line-height: 1.25;
  font-weight: 560;
}

.cta, .primary, .small-primary {
  background: var(--action);
  color: var(--action-ink);
  border: 0;
  border-radius: 999px;
  padding: 12px 16px;
  font-weight: 600;
  white-space: nowrap;
}

.cta:disabled { opacity: 0.55; cursor: default; }

.funnel { display: flex; flex-direction: column; gap: 8px; }

.block { display: flex; flex-direction: column; align-items: center; gap: 8px; }

.slice {
  width: calc(100% - (var(--i) * 4.6%));
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  gap: 10px;
  align-items: center;
  text-align: left;
  color: #f7f3ea;
  border: 0;
  border-radius: 14px;
  padding: 12px 14px;
  background: var(--tone);
}

.slice.on { outline: 3px solid var(--ink); outline-offset: 2px; }

.idx {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.14);
  font-size: 13px;
  font-weight: 600;
}

.slice-label { font-weight: 600; font-size: 16px; }

.slice-hint {
  display: block;
  font-weight: 400;
  font-size: 12px;
  opacity: 0.8;
}

.count {
  min-width: 28px;
  text-align: center;
  font-family: Fraunces, Georgia, serif;
  font-size: 22px;
}

.next-tag {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: #f7f3ea;
  color: var(--ink);
  border-radius: 999px;
  padding: 4px 8px;
}

.drawer {
  width: 100%;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
}

.drawer h2 {
  font-family: Fraunces, Georgia, serif;
  font-size: 28px;
  margin: 0 0 4px;
}

.here {
  display: inline-block;
  margin-bottom: 8px;
  color: var(--good);
  font-size: 13px;
  font-weight: 700;
}

.do { margin: 8px 0 0; padding-left: 18px; }
.do li { margin: 4px 0; }

.asset {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.asset-head, .people-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

h3 { margin: 0; font-size: 14px; letter-spacing: 0.03em; text-transform: uppercase; color: var(--muted); }

pre {
  margin: 0;
  white-space: pre-wrap;
  background: #1c1915;
  color: #f6f1e6;
  border-radius: 12px;
  padding: 14px;
  font-family: Outfit, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

.copy, .small-primary, .ghost {
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 600;
}

.copy, .ghost {
  background: transparent;
  border: 1px solid var(--line);
}

.grid-2, .grid-4 {
  display: grid;
  gap: 8px;
}

.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

textarea { min-height: 88px; resize: vertical; }

.math {
  background: #efe6d4;
  border-radius: 12px;
  padding: 12px 14px;
}

.math strong { font-family: Fraunces, Georgia, serif; font-size: 22px; }

.level-1 { color: var(--action); }
.level-2 { color: #8a5a12; }
.level-3 { color: var(--good); }

.people { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }

.add-form, .deal-actions { display: flex; flex-wrap: wrap; gap: 8px; }

.add-form input { flex: 1 1 140px; }

.deal {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  align-items: center;
}

.deal p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }

.who { font-weight: 600; }

.cash { max-width: 160px; }

.empty { color: var(--muted); margin: 0; }

.toast {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: #f7f3ea;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 14px;
  z-index: 5;
}

.project-bar, .teach, .coach-actions, .deal-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }

.project-bar { width: 100%; }
.project-bar input { flex: 1 1 220px; min-width: 0; }

.project-notes {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
}

.project-notes textarea {
  min-height: 120px;
  line-height: 1.45;
  font-weight: 500;
}
.teach input { min-width: 180px; }

.teach { margin: -6px 0 16px; }
.teach input { flex: 1; }

.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px;
  margin-bottom: 14px;
}

.mem-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.entry {
  margin: 0;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  white-space: pre-wrap;
  font-size: 14px;
}

@media (max-width: 800px) {
  .mem-cols { grid-template-columns: 1fr; }
}

@media (max-width: 800px) {
  .fields, .grid-4, .grid-2, .project-notes { grid-template-columns: 1fr; }
  .coach { grid-template-columns: auto 1fr; }
  .cta { grid-column: 1 / -1; }
  .coach-line { font-size: 18px; }
  .slice { width: calc(100% - (var(--i) * 1.5%)); }
  .deal { grid-template-columns: 1fr; }
}
