.emotion-card {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius-md);
  padding: 1.2rem 1.25rem 1.35rem;
  background:
    linear-gradient(145deg, var(--bg-card-2), rgba(129, 74, 200, 0.1)),
    radial-gradient(
      ellipse 120% 80% at 100% 0%,
      rgba(223, 122, 254, 0.12),
      transparent 58%
    );
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}

.emotion-kicker {
  margin: 0 0 0.25rem;
  font-size: 0.8rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.emotion-title {
  margin: 0;
  margin-bottom: 0 0 0.35rem 0;
  font-size: clamp(1.05rem, 2.6vw, 1.35rem);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.emotion-copy {
  margin: 0.6rem 0 1rem;
  color: var(--text-soft);
  font-size: 0.9rem;
  line-height: 1.45;
}

.emotion-summary {
  display: block;
  margin: 0.95rem 0 1.05rem;
}

.emotion-primary-score {
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  padding: 0.95rem 1rem 0.9rem;
  text-align: center;
  background:
    radial-gradient(circle at 0% 0%, rgba(118, 240, 191, 0.08), transparent 58%),
    radial-gradient(circle at 100% 0%, rgba(76, 227, 255, 0.08), transparent 56%),
    rgba(255, 255, 255, 0.025);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

.emotion-primary-label {
  margin: 0;
  color: rgba(228, 241, 255, 0.9);
  font-size: 0.92rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  font-weight: 700;
}

.emotion-primary-value {
  margin: 0.3rem 0 0.2rem;
  font-size: clamp(1.85rem, 5.3vw, 2.5rem);
  font-weight: 760;
  line-height: 1.02;
  letter-spacing: -0.02em;
  color: #ffffff;
  text-shadow:
    0 0 12px rgba(118, 240, 191, 0.18),
    0 0 18px rgba(76, 227, 255, 0.16);
}

/* .emotion-primary-sub {
  margin: 0;
  color: rgba(216, 232, 255, 0.84);
  font-size: 0.92rem;
  line-height: 1.4;
  max-width: 42ch;
} */

.emotion-map-wrap {
  margin: 0.2rem 0 0.9rem;
}

.emotion-simple {
  margin: 0.25rem 0 0.4rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  padding: 1.1rem 1.05rem 1rem;
  background:
    radial-gradient(circle at 0% 0%, rgba(255, 126, 234, 0.14), transparent 56%),
    radial-gradient(circle at 100% 0%, rgba(76, 227, 255, 0.14), transparent 56%),
    rgba(255, 255, 255, 0.05);
  display: grid;
  gap: 0.95rem;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}

.emotion-simple-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  text-align: center;
}

.emotion-simple-head > div {
  display: grid;
  justify-items: center;
}

.emotion-simple-emoji {
  display: inline-grid;
  place-items: center;
  width: 2.7rem;
  height: 2.7rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 1.45rem;
  line-height: 1;
}

.emotion-simple-title {
  margin: 0;
  font-size: clamp(1.22rem, 3.4vw, 1.62rem);
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.015em;
  line-height: 1.18;
}

.emotion-meter-block {
  display: grid;
  gap: 0.35rem;
}

.emotion-meter-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.03rem;
  color: var(--text-soft);
  font-weight: 600;
}

.emotion-meter-track {
  height: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

.emotion-meter-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  transition: width 280ms ease;
}

.emotion-meter-fill.arousal {
  background: linear-gradient(90deg, rgba(118, 240, 191, 0.92), rgba(76, 227, 255, 0.9));
}

.emotion-meter-fill.valence {
  background: linear-gradient(90deg, rgba(255, 126, 234, 0.92), rgba(223, 122, 254, 0.9));
}

.emotion-map {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background:
    radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.05), transparent 68%),
    rgba(255, 255, 255, 0.02);
  isolation: isolate;
  --q-accent: rgba(223, 122, 254, 0.2);
}

.emotion-map::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 50%, var(--q-accent), transparent 62%);
  opacity: 0.22;
  transition: background 280ms ease, opacity 280ms ease;
  z-index: 1;
}

.emotion-map.quadrant-q1 {
  --q-accent: rgba(76, 227, 255, 0.34);
}

.emotion-map.quadrant-q2 {
  --q-accent: rgba(255, 126, 234, 0.34);
}

.emotion-map.quadrant-q3 {
  --q-accent: rgba(122, 166, 255, 0.28);
}

.emotion-map.quadrant-q4 {
  --q-accent: rgba(118, 240, 191, 0.3);
}

.emotion-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.07) 1px, transparent 1px);
  background-size: 10% 10%;
  opacity: 0.45;
  animation: map-grid-breathe 4.2s ease-in-out infinite;
  z-index: 0;
}

.emotion-circumplex-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px dashed rgba(255, 255, 255, 0.22);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.05),
    0 0 24px rgba(223, 122, 254, 0.08);
  z-index: 1;
  opacity: 0.85;
}

.emotion-center-dot {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255, 255, 255, 0.65);
  box-shadow: 0 0 0 6px rgba(255, 255, 255, 0.08);
  z-index: 3;
}

.emotion-axis {
  position: absolute;
  background: rgba(255, 255, 255, 0.35);
  z-index: 2;
}

.emotion-axis.axis-x {
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
}

.emotion-axis.axis-y {
  top: 0;
  bottom: 0;
  left: 50%;
  width: 1px;
}

.emotion-axis-label {
  position: absolute;
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.82);
  background: rgba(7, 10, 19, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 0.24rem 0.55rem;
  backdrop-filter: blur(6px);
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
}

.emotion-axis-label.axis-top {
  top: 0.45rem;
  left: 50%;
  transform: translateX(-50%);
}

.emotion-axis-label.axis-bottom {
  bottom: 0.45rem;
  left: 50%;
  transform: translateX(-50%);
}

.emotion-axis-label.axis-left {
  left: 0.45rem;
  top: 50%;
  transform: translateY(-50%);
}

.emotion-axis-label.axis-right {
  right: 0.45rem;
  top: 50%;
  transform: translateY(-50%);
}

.emotion-quadrant {
  display: none;
}

.emotion-quadrant.q1 {
  top: 14%;
  right: 11%;
}

.emotion-quadrant.q2 {
  top: 14%;
  left: 11%;
}

.emotion-quadrant.q3 {
  bottom: 14%;
  left: 11%;
}

.emotion-quadrant.q4 {
  bottom: 14%;
  right: 11%;
}

.emotion-point {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.7);
  background: linear-gradient(135deg, rgba(223, 122, 254, 0.95), rgba(76, 227, 255, 0.95));
  box-shadow: 0 0 0 4px rgba(223, 122, 254, 0.18), 0 8px 18px rgba(0, 0, 0, 0.35);
  left: clamp(14px, var(--point-x, 50%), calc(100% - 14px));
  top: clamp(14px, var(--point-y, 50%), calc(100% - 14px));
  transform: translate(-50%, -50%);
  transition: left 220ms ease, top 220ms ease, transform 220ms ease;
  animation: emotion-point-pulse 1.8s ease-in-out infinite;
  z-index: 5;
}

.emotion-point::after {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 1px solid rgba(223, 122, 254, 0.36);
  opacity: 0;
  animation: emotion-point-ring 2.2s ease-out infinite;
}

.emotion-interpretation {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.9rem;
  line-height: 1.45;
}

.emotion-guide {
  position: absolute;
  pointer-events: none;
  z-index: 4;
  transition: left 240ms ease, top 240ms ease;
}

/* Bars are drawn in ::before so we can grow from each axis toward the marker. */
.emotion-guide::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 999px;
}

.emotion-guide.guide-x {
  height: 6px;
  width: 0;
  background: transparent;
}

.emotion-guide.guide-x::before {
  transform: scaleX(1);
  transform-origin: left center;
  background:
    linear-gradient(
      to right,
      rgba(223, 122, 254, 0.12),
      rgba(76, 227, 255, 0.78) 52%,
      rgba(255, 255, 255, 0.28)
    );
  background-size: 220% 100%;
  box-shadow:
    0 0 14px rgba(76, 227, 255, 0.35),
    0 1px 0 rgba(255, 255, 255, 0.08) inset;
  animation: guide-flow-x 2.6s linear infinite;
}

.emotion-guide.guide-x.to-left::before {
  transform-origin: right center;
  background:
    linear-gradient(
      to left,
      rgba(223, 122, 254, 0.12),
      rgba(76, 227, 255, 0.78) 52%,
      rgba(255, 255, 255, 0.28)
    );
  animation: guide-flow-x-left 2.6s linear infinite;
}

.emotion-guide.guide-x.animate-draw:not(.to-left)::before,
.emotion-guide.guide-x.animate-draw-replay:not(.to-left)::before {
  animation:
    emotion-guide-grow-x-from-left 0.75s cubic-bezier(0.25, 0.82, 0.25, 1) forwards,
    guide-flow-x 2.6s linear infinite;
}

.emotion-guide.guide-x.animate-draw.to-left::before,
.emotion-guide.guide-x.animate-draw-replay.to-left::before {
  animation:
    emotion-guide-grow-x-from-right 0.75s cubic-bezier(0.25, 0.82, 0.25, 1) forwards,
    guide-flow-x-left 2.6s linear infinite;
}

.emotion-guide.guide-y {
  width: 6px;
  height: 0;
  background: transparent;
}

.emotion-guide.guide-y::before {
  background:
    linear-gradient(
      to bottom,
      rgba(223, 122, 254, 0.12),
      rgba(76, 227, 255, 0.78) 52%,
      rgba(255, 255, 255, 0.28)
    );
  background-size: 100% 220%;
  box-shadow:
    0 0 14px rgba(76, 227, 255, 0.35),
    1px 0 0 rgba(255, 255, 255, 0.08) inset;
  animation: guide-flow-y 2.6s linear infinite;
}

/*
 * Vertical segment: horizontal arousal axis (midline) → marker.
 * clip-path avoids scaleY ambiguity with the shimmering gradient so motion clearly
 * runs from axis toward marker in both halves of the plane.
 *
 * Marker above midline → segment grows ↑ (unclip from bottom / axis-first).
 * Marker below midline → segment grows ↓ (unclip from top / axis-first).
 */
.emotion-guide.guide-y.animate-draw.toward-top::before,
.emotion-guide.guide-y.animate-draw-replay.toward-top::before {
  animation: emotion-guide-y-reveal-from-horizontal-axis-up 0.75s
    cubic-bezier(0.25, 0.82, 0.25, 1) forwards;
}

.emotion-guide.guide-y.animate-draw.toward-bottom::before,
.emotion-guide.guide-y.animate-draw-replay.toward-bottom::before {
  animation: emotion-guide-y-reveal-from-horizontal-axis-down 0.75s
    cubic-bezier(0.25, 0.82, 0.25, 1) forwards;
}

.emotion-point-label {
  position: absolute;
  left: clamp(34px, var(--point-x, 50%), calc(100% - 34px));
  top: clamp(28px, var(--point-y, 50%), calc(100% - 28px));
  transform: translate(-50%, calc(-100% - 12px));
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(7, 10, 19, 0.72);
  padding: 0.28rem 0.6rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #f0f6ff;
  backdrop-filter: blur(7px);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.34);
  z-index: 6;
  transition: left 240ms ease, top 240ms ease, transform 240ms ease;
  white-space: nowrap;
}

.emotion-point-label.below {
  transform: translate(-50%, 12px);
}

.emotion-point-label.edge-right {
  transform: translate(calc(-100% - 12px), calc(-100% - 2px));
}

.emotion-point-label.edge-left {
  transform: translate(12px, calc(-100% - 2px));
}

.emotion-point-label.below.edge-right {
  transform: translate(calc(-100% - 12px), 10px);
}

.emotion-point-label.below.edge-left {
  transform: translate(12px, 10px);
}

.emotion-mode-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.emotion-mode-tag {
  position: absolute;
  transform: translate(-50%, -50%);
  color: rgba(236, 244, 255, 0.96);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-shadow: 0 1px 6px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  padding: 0.2rem 0.55rem;
  background:
    radial-gradient(circle at 0% 0%, rgba(223, 122, 254, 0.12), transparent 62%),
    radial-gradient(circle at 100% 0%, rgba(76, 227, 255, 0.12), transparent 62%),
    rgba(7, 10, 19, 0.7);
  box-shadow:
    0 8px 20px rgba(0, 0, 0, 0.26),
    0 0 0 1px rgba(255, 255, 255, 0.03) inset;
  backdrop-filter: blur(6px);
  opacity: 0;
  transition:
    opacity 220ms ease,
    transform 220ms ease,
    color 220ms ease,
    border-color 220ms ease,
    box-shadow 220ms ease;
  white-space: nowrap;
}

.emotion-mode-tag.is-active {
  opacity: 1;
}

.emotion-mode-tag.is-primary {
  font-weight: 800;
  color: #ffffff;
  border-color: rgba(118, 240, 191, 0.5);
  box-shadow:
    0 10px 24px rgba(0, 0, 0, 0.32),
    0 0 0 1px rgba(118, 240, 191, 0.18) inset,
    0 0 14px rgba(118, 240, 191, 0.28);
  transform: translate(-50%, -50%) scale(1.06);
}

.emotion-map:hover .emotion-point {
  transform: translate(-50%, -50%) scale(1.08);
}

@keyframes emotion-point-pulse {
  0%,
  100% {
    box-shadow: 0 0 0 4px rgba(223, 122, 254, 0.18), 0 8px 18px rgba(0, 0, 0, 0.35);
  }
  50% {
    box-shadow: 0 0 0 7px rgba(76, 227, 255, 0.22), 0 10px 22px rgba(0, 0, 0, 0.42);
  }
}

@keyframes emotion-point-ring {
  0% {
    transform: scale(0.75);
    opacity: 0.55;
  }
  70% {
    transform: scale(1.2);
    opacity: 0.1;
  }
  100% {
    transform: scale(1.35);
    opacity: 0;
  }
}

@keyframes map-grid-breathe {
  0%,
  100% {
    opacity: 0.36;
  }
  50% {
    opacity: 0.5;
  }
}

@keyframes guide-flow-x {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 220% 50%;
  }
}

@keyframes guide-flow-x-left {
  0% {
    background-position: 220% 50%;
  }
  100% {
    background-position: 0% 50%;
  }
}

@keyframes guide-flow-y {
  0% {
    background-position: 50% 0%;
  }
  100% {
    background-position: 50% 220%;
  }
}

@keyframes emotion-guide-grow-x-from-left {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

@keyframes emotion-guide-grow-x-from-right {
  from {
    transform: scaleX(0);
  }
  to {
    transform: scaleX(1);
  }
}

/* Axis at segment bottom → first visible ink at bottom, sweeps ↑ toward marker. */
@keyframes emotion-guide-y-reveal-from-horizontal-axis-up {
  from {
    clip-path: inset(100% 0 0 0);
  }
  to {
    clip-path: inset(0 0 0 0);
  }
}

/* Axis at segment top → first ink at top, sweeps ↓ toward marker. */
@keyframes emotion-guide-y-reveal-from-horizontal-axis-down {
  from {
    clip-path: inset(0 0 100% 0);
  }
  to {
    clip-path: inset(0 0 0 0);
  }
}

@media (max-width: 700px) {
  .emotion-card {
    padding: 1rem;
  }

  .emotion-summary {
    grid-template-columns: 1fr;
  }

  .emotion-axis-label {
    font-size: 0.68rem;
  }

  .emotion-point-label {
    font-size: 0.72rem;
    padding: 0.24rem 0.5rem;
  }

  .emotion-mode-tag {
    font-size: 0.68rem;
    padding: 0.18rem 0.46rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .emotion-grid,
  .emotion-point,
  .emotion-point::after,
  .emotion-guide.guide-x,
  .emotion-guide.guide-x.animate-draw,
  .emotion-guide.guide-x.animate-draw-replay,
  .emotion-guide.guide-y,
  .emotion-guide.guide-x::before,
  .emotion-guide.guide-y::before {
    animation: none !important;
  }

  .emotion-guide.guide-x::before {
    transform: scaleX(1) !important;
  }

  .emotion-guide.guide-y::before {
    clip-path: none !important;
  }
}
