.ebv {
  --ebv-ink: #311018;
  --ebv-muted: #7a5660;
  --ebv-panel: #fff7f8;
  --ebv-line: rgba(143, 34, 57, 0.2);
  --ebv-red: #c61235;
  --ebv-red-dark: #870a23;
  --ebv-red-soft: #ffe1e7;
  --ebv-cream: #fffdfb;

  color: var(--ebv-ink);
  width: 100%;
}

.theme-dark .ebv {
  --ebv-ink: #fff0f3;
  --ebv-muted: #e3a7b5;
  --ebv-panel: #261217;
  --ebv-line: rgba(255, 177, 190, 0.22);
  --ebv-red: #ff4668;
  --ebv-red-dark: #b80d31;
  --ebv-red-soft: rgba(255, 70, 104, 0.18);
  --ebv-cream: #170b0e;
}

.ebv__panel {
  display: grid;
  gap: 1rem;
  grid-template-columns: minmax(0, 1fr);
  padding: 1rem;
  border: 1px solid var(--ebv-line);
  border-radius: 8px;
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 112, 132, 0.22), transparent 28%),
    linear-gradient(135deg, var(--ebv-panel), var(--ebv-cream));
  box-shadow: 0 18px 48px rgba(112, 18, 37, 0.13);
}

.ebv__controls,
.ebv__visual,
.ebv__results {
  min-width: 0;
}

.ebv [hidden] {
  display: none;
}

.ebv__unit,
.ebv__row,
.ebv__selector-stack,
.ebv__chips,
.ebv__results {
  display: grid;
  gap: 0.7rem;
}

.ebv__unit {
  grid-template-columns: 1fr 1fr;
  padding: 0.25rem;
  border: 1px solid var(--ebv-line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.48);
}

.theme-dark .ebv__unit {
  background: rgba(255, 255, 255, 0.05);
}

.ebv__pill {
  border: 0;
  border-radius: 999px;
  padding: 0.65rem 0.9rem;
  color: var(--ebv-muted);
  background: transparent;
  font-weight: 800;
  cursor: pointer;
}

.ebv__pill--active {
  color: #fff;
  background: linear-gradient(135deg, var(--ebv-red), var(--ebv-red-dark));
}

.ebv__row {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 0.8rem;
}

.ebv__row--imperial {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.ebv__field,
.ebv__choice-field {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
  color: var(--ebv-muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ebv__choice-field {
  gap: 0.45rem;
}

.ebv__selector-stack {
  margin-top: 0.8rem;
}

.ebv__choice {
  display: grid;
  gap: 0.35rem;
  padding: 0.35rem;
  border: 1px solid var(--ebv-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.48);
}

.theme-dark .ebv__choice {
  background: rgba(255, 255, 255, 0.055);
}

.ebv__choice--sex {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.ebv__choice--build {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.ebv__choice-btn {
  min-width: 0;
  border: 0;
  border-radius: 7px;
  padding: 0.72rem 0.6rem;
  color: var(--ebv-muted);
  background: transparent;
  font: inherit;
  font-size: 0.92rem;
  font-weight: 900;
  line-height: 1.1;
  cursor: pointer;
  transition: background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.ebv__choice-btn:hover {
  color: var(--ebv-ink);
  background: rgba(198, 18, 53, 0.11);
}

.ebv__choice-btn--active {
  color: #fff;
  background: var(--ebv-red);
  box-shadow: 0 8px 20px rgba(198, 18, 53, 0.26);
}

.theme-dark .ebv__choice-btn--active {
  color: #fff;
  background: #f23b62;
  box-shadow: 0 8px 24px rgba(242, 59, 98, 0.28);
}

.ebv__choice-btn:focus-visible {
  outline: 3px solid rgba(255, 84, 119, 0.28);
  outline-offset: 2px;
}

.ebv__field input {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--ebv-line);
  border-radius: 8px;
  padding: 0.84rem 0.85rem;
  color: var(--ebv-ink);
  background: rgba(255, 255, 255, 0.74);
  font: inherit;
  font-size: 1rem;
  font-weight: 850;
  text-transform: none;
  letter-spacing: 0;
}

.ebv__field input:hover {
  border-color: rgba(198, 18, 53, 0.42);
  background-color: rgba(255, 255, 255, 0.96);
}

.ebv__field input:focus {
  outline: 3px solid rgba(198, 18, 53, 0.16);
  outline-offset: 2px;
  border-color: var(--ebv-red);
}

.theme-dark .ebv__field input {
  background: rgba(255, 255, 255, 0.06);
}

.theme-dark .ebv__field input:hover {
  background-color: rgba(255, 255, 255, 0.12);
}

.ebv__chips {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 0.8rem;
}

.ebv__chips span {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.7rem;
  border-radius: 8px;
  background: var(--ebv-red-soft);
  color: var(--ebv-muted);
  font-weight: 800;
}

.ebv__chips svg {
  width: 1.1rem;
  height: 1.1rem;
  color: var(--ebv-red);
}

.ebv__chips strong {
  color: var(--ebv-ink);
  font-size: 1.15rem;
}

.ebv__note,
.ebv__method-note {
  margin-top: 0.8rem;
  padding: 0.8rem;
  border-left: 4px solid var(--ebv-red);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.5);
}

.theme-dark .ebv__note,
.theme-dark .ebv__method-note {
  background: rgba(255, 255, 255, 0.05);
}

.ebv__note p,
.ebv__method-note p {
  margin: 0.25rem 0 0;
  color: var(--ebv-muted);
  line-height: 1.45;
}

.ebv__visual {
  display: grid;
  place-items: center;
  gap: 0.8rem;
  padding: 0.8rem;
}

.ebv__bag {
  position: relative;
  width: min(72vw, 260px);
  height: 320px;
  perspective: 900px;
}

.ebv__bag-neck {
  position: absolute;
  z-index: 2;
  top: 0;
  left: 50%;
  width: 76px;
  height: 34px;
  transform: translateX(-50%);
  border: 1px solid var(--ebv-line);
  border-radius: 8px 8px 2px 2px;
  background: linear-gradient(90deg, rgba(255,255,255,0.45), rgba(255,255,255,0.08));
}

.ebv__bag-body {
  position: absolute;
  inset: 28px 0 0;
  overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.78);
  border-radius: 36px 36px 64px 64px;
  background:
    linear-gradient(100deg, rgba(255,255,255,0.62), rgba(255,255,255,0.08) 34%, rgba(0,0,0,0.05)),
    rgba(255, 255, 255, 0.28);
  box-shadow: inset 0 0 28px rgba(105, 12, 32, 0.2), 0 24px 44px rgba(84, 9, 25, 0.2);
  transform: rotateX(4deg);
}

.ebv__liquid {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 62%;
  background:
    radial-gradient(ellipse at 50% 0, rgba(255, 164, 176, 0.85), transparent 16%),
    linear-gradient(180deg, #ec314f, var(--ebv-red-dark));
  transition: height 240ms ease;
}

.ebv__liquid::before {
  content: "";
  position: absolute;
  top: -13px;
  left: -8%;
  width: 116%;
  height: 26px;
  border-radius: 50%;
  background: rgba(255, 116, 133, 0.9);
  animation: ebv-wave 2.8s ease-in-out infinite;
}

.ebv__shine {
  position: absolute;
  top: 24px;
  left: 28px;
  width: 42px;
  height: 210px;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(255,255,255,0.68), transparent);
  opacity: 0.8;
}

.ebv__marks {
  position: absolute;
  inset: 18px 18px 26px auto;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: rgba(255, 255, 255, 0.86);
  font-weight: 900;
  text-shadow: 0 1px 8px rgba(0,0,0,0.24);
}

.ebv__total {
  display: grid;
  gap: 0.15rem;
  text-align: center;
}

.ebv__total span {
  color: var(--ebv-muted);
  font-weight: 800;
}

.ebv__total strong {
  color: var(--ebv-red);
  font-size: clamp(2.4rem, 12vw, 4.8rem);
  line-height: 0.98;
}

.ebv__result-card {
  padding: 0.9rem;
  border: 1px solid var(--ebv-line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.56);
}

.theme-dark .ebv__result-card {
  background: rgba(255, 255, 255, 0.05);
}

.ebv__result-card span {
  color: var(--ebv-muted);
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.ebv__result-card strong {
  display: block;
  margin-top: 0.25rem;
  color: var(--ebv-ink);
  font-size: 1.65rem;
}

.ebv__result-card p {
  margin: 0.35rem 0 0;
  color: var(--ebv-muted);
  line-height: 1.35;
}

.ebv__result-card--primary {
  border-color: rgba(198, 18, 53, 0.42);
}

.ebv__bar {
  overflow: hidden;
  height: 0.55rem;
  margin-top: 0.7rem;
  border-radius: 999px;
  background: rgba(122, 86, 96, 0.17);
}

.ebv__bar i {
  display: block;
  height: 100%;
  width: 60%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--ebv-red), #ff8aa0);
  transition: width 220ms ease;
}

.ebv__method-note small {
  display: block;
  margin-top: 0.45rem;
  color: var(--ebv-muted);
}

@keyframes ebv-wave {
  0%, 100% { transform: translateX(-1.5%) rotate(-1deg); }
  50% { transform: translateX(1.5%) rotate(1deg); }
}

@media (min-width: 860px) {
  .ebv__panel {
    grid-template-columns: minmax(280px, 0.9fr) minmax(240px, 0.7fr) minmax(300px, 1fr);
    align-items: center;
    padding: 1.2rem;
  }
}

@media (max-width: 520px) {
  .ebv__row,
  .ebv__row--imperial,
  .ebv__chips {
    grid-template-columns: 1fr;
  }

  .ebv__bag {
    height: 280px;
  }
}
