/* Theme aligned with live.xowol.com hints: #27152E, #190B26 */
:root {
  --v-bg-deep: #190b26;
  --v-bg-mid: #27152e;
  --v-accent: #ff4d8d;
  --v-accent2: #b66cff;
  --v-gold: #f0c674;
  --v-ink: rgba(255, 255, 255, 0.92);
  --v-ink2: rgba(255, 255, 255, 0.62);
  --v-line: rgba(255, 255, 255, 0.12);
  --v-glass: rgba(18, 8, 28, 0.55);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
  --host-card-w: 112px;
  --host-card-h: 149px;
  --hosts-rail-h: 186px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

html {
  -ms-text-size-adjust: 100%;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  color: var(--v-ink);
  background: var(--v-bg-deep);
  overflow-x: hidden;
  text-align: center;
}

/* Ensure the HTML `hidden` attribute always wins */
[hidden] {
  display: none !important;
}

#bg-stack {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.bg-layer {
  position: absolute;
  inset: -12%;
  background-size: cover;
  background-position: center;
  transition: opacity 1.1s ease, filter 1.1s ease, transform 12s ease;
  will-change: opacity, filter;
}

.bg-layer-a {
  opacity: 1;
  filter: blur(0px) saturate(1.1);
}

.bg-layer-b {
  opacity: 0;
  filter: blur(18px) saturate(1.35);
}

body.bg-swap .bg-layer-a {
  opacity: 0;
  filter: blur(22px);
}

body.bg-swap .bg-layer-b {
  opacity: 1;
  filter: blur(5px) saturate(1.2);
}

.bg-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse 90% 70% at 50% 40%, transparent 0%, rgba(10, 4, 18, 0.75) 70%, #08030d 100%);
}

/* Gradient presets driven by body[data-mood] */
body[data-mood="sweet"] .bg-layer-a {
  background-image: radial-gradient(circle at 20% 30%, rgba(255, 120, 180, 0.45), transparent 45%),
    radial-gradient(circle at 80% 60%, rgba(120, 90, 220, 0.4), transparent 50%), linear-gradient(160deg, #2a1435 0%, #190b26 55%, #1a0a24 100%);
}
body[data-mood="sweet"] .bg-layer-b {
  background-image: radial-gradient(circle at 70% 20%, rgba(255, 180, 210, 0.5), transparent 40%),
    radial-gradient(circle at 15% 80%, rgba(160, 100, 255, 0.35), transparent 45%), linear-gradient(200deg, #321a40 0%, #1f0f2a 100%);
}

body[data-mood="bold"] .bg-layer-a {
  background-image: radial-gradient(circle at 50% 0%, rgba(255, 60, 120, 0.55), transparent 50%),
    linear-gradient(145deg, #3a0820 0%, #190b26 60%, #12061a 100%);
}
body[data-mood="bold"] .bg-layer-b {
  background-image: radial-gradient(circle at 10% 50%, rgba(255, 50, 100, 0.5), transparent 45%),
    linear-gradient(165deg, #4a1028 0%, #1a0818 100%);
}

body[data-mood="sophisticated"] .bg-layer-a {
  background-image: radial-gradient(circle at 75% 35%, rgba(200, 170, 120, 0.25), transparent 50%),
    linear-gradient(175deg, #1e1228 0%, #140a1c 55%, #0f0614 100%);
}
body[data-mood="sophisticated"] .bg-layer-b {
  background-image: radial-gradient(circle at 30% 70%, rgba(240, 198, 116, 0.2), transparent 45%),
    linear-gradient(190deg, #241830 0%, #120814 100%);
}

body[data-mood="chill"] .bg-layer-a {
  background-image: radial-gradient(circle at 40% 40%, rgba(100, 200, 255, 0.2), transparent 50%),
    linear-gradient(180deg, #1a1428 0%, #190b26 100%);
}
body[data-mood="chill"] .bg-layer-b {
  background-image: radial-gradient(circle at 60% 70%, rgba(80, 160, 255, 0.25), transparent 45%),
    linear-gradient(200deg, #152030 0%, #120818 100%);
}

body[data-mood="heart"] .bg-layer-a {
  background-image: radial-gradient(circle at 50% 45%, rgba(255, 100, 160, 0.35), transparent 55%),
    linear-gradient(160deg, #281020 0%, #190b26 100%);
}
body[data-mood="heart"] .bg-layer-b {
  background-image: radial-gradient(circle at 25% 60%, rgba(255, 130, 180, 0.3), transparent 50%),
    linear-gradient(185deg, #301428 0%, #150810 100%);
}

body[data-mood="learn"] .bg-layer-a {
  background-image: radial-gradient(circle at 80% 80%, rgba(120, 220, 200, 0.2), transparent 50%),
    linear-gradient(170deg, #142028 0%, #190b26 100%);
}
body[data-mood="learn"] .bg-layer-b {
  background-image: radial-gradient(circle at 20% 30%, rgba(100, 200, 255, 0.22), transparent 48%),
    linear-gradient(195deg, #12202a 0%, #0c141a 100%);
}

body[data-mood="global"] .bg-layer-a {
  background-image: radial-gradient(circle at 30% 30%, rgba(100, 140, 255, 0.28), transparent 50%),
    linear-gradient(155deg, #1a1532 0%, #190b26 100%);
}
body[data-mood="global"] .bg-layer-b {
  background-image: radial-gradient(circle at 70% 70%, rgba(180, 100, 255, 0.22), transparent 48%),
    linear-gradient(205deg, #221838 0%, #0f0618 100%);
}

body[data-mood="local"] .bg-layer-a {
  background-image: radial-gradient(circle at 50% 100%, rgba(240, 200, 120, 0.18), transparent 55%),
    linear-gradient(180deg, #201828 0%, #190b26 100%);
}
body[data-mood="local"] .bg-layer-b {
  background-image: radial-gradient(circle at 50% 0%, rgba(255, 220, 160, 0.15), transparent 50%),
    linear-gradient(175deg, #281c20 0%, #120a10 100%);
}

/* Default before first pick */
body:not([data-mood]) .bg-layer-a,
body[data-mood=""] .bg-layer-a {
  background-image: linear-gradient(165deg, #27152e 0%, #190b26 45%, #12061a 100%);
}
body:not([data-mood]) .bg-layer-b,
body[data-mood=""] .bg-layer-b {
  background-image: linear-gradient(195deg, #321a3a 0%, #1a0e22 100%);
}

.panel {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 440px;
  margin-left: auto;
  margin-right: auto;
  min-height: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  padding-bottom: calc(var(--hosts-rail-h) + 16px);
  padding-bottom: calc(var(--hosts-rail-h) + constant(safe-area-inset-bottom) + 16px);
  padding-bottom: calc(var(--hosts-rail-h) + env(safe-area-inset-bottom, 0px) + 16px);
  text-align: center;
  box-sizing: border-box;
}

/* Live hosts rail */
.hosts-rail {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  max-height: 42vh;
  padding-bottom: constant(safe-area-inset-bottom);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: linear-gradient(180deg, transparent 0%, rgba(8, 3, 15, 0.88) 28%, rgba(8, 3, 15, 0.96) 100%);
  border-top: 1px solid var(--v-line);
  pointer-events: auto;
  opacity: 0.85;
  transition: opacity 0.35s ease;
}

body.phase-quiz .hosts-rail {
  opacity: 1;
}

@supports selector(:has(*)) {
  body:has(#quiz:not([hidden])) .hosts-rail {
    opacity: 1;
  }
}

.hosts-rail__head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 520px;
  padding: 10px 16px 6px;
  box-sizing: border-box;
  text-align: left;
}

.hosts-rail__live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--v-accent);
  box-shadow: 0 0 10px rgba(255, 77, 141, 0.65);
  animation: livePulse 1.4s ease-in-out infinite;
}

@keyframes livePulse {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
  }
  50% {
    opacity: 0.65;
    transform: scale(0.88);
  }
}

.hosts-rail__title {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.hosts-rail__count {
  margin-left: auto;
  font-size: 12px;
  color: var(--v-ink2);
  font-variant-numeric: tabular-nums;
}

.hosts-rail__scroll {
  width: 100%;
  max-width: 100%;
  padding: 4px 0 14px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x proximity;
  -webkit-overflow-scrolling: touch;
  -ms-overflow-style: none;
  scrollbar-width: none;
  text-align: center;
}

.hosts-rail__scroll::-webkit-scrollbar {
  width: 0;
  height: 0;
  display: none;
}

.hosts-rail__track {
  display: inline-flex;
  gap: 14px;
  padding: 0 16px;
  vertical-align: top;
  text-align: left;
}

.host-card {
  flex: 0 0 auto;
  width: var(--host-card-w);
  scroll-snap-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.host-card__frame {
  position: relative;
  width: var(--host-card-w);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 0 0 2px rgba(255, 77, 141, 0.55), 0 10px 28px rgba(0, 0, 0, 0.45);
}

.host-card__avatar {
  display: block;
  width: var(--host-card-w);
  height: var(--host-card-h);
  object-fit: cover;
  border-radius: 16px;
  background: var(--v-bg-mid);
}

@supports (aspect-ratio: 3 / 4) {
  .host-card__avatar {
    height: auto;
    aspect-ratio: 3 / 4;
  }
}

.host-card__badge {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 3px 7px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: #fff;
  background: var(--v-accent);
  line-height: 1.2;
}

.host-card__name {
  width: 100%;
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.host-card__meta {
  width: 100%;
  font-size: 12px;
  color: var(--v-ink2);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Boot */
.boot {
  text-align: center;
}

.boot__logo {
  border-radius: 22%;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
}

.boot__title {
  margin: 16px 0 4px;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.boot__sub {
  margin: 0 0 28px;
  font-size: 14px;
  color: var(--v-ink2);
}

.boot__track {
  width: min(320px, 88vw);
  height: 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.boot__fill {
  height: 100%;
  width: 0%;
  border-radius: 6px;
  background: linear-gradient(90deg, var(--v-accent2), var(--v-accent), var(--v-gold));
  transition: width 0.12s linear;
}

.boot__hint {
  margin-top: 18px;
  font-size: 13px;
  color: var(--v-ink2);
}

/* Quiz */
.quiz {
  max-width: 440px;
}

.quiz__top {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  margin-bottom: 28px;
  text-align: left;
}

.quiz__ico {
  border-radius: 20%;
}

.quiz__brand {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
}

.quiz__head {
  font-size: 20px;
  font-weight: 650;
  line-height: 1.35;
  margin: 0 0 8px;
  text-align: center;
}

.quiz__step {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--v-gold);
  text-align: center;
  margin: 0 0 20px;
}

.quiz__chips {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 10px;
  width: 100%;
  text-align: left;
}

.chip {
  display: block;
  width: 100%;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid var(--v-line);
  background: rgba(18, 8, 28, 0.88);
  color: var(--v-ink);
  font-size: 15px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .chip {
    background: var(--v-glass);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
  }
}

.chip:hover {
  border-color: rgba(255, 77, 141, 0.45);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  transform: translateY(-1px);
}

.chip:active {
  transform: scale(0.99);
}

.quiz__matchline {
  min-height: 22px;
  margin-top: 18px;
  font-size: 13px;
  color: var(--v-ink2);
  text-align: center;
}

/* Match overlay */
.match {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 3, 15, 0.92);
}

@supports ((-webkit-backdrop-filter: blur(1px)) or (backdrop-filter: blur(1px))) {
  .match {
    background: rgba(8, 3, 15, 0.88);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
  }
}

.match__grid {
  position: absolute;
  inset: 0;
  background-image: linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  opacity: 0.5;
  animation: drift 22s linear infinite;
}

@keyframes drift {
  from {
    transform: translateY(0);
  }
  to {
    transform: translateY(-48px);
  }
}

.match__scan {
  position: absolute;
  inset: -20% -10%;
  background: linear-gradient(
    transparent 0%,
    rgba(182, 108, 255, 0.07) 45%,
    rgba(255, 77, 141, 0.12) 50%,
    rgba(182, 108, 255, 0.07) 55%,
    transparent 100%
  );
  background-size: 100% 180%;
  animation: scanMove 3.8s ease-in-out infinite;
  pointer-events: none;
}

@keyframes scanMove {
  0%,
  100% {
    transform: translateY(-12%);
  }
  50% {
    transform: translateY(12%);
  }
}

.match__panel {
  position: relative;
  text-align: center;
  padding: 32px 28px;
  max-width: min(380px, 92vw);
  border-radius: 20px;
  border: 1px solid var(--v-line);
  background: rgba(25, 11, 38, 0.75);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.55);
}

.match__pulse {
  width: 72px;
  height: 72px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 77, 141, 0.5), transparent 70%);
  animation: pulse 1.6s ease-in-out infinite;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.9;
  }
  50% {
    transform: scale(1.12);
    opacity: 1;
  }
}

.match__status {
  margin: 0 0 20px;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.45;
}

.match__bar {
  height: 4px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.match__barfill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--v-accent2), var(--v-accent));
  animation: fillBar var(--fill-dur, 8s) linear forwards;
}

@keyframes fillBar {
  to {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .bg-layer,
  .match__grid,
  .match__scan,
  .match__pulse,
  .hosts-rail__live-dot {
    animation: none !important;
    transition: none !important;
  }

  .hosts-rail {
    transition: none;
  }
}
