/* ==========================================================================
   Red Penguin: the conversation pieces
   Messages, the composer, the plan, the live run and the finished list.
   The landing page demo and the real app both draw from this one file, so
   what the landing page shows is what the tool looks like.
   ========================================================================== */

/* --- messages -------------------------------------------------------------- */
.msg { display: flex; gap: 12px; margin: 0 0 22px; animation: rise-in .45s var(--ease) both; }
.msg-user { justify-content: flex-end; }
.msg-user .bubble {
  max-width: min(78%, 560px);
  padding: 11px 16px;
  background: var(--paper-3); color: var(--ink);
  border-radius: 20px 20px 6px 20px;
  font-size: 15px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg-avatar {
  flex: none; width: 32px; height: 32px; margin-top: 1px;
  display: grid; place-items: center;
  border-radius: 11px; background: var(--card); border: 1px solid var(--line);
  box-shadow: var(--shadow-1);
}
.msg-avatar .lurk { margin-top: 1px; }
.msg-body { min-width: 0; flex: 1; display: grid; gap: 12px; padding-top: 4px; }
.msg-body > p, .say { font-size: 15px; line-height: 1.6; color: var(--ink); overflow-wrap: anywhere; }
.say + .say { margin-top: -4px; }
.say-quiet { font-size: 13px; color: var(--ink-3); line-height: 1.5; }
.say-ask { color: var(--ink-2); }

.typing { display: inline-flex; gap: 5px; align-items: center; height: 24px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); animation: typing 1.2s var(--ease-soft) infinite; }
.typing i:nth-child(2) { animation-delay: .15s; }
.typing i:nth-child(3) { animation-delay: .3s; }
@keyframes typing { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-4px); opacity: 1; } }

.quick { display: flex; flex-wrap: wrap; gap: 8px; }

/* --- composer -------------------------------------------------------------- */
.composer {
  position: relative;
  background: var(--card); border: 1px solid var(--line-2);
  border-radius: 22px; box-shadow: var(--shadow-2);
  transition: border-color .2s var(--ease-soft), box-shadow .25s var(--ease-soft);
}
.composer:focus-within { border-color: var(--ink-3); box-shadow: var(--shadow-2), 0 0 0 4px rgba(var(--accent-rgb), .1); }
.composer textarea {
  display: block; width: 100%; min-height: 56px; max-height: 220px; resize: none;
  padding: 17px 20px 4px; border: 0; background: transparent; color: var(--ink);
  font-size: 16px; line-height: 1.5; outline: none;
}
.composer textarea::placeholder { color: var(--ink-3); }
.composer-bar { display: flex; align-items: center; gap: 8px; padding: 6px 10px 10px 14px; }
.composer-hint { margin-left: auto; font-size: 12px; color: var(--ink-3); display: inline-flex; align-items: center; gap: 6px; }
.composer-tool {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px;
  border-radius: 999px; color: var(--ink-3); font-size: 12.500px; font-weight: 500;
  transition: background-color .15s, color .15s;
}
.composer-tool:hover { background: var(--paper-2); color: var(--ink); }
.composer-tool svg { width: 14px; height: 14px; }
.send-btn {
  display: grid; place-items: center; flex: none;
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--ink); color: var(--on-ink);
  transition: transform .2s var(--spring), background-color .15s, opacity .15s;
}
.send-btn svg { width: 18px; height: 18px; }
.send-btn:hover { background: var(--accent); color: var(--on-accent); transform: translateY(-1px); }
.send-btn:active { transform: scale(.94); }
.send-btn[disabled] { opacity: .28; pointer-events: none; }

/* --- the plan -------------------------------------------------------------- */
.plan { overflow: hidden; border-radius: var(--r-xl); }
.plan-main { display: grid; grid-template-columns: auto 1fr; gap: 0; }
.plan-target {
  display: grid; align-content: center; justify-items: start; gap: 2px;
  padding: 22px 26px 22px 24px; min-width: 150px;
  border-right: 1px dashed var(--line-2);
}
.plan-eyebrow { font-size: 11.500px; font-weight: 500; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.plan-num { font-size: 64px; line-height: .95; letter-spacing: -.03em; color: var(--ink); }
.plan-unit { font-size: 13.500px; color: var(--ink-2); font-weight: 500; }
.plan-facts { display: grid; gap: 0; padding: 8px 0; min-width: 0; }
.fact { display: grid; grid-template-columns: 92px 1fr; gap: 12px; align-items: start; padding: 10px 22px; }
.fact + .fact { border-top: 1px solid var(--line); }
.fact dt { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-3); padding-top: 1px; }
.fact dt svg { width: 15px; height: 15px; }
.fact dd { font-size: 14px; color: var(--ink); min-width: 0; line-height: 1.5; }
.fact dd .faint { font-size: 13px; }
.fact-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 2px; }
.sub-chip {
  display: inline-flex; align-items: center; height: 24px; padding: 0 9px;
  border-radius: 999px; background: var(--paper-2); color: var(--ink-2);
  font-family: var(--font-mono); font-size: 12px; white-space: nowrap;
}
.phrase-chip {
  display: inline-flex; align-items: center; height: 24px; padding: 0 8px;
  border-radius: 7px; background: var(--paper-2); color: var(--ink-2);
  font-family: var(--font-mono); font-size: 11.500px; white-space: nowrap;
}
.linklike { color: var(--ink-2); font-size: 13px; text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.linklike:hover { color: var(--ink); text-decoration-color: var(--accent); }
.plan-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  padding: 12px 14px 12px 22px; background: var(--paper-2); border-top: 1px solid var(--line);
}
.plan-cost { font-size: 13px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.plan-cost b { font-weight: 500; color: var(--ink); }
.plan-cost .sep { color: var(--line-2); }
.plan-actions { display: flex; align-items: center; gap: 14px; margin-left: auto; }
.plan-actions .switch { font-size: 13px; color: var(--ink-2); }
.plan.is-stale { opacity: .62; }
.plan.is-stale .plan-foot { display: none; }
.plan.is-started .plan-actions { display: none; }

.btn-run { --h: 40px; padding: 0 18px 0 14px; border-radius: 999px; }
.btn-run svg { width: 15px; height: 15px; }
.btn-run.is-nudged { animation: nudge 1.8s var(--ease-soft) infinite; }
@keyframes nudge {
  0%, 100% { box-shadow: 0 0 0 0 rgba(var(--accent-rgb), .45); }
  50% { box-shadow: 0 0 0 9px rgba(var(--accent-rgb), 0); }
}

/* --- the live run ---------------------------------------------------------- */
.run { border-radius: var(--r-xl); overflow: hidden; }
.run-head { display: flex; align-items: center; gap: 12px; padding: 16px 16px 12px 20px; }
.run-title { display: flex; align-items: center; gap: 10px; font-size: 14.500px; font-weight: 500; min-width: 0; }
.run-title .lurk { flex: none; margin-top: -2px; }
.run-phase { color: var(--ink-3); font-weight: 400; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.run-head .btn { margin-left: auto; flex: none; }
.run-bar { height: 3px; background: var(--paper-3); position: relative; overflow: hidden; }
.run-bar-fill {
  position: absolute; inset: 0 auto 0 0; width: 0;
  background: var(--accent); border-radius: 0 3px 3px 0;
  transition: width .9s var(--ease-soft);
}
.run[data-state="running"] .run-bar-fill::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .55), transparent);
  background-size: 50% 100%; background-repeat: no-repeat;
  animation: sweep 1.6s var(--ease-soft) infinite;
}
@keyframes sweep { from { background-position: -60% 0; } to { background-position: 180% 0; } }
.run-stats { display: grid; grid-template-columns: repeat(3, 1fr); }
.stat { padding: 16px 20px 14px; display: grid; gap: 2px; }
.stat + .stat { border-left: 1px solid var(--line); }
.stat b { font-family: var(--font-mono); font-size: 24px; font-weight: 500; letter-spacing: -.03em; line-height: 1.1; font-feature-settings: "zero", "tnum"; }
.stat b .of { color: var(--ink-3); font-size: 15px; }
.stat > span { font-size: 12.500px; color: var(--ink-3); }
.stat-hero b { color: var(--accent-ink); }
.run-feed { border-top: 1px solid var(--line); min-height: 0; }
.run-feed:empty { display: none; }
.run-note {
  display: flex; align-items: flex-start; gap: 9px; padding: 10px 20px;
  border-top: 1px solid var(--line); background: var(--paper-2);
  font-size: 12.500px; color: var(--ink-2); line-height: 1.5;
}
.run-note svg { width: 14px; height: 14px; flex: none; margin-top: 2px; color: var(--ink-3); }
.run-note:empty { display: none; }

/* --- lead rows ------------------------------------------------------------- */
.lead-row {
  display: grid; grid-template-columns: 22px minmax(0, 1.5fr) minmax(0, 1fr); align-items: center; gap: 12px;
  padding: 9px 20px; font-size: 13.500px;
}
.lead-row + .lead-row { border-top: 1px solid var(--line); }
.lead-row.is-new { animation: lead-in .55s var(--ease) both; }
@keyframes lead-in { from { opacity: 0; transform: translateY(-8px); background: var(--accent-wash); } to { opacity: 1; transform: none; background: transparent; } }
.lead-email { font-family: var(--font-mono); font-size: 13px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: -.01em; }
.lead-meta { color: var(--ink-3); font-size: 12.500px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: right; }

/* --- the finished list ------------------------------------------------------ */
.result { border-radius: var(--r-xl); overflow: hidden; }
.result-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; padding: 22px 24px 16px; flex-wrap: wrap; }
.result-count { display: flex; align-items: baseline; gap: 12px; }
.result-num { font-size: 68px; line-height: .9; letter-spacing: -.03em; }
.result-label { font-size: 15px; color: var(--ink-2); font-weight: 500; }
.result-label small { display: block; font-size: 12.500px; color: var(--ink-3); font-weight: 400; margin-top: 2px; }
.gradebar { display: grid; gap: 8px; min-width: 210px; flex: 1; max-width: 300px; }
.gradebar-track { display: flex; height: 8px; border-radius: 999px; overflow: hidden; background: var(--paper-3); gap: 2px; }
.gradebar-seg { height: 100%; min-width: 4px; border-radius: 2px; transition: flex-grow .8s var(--ease); }
.gradebar-seg[data-g="A"] { background: var(--g-a); }
.gradebar-seg[data-g="B"] { background: var(--g-b); }
.gradebar-seg[data-g="C"] { background: var(--g-c); }
.gradebar-seg[data-g="D"] { background: var(--g-d); }
.gradebar-seg[data-g="E"], .gradebar-seg[data-g="F"] { background: var(--g-e); }
.gradebar-key { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--ink-3); }
.gradebar-key span { display: inline-flex; align-items: center; gap: 5px; }
.gradebar-key i { width: 8px; height: 8px; border-radius: 3px; display: inline-block; }
.result-story { padding: 0 24px 16px; font-size: 13.500px; color: var(--ink-2); line-height: 1.55; }
.result-list { border-top: 1px solid var(--line); }
.result-more { padding: 10px 20px; border-top: 1px solid var(--line); font-size: 13px; color: var(--ink-3); }
.result-actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  padding: 12px 14px; background: var(--paper-2); border-top: 1px solid var(--line);
}
.result-actions .spacer { flex: 1; }
.result.is-empty .result-num { color: var(--ink-3); }
.sheet-link { display: inline-flex; align-items: center; gap: 7px; }

/* narrow screens */
@media (max-width: 620px) {
  .plan-main { grid-template-columns: 1fr; }
  .plan-target { border-right: 0; border-bottom: 1px dashed var(--line-2); padding: 18px 20px 16px; grid-auto-flow: column; justify-content: start; align-items: baseline; gap: 10px; }
  .plan-target .plan-eyebrow { display: none; }
  .plan-num { font-size: 48px; }
  .fact { grid-template-columns: 78px 1fr; padding: 10px 20px; }
  .stat { padding: 14px 14px 12px; }
  .stat b { font-size: 20px; }
  .lead-row { grid-template-columns: 22px 1fr; padding: 9px 14px; }
  .lead-row .lead-meta { display: none; }
  .result-num { font-size: 54px; }
  .msg-user .bubble { max-width: 88%; }
}
