/* Sticky Single-Brain Sanctuary Guide — Shared Styles (Pill Drawer & Docked Explorer Bar) */

.sg-pill-btn {
  position: fixed;
  right: 20px;
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 850;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  padding: 8px 18px 8px 10px;
  border-radius: 999px;
  background: var(--ink, #233f2c);
  color: #fff9e8;
  border: 2px solid #f8f3df;
  box-shadow: 0 10px 26px rgba(35, 63, 44, 0.28);
  font: 800 14px/1.2 ui-rounded, "Arial Rounded MT Bold", system-ui, -apple-system, sans-serif;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.sg-pill-btn:hover {
  transform: translateY(-2px);
  background: #1a3121;
  box-shadow: 0 12px 30px rgba(35, 63, 44, 0.34);
}

.sg-pill-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #91bd6f;
  border: 1.5px solid #fff9e8;
  object-fit: cover;
  flex-shrink: 0;
}

.sg-pill-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #8ee065;
  box-shadow: 0 0 0 3px rgba(142, 224, 101, 0.25);
  flex-shrink: 0;
}

/* Mini-drawer on / and /about/ */
.sg-drawer {
  position: fixed;
  right: 20px;
  bottom: calc(max(20px, env(safe-area-inset-bottom)) + 58px);
  z-index: 851;
  width: calc(100vw - 32px);
  max-width: 380px;
  max-height: min(520px, calc(100dvh - 96px));
  background: #fffef7;
  color: var(--ink, #233f2c);
  border: 2px solid var(--ink, #233f2c);
  border-radius: 22px;
  box-shadow: 0 18px 42px rgba(35, 63, 44, 0.26);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sg-drawer[hidden] {
  display: none !important;
}

.sg-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 14px;
  background: #eef4dc;
  border-bottom: 1px solid #d5dfc0;
}

.sg-drawer-brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 850;
  color: var(--ink, #233f2c);
}

.sg-drawer-brand img {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  background: #91bd6f;
}

.sg-drawer-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.sg-explorer-link {
  font: 750 12px/1.2 system-ui, -apple-system, sans-serif;
  color: var(--green, #2c623d);
  text-decoration: none;
  padding: 6px 10px;
  border-radius: 999px;
  background: #fffef7;
  border: 1px solid #c5cfb0;
}

.sg-explorer-link:hover {
  background: #dfead0;
}

.sg-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--ink, #233f2c);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.sg-close-btn:hover {
  background: #dfead0;
}

.sg-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 180px;
  max-height: 290px;
}

.sg-msg {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 14px;
  font: 450 13.5px/1.55 system-ui, -apple-system, sans-serif;
  word-break: break-word;
}

.sg-msg.assistant {
  align-self: flex-start;
  background: #f1f5e6;
  border: 1px solid #dbe3cb;
  color: var(--ink, #233f2c);
  border-bottom-left-radius: 4px;
}

.sg-msg.user {
  align-self: flex-end;
  background: var(--ink, #233f2c);
  color: #fff9e8;
  border-bottom-right-radius: 4px;
}

.sg-msg p {
  margin: 0 0 6px;
}

.sg-msg p:last-child {
  margin-bottom: 0;
}

.sg-msg ul {
  margin: 4px 0;
  padding-left: 18px;
}

.sg-msg li {
  margin-bottom: 3px;
}

.sg-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 12px;
  background: #faf6ea;
  border-top: 1px solid #e5dec9;
}

.sg-chip {
  background: #e9eed9;
  border: 1px solid #c5cfb0;
  border-radius: 999px;
  padding: 5px 11px;
  font: 700 11.5px/1.2 system-ui, -apple-system, sans-serif;
  color: var(--ink, #233f2c);
  cursor: pointer;
  transition: background 0.12s ease;
}

.sg-chip:hover {
  background: #dbe4c4;
}

.sg-form {
  display: flex;
  gap: 8px;
  padding: 10px 12px;
  background: #faf6ea;
  border-top: 1px solid #d9dec8;
}

.sg-input {
  flex: 1;
  min-width: 0;
  border: 1.5px solid #c5cfb0;
  border-radius: 10px;
  padding: 9px 12px;
  font: 500 13.5px/1.3 system-ui, -apple-system, sans-serif;
  background: #fff;
  color: var(--ink, #233f2c);
  outline: none;
}

.sg-input:focus {
  border-color: var(--green, #2c623d);
}

.sg-send {
  background: var(--ink, #233f2c);
  color: #fff9e8;
  border: none;
  border-radius: 10px;
  padding: 0 15px;
  font: 750 13px/1 system-ui, -apple-system, sans-serif;
  cursor: pointer;
}

.sg-send:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Docked Single-Bar Mode on /guide/ */
.sg-dock-wrap {
  position: sticky;
  bottom: 12px;
  z-index: 50;
  margin-top: 28px;
}

.sg-dock-card {
  background: #fffef7;
  border: 2px solid var(--ink, #233f2c);
  border-radius: 22px;
  box-shadow: 0 14px 34px rgba(35, 63, 44, 0.16);
  overflow: hidden;
}

.sg-dock-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 16px;
  background: #eef4dc;
  border-bottom: 1px solid #d5dfc0;
}

.sg-dock-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 850;
  color: var(--ink, #233f2c);
}

.sg-dock-title img {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: #91bd6f;
}

.sg-dock-toggle {
  background: #fffef7;
  border: 1px solid #c5cfb0;
  border-radius: 999px;
  padding: 5px 12px;
  font: 700 12px/1.2 system-ui, -apple-system, sans-serif;
  color: var(--ink, #233f2c);
  cursor: pointer;
}

.sg-dock-toggle:hover {
  background: #dfead0;
}

.sg-dock-card .sg-messages {
  max-height: 260px;
}

.sg-dock-card.collapsed .sg-messages {
  display: none;
}

@media (max-width: 600px) {
  .sg-drawer {
    right: 12px;
    left: 12px;
    width: auto;
    max-width: none;
  }
  .sg-pill-btn {
    right: 14px;
    bottom: max(14px, env(safe-area-inset-bottom));
  }
}
