/* Mental OS host overlays — light theme matching mental-os-v4.html.
   Inline cockpit + per-layer poll blocks + small floating badge + modals.
*/

#mos-badge,
[data-mos-section] .mos-cockpit,
[data-mos-section] .mos-layer-block,
[data-mos-section] .mos-end-block,
.mos-modal {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  color: #1A1D29;
  box-sizing: border-box;
}

/* ─── Floating badge (top-right) ─── */
#mos-badge {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 9999;
  display: none;
}
.mos-badge-inner {
  display: flex; align-items: center; gap: 10px;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(0,0,0,0.10);
  border-radius: 999px;
  padding: 8px 14px;
  box-shadow: 0 6px 20px rgba(0,0,0,0.10);
}
.mos-badge-code {
  font-family: 'Courier New', monospace;
  font-weight: 700;
  letter-spacing: 0.16em;
  color: #7E22CE;
  font-size: 14px;
}
.mos-badge-stat {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px;
  color: rgba(26, 29, 41, 0.65);
}
.mos-badge-dot {
  display: inline-block; width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(0,0,0,0.2);
}
.mos-badge-dot.live {
  background: #047857;
  box-shadow: 0 0 0 0 rgba(4, 120, 87, 0.6);
  animation: mos-pulse 1.6s infinite;
}
@keyframes mos-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(4, 120, 87, 0.45); }
  70%  { box-shadow: 0 0 0 8px rgba(4, 120, 87, 0); }
  100% { box-shadow: 0 0 0 0 rgba(4, 120, 87, 0); }
}
.mos-badge-inner.closed .mos-badge-code { color: rgba(26, 29, 41, 0.45); }

/* ─── Cockpit (Start section) ─── */
.mos-cockpit {
  margin: 32px 56px;
  padding: 28px 32px;
  background: linear-gradient(180deg, #FFFFFF 0%, #F5F5F0 100%);
  border: 1px solid rgba(0,0,0,0.10);
  border-radius: 18px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.06);
}
.mos-cockpit-eyebrow {
  font-size: 12px; font-weight: 600; letter-spacing: 0.10em;
  text-transform: uppercase;
  color: #7E22CE;
  margin-bottom: 8px;
}
.mos-cockpit-title {
  font-size: 26px; font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
  color: #0F1117;
}
.mos-cockpit-desc {
  color: rgba(26, 29, 41, 0.65);
  margin-bottom: 18px;
  max-width: 560px;
}
.mos-cockpit-grid {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 28px;
  align-items: start;
  margin-bottom: 20px;
}
.mos-cockpit-qr {
  background: #FFFFFF;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 12px;
  padding: 10px;
  width: 220px;
}
.mos-cockpit-qr #mos-qr-canvas { display: flex; justify-content: center; }
.mos-cockpit-qr canvas, .mos-cockpit-qr img { width: 200px !important; height: 200px !important; display: block; }
.mos-cockpit-info { display: flex; flex-direction: column; gap: 8px; }
.mos-cockpit-code {
  font-family: 'Courier New', monospace;
  font-size: 36px; font-weight: 700;
  letter-spacing: 0.18em;
  color: #7E22CE;
  line-height: 1;
}
.mos-cockpit-url {
  font-size: 12px;
  color: rgba(26, 29, 41, 0.55);
  word-break: break-all;
}

.mos-cockpit-polls {
  border-top: 1px solid rgba(0,0,0,0.08);
  padding-top: 18px;
}

/* ─── Per-layer block ─── */
.mos-layer-block, .mos-end-block {
  margin: 14px 0 28px;
  padding: 18px 22px;
  background: #FFFFFF;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 14px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.04);
}
.mos-layer-block { border-left: 4px solid var(--mos-color, #7E22CE); }

[data-mos-section="L1_qualities"] .mos-layer-block { border-left-color: #B45309; }
[data-mos-section="L2_habits"]    .mos-layer-block { border-left-color: #047857; }
[data-mos-section="L3_patterns"]  .mos-layer-block { border-left-color: #1D4ED8; }
[data-mos-section="L4_judgments"] .mos-layer-block { border-left-color: #7E22CE; }
[data-mos-section="L5_influence"] .mos-layer-block { border-left-color: #C2410C; }
[data-mos-section="L6_loop"]      .mos-layer-block { border-left-color: #0F766E; }

.mos-section-eyebrow {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.10em;
  color: rgba(26, 29, 41, 0.5);
  margin-bottom: 10px;
}

/* ─── Counts + chips ─── */
.mos-counts {
  display: flex; gap: 18px;
  margin-top: 4px;
}
.mos-counts > div {
  display: flex; align-items: baseline; gap: 6px;
}
.mos-counts strong {
  font-size: 22px; font-weight: 700; color: #1A1D29;
}
.mos-counts span {
  font-size: 12px; color: rgba(26, 29, 41, 0.55);
}
.mos-pchips {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 4px;
  max-height: 90px;
  overflow-y: auto;
}
.mos-pchip {
  background: #F5F5F0;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid rgba(0,0,0,0.06);
}
.mos-pchip.offline { opacity: 0.45; }
.mos-muted-note {
  font-size: 13px; font-style: italic;
  color: rgba(26, 29, 41, 0.5);
}

/* ─── Buttons ─── */
.mos-btn {
  font-family: inherit;
  font-size: 14px; font-weight: 600;
  border: none; border-radius: 10px;
  padding: 10px 16px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
}
.mos-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.mos-btn-primary {
  background: #7E22CE; color: #fff; padding: 14px 28px; font-size: 16px;
}
.mos-btn-primary:hover { background: #9333EA; }
.mos-btn-danger {
  background: #FFFFFF; color: #B45309;
  border: 1px solid rgba(180, 83, 9, 0.4);
  align-self: flex-start;
  margin-top: 6px;
}
.mos-btn-danger:hover { background: #FEF3C7; }

.mos-poll-row { display: flex; flex-wrap: wrap; gap: 8px; }
.mos-btn-poll {
  background: #F5F5F0;
  color: #1A1D29;
  border: 1px solid rgba(0,0,0,0.10);
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
}
.mos-btn-poll:hover { background: #ECECE5; }
.mos-btn-poll .mos-poll-label { font-weight: 600; }
.mos-btn-poll .mos-poll-count {
  font-size: 12px;
  background: rgba(0,0,0,0.06);
  padding: 2px 8px;
  border-radius: 999px;
  color: rgba(26, 29, 41, 0.7);
}
.mos-btn-poll.mos-status-current {
  background: #1D4ED8; color: #fff;
  border-color: #1D4ED8;
  box-shadow: 0 4px 12px rgba(29, 78, 216, 0.30);
}
.mos-btn-poll.mos-status-current .mos-poll-count {
  background: rgba(255,255,255,0.25); color: #fff;
}
.mos-btn-poll.mos-status-completed {
  background: #DCFCE7; color: #047857;
  border-color: rgba(4, 120, 87, 0.30);
}
.mos-btn-poll.mos-status-completed .mos-poll-count {
  background: rgba(4,120,87,0.15); color: #047857;
}

.mos-btn-reveal {
  background: #FEF3C7; color: #B45309;
  border: 1px solid rgba(245, 158, 11, 0.4);
  margin-top: 12px;
}
.mos-btn-reveal:hover:not(:disabled) { background: #FDE68A; }

.mos-btn-final {
  background: #047857; color: #fff;
  margin-top: 12px;
  padding: 12px 24px; font-size: 16px;
}
.mos-btn-final:hover:not(:disabled) { background: #059669; }

/* ─── Layer fragments inline ─── */
.mos-layer-fragments {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 6px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px dashed rgba(0,0,0,0.10);
}
.mos-frag-mini {
  background: #FAFAF7;
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 8px;
  padding: 6px 10px;
  display: flex; flex-direction: column;
  font-size: 12px;
}
.mos-frag-mini-name {
  color: rgba(26, 29, 41, 0.55);
  font-size: 11px;
  margin-bottom: 2px;
}
.mos-frag-mini-leader {
  font-weight: 700; color: #7E22CE;
}

/* ─── Modal ─── */
.mos-modal {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 10000;
  display: none;
  align-items: center; justify-content: center;
  padding: 40px;
}
.mos-modal.visible { display: flex; }
.mos-modal-content {
  background: #FFFFFF;
  border-radius: 18px;
  max-width: 1100px; width: 100%;
  max-height: 90vh; overflow-y: auto;
  padding: 32px;
  position: relative;
  box-shadow: 0 24px 80px rgba(0,0,0,0.3);
}
.mos-modal-close {
  position: absolute; top: 16px; right: 16px;
  width: 36px; height: 36px;
  background: #F5F5F0; border: none; border-radius: 50%;
  font-size: 18px; cursor: pointer;
}
.mos-modal h2 {
  font-size: 24px; margin-bottom: 6px; letter-spacing: -0.01em;
}
.mos-modal-sub {
  color: rgba(26, 29, 41, 0.6);
  font-size: 14px; margin-bottom: 24px;
}

.mos-fragments-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.mos-frag-card {
  background: #FAFAF7;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 12px;
  padding: 14px 16px;
}
.mos-frag-name { font-size: 13px; font-weight: 600; color: #1A1D29; margin-bottom: 8px; }
.mos-frag-leader { font-size: 16px; font-weight: 700; color: #7E22CE; margin-bottom: 4px; }
.mos-frag-strength { font-size: 12px; color: rgba(26, 29, 41, 0.7); line-height: 1.4; }

/* ─── Final reveal snapshot ─── */
.mos-snapshot-name {
  font-size: 13px; text-transform: uppercase; letter-spacing: 0.08em;
  color: rgba(26, 29, 41, 0.5);
  margin-bottom: 6px;
}
.mos-snapshot-headline {
  font-size: 24px; font-weight: 700; line-height: 1.3;
  color: #1A1D29;
  margin-bottom: 18px;
  letter-spacing: -0.01em;
}
.mos-snapshot-council {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
.mos-snapshot-leader {
  background: #FAFAF7;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 10px;
  padding: 10px 12px;
}
.mos-snapshot-leader .lyr {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em;
  color: rgba(26, 29, 41, 0.5);
  margin-bottom: 4px;
}
.mos-snapshot-leader .who { font-size: 14px; font-weight: 700; color: #1D4ED8; margin-bottom: 4px; }
.mos-snapshot-leader .str { font-size: 11px; color: rgba(26, 29, 41, 0.7); line-height: 1.4; }
.mos-snapshot-text {
  font-size: 15px; line-height: 1.7;
  color: rgba(26, 29, 41, 0.85);
  border-top: 1px solid rgba(0,0,0,0.08);
  padding-top: 18px;
}
.mos-snapshot-nav {
  display: flex; flex-wrap: wrap; gap: 6px;
  margin-top: 24px;
  padding-top: 18px;
  border-top: 1px solid rgba(0,0,0,0.08);
}
.mos-snapshot-pill {
  background: #F5F5F0;
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
}
.mos-snapshot-pill:hover { background: #ECECE5; }

@media (max-width: 800px) {
  .mos-cockpit { margin: 20px 16px; padding: 20px; }
  .mos-cockpit-grid { grid-template-columns: 1fr; }
}
