* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  min-height: 100vh;
  overflow: hidden;
  background: #f8f0ff;
  display: flex;
  align-items: center;
  justify-content: center;
}

#formCard {
  background: #fff;
  border-radius: 24px;
  padding: 2rem 1.75rem;
  width: 90%;
  max-width: 420px;
  box-shadow: 0 24px 60px rgba(0,0,0,0.12);
  position: relative;
  z-index: 1;
}

.header { text-align: center; margin-bottom: 1.5rem; }
h1 { font-size: 22px; font-weight: 700; color: #1a1a2e; margin-bottom: 4px; }
.tagline { font-size: 14px; color: #888; }

.person-block { margin-bottom: 0.75rem; }
.person-row { display: flex; gap: 10px; align-items: flex-end; }

.field { margin-bottom: 0; }
.field-name { flex: 1.5; }
.field-zodiac { flex: 1; }

.field-label {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; color: #555;
  margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px;
}

input[type="text"] {
  width: 100%; padding: 11px 14px;
  border: 2px solid #eee; border-radius: 12px;
  font-size: 15px; color: #1a1a2e;
  outline: none; transition: border-color 0.2s; background: #fafafa;
}
input[type="text"]:focus { border-color: #ff6b9d; background: #fff; }
input[type="text"]::placeholder { color: #bbb; }
input[type="text"].invalid { border-color: #e53e3e; }

select {
  width: 100%; padding: 11px 10px 11px 12px;
  border: 2px solid #eee; border-radius: 12px;
  font-size: 14px; color: #1a1a2e;
  outline: none; transition: border-color 0.2s; background: #fafafa;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24'%3E%3Cpath d='M6 9L12 15L18 9' stroke='%23aaa' stroke-width='2' stroke-linecap='round' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
}
select:focus { border-color: #a855f7; background-color: #fff; }
select.invalid { border-color: #e53e3e; }

.zodiac-hint {
  font-size: 12px; color: #a855f7; font-weight: 600;
  text-align: center; margin: 4px 0 8px;
  min-height: 18px; transition: opacity 0.3s;
  display: flex; align-items: center; justify-content: center; gap: 5px;
}

.divider { display: flex; justify-content: center; margin: 0.4rem 0; }

.error { font-size: 13px; color: #e53e3e; margin-bottom: 10px; display: none; }

.btn {
  width: 100%; padding: 14px; border: none; border-radius: 12px;
  background: #ff6b9d;
  color: #fff; font-size: 16px; font-weight: 700;
  cursor: pointer; transition: transform 0.15s, opacity 0.15s;
  display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:hover { opacity: 0.88; }
.btn:active { transform: scale(0.97); }

/* HEART */
#heartSvg {
  position: fixed;
  left: 50%; top: 50%;
  width: 120px; height: 120px;
  margin-left: -60px; margin-top: -60px;
  z-index: 5; display: none;
  transform: translateY(-110vh) scale(0.1);
  transition: none;
}

/* RESULT */
#result {
  position: fixed; inset: 0; z-index: 10;
  display: none; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; padding: 2rem;
  opacity: 0; transition: opacity 0.5s ease;
  pointer-events: none;
}
#result.visible:not(.glitch-bg) {
  background: transparent; /* heart SVG yang jadi background */
}
#result.glitch-bg {
  background: #0a0010 !important;
}
#result.visible { opacity: 1; pointer-events: auto; }
#result > *:not(canvas) { position: relative; z-index: 1; }

.res-zodiac-pair { font-size: clamp(12px, 2vw, 16px); color: rgba(255,255,255,0.7); margin-bottom: 0.3rem; letter-spacing: 0.3px; }
.res-names { font-size: clamp(15px, 2.5vw, 22px); color: rgba(255,255,255,0.85); margin-bottom: 0.5rem; }
.res-names strong { color: #fff; }
.res-pct { font-size: clamp(64px, 15vw, 120px); font-weight: 800; color: #fff; line-height: 1; max-width: 100vw; overflow: hidden; }
.res-pct-unit { font-size: clamp(22px, 5vw, 42px); font-weight: 700; color: rgba(255,255,255,0.8); }
/* Saat glitch, angka bisa panjang — kecilkan otomatis */
.res-pct.glitching { font-size: clamp(18px, 7vw, 52px); letter-spacing: -1px; white-space: nowrap; }

.res-score-breakdown {
  display: flex; gap: 6px; margin: 6px 0 14px;
  font-size: clamp(11px, 1.8vw, 14px); color: rgba(255,255,255,0.75);
  align-items: center; flex-wrap: wrap; justify-content: center;
}
.res-score-breakdown span { display: flex; align-items: center; gap: 3px; font-weight: 600; }
.res-score-breakdown span:nth-child(2),
.res-score-breakdown span:nth-child(4) { font-weight: 400; opacity: 0.6; }

.res-bar-track { width: 240px; height: 8px; background: rgba(255,255,255,0.25); border-radius: 100px; overflow: hidden; margin: 0 auto 1rem; }
.res-bar-fill { height: 100%; border-radius: 100px; background: #fff; width: 0%; transition: width 1.2s cubic-bezier(0.22,1,0.36,1); }
.res-badge { display: inline-block; padding: 8px 22px; border-radius: 100px; background: rgba(255,255,255,0.2); border: 1.5px solid rgba(255,255,255,0.5); color: #fff; font-size: clamp(13px, 2vw, 18px); font-weight: 700; margin-bottom: 0.75rem; }
.res-msg { font-size: clamp(13px, 1.8vw, 16px); color: rgba(255,255,255,0.85); line-height: 1.6; max-width: 300px; margin-bottom: 1.75rem; }
.res-reset {
  background: rgba(255,255,255,0.15); border: 1.5px solid rgba(255,255,255,0.4);
  border-radius: 12px; padding: 12px 28px; font-size: clamp(13px, 2vw, 17px); font-weight: 600;
  color: #fff; cursor: pointer; display: flex; align-items: center; gap: 8px;
}
.res-reset:hover { background: rgba(255,255,255,0.25); }

/* GLITCH */
.glitch-active { animation: glitchShake 0.05s infinite; }
@keyframes glitchShake {
  0%   { transform: translate(0,0) skewX(0deg); }
  10%  { transform: translate(-8px, 3px) skewX(4deg); }
  20%  { transform: translate(9px, -4px) skewX(-6deg); }
  30%  { transform: translate(-6px, 6px) skewX(3deg); }
  40%  { transform: translate(10px, -3px) skewX(-5deg); }
  50%  { transform: translate(-3px, 8px) skewX(7deg); }
  60%  { transform: translate(7px, -6px) skewX(-4deg); }
  70%  { transform: translate(-9px, 4px) skewX(5deg); }
  80%  { transform: translate(5px, -8px) skewX(-3deg); }
  90%  { transform: translate(-7px, 2px) skewX(6deg); }
  100% { transform: translate(0,0) skewX(0deg); }
}
.glitch-text {
  position: relative;
  display: inline-block;
}
.glitch-text::before, .glitch-text::after {
  content: attr(data-text);
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  pointer-events: none;
}
.glitch-text.glitching::before {
  color: #ff00cc;
  clip-path: polygon(0 15%, 100% 15%, 100% 38%, 0 38%);
  animation: glitchLayer1 0.07s infinite;
  left: -8px;
  text-shadow: 3px 0 #ff00cc, -3px 0 #00ffee;
}
.glitch-text.glitching::after {
  color: #00ffee;
  clip-path: polygon(0 52%, 100% 52%, 100% 78%, 0 78%);
  animation: glitchLayer2 0.05s infinite;
  left: 8px;
  text-shadow: -3px 0 #ff00cc, 3px 0 #ffff00;
}
@keyframes glitchLayer1 {
  0%   { clip-path: polygon(0 5%,  100% 5%,  100% 28%, 0 28%); transform: translate(-8px, 2px) scaleX(1.04); opacity:1; }
  15%  { clip-path: polygon(0 70%, 100% 70%, 100% 90%, 0 90%); transform: translate(10px,-3px) scaleX(0.97); opacity:0.8; }
  30%  { clip-path: polygon(0 30%, 100% 30%, 100% 55%, 0 55%); transform: translate(-6px, 5px) scaleX(1.08); opacity:1; }
  45%  { clip-path: polygon(0 85%, 100% 85%, 100% 100%,0 100%); transform: translate(12px,-2px) scaleX(0.95); opacity:0.6; }
  60%  { clip-path: polygon(0 0%,  100% 0%,  100% 20%, 0 20%); transform: translate(-10px,4px) scaleX(1.06); opacity:1; }
  75%  { clip-path: polygon(0 45%, 100% 45%, 100% 68%, 0 68%); transform: translate(7px,-6px)  scaleX(0.98); opacity:0.9; }
  90%  { clip-path: polygon(0 60%, 100% 60%, 100% 80%, 0 80%); transform: translate(-4px, 8px) scaleX(1.03); opacity:0.7; }
  100% { clip-path: polygon(0 5%,  100% 5%,  100% 28%, 0 28%); transform: translate(0,0) scaleX(1); opacity:1; }
}
@keyframes glitchLayer2 {
  0%   { clip-path: polygon(0 55%, 100% 55%, 100% 78%, 0 78%); transform: translate(9px, 0px)  scaleY(1.05); opacity:1; }
  12%  { clip-path: polygon(0 10%, 100% 10%, 100% 32%, 0 32%); transform: translate(-11px,3px) scaleY(0.96); opacity:0.7; }
  25%  { clip-path: polygon(0 80%, 100% 80%, 100% 100%,0 100%); transform: translate(6px,-5px)  scaleY(1.08); opacity:1; }
  38%  { clip-path: polygon(0 25%, 100% 25%, 100% 48%, 0 48%); transform: translate(-8px, 7px) scaleY(0.93); opacity:0.8; }
  50%  { clip-path: polygon(0 65%, 100% 65%, 100% 88%, 0 88%); transform: translate(13px,-4px) scaleY(1.04); opacity:1; }
  63%  { clip-path: polygon(0 0%,  100% 0%,  100% 18%, 0 18%); transform: translate(-5px, 9px) scaleY(0.97); opacity:0.6; }
  76%  { clip-path: polygon(0 40%, 100% 40%, 100% 62%, 0 62%); transform: translate(10px,-2px) scaleY(1.06); opacity:0.9; }
  88%  { clip-path: polygon(0 72%, 100% 72%, 100% 95%, 0 95%); transform: translate(-9px, 4px) scaleY(0.95); opacity:0.8; }
  100% { clip-path: polygon(0 55%, 100% 55%, 100% 78%, 0 78%); transform: translate(0,0) scaleY(1); opacity:1; }
}
/* Layer ketiga: warna hijau/kuning flicker via filter */
.glitch-text.glitching {
  animation: glitchMainFlicker 0.09s infinite;
  filter: drop-shadow(0 0 6px #ff00cc) drop-shadow(0 0 10px #00ffee);
}
@keyframes glitchMainFlicker {
  0%   { filter: drop-shadow(0 0 6px #ff00cc) drop-shadow(0 0 10px #00ffee); }
  20%  { filter: drop-shadow(4px 0 0 #ff00cc) drop-shadow(-4px 0 0 #00ffee) brightness(1.3); }
  40%  { filter: drop-shadow(-6px 0 0 #ffff00) drop-shadow(6px 0 0 #ff00cc) brightness(0.8); }
  60%  { filter: drop-shadow(0 0 12px #00ffee) drop-shadow(0 0 6px #ff00cc) brightness(1.5); }
  80%  { filter: drop-shadow(8px 0 0 #ff00cc) drop-shadow(-8px 0 0 #ffff00) brightness(0.9); }
  100% { filter: drop-shadow(0 0 6px #ff00cc) drop-shadow(0 0 10px #00ffee); }
}
.glitch-bar { animation: glitchBar 0.08s infinite; }
@keyframes glitchBar {
  0%   { width: 100%; background: #fff; transform: scaleY(1); }
  15%  { width: 130%; background: #ff00cc; transform: scaleY(2.5); }
  30%  { width: 60%;  background: #00ffee; transform: scaleY(0.5); }
  45%  { width: 140%; background: #ffff00; transform: scaleY(3); }
  60%  { width: 75%;  background: #ff00cc; transform: scaleY(0.8); }
  75%  { width: 120%; background: #00ffee; transform: scaleY(2); }
  90%  { width: 50%;  background: #ffff00; transform: scaleY(1.5); }
  100% { width: 100%; background: #fff; transform: scaleY(1); }
}
.glitch-scan {
  position: fixed; inset: 0; pointer-events: none; z-index: 20;
  display: none;
}
.glitch-scan.on {
  display: block;
  animation: scanAnim 0.15s infinite;
}
@keyframes scanAnim {
  0%   { background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,255,238,0.12) 2px, rgba(0,255,238,0.12) 4px); opacity:1; }
  25%  { background: repeating-linear-gradient(0deg, transparent, transparent 1px, rgba(255,0,204,0.15) 1px, rgba(255,0,204,0.15) 3px); opacity:0.8; }
  50%  { background: repeating-linear-gradient(0deg, transparent, transparent 3px, rgba(255,255,0,0.1)  3px, rgba(255,255,0,0.1)  6px); opacity:1; }
  75%  { background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(0,255,238,0.18) 2px, rgba(0,255,238,0.18) 4px); opacity:0.7; }
  100% { background: repeating-linear-gradient(0deg, transparent, transparent 2px, rgba(255,0,204,0.12) 2px, rgba(255,0,204,0.12) 4px); opacity:1; }
}
