/* ============================================================
   ECHOES — Component Styles
   ============================================================ */

/* ---- Table Cards ---- */
.table-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
  transition: all 0.2s ease;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  text-decoration: none;
  display: block;
  color: inherit;
}

.table-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--accent-a);
  opacity: 0;
  transition: opacity 0.2s;
}

.table-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.table-card:hover::before { opacity: 1; }

.table-card-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.table-card-module {
  font-size: 0.78rem;
  color: var(--accent-b-light);
  margin-bottom: 10px;
}

.table-card-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.table-card-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.table-card-dm {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

/* ---- Module Card ---- */
.module-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.2s ease;
}

.module-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
  box-shadow: var(--shadow-card);
}

.module-card-banner {
  height: 80px;
  display: flex;
  align-items: flex-end;
  padding: 12px 16px;
  position: relative;
}

.module-card-banner::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 20%, rgba(0,0,0,0.7));
}

.module-card-system {
  font-size: 0.72rem;
  font-weight: 600;
  color: white;
  position: relative;
  z-index: 1;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  background: rgba(0,0,0,0.4);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.module-card-body { padding: 16px; }

.module-card-title {
  font-family: var(--font-display);
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.module-card-desc {
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.module-card-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ---- Post styles ---- */
.post {
  --thread-accent: var(--accent-a-light);
  --thread-fill: linear-gradient(
    90deg,
    color-mix(in srgb, var(--thread-accent) 20%, transparent) 0%,
    color-mix(in srgb, var(--thread-accent) 10%, transparent) 30%,
    transparent 72%
  );
  border: none;
  border-radius: 0;
  padding: 10px 18px;
  position: relative;
  animation: postIn 0.3s ease;
  width: 100%;
  background: var(--thread-fill);
}

@keyframes postIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Post type tweaks — gradient accent comes from --thread-accent via resolvePostAccentColor */
.post-system { text-align: center; opacity: 0.8; }
.post-dm-only { border-left: 2px solid rgba(212,175,55,0.4); padding-left: 16px; }

/* Scene insert card — special layout for DM scene inserts */
.scene-insert-card {
  background: transparent !important;
  border: none !important;
  border-radius: 0 !important;
  padding: 4px 0 !important;
  margin: 8px 0;
  width: 100%;
  align-self: center;
  text-align: center;
}

.scene-insert-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.scene-insert-rule {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(212,175,55,0.3), transparent);
}

.scene-insert-badge {
  font-family: var(--font-display);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0.9;
}

.scene-insert-body {
  text-align: center;
  font-family: var(--font-display);
  font-size: 0.92rem;
  line-height: 1.65;
  color: var(--text-secondary);
  padding: 0 20px;
  font-style: italic;
}

.scene-insert-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 12px;
}

.scene-insert-time {
  font-size: 0.68rem;
  color: var(--text-faint);
}
.post-system {
  --post-surface: rgba(148,163,184,0.05);
  border-style: dashed;
  text-align: center;
}
.post-dm-only {
  --post-surface: rgba(212,175,55,0.05);
  border-color: rgba(212,175,55,0.3);
}
.post-combat { --post-surface: rgba(244,63,94,0.06); border-color: rgba(244,63,94,0.25); }

/* Lane gradient directions — posts span full width, gradient bleeds from speaker's side */
.chat-flow-left {
  --thread-fill: linear-gradient(
    90deg,
    color-mix(in srgb, var(--thread-accent) 22%, transparent) 0%,
    color-mix(in srgb, var(--thread-accent) 12%, transparent) 35%,
    transparent 75%
  );
}

.chat-flow-right {
  --thread-fill: linear-gradient(
    270deg,
    color-mix(in srgb, var(--thread-accent) 22%, transparent) 0%,
    color-mix(in srgb, var(--thread-accent) 12%, transparent) 35%,
    transparent 75%
  );
}

.chat-flow-center {
  --thread-fill: radial-gradient(
    ellipse at center,
    color-mix(in srgb, var(--thread-accent) 18%, transparent) 0%,
    color-mix(in srgb, var(--thread-accent) 8%, transparent) 45%,
    transparent 78%
  );
  text-align: center;
}

.chat-entity { text-align: center; }

/* Grouped posts — same speaker's consecutive messages merge into one visual block */

/* Continuation posts: hide repeated name/avatar header */
.chat-group-middle .post-header,
.chat-group-end .post-header {
  display: none;
}

/* Cancel the feed gap between grouped posts and show a thin divider instead */
.chat-group-middle,
.chat-group-end {
  margin-top: -8px; /* cancels post-feed gap:8px */
  border-top: 1px solid rgba(255,255,255,0.07);
  padding-top: 10px;
}

/* Subtle rounding on outer edges of each group */
.chat-group-solo  { border-radius: 6px; }
.chat-group-start { border-radius: 6px 6px 0 0; }
.chat-group-middle{ border-radius: 0; }
.chat-group-end   { border-radius: 0 0 6px 6px; }

.post-header {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 8px;
}

.post-author {
  font-weight: 600;
  font-size: 0.84rem;
  color: var(--text-primary);
}

.post-speaker-meta {
  font-size: 0.66rem;
  color: var(--text-muted);
  line-height: 1.3;
}

.post-char-name {
  font-size: 0.75rem;
  color: var(--accent-a-light);
  font-style: italic;
}

.post-time {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-left: auto;
}

.post-type-tag {
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

.post-type-narrative .post-type-tag { color: var(--text-muted); }
.post-type-action .post-type-tag { color: var(--accent-b); }
.post-type-dialogue .post-type-tag { color: var(--accent-success); }
.post-type-dm-only .post-type-tag { color: var(--accent-gold-v); }

.post-content {
  font-size: 0.88rem;
  line-height: 1.68;
  color: var(--text-primary);
  overflow-wrap: anywhere;
  word-break: break-word;
}

.post-content em { color: var(--text-secondary); font-style: italic; }
.post-content strong { color: var(--accent-a-light); font-weight: 600; }
.post-content code,
.post-content pre,
.post-content a {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.post-content code {
  white-space: pre-wrap;
}

.post-reply-ref {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  background: rgba(148,163,184,0.08);
  border-radius: var(--radius-sm);
  padding: 7px 9px;
  text-align: left;
  cursor: pointer;
}

.post-reply-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-a-light);
}

.post-reply-snippet {
  font-size: 0.78rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.post-mentions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.post-mention-chip {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-full);
  border: 1px solid rgba(6,182,212,0.28);
  background: rgba(6,182,212,0.12);
  color: var(--accent-b-light);
  font-size: 0.68rem;
}

.post-style-indicator {
  margin-top: 8px;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.post-targeted {
  box-shadow: 0 0 0 1px rgba(6,182,212,0.25), 0 18px 40px rgba(6,182,212,0.08);
}

.post-flash {
  animation: postFlash 1s ease;
}

@keyframes postFlash {
  0% { box-shadow: 0 0 0 0 rgba(6,182,212,0.45); }
  100% { box-shadow: 0 0 0 16px rgba(6,182,212,0); }
}

.post-dice {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.dice-result {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.76rem;
}

.dice-context-tag {
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent-warning);
  background: rgba(245,158,11,0.12);
  border: 1px solid rgba(245,158,11,0.25);
  border-radius: var(--radius-full);
  padding: 2px 6px;
}

.dice-notation { color: var(--text-muted); }
.dice-rolls { color: var(--text-secondary); }
.dice-total { color: var(--accent-a-light); font-weight: 700; font-size: 1rem; }

.dice-apply-btn {
  display: none;
  margin-left: 2px;
  border: none;
  border-radius: var(--radius-full);
  background: rgba(6,182,212,0.18);
  color: var(--accent-b-light);
  padding: 4px 8px;
  font-size: 0.68rem;
  cursor: pointer;
  font-family: var(--font-body);
}

.dice-result:hover .dice-apply-btn {
  display: inline-flex;
  align-items: center;
}

.dice-total.nat20 { color: #FFD700; text-shadow: 0 0 12px rgba(255,215,0,0.5); }
.dice-total.nat1 { color: var(--accent-danger); }

.post-actions {
  display: none;
  gap: 6px;
  margin-top: 7px;
}

.post:hover .post-actions { display: flex; }

.post-action-btn {
  font-size: 0.68rem;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  padding: 3px 7px;
  border-radius: var(--radius-sm);
  transition: all 0.15s;
  font-family: var(--font-body);
}

.post-action-btn:hover { background: var(--bg-elevated); color: var(--text-primary); }

/* ---- Post composer ---- */
.composer {
  border-top: 1px solid var(--border);
  background: var(--bg-surface);
  padding: 12px 16px;
  flex-shrink: 0;
}

.composer-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.composer-toolbar-spacer {
  flex: 1 1 auto;
}

.composer-context {
  margin-bottom: 8px;
}

.composer-reply {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(148,163,184,0.08);
  padding: 9px 11px;
}

.composer-reply-label {
  font-size: 0.72rem;
  color: var(--accent-a-light);
  margin-bottom: 3px;
}

.composer-reply-snippet {
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.composer-target-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.composer-target-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  align-self: center;
  margin-right: 4px;
}

.composer-target-chip {
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--bg-card);
  color: var(--text-secondary);
  padding: 4px 10px;
  font-size: 0.72rem;
  cursor: pointer;
}

.composer-target-chip.active {
  border-color: rgba(6,182,212,0.34);
  background: rgba(6,182,212,0.14);
  color: var(--accent-b-light);
}

.composer-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.composer-textarea-wrap {
  position: relative;
}

.composer-textarea-wrap .macro-dropdown {
  left: 0;
  bottom: calc(100% + 8px);
}

.post-type-select {
  padding: 5px 9px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 0.76rem;
  font-family: var(--font-body);
  outline: none;
  cursor: pointer;
}

.composer-inline-input {
  padding: 5px 9px;
  min-width: 140px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.76rem;
  font-family: var(--font-body);
}

.composer-speaker-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: rgba(16,185,129,0.1);
  color: var(--accent-success);
  font-size: 0.74rem;
}

.composer-textarea {
  width: 100%;
  background: linear-gradient(180deg, rgba(255,255,255,0.06), rgba(255,255,255,0.02)), var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.88rem;
  padding: 10px 12px;
  resize: none;
  min-height: 72px;
  max-height: 200px;
  outline: none;
  line-height: 1.58;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.composer-textarea:focus {
  border-color: var(--accent-a);
  box-shadow: 0 0 0 1px rgba(139,92,246,0.22);
}
.composer-textarea::placeholder { color: var(--text-muted); }

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}

.composer-help {
  position: relative;
}

.composer-help[open] {
  z-index: 8;
}

.composer-help-btn {
  list-style: none;
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0 10px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
  background: rgba(148,163,184,0.08);
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.composer-help-btn::-webkit-details-marker {
  display: none;
}

.composer-help-btn:hover,
.composer-help[open] .composer-help-btn {
  color: var(--text-primary);
  border-color: rgba(6,182,212,0.28);
}

.composer-help-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 10px);
  width: min(92vw, 360px);
  padding: 12px;
  border-radius: 18px;
  border: 1px solid var(--border-light);
  background: linear-gradient(180deg, rgba(17,24,39,0.95), rgba(15,23,42,0.94));
  box-shadow: 0 18px 42px rgba(2,6,23,0.46);
}

.composer-help-title {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-primary);
  margin-bottom: 10px;
}

.composer-help-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.composer-help-item {
  display: grid;
  gap: 4px;
  padding: 8px 9px;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(148,163,184,0.12);
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.composer-help-item span {
  color: var(--text-muted);
  line-height: 1.35;
}

.composer-help-item code,
.composer-help-note code {
  font-family: var(--font-mono);
  background: rgba(6,182,212,0.08);
  padding: 2px 5px;
  border-radius: 6px;
  color: var(--accent-b-light);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.composer-help-note {
  margin-top: 10px;
  font-size: 0.71rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.dm-presence {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.dm-presence-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(148,163,184,0.5);
}

.dm-presence.active .dm-presence-dot { background: #22c55e; box-shadow: 0 0 10px rgba(34,197,94,0.45); }
.dm-presence.present .dm-presence-dot { background: #38bdf8; }
.dm-presence.awaiting .dm-presence-dot { background: #f59e0b; }

.scene-banner {
  position: relative;
  margin: 0 16px 12px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  min-height: 160px;
  border: 1px solid rgba(212,175,55,0.16);
}

.scene-banner-img {
  width: 100%;
  height: 100%;
  min-height: 160px;
  object-fit: cover;
  display: block;
}

.scene-banner-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 8px;
  padding: 22px;
  background: linear-gradient(180deg, rgba(15,23,42,0.08), rgba(15,23,42,0.82));
}

.scene-banner-kicker {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255,255,255,0.78);
}

.scene-banner-title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: white;
}

.scene-banner-copy {
  font-size: 0.84rem;
  color: rgba(255,255,255,0.86);
  max-width: 62ch;
  line-height: 1.6;
}

.scene-cast {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.scene-cast-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(148,163,184,0.06);
  padding: 8px 10px;
}

.scene-cast-name {
  font-size: 0.78rem;
  color: var(--text-primary);
}

.scene-cast-meta {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ---- Combat tracker ---- */
.combat-panel {
  background: var(--bg-card);
  border: 1px solid rgba(244,63,94,0.3);
  border-radius: var(--radius-md);
  padding: 14px;
}

.combat-title {
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--accent-danger);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.combat-round {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.combatant-row {
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
  margin-bottom: 4px;
  border: 1px solid transparent;
}

.combatant-row-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 8px;
  cursor: pointer;
}

.combatant-details {
  padding: 0 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.combatant-row.active-turn {
  background: rgba(244,63,94,0.08);
  border-color: rgba(244,63,94,0.25);
}

.combatant-row.combatant-dead {
  opacity: 0.45;
}

.combatant-active-arrow {
  color: var(--accent-danger);
  font-size: 0.7rem;
}

.combatant-collapse-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0 3px;
  line-height: 1;
  margin-left: auto;
}
.combatant-collapse-btn:hover { color: var(--text-primary); }

.combatant-init {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-muted);
  min-width: 22px;
  text-align: center;
}

.combatant-name {
  flex: 1;
  font-size: 0.82rem;
  color: var(--text-primary);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.combatant-hp {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--accent-success);
  white-space: nowrap;
}

.combatant-hp.bloodied { color: var(--accent-warning); }
.combatant-hp.critical { color: var(--accent-danger); }
.combatant-hp.dead { color: var(--text-muted); text-decoration: line-through; }

.combatant-type-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.combatant-type { font-size: 0.65rem; padding: 1px 5px; border-radius: var(--radius-full); }
.combatant-type.player { background: rgba(139,92,246,0.2); color: var(--accent-a-light); }
.combatant-type.enemy { background: rgba(244,63,94,0.15); color: var(--accent-danger); }

.combatant-action-tag {
  font-size: 0.65rem;
  padding: 1px 5px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
}
.combatant-action-tag code {
  font-family: var(--font-mono);
  color: var(--accent-a-light);
  font-size: 0.65rem;
}

.combatant-hp-controls {
  display: flex;
  gap: 5px;
  align-items: center;
}

/* ---- Time & downtime ---- */
.time-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.time-clock-card,
.time-timer-card,
.time-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(148,163,184,0.06);
}

.time-clock-card {
  padding: 12px 13px;
}

.time-kicker,
.dm-time-section-title {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.time-clock-label {
  font-family: var(--font-display);
  font-size: 0.96rem;
  color: var(--text-primary);
  margin-top: 4px;
}

.time-clock-readout {
  font-size: 0.82rem;
  color: var(--accent-gold-v);
  margin-top: 3px;
}

.time-clock-meta,
.time-item-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.time-clock-notes,
.time-item-copy,
.time-item-result {
  margin-top: 8px;
  font-size: 0.76rem;
  line-height: 1.55;
  color: var(--text-secondary);
}

.time-item-result {
  color: var(--text-primary);
  font-style: italic;
}

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

.time-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

.time-subsection {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.time-subsection-title {
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.time-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.time-item {
  padding: 10px 11px;
}

.time-item-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.time-item-title,
.time-timer-label {
  font-size: 0.8rem;
  color: var(--text-primary);
  font-weight: 600;
}

.time-item-status,
.time-inline-pill {
  border-radius: var(--radius-full);
  padding: 2px 8px;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.time-inline-pill {
  background: rgba(139,92,246,0.12);
  color: var(--accent-a-light);
  border: 1px solid rgba(139,92,246,0.22);
}

.time-item-status.pending {
  background: rgba(245,158,11,0.13);
  color: var(--accent-warning);
  border: 1px solid rgba(245,158,11,0.22);
}

.time-item-status.active {
  background: rgba(34,211,238,0.12);
  color: var(--accent-b-light);
  border: 1px solid rgba(34,211,238,0.22);
}

.time-item-status.complete {
  background: rgba(74,222,128,0.11);
  color: var(--accent-success);
  border: 1px solid rgba(74,222,128,0.18);
}

.time-item-foot {
  margin-top: 8px;
  font-size: 0.68rem;
  color: var(--text-faint);
}

.time-item-actions,
.dm-time-quick,
.dm-time-save-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.time-empty {
  padding: 10px 12px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-md);
  font-size: 0.76rem;
  color: var(--text-muted);
}

.time-timer-card {
  padding: 11px 12px;
}

.time-timer-count {
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 1.2rem;
  color: var(--text-primary);
}

.dm-time-controls {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.dm-time-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.dm-time-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.7rem;
  color: var(--text-muted);
}

.dm-time-field span {
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.dm-time-field input,
.dm-time-field select,
.dm-time-field textarea {
  width: 100%;
  padding: 7px 9px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.78rem;
  font-family: var(--font-body);
  outline: none;
  resize: vertical;
}

.dm-time-field-wide {
  grid-column: 1 / -1;
}

.dm-time-divider {
  height: 1px;
  background: var(--border);
  margin: 2px 0;
}

.table-live-timer-card {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 8px;
  border-radius: 999px;
  border: 1px solid rgba(139,92,246,0.22);
  background: rgba(139,92,246,0.08);
  max-width: 220px;
}

.table-live-timer-ring {
  width: 34px;
  height: 34px;
  transform: rotate(-90deg);
  flex-shrink: 0;
}

.table-live-timer-track,
.table-live-timer-progress {
  fill: none;
  stroke-width: 4;
}

.table-live-timer-track {
  stroke: rgba(255,255,255,0.08);
}

.table-live-timer-progress {
  stroke: var(--accent-a-light);
  stroke-linecap: round;
  transition: stroke-dashoffset 0.6s linear;
}

.table-live-timer-copy {
  min-width: 0;
}

.table-live-timer-label {
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table-live-timer-value {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  color: var(--text-primary);
  margin-top: 2px;
}

/* ---- Chapter navigator ---- */
.chapter-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.chapter-header {
  padding: 12px 14px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
}

.chapter-title {
  font-family: var(--font-display);
  font-size: 0.85rem;
  color: var(--accent-gold-v);
}

.chapter-scene {
  padding: 12px 14px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.65;
  border-bottom: 1px solid var(--border);
}

.chapter-dm-notes {
  padding: 12px 14px;
  background: rgba(212,175,55,0.05);
  border-left: 3px solid var(--accent-gold);
}

.chapter-dm-notes-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-gold);
  margin-bottom: 6px;
  font-weight: 600;
}

.chapter-dm-notes-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.65;
  white-space: pre-wrap;
}

/* ---- Party panel ---- */
.party-member {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
  transition: background 0.15s;
  cursor: default;
}

.party-member:hover { background: var(--bg-card); }

.party-member-info { flex: 1; min-width: 0; }
.party-member-name { font-size: 0.82rem; font-weight: 600; color: var(--text-primary); }
.party-member-char { font-size: 0.72rem; color: var(--text-muted); }

.char-art-placeholder {
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  color: var(--text-muted);
  font-size: 0.78rem;
  text-align: center;
  background:
    radial-gradient(circle at top, rgba(139,92,246,0.16), transparent 52%),
    linear-gradient(135deg, rgba(15,23,42,0.55), rgba(30,41,59,0.12));
}

.hp-bar {
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  margin-top: 4px;
  overflow: hidden;
}

.hp-bar-fill {
  height: 100%;
  border-radius: 2px;
  background: var(--accent-success);
  transition: width 0.4s ease, background 0.4s ease;
}

.hp-bar-fill[data-pct="bloodied"] { background: var(--accent-warning); }
.hp-bar-fill[data-pct="critical"] { background: var(--accent-danger); }

/* ---- DM Hub ---- */
.dmhub-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-width: 900px;
  margin: 0 auto;
  padding: 0 24px 40px;
}

.dmhub-header {
  padding: 32px 0 24px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 28px;
}

.dmhub-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.dmhub-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
}

.dmhub-body {
  display: flex;
  flex-direction: column;
  gap: 36px;
}

.dmhub-section {}

.dmhub-section-label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.dmhub-count {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 0.68rem;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border);
}

.dmhub-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 32px 20px;
  text-align: center;
  background: var(--bg-surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
}

.dmhub-empty-icon { font-size: 2rem; opacity: 0.4; }
.dmhub-empty-title { font-size: 0.9rem; font-weight: 600; color: var(--text-secondary); }
.dmhub-empty-desc { font-size: 0.82rem; color: var(--text-muted); max-width: 280px; line-height: 1.55; }

.dmhub-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  margin-bottom: 8px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.dmhub-row:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow-card);
}

.dmhub-row-active {
  border-color: rgba(212,175,55,0.3);
  background: rgba(212,175,55,0.04);
}

.dmhub-row-active:hover { border-color: rgba(212,175,55,0.5); }

.dmhub-row-status { flex-shrink: 0; }

.dmhub-row-info { flex: 1; min-width: 0; }

.dmhub-row-name {
  font-family: var(--font-display);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 5px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.dmhub-row-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 4px;
}

.dmhub-row-stats {
  display: flex;
  gap: 14px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.dmhub-row-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* Urgency dot — shared with old dm-table-card */
.dm-urgency {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.dm-urgency.high { background: var(--accent-danger); box-shadow: 0 0 8px var(--accent-danger); animation: pulse 1.5s infinite; }
.dm-urgency.medium { background: var(--accent-warning); }
.dm-urgency.low { background: var(--accent-success); }

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ---- Admin / Dev Panel ---- */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 60px; height: 60px;
  background: var(--accent-a);
  opacity: 0.05;
  border-radius: 0 var(--radius-lg) 0 100%;
}

.stat-card-value {
  font-family: var(--font-mono);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--accent-a-light);
  line-height: 1;
  margin-bottom: 6px;
}

.stat-card-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ---- Data table ---- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.data-table th {
  text-align: left;
  padding: 10px 14px;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
}

.data-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  vertical-align: middle;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--bg-card); color: var(--text-primary); }

/* ---- Activity feed ---- */
.activity-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
}

.activity-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-a);
  flex-shrink: 0;
  margin-top: 4px;
}

.activity-text { color: var(--text-secondary); flex: 1; line-height: 1.4; }
.activity-user { color: var(--accent-a-light); font-weight: 500; }
.activity-time { font-size: 0.72rem; color: var(--text-muted); flex-shrink: 0; }

/* ---- Dice roller widget ---- */
.dice-roller {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
}

.dice-roller-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.dice-buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  margin-bottom: 10px;
}

.dice-btn {
  padding: 7px 4px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}

.dice-btn:hover {
  background: var(--accent-a-dim);
  color: var(--accent-a-light);
  border-color: var(--accent-a);
}

.dice-output {
  min-height: 36px;
  background: var(--bg-base);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  font-family: var(--font-mono);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.dice-output.rolled { color: var(--accent-a-light); animation: diceFlash 0.3s ease; }

@keyframes diceFlash {
  0% { background: rgba(139,92,246,0.2); }
  100% { background: var(--bg-base); }
}

/* ---- Profile modal ---- */
.color-picker-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
  margin-top: 6px;
}

.color-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
}

.color-dot:hover, .color-dot.active { border-color: var(--text-primary); transform: scale(1.15); }

.macro-manager-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.macro-manager-item:last-child {
  border-bottom: none;
}

.macro-manager-expansion {
  margin-top: 6px;
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.macro-manager-scope {
  font-size: 0.65rem;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  border: 1px solid var(--border-light);
  color: var(--text-muted);
  background: var(--bg-card);
}

/* ---- Invite code display ---- */
.invite-code {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 14px;
}

.invite-code-value {
  font-family: var(--font-mono);
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--accent-a-light);
  letter-spacing: 0.15em;
  flex: 1;
}

.session-lock-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 1px 3px;
  border-radius: var(--radius-sm);
  opacity: 0.55;
  transition: opacity var(--transition), transform var(--transition);
  line-height: 1;
}
.session-lock-btn:hover { opacity: 0.9; transform: scale(1.15); }
.session-lock-btn.locked { opacity: 0.9; }

/* ---- Section headers ---- */
.section-title {
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* ---- Toggle switch ---- */
.toggle-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}

.toggle {
  position: relative;
  width: 42px;
  height: 24px;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-slider {
  position: absolute;
  inset: 0;
  background: var(--border-light);
  border-radius: 24px;
  cursor: pointer;
  transition: all 0.2s;
}

.toggle-slider::before {
  content: '';
  position: absolute;
  height: 18px; width: 18px;
  left: 3px; top: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s;
}

input:checked + .toggle-slider { background: var(--accent-a); }
input:checked + .toggle-slider::before { transform: translateX(18px); }

.toggle-label { font-size: 0.875rem; color: var(--text-secondary); }

/* ---- Inline markdown rendering ---- */
.post-content p { margin-bottom: 8px; }
.post-content p:last-child { margin-bottom: 0; }
.post-content blockquote {
  border-left: 3px solid var(--accent-a);
  padding-left: 12px;
  color: var(--text-secondary);
  font-style: italic;
  margin: 8px 0;
}

/* ---- Scroll to bottom btn ---- */
.scroll-bottom-btn {
  position: absolute;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--accent-a);
  color: white;
  border: none;
  border-radius: var(--radius-full);
  padding: 6px 16px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--glow-a);
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
  font-family: var(--font-body);
}

.scroll-bottom-btn.visible { opacity: 1; pointer-events: all; }

/* ---- Mini progress bar ---- */
.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 8px;
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--accent-a), var(--accent-b));
  transition: width 0.5s ease;
}

/* ---- Character Roster (Dashboard) ---- */
.char-roster {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.char-roster-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  min-width: 200px;
  flex: 1 1 200px;
  max-width: 320px;
}
.char-roster-card:hover {
  border-color: var(--accent-a);
  background: var(--bg-surface);
}

.char-roster-portrait {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-surface);
  border: 1px solid var(--border);
}
.char-roster-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.char-roster-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: var(--text-secondary);
}

.char-roster-info {
  flex: 1;
  min-width: 0;
}
.char-roster-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.char-roster-class {
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.char-roster-hp-bar {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 6px;
}
.char-roster-hp-fill {
  height: 100%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--accent-a), var(--accent-b));
  transition: width 0.3s ease;
}
.char-roster-hp-label {
  font-size: 0.68rem;
  color: var(--text-secondary);
  margin-top: 3px;
}

.char-roster-empty {
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-style: italic;
  padding: 8px 0;
}

/* ---- Character Maker Modal ---- */
.char-maker-portrait-row {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.char-maker-portrait {
  width: 80px;
  height: 80px;
  border-radius: var(--radius-md);
  overflow: hidden;
  flex-shrink: 0;
  background: var(--bg-surface);
  border: 2px dashed var(--border);
  cursor: pointer;
  transition: border-color 0.15s;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.char-maker-portrait:hover { border-color: var(--accent-a); }
.char-maker-portrait img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.char-maker-portrait-placeholder {
  font-size: 1.8rem;
  color: var(--text-secondary);
  pointer-events: none;
}
.char-maker-portrait-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  justify-content: center;
}

/* Preset variable chips */
.char-preset-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.char-preset-chip {
  padding: 3px 10px;
  font-size: 0.72rem;
  font-family: var(--font-mono, monospace);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  user-select: none;
}
.char-preset-chip:hover,
.char-preset-chip.active {
  background: var(--accent-a);
  border-color: var(--accent-a);
  color: #fff;
}

/* ---- Help / Tutorial button ---- */
.nav-help-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  flex-shrink: 0;
}
.nav-help-btn:hover {
  background: var(--bg-elevated);
  color: var(--accent-a-light);
  border-color: var(--accent-a);
}
.nav-help-btn svg {
  width: 15px;
  height: 15px;
  stroke-width: 2;
}

/* ---- Tutorial modal ---- */
.tutorial-modal {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ---- Tutorial code blocks ---- */
.tut-code {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  color: var(--accent-a-light);
  white-space: pre;
  overflow-x: auto;
  line-height: 1.6;
  margin: 8px 0;
  display: block;
}

/* ---- Tutorial mock scene ---- */
.tut-scene {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 10px 0;
  padding: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.tut-scene-post {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-light);
}
.tut-scene-post:last-child { border-bottom: none; padding-bottom: 0; }
.tut-scene-who {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--accent-a-light);
}
.tut-scene-line {
  font-size: 0.82rem;
  color: var(--text-primary);
  line-height: 1.55;
}
.tut-scene-note {
  font-size: 0.7rem;
  color: var(--text-faint);
  font-style: italic;
  margin-top: 2px;
}

/* ---- Tutorial compare blocks ---- */
.tut-compare {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 10px 0;
}
.tut-compare-col {
  padding: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.tut-compare-label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.tut-compare-text {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ---- DM tutorial examples ---- */
.tut-dm-examples {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 8px 0;
}
.tut-dm-ex {
  padding: 8px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent-danger);
  border-radius: var(--radius-md);
}
.tut-dm-ex-label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin-bottom: 3px;
}
.tut-dm-ex-text {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* ---- DM macro row ---- */
.tut-macro-row {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-secondary);
  padding: 4px 0;
  border-bottom: 1px solid var(--border-light);
}
.tut-macro-row:last-child { border-bottom: none; }
.tut-macro-row code { flex-shrink: 0; }

/* ================================================================
   PULSE METER
   ================================================================ */
.pulse-meter {
  display: flex;
  align-items: center;
  gap: 6px;
}
.pulse-meter-display {
  flex-shrink: 0;
}
.pulse-ecg {
  width: 52px;
  height: 22px;
  color: var(--ecg-color, #10b981);
  position: relative;
  overflow: hidden;
}
.pulse-ecg svg {
  width: 100%;
  height: 100%;
}
.ecg-line {
  stroke: currentColor;
  animation: ecgScroll linear infinite;
}
/* Speed tiers */
.pulse-dormant .ecg-line { animation-duration: 4.5s; opacity: 0.5; }
.pulse-slow    .ecg-line { animation-duration: 2.8s; }
.pulse-steady  .ecg-line { animation-duration: 1.8s; }
.pulse-active  .ecg-line { animation-duration: 1.1s; }
.pulse-frantic .ecg-line { animation-duration: 0.55s; }

@keyframes ecgScroll {
  0%   { stroke-dasharray: 0 200; stroke-dashoffset: 0; }
  40%  { stroke-dasharray: 60 140; stroke-dashoffset: -20; }
  70%  { stroke-dasharray: 60 140; stroke-dashoffset: -80; }
  100% { stroke-dasharray: 0 200; stroke-dashoffset: -200; }
}

.pulse-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

/* Interactive pip picker */
.pulse-meter-interactive {
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}
.pulse-pips {
  display: flex;
  gap: 6px;
  align-items: center;
}
.pulse-pip {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--pip-color, #64748b);
  background: transparent;
  cursor: pointer;
  transition: background 0.18s, transform 0.15s;
  position: relative;
}
.pulse-pip::after {
  content: '';
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: var(--pip-color, #64748b);
  opacity: 0;
  transition: opacity 0.18s;
}
.pulse-pip.active::after,
.pulse-pip:hover::after { opacity: 1; }
.pulse-pip:hover { transform: scale(1.15); }

/* Pulse on table cards */
.table-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}
.table-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.3;
}

/* ================================================================
   MODULE VAULT
   ================================================================ */
.vault-quota {
  margin-bottom: 14px;
}
.vault-quota-bar {
  height: 5px;
  background: var(--bg-elevated);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 4px;
}
.vault-quota-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}
.vault-quota-label {
  font-size: 0.72rem;
  color: var(--text-muted);
}
.vault-upload-zone {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 20px;
  margin-bottom: 16px;
  cursor: pointer;
  border: 2px dashed var(--border);
  border-radius: var(--radius-md);
  transition: border-color 0.18s, background 0.18s;
  font-size: 0.82rem;
  color: var(--text-secondary);
}
.vault-upload-zone:hover,
.vault-upload-zone.drag-over {
  border-color: var(--accent-b);
  background: rgba(6,182,212,0.04);
}
.vault-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 10px;
  max-height: 400px;
  overflow-y: auto;
}
.vault-pick-grid {
  max-height: 440px;
  cursor: pointer;
}
.vault-asset-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 6px;
  transition: border-color 0.15s, transform 0.15s;
}
.vault-pick-card:hover {
  border-color: var(--accent-b);
  transform: scale(1.03);
}
.vault-thumb {
  width: 100%;
  height: 72px;
  object-fit: cover;
  display: block;
}
.vault-thumb-audio,
.vault-thumb-video {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  background: var(--bg-elevated);
  color: var(--text-muted);
}
.vault-asset-name {
  font-size: 0.68rem;
  color: var(--text-secondary);
  padding: 0 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.vault-asset-meta {
  font-size: 0.62rem;
  color: var(--text-faint);
  padding: 0 6px;
}
.vault-asset-actions {
  display: flex;
  gap: 4px;
  padding: 0 6px;
}
.vault-empty {
  grid-column: 1/-1;
  text-align: center;
  color: var(--text-faint);
  font-size: 0.82rem;
  padding: 24px 0;
}
.btn-xs {
  font-size: 0.68rem;
  padding: 2px 7px;
  border-radius: 4px;
}

/* ================================================================
   INVENTORY
   ================================================================ */
.inv-empty {
  text-align: center;
  color: var(--text-faint);
  font-size: 0.84rem;
  padding: 32px 0;
}
.inv-section {
  margin-bottom: 16px;
}
.inv-section-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.inv-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.inv-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color 0.15s;
}
.inv-item:hover { border-color: var(--accent-a-light); }
.inv-item-icon {
  font-size: 1.3rem;
  line-height: 1;
  flex-shrink: 0;
  width: 28px;
  text-align: center;
}
.inv-item-body {
  flex: 1;
  min-width: 0;
}
.inv-item-name {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-primary);
}
.inv-item-desc {
  font-size: 0.74rem;
  color: var(--text-secondary);
  margin-top: 2px;
  line-height: 1.4;
}
.inv-item-tags {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 4px;
  flex-wrap: wrap;
}
.inv-item-val {
  font-size: 0.68rem;
  color: var(--accent-gold-v);
}
.inv-item-qty {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
}
.inv-drop-btn {
  opacity: 0;
  transition: opacity 0.15s;
}
.inv-item:hover .inv-drop-btn { opacity: 1; }

/* Compact party list variant */
.inv-item--compact { padding: 5px 8px; }
.inv-item--compact .inv-item-name { font-size: 0.82rem; }

/* Item origin tag */
.inv-item-origin {
  font-size: 0.63rem;
  color: var(--text-faint);
  font-style: italic;
}

/* Coin purse */
.inv-purse-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0 12px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 14px;
}
.coin-purse {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.coin-purse--empty {
  color: var(--text-faint);
  font-size: 0.75rem;
  font-style: italic;
}
.coin-chip {
  display: inline-flex;
  align-items: baseline;
  gap: 3px;
  padding: 2px 7px;
  background: rgba(212,175,55,0.1);
  border: 1px solid rgba(212,175,55,0.22);
  border-radius: 12px;
  font-size: 0.75rem;
  white-space: nowrap;
}
.coin-chip-val {
  font-weight: 700;
  color: var(--accent-gold-v, #d4af37);
}
.coin-chip-denom {
  color: var(--text-muted);
  font-size: 0.66rem;
  text-transform: lowercase;
}

/* Party inventory panel */
.party-inv-member {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.party-inv-member:last-child { border-bottom: none; margin-bottom: 0; }
.party-inv-member-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.party-inv-member-name {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text-primary);
}
.party-inv-list { gap: 4px; }

/* Coin award form grid */
.coin-award-grid {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 6px 0 10px;
  padding: 10px;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
}
.coin-award-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.coin-award-label {
  font-size: 0.82rem;
  color: var(--text-secondary);
  text-transform: lowercase;
  min-width: 60px;
}

/* Market balance bar (player's purse shown in market) */
.market-balance-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(212,175,55,0.05);
  border: 1px solid rgba(212,175,55,0.15);
  border-radius: var(--radius-md);
  margin-bottom: 12px;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Rarity badge */
.rarity-badge {
  font-size: 0.62rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 1px 5px;
  border: 1px solid currentColor;
  border-radius: 3px;
}

/* ================================================================
   MARKETS
   ================================================================ */
.market-desc {
  font-size: 0.82rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
  font-style: italic;
}
.market-dm-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 10px;
  background: rgba(212,175,55,0.05);
  border: 1px solid rgba(212,175,55,0.18);
  border-radius: var(--radius-md);
  margin-bottom: 14px;
}
.market-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
  max-height: 440px;
  overflow-y: auto;
}
.market-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  transition: border-color 0.15s, transform 0.15s;
}
.market-card:hover { border-color: var(--accent-a); transform: translateY(-1px); }
.market-card-icon {
  font-size: 1.6rem;
  text-align: center;
  margin-bottom: 2px;
}
.market-card-name {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
}
.market-card-desc {
  font-size: 0.72rem;
  color: var(--text-secondary);
  text-align: center;
  line-height: 1.4;
}
.market-card-stock {
  font-size: 0.68rem;
  color: var(--text-faint);
  text-align: center;
}
.market-card-price {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 3px;
  margin-top: 4px;
}
.market-price-num {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--accent-gold-v);
}
.market-price-cur {
  font-size: 0.72rem;
  color: var(--text-muted);
}
.markets-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.market-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color 0.15s;
}
.market-list-row:hover { border-color: var(--accent-a); }
.market-list-name {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
}
.market-list-desc {
  font-size: 0.74rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* ---- Asset upload row (upload zone + vault pick button side by side) ---- */
.asset-upload-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}
.asset-upload-row .upload-zone {
  flex: 1;
}
.asset-upload-row .vault-pick-btn {
  align-self: center;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ════════════════════════════════════════════════════════
   CHARACTER CARD POST (feed post_type=character_card)
   ════════════════════════════════════════════════════════ */
.char-card-post {
  display: flex;
  gap: 14px;
  background: linear-gradient(135deg, var(--bg-card) 0%, var(--bg-elevated) 100%);
  border: 1px solid var(--accent-a);
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.25);
  margin: 4px 0;
}
.char-card-post-art {
  flex-shrink: 0;
  width: 72px;
  height: 88px;
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
}
.char-card-post-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.char-card-post-art-placeholder {
  font-size: 2rem;
  line-height: 1;
  opacity: 0.5;
}
.char-card-post-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.char-card-post-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}
.char-card-post-name {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.char-card-post-class {
  font-size: 0.78rem;
  color: var(--accent-a-light);
  font-style: italic;
  margin-top: 1px;
}
.char-card-post-bio {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.45;
  margin-top: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.char-card-post-theme {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 0.72rem;
  color: var(--accent-b);
  margin-top: 4px;
  text-decoration: none;
  opacity: 0.85;
  transition: opacity 0.15s;
}
.char-card-post-theme:hover { opacity: 1; text-decoration: underline; }
.char-card-post-uuid {
  font-size: 0.65rem;
  color: var(--text-faint);
  font-family: monospace;
  margin-top: 6px;
  letter-spacing: 0.04em;
}
.char-card-post-player {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

/* ════════════════════════════════════════════════════════
   CHARACTER UUID BADGE (inside character modal)
   ════════════════════════════════════════════════════════ */
.char-uuid-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-sunken);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 0.68rem;
  font-family: monospace;
  color: var(--text-faint);
  letter-spacing: 0.06em;
  user-select: all;
}

/* ════════════════════════════════════════════════════════
   BIO / THEME SONG IN SIDEBAR CHARACTER CARD & PARTY LIST
   ════════════════════════════════════════════════════════ */
.char-bio-snippet {
  font-size: 0.74rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-top: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.char-theme-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.7rem;
  color: var(--accent-b);
  text-decoration: none;
  margin-top: 3px;
  opacity: 0.8;
  transition: opacity 0.15s;
}
.char-theme-link:hover { opacity: 1; text-decoration: underline; }

.party-member-bio {
  font-size: 0.73rem;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-top: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ════════════════════════════════════════════════════════
   DM STYLE METER (sidebar accordion + DM Hub)
   ════════════════════════════════════════════════════════ */
.dm-style-meter {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 0 4px;
}
.dm-style-meter-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-muted);
  margin-bottom: 2px;
}
.dm-style-axis {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.dm-style-axis-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.67rem;
  color: var(--text-faint);
}
.dm-style-axis-lo { text-align: left; }
.dm-style-axis-hi { text-align: right; }
.dm-style-bar-track {
  position: relative;
  height: 6px;
  background: var(--bg-sunken);
  border-radius: 3px;
  overflow: visible;
}
.dm-style-bar-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: linear-gradient(90deg, var(--accent-b) 0%, var(--accent-a) 100%);
  border-radius: 3px;
  transition: width 0.3s ease;
}
.dm-style-bar-dot {
  position: absolute;
  top: 50%;
  width: 10px;
  height: 10px;
  background: var(--accent-a-light);
  border: 2px solid var(--bg-card);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: left 0.3s ease;
  box-shadow: 0 0 4px rgba(0,0,0,0.4);
}
.dm-style-note {
  font-size: 0.75rem;
  color: var(--text-secondary);
  font-style: italic;
  line-height: 1.4;
  padding: 6px 0 0;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
