/* ────────────────────────────────────────────────────────────
   PULSE — board v3.4 — product-card layout
   Circular avatar at top · centered name · action buttons at bottom
   ────────────────────────────────────────────────────────── */

.b3 {
  flex: 1;
  max-width: 1440px; margin: 0 auto; width: 100%;
  padding: 40px 48px 80px;
  display: flex; flex-direction: column;
}
.b3-head {
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 28px; flex-wrap: wrap;
  margin-bottom: 36px;
}
.b3-h {
  font-family: var(--font-ui);
  font-weight: 700;
  font-size: clamp(36px, 4.4vw, 56px);
  line-height: 1.0;
  letter-spacing: -0.035em;
}
.b3-filters { display: flex; gap: 6px; flex-wrap: wrap; }

.b3-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
  align-items: stretch;
}

/* ── card base ──────────────────────────────────────────── */
.c4 {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  padding: 24px 22px 22px;
  display: flex; flex-direction: column;
  align-items: center;
  text-align: center;
  height: 380px;
  transition: transform 0.22s var(--ease), border-color 0.18s, box-shadow 0.18s;
  overflow: hidden;
}

/* char-card variant — clean product layout */
.c4.c4-char {
  padding: 0;
  text-align: left;
  align-items: stretch;
  gap: 0;
}
.c4-portrait {
  position: relative;
  flex: 1;
  background: var(--surface-2);
  overflow: hidden;
  min-height: 0;
}
.c4-portrait img,
.c4-portrait .avatar-live,
.c4-portrait video {
  width: 100% !important; height: 100% !important;
  object-fit: cover; display: block;
  border-radius: 0 !important;
}
.c4-text {
  padding: 12px 16px 4px;
  display: flex; flex-direction: column;
  gap: 4px;
  flex-shrink: 0;
}
.c4-char-name {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -0.018em;
  color: var(--ink);
  line-height: 1.05;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.c4-char-line {
  display: flex; gap: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.c4-char-line .dot { opacity: 0.5; }
.c4-char-line .ink-pulse { color: var(--pulse-hi); }
.c4-char-line .muted { color: var(--ink-4); }

.c4-char-row {
  padding: 12px 16px 14px;
  display: flex; gap: 6px;
  flex-shrink: 0;
}
.c4-char-row .c4-btn { flex: 1; justify-content: center; padding: 8px 12px; font-size: 12.5px; }
.c4-rename-tight { width: 100%; padding: 2px 6px; font-size: 17px; text-align: left; }

.c4-poster-rings {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
  z-index: 3;
}
.c4-poster-rings span {
  position: absolute;
  width: 90px; height: 90px;
  border-radius: 999px;
  border: 1px solid oklch(from var(--pulse) l c h / 0.45);
  animation: c4-ring 2.8s var(--ease) infinite;
}
.c4-poster-rings span:nth-child(2) { animation-delay: 0.93s; }
.c4-poster-rings span:nth-child(3) { animation-delay: 1.86s; }
.c4:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  box-shadow: var(--shadow-md);
}
.c4.is-draft { opacity: 0.95; }
.c4.is-pregen {
  border-color: oklch(from var(--pulse) l c h / 0.4);
  box-shadow: 0 0 0 1px oklch(from var(--pulse) l c h / 0.16);
}

/* avatar wrapper */
.c4-av-wrap {
  position: relative;
  width: 140px; height: 140px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 16px;
}
.c4-av {
  width: 140px; height: 140px;
  border-radius: 999px;
  overflow: hidden;
  background: var(--surface-2);
  position: relative;
  z-index: 2;
  border: 2px solid var(--panel);
  box-shadow: 0 0 0 1px var(--line), 0 14px 32px -8px oklch(0 0 0 / 0.55);
}
.c4-av img,
.c4-av .avatar-live,
.c4-av video {
  width: 100% !important; height: 100% !important;
  object-fit: cover; display: block;
  border-radius: 0 !important;
}

/* pulse rings (pre-gen, create-card idle, generating) */
.c4-rings {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
  z-index: 1;
}
.c4-rings span {
  position: absolute;
  width: 140px; height: 140px;
  border-radius: 999px;
  border: 1px solid oklch(from var(--pulse) l c h / 0.40);
  animation: c4-ring 3.0s var(--ease) infinite;
}
.c4-rings span:nth-child(2) { animation-delay: 1.0s; }
.c4-rings span:nth-child(3) { animation-delay: 2.0s; }
.c4-rings span:nth-child(4) { animation-delay: 0.5s; }
@keyframes c4-ring {
  from { transform: scale(0.7); opacity: 1; }
  to   { transform: scale(2.0); opacity: 0; }
}

.c4-live {
  position: absolute;
  top: -4px; right: -8px;
  z-index: 4;
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 8px 3px 6px;
  background: oklch(0 0 0 / 0.7);
  border: 1px solid oklch(1 0 0 / 0.10);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--pulse-hi);
  backdrop-filter: blur(8px);
}
.c4-live .pulse-dot { width: 5px; height: 5px; }

/* hover action buttons — top right */
.c4-actions {
  position: absolute; top: 14px; right: 14px;
  z-index: 6;
  display: flex; gap: 4px;
  animation: c4-actions-in 0.16s var(--ease-out);
}
@keyframes c4-actions-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}
.c4-act {
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  background: oklch(0 0 0 / 0.55);
  border: 1px solid oklch(1 0 0 / 0.12);
  backdrop-filter: blur(8px);
  border-radius: 999px;
  color: var(--ink);
  transition: all 0.15s;
}
.c4-act:hover { background: oklch(0 0 0 / 0.85); transform: scale(1.08); }
.c4-act-danger:hover { color: oklch(0.78 0.2 28); border-color: oklch(0.78 0.2 28 / 0.4); }
.c4-act-variant:hover { color: var(--pulse); border-color: oklch(from var(--pulse) l c h / 0.4); }

/* name */
.c4-name {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 20px;
  letter-spacing: -0.018em;
  color: var(--ink);
  line-height: 1.1;
  margin: 0;
  max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.c4-rename {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 20px;
  letter-spacing: -0.018em;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid var(--pulse);
  border-radius: 8px;
  padding: 3px 10px;
  text-align: center;
  outline: none;
  width: 90%;
}

/* description */
.c4-desc {
  margin: 6px 0 0;
  font-size: 12.5px;
  color: var(--ink-3);
  line-height: 1.5;
  max-width: 100%;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* status badge */
.c4-status { margin-top: 14px; }
.c4-status-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--ink-3);
}
.c4-status-pill.is-live {
  background: oklch(from var(--pulse) l c h / 0.10);
  color: var(--pulse-hi);
  border-color: oklch(from var(--pulse) l c h / 0.35);
}
.c4-status-pill.is-empty {
  color: var(--ink-4);
}
.c4-status-pill.is-pregen {
  background: oklch(from var(--pulse) l c h / 0.12);
  color: var(--pulse-hi);
  border-color: oklch(from var(--pulse) l c h / 0.4);
}
.c4-status-pill.is-ready {
  color: var(--pulse-hi);
  background: oklch(from var(--pulse) l c h / 0.10);
  border-color: oklch(from var(--pulse) l c h / 0.3);
}
.c4-status-pill .pulse-dot { width: 5px; height: 5px; }

/* action buttons row */
.c4-actions-row {
  margin-top: auto;
  display: flex; gap: 6px;
  width: 100%;
  justify-content: center;
}
.c4-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 14px;
  background: oklch(1 0 0 / 0.04);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink);
  letter-spacing: -0.005em;
  transition: all 0.15s var(--ease);
  cursor: pointer;
}
.c4-btn:hover { background: oklch(1 0 0 / 0.08); transform: translateY(-1px); }
.c4-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.c4-btn-primary {
  background: var(--pulse);
  color: oklch(0.12 0.01 250);
  border-color: transparent;
  box-shadow: 0 0 0 1px oklch(from var(--pulse) l c h / 0.2), 0 6px 16px -4px oklch(from var(--pulse) l c h / 0.5);
}
.c4-btn-primary:hover { background: var(--pulse-hi); }
.c4-btn-gen {
  background: oklch(from var(--pulse) l c h / 0.12);
  color: var(--pulse-hi);
  border-color: oklch(from var(--pulse) l c h / 0.3);
}
.c4-btn-gen:hover { background: oklch(from var(--pulse) l c h / 0.20); }
.c4-btn-progress {
  background: oklch(from var(--pulse) l c h / 0.10);
  color: var(--pulse-hi);
  border-color: oklch(from var(--pulse) l c h / 0.3);
}
.c4-btn-ghost {
  background: transparent;
  color: var(--ink-2);
}

/* progress bar */
.c4-progress {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 2px;
  background: oklch(0 0 0 / 0.35);
  overflow: hidden;
}
.c4-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--pulse), var(--pulse-hi));
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 0.4s var(--ease-out);
  box-shadow: 0 0 8px oklch(from var(--pulse) l c h / 0.7);
}
.c4-progress-indet { position: relative; height: 2px; background: var(--surface-2); border-radius: 999px; margin-top: 14px; width: 80%; overflow: hidden; }
.c4-progress-sweep { position: absolute; inset: 0; background: linear-gradient(90deg, transparent, var(--pulse), transparent); animation: c4-sweep 1.6s linear infinite; }
@keyframes c4-sweep { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

/* ── CREATE CARD ─────────────────────────────────────────── */
.c4-create {
  background:
    radial-gradient(circle at 50% 32%, oklch(from var(--pulse) l c h / 0.10), transparent 55%),
    var(--panel);
  border-style: dashed;
}
.c4-create.is-wide { grid-column: span 2; border-style: solid; height: 380px; }
.c4-create.is-dropover { border-color: var(--pulse); box-shadow: 0 0 0 3px var(--pulse-soft); }

.c4-idle-btn {
  width: 100%; height: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 14px;
  padding: 24px 22px;
  background: transparent;
  border: none;
  cursor: pointer;
  color: inherit;
  text-align: center;
}
.c4-idle-btn .c4-desc {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-3);
  margin-top: 2px;
}

.c4-av-plus {
  border: 1px dashed oklch(from var(--pulse) l c h / 0.5);
  background: var(--surface-2);
  display: flex; align-items: center; justify-content: center;
}
.c4-plus {
  font-size: 38px;
  color: var(--pulse);
  font-weight: 200;
  line-height: 1;
}

.c4-av-quad {
  background: var(--surface-2);
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 4px;
  padding: 14px;
}
.c4-gen-cell {
  background: linear-gradient(135deg, var(--panel), var(--panel-hi));
  border-radius: 50%;
  animation: c4-cell-pulse 1.4s var(--ease) infinite;
  position: relative;
  overflow: hidden;
}
.c4-gen-cell::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(135deg, transparent, oklch(from var(--pulse) l c h / 0.35), transparent);
  animation: c4-cell-sweep 1.8s linear infinite;
}
@keyframes c4-cell-pulse { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }
@keyframes c4-cell-sweep { from { transform: translateX(-100%); } to { transform: translateX(100%); } }

.c4-x-corner { position: absolute; top: 14px; right: 14px; z-index: 6; }

/* expanded stages (compose / pick / added) */
.c4-compose, .c4-pick, .c4-added {
  display: flex; flex-direction: column; gap: 10px;
  width: 100%; height: 100%;
  text-align: left;
  align-items: stretch;
  animation: c4-stage-in 0.3s var(--ease-out);
}
@keyframes c4-stage-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.c4-step-head { display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; }
.c4-step-eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-3);
}
.c4-step-no {
  padding: 2px 8px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--ink-2); font-weight: 500;
}
.c4-x {
  width: 24px; height: 24px;
  border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-3); transition: all 0.15s;
}
.c4-x:hover { background: var(--panel-hi); color: var(--ink); }

.c4-compose-body {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  gap: 8px;
}
.c4-variation {
  display: flex; align-items: center; gap: 9px;
  padding: 6px 9px 6px 6px;
  background: oklch(from var(--pulse) l c h / 0.1);
  border: 1px solid oklch(from var(--pulse) l c h / 0.30);
  border-radius: 8px;
  font-size: 11.5px;
  color: var(--ink-2);
}
.c4-variation img { width: 24px; height: 24px; border-radius: 5px; object-fit: cover; }
.c4-variation strong { color: var(--pulse-hi); font-weight: 600; }
.c4-variation button { margin-left: auto; width: 18px; height: 18px; border-radius: 999px; color: var(--ink-3); display: flex; align-items: center; justify-content: center; }

.c4-field { display: flex; flex-direction: column; gap: 4px; }
.c4-field label {
  font-family: var(--font-mono);
  font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--ink-3);
  display: inline-flex; align-items: center; gap: 8px;
}
.c4-variant-tag {
  display: inline-flex; align-items: center;
  padding: 2px 8px;
  background: oklch(from var(--pulse) l c h / 0.16);
  color: var(--pulse-hi);
  border: 1px solid oklch(from var(--pulse) l c h / 0.40);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 500;
}
.c4-variant-link {
  cursor: pointer;
  margin-left: auto;
  transition: all 0.15s var(--ease);
}
.c4-variant-link:hover {
  background: oklch(from var(--pulse) l c h / 0.26);
  border-color: var(--pulse);
  color: var(--pulse-hi);
}

.c4.is-highlighted {
  border-color: var(--pulse);
  box-shadow: 0 0 0 2px oklch(from var(--pulse) l c h / 0.4), 0 0 60px -8px oklch(from var(--pulse) l c h / 0.5);
  animation: c4-highlight 2.0s var(--ease) 1;
}
@keyframes c4-highlight {
  0% { box-shadow: 0 0 0 0 oklch(from var(--pulse) l c h / 0.6); }
  50% { box-shadow: 0 0 0 6px oklch(from var(--pulse) l c h / 0.3), 0 0 80px -4px oklch(from var(--pulse) l c h / 0.6); }
  100% { box-shadow: 0 0 0 2px oklch(from var(--pulse) l c h / 0.4), 0 0 60px -8px oklch(from var(--pulse) l c h / 0.5); }
}
.c4-input {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 12.5px;
  color: var(--ink);
  outline: none; font-family: var(--font-ui);
}
.c4-input:focus { border-color: var(--pulse); background: var(--surface); }
.c4-textarea { resize: none; line-height: 1.45; min-height: 46px; height: 46px; font-size: 11.5px; }
.c4-arches { display: flex; flex-wrap: wrap; gap: 3px; }

.c4-step-foot {
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
}
.c4-hint {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: 0.08em; color: var(--ink-3);
}
.c4-hint.mono { color: var(--ink-4); font-size: 10px; letter-spacing: 0.08em; }

/* pick state */
.c4-pick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 5px; flex: 1; min-height: 0;
}
.c4-pick-cell {
  position: relative;
  border-radius: 9px; overflow: hidden;
  background: var(--surface-2);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.18s var(--ease);
}
.c4-pick-cell img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.4s var(--ease); }
.c4-pick-cell:hover { border-color: var(--pulse); }
.c4-pick-cell:hover img { transform: scale(1.04); }
.c4-pick-cell.is-picked { border-color: var(--pulse); box-shadow: 0 0 0 2px var(--pulse-soft); }
.c4-pick-num {
  position: absolute; top: 6px; left: 6px;
  padding: 2px 7px;
  background: oklch(0 0 0 / 0.55);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 9px; letter-spacing: 0.12em;
  color: var(--ink);
}

/* added state — hero portrait moment */
.c4-added-body {
  flex: 1; display: grid;
  grid-template-columns: 1.2fr 1.5fr;
  gap: 18px;
  min-height: 0;
  margin-top: 8px;
}
.c4-added-portrait {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-2);
  border: 1.5px solid oklch(from var(--pulse) l c h / 0.5);
  box-shadow: 0 0 40px -4px oklch(from var(--pulse) l c h / 0.35);
}
.c4-added-portrait img { width: 100%; height: 100%; object-fit: cover; display: block; }
.c4-added-rings {
  position: absolute; inset: -8px;
  pointer-events: none;
}
.c4-added-rings span {
  position: absolute; inset: 0;
  border-radius: 14px;
  border: 1px solid oklch(from var(--pulse) l c h / 0.35);
  animation: c4-added-ring 3.4s var(--ease) infinite;
}
.c4-added-rings span:nth-child(2) { animation-delay: 1.1s; }
.c4-added-rings span:nth-child(3) { animation-delay: 2.2s; }
@keyframes c4-added-ring {
  0%   { transform: scale(1.0); opacity: 0.65; }
  100% { transform: scale(1.18); opacity: 0; }
}
.c4-added-meta {
  display: flex; flex-direction: column;
  justify-content: center;
}
.c4-added-row {
  display: flex; gap: 8px;
  font-family: var(--font-mono);
  font-size: 10px; letter-spacing: 0.10em; text-transform: uppercase;
  padding: 4px 0;
}
.c4-added-row .k { color: var(--ink-3); width: 80px; }
.c4-added-row .v { color: var(--ink); }

@media (max-width: 640px) {
  .c4-create.is-wide { grid-column: span 1; }
  .c4-pick-grid { grid-template-columns: 1fr 1fr; }
  .c4-added-body { grid-template-columns: 1fr; }
}
