/* ═══════════════════════════════════════════════════════════════
   Groof Shared — Stylesheet
   ═══════════════════════════════════════════════════════════════ */

/* ── Tokens ──────────────────────────────────────────────────── */
:root {
  --bg:           #F4F5F8;
  --surface:      #FFFFFF;
  --border:       #DDE1EA;
  --text:         #1A1D2E;
  --text-muted:   #6B7280;
  --accent:       #5B6EE8;
  --accent-dark:  #3D50C8;
  --danger:       #E53E3E;
  --warning:      #DD6B20;
  --success:      #38A169;

  --card-yellow:  #FFF3A3;
  --card-yellow-b:#D4C44A;
  --card-blue:    #A3C4F3;
  --card-blue-b:  #5A96E0;
  --card-green:   #A8E6CF;
  --card-green-b: #4DB88A;
  --card-pink:    #FFC9FF;
  --card-pink-b:  #C87EC8;

  --radius:       8px;
  --radius-card:  5px;
  --shadow-card:  2px 4px 10px rgba(0,0,0,0.13);
  --shadow-modal: 0 8px 40px rgba(0,0,0,0.22);

  --header-h:     58px;
  --chat-w:       33.33%;
  --canvas-w:     66.67%;
  --agreement-h:  60px;
}

/* ── Reset ───────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Segoe UI', system-ui, sans-serif; background: var(--bg); color: var(--text); font-size: 15px; line-height: 1.5; }
button { cursor: pointer; border: none; background: none; font: inherit; }
input, textarea { font: inherit; }

/* ── Utilities ───────────────────────────────────────────────── */
.hidden { display: none !important; }
.error-text { color: var(--danger); font-size: 0.85rem; margin-top: 6px; }

/* ── Buttons ─────────────────────────────────────────────────── */
.btn-primary {
  background: var(--accent);
  color: #fff;
  padding: 10px 22px;
  border-radius: var(--radius);
  font-weight: 600;
  transition: background 0.15s;
}
.btn-primary:hover { background: var(--accent-dark); }
.btn-primary:disabled { background: #b0b8e8; cursor: not-allowed; }

.btn-secondary {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent);
  padding: 9px 20px;
  border-radius: var(--radius);
  font-weight: 600;
  transition: background 0.15s;
}
.btn-secondary:hover { background: rgba(91,110,232,0.07); }

.btn-full { width: 100%; }

.btn-icon {
  color: var(--text-muted);
  font-size: 0.82rem;
  padding: 5px 10px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  transition: background 0.15s;
}
.btn-icon:hover { background: var(--bg); }

.btn-send {
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  width: 36px; height: 36px;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem;
}
.btn-send:hover { background: var(--accent-dark); }

.btn-agree {
  background: var(--success);
  color: #fff;
  padding: 8px 18px;
  border-radius: var(--radius);
  font-weight: 600;
}
.btn-disagree {
  background: var(--danger);
  color: #fff;
  padding: 8px 18px;
  border-radius: var(--radius);
  font-weight: 600;
}

.btn-mod {
  background: var(--accent);
  color: #fff;
  padding: 9px 18px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.88rem;
  transition: background 0.15s;
}
.btn-mod:hover { background: var(--accent-dark); }
.btn-mod.secondary {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent);
}
.btn-mod.secondary:hover { background: rgba(91,110,232,0.07); }

/* ══════════════════════════════════════════════════════════════
   LANDING PAGE
   ══════════════════════════════════════════════════════════════ */

.landing-page { min-height: 100vh; display: flex; flex-direction: column; }

.landing-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 20px 40px;
  text-align: center;
}
.header-logo { max-height: 52px; width: auto; }
.tagline { color: var(--text-muted); margin-top: 8px; font-size: 0.95rem; }

.session-grid-wrapper { flex: 1; padding: 40px; max-width: 1100px; margin: 0 auto; width: 100%; }

.session-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 20px;
}

.session-btn {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 20px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.1s;
  position: relative;
  cursor: pointer;
}
.session-btn:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 16px rgba(91,110,232,0.12);
  transform: translateY(-2px);
}
.session-btn.active { border-color: var(--accent); background: #f0f2fd; }

.btn-badge {
  position: absolute;
  top: 12px; right: 12px;
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 20px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.btn-title {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
  line-height: 1.3;
}
.btn-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.grid-footer-tagline {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.95rem;
  padding-top: 16px;
}

.load-session-bar {
  text-align: center;
  padding: 20px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}
.load-btn {
  color: var(--accent);
  font-size: 0.9rem;
  cursor: pointer;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius);
  border: 1.5px dashed var(--accent);
  display: inline-block;
  transition: background 0.15s;
}
.load-btn:hover { background: rgba(91,110,232,0.07); }

/* ── Modals ──────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(20,22,40,0.45);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
  backdrop-filter: blur(2px);
}
.modal-box {
  background: var(--surface);
  border-radius: 12px;
  padding: 32px;
  width: min(480px, 95vw);
  box-shadow: var(--shadow-modal);
  position: relative;
}
.modal-box h2 { font-size: 1.25rem; margin-bottom: 20px; }

.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-weight: 600; font-size: 0.88rem; margin-bottom: 6px; color: var(--text); }
.form-group input, .form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s;
  background: var(--bg);
}
.form-group input:focus, .form-group textarea:focus { border-color: var(--accent); background: #fff; }

.radio-group { display: flex; flex-direction: column; gap: 10px; }
.radio-label {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.radio-label:has(input:checked) { border-color: var(--accent); background: #f0f2fd; }
.radio-label input { margin-top: 3px; accent-color: var(--accent); flex-shrink: 0; }
.radio-label strong { display: block; font-size: 0.9rem; }
.radio-label small { color: var(--text-muted); font-size: 0.8rem; }

.modal-actions { display: flex; gap: 12px; justify-content: flex-end; margin-top: 24px; }

.share-link-row { display: flex; gap: 8px; margin: 12px 0; }
.share-link-row input {
  flex: 1; padding: 9px 12px;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  font-size: 0.85rem; background: var(--bg); color: var(--text);
}
.share-hint { font-size: 0.82rem; color: var(--text-muted); margin-bottom: 8px; }

/* ══════════════════════════════════════════════════════════════
   SESSION PAGE
   ══════════════════════════════════════════════════════════════ */

.session-page { height: 100vh; display: flex; flex-direction: column; }

/* ── Full overlay (name entry) ───────────────────────────────── */
.full-overlay {
  position: fixed; inset: 0;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 500;
}
.overlay-box {
  background: var(--surface);
  border-radius: 12px;
  padding: 36px 32px;
  width: min(420px, 95vw);
  box-shadow: var(--shadow-modal);
  text-align: center;
}
.overlay-logo { max-height: 40px; margin-bottom: 20px; }
.session-preview {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 20px;
  text-align: left;
}
.session-preview .preview-title { font-weight: 700; font-size: 1rem; }
.session-preview .preview-goal { color: var(--text-muted); font-size: 0.85rem; margin-top: 4px; }

/* ── Session Header ──────────────────────────────────────────── */
.session-header {
  height: var(--header-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 20px;
  flex-shrink: 0;
}
.header-logo-small { height: 28px; width: auto; flex-shrink: 0; }

.session-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.hdr-title { font-weight: 700; font-size: 0.95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hdr-goal { font-size: 0.78rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.session-status { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.step-label {
  font-size: 0.8rem;
  font-weight: 600;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 3px 12px;
  color: var(--text-muted);
}

.timer-display {
  font-size: 1.1rem;
  font-weight: 700;
  min-width: 56px;
  text-align: center;
  color: var(--success);
  font-variant-numeric: tabular-nums;
  transition: color 0.3s;
}
.timer-display.warn { color: var(--warning); }
.timer-display.danger { color: var(--danger); animation: pulse 0.8s infinite alternate; }
@keyframes pulse { from { opacity: 1; } to { opacity: 0.4; } }

.header-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }

.participants-mini {
  display: flex;
  gap: 4px;
  align-items: center;
}
.participant-dot {
  width: 28px; height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  position: relative;
  cursor: default;
  flex-shrink: 0;
}
.participant-dot.offline { background: var(--border); color: var(--text-muted); }
.participant-dot .crown { position: absolute; top: -8px; font-size: 10px; }

/* ── Workspace ───────────────────────────────────────────────── */
.workspace {
  flex: 1;
  display: flex;
  min-height: 0; /* allow flex children to scroll */
}

/* ── Chat Panel ──────────────────────────────────────────────── */
.chat-panel {
  width: var(--chat-w);
  min-width: 240px;
  max-width: 360px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  min-height: 0;
  overflow-y: auto;
}
.chat-header {
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--border);
}
.chat-header h3 { font-size: 0.9rem; font-weight: 700; margin-bottom: 10px; }

.participants-list { display: flex; flex-direction: column; gap: 4px; }
.participant-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 2px 0;
}
.participant-row .dot-status {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--success); flex-shrink: 0;
}
.participant-row .dot-status.offline { background: var(--border); }
.participant-row .p-name { font-weight: 600; color: var(--text); }
.participant-row .p-crown { font-size: 10px; color: #f4b942; }
.participant-row .p-agree { margin-left: auto; font-size: 0.75rem; }
.p-agree.agree { color: var(--success); font-weight: 700; }
.p-agree.disagree { color: var(--danger); font-weight: 700; }

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.chat-msg { display: flex; flex-direction: column; gap: 2px; }
.chat-msg .msg-sender { font-size: 0.75rem; font-weight: 700; color: var(--accent); }
.chat-msg .msg-sender.is-mod { color: #f4b942; }
.chat-msg .msg-sender.is-me { color: var(--success); }
.chat-msg .msg-text {
  font-size: 0.85rem;
  background: var(--bg);
  border-radius: 0 8px 8px 8px;
  padding: 7px 10px;
  word-break: break-word;
}
.chat-msg.me .msg-text { background: #e8ebfd; border-radius: 8px 0 8px 8px; }
.chat-msg .msg-time { font-size: 0.7rem; color: var(--text-muted); }
.chat-system {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
}

.chat-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--border);
}
.chat-input-row input {
  flex: 1;
  padding: 8px 12px;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  outline: none;
  font-size: 0.88rem;
  background: var(--bg);
}
.chat-input-row input:focus { border-color: var(--accent); background: #fff; }

/* ── Mapping Canvas ──────────────────────────────────────────── */
.mapping-canvas {
  flex: 1;
  overflow: auto;
  padding: 28px;
  background: var(--bg);
  display: flex;
  flex-direction: column;
}

/* Canvas title row (for PNG export) */
.canvas-header {
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 2px solid var(--border);
}
.canvas-title { font-size: 1.3rem; font-weight: 800; }
.canvas-goal { font-size: 0.88rem; color: var(--text-muted); margin-top: 4px; }

/* Step-specific wrappers */
.step-wrapper { display: flex; flex-direction: column; gap: 20px; }

/* ── Cards ───────────────────────────────────────────────────── */
.card {
  background: var(--card-yellow);
  border: 1.5px solid var(--card-yellow-b);
  border-radius: var(--radius-card);
  padding: 10px 12px;
  box-shadow: var(--shadow-card);
  font-size: 0.85rem;
  line-height: 1.45;
  word-break: break-word;
  position: relative;
  min-width: 0;
}
.card[data-type="rule"]     { background: var(--card-blue);  border-color: var(--card-blue-b); }
.card[data-type="example"]  { background: var(--card-green); border-color: var(--card-green-b); }
.card[data-type="question"] { background: var(--card-pink);  border-color: var(--card-pink-b); }

.card-owner {
  font-size: 0.68rem;
  color: rgba(0,0,0,0.4);
  margin-top: 6px;
  font-weight: 600;
}
.card-actions {
  position: absolute;
  top: 4px; right: 4px;
  display: none;
  gap: 4px;
}
.card:hover .card-actions { display: flex; }
.card-btn {
  width: 20px; height: 20px;
  border-radius: 50%;
  font-size: 0.7rem;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.12);
  color: rgba(0,0,0,0.6);
  transition: background 0.15s;
  cursor: pointer;
}
.card-btn:hover { background: rgba(0,0,0,0.25); }
.card-btn.del:hover { background: var(--danger); color: #fff; }

.card-text-editable {
  outline: none;
  cursor: text;
  min-height: 1.4em;
}
.card-text-editable:focus {
  background: rgba(255,255,255,0.6);
  border-radius: 2px;
  padding: 0 2px;
}

/* ── Story input row (always visible) ───────────────────────── */
.story-input-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}
.story-textarea {
  flex: 1;
  padding: 10px 12px;
  border: 2px solid var(--card-yellow-b);
  border-radius: var(--radius);
  background: var(--card-yellow);
  font-size: 0.9rem;
  resize: none;
  outline: none;
  line-height: 1.4;
  transition: border-color 0.15s;
}
.story-textarea:focus { border-color: var(--accent); background: #fffce8; }
.story-textarea::placeholder { color: #aaa; }
.story-add-btn { flex-shrink: 0; align-self: flex-end; }

.story-cards-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  min-height: 70px;
  padding: 14px;
  background: rgba(255,243,163,0.2);
  border: 2px dashed var(--card-yellow-b);
  border-radius: var(--radius);
}
.row-empty-hint {
  color: var(--text-muted);
  font-size: 0.8rem;
  align-self: center;
  font-style: italic;
}

/* ── Given / When / Then card display ───────────────────────── */
.gwt-body { display: flex; flex-direction: column; gap: 4px; }
.gwt-row { display: flex; gap: 4px; font-size: 0.8rem; line-height: 1.3; }
.gwt-label {
  font-weight: 700;
  color: rgba(0,0,0,0.45);
  flex-shrink: 0;
  min-width: 38px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding-top: 1px;
}
.gwt-value { flex: 1; word-break: break-word; }
.gwt-value[contenteditable="true"] {
  outline: none;
  background: rgba(255,255,255,0.5);
  border-radius: 2px;
  padding: 0 2px;
}
.gwt-value[contenteditable="true"]:focus {
  background: rgba(255,255,255,0.85);
}

/* ── Given / When / Then input form ─────────────────────────── */
.gwt-form { flex-direction: column; gap: 6px; }
.gwt-form.open { display: flex; }
.gwt-input-row { display: flex; align-items: flex-start; gap: 6px; }
.gwt-input-row .gwt-label {
  font-weight: 700;
  font-size: 0.75rem;
  color: rgba(0,0,0,0.5);
  padding-top: 8px;
  min-width: 42px;
  flex-shrink: 0;
}
.gwt-input {
  flex: 1;
  border: 1.5px solid var(--card-green-b);
  border-radius: 4px;
  padding: 6px 8px;
  font-size: 0.83rem;
  background: rgba(168,230,207,0.4);
  resize: none;
  outline: none;
  font-family: inherit;
}
.gwt-input:focus { border-color: var(--accent); background: rgba(168,230,207,0.6); }
.gwt-open-btn { border-color: var(--card-green-b) !important; }

/* ── Question zone (story-level, above rules) ────────────────── */
.question-zone {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 6px 0 4px;
}
.question-open-btn { border-color: var(--card-pink-b) !important; color: #9a3e9a; }

/* ── Card input areas ────────────────────────────────────────── */
.add-card-area {
  margin-top: 8px;
}
.add-card-btn {
  font-size: 0.8rem;
  color: var(--text-muted);
  border: 1.5px dashed var(--border);
  border-radius: var(--radius-card);
  padding: 6px 10px;
  background: transparent;
  width: 100%;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}
.add-card-btn:hover { border-color: var(--accent); color: var(--accent); }
.add-card-form { display: none; margin-top: 6px; }
.add-card-form.open { display: block; }
.add-card-form textarea {
  width: 100%;
  border: 1.5px solid var(--accent);
  border-radius: var(--radius-card);
  padding: 8px 10px;
  font-size: 0.85rem;
  resize: vertical;
  min-height: 56px;
  background: rgba(255,255,255,0.7);
  outline: none;
}
.add-card-form-row { display: flex; gap: 6px; margin-top: 6px; }
.add-card-submit {
  background: var(--accent);
  color: #fff;
  padding: 5px 12px;
  border-radius: var(--radius-card);
  font-size: 0.8rem;
  font-weight: 600;
  flex-shrink: 0;
}
.add-card-cancel {
  color: var(--text-muted);
  padding: 5px 8px;
  font-size: 0.8rem;
}

/* ── Waiting / Info screens ──────────────────────────────────── */
.waiting-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  flex: 1;
  gap: 16px;
  padding: 40px;
}
.waiting-screen h2 { font-size: 1.3rem; }
.waiting-screen p { color: var(--text-muted); max-width: 420px; }
.share-box {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  width: 100%;
  max-width: 480px;
}
.share-box label { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); display: block; margin-bottom: 6px; }
.share-box-row { display: flex; gap: 8px; }
.share-box-row input {
  flex: 1;
  padding: 8px 10px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.82rem;
  background: var(--bg);
}
.mod-controls {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-top: 16px;
  justify-content: center;
}

/* ── Story Collection ────────────────────────────────────────── */
.my-cards-area {
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  max-width: 520px;
  width: 100%;
}
.my-cards-area h3 { font-size: 0.9rem; font-weight: 700; margin-bottom: 4px; }
.my-cards-area p { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 14px; }
.my-cards-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }

/* ── Story Arrangement ───────────────────────────────────────── */
.reveal-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}
.person-row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
}
.person-row-label {
  font-weight: 700;
  font-size: 0.82rem;
  color: var(--accent);
  min-width: 110px;
  padding-top: 4px;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.person-row-label em {
  font-weight: 400;
  color: var(--text-muted);
  font-style: normal;
}
.person-row-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  flex: 1;
}
.order-row-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.order-row-label strong { color: var(--text); }
.waiting-hint {
  display: flex;
  align-items: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 16px;
  font-style: italic;
}
.draggable-stories {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  min-height: 80px;
  padding: 16px;
  background: var(--surface);
  border: 2px dashed var(--border);
  border-radius: var(--radius);
}
.draggable-stories .card { user-select: none; width: 180px; }
.draggable-stories .card.dragging {
  opacity: 0.25;
  transform: rotate(2deg) scale(1.04);
  box-shadow: 0 8px 24px rgba(0,0,0,0.22);
  pointer-events: none;
}
.drag-active { border-color: var(--accent) !important; background: rgba(91,110,232,0.04) !important; }

/* Drop placeholder — the glowing "slot" that shows where the card will land */
.drop-placeholder {
  background: rgba(91,110,232,0.08);
  border: 2px dashed var(--accent);
  border-radius: var(--radius-card);
  flex-shrink: 0;
  transition: width 0.1s, height 0.1s;
}

/* Grip handle */
.card-grip {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: rgba(0,0,0,0.25);
  cursor: grab;
  margin-bottom: 4px;
  line-height: 1;
  user-select: none;
  transition: color 0.15s;
}
.card-grip:hover { color: rgba(0,0,0,0.55); }
.card-grip:active { cursor: grabbing; }

.person-row-cards .card { width: 160px; }

/* ── Story Columns (Rules + Examples) ────────────────────────── */
.story-columns {
  display: flex;
  gap: 0;
  align-items: flex-start;
  min-width: max-content;
}
.story-column {
  width: 220px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  padding: 0 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.story-column:last-child { border-right: none; }
.story-column > .card { margin-bottom: 4px; }

.rule-section { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.rule-section > .card { margin-bottom: 2px; }

.examples-stack { display: flex; flex-direction: column; gap: 6px; padding-left: 8px; border-left: 2px solid var(--border); margin-left: 4px; }

/* ── Agreement bar ───────────────────────────────────────────── */
.agreement-bar {
  height: var(--agreement-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 20px;
  gap: 16px;
  flex-shrink: 0;
}
.agreement-status {
  font-size: 0.85rem;
  color: var(--text-muted);
  flex: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.agr-chip {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 20px;
  border: 1.5px solid var(--border);
}
.agr-chip.agree { border-color: var(--success); color: var(--success); }
.agr-chip.disagree { border-color: var(--danger); color: var(--danger); }
.agreement-actions { display: flex; gap: 10px; align-items: center; }

/* ── Misc ────────────────────────────────────────────────────── */
.step-info-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 18px;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.step-info-bar strong { color: var(--text); }

.type-picker { display: flex; gap: 8px; margin-bottom: 6px; }
.type-pick-btn {
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 600;
  border: 1.5px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}
.type-pick-btn.selected-example { border-color: var(--card-green-b); background: var(--card-green); }
.type-pick-btn.selected-question { border-color: var(--card-pink-b); background: var(--card-pink); }

/* spinner for loading states */
.spinner {
  width: 32px; height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Scrollbar styling */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #bbb; }
