/* Relationship gauge in the chat header and its breakdown (chat window, saved slot card). */
.site-chat-header:has(.site-chat-gauge:not([hidden])) {
  grid-template-columns: 42px 46px 1fr 38px 42px;
}

.site-chat-empty-mode .site-chat-gauge {
  display: none;
}

.site-chat-gauge {
  --gauge-color: rgba(255, 255, 255, 0.35);
  position: relative;
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.04);
  box-shadow: 0 0 14px color-mix(in srgb, var(--gauge-color) 35%, transparent);
  cursor: pointer;
}

.site-chat-gauge[hidden] {
  display: none;
}

.site-chat-gauge svg {
  width: 34px;
  height: 34px;
  overflow: visible;
}

.site-chat-gauge .gauge-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.14);
  stroke-width: 3.2;
  stroke-dasharray: 75 100;
  transform: rotate(135deg);
  transform-origin: 18px 18px;
}

.site-chat-gauge .gauge-arc {
  fill: none;
  stroke: var(--gauge-color);
  stroke-width: 3.2;
  stroke-linecap: round;
  transform: rotate(135deg);
  transform-origin: 18px 18px;
  transition: stroke-dasharray 0.6s ease, stroke 0.6s ease;
}

.site-chat-gauge .gauge-needle {
  stroke: var(--gauge-color);
  stroke-width: 2;
  stroke-linecap: round;
  transform-origin: 18px 18px;
  transition: transform 0.6s ease, stroke 0.6s ease;
}

.site-chat-gauge .gauge-hub {
  fill: var(--gauge-color);
}

.site-chat-gauge.is-locked {
  opacity: 0.55;
}

.site-chat-gauge.is-locked::after {
  content: "🔒";
  position: absolute;
  right: -2px;
  bottom: -2px;
  font-size: 10px;
}

.site-chat-gauge.is-pending .gauge-hub {
  animation: relationship-pulse 1.2s ease-in-out infinite;
}

@keyframes relationship-pulse {
  50% { opacity: 0.35; }
}

.relationship-window {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 16px;
}

.relationship-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 2, 14, 0.62);
  backdrop-filter: blur(6px);
}

.relationship-card {
  position: relative;
  width: min(380px, 100%);
  max-height: calc(100dvh - 32px);
  overflow: auto;
  padding: 18px;
  border: 1px solid rgba(192, 132, 252, 0.34);
  border-radius: 22px;
  background:
    radial-gradient(circle at 90% 0%, rgba(236, 72, 153, 0.16), transparent 42%),
    rgba(14, 8, 30, 0.96);
  color: #f6edff;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
}

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

.relationship-card h3 {
  margin: 0;
  font-size: 17px;
}

.relationship-card header button {
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
  font-size: 22px;
  cursor: pointer;
}

.relationship-status {
  display: grid;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid color-mix(in srgb, var(--gauge-color) 55%, transparent);
  border-radius: 16px;
  background: color-mix(in srgb, var(--gauge-color) 12%, transparent);
}

.relationship-status strong {
  font-size: 18px;
}

.relationship-status span {
  font-size: 13px;
  opacity: 0.82;
}

.relationship-attitude {
  position: relative;
  margin: 14px 2px 4px;
  height: 8px;
  border-radius: 99px;
  background: linear-gradient(90deg, hsl(2, 80%, 58%), hsl(0, 0%, 62%), hsl(322, 85%, 62%));
}

.relationship-attitude i {
  position: absolute;
  top: 50%;
  width: 16px;
  height: 16px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--gauge-color);
  transform: translate(-50%, -50%);
  box-shadow: 0 0 10px var(--gauge-color);
}

.relationship-attitude small {
  position: absolute;
  top: 12px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  opacity: 0.6;
}

.relationship-card h4,
.slot-relationship h4 {
  margin: 24px 0 8px;
  font-size: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.7;
}

.relationship-feelings {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.relationship-feelings div {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 4px;
  font-size: 14px;
}

.relationship-feelings span {
  flex: 1;
  text-transform: capitalize;
}

.relationship-feelings b.is-beyond {
  color: #ffd166;
  text-shadow: 0 0 10px rgba(255, 209, 102, 0.6);
}

.relationship-feelings em,
.relationship-status em {
  font-size: 11px;
  font-style: normal;
}

.relationship-feelings em.is-up,
.relationship-status em.is-up {
  color: #7ee2a8;
}

.relationship-feelings em.is-down,
.relationship-status em.is-down {
  color: #ff8fa3;
}

.relationship-feelings i {
  display: block;
  height: 6px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.relationship-feelings i::before {
  content: "";
  display: block;
  width: var(--level);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, hsl(calc(var(--hue, 300) - 40), 80%, 52%), hsl(var(--hue, 322), 88%, 64%));
  box-shadow: 0 0 10px hsl(var(--hue, 322) 88% 64% / 0.55);
}

/* Where and when, the heart with the status, the thoughts from the reply. */
.relationship-scene {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 12px;
}

.relationship-scene span {
  padding: 4px 10px;
  border: 1px solid rgba(192, 132, 252, 0.28);
  border-radius: 99px;
  background: rgba(147, 51, 234, 0.1);
  font-size: 12px;
}

.relationship-hero {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
}

.relationship-hero .relationship-status {
  min-width: 0;
  overflow-wrap: anywhere;
}

.relationship-mood b {
  font-weight: 700;
}

.relationship-heart {
  --hue: 322;
  width: clamp(48px, 15vw, 64px);
  aspect-ratio: 32 / 30;
  animation: relationship-beat var(--beat, 1.1s) ease-in-out infinite;
}

.relationship-heart svg {
  width: 100%;
  height: 100%;
  overflow: visible;
}

.relationship-heart-shell {
  fill: hsl(var(--hue) 60% 50% / 0.18);
  stroke: hsl(var(--hue) 90% 70%);
  stroke-width: 1.6;
}

.relationship-heart-fill {
  fill: hsl(var(--hue) 88% 60%);
  transition: clip-path 0.6s ease;
}

.relationship-heart.is-full svg {
  filter: drop-shadow(0 0 8px hsl(var(--hue) 90% 62% / 0.8));
}

@keyframes relationship-beat {
  0%, 55%, 100% { transform: scale(1); }
  15% { transform: scale(1.12); }
  30% { transform: scale(0.97); }
  42% { transform: scale(1.06); }
}

.relationship-energy {
  display: block;
  height: 4px;
  margin-top: 6px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.relationship-energy::before {
  content: "";
  display: block;
  width: var(--level);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #a855f7, #f9a8d4);
}

.relationship-thought {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid rgba(192, 132, 252, 0.22);
  border-radius: 16px;
  background:
    radial-gradient(circle at 0% 0%, color-mix(in srgb, var(--gauge-color) 16%, transparent), transparent 60%),
    rgba(255, 255, 255, 0.03);
  font-size: 14px;
  font-style: italic;
  line-height: 1.5;
}

.relationship-desire small {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.6;
}

.relationship-desire {
  display: grid;
  gap: 4px;
  margin: 16px 0 0;
  padding: 10px 14px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(147, 51, 234, 0.18), rgba(236, 72, 153, 0.14));
  font-size: 15px;
  font-weight: 700;
}

@media (prefers-reduced-motion: reduce) {
  .relationship-heart { animation: none; }
}

.relationship-reason,
.relationship-pending,
.relationship-empty {
  margin: 14px 0 0;
  font-size: 12px;
  font-style: italic;
  opacity: 0.7;
}

.relationship-locked p {
  margin: 0 0 14px;
  font-size: 14px;
  line-height: 1.45;
}

.relationship-cta {
  display: block;
  padding: 12px;
  border-radius: 14px;
  background: linear-gradient(135deg, #9333ea, #ec4899);
  color: #fff;
  font-weight: 800;
  text-align: center;
  text-decoration: none;
}

body.theme-light .relationship-card,
.site-chat-body.theme-light .relationship-card {
  background: #fff8fc;
  color: #2a1530;
}

body.theme-light .relationship-thought,
.site-chat-body.theme-light .relationship-thought {
  background: rgba(42, 21, 48, 0.05);
}
