:root {
  --ink: #eef1ff;
  --muted: #a6acc9;
  --line: #ffffff1a;
  --lilac: #b6a1ff;
  --aqua: #7ee4df;
  --dark: #070a18;
}

* {
  box-sizing: border-box;
}

body.companions-page {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 72% 18%, rgb(88 70 170 / 28%), transparent 34%),
    radial-gradient(circle at 18% 70%, rgb(26 117 133 / 22%), transparent 30%),
    #070a18;
  color: var(--ink);
  font-family: "Noto Sans TC", sans-serif;
  overflow-x: hidden;
}

.noise,
.motion-grid,
.glow {
  pointer-events: none;
}

.noise {
  position: fixed;
  inset: 0;
  opacity: .045;
  z-index: 5;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.6'/%3E%3C/svg%3E");
}

.glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(100px);
}

.glow-a {
  width: 480px;
  height: 480px;
  background: #3e3379;
  right: -120px;
  top: 180px;
  opacity: .38;
}

.glow-b {
  width: 350px;
  height: 350px;
  background: #176276;
  left: -180px;
  top: 670px;
  opacity: .25;
}

.topbar {
  height: 86px;
  max-width: 100%;
  margin: 0;
  padding: 0 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, #071a43, #07122f 55%, #071a43);
  position: relative;
  z-index: 10;
}

.logo-brand img {
  width: 162px;
  height: auto;
  filter: drop-shadow(0 4px 10px rgb(255 179 71 / 20%));
}

nav {
  display: flex;
  gap: 36px;
  margin-left: auto;
  margin-right: 48px;
}

nav a,
.login {
  color: var(--muted);
  text-decoration: none;
  font-size: 16px;
  background: none;
  border: 0;
  font-family: inherit;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 18px;
}

.join {
  border: 1px solid #d6d4ff55;
  background: #a490e91c;
  color: #f4f3ff;
  padding: 12px 16px;
  border-radius: 5px;
  font: 600 15px "Noto Sans TC";
}

.kicker {
  font: 500 11px "DM Mono", monospace;
  letter-spacing: .17em;
  color: #98a1c2;
  margin: 0 0 20px;
}

.kicker i {
  display: inline-block;
  width: 18px;
  height: 1px;
  background: var(--aqua);
  vertical-align: middle;
  margin: -2px 9px 0 0;
}

.companion-room {
  max-width: 1320px;
  margin: auto;
  padding: clamp(70px, 9vw, 120px) 45px 80px;
  position: relative;
  z-index: 2;
}

.companion-room-copy {
  max-width: 780px;
  margin-bottom: 42px;
}

.companion-room-copy h1 {
  font: 400 clamp(52px, 7vw, 92px)/1.08 "Playfair Display", "Noto Sans TC", serif;
  letter-spacing: -.055em;
  margin: 0;
}

.companion-room-copy h1 em {
  font-style: italic;
  background: linear-gradient(100deg, #d8cbff, #88e4e1);
  -webkit-background-clip: text;
  color: transparent;
}

.companion-room-copy > p:not(.kicker) {
  color: var(--muted);
  font-size: 16px;
  line-height: 1.9;
  max-width: 650px;
}

.gender-tabs {
  display: inline-flex;
  gap: 10px;
  padding: 6px;
  margin-top: 22px;
  border: 1px solid rgb(255 255 255 / 13%);
  border-radius: 999px;
  background: rgb(255 255 255 / 5%);
}

.gender-tab {
  min-width: 92px;
  border: 0;
  border-radius: 999px;
  padding: 11px 20px;
  background: transparent;
  color: #aeb7d7;
  font: 700 16px "Noto Sans TC";
}

.gender-tab.is-active {
  background: linear-gradient(100deg, #b7a2ff, #80ddd9);
  color: #11142b;
}

.selected-companion {
  display: grid;
  grid-template-columns: minmax(330px, 56%) minmax(260px, 44%);
  min-height: 590px;
  border: 1px solid rgb(255 255 255 / 14%);
  background:
    linear-gradient(145deg, rgb(19 25 51 / 86%), rgb(7 10 24 / 92%)),
    radial-gradient(circle at 22% 20%, rgb(126 228 223 / 18%), transparent 34%),
    radial-gradient(circle at 80% 22%, rgb(182 161 255 / 20%), transparent 38%);
  box-shadow: 0 34px 95px rgb(0 0 0 / 36%);
  overflow: hidden;
}

.digital-human-stage {
  position: relative;
  min-height: 590px;
  display: grid;
  place-items: end center;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgb(11 24 62 / 18%), rgb(7 10 24 / 92%)),
    radial-gradient(circle at 50% 18%, rgb(126 228 223 / 28%), transparent 34%),
    linear-gradient(135deg, #101735, #16284d 48%, #070a18);
}

.stage-background {
  position: absolute;
  inset: 0;
  background-position: center;
  background-size: cover;
  opacity: 0;
  transform: scale(1.02);
  transition: opacity .35s ease, transform .6s ease;
}

.digital-human-stage.has-custom-background .stage-background {
  opacity: .82;
  transform: scale(1);
}

.digital-human-stage:before {
  content: "";
  position: absolute;
  inset: 13%;
  border: 1px solid rgb(126 228 223 / 22%);
  border-radius: 48% 52% 45% 55%;
  transform: rotate(-12deg);
  filter: drop-shadow(0 0 32px rgb(126 228 223 / 22%));
}

.digital-human-stage:after {
  content: "";
  position: absolute;
  left: 10%;
  right: 10%;
  bottom: 0;
  height: 36%;
  background: linear-gradient(180deg, transparent, rgb(7 10 24 / 86%));
  pointer-events: none;
}

#selected-companion-image {
  position: relative;
  z-index: 2;
  width: min(86%, 460px);
  max-height: 560px;
  object-fit: contain;
  object-position: bottom center;
  filter: drop-shadow(0 34px 50px rgb(0 0 0 / 52%));
  animation: companionBreath 5.5s ease-in-out infinite;
}

.live2d-mount {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
}

.stage-status {
  position: absolute;
  z-index: 5;
  top: 22px;
  left: 22px;
  padding: 8px 12px;
  border: 1px solid rgb(126 228 223 / 28%);
  background: rgb(7 10 24 / 52%);
  color: #aefaf2;
  font: 10px "DM Mono", monospace;
  letter-spacing: .12em;
  backdrop-filter: blur(12px);
}

.stage-scan {
  position: absolute;
  z-index: 4;
  inset: 0;
  background: repeating-linear-gradient(180deg, rgb(255 255 255 / 0), rgb(255 255 255 / 0) 9px, rgb(126 228 223 / 4%) 10px);
  mix-blend-mode: screen;
  pointer-events: none;
}

.stage-orbit {
  position: absolute;
  z-index: 1;
  width: 72%;
  height: 42%;
  border: 1px solid rgb(182 161 255 / 24%);
  border-radius: 50%;
  transform: rotate(-20deg);
}

.selected-profile {
  padding: clamp(30px, 4vw, 54px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  position: relative;
  z-index: 4;
}

.profile-heading span {
  display: inline-flex;
  color: #8ae6df;
  font-size: 13px;
  letter-spacing: .08em;
  margin-bottom: 12px;
}

.profile-heading h2 {
  margin: 0;
  font: 400 clamp(46px, 6vw, 76px)/1 "Playfair Display", "Noto Sans TC", serif;
  letter-spacing: -.055em;
}

.profile-mood {
  color: #edefff;
  font-size: 21px;
  line-height: 1.7;
  margin: 22px 0 10px;
}

.profile-description {
  color: var(--muted);
  font-size: 17px;
  line-height: 1.9;
  margin: 0 0 26px;
}

.profile-facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 0 0 28px;
}

.profile-facts div {
  padding: 20px 17px;
  border: 1px solid rgb(255 255 255 / 12%);
  background: rgb(255 255 255 / 5%);
}

.profile-facts dt {
  color: #8d96b7;
  font: 700 13px "Noto Sans TC";
  letter-spacing: .12em;
  margin-bottom: 12px;
}

.profile-facts dd {
  margin: 0;
  color: #f2f4ff;
  font-size: 19px;
  font-weight: 800;
  line-height: 1.55;
}

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

.voice-preview,
.choose-companion {
  border: 1px solid rgb(255 255 255 / 18%);
  background: rgb(255 255 255 / 7%);
  color: #f4f5ff;
  min-height: 58px;
  padding: 0 23px;
  font: 800 17px "Noto Sans TC";
  border-radius: 4px;
}

.choose-companion {
  border: 0;
  background: linear-gradient(100deg, #b7a2ff, #80ddd9);
  color: #11142b;
}

#voice-status,
#form-result {
  display: block;
  min-height: 18px;
  margin-top: 15px;
  color: #83e0cb;
  font-size: 16px;
  font-weight: 700;
}

.companion-selector {
  display: flex;
  gap: 12px;
  margin-top: 18px;
  padding-bottom: 10px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.companion-thumb {
  flex: 0 0 116px;
  min-height: 144px;
  border: 1px solid rgb(255 255 255 / 12%);
  background: linear-gradient(180deg, rgb(255 255 255 / 7%), rgb(255 255 255 / 3%));
  color: #f5f6ff;
  padding: 9px;
  text-align: left;
  border-radius: 16px;
  transition: transform .2s ease, border-color .2s ease, background .2s ease;
}

.companion-thumb.is-active {
  border-color: rgb(126 228 223 / 62%);
  background: rgb(126 228 223 / 12%);
  transform: translateY(-3px);
}

.companion-thumb img {
  width: 100%;
  height: 82px;
  object-fit: cover;
  object-position: top center;
  border-radius: 12px;
  background: #10152a;
}

.companion-thumb span,
.companion-thumb small {
  display: block;
}

.companion-thumb span {
  margin-top: 9px;
  font-size: 15px;
  font-weight: 600;
}

.companion-thumb small {
  margin-top: 3px;
  color: #9fa7c7;
  font-size: 11px;
}

footer {
  max-width: 100%;
  margin: 0;
  padding: 27px 45px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #747c9e;
  font: 13px "DM Mono", "Noto Sans TC";
  border-top: 1px solid var(--line);
  background: rgb(7 12 31 / 55%);
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  place-items: center;
  background: #040613c9;
  backdrop-filter: blur(8px);
}

.modal.show {
  display: grid;
}

.modal-box {
  position: relative;
  width: min(460px, 90vw);
  padding: 44px;
  background: #141934;
  border: 1px solid #ffffff22;
  box-shadow: 0 30px 100px #0008;
}

.modal h2 {
  margin: 0;
  font: 400 35px/1.18 "Playfair Display", "Noto Sans TC", serif;
}

.modal-box > p:not(.kicker) {
  font-size: 13px;
  line-height: 1.8;
  color: var(--muted);
}

.close {
  position: absolute;
  right: 16px;
  top: 12px;
  border: 0;
  background: none;
  color: #ced3ed;
  font-size: 27px;
}

form {
  display: flex;
  gap: 8px;
  margin-top: 25px;
}

input {
  flex: 1;
  background: #090d20;
  border: 1px solid #ffffff25;
  color: #fff;
  padding: 12px;
  font: 13px "Noto Sans TC";
}

.cta {
  border: 0;
  border-radius: 3px;
  background: linear-gradient(100deg, #b7a2ff, #80ddd9);
  color: #11142b;
  padding: 12px 16px;
  font: 600 13px "Noto Sans TC";
}

@keyframes companionBreath {
  0%, 100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-8px) scale(1.012);
  }
}

@media (max-width: 980px) {
  .selected-companion {
    grid-template-columns: 1fr;
  }

  .digital-human-stage {
    min-height: 540px;
  }
}

@media (max-width: 760px) {
  .topbar {
    height: 70px;
    padding: 0 21px;
  }

  nav,
  .login {
    display: none;
  }

  .join {
    padding: 8px 10px;
    font-size: 12px;
  }

  .logo-brand img {
    width: 138px;
  }

  .companion-room {
    padding: 58px 24px 56px;
  }

  .selected-companion {
    min-height: 0;
  }

  .digital-human-stage {
    min-height: 455px;
  }

  #selected-companion-image {
    width: min(95%, 390px);
    max-height: 430px;
  }

  .selected-profile {
    padding: 30px 24px 28px;
  }

  .profile-facts {
    grid-template-columns: 1fr;
  }

  .profile-actions,
  form {
    flex-direction: column;
  }

  .voice-preview,
  .choose-companion,
  form .cta {
    width: 100%;
  }

  .companion-thumb {
    flex-basis: 104px;
  }

  footer {
    padding: 25px;
    align-items: flex-start;
    gap: 15px;
    flex-direction: column;
  }
}
