:root {
  --bg: #0d1020;
  --panel: rgba(255, 250, 238, 0.96);
  --ink: #171a1f;
  --muted: #657083;
  --line: rgba(23, 26, 31, 0.12);
  --amber: #ffae00;
  --teal: #24377f;
  --green: #62b26d;
  --red: #ff6b2c;
  --blue: #30459a;
  --soft: #edf0e9;
  font-family:
    Inter, "Microsoft YaHei", "PingFang SC", "Noto Sans SC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(135deg, rgba(255, 174, 0, 0.18), transparent 34%),
    linear-gradient(315deg, rgba(36, 55, 127, 0.72), transparent 50%),
    #0d1020;
  overflow-x: hidden;
}

button {
  font: inherit;
}

.app-shell {
  width: min(1120px, calc(100vw - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  place-items: center;
  padding: 28px 0;
}

.panel {
  display: none;
  width: 100%;
  min-height: min(720px, calc(100vh - 56px));
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 174, 0, 0.08), transparent 34%),
    linear-gradient(315deg, rgba(36, 55, 127, 0.08), transparent 42%),
    var(--panel);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.32);
  position: relative;
  overflow: hidden;
}

.panel.is-active {
  display: block;
  animation: panelIn 520ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.intro-screen {
  background:
    linear-gradient(112deg, #ffae00 0 44%, #24377f 44.2% 100%);
  color: #f6f5eb;
}

.intro-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(112deg, rgba(255, 255, 255, 0.16) 0 15%, transparent 15.2% 100%),
    linear-gradient(112deg, transparent 0 52%, rgba(255, 255, 255, 0.12) 52.2% 62%, transparent 62.2% 100%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.07) 0 1px, transparent 1px 42px);
  opacity: 0.55;
  pointer-events: none;
}

.radar-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.intro-screen::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(13, 16, 32, 0.72), rgba(13, 16, 32, 0.1) 48%, rgba(13, 16, 32, 0.36)),
    linear-gradient(180deg, transparent 68%, rgba(13, 16, 32, 0.64));
  pointer-events: none;
}

.cs2-backdrop {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}

.cs2-wordmark {
  position: absolute;
  right: 6%;
  top: 7%;
  width: min(34vw, 360px);
  min-height: 58px;
  display: grid;
  place-items: center;
  padding: 12px 18px;
  background: rgba(13, 16, 32, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.68);
  font-size: clamp(1rem, 2.4vw, 1.8rem);
  font-weight: 950;
  transform: skewX(-12deg);
  opacity: 0.72;
  animation: wordmarkDrift 5.8s ease-in-out infinite;
}

.cs2-token,
.cs2-round-code {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(13, 16, 32, 0.38);
  color: rgba(255, 255, 255, 0.82);
  border-radius: 8px;
  font-weight: 900;
  letter-spacing: 0;
  backdrop-filter: blur(8px);
}

.cs2-token {
  width: 64px;
  height: 44px;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
  animation: tokenFloat 3.6s ease-in-out infinite;
}

.token-ct {
  right: clamp(24px, 8vw, 90px);
  bottom: clamp(86px, 14vw, 140px);
  color: #b9c5ff;
}

.token-t {
  right: clamp(100px, 22vw, 260px);
  bottom: clamp(32px, 8vw, 72px);
  color: #ffd16b;
  animation-delay: 0.7s;
}

.cs2-round-code {
  left: clamp(28px, 6vw, 72px);
  bottom: clamp(22px, 5vw, 52px);
  min-height: 32px;
  padding: 8px 12px;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.68);
}

.hud {
  position: relative;
  z-index: 2;
  width: min(680px, calc(100% - 48px));
  padding: clamp(28px, 7vw, 72px);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 44px;
}

.brand-mark {
  display: inline-grid;
  place-items: center;
  min-width: 68px;
  height: 34px;
  border: 1px solid rgba(255, 174, 0, 0.86);
  background: rgba(13, 16, 32, 0.34);
  color: #ffcf64;
  font-weight: 800;
  letter-spacing: 0;
}

.brand-sub,
.kicker {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.intro-screen .brand-sub,
.intro-screen .kicker {
  color: rgba(246, 245, 235, 0.64);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  max-width: 620px;
  font-size: clamp(2.45rem, 7vw, 5.2rem);
  line-height: 1.02;
  letter-spacing: 0;
}

.intro-copy {
  max-width: 520px;
  margin-top: 24px;
  color: rgba(246, 245, 235, 0.76);
  font-size: clamp(1rem, 2vw, 1.18rem);
  line-height: 1.8;
}

.primary-action,
.ghost-action,
.answer-button {
  border-radius: 8px;
  cursor: pointer;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    background-color 180ms ease,
    color 180ms ease,
    box-shadow 180ms ease;
  will-change: transform;
}

.primary-action {
  margin-top: 34px;
  border: 0;
  background: var(--amber);
  color: #101426;
  min-height: 48px;
  padding: 0 22px;
  font-weight: 900;
  box-shadow: 0 14px 36px rgba(255, 174, 0, 0.3);
}

.primary-action:hover {
  box-shadow:
    0 18px 42px rgba(255, 174, 0, 0.42),
    0 0 0 5px rgba(255, 174, 0, 0.12);
}

.primary-action:hover,
.answer-button:hover,
.ghost-action:hover {
  transform: translateY(-3px) scale(1.025);
}

.primary-action:active,
.answer-button:active,
.ghost-action:active {
  transform: translateY(0) scale(0.985);
}

.quiz-screen,
.result-screen {
  padding: clamp(20px, 5vw, 48px);
}

.result-screen {
  color: #f6f5eb;
  background:
    linear-gradient(112deg, rgba(255, 174, 0, 0.92) 0 36%, rgba(36, 55, 127, 0.98) 36.2% 100%),
    #0d1020;
}

.result-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(112deg, rgba(255, 255, 255, 0.16) 0 12%, transparent 12.2% 100%),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.06) 0 1px, transparent 1px 40px);
  pointer-events: none;
  opacity: 0.48;
}

.result-screen > * {
  position: relative;
  z-index: 1;
}

.quiz-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
}

.quiz-header h2,
.result-main h2 {
  margin-top: 8px;
  font-size: clamp(1.65rem, 4vw, 3rem);
  line-height: 1.08;
  letter-spacing: 0;
}

.round-chip {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffdf2;
  font-weight: 900;
}

.progress-track {
  height: 10px;
  margin: 32px 0;
  border-radius: 999px;
  background: #dfe3dc;
  overflow: hidden;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #24377f 0%, #ffae00 58%, #ff6b2c 100%);
  transition: width 380ms ease;
}

.question-card {
  display: grid;
  gap: 24px;
}

.question-text {
  max-width: 820px;
  font-size: clamp(1.25rem, 3vw, 2.05rem);
  line-height: 1.45;
  font-weight: 850;
}

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

.answer-button {
  min-height: 108px;
  padding: 20px;
  text-align: left;
  color: var(--ink);
  border: 1px solid rgba(36, 55, 127, 0.16);
  background:
    linear-gradient(135deg, rgba(255, 174, 0, 0.08), transparent 44%),
    #fffdf5;
  box-shadow: 0 14px 28px rgba(17, 19, 22, 0.06);
}

.answer-button strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1.05rem;
}

.answer-button span {
  color: var(--muted);
  line-height: 1.55;
}

.answer-button:hover,
.answer-button.is-selected {
  border-color: rgba(255, 174, 0, 0.72);
  background:
    linear-gradient(135deg, rgba(255, 174, 0, 0.18), transparent 44%),
    linear-gradient(315deg, rgba(36, 55, 127, 0.12), transparent 46%),
    #fffaf0;
  box-shadow: 0 18px 34px rgba(255, 174, 0, 0.16);
}

.answer-button:hover {
  box-shadow:
    0 22px 38px rgba(36, 55, 127, 0.12),
    0 0 0 4px rgba(255, 174, 0, 0.1);
}

.quiz-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 28px;
}

.ghost-action {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid rgba(36, 55, 127, 0.2);
  background: rgba(255, 253, 245, 0.7);
  color: #24377f;
  font-weight: 800;
}

.ghost-action:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none;
}

.result-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: clamp(22px, 5vw, 48px);
  align-items: center;
  min-height: calc(min(720px, 100vh - 56px) - 96px);
}

.result-screen.is-active .result-main {
  animation: resultSlide 560ms cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.result-screen.is-active .loadout-panel {
  animation: resultSlide 620ms cubic-bezier(0.2, 0.8, 0.2, 1) 80ms both;
}

.result-tagline {
  margin-top: 14px;
  color: #ffcf64;
  font-size: 1.08rem;
  font-weight: 900;
}

.result-description {
  max-width: 710px;
  margin-top: 18px;
  color: rgba(255, 255, 255, 0.82);
  font-size: 1rem;
  line-height: 1.9;
}

.trait-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 28px;
  max-width: 740px;
}

.trait {
  border: 1px solid rgba(255, 174, 0, 0.24);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 174, 0, 0.14), transparent 48%),
    rgba(13, 16, 32, 0.58);
  padding: 14px;
}

.trait-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-weight: 900;
}

.trait-bar {
  height: 8px;
  margin-top: 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  overflow: hidden;
}

.trait-bar span {
  display: block;
  width: var(--score);
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  animation: growBar 850ms ease both;
}

.result-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.loadout-panel {
  border: 1px solid rgba(255, 174, 0, 0.28);
  border-radius: 8px;
  background:
    linear-gradient(144deg, rgba(255, 174, 0, 0.18), transparent 34%),
    #10162f;
  color: #f6f5eb;
  padding: 22px;
  position: relative;
  overflow: hidden;
}

.loadout-panel::before,
.loadout-panel::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.loadout-panel::before {
  inset: 0 0 auto auto;
  width: 74%;
  height: 64%;
  background:
    linear-gradient(135deg, rgba(255, 174, 0, 0.22), transparent 44%),
    linear-gradient(45deg, transparent 0 52%, rgba(255, 255, 255, 0.08) 52.2% 64%, transparent 64.2% 100%);
  opacity: 0.92;
}

.loadout-panel::after {
  left: 22px;
  right: 22px;
  bottom: 22px;
  height: 6px;
  background: linear-gradient(90deg, #ffae00, #ff6b2c 48%, #30459a);
  opacity: 0.92;
}

.loadout-header {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 4px;
  margin-bottom: 12px;
}

.loadout-header span {
  color: rgba(255, 174, 0, 0.78);
  font-size: 0.75rem;
  font-weight: 900;
}

.loadout-header strong {
  font-size: 1.06rem;
}

.combat-card {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 14px;
  margin: 18px 0 12px;
  padding: 16px;
  border: 1px solid rgba(255, 174, 0, 0.24);
  border-radius: 8px;
  background: rgba(13, 16, 32, 0.42);
}

.combat-code {
  color: #fff;
  font-size: clamp(2.2rem, 5vw, 3.8rem);
  font-weight: 950;
  line-height: 0.9;
}

.combat-stars {
  color: #ffae00;
  font-size: 1.25rem;
  letter-spacing: 0;
  text-shadow: 0 0 24px rgba(255, 174, 0, 0.28);
}

.combat-index {
  display: flex;
  align-items: baseline;
  gap: 12px;
}

.combat-index span {
  color: #ffae00;
  font-size: 4.8rem;
  font-weight: 950;
  line-height: 0.9;
}

.combat-index strong {
  color: rgba(255, 255, 255, 0.82);
  font-size: 1rem;
}

.combat-stats {
  display: grid;
  gap: 12px;
}

.combat-stat {
  display: grid;
  gap: 7px;
  animation: statIn 480ms ease var(--delay) both;
}

.combat-stat-head {
  display: flex;
  justify-content: space-between;
  color: rgba(255, 255, 255, 0.82);
  font-size: 0.86rem;
  font-weight: 900;
}

.combat-stat-head strong {
  color: #ffcf64;
}

.combat-stat-bar {
  height: 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

.combat-stat-bar span {
  display: block;
  width: var(--score);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #ffae00, #ff6b2c);
  animation: growBar 900ms ease var(--delay) both;
}

#badgeCanvas {
  position: relative;
  z-index: 1;
  width: 100%;
  aspect-ratio: 1;
  display: block;
  filter: drop-shadow(0 18px 36px rgba(0, 0, 0, 0.28));
}

.loadout-list {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.loadout-list div {
  display: grid;
  gap: 4px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
}

.loadout-list span {
  color: rgba(246, 245, 235, 0.55);
  font-size: 0.78rem;
}

.loadout-list strong {
  font-size: 1rem;
  line-height: 1.45;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  min-height: 42px;
  padding: 10px 16px;
  border-radius: 8px;
  background: #171a1f;
  color: #fffdf5;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.28);
  transition:
    opacity 220ms ease,
    transform 220ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.swap-out {
  animation: swapOut 220ms ease both;
}

.swap-in {
  animation: swapIn 360ms ease both;
}

@keyframes panelIn {
  from {
    opacity: 0;
    transform: translateY(14px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes swapOut {
  to {
    opacity: 0;
    transform: translateY(10px);
  }
}

@keyframes swapIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes growBar {
  from {
    width: 0;
  }
}

@keyframes tokenFloat {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes wordmarkDrift {
  0%,
  100% {
    transform: skewX(-12deg) translateX(0);
  }
  50% {
    transform: skewX(-12deg) translateX(-10px);
  }
}

@keyframes statIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes resultSlide {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 840px) {
  .panel {
    min-height: calc(100vh - 32px);
  }

  .app-shell {
    width: min(100vw - 20px, 1120px);
    padding: 10px 0;
  }

  .hud {
    width: 100%;
    padding: 28px;
  }

  .intro-screen::before {
    background:
      linear-gradient(112deg, rgba(255, 255, 255, 0.16) 0 16%, transparent 16.2% 100%),
      repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.07) 0 1px, transparent 1px 36px);
    opacity: 0.44;
  }

  .cs2-wordmark,
  .cs2-token,
  .cs2-round-code {
    display: none;
  }

  .brand-row,
  .quiz-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .answer-list,
  .trait-grid,
  .result-layout {
    grid-template-columns: 1fr;
  }

  .answer-button {
    min-height: auto;
  }

  .loadout-panel {
    order: -1;
  }
}

@media (min-width: 841px) and (max-height: 760px) {
  .cs2-wordmark,
  .cs2-token,
  .cs2-round-code {
    display: none;
  }

  .hud {
    width: min(620px, calc(100% - 48px));
    padding: 46px;
  }

  h1 {
    font-size: clamp(2.3rem, 5.4vw, 4.45rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 1ms !important;
  }
}
