/* ============================================================
   Proto P button + Connect modal — /mastels/
   Palette mirrors globalproto.com/store and /mastels/index.html:
   dark grey base (rgb(16,17,20)) + mint accent (rgb(110,231,183))
   with sage as the secondary (rgb(144,163,117)).
   ============================================================ */

/* P button in nav (added before .top__back) */
.proto-p-btn {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid rgba(16, 185, 129, 0.32);
  background: rgba(16, 185, 129, 0.08);
  color: rgb(110, 231, 183);
  font-family: 'Playfair Display', 'Cormorant Garamond', Georgia, serif;
  font-weight: 600;
  font-size: 22px;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin-right: 12px;
  padding: 0;
  letter-spacing: 0;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.2s ease;
  position: relative;
}
.proto-p-btn:hover {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(16, 185, 129, 0.55);
  color: rgb(110, 231, 183);
}
.proto-p-btn:active { transform: scale(0.96); }
.proto-p-btn:focus-visible {
  outline: 2px solid rgb(110, 231, 183);
  outline-offset: 2px;
}

/* Connected state — shifts to a sage tone so the dot reads clearly */
.proto-p-btn.is-connected {
  background: rgba(144, 163, 117, 0.18);
  border-color: rgba(144, 163, 117, 0.55);
  color: rgb(180, 198, 145);
}
.proto-p-btn.is-connected::after {
  content: '';
  position: absolute;
  top: -2px; right: -2px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: rgb(110, 231, 183);
  box-shadow: 0 0 0 2px rgb(16, 17, 20), 0 0 10px rgba(16, 185, 129, 0.55);
}

@media (max-width: 720px) {
  .proto-p-btn { width: 36px; height: 36px; font-size: 19px; margin-right: 8px; }
}

/* ===== Modal overlay ===== */
.proto-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(8, 9, 11, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  transition: opacity 0.22s ease;
}
.proto-overlay.is-open { display: flex; opacity: 1; }

.proto-modal {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: rgb(20, 22, 26);
  border: 1px solid rgba(239, 237, 235, 0.10);
  border-radius: 14px;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, 0.85), 0 0 0 1px rgba(16, 185, 129, 0.05);
  padding: 36px;
  color: rgb(239, 237, 235);
  transform: translateY(16px) scale(0.97);
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
}
.proto-overlay.is-open .proto-modal { transform: translateY(0) scale(1); }
@media (max-width: 540px) {
  .proto-modal { padding: 28px 22px; border-radius: 12px; }
}

.proto-modal__header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 20px;
}
.proto-modal__icon {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  background: rgba(16, 185, 129, 0.10);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: rgb(110, 231, 183);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 600;
  font-size: 26px;
  flex-shrink: 0;
}
.proto-modal__title {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 600;
  font-size: 26px;
  color: rgb(239, 237, 235);
  margin: 0;
  line-height: 1.1;
}
.proto-modal__subtitle {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(239, 237, 235, 0.55);
  margin-top: 4px;
}

.proto-modal__close {
  position: absolute;
  top: 18px; right: 18px;
  background: transparent;
  border: none;
  color: rgba(239, 237, 235, 0.55);
  font-size: 22px;
  line-height: 1;
  width: 32px; height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 0.15s ease, color 0.15s ease;
}
.proto-modal__close:hover { background: rgba(239, 237, 235, 0.06); color: rgb(239, 237, 235); }

.proto-body {
  font-size: 15px;
  line-height: 1.6;
  color: rgba(239, 237, 235, 0.78);
}
.proto-body p { margin: 0 0 14px 0; }
.proto-body p:last-child { margin-bottom: 0; }
.proto-body strong { color: rgb(239, 237, 235); font-weight: 500; }

.proto-checklist {
  margin: 20px 0;
  padding: 18px 20px;
  background: rgba(239, 237, 235, 0.03);
  border: 1px solid rgba(239, 237, 235, 0.08);
  border-radius: 10px;
}
.proto-checklist__label {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(239, 237, 235, 0.55);
  margin-bottom: 10px;
}
.proto-checklist ul { list-style: none; padding: 0; margin: 0; }
.proto-checklist li {
  font-size: 14px;
  color: rgba(239, 237, 235, 0.78);
  padding: 5px 0 5px 22px;
  position: relative;
}
.proto-checklist li::before {
  content: '';
  position: absolute;
  left: 0; top: 11px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: rgb(110, 231, 183);
}

.proto-privacy {
  font-size: 12px;
  color: rgba(239, 237, 235, 0.55);
  line-height: 1.55;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(239, 237, 235, 0.06);
}

.proto-actions {
  display: flex;
  gap: 12px;
  margin-top: 24px;
  flex-wrap: wrap;
}
.proto-btn {
  flex: 1 1 auto;
  min-width: 130px;
  padding: 13px 22px;
  border-radius: 999px;
  font-family: 'Inter', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, transform 0.18s ease;
  border: 1px solid transparent;
  text-align: center;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.proto-btn--primary {
  background: rgba(16, 185, 129, 0.18);
  color: rgb(110, 231, 183);
  border-color: rgba(16, 185, 129, 0.55);
}
.proto-btn--primary:hover {
  background: rgba(16, 185, 129, 0.28);
  border-color: rgba(16, 185, 129, 0.75);
  transform: translateY(-1px);
}
.proto-btn--ghost {
  background: transparent;
  color: rgba(239, 237, 235, 0.78);
  border-color: rgba(239, 237, 235, 0.18);
}
.proto-btn--ghost:hover { color: rgb(239, 237, 235); border-color: rgba(239, 237, 235, 0.32); }

/* ===== Loading ===== */
.proto-loading { text-align: center; padding: 12px 0 8px; }
.proto-loading__spinner {
  width: 64px;
  height: 64px;
  border-radius: 14px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.28);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 600;
  font-size: 32px;
  color: rgb(110, 231, 183);
  position: relative;
  margin-bottom: 18px;
}
.proto-loading__spinner::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 16px;
  border: 2px solid transparent;
  border-top-color: rgb(110, 231, 183);
  animation: protoSpin 0.9s linear infinite;
}
@keyframes protoSpin { to { transform: rotate(360deg); } }
.proto-loading__title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 22px;
  font-weight: 600;
  color: rgb(239, 237, 235);
  margin: 0 0 6px;
}
.proto-loading__text { font-size: 14px; color: rgba(239, 237, 235, 0.55); }

/* ===== Connected summary ===== */
.proto-summary { margin-top: 4px; }
.proto-summary__panel {
  margin: 18px 0 22px;
  padding: 18px 20px;
  background: rgba(16, 185, 129, 0.06);
  border: 1px solid rgba(16, 185, 129, 0.22);
  border-radius: 10px;
}
.proto-summary__label {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(239, 237, 235, 0.55);
  margin-bottom: 10px;
}
.proto-summary__list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.proto-summary__chip {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.05em;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(239, 237, 235, 0.05);
  border: 1px solid rgba(239, 237, 235, 0.10);
  color: rgba(239, 237, 235, 0.78);
}
.proto-summary__chip--high {
  background: rgba(244, 114, 80, 0.14);
  border-color: rgba(244, 114, 80, 0.42);
  color: rgb(244, 162, 130);
}
.proto-summary__chip--low {
  background: rgba(144, 163, 117, 0.16);
  border-color: rgba(144, 163, 117, 0.45);
  color: rgb(180, 198, 145);
}

/* ===== Ranked product list ===== */
.proto-recs {
  list-style: none;
  padding: 0;
  margin: 0 0 6px;
}
.proto-recs__item {
  display: grid;
  grid-template-columns: 24px 64px 1fr;
  align-items: start;
  gap: 14px;
  padding: 16px 0;
  border-top: 1px solid rgba(239, 237, 235, 0.06);
}
.proto-recs__item:first-child { border-top: none; padding-top: 4px; }
.proto-recs__rank {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.10em;
  color: rgb(110, 231, 183);
  padding-top: 4px;
}
.proto-recs__media {
  width: 64px;
  height: 64px;
  border-radius: 8px;
  overflow: hidden;
  background: rgba(239, 237, 235, 0.05);
  border: 1px solid rgba(239, 237, 235, 0.08);
  display: flex;
  align-items: center;
  justify-content: center;
}
.proto-recs__media__fallback {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 600;
  font-size: 24px;
  color: rgba(110, 231, 183, 0.62);
}
.proto-recs__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.proto-recs__body {
  min-width: 0;
}
.proto-recs__pill {
  display: inline-block;
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 3px 7px;
  border-radius: 999px;
  margin-bottom: 5px;
}
.proto-recs__pill--rec {
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid rgba(16, 185, 129, 0.42);
  color: rgb(110, 231, 183);
}
.proto-recs__pill--match {
  background: rgba(144, 163, 117, 0.14);
  border: 1px solid rgba(144, 163, 117, 0.38);
  color: rgb(180, 198, 145);
}
.proto-recs__namerow {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.proto-recs__name {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 600;
  font-size: 17px;
  color: rgb(239, 237, 235);
  line-height: 1.25;
}
.proto-recs__price {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 12px;
  letter-spacing: 0.04em;
  color: rgb(110, 231, 183);
  white-space: nowrap;
  flex-shrink: 0;
}
.proto-recs__vendor {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(239, 237, 235, 0.42);
  margin: 3px 0 6px;
}
.proto-recs__why {
  font-size: 13px;
  color: rgba(239, 237, 235, 0.78);
  line-height: 1.5;
}
.proto-recs__tags {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.proto-recs__tag {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(239, 237, 235, 0.04);
  border: 1px solid rgba(239, 237, 235, 0.08);
  color: rgba(239, 237, 235, 0.55);
}

/* ===== Error ===== */
.proto-error {
  padding: 16px 18px;
  border-radius: 10px;
  background: rgba(244, 114, 80, 0.08);
  border: 1px solid rgba(244, 114, 80, 0.28);
  color: rgb(244, 162, 130);
  font-size: 14px;
  line-height: 1.55;
  margin-bottom: 18px;
}
.proto-error strong { color: rgb(239, 237, 235); font-weight: 500; }

/* ===== Personalized banner (bottom-center while connected) ===== */
.proto-personalized-banner {
  display: none;
  position: fixed;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  padding: 9px 14px 9px 14px;
  border-radius: 999px;
  background: rgba(20, 22, 26, 0.92);
  border: 1px solid rgba(16, 185, 129, 0.42);
  backdrop-filter: blur(8px);
  font-family: 'JetBrains Mono', ui-monospace, monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgb(239, 237, 235);
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.75);
  align-items: center;
  gap: 10px;
}
.proto-personalized-banner::before {
  content: '';
  width: 7px; height: 7px; border-radius: 50%;
  background: rgb(110, 231, 183);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.7);
  display: inline-block;
}
.proto-personalized-banner button {
  background: transparent;
  border: none;
  color: rgba(239, 237, 235, 0.55);
  font: inherit;
  font-size: 11px;
  cursor: pointer;
  padding: 0 0 0 10px;
  letter-spacing: 0.10em;
  border-left: 1px solid rgba(239, 237, 235, 0.15);
  margin-left: 6px;
}
.proto-personalized-banner button:hover { color: rgb(239, 237, 235); }
body.proto-connected .proto-personalized-banner { display: inline-flex; }
