/* ============================================================
   ECHOES — Main Stylesheet
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { font-size: 15px; scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background: var(--bg-base);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  line-height: 1.6;
}

/* ---- Layout ---- */
#app {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  height: 100vh;
  z-index: 100;
  transition: transform var(--transition);
}

.sidebar.hidden { transform: translateX(-100%); }

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  transition: margin-left var(--transition);
}

.main-content.full-width { margin-left: 0; }

/* ---- Sidebar ---- */
.sidebar-logo {
  padding: 20px 18px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}

.logo-glyph {
  font-size: 22px;
  color: var(--accent-a);
  filter: drop-shadow(var(--glow-a));
  line-height: 1;
}

.logo-text {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.05em;
}

.nav-section {
  flex: 1;
  padding: 12px 0;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 0;
  position: relative;
  transition: color var(--transition), background var(--transition);
}

.nav-item svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.nav-item:hover {
  color: var(--text-primary);
  background: var(--bg-card);
}

.nav-item.active {
  color: var(--accent-a-light);
  background: var(--bg-card);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  background: var(--accent-a);
  border-radius: 0 3px 3px 0;
  box-shadow: var(--glow-a);
}

.nav-subitem {
  padding: 7px 18px 7px 42px;
  font-size: 0.76rem;
  color: var(--text-muted);
  gap: 8px;
}

.nav-subitem .nav-subicon {
  font-size: 0.72rem;
  color: var(--accent-b-light);
  line-height: 1;
}

.nav-subitem.active::before {
  left: 14px;
  top: 7px;
  bottom: 7px;
  width: 2px;
}

.nav-bottom {
  padding: 12px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-notif-btn {
  position: relative;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-secondary);
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
}

.nav-notif-btn:hover { color: var(--text-primary); background: var(--bg-card); }

.nav-notif-btn svg {
  width: 18px; height: 18px;
  stroke: currentColor; fill: none;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}

.notif-badge {
  position: absolute;
  top: 4px; right: 4px;
  background: var(--accent-danger);
  color: white;
  font-size: 10px;
  font-weight: 700;
  min-width: 16px;
  height: 16px;
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 3px;
  line-height: 1;
  box-shadow: var(--glow-danger);
}

.nav-user {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  transition: background var(--transition);
  min-width: 0;
}

.nav-user:hover { background: var(--bg-card); }

#nav-username {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.theme-toggle {
  width: 32px; height: 32px;
  display: flex; align-items: center; justify-content: center;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  flex-shrink: 0;
}

.theme-toggle:hover {
  color: var(--accent-b-light);
  border-color: var(--accent-b);
  background: var(--bg-card);
}

.theme-toggle svg {
  width: 15px; height: 15px;
  stroke: currentColor; fill: none;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}

/* ---- Avatars ---- */
.avatar-sm, .avatar-md, .avatar-lg {
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-family: var(--font-display);
  color: white;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-md { width: 40px; height: 40px; font-size: 15px; }
.avatar-lg { width: 56px; height: 56px; font-size: 20px; }

/* ---- Overlay & Modal ---- */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  z-index: 200;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-content {
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  max-width: 560px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.modal-title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--text-primary);
}

.modal-close {
  width: 30px; height: 30px;
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  transition: all var(--transition);
}

.modal-close:hover { background: var(--bg-card); color: var(--text-primary); }

/* ---- Notification Panel ---- */
.notif-panel {
  position: fixed;
  bottom: 60px;
  left: 12px;
  width: 320px;
  max-height: 480px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  z-index: 1100;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.notif-header h3 {
  font-family: var(--font-display);
  font-size: 0.9rem;
  color: var(--text-primary);
}

.notif-list { flex: 1; overflow-y: auto; }

.notif-item {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background var(--transition);
}

.notif-item:hover { background: var(--bg-card); }
.notif-item.unread { border-left: 3px solid var(--accent-a); }
.notif-item-title { font-size: 0.82rem; font-weight: 600; color: var(--text-primary); margin-bottom: 2px; }
.notif-item-body { font-size: 0.75rem; color: var(--text-muted); line-height: 1.4; }
.notif-item-time { font-size: 0.7rem; color: var(--text-faint); margin-top: 4px; }

/* ---- User menu ---- */
.user-menu {
  position: fixed;
  bottom: 60px;
  left: 12px;
  width: 220px;
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  z-index: 1100;
  overflow: hidden;
}

.user-menu-header {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border);
}

.menu-display-name { font-size: 0.875rem; font-weight: 600; color: var(--text-primary); }
.menu-role { font-size: 0.72rem; color: var(--accent-a-light); text-transform: capitalize; }
.user-menu-items { padding: 6px; }

.menu-item {
  display: block;
  width: 100%;
  padding: 8px 12px;
  background: none;
  border: none;
  color: var(--text-secondary);
  text-align: left;
  cursor: pointer;
  font-size: 0.85rem;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  font-family: var(--font-body);
}

.menu-item:hover { background: var(--bg-card); color: var(--text-primary); }
.menu-item.danger { color: var(--accent-danger); }
.menu-item.danger:hover { background: rgba(244,63,94,0.1); }

.menu-divider { border: none; border-top: 1px solid var(--border); margin: 4px 0; }

/* ---- Theme Picker ---- */
.theme-picker {
  position: fixed;
  bottom: 60px;
  left: calc(var(--sidebar-width) - 12px);
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  z-index: 1100;
  box-shadow: var(--shadow-modal);
}

.theme-picker-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 10px;
}

.theme-swatches { display: flex; gap: 8px; }

.swatch {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  cursor: pointer;
  transition: all var(--transition);
}

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

.swatch-custom {
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-picker-divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 10px 0;
}

.custom-theme-panel {
  position: fixed;
  bottom: 60px;
  left: calc(var(--sidebar-width) + 130px);
  background: var(--bg-surface);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  z-index: 1101;
  box-shadow: var(--shadow-modal);
  width: 220px;
}

.custom-theme-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 12px;
  letter-spacing: 0.04em;
}

.custom-theme-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.custom-theme-label {
  font-size: 0.72rem;
  color: var(--text-secondary);
}

.custom-theme-color {
  width: 36px;
  height: 24px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  background: none;
  cursor: pointer;
  padding: 0;
}

/* ---- Page containers ---- */
.page { padding: 28px 32px; max-width: 1280px; }
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 28px;
  gap: 16px;
}

.page-title {
  font-family: var(--font-display);
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: 0.03em;
}

.page-subtitle {
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ---- Utility ---- */
.hidden { display: none !important; }
/* Role-gated elements — visibility managed by JS via .hidden class only */
/* .dm-only, .admin-only, .player-only: initial hidden state set in HTML via class="... hidden" */

.text-accent { color: var(--accent-a-light); }
.text-muted { color: var(--text-muted); }
.text-success { color: var(--accent-success); }
.text-danger { color: var(--accent-danger); }
.text-gold { color: var(--accent-gold-v); }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-4 { gap: 16px; }
.gap-6 { gap: 24px; }

/* ---- Landing page ---- */
.landing {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.landing-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse at 20% 40%, rgba(139,92,246,0.12) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 60%, rgba(6,182,212,0.08) 0%, transparent 60%),
    var(--bg-base);
}

.landing-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 2px 2px, rgba(139,92,246,0.04) 1px, transparent 0);
  background-size: 32px 32px;
}

.landing-ghost-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.landing-content {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 60px;
  align-items: center;
  max-width: 960px;
  width: 100%;
  padding: 40px 24px;
}

.landing-left { }

.landing-eyebrow {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent-a);
  margin-bottom: 16px;
  font-weight: 600;
}

.landing-title {
  font-family: var(--font-display);
  font-size: 3rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.15;
  margin-bottom: 20px;
}

.landing-title span {
  color: var(--accent-a-light);
  text-shadow: var(--glow-a);
}

.landing-desc {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.7;
  margin-bottom: 28px;
}

.landing-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 24px;
}

.landing-pill {
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-light);
  background: rgba(139,92,246,0.08);
  color: var(--accent-a-light);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.landing-features {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 28px;
}

.landing-feature {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.landing-feature::before {
  content: '◆';
  color: var(--accent-a);
  font-size: 8px;
}

.landing-session-shell {
  position: relative;
  border: 1px solid rgba(139,92,246,0.16);
  border-radius: 22px;
  padding: 18px 18px 16px;
  background:
    linear-gradient(180deg, rgba(10,14,26,0.76), rgba(10,14,26,0.4)),
    radial-gradient(circle at top left, rgba(139,92,246,0.16), transparent 52%);
  backdrop-filter: blur(8px);
  box-shadow: 0 20px 60px rgba(5,8,18,0.22);
}

.landing-session-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.landing-session-note {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.landing-session-stream {
  display: grid;
  gap: 10px;
}

.landing-session-insert {
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(255,255,255,0.03);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.landing-session-type {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-b-light);
  margin-bottom: 8px;
}

.landing-session-copy {
  margin: 0;
  font-family: var(--font-display);
  font-size: 0.9rem;
  line-height: 1.65;
  color: rgba(236,242,255,0.92);
}

.landing-session-empty {
  padding: 12px 14px;
  border: 1px dashed rgba(255,255,255,0.08);
  border-radius: 16px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.landing-ghost-echo {
  position: absolute;
  left: var(--ghost-x);
  top: var(--ghost-y);
  width: min(var(--ghost-width), 26vw);
  font-family: var(--font-display);
  font-size: clamp(0.9rem, 1.2vw, 1.15rem);
  line-height: 1.6;
  color: rgba(234,239,255,0.2);
  opacity: 0;
  filter: blur(var(--ghost-blur));
  transform: translate3d(0, 0, 0) rotate(var(--ghost-rotate));
  text-shadow: 0 0 30px rgba(139,92,246,0.14);
  animation:
    landing-ghost-drift var(--ghost-duration) ease-in-out infinite,
    landing-ghost-fade calc(var(--ghost-duration) * 0.75) ease-in-out infinite;
  animation-delay: var(--ghost-delay), var(--ghost-delay);
  white-space: normal;
}

@keyframes landing-ghost-drift {
  0% {
    transform: translate3d(0, 18px, 0) rotate(var(--ghost-rotate)) scale(0.97);
  }
  50% {
    transform: translate3d(8px, -16px, 0) rotate(calc(var(--ghost-rotate) + 2deg)) scale(1.02);
  }
  100% {
    transform: translate3d(-6px, 20px, 0) rotate(calc(var(--ghost-rotate) - 2deg)) scale(0.98);
  }
}

@keyframes landing-ghost-fade {
  0%, 100% {
    opacity: 0;
    filter: blur(calc(var(--ghost-blur) + 4px));
  }
  20% {
    opacity: 0.08;
    filter: blur(var(--ghost-blur));
  }
  48% {
    opacity: 0.18;
    filter: blur(calc(var(--ghost-blur) - 2px));
  }
  72% {
    opacity: 0.1;
    filter: blur(calc(var(--ghost-blur) + 1px));
  }
}

.landing-right {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: var(--shadow-card);
}

.landing-card-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  color: var(--accent-a);
  font-weight: 600;
  margin-bottom: 14px;
}

.landing-card-title {
  font-family: var(--font-display);
  font-size: 1.8rem;
  line-height: 1.2;
  color: var(--text-primary);
  margin-bottom: 12px;
}

.landing-card-desc {
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.65;
  margin-bottom: 20px;
}

.landing-login-banner {
  background: rgba(245,158,11,0.1);
  border: 1px solid rgba(245,158,11,0.24);
  color: var(--text-secondary);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  font-size: 0.82rem;
  line-height: 1.55;
  margin-bottom: 18px;
}

.landing-link-row {
  margin-top: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.landing-inline-link {
  color: var(--accent-a-light);
  text-decoration: none;
}

.landing-inline-link:hover {
  text-decoration: underline;
}

.interest-role-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 18px;
}

.interest-role-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 14px 14px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color var(--transition), transform var(--transition), background var(--transition);
  font-family: var(--font-body);
  text-align: left;
}

.interest-role-btn:hover,
.interest-role-btn.active {
  border-color: var(--accent-a);
  background: rgba(139,92,246,0.08);
  color: var(--text-primary);
  transform: translateY(-1px);
}

.interest-role-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.interest-role-copy {
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.auth-tabs {
  display: flex;
  background: var(--bg-card);
  border-radius: var(--radius-md);
  padding: 4px;
  margin-bottom: 24px;
}

.auth-tab {
  flex: 1;
  padding: 8px;
  background: none;
  border: none;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  font-family: var(--font-body);
}

.auth-tab.active {
  background: var(--bg-elevated);
  color: var(--accent-a-light);
}

/* ---- Forms ---- */
.form-group { margin-bottom: 16px; }
.form-success { color: var(--accent-success); }

label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
  letter-spacing: 0.02em;
}

input[type="text"], input[type="email"], input[type="password"],
input[type="number"], select, textarea {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-family: var(--font-body);
  font-size: 0.9rem;
  padding: 10px 14px;
  outline: none;
  transition: border-color var(--transition), box-shadow var(--transition);
  -webkit-appearance: none;
}

input:focus, select:focus, textarea:focus {
  border-color: var(--accent-a);
  box-shadow: 0 0 0 3px rgba(139,92,246,0.15);
}

select option { background: var(--bg-card); }
textarea { resize: vertical; min-height: 80px; line-height: 1.6; }

.form-hint { font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 0.8rem; color: var(--accent-danger); margin-top: 6px; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  border: none;
  transition: all var(--transition);
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary {
  background: var(--accent-a);
  color: white;
  box-shadow: var(--glow-a);
}

.btn-primary:hover {
  background: var(--accent-a-light);
  transform: translateY(-1px);
}

.btn-secondary {
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--border-light);
}

.btn-secondary:hover { background: var(--bg-hover); }

.btn-ghost {
  background: none;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-ghost:hover { background: var(--bg-card); color: var(--text-primary); }

.btn-danger {
  background: var(--accent-danger);
  color: white;
}

.btn-danger:hover { opacity: 0.85; }

.btn-success {
  background: var(--accent-success);
  color: white;
}

.btn-sm { padding: 6px 14px; font-size: 0.8rem; }
.btn-lg { padding: 13px 28px; font-size: 0.95rem; }
.btn-full { width: 100%; }
.btn-ghost-sm {
  background: none; border: none;
  color: var(--text-muted); font-size: 0.78rem;
  cursor: pointer; padding: 4px 8px;
  border-radius: var(--radius-sm);
  transition: all var(--transition);
  font-family: var(--font-body);
}
.btn-ghost-sm:hover { color: var(--text-primary); background: var(--bg-card); }

.btn svg {
  width: 15px; height: 15px;
  stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0;
}

/* ---- Cards ---- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 20px;
  transition: all var(--transition);
}

.card:hover {
  border-color: var(--border-light);
  box-shadow: var(--shadow-card), var(--glow-a);
}

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 12px;
}

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

.card-subtitle { font-size: 0.8rem; color: var(--text-muted); margin-top: 3px; }

/* ---- Grid ---- */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }

/* ---- Badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge-active { background: rgba(16,185,129,0.15); color: var(--accent-success); border: 1px solid rgba(16,185,129,0.3); }
.badge-forming { background: rgba(139,92,246,0.15); color: var(--accent-a-light); border: 1px solid rgba(139,92,246,0.3); }
.badge-stale { background: rgba(245,158,11,0.12); color: #fbbf24; border: 1px solid rgba(245,158,11,0.28); }
.badge-paused { background: rgba(245,158,11,0.15); color: var(--accent-warning); border: 1px solid rgba(245,158,11,0.3); }
.badge-completed { background: rgba(107,114,128,0.15); color: var(--text-muted); border: 1px solid rgba(107,114,128,0.3); }
.badge-archived { background: rgba(75,85,99,0.16); color: #cbd5e1; border: 1px solid rgba(148,163,184,0.28); }
.badge-dm { background: rgba(212,175,55,0.15); color: var(--accent-gold-v); border: 1px solid rgba(212,175,55,0.3); }
.badge-combat { background: rgba(244,63,94,0.15); color: var(--accent-danger); border: 1px solid rgba(244,63,94,0.3); }

/* ---- Stat rows ---- */
.stat-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.stat-row svg {
  width: 13px; height: 13px;
  stroke: currentColor; fill: none;
  stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
  flex-shrink: 0;
}

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

/* ---- Empty states ---- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  text-align: center;
  color: var(--text-muted);
}

.empty-glyph {
  font-size: 48px;
  margin-bottom: 16px;
  opacity: 0.4;
}

.empty-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.empty-desc { font-size: 0.875rem; line-height: 1.6; max-width: 320px; }

/* ---- Loading ---- */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid var(--border);
  border-top-color: var(--accent-a);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ---- Tabs ---- */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  gap: 0;
}

.tab-item {
  padding: 10px 20px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font-body);
  transition: all var(--transition);
  margin-bottom: -1px;
}

.tab-item:hover { color: var(--text-secondary); }
.tab-item.active { color: var(--accent-a-light); border-bottom-color: var(--accent-a); }

/* ---- Guides ---- */
.guide-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(240px, 0.8fr);
  gap: 18px;
  margin-bottom: 24px;
}

.guide-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.02), transparent), var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px 20px;
}

.guide-hero-card {
  position: relative;
  overflow: hidden;
}

.guide-hero-card::after {
  content: '';
  position: absolute;
  inset: auto -10% -40% 35%;
  height: 180px;
  background: radial-gradient(circle, rgba(6,182,212,0.18), transparent 68%);
  pointer-events: none;
}

.guide-kicker {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent-b-light);
  margin-bottom: 8px;
}

.guide-title {
  font-size: 1.6rem;
  line-height: 1.15;
  margin-bottom: 10px;
  color: var(--text-primary);
}

.guide-lead {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.8;
  max-width: 62ch;
}

.guide-meta-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.guide-meta-tile {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.guide-meta-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.guide-meta-value {
  font-size: 0.84rem;
  color: var(--text-primary);
  line-height: 1.55;
}

.guide-tab-panel {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

.guide-section-title {
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.guide-copy {
  font-size: 0.875rem;
  line-height: 1.8;
  color: var(--text-secondary);
}

.guide-copy p {
  margin-bottom: 10px;
}

.guide-copy ul,
.guide-copy ol {
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 10px 0;
}

.guide-copy code {
  font-family: var(--font-mono);
  background: var(--bg-elevated);
  padding: 1px 6px;
  border-radius: 4px;
  color: var(--accent-a-light);
  font-size: 0.8rem;
}

.guide-callout {
  border-left: 3px solid var(--accent-a);
  background: rgba(139,92,246,0.08);
  padding: 12px 14px;
  border-radius: 0 var(--radius-md) var(--radius-md) 0;
  font-size: 0.84rem;
  color: var(--text-secondary);
}

.guide-checklist {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.guide-check-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.guide-check-item strong {
  display: block;
  color: var(--text-primary);
  margin-bottom: 4px;
  font-size: 0.82rem;
}

.guide-shot-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.guide-shot-slot {
  min-height: 210px;
  border: 1px dashed rgba(6,182,212,0.45);
  background:
    linear-gradient(135deg, rgba(6,182,212,0.08), rgba(139,92,246,0.05)),
    var(--bg-card);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}

.guide-shot-badge {
  align-self: flex-start;
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid rgba(6,182,212,0.35);
  color: var(--accent-b-light);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.guide-shot-title {
  font-size: 0.96rem;
  color: var(--text-primary);
}

.guide-shot-note {
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.65;
}

.guide-shot-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.guide-ref-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.guide-ref-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px;
}

.guide-ref-card h3 {
  font-size: 0.8rem;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.guide-ref-card ul {
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--text-secondary);
  font-size: 0.82rem;
}

.guide-vibe-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 14px;
  margin-top: 10px;
}

.guide-vibe-row {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

@media (max-width: 980px) {
  .guide-hero,
  .guide-grid,
  .guide-ref-grid,
  .guide-shot-grid {
    grid-template-columns: 1fr;
  }

  .guide-meta-grid {
    grid-template-columns: 1fr;
  }
}

/* ---- Alert ---- */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  margin-bottom: 16px;
}

.alert-error { background: rgba(244,63,94,0.1); color: var(--accent-danger); border: 1px solid rgba(244,63,94,0.2); }
.alert-success { background: rgba(16,185,129,0.1); color: var(--accent-success); border: 1px solid rgba(16,185,129,0.2); }
.alert-info { background: rgba(139,92,246,0.1); color: var(--accent-a-light); border: 1px solid rgba(139,92,246,0.2); }
.alert-warning { background: rgba(245,158,11,0.1); color: var(--accent-warning); border: 1px solid rgba(245,158,11,0.2); }

/* ---- Search / Filter bar ---- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.search-input {
  flex: 1;
  min-width: 200px;
  max-width: 360px;
  padding: 9px 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.875rem;
  font-family: var(--font-body);
  outline: none;
  transition: border-color var(--transition);
}

.search-input:focus { border-color: var(--accent-a); }
.search-input::placeholder { color: var(--text-muted); }

/* ---- Mobile responsiveness (base — landing page only tweaks) ---- */
@media (max-width: 768px) {
  .landing-content { grid-template-columns: 1fr; gap: 32px; }
  .landing-title { font-size: 2rem; }
  .landing-card-title { font-size: 1.45rem; }
  .interest-role-grid { grid-template-columns: 1fr; }
  .landing-session-shell { padding: 16px 14px 14px; }
  .landing-session-copy { font-size: 0.84rem; }
  .landing-ghost-echo {
    width: min(var(--ghost-width), 48vw);
    font-size: 0.82rem;
    opacity: 0.05;
  }
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* ---- Table view layout ---- */
.table-view {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) 278px;
  height: 100vh;
  overflow: hidden;
}

.table-sidebar-left {
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 14px;
}

.table-main {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.table-header {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-surface);
  flex-shrink: 0;
}

.table-header-title {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--text-primary);
}

.post-feed {
  flex: 1;
  overflow-y: auto;
  padding: 18px 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.table-sidebar-right {
  background: var(--bg-surface);
  border-left: 1px solid var(--border);
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sidebar-panel.hidden { display: none; }

.sidebar-panel-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 0 0 8px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  text-align: left;
  font-family: var(--font-display);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.sidebar-panel-toggle:hover { color: var(--text-primary); }
.sidebar-panel-toggle.open { color: var(--text-primary); }
.sidebar-panel-toggle.open .acc-arrow::before {
  transform: rotate(-135deg) translate(-2px, -2px);
}

.sidebar-panel-body {
  display: none;
  padding-top: 10px;
}

.sidebar-panel-body.open { display: block; }

@media (max-width: 1200px) {
  .table-view { grid-template-columns: 228px minmax(0, 1fr) 248px; }
}

@media (max-width: 1100px) {
  .table-view { grid-template-columns: 190px minmax(0, 1fr) 220px; }
}

/* table mobile handled in the main mobile block below */

/* ============================================================
   VIBE TEXT SYSTEM — animated post markup
   ============================================================ */

/* !! shout !! */
.vibe-shout {
  color: #FF4560;
  font-weight: 800;
  font-size: 1.05em;
  letter-spacing: 0.02em;
  display: inline-block;
  animation: vibe-shake 0.12s linear infinite;
}
@keyframes vibe-shake {
  0%,100% { transform: translate(0,0) rotate(0deg); }
  20% { transform: translate(-1px,1px) rotate(-0.5deg); }
  40% { transform: translate(1px,-1px) rotate(0.5deg); }
  60% { transform: translate(-1px,0) rotate(-0.3deg); }
  80% { transform: translate(1px,1px) rotate(0.3deg); }
}

/* ~~ whisper ~~ */
.vibe-whisper {
  opacity: 0.5;
  font-size: 0.82em;
  font-style: italic;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
}

/* >> stress << */
.vibe-stress {
  color: #F59E0B;
  font-style: italic;
  display: inline-block;
  animation: vibe-jitter 0.07s linear infinite;
}
@keyframes vibe-jitter {
  0%,100% { transform: translate(0,0); }
  25% { transform: translate(0.8px,-0.5px); }
  50% { transform: translate(-0.8px,0.5px); }
  75% { transform: translate(0.5px,0.8px); }
}

/* ^^ excited ^^ */
.vibe-excited {
  color: #22D3EE;
  display: inline-block;
  animation: vibe-bounce 0.35s ease-in-out infinite alternate;
}
@keyframes vibe-bounce {
  from { transform: translateY(0); }
  to { transform: translateY(-4px); }
}

/* (( inner thought )) */
.vibe-thought {
  font-style: italic;
  color: var(--text-muted);
  opacity: 0.75;
  font-size: 0.92em;
}
.vibe-thought::before { content: '('; }
.vibe-thought::after  { content: ')'; }

/* == dramatic == */
.vibe-dramatic {
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: var(--accent-gold-v);
  font-weight: 600;
  font-size: 0.9em;
}

/* %% glitch %% */
.vibe-glitch {
  color: #A78BFA;
  position: relative;
  display: inline-block;
  animation: vibe-glitch 2s steps(2) infinite;
}
@keyframes vibe-glitch {
  0%,100% { text-shadow: none; clip-path: none; }
  10% { text-shadow: 2px 0 #F43F5E, -2px 0 #06B6D4; }
  20% { text-shadow: -2px 0 #F43F5E, 2px 0 #06B6D4; }
  30% { text-shadow: none; }
}

/* -- sad -- */
.vibe-sad {
  color: #60A5FA;
  font-style: italic;
  opacity: 0.8;
  animation: vibe-droop 3s ease-in-out infinite;
}
@keyframes vibe-droop {
  0%,100% { transform: translateY(0); }
  50% { transform: translateY(2px); }
}

/* ++ bold bright ++ (emphasis) */
.vibe-emph {
  color: var(--accent-a-light);
  font-weight: 700;
  text-shadow: 0 0 12px rgba(139,92,246,0.4);
}

/* ============================================================
   POST TEXT STYLES
   ============================================================ */

.post-content-style-whisper {
  opacity: 0.74;
  font-style: italic;
  letter-spacing: 0.03em;
}

.post-content-style-echo {
  text-shadow: 0 0 10px rgba(56,189,248,0.18);
}

.post-content-style-glitch,
.post-content-style-glitched {
  text-shadow: 1px 0 rgba(244,63,94,0.32), -1px 0 rgba(34,211,238,0.28);
}

.post-content-style-narration {
  font-family: var(--font-display);
  font-style: italic;
  letter-spacing: 0.02em;
  color: #d7dce7;
}

.post-content-style-noble {
  letter-spacing: 0.015em;
  color: #f8e8bf;
}

.post-content-style-ritual {
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #fca5a5;
}

.post-content-style-ember {
  color: #fdba74;
  text-shadow: 0 0 10px rgba(251,146,60,0.16);
}

.post-content-style-oceanic {
  color: #7dd3fc;
}

.post-content-style-faded-memory {
  opacity: 0.78;
  filter: saturate(0.75);
}

.post-content-style-machine {
  font-family: var(--font-mono);
  letter-spacing: 0.02em;
  color: #cbd5f5;
}

.post-content-style-celestial {
  color: #fef3c7;
  text-shadow: 0 0 14px rgba(250,204,21,0.14);
}
.post-content-style-shout   { color: #fb7185; font-weight:700; text-transform:uppercase; letter-spacing:0.06em; }
.post-content-style-frantic { color: #fed7aa; font-style:italic; }
.post-content-style-decree  { color: #f0d9b5; font-family:var(--font-display); letter-spacing:0.12em; text-transform:uppercase; }
.post-content-style-cold    { color: #bae6fd; letter-spacing:0.04em; opacity:0.88; }
.post-content-style-oracle  { color: #c4b5fd; font-style:italic; text-align:center; }
.post-content-style-cursed  { color: #9ca3af; filter:sepia(0.2) hue-rotate(340deg); opacity:0.82; }
.post-content-style-verdant { color: #86efac; }
.post-content-style-storm   { color: #93c5fd; font-weight:600; text-shadow:0 0 8px rgba(147,197,253,0.4); }
.post-content-style-chronicle { color: #d4af37; font-family:var(--font-display); }
.post-content-style-ghost   { opacity:0.38; font-style:italic; color:#f3f4f6; }
.post-content-style-encrypted { font-family:var(--font-mono); color:#34d399; font-size:0.85em; }
.post-content-style-void    { color:rgba(148,163,184,0.45); text-align:center; letter-spacing:0.06em; }

/* Macro chip in composer */
.macro-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: var(--accent-a-dim);
  border: 1px solid var(--accent-a);
  border-radius: var(--radius-full);
  font-size: 0.72rem;
  color: var(--accent-a-light);
  font-family: var(--font-mono);
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.macro-chip:hover { background: var(--accent-a); color: white; }

/* Macro autocomplete dropdown */
.macro-dropdown {
  position: absolute;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-modal);
  z-index: 500;
  max-height: 240px;
  overflow-y: auto;
  min-width: 260px;
}
.macro-drop-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  width: 100%;
  background: none;
  border: none;
  color: var(--text-primary);
  text-align: left;
  font-family: var(--font-body);
  cursor: pointer;
  transition: background 0.12s;
  border-bottom: 1px solid var(--border);
}
.macro-drop-item:last-child { border-bottom: none; }
.macro-drop-item:hover, .macro-drop-item.selected { background: var(--bg-hover); }
.macro-drop-icon { font-size: 1rem; flex-shrink: 0; }
.macro-drop-code { font-family: var(--font-mono); font-size: 0.78rem; color: var(--accent-a-light); }
.macro-drop-expansion { font-size: 0.72rem; color: var(--text-muted); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.macro-drop-scope { font-size: 0.65rem; padding: 1px 5px; border-radius: var(--radius-full); background: var(--bg-card); color: var(--text-muted); flex-shrink: 0; }

/* Avatar image (overrides color-initial avatar) */
.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.file-input-accessible {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Character art panel */
.char-art-wrap {
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--border);
  margin-bottom: 8px;
  background: var(--bg-base);
  position: relative;
}
.char-art-img {
  width: 100%;
  display: block;
  max-height: 200px;
  object-fit: cover;
  object-position: top;
}
.char-art-upload-btn {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(0,0,0,0.6);
  color: white;
  border: none;
  border-radius: var(--radius-sm);
  padding: 4px 8px;
  font-size: 0.72rem;
  cursor: pointer;
  backdrop-filter: blur(4px);
  font-family: var(--font-body);
  transition: background 0.15s;
}
.char-art-upload-btn:hover { background: rgba(0,0,0,0.85); }

/* Session cap warning */
.session-cap-badge {
  font-size: 0.68rem;
  padding: 2px 7px;
  border-radius: var(--radius-full);
  background: rgba(245,158,11,0.15);
  color: var(--accent-warning);
  border: 1px solid rgba(245,158,11,0.3);
}

/* ============================================================
   DASHBOARD — Player facelift
   ============================================================ */

/* Page layout */
.dash-page { padding: 0; }
.dash-section { margin-bottom: 36px; padding: 0 28px; }
.dash-section:first-child { padding-top: 0; }
.dash-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

/* Hero */
.dash-hero {
  display: flex;
  gap: 28px;
  align-items: flex-start;
  padding: 28px 28px 32px;
  background: linear-gradient(160deg, var(--bg-surface), var(--bg-base));
  border-bottom: 1px solid var(--border);
  margin-bottom: 36px;
  flex-wrap: wrap;
}
.dash-hero-left { flex: 1; min-width: 240px; }
.dash-greeting-name {
  font-family: var(--font-display);
  font-size: 1.6rem;
  color: var(--text-primary);
  margin: 0 0 6px;
  line-height: 1.1;
}
.dash-greeting-role { margin-bottom: 20px; }

/* Gauges */
.dash-gauges {
  display: flex;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
}
.gauge-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.gauge-svg { display: block; }
.gauge-track {
  fill: none;
  stroke: var(--bg-elevated);
  stroke-width: 8;
}
.gauge-fill {
  fill: none;
  stroke-width: 8;
  stroke-linecap: round;
  transition: stroke-dasharray 0.8s cubic-bezier(.4,0,.2,1);
}
.gauge-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
}
.gauge-value {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}
.gauge-sub {
  font-size: 0.62rem;
  color: var(--text-muted);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.gauge-subsub {
  font-size: 0.58rem;
  color: var(--text-faint);
}

/* Session slots */
.dash-slots { flex: 1; min-width: 280px; }
.dash-slots-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 10px;
}
.dash-slots-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.session-slot {
  flex: 1;
  min-width: 140px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  overflow: hidden;
  transition: border-color 0.15s, transform 0.12s;
}
.session-slot.active {
  cursor: pointer;
  background: var(--bg-card);
}
.session-slot.active:hover { border-color: var(--accent-a); transform: translateY(-2px); }
.session-slot.empty {
  background: var(--bg-surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 14px;
  cursor: pointer;
  border-style: dashed;
}
.session-slot.empty:hover { border-color: var(--accent-a); }
.slot-icon { font-size: 1.6rem; color: var(--text-muted); margin-bottom: 6px; }
.slot-label { font-size: 0.82rem; color: var(--text-secondary); font-weight: 600; }
.slot-sub { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }
.slot-art {
  width: 100%;
  height: 90px;
  object-fit: cover;
  object-position: top center;
  display: block;
}
.slot-art-placeholder {
  width: 100%;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 2rem;
  color: rgba(255,255,255,0.5);
}
.slot-info { padding: 10px 12px; }
.slot-char {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.slot-table {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-bottom: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.slot-status-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.slot-hp { font-size: 0.72rem; color: var(--text-secondary); }
.slot-hp.critical { color: var(--accent-danger); }
.slot-hp.bloodied { color: var(--accent-warning); }
.slot-hp-bar {
  height: 3px;
  background: var(--bg-elevated);
  border-radius: 99px;
  margin-top: 5px;
  overflow: hidden;
}
.slot-hp-fill {
  height: 100%;
  background: var(--accent-a);
  border-radius: 99px;
  transition: width 0.4s ease;
}
.slot-hp-fill.critical { background: var(--accent-danger); }
.slot-hp-fill.bloodied { background: var(--accent-warning); }

.dash-slots-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.dm-dash-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* History collapsible */
.history-collapse { border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; }
.history-collapse-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  background: var(--bg-surface);
  transition: background var(--transition);
}
.history-collapse-header::-webkit-details-marker { display: none; }
.history-collapse-header:hover { background: var(--bg-card); }
.history-collapse-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: auto;
}
.history-collapse-chevron {
  stroke: var(--text-muted);
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
  transition: transform var(--transition);
}
.history-collapse[open] .history-collapse-chevron { transform: rotate(180deg); }
.history-collapse[open] .history-collapse-header { border-bottom: 1px solid var(--border); }
.history-collapse > .grid-3 { padding: 0 16px 16px; }

/* Friends strip */
.friends-strip {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  padding: 4px 0;
}
.friend-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  cursor: pointer;
  padding: 8px 10px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
  min-width: 62px;
  text-align: center;
}
.friend-chip:hover { background: var(--bg-card); border-color: var(--border); }
.friend-chip.add-friend { border-style: dashed; border-color: var(--border); color: var(--text-muted); }
.friend-chip.add-friend:hover { border-color: var(--accent-a); color: var(--accent-a); }
.friend-avatar-wrap {
  position: relative;
  display: inline-block;
}
.friend-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: #fff;
}
.friend-dot {
  position: absolute;
  bottom: 1px;
  right: 1px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 2px solid var(--bg-base);
}
.friend-dot.online { background: var(--accent-a); }
.friend-dot.away   { background: var(--text-muted); }
.friend-name { font-size: 0.72rem; color: var(--text-muted); white-space: nowrap; max-width: 62px; overflow: hidden; text-overflow: ellipsis; }
.friend-code-inline {
  background: var(--bg-elevated);
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 0.85em;
  letter-spacing: 0.12em;
  color: var(--accent-a-light);
}

/* Friend Code display in modal */
.friend-code-display {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--bg-elevated);
  border-radius: var(--radius-md);
  padding: 14px 18px;
  border: 1px solid var(--border);
}
.fcd-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  flex-basis: 100%;
}
.fcd-code {
  font-family: var(--font-mono);
  font-size: 1.5rem;
  letter-spacing: 0.22em;
  font-weight: 700;
  color: var(--accent-a-light);
  flex: 1;
}

/* Friend list rows in modal */
.friend-list-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.friend-list-row:last-child { border-bottom: none; }

/* DM collapsible controls */
.dm-controls-section {
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.dm-controls-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--bg-card);
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  font-size: 0.8rem;
  font-family: var(--font-body);
  transition: background 0.15s;
}
.dm-controls-toggle:hover { background: var(--bg-elevated); }
.dm-controls-toggle .toggle-arrow {
  font-size: 0.7rem;
  transition: transform 0.2s;
}
.dm-controls-toggle.open .toggle-arrow { transform: rotate(180deg); }
.dm-controls-body {
  display: none;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  background: var(--bg-surface);
}
.dm-controls-body.open { display: flex; }

/* ============================================================
   POST TEXT STYLES — named vibes with full CSS animation
   Applied as .post-style-<name> on the .post element
   ============================================================ */

/* plain = no style override, just the base */
.post-style-plain {}

.post-style-narration .post-content {
  font-family: var(--font-display);
  font-style: italic;
  letter-spacing: 0.02em;
  color: #d7dce7;
}

/* whisper — faded, small, italic. Ghosts through the page */
.post-style-whisper .post-content {
  opacity: 0.55;
  font-style: italic;
  font-size: 0.88em;
  letter-spacing: 0.02em;
  color: var(--text-muted);
}

/* echo — text repeats its own ghost using text-shadow */
.post-style-echo .post-content {
  color: var(--accent-b-light);
  text-shadow:
    2px 2px 0 rgba(6,182,212,0.18),
    4px 4px 0 rgba(6,182,212,0.10),
    6px 6px 0 rgba(6,182,212,0.05);
  letter-spacing: 0.01em;
}

/* glitched — RGB-split shift + flicker */
.post-style-glitch .post-content {
  color: var(--text-primary);
  position: relative;
  animation: post-glitch-flicker 6s steps(1) infinite;
}
.post-style-glitch .post-content::before,
.post-style-glitch .post-content::after {
  content: attr(data-text);
  position: absolute;
  inset: 0;
  overflow: hidden;
  clip-path: polygon(0 0, 100% 0, 100% 45%, 0 45%);
}
.post-style-glitch .post-content::before {
  left: -2px;
  color: #ff3366;
  animation: post-glitch-r 5s steps(2) infinite;
}
.post-style-glitch .post-content::after {
  left: 2px;
  color: #33eeff;
  animation: post-glitch-b 7s steps(2) infinite;
  clip-path: polygon(0 55%, 100% 55%, 100% 100%, 0 100%);
}
@keyframes post-glitch-flicker {
  0%, 94%, 100% { opacity: 1; }
  95% { opacity: 0.7; }
  96% { opacity: 1; }
  97% { opacity: 0.5; }
  98% { opacity: 1; }
}
@keyframes post-glitch-r {
  0%, 85%, 100% { transform: translateX(0); }
  86% { transform: translateX(-3px); }
  90% { transform: translateX(3px); }
  95% { transform: translateX(-1px); }
}
@keyframes post-glitch-b {
  0%, 85%, 100% { transform: translateX(0); }
  87% { transform: translateX(3px); }
  91% { transform: translateX(-2px); }
  96% { transform: translateX(2px); }
}

/* noble — wide spaced golden uppercase prose */
.post-style-noble .post-content {
  font-family: var(--font-display);
  letter-spacing: 0.08em;
  color: var(--accent-gold-v);
  line-height: 1.8;
  text-shadow: 0 0 24px rgba(212,175,55,0.2);
}

/* ritual — deep purple, centered, glowing border on post */
.post-style-ritual {
  border-color: rgba(139,92,246,0.5) !important;
  box-shadow: 0 0 28px rgba(139,92,246,0.15), 0 0 0 1px rgba(139,92,246,0.18) inset !important;
}
.post-style-ritual .post-content {
  font-family: var(--font-display);
  color: #C4B5FD;
  text-align: center;
  font-size: 0.95em;
  letter-spacing: 0.04em;
  line-height: 1.9;
  text-shadow: 0 0 16px rgba(139,92,246,0.6), 0 0 32px rgba(139,92,246,0.2);
  animation: ritual-pulse 4s ease-in-out infinite;
}
@keyframes ritual-pulse {
  0%, 100% { text-shadow: 0 0 16px rgba(139,92,246,0.6), 0 0 32px rgba(139,92,246,0.2); }
  50%       { text-shadow: 0 0 24px rgba(139,92,246,0.9), 0 0 48px rgba(139,92,246,0.35); }
}

/* ember — warm fire orange glow, slight upward drift */
.post-style-ember .post-content {
  color: #FCD34D;
  text-shadow:
    0 0 8px rgba(251,146,60,0.7),
    0 0 20px rgba(239,68,68,0.4),
    0 0 40px rgba(239,68,68,0.15);
  animation: ember-flicker 3s ease-in-out infinite;
}
@keyframes ember-flicker {
  0%, 100% { text-shadow: 0 0 8px rgba(251,146,60,0.7), 0 0 20px rgba(239,68,68,0.4); }
  30%       { text-shadow: 0 0 12px rgba(251,146,60,0.9), 0 0 30px rgba(239,68,68,0.55), 0 0 50px rgba(251,146,60,0.2); }
  60%       { text-shadow: 0 0 6px rgba(251,146,60,0.5), 0 0 16px rgba(239,68,68,0.3); }
}

/* oceanic — deep teal, wave drift */
.post-style-oceanic .post-content {
  color: #67E8F9;
  text-shadow: 0 0 18px rgba(6,182,212,0.45), 0 2px 24px rgba(6,182,212,0.2);
  animation: ocean-swell 6s ease-in-out infinite;
}
@keyframes ocean-swell {
  0%, 100% { letter-spacing: 0.01em; opacity: 0.92; }
  50%       { letter-spacing: 0.02em; opacity: 1; }
}

/* faded-memory — sepia desaturated, like old parchment */
.post-style-faded-memory .post-content {
  color: #C5B89A;
  filter: sepia(0.4) contrast(0.85);
  font-style: italic;
  opacity: 0.78;
  line-height: 1.85;
  letter-spacing: 0.015em;
}
.post-style-faded-memory {
  background: rgba(197,184,154,0.04) !important;
}

/* machine — monospace terminal green */
.post-style-machine .post-content {
  font-family: var(--font-mono);
  font-size: 0.85em;
  color: #4ADE80;
  text-shadow: 0 0 8px rgba(74,222,128,0.5);
  line-height: 1.7;
  animation: machine-blink-cursor 1.2s steps(1) infinite;
}
.post-style-machine::before {
  content: '> ';
  color: rgba(74,222,128,0.5);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  position: absolute;
  left: 14px;
  top: 14px;
}
.post-style-machine { position: relative !important; padding-left: 32px !important; }
@keyframes machine-blink-cursor {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0.85; }
}

/* celestial — starfield shimmer, cool white-blue */
.post-style-celestial .post-content {
  color: #E0F2FE;
  letter-spacing: 0.03em;
  line-height: 1.9;
  background: linear-gradient(90deg, #E0F2FE, #C4B5FD, #67E8F9, #E0F2FE);
  background-size: 300% auto;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: celestial-shift 8s linear infinite;
}
@keyframes celestial-shift {
  0%   { background-position: 0% center; }
  100% { background-position: 300% center; }
}

/* shout — bolded, caps, red-shifted, in-your-face */
.post-style-shout .post-content {
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #FB7185;
  text-transform: uppercase;
  text-shadow: 0 0 12px rgba(244,63,94,0.4);
  font-size: 1.02em;
}

/* frantic — slightly skewed, fast pulse, urgent orange */
.post-style-frantic .post-content {
  color: #FED7AA;
  font-style: italic;
  letter-spacing: -0.01em;
  animation: frantic-jitter 0.4s steps(2) infinite;
}
@keyframes frantic-jitter {
  0%, 100% { transform: translateX(0); }
  50%       { transform: translateX(0.6px); }
}

/* decree — centered, spaced, gold, Cinzel caps */
.post-style-decree .post-content {
  font-family: var(--font-display);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--accent-gold-v);
  font-size: 0.88em;
  line-height: 2;
  border-top: 1px solid rgba(212,175,55,0.3);
  border-bottom: 1px solid rgba(212,175,55,0.3);
  padding: 8px 0;
  margin: 4px 0;
}

/* cold — ice-blue, wide spacing, tight and clinical */
.post-style-cold .post-content {
  color: #BAE6FD;
  letter-spacing: 0.05em;
  font-size: 0.9em;
  opacity: 0.88;
  line-height: 1.65;
  filter: saturate(0.7) brightness(1.1);
}

/* oracle — drifting indented quotes, muted violet */
.post-style-oracle .post-content {
  color: #C4B5FD;
  font-style: italic;
  text-align: center;
  font-size: 0.92em;
  line-height: 2;
  letter-spacing: 0.03em;
  opacity: 0.9;
  animation: oracle-drift 8s ease-in-out infinite;
}
@keyframes oracle-drift {
  0%, 100% { letter-spacing: 0.03em; }
  50%       { letter-spacing: 0.055em; }
}

/* cursed — desaturated, slight red tint, decay feel */
.post-style-cursed .post-content {
  color: #9CA3AF;
  filter: sepia(0.2) hue-rotate(340deg) contrast(0.9);
  font-size: 0.88em;
  letter-spacing: 0.01em;
  animation: cursed-flicker 8s steps(1) infinite;
}
.post-style-cursed {
  border-color: rgba(239,68,68,0.15) !important;
  background: rgba(239,68,68,0.03) !important;
}
@keyframes cursed-flicker {
  0%, 90%, 100% { opacity: 1; }
  91% { opacity: 0.6; }
  92% { opacity: 1; }
  96% { opacity: 0.8; }
}

/* verdant — earthy green, grounded, breathing */
.post-style-verdant .post-content {
  color: #86EFAC;
  letter-spacing: 0.015em;
  line-height: 1.85;
  animation: verdant-breathe 5s ease-in-out infinite;
}
@keyframes verdant-breathe {
  0%, 100% { opacity: 0.9; }
  50%       { opacity: 1; }
}

/* storm — electric blue, sharp, crackling */
.post-style-storm .post-content {
  color: #93C5FD;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-shadow: 0 0 10px rgba(147,197,253,0.5), 0 0 24px rgba(59,130,246,0.25);
  animation: storm-crack 4s steps(1) infinite;
}
@keyframes storm-crack {
  0%, 88%, 90%, 100% { text-shadow: 0 0 10px rgba(147,197,253,0.5), 0 0 24px rgba(59,130,246,0.25); }
  89% { text-shadow: 0 0 20px rgba(147,197,253,0.9), 0 0 40px rgba(59,130,246,0.6); }
}

/* chronicle — warm parchment, Cinzel, formal historian */
.post-style-chronicle .post-content {
  font-family: var(--font-display);
  color: #D4AF37;
  font-size: 0.9em;
  line-height: 1.9;
  letter-spacing: 0.025em;
  opacity: 0.88;
}
.post-style-chronicle {
  background: rgba(212,175,55,0.04) !important;
  border-left: 2px solid rgba(212,175,55,0.3) !important;
}

/* ghost — near-invisible, hovering, barely real */
.post-style-ghost .post-content {
  opacity: 0.32;
  color: #F3F4F6;
  font-style: italic;
  letter-spacing: 0.04em;
  animation: ghost-fade 6s ease-in-out infinite;
}
.post-style-ghost:hover .post-content {
  opacity: 0.7;
  transition: opacity 0.4s ease;
}
@keyframes ghost-fade {
  0%, 100% { opacity: 0.28; }
  50%       { opacity: 0.38; }
}

/* encrypted — monospace, dashes, classified aesthetic */
.post-style-encrypted .post-content {
  font-family: var(--font-mono);
  font-size: 0.82em;
  color: #34D399;
  text-shadow: 0 0 6px rgba(52,211,153,0.4);
  letter-spacing: 0.04em;
  line-height: 1.7;
}
.post-style-encrypted::before {
  content: '── [CLASSIFIED] ──';
  display: block;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  color: rgba(52,211,153,0.4);
  letter-spacing: 0.12em;
  margin-bottom: 6px;
}

/* void — near-black text, minimal, cold silence */
.post-style-void .post-content {
  color: rgba(148,163,184,0.45);
  font-size: 0.88em;
  letter-spacing: 0.08em;
  line-height: 2;
  text-align: center;
}
.post-style-void {
  background: rgba(0,0,0,0.35) !important;
  border-color: transparent !important;
}

/* ============================================================
   VIBE PICKER — the fun button panel above the composer
   ============================================================ */
.vibe-picker-wrap {
  position: relative;
}
.vibe-picker-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 0.8rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  font-family: var(--font-body);
  white-space: nowrap;
}
.vibe-picker-btn:hover,
.vibe-picker-btn.active { border-color: var(--accent-a); color: var(--accent-a-light); }
.vibe-picker-btn .vibe-current-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent-a);
  flex-shrink: 0;
}

.vibe-picker-panel {
  position: absolute;
  bottom: calc(100% + 6px);
  left: 0;
  z-index: 500;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-modal);
  padding: 10px;
  display: none;
  flex-direction: column;
  gap: 6px;
  min-width: 260px;
  max-width: 340px;
}
.vibe-picker-panel.open { display: flex; }

.vibe-picker-title {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 2px 4px;
}

.vibe-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
}

.vibe-option {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 8px 6px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
}
.vibe-option:hover { border-color: var(--accent-a); background: var(--bg-elevated); }
.vibe-option.selected {
  border-color: var(--accent-a);
  background: rgba(139,92,246,0.12);
  box-shadow: 0 0 10px rgba(139,92,246,0.15);
}
.vibe-option-icon { font-size: 1.1rem; line-height: 1; }
.vibe-option-label {
  font-size: 0.62rem;
  color: var(--text-muted);
  font-family: var(--font-body);
  white-space: nowrap;
}

/* Preview sample text for vibe on hover */
.vibe-picker-preview {
  margin-top: 4px;
  padding: 6px 10px;
  background: var(--bg-base);
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  min-height: 28px;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  font-style: italic;
}

/* ============================================================
   PREVIEW VIBES — applied to .composer when vibe is active
   Gives a live feel while typing, without distracting animation
   ============================================================ */
.preview-vibe-whisper .composer-textarea { opacity: 0.65; font-style: italic; }
.preview-vibe-echo    .composer-textarea { color: #67e8f9; text-shadow: 0 0 8px rgba(6,182,212,0.2); }
.preview-vibe-glitch  .composer-textarea { color: var(--text-primary); text-shadow: 1px 0 rgba(244,63,94,0.4), -1px 0 rgba(34,211,238,0.35); }
.preview-vibe-shout   .composer-textarea { color: #fb7185; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.preview-vibe-frantic .composer-textarea { color: #fed7aa; font-style: italic; }
.preview-vibe-noble   .composer-textarea { color: #f0d9b5; font-family: var(--font-display); letter-spacing: 0.06em; }
.preview-vibe-decree  .composer-textarea { color: #f0d9b5; font-family: var(--font-display); letter-spacing: 0.1em; text-transform: uppercase; }
.preview-vibe-cold    .composer-textarea { color: #bae6fd; letter-spacing: 0.04em; }
.preview-vibe-ritual  .composer-textarea { color: #c084fc; letter-spacing: 0.06em; text-transform: uppercase; }
.preview-vibe-oracle  .composer-textarea { color: #c4b5fd; font-style: italic; text-align: center; }
.preview-vibe-cursed  .composer-textarea { color: #9ca3af; filter: sepia(0.25) hue-rotate(340deg); }
.preview-vibe-ember   .composer-textarea { color: #fcd34d; text-shadow: 0 0 8px rgba(251,146,60,0.2); }
.preview-vibe-oceanic .composer-textarea { color: #67e8f9; }
.preview-vibe-verdant .composer-textarea { color: #86efac; }
.preview-vibe-storm   .composer-textarea { color: #93c5fd; font-weight: 600; text-shadow: 0 0 6px rgba(147,197,253,0.3); }
.preview-vibe-faded-memory .composer-textarea { opacity: 0.72; filter: saturate(0.7); color: #c5b89a; }
.preview-vibe-chronicle .composer-textarea { color: #d4af37; font-family: var(--font-display); }
.preview-vibe-ghost   .composer-textarea { opacity: 0.35; font-style: italic; }
.preview-vibe-machine .composer-textarea { font-family: var(--font-mono); color: #4ade80; letter-spacing: 0.02em; }
.preview-vibe-encrypted .composer-textarea { font-family: var(--font-mono); color: #34d399; font-size: 0.9em; }
.preview-vibe-celestial .composer-textarea { color: #e0f2fe; text-shadow: 0 0 10px rgba(165,243,252,0.2); }
.preview-vibe-void    .composer-textarea { color: rgba(148,163,184,0.45); text-align: center; letter-spacing: 0.05em; }

/* ============================================================
   MOBILE RESPONSIVE
   ============================================================ */

/* Mobile top bar — hidden on desktop */
.mobile-topbar {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 52px;
  z-index: 900;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  align-items: center;
  padding: 0 12px;
  gap: 10px;
}
.mobile-nav-toggle {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 5px;
  width: 36px;
  height: 36px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  flex-shrink: 0;
}
.mobile-nav-toggle span {
  display: block;
  height: 2px;
  background: var(--text-secondary);
  border-radius: 1px;
  transition: all 0.2s;
}
.mobile-logo {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--text-primary);
}
.mobile-logo .logo-glyph { color: var(--accent-a); font-size: 1.1rem; }
.mobile-notif-btn {
  position: relative;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.mobile-notif-btn svg { width: 20px; height: 20px; stroke: var(--text-secondary); fill: none; stroke-width: 2; }

/* Sidebar overlay */
.mobile-sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  z-index: 998;
  backdrop-filter: blur(2px);
}

@media (max-width: 768px) {
  /* Show mobile bar, hide desktop sidebar nav-bottom items that overlap */
  .mobile-topbar { display: flex; }
  .mobile-sidebar-overlay.visible { display: block; }

  /* Push content down for top bar */
  #app { padding-top: 52px; }

  /* Sidebar becomes a slide-in drawer */
  #sidebar.sidebar {
    position: fixed;
    top: 52px;
    left: -240px;
    bottom: 0;
    width: 220px;
    z-index: 999;
    transition: left 0.25s cubic-bezier(.4,0,.2,1);
    border-right: 1px solid var(--border);
    box-shadow: 4px 0 24px rgba(0,0,0,0.4);
  }
  #sidebar.sidebar.mobile-open { left: 0; }

  /* In immersive mode (session/builder), sidebar gets .hidden via JS.
     On mobile we override that so the hamburger can still slide it in. */
  #sidebar.sidebar.hidden {
    display: flex !important;
    left: -240px;
  }
  #sidebar.sidebar.hidden.mobile-open {
    left: 0;
  }

  /* Full-width main on mobile */
  .main-content {
    margin-left: 0 !important;
    width: 100% !important;
    max-width: 100vw;
  }

  /* Table view: stack columns */
  .table-view {
    display: flex !important;
    flex-direction: column !important;
    height: auto !important;
    overflow: visible !important;
  }
  .table-sidebar-left,
  .table-sidebar-right {
    width: 100% !important;
    max-height: none !important;
    overflow: visible !important;
    border: none !important;
    border-bottom: 1px solid var(--border) !important;
  }
  .table-sidebar-left { order: 2; }
  .table-main        { order: 1; min-height: 60vh; }
  .table-sidebar-right { order: 3; }

  /* Post feed height adjustment */
  .post-feed { max-height: 50vh !important; }

  /* Composer full width */
  .composer { border-radius: 0 !important; }
  .composer-toolbar { flex-wrap: wrap; gap: 4px; }
  .composer-help-panel {
    left: 0;
    right: auto;
    width: min(calc(100vw - 24px), 340px);
  }

  /* Dash hero stack */
  .dash-hero { flex-direction: column; gap: 20px; }
  .dash-gauges { gap: 10px; justify-content: center; }
  .dash-slots { width: 100%; }
  .dash-slots-row { justify-content: center; }
  .session-slot { min-width: 140px; max-width: 180px; }

  /* Grid -> 1 col on small phones, 2 on tablet */
  .grid-3 { grid-template-columns: repeat(2, 1fr); }

  /* Builder: hide on mobile (too complex) */
  .builder-layout { flex-direction: column; }

  /* Modal fills screen */
  .modal-content {
    width: 100vw !important;
    max-width: 100vw !important;
    max-height: 92vh !important;
    border-radius: var(--radius-md) var(--radius-md) 0 0 !important;
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    transform: none !important;
  }
  .modal.hidden { display: none !important; }
  .modal:not(.hidden) {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: flex-end;
    z-index: 9000;
  }

  /* Page padding */
  .page { padding: 16px !important; }
  .dash-section { padding: 0 16px !important; }

  /* DM hub, admin etc */
  .page-header { flex-wrap: wrap; gap: 10px; }
  .page-header > div:last-child { width: 100%; }

  /* Friends strip scrollable */
  .friends-strip { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 8px; }

  /* Hide right sidebar's Echodio on mobile (too complex) */
  #sidebar-panel-echodio { display: none; }

  /* Dice roller compact */
  .dice-buttons { flex-wrap: wrap; }
  .dice-btn { padding: 5px 8px; font-size: 0.75rem; }
}

@media (max-width: 480px) {
  .grid-3 { grid-template-columns: 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .dash-gauges { gap: 8px; }
  .dash-slots-row { flex-direction: column; align-items: center; }
  .session-slot { width: 100%; max-width: 280px; }
}

/* Safe area insets — only on mobile where topbar is shown */
@media (max-width: 768px) {
  @supports (padding-top: env(safe-area-inset-top)) {
    .mobile-topbar {
      padding-top: env(safe-area-inset-top);
      height: calc(52px + env(safe-area-inset-top));
    }
    #app { padding-top: calc(52px + env(safe-area-inset-top)); }
    #sidebar.sidebar { top: calc(52px + env(safe-area-inset-top)); }
    .composer { padding-bottom: env(safe-area-inset-bottom); }
  }
}

/* Tablet: 2-col layout preserved but smaller sidebar */
@media (min-width: 769px) and (max-width: 1100px) {
  .table-view { grid-template-columns: 180px minmax(0, 1fr) 210px; }
  .table-sidebar-right { width: auto !important; display: flex !important; }
  .table-sidebar-left  { width: auto !important; }
  .post-feed { padding: 16px 14px 12px; }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
  .mobile-topbar { display: none; }
}

/* ============================================================
   TABLE LEFT SIDEBAR — accordion + mobile squeeze
   ============================================================ */

/* Always-visible header strip */
.tbl-header-strip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.tbl-back-btn {
  flex-shrink: 0;
  padding: 4px 8px !important;
  font-size: 0.82rem !important;
}
.tbl-header-info { flex: 1; min-width: 0; }
.tbl-header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.tbl-utility-btn {
  position: relative;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition), border-color var(--transition), background var(--transition);
}
.tbl-utility-btn:hover {
  color: var(--text-primary);
  border-color: var(--border-light);
  background: var(--bg-card);
}
.tbl-utility-btn svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tbl-user-pill {
  flex-shrink: 0;
  background: none;
  border: none;
  padding: 2px;
  border-radius: 50%;
  cursor: pointer;
  opacity: 0.75;
  transition: opacity 0.15s;
  display: flex;
  align-items: center;
}
.tbl-user-pill:hover { opacity: 1; }
.avatar-xs {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  flex-shrink: 0;
}
.tbl-header-name {
  font-family: var(--font-display);
  font-size: 0.88rem;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
}
.tbl-header-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
  flex-wrap: wrap;
}

/* Accordion container */
.tbl-accordion {
  border-bottom: 1px solid var(--border);
}

/* Sharp-angle accordion toggle — clip-path chevron, no rounded curves */
.tbl-acc-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  font-family: var(--font-body);
  letter-spacing: 0.03em;
  text-align: left;
  transition: background 0.12s, color 0.12s;
  position: relative;
}
.tbl-acc-toggle:hover { background: var(--bg-card); color: var(--text-primary); }
.tbl-acc-toggle.open  { color: var(--text-primary); }

/* Sharp chevron using clip-path — no SVG, no border-trick */
.acc-arrow {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.18s cubic-bezier(.4,0,.2,1);
}
.acc-arrow::before {
  content: '';
  display: block;
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform 0.18s cubic-bezier(.4,0,.2,1);
}
.tbl-acc-toggle.open .acc-arrow::before {
  transform: rotate(-135deg) translate(-2px, -2px);
}

/* Accordion body */
.tbl-acc-body {
  display: none;
  padding: 0 12px 10px;
  flex-direction: column;
  gap: 0;
}
.tbl-acc-body.open { display: flex; }

/* DM controls accordion reuses same pattern */
.dm-controls-section .dm-controls-toggle .toggle-arrow { display: none; } /* replaced by acc-arrow style */

/* ============================================================
   MOBILE SQUEEZE — tighter everything at ≤768px
   ============================================================ */
@media (max-width: 768px) {

  /* Table sidebar left becomes a slim top strip on mobile */
  .table-sidebar-left {
    width: 100% !important;
    max-height: none !important;
    overflow: visible !important;
    border-right: none !important;
    border-bottom: 1px solid var(--border) !important;
    flex-shrink: 0;
  }

  /* Party open by default, char+dm closed */
  /* (handled by JS, but ensure bodies without .open are hidden) */

  /* Tighter accordion on mobile */
  .tbl-acc-toggle { padding: 7px 12px; font-size: 0.75rem; }
  .tbl-acc-body   { padding: 0 10px 8px; }

  /* Squeeze party members */
  .party-member { padding: 4px 0; gap: 7px; }
  .party-member-name { font-size: 0.78rem; }
  .party-member-char { font-size: 0.68rem; }
  .avatar-sm { width: 26px !important; height: 26px !important; font-size: 0.65rem !important; }
  .avatar-md { width: 32px !important; height: 32px !important; font-size: 0.75rem !important; }

  /* Tighter header strip */
  .tbl-header-strip { padding: 7px 10px; }
  .tbl-header-name  { font-size: 0.82rem; }
  .tbl-header-actions { gap: 4px; }
  .tbl-utility-btn { width: 28px; height: 28px; }

  /* Post feed gets max room */
  .table-main { order: 1; display: flex; flex-direction: column; min-height: 0; }
  .post-feed  { flex: 1; max-height: 52vh !important; min-height: 200px; padding: 14px 12px 10px !important; gap: 7px !important; }

  /* Kill ALL the padding in the main post area */
  .table-header { padding: 7px 10px !important; }
  .table-header-title { font-size: 0.88rem !important; }
  .table-live-timer-card { max-width: 168px; padding: 5px 8px 5px 6px; gap: 8px; }
  .table-live-timer-label { font-size: 0.58rem; }
  .table-live-timer-value { font-size: 0.8rem; }
  .table-live-timer-ring { width: 28px; height: 28px; }

  /* Composer tighter */
  .composer { flex-shrink: 0; padding: 10px 12px !important; }
  .composer-toolbar { padding: 0 !important; gap: 4px !important; }
  .composer-textarea { padding: 7px 10px !important; font-size: 0.85rem !important; min-height: 56px !important; }
  .composer-footer { padding: 0 !important; }
  .composer-help-panel { width: min(calc(100vw - 28px), 320px); }
  .composer-help-grid { grid-template-columns: 1fr; }

  /* Vibe picker panel opens upward — ensure it's visible */
  .vibe-picker-panel { max-height: 60vh; overflow-y: auto; }
  .vibe-grid { grid-template-columns: repeat(4, 1fr); }

  /* Kill section title margins */
  .section-title { margin-bottom: 6px !important; font-size: 0.65rem !important; }

  /* Right sidebar stacks below — minimal on mobile */
  .table-sidebar-right {
    display: flex !important;
    width: 100% !important;
    border-left: none !important;
    border-top: 1px solid var(--border) !important;
    padding: 10px 12px !important;
  }

  .sidebar-panel-toggle {
    padding-bottom: 6px;
    font-size: 0.75rem;
  }

  .sidebar-panel-body { padding-top: 8px; }
  .dm-time-grid { grid-template-columns: 1fr; }

  /* Dice buttons tighter row */
  .dice-roller { padding: 0 !important; }
  .dice-buttons { gap: 4px !important; }
  .dice-btn { padding: 5px 7px !important; font-size: 0.72rem !important; min-width: 34px !important; }
  .dice-output { font-size: 0.8rem !important; padding: 5px 8px !important; }
  #dice-history { max-height: 80px !important; }

  /* Chapter panel compact */
  .chapter-panel { padding: 8px 10px !important; }
  .chapter-title  { font-size: 0.82rem !important; }
  .chapter-scene  { font-size: 0.76rem !important; max-height: 60px; overflow: hidden; }

  /* Badges smaller */
  .badge { font-size: 0.62rem !important; padding: 1px 5px !important; }

  /* DM controls tighter */
  .dm-controls-toggle { padding: 6px 10px !important; font-size: 0.75rem !important; }
  .dm-controls-body   { padding: 6px 10px !important; gap: 4px !important; }

  /* Modal bottom sheet tighter */
  .modal-content { max-height: 88vh !important; }
}

/* ============================================================
   SHARP ANGLE DESIGN LANGUAGE — replaces rounded toggles
   Applies to dm-controls-section toggles + any .sharp-toggle
   ============================================================ */
.dm-controls-section {
  border-radius: 0 !important;
  border-left: 2px solid var(--border);
  border-right: none;
  border-top: none;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
  margin-left: 4px;
}
.dm-controls-toggle {
  border-radius: 0 !important;
  font-size: 0.76rem !important;
  padding: 7px 12px !important;
  border-left: 2px solid transparent;
  transition: border-color 0.15s, background 0.15s;
  clip-path: none;
}
.dm-controls-toggle.open {
  border-left-color: var(--accent-a);
  color: var(--text-primary);
}
.dm-controls-toggle:hover { border-left-color: var(--accent-a); }

/* Sharp toggle arrow — same as acc-arrow */
.dm-controls-toggle .toggle-arrow {
  display: inline-block !important;
  width: 10px;
  height: 10px;
  position: relative;
  flex-shrink: 0;
}
.dm-controls-toggle .toggle-arrow::before {
  content: '';
  display: block;
  width: 6px;
  height: 6px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(45deg) translate(-1px, -2px);
  transition: transform 0.18s;
}
.dm-controls-toggle.open .toggle-arrow::before {
  transform: rotate(-135deg) translate(-1px, -2px);
}

/* ============================================================
   MEDIA PANEL — right sidebar slide-in media viewer
   ============================================================ */

.media-panel {
  display: none;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  flex-shrink: 0;
  /* Slide in from top */
  animation: mediaPanelIn 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
.media-panel.active {
  display: flex;
}
@keyframes mediaPanelIn {
  from { opacity: 0; transform: translateY(-12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.media-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 10px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.media-panel-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 160px;
}
.media-panel-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 2px 5px;
  border-radius: var(--radius-sm);
  line-height: 1;
  transition: color 0.15s, background 0.15s;
}
.media-panel-btn:hover {
  color: var(--text-primary);
  background: var(--bg-surface);
}

.media-panel-body {
  position: relative;
  width: 100%;
  background: #000;
}

.media-panel-img {
  display: block;
  width: 100%;
  max-height: 240px;
  object-fit: contain;
  cursor: zoom-in;
  transition: opacity 0.15s;
}
.media-panel-img:hover { opacity: 0.92; }

.media-panel-video {
  display: block;
  width: 100%;
  max-height: 240px;
  background: #000;
}

/* ---- Fullscreen lightbox ---- */
.media-fullscreen-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(0, 0, 0, 0.93);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.18s ease;
}
@keyframes fadeIn {
  from { opacity: 0; } to { opacity: 1; }
}
.media-fullscreen-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 95vw;
  max-height: 95vh;
}
.media-fullscreen-close {
  position: absolute;
  top: -36px;
  right: 0;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.15);
  color: #fff;
  font-size: 0.8rem;
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s;
}
.media-fullscreen-close:hover { background: rgba(255,255,255,0.15); }
.media-fullscreen-img {
  max-width: 95vw;
  max-height: 88vh;
  object-fit: contain;
  border-radius: var(--radius-md);
}
.media-fullscreen-video {
  max-width: 95vw;
  max-height: 88vh;
  border-radius: var(--radius-md);
  background: #000;
}
.media-fullscreen-caption {
  margin-top: 10px;
  font-size: 0.78rem;
  color: rgba(255,255,255,0.45);
  font-family: var(--font-mono);
  text-align: center;
}

/* ============================================================
   GAME ICONS — inline icon rendering via CSS mask
   [icon:lorc/sword:c0a060] → <span class="gi">
   ============================================================ */
.gi {
  display: inline-block;
  width: 1.3em;
  height: 1.3em;
  vertical-align: middle;
  margin: 0 0.1em;
  background-color: #c0a060; /* overridden by inline style */
  -webkit-mask-size: contain;
  mask-size: contain;
  -webkit-mask-repeat: no-repeat;
  mask-repeat: no-repeat;
  -webkit-mask-position: center;
  mask-position: center;
  flex-shrink: 0;
}

/* ============================================================
   ICON PICKER POPOVER
   ============================================================ */
.iconpicker-popover {
  width: 360px;
  max-height: 500px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-modal);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-size: 0.82rem;
}
.iconpicker-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.iconpicker-search {
  flex: 1;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 0.82rem;
  padding: 6px 10px;
  outline: none;
  font-family: var(--font-body);
}
.iconpicker-search:focus { border-color: var(--accent-a); }
.iconpicker-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
}
.iconpicker-close:hover { color: var(--text-primary); background: var(--bg-surface); }

.iconpicker-color-bar {
  display: flex;
  gap: 12px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg-surface);
}
.iconpicker-color-section {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.iconpicker-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
}
.iconpicker-colorwheel {
  width: 30px;
  height: 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1px 2px;
  background: var(--bg-base);
  cursor: pointer;
}
.iconpicker-hex {
  width: 76px;
  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-mono);
  padding: 4px 7px;
  outline: none;
}
.iconpicker-hex:focus { border-color: var(--accent-a); }
.iconpicker-faves {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  min-height: 22px;
}
.iconpicker-fave-dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.1s, border-color 0.1s;
  flex-shrink: 0;
}
.iconpicker-fave-dot:hover { transform: scale(1.15); }
.iconpicker-fave-dot.active { border-color: #fff; }
.iconpicker-fave-add {
  background: none;
  border: 1px dashed var(--border);
  color: var(--text-muted);
  font-size: 0.65rem;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color 0.12s, border-color 0.12s;
}
.iconpicker-fave-add:hover { color: var(--accent-a-light); border-color: var(--accent-a); }

.iconpicker-section-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  padding: 7px 12px 3px;
  flex-shrink: 0;
}
.iconpicker-grid {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 3px;
  padding: 4px 12px 6px;
  overflow-y: auto;
  flex: 1;
}
.iconpicker-recent {
  flex: none;
  overflow: visible;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  margin-bottom: 2px;
}
.iconpicker-icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 5px;
  cursor: pointer;
  transition: background 0.1s, border-color 0.1s;
  aspect-ratio: 1;
}
.iconpicker-icon-btn:hover {
  background: var(--bg-surface);
  border-color: var(--border);
}
.iconpicker-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg-surface);
}
.iconpicker-page-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.12s;
}
.iconpicker-page-btn:hover:not(:disabled) { background: var(--bg-elevated); color: var(--text-primary); }
.iconpicker-page-btn:disabled { opacity: 0.35; cursor: default; }

/* ============================================================
   NPC PERSONA — scene cast bubbles + post backsplash
   ============================================================ */

.scene-cast-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.scene-cast-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: border-color 0.15s;
  overflow: hidden;
}

.scene-cast-avatar-dm {
  cursor: pointer;
}
.scene-cast-avatar-dm:hover {
  border-color: var(--accent-a);
}
.scene-cast-avatar-dm:hover .scene-cast-upload-hint {
  opacity: 1;
}
.scene-cast-avatar-dm:hover .scene-cast-initials {
  opacity: 0;
}

.scene-cast-initials {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  pointer-events: none;
  transition: opacity 0.15s;
}

.scene-cast-upload-hint {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--accent-a-light);
  background: rgba(0,0,0,0.45);
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
}

/* ---- NPC / persona post backsplash ---- */
.post-speaker-npc,
.post-speaker-monster,
.post-speaker-enemy {
  border-left: 2px solid var(--thread-accent);
  --thread-accent: var(--accent-b);
  --post-surface: rgba(6,182,212,0.04);
}

.post-speaker-npc .post-header,
.post-speaker-monster .post-header,
.post-speaker-enemy .post-header {
  opacity: 0.9;
}

/* Portrait in post: if speaker has artwork, give avatar a glow */
.post-speaker-npc .avatar-sm img,
.post-speaker-monster .avatar-sm img,
.post-speaker-enemy .avatar-sm img {
  box-shadow: 0 0 0 2px var(--accent-b);
}

/* ============================================================
   ALPHA QUEST SYSTEM
   ============================================================ */
.alpha-page { max-width: 760px; }

.alpha-hero {
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 20px 24px;
  margin-bottom: 28px;
}

.alpha-progress-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 10px;
}

.alpha-progress-text { display: flex; gap: 12px; align-items: baseline; }
.alpha-progress-count { font-weight: 600; font-size: 1rem; }
.alpha-progress-pct { font-size: 0.8rem; color: var(--text-muted); }
.alpha-xp-total { font-size: 0.85rem; color: var(--accent-a); font-weight: 600; }

.alpha-xp-bar-wrap {
  height: 6px;
  background: var(--surface-2);
  border-radius: 3px;
  overflow: hidden;
}
.alpha-xp-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-a), var(--accent-b));
  border-radius: 3px;
  transition: width 0.4s ease;
}

.alpha-complete-banner {
  margin-top: 14px;
  padding: 10px 14px;
  background: color-mix(in srgb, var(--accent-a) 15%, transparent);
  border: 1px solid var(--accent-a);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--accent-a);
  text-align: center;
}

.alpha-quests-list { display: flex; flex-direction: column; gap: 20px; }

.alpha-category {}
.alpha-category-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.alpha-cat-icon { font-size: 1rem; color: var(--accent-a); }
.alpha-cat-label { font-weight: 600; font-size: 0.85rem; flex: 1; }
.alpha-cat-count { font-size: 0.75rem; color: var(--text-muted); }

.alpha-quest-card {
  display: grid;
  grid-template-columns: 28px 1fr auto auto;
  gap: 10px;
  align-items: start;
  padding: 14px;
  background: var(--surface-1);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color 0.15s;
}
.alpha-quest-card:hover { border-color: var(--accent-a); }
.alpha-quest-done { opacity: 0.65; }
.alpha-quest-done .alpha-quest-title { text-decoration: line-through; }

.alpha-quest-check {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--accent-a);
  flex-shrink: 0;
  margin-top: 1px;
}
.alpha-quest-done .alpha-quest-check {
  background: var(--accent-a);
  border-color: var(--accent-a);
  color: #fff;
}

.alpha-quest-body { min-width: 0; }
.alpha-quest-title { font-weight: 600; font-size: 0.9rem; margin-bottom: 3px; }
.alpha-quest-desc { font-size: 0.8rem; color: var(--text-muted); line-height: 1.5; }
.alpha-quest-hint {
  margin-top: 5px;
  font-size: 0.75rem;
  color: var(--accent-b);
  font-style: italic;
}

.alpha-quest-xp { font-size: 0.78rem; white-space: nowrap; padding-top: 2px; }
.alpha-xp-earned { color: var(--accent-a); font-weight: 600; }
.alpha-xp-pending { color: var(--text-muted); }

.alpha-mark-btn { white-space: nowrap; align-self: center; }

/* Mobile alpha adjustments */
@media (max-width: 600px) {
  .alpha-quest-card {
    grid-template-columns: 24px 1fr;
    grid-template-rows: auto auto;
  }
  .alpha-quest-xp { grid-column: 2; }
  .alpha-mark-btn { grid-column: 1 / -1; width: 100%; justify-content: center; }
}

.alpha-auto-badge {
  font-size: 0.65rem;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px 5px;
  align-self: center;
  white-space: nowrap;
  letter-spacing: 0.04em;
}

/* ============================================================
   QUEST UNLOCK POPUP
   ============================================================ */
.quest-unlock-popup {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--accent-a);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent-a) 20%, transparent),
              var(--shadow-modal);
  min-width: 240px;
  max-width: 320px;
  transform: translateY(20px);
  opacity: 0;
  transition: transform 0.3s cubic-bezier(.2,.8,.3,1), opacity 0.3s ease;
  pointer-events: none;
}

.quest-unlock-popup.quest-unlock-visible {
  transform: translateY(0);
  opacity: 1;
}

.quest-unlock-glyph {
  font-size: 1.6rem;
  color: var(--accent-a);
  flex-shrink: 0;
  animation: questGlyphSpin 0.5s ease 0.1s both;
}

@keyframes questGlyphSpin {
  from { transform: scale(0.4) rotate(-30deg); opacity: 0; }
  to   { transform: scale(1) rotate(0deg); opacity: 1; }
}

.quest-unlock-body { min-width: 0; }

.quest-unlock-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent-a);
  font-weight: 600;
  margin-bottom: 2px;
}

.quest-unlock-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
}

.quest-unlock-xp {
  font-size: 0.78rem;
  color: var(--accent-b);
  margin-top: 2px;
  font-weight: 600;
}

@media (max-width: 768px) {
  .quest-unlock-popup {
    bottom: 70px; /* above mobile topbar */
    right: 12px;
    left: 12px;
    max-width: none;
  }
}

/* ============================================================
   ADMIN PANEL — REDESIGN (2-col workspace)
   ============================================================ */
.adm-page { max-width: none; padding: 20px 24px; }

/* Compact KPI strip */
.adm-kpi-strip {
  display: flex;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-bottom: 20px;
}
.adm-kpi {
  flex: 1;
  background: var(--bg-surface);
  padding: 10px 14px;
  min-width: 0;
}
.adm-kpi-val {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
  font-family: var(--font-display);
}
.adm-kpi-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 2-col workspace */
.adm-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 240px;
  gap: 16px;
  align-items: start;
}

.adm-main {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.adm-scroll-panel {
  max-height: calc(100vh - 260px);
  overflow-y: auto;
  padding: 0;
}

/* Compact feed rows */
.adm-feed-row {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.1s;
}
.adm-feed-row:hover { background: var(--bg-card); }
.adm-feed-meta {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: nowrap;
  overflow: hidden;
  margin-bottom: 3px;
}
.adm-feed-author { font-weight: 600; font-size: 0.78rem; color: var(--accent-a-light); white-space: nowrap; }
.adm-feed-in { font-size: 0.68rem; color: var(--text-muted); flex-shrink: 0; }
.adm-feed-table { font-size: 0.78rem; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.adm-feed-time { font-size: 0.65rem; color: var(--text-faint); white-space: nowrap; margin-left: auto; }
.adm-feed-content {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Compact activity rows */
.adm-act-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
}
.adm-act-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--accent-a);
  flex-shrink: 0;
}
.adm-act-body { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.adm-act-user { font-weight: 600; color: var(--text-primary); }
.adm-act-verb { color: var(--text-secondary); }
.adm-act-entity { font-size: 0.7rem; color: var(--text-muted); font-family: var(--font-mono); }
.adm-act-time { font-size: 0.65rem; color: var(--text-faint); white-space: nowrap; }

.adm-filter-row {
  display: flex;
  gap: 8px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.adm-empty { padding: 20px 14px; color: var(--text-muted); font-size: 0.82rem; }

/* Right sidebar */
.adm-sidebar { display: flex; flex-direction: column; gap: 12px; }
.adm-side-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}
.adm-side-scroll { max-height: 220px; overflow-y: auto; }
.adm-side-title {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 10px;
  font-weight: 600;
}
.adm-pulse-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.adm-pulse-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 8px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  color: var(--text-secondary);
}
.adm-pulse-item strong { font-size: 0.9rem; color: var(--text-primary); }
.adm-pulse-warn { border: 1px solid var(--accent-warning); color: var(--accent-warning); }
.adm-pulse-danger { border: 1px solid var(--accent-danger); color: var(--accent-danger); }
.adm-side-act {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.72rem;
  flex-wrap: nowrap;
  overflow: hidden;
}
.adm-side-act:last-child { border-bottom: none; }
.adm-side-act-user { font-weight: 600; color: var(--text-primary); white-space: nowrap; }
.adm-side-act-verb { color: var(--text-muted); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.adm-side-act-time { font-size: 0.65rem; color: var(--text-faint); white-space: nowrap; }

/* ============================================================
   IT PANEL
   ============================================================ */
.it-page { max-width: none; padding: 20px 24px; }

.it-scroll-panel {
  max-height: calc(100vh - 220px);
  overflow-y: auto;
  padding: 16px 0;
}

.it-section-header {
  padding: 0 0 16px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.it-section-title { font-weight: 600; font-size: 0.9rem; margin-bottom: 3px; }
.it-section-desc { font-size: 0.78rem; color: var(--text-muted); }

.it-filter-row { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }

.it-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 16px 18px;
}
.it-card-title { font-weight: 600; font-size: 0.85rem; margin-bottom: 12px; color: var(--text-primary); }

.it-form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}
.it-field { display: flex; flex-direction: column; gap: 4px; }
.it-field label { font-size: 0.72rem; color: var(--text-muted); }
.it-msg { font-size: 0.8rem; margin-top: 8px; min-height: 18px; }

.it-table-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.it-table-row:last-child { border-bottom: none; }
.it-table-info { flex: 1; min-width: 0; }
.it-table-name { font-weight: 600; font-size: 0.82rem; color: var(--text-primary); }
.it-table-id { font-size: 0.7rem; color: var(--text-muted); font-family: var(--font-mono); }
.it-table-meta { font-size: 0.72rem; color: var(--text-muted); margin-top: 2px; }
.it-table-controls { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }

.it-select {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  padding: 4px 6px;
  font-size: 0.75rem;
  font-family: var(--font-body);
}

.it-flag-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-right: 8px;
  cursor: pointer;
}

/* Mobile admin/IT */
@media (max-width: 900px) {
  .adm-workspace { grid-template-columns: 1fr; }
  .adm-sidebar { flex-direction: row; flex-wrap: wrap; }
  .adm-side-card { flex: 1; min-width: 200px; }
  .adm-kpi-strip { flex-wrap: wrap; }
  .adm-kpi { min-width: calc(25% - 1px); }
}
@media (max-width: 600px) {
  .adm-kpi { min-width: calc(50% - 1px); }
  .adm-scroll-panel { max-height: 60vh; }
}

/* M3 — scene transition toast (chapter_advanced banner) */
@keyframes sceneFade {
  0% { opacity: 0; transform: translateX(-50%) translateY(-6px); }
  10% { opacity: 1; transform: translateX(-50%) translateY(0); }
  85% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-6px); }
}
