:root {
  color-scheme: dark;
  --bg: #080b12;
  --panel: rgba(15, 20, 32, 0.92);
  --panel-strong: #111827;
  --text: #f5f7fb;
  --muted: #9ba7b8;
  --line: rgba(255, 255, 255, 0.12);
  --red: #ff4655;
  --cyan: #45e3ff;
  --yellow: #ffd166;
  --green: #65f2a9;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
  --radius: 28px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 70, 85, 0.34), transparent 32rem),
    radial-gradient(circle at 80% 20%, rgba(69, 227, 255, 0.18), transparent 28rem),
    linear-gradient(135deg, #06070c 0%, #101625 48%, #080b12 100%);
}

button,
input {
  font: inherit;
}

.shell {
  width: min(1040px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.screen {
  display: none;
  min-height: calc(100vh - 64px);
  align-items: center;
  justify-content: center;
}

.screen.active {
  display: flex;
}

.card {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.08), transparent 32%),
    var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero {
  max-width: 780px;
  padding: clamp(28px, 7vw, 76px);
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "VBTI";
  position: absolute;
  right: -20px;
  bottom: -50px;
  color: rgba(255, 255, 255, 0.04);
  font-size: clamp(96px, 18vw, 180px);
  font-weight: 900;
  letter-spacing: -0.08em;
  pointer-events: none;
}

.eyebrow {
  margin: 0 0 12px;
  color: var(--cyan);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.brand-mark {
  margin: 0 0 14px;
  color: var(--cyan);
  font-size: clamp(1.4rem, 3vw, 2.2rem);
  font-weight: 950;
  letter-spacing: 0.08em;
  text-transform: none;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  max-width: 680px;
  margin-bottom: 20px;
  font-size: clamp(2.8rem, 9vw, 6.6rem);
  line-height: 1.02;
  letter-spacing: -0.08em;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 4rem);
  line-height: 0.95;
  letter-spacing: -0.06em;
}

#resultTitle {
  position: relative;
  display: inline-block;
}

h3 {
  margin-bottom: 14px;
  font-size: 1.05rem;
}

.hero-copy {
  max-width: 620px;
  margin-bottom: 28px;
  color: var(--muted);
  font-size: clamp(1rem, 2vw, 1.2rem);
  line-height: 1.8;
}

.contact-line {
  margin: 14px 0 0;
  color: rgba(220, 228, 242, 0.68);
  font-size: 0.9rem;
  line-height: 1.6;
}

.result-contact {
  margin-top: -2px;
}

.hero-stats,
.trait-tags,
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.hero-stats {
  margin-bottom: 34px;
}

.hero-stats span,
.trait-tags span {
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 9px 14px;
  color: #dce4f2;
  background: rgba(255, 255, 255, 0.06);
}

.btn {
  border: 0;
  border-radius: 999px;
  padding: 13px 20px;
  color: var(--text);
  cursor: pointer;
  transition: transform 160ms ease, opacity 160ms ease, border-color 160ms ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-2px);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.btn-primary {
  background: linear-gradient(135deg, var(--red), #ff7a45);
  font-weight: 900;
}

.btn-secondary {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.07);
}

.test-card,
.result-card {
  padding: clamp(20px, 4vw, 44px);
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 18px;
}

.progress-text {
  flex: 0 0 auto;
  color: var(--yellow);
  font-weight: 900;
}

.progress {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
}

.progress span {
  display: block;
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--red), var(--cyan));
  transition: width 220ms ease;
}

.question-list {
  display: grid;
  gap: 16px;
  margin: 26px 0;
}

.question {
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.045);
}

.question-title {
  margin-bottom: 14px;
  font-weight: 850;
  line-height: 1.6;
}

.options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 72px;
  border: 1px solid transparent;
  border-radius: 18px;
  padding: 13px;
  background: rgba(255, 255, 255, 0.06);
  color: #dce4f2;
  cursor: pointer;
}

.option:has(input:checked) {
  border-color: rgba(255, 70, 85, 0.85);
  background: rgba(255, 70, 85, 0.18);
}

.option input {
  margin-top: 4px;
  accent-color: var(--red);
}

.actions-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.hint {
  margin: 0;
  color: var(--muted);
}

.result-card {
  display: grid;
  gap: 22px;
  position: relative;
}

.poster {
  --poster-accent-1: rgba(255, 70, 85, 0.42);
  --poster-accent-2: rgba(69, 227, 255, 0.12);
  --poster-glow: rgba(255, 255, 255, 0.18);
  --poster-outline: rgba(255, 255, 255, 0.18);
  min-height: 360px;
  border-radius: calc(var(--radius) - 8px);
  padding: clamp(24px, 5vw, 52px);
  background:
    linear-gradient(135deg, var(--poster-accent-1), var(--poster-accent-2)),
    radial-gradient(circle at 80% 20%, var(--poster-glow), transparent 18rem),
    #0c1220;
  position: relative;
  overflow: hidden;
  animation: posterEnter 520ms cubic-bezier(0.22, 1, 0.36, 1);
}

.poster::after {
  content: "";
  position: absolute;
  inset: 18px;
  border: 1px solid var(--poster-outline);
  border-radius: 20px;
  pointer-events: none;
}

.poster-stamp {
  position: absolute;
  top: 26px;
  right: -36px;
  width: 190px;
  padding: 7px 0;
  background: rgba(255, 70, 85, 0.88);
  color: white;
  font-size: 0.76rem;
  font-weight: 950;
  letter-spacing: 0.22em;
  text-align: center;
  transform: rotate(35deg);
  box-shadow: 0 12px 32px rgba(255, 70, 85, 0.28);
  z-index: 1;
}

.result-subtitle,
.result-desc {
  max-width: 760px;
  color: #dce4f2;
  line-height: 1.8;
}

.result-subtitle {
  margin: 14px 0 12px;
  font-size: 1.15rem;
}

.legendary-banner {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  max-width: min(100%, 720px);
  margin: 0 auto 8px;
  border: 1px solid rgba(255, 209, 102, 0.52);
  border-radius: 999px;
  padding: 12px 20px;
  color: #fff2c2;
  background: linear-gradient(135deg, rgba(255, 209, 102, 0.22), rgba(255, 180, 66, 0.12));
  box-shadow: 0 14px 34px rgba(255, 209, 102, 0.2);
  font-weight: 900;
  letter-spacing: 0.02em;
  opacity: 0;
  transform: translateY(-10px) scale(0.96);
}

.legendary-banner.show {
  animation: legendaryBannerIn 560ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.legendary-fireworks {
  position: absolute;
  inset: -18px;
  z-index: 3;
  pointer-events: none;
  opacity: 0;
}

.legendary-fireworks.show {
  opacity: 1;
}

.legendary-burst {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(255, 249, 220, 0.96) 0 22%, rgba(255, 209, 102, 0.78) 24%, rgba(255, 209, 102, 0) 72%);
  box-shadow:
    0 -48px 0 -5px rgba(255, 209, 102, 0.9),
    34px -34px 0 -5px rgba(255, 231, 158, 0.86),
    48px 0 0 -5px rgba(255, 187, 94, 0.84),
    34px 34px 0 -5px rgba(255, 235, 175, 0.88),
    0 48px 0 -5px rgba(255, 209, 102, 0.86),
    -34px 34px 0 -5px rgba(255, 223, 140, 0.84),
    -48px 0 0 -5px rgba(255, 195, 88, 0.82),
    -34px -34px 0 -5px rgba(255, 239, 186, 0.84);
  filter: drop-shadow(0 0 16px rgba(255, 209, 102, 0.46));
  opacity: 0;
  transform: scale(0.12);
}

.legendary-fireworks.show .legendary-burst {
  animation: fireworkBurst 1.4s ease-out forwards;
}

.legendary-burst:nth-child(1) {
  top: 26px;
  left: 12%;
}

.legendary-burst:nth-child(2) {
  top: 14px;
  left: 42%;
  animation-delay: 0.12s;
}

.legendary-burst:nth-child(3) {
  top: 34px;
  left: 68%;
  animation-delay: 0.22s;
}

.legendary-burst:nth-child(4) {
  top: 62px;
  left: 84%;
  animation-delay: 0.32s;
}

.match {
  display: inline-flex;
  width: fit-content;
  margin-bottom: 18px;
  border-radius: 999px;
  padding: 8px 13px;
  color: #17202f;
  background: var(--yellow);
  font-weight: 900;
}

.analysis,
.note,
.duo-box {
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.045);
}

.note p,
.duo-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.8;
}

.duo-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.duo-card {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent),
    rgba(255, 255, 255, 0.04);
}

.duo-card-best {
  border-color: rgba(101, 242, 169, 0.28);
}

.duo-card-fear {
  border-color: rgba(255, 70, 85, 0.28);
}

.duo-kicker {
  margin-bottom: 8px !important;
  color: var(--cyan) !important;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.duo-card h4 {
  margin: 0 0 8px;
  font-size: 1.2rem;
}

.radar-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(240px, 0.8fr);
  align-items: center;
  gap: 18px;
}

.radar-canvas {
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
  display: block;
}

.radar-legend {
  display: grid;
  gap: 12px;
}

.dim-row {
  display: grid;
  grid-template-columns: 16px 1fr 44px;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.04);
}

.dim-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--red), var(--cyan));
}

.dim-name {
  color: #dce4f2;
  font-weight: 800;
}

.dim-score {
  color: var(--yellow);
  font-weight: 900;
  text-align: right;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 10;
  max-width: min(420px, calc(100vw - 40px));
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 18px;
  padding: 12px 16px;
  background: rgba(17, 24, 39, 0.92);
  color: var(--text);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.toast-top {
  left: 50%;
  right: auto;
  top: 20px;
  bottom: auto;
  transform: translate(-50%, -12px);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.toast-top.show {
  transform: translate(-50%, 0);
}

.share-overlay {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 70, 85, 0.26), transparent 26rem),
    rgba(2, 6, 14, 0.82);
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease;
}

.share-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.share-panel {
  width: min(560px, 100%);
  max-height: min(92vh, 900px);
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 28px;
  padding: clamp(18px, 4vw, 30px);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.09), transparent 36%),
    rgba(13, 18, 30, 0.96);
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.62);
  transform: translateY(24px) scale(0.97);
  transition: transform 260ms cubic-bezier(0.22, 1, 0.36, 1);
}

.share-overlay.show .share-panel {
  transform: translateY(0) scale(1);
}

.share-panel h2 {
  max-width: 460px;
  font-size: clamp(1.8rem, 6vw, 3.4rem);
}

.share-hint {
  margin: 14px 0 18px;
  color: var(--muted);
  line-height: 1.7;
  text-align: center;
}

.share-preview {
  display: block;
  width: min(360px, 100%);
  margin: 0 auto 18px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 22px;
  background: #101625;
  box-shadow: 0 18px 54px rgba(0, 0, 0, 0.42);
  animation: posterFloat 2.8s ease-in-out infinite;
}

.share-actions {
  justify-content: center;
}

.share-actions .btn[hidden] {
  display: none;
}

.result-actions .btn,
.share-actions .btn,
.share-actions a {
  text-align: center;
}

.result-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.result-actions #shareBtn {
  grid-column: 1 / -1;
}

.debug-panel {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 30;
  width: min(320px, calc(100vw - 24px));
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 22px;
  padding: 16px;
  background: rgba(10, 14, 24, 0.88);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(16px);
}

.debug-title,
.debug-label {
  margin: 0 0 10px;
  color: var(--yellow);
  font-size: 0.82rem;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.debug-group {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.debug-group .btn {
  width: 100%;
  justify-content: center;
}

.debug-select {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  padding: 12px 14px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

body.legendary-active {
  background:
    radial-gradient(circle at 18% 14%, rgba(255, 209, 102, 0.28), transparent 26rem),
    radial-gradient(circle at 84% 18%, rgba(255, 227, 138, 0.16), transparent 22rem),
    radial-gradient(circle at 50% 100%, rgba(255, 180, 66, 0.12), transparent 26rem),
    linear-gradient(135deg, #08070c 0%, #17131f 40%, #0b0f18 100%);
}

.legendary-result-card {
  position: relative;
}

.legendary-result-card::before {
  content: "";
  position: absolute;
  inset: -12px;
  border-radius: calc(var(--radius) + 8px);
  background:
    radial-gradient(circle at 18% 16%, rgba(255, 209, 102, 0.22), transparent 20rem),
    radial-gradient(circle at 86% 8%, rgba(255, 230, 148, 0.16), transparent 16rem);
  filter: blur(22px);
  opacity: 0.95;
  pointer-events: none;
}

.legendary-poster {
  --poster-accent-1: rgba(255, 209, 102, 0.48);
  --poster-accent-2: rgba(255, 174, 66, 0.18);
  --poster-glow: rgba(255, 239, 176, 0.24);
  --poster-outline: rgba(255, 220, 120, 0.34);
  box-shadow:
    0 0 0 1px rgba(255, 219, 134, 0.18),
    0 24px 80px rgba(255, 191, 73, 0.16),
    inset 0 1px 0 rgba(255, 244, 200, 0.12);
}

.legendary-poster::before {
  content: "";
  position: absolute;
  inset: -20% 40% auto -10%;
  height: 120px;
  background: linear-gradient(90deg, transparent, rgba(255, 235, 170, 0.56), transparent);
  transform: rotate(-8deg);
  filter: blur(14px);
  opacity: 0.72;
  pointer-events: none;
}

.legendary-result .poster-stamp {
  background: linear-gradient(135deg, #ffd166, #ffb347);
  color: #3a2500;
  box-shadow: 0 14px 36px rgba(255, 209, 102, 0.34);
}

.legendary-result #resultTitle {
  color: transparent;
  background-image: linear-gradient(
    135deg,
    #fff8d6 0%,
    #ffe08a 18%,
    #ffd166 36%,
    #fff3bf 52%,
    #ffcb57 70%,
    #fff7d8 100%
  );
  background-size: 220% 220%;
  -webkit-background-clip: text;
  background-clip: text;
  filter: drop-shadow(0 0 10px rgba(255, 225, 132, 0.34));
  text-shadow:
    0 0 18px rgba(255, 209, 102, 0.24),
    0 0 34px rgba(255, 209, 102, 0.14);
  animation: legendaryTitleGlow 3.2s ease-in-out infinite;
}

.legendary-result #resultTitle::after {
  content: "";
  position: absolute;
  inset: -10px -18px;
  z-index: -1;
  border-radius: 24px;
  background:
    radial-gradient(circle at 30% 50%, rgba(255, 224, 138, 0.26), transparent 38%),
    radial-gradient(circle at 70% 52%, rgba(255, 193, 77, 0.18), transparent 42%);
  filter: blur(16px);
  pointer-events: none;
}

.legendary-result .match {
  background: linear-gradient(135deg, #ffe08a, #ffcb57);
  box-shadow: 0 10px 24px rgba(255, 209, 102, 0.24);
}

.legendary-result .trait-tags span,
.legendary-result .analysis,
.legendary-result .note,
.legendary-result .duo-box {
  border-color: rgba(255, 215, 132, 0.22);
  background: linear-gradient(135deg, rgba(255, 220, 140, 0.08), rgba(255, 255, 255, 0.045));
}

.legendary-result .analysis h3 {
  color: #ffe7a5;
}

.legendary-result .dim-row {
  border-color: rgba(255, 222, 148, 0.26);
  background: linear-gradient(135deg, rgba(255, 224, 146, 0.12), rgba(255, 255, 255, 0.05));
  box-shadow: inset 0 1px 0 rgba(255, 248, 214, 0.08);
}

.legendary-result .dim-dot {
  background: linear-gradient(180deg, #ffd166, #fff1a8);
  box-shadow: 0 0 14px rgba(255, 209, 102, 0.34);
}

.legendary-result .dim-name {
  color: #fff0bf;
}

.legendary-result .dim-score {
  color: #fff3bf;
  text-shadow: 0 0 12px rgba(255, 209, 102, 0.24);
}

.legendary-result .duo-card {
  border-color: rgba(255, 215, 132, 0.24);
  background:
    linear-gradient(135deg, rgba(255, 240, 190, 0.1), transparent),
    rgba(255, 255, 255, 0.04);
}

@keyframes posterEnter {
  from {
    opacity: 0;
    transform: translateY(22px) scale(0.98);
    filter: blur(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes posterFloat {
  0%,
  100% {
    transform: translateY(0) rotate(-0.4deg);
  }

  50% {
    transform: translateY(-8px) rotate(0.4deg);
  }
}

@keyframes fireworkBurst {
  0% {
    opacity: 0;
    transform: scale(0.12);
  }

  18% {
    opacity: 1;
    transform: scale(1);
  }

  100% {
    opacity: 0;
    transform: scale(1.28);
  }
}

@keyframes legendaryBannerIn {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.96);
    filter: blur(8px);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
    filter: blur(0);
  }
}

@keyframes legendaryTitleGlow {
  0%,
  100% {
    background-position: 0% 50%;
    transform: translateY(0);
  }

  50% {
    background-position: 100% 50%;
    transform: translateY(-1px);
  }
}

@media (max-width: 720px) {
  .shell {
    width: min(100% - 20px, 1040px);
    padding: 10px 0;
  }

  .screen {
    min-height: calc(100vh - 20px);
  }

  .topbar,
  .actions-bottom {
    flex-direction: column;
    align-items: stretch;
  }

  .options {
    grid-template-columns: 1fr;
  }

  .duo-grid,
  .radar-layout,
  .dim-row {
    grid-template-columns: 1fr;
    gap: 7px;
  }

  .dim-row {
    grid-template-columns: 16px 1fr 44px;
  }

  .dim-score {
    text-align: left;
  }

  .share-overlay {
    align-items: end;
    padding: 10px;
  }

  .share-panel {
    border-radius: 24px;
  }

  .result-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .result-actions .btn {
    width: 100%;
  }

  .result-actions #shareBtn {
    grid-column: 1 / -1;
  }

  .result-actions #posterBtn {
    display: none;
  }

  .share-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .share-actions .btn,
  .share-actions a {
    width: 100%;
  }
}
