:root {
  --bg: #0a0e1a;
  --card: #141a2e;
  --card-2: #1a2138;
  --text: #e8ecf5;
  --muted: #8b95ad;
  --line: rgba(255, 255, 255, 0.08);
  --pole-a: #3b82f6; /* blue pole */
  --pole-a-2: #22d3ee;
  --pole-b: #f43f5e; /* red pole */
  --pole-b-2: #fb923c;
  --radius: 18px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.45);
}

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

/* The `hidden` attribute must always win. Several elements here set an explicit
   `display` (e.g. the connecting overlay and the chat screen use `display:flex`),
   which would otherwise override `[hidden]` and leave them stuck on screen. */
[hidden] {
  display: none !important;
}

/* ===== 18+ age gate / waiver ===== */
.gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(5, 7, 15, 0.85);
  backdrop-filter: blur(10px);
  overflow-y: auto;
}
html[data-agreed="1"] .gate {
  display: none !important;
}
.gate-card {
  background: linear-gradient(180deg, #141a2e, #1a2138);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  max-width: 480px;
  width: 100%;
  padding: 32px 28px;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  margin: auto;
}
.gate-bear {
  width: 56px;
  height: 56px;
  display: block;
  margin: 0 auto 6px;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
}
.gate-card h2 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.gate-lead {
  color: #8b95ad;
  margin: 10px 0 18px;
  font-size: 15px;
}
.gate-terms {
  text-align: left;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}
.gate-terms li {
  position: relative;
  padding-left: 20px;
  font-size: 13.5px;
  line-height: 1.45;
  color: #c3cbe0;
}
.gate-terms li::before {
  content: "•";
  position: absolute;
  left: 4px;
  color: #22d3ee;
}
.gate-terms strong {
  color: #e8ecf5;
}
.gate-check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
  font-size: 13.5px;
  line-height: 1.4;
  color: #c3cbe0;
  margin-bottom: 12px;
  cursor: pointer;
}
.gate-check input {
  margin-top: 2px;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: #3b82f6;
  cursor: pointer;
}
.gate-enter {
  width: 100%;
  margin-top: 8px;
  padding: 13px;
  font-size: 16px;
}
.gate-enter:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: grayscale(0.3);
}
.gate-leave {
  display: inline-block;
  margin-top: 14px;
  color: #8b95ad;
  font-size: 13px;
  text-decoration: none;
}
.gate-leave:hover {
  color: #e8ecf5;
}
.gate-fine {
  color: #8b95ad;
  font-size: 11.5px;
  margin-top: 16px;
  opacity: 0.85;
}

html,
body {
  height: 100%;
}
body {
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica,
    Arial, sans-serif;
  background: radial-gradient(
      1200px 800px at 18% -10%,
      rgba(59, 130, 246, 0.12),
      transparent 60%
    ),
    radial-gradient(
      1000px 700px at 100% 110%,
      rgba(244, 63, 94, 0.12),
      transparent 55%
    ),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* floating poles */
.orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.5;
  z-index: 0;
  pointer-events: none;
  animation: float 18s ease-in-out infinite;
}
.orb-a {
  width: 420px;
  height: 420px;
  background: radial-gradient(circle, var(--pole-a), transparent 70%);
  top: -120px;
  left: -100px;
}
.orb-b {
  width: 480px;
  height: 480px;
  background: radial-gradient(circle, var(--pole-b), transparent 70%);
  bottom: -160px;
  right: -120px;
  animation-delay: -9s;
}
@keyframes float {
  0%,
  100% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(40px, 30px);
  }
}

.topbar {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 28px;
}
.brand {
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-bear {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.4));
}
.logo {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
}
.logo-accent {
  background: linear-gradient(90deg, var(--pole-a-2), var(--pole-b));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.status {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--muted);
  font-size: 14px;
}
.dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 10px #22c55e;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.4;
  }
}

main {
  position: relative;
  z-index: 1;
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 40px;
}
.screen {
  animation: fade 0.4s ease;
}
@keyframes fade {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* hero */
.hero {
  text-align: center;
  margin: 30px 0 38px;
}
.hero h1 {
  font-size: clamp(34px, 6vw, 56px);
  font-weight: 800;
  letter-spacing: -1.5px;
  line-height: 1.05;
}
.grad {
  background: linear-gradient(90deg, var(--pole-a-2), var(--pole-b));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero p {
  color: var(--muted);
  max-width: 600px;
  margin: 16px auto 0;
  font-size: 17px;
  line-height: 1.6;
}
.hero strong {
  color: var(--text);
}

/* topics grid */
.topics {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}
.topic-card {
  text-align: left;
  background: linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  color: var(--text);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.topic-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.18);
  box-shadow: var(--shadow);
}
.topic-emoji {
  font-size: 30px;
}
.topic-title {
  font-size: 17px;
  font-weight: 650;
  line-height: 1.3;
}
.topic-sides {
  color: var(--muted);
  font-size: 13px;
}
.topic-sides em {
  color: #c3cbe0;
  font-style: normal;
  font-weight: 600;
}

/* side select */
.back {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
  margin-bottom: 16px;
}
.back:hover {
  color: var(--text);
}
.side-title {
  font-size: 26px;
  font-weight: 750;
  text-align: center;
  line-height: 1.25;
  max-width: 680px;
  margin: 10px auto 0;
}
.side-sub {
  text-align: center;
  color: var(--muted);
  margin: 8px 0 26px;
}
.sides {
  display: flex;
  align-items: stretch;
  gap: 14px;
  justify-content: center;
  flex-wrap: wrap;
}
.side-card {
  flex: 1;
  min-width: 240px;
  max-width: 340px;
  min-height: 200px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  cursor: pointer;
  color: var(--text);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 28px;
  transition: transform 0.18s, box-shadow 0.18s, filter 0.18s;
}
.side-a {
  background: linear-gradient(
    160deg,
    rgba(59, 130, 246, 0.18),
    rgba(34, 211, 238, 0.08)
  );
  border-color: rgba(59, 130, 246, 0.4);
}
.side-b {
  background: linear-gradient(
    160deg,
    rgba(244, 63, 94, 0.18),
    rgba(251, 146, 60, 0.08)
  );
  border-color: rgba(244, 63, 94, 0.4);
}
.side-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow);
  filter: brightness(1.12);
}
.side-label {
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--muted);
}
.side-name {
  font-size: 22px;
  font-weight: 750;
  text-align: center;
}
.vs {
  display: flex;
  align-items: center;
  font-weight: 800;
  color: var(--muted);
}
.cam-note {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin-top: 26px;
}

/* today's topic card */
.today {
  background: linear-gradient(180deg, var(--card), var(--card-2));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 24px 24px;
  text-align: center;
  max-width: 760px;
  margin: 0 auto;
}
.today-tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #fda4af;
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.3);
  padding: 5px 12px;
  border-radius: 999px;
  margin-bottom: 16px;
}
.today-q {
  font-size: clamp(22px, 3.4vw, 30px);
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.5px;
  max-width: 620px;
  margin: 0 auto;
}
.today-sub {
  color: var(--muted);
  margin: 12px auto 22px;
  font-size: 15px;
  max-width: 460px;
}

/* tomorrow's topic forum */
.forum {
  max-width: 760px;
  margin: 34px auto 0;
}
.forum-head {
  text-align: center;
  margin-bottom: 18px;
}
.forum-head h3 {
  font-size: 20px;
  font-weight: 750;
}
.forum-sub {
  color: var(--muted);
  font-size: 14px;
  margin: 6px auto 0;
  max-width: 480px;
}
.suggest {
  display: flex;
  gap: 10px;
}
.suggest input {
  flex: 1;
  min-width: 0;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 16px;
  color: var(--text);
  font-size: 15px;
  outline: none;
}
.suggest input:focus {
  border-color: rgba(59, 130, 246, 0.5);
}
.suggest-error {
  color: #fda4af;
  font-size: 13px;
  margin: 8px 2px 0;
}
.suggestions {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}
.suggestion {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
}
.vote {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-width: 50px;
  padding: 6px 8px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--card-2);
  color: var(--muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  line-height: 1.1;
}
.vote:hover {
  border-color: rgba(59, 130, 246, 0.5);
  color: var(--text);
}
.vote.voted {
  background: rgba(59, 130, 246, 0.18);
  border-color: rgba(59, 130, 246, 0.55);
  color: #bfdbfe;
}
.vote-arrow {
  font-size: 11px;
}
.vote-count {
  font-size: 15px;
  font-weight: 700;
}
.suggestion-title {
  flex: 1;
  font-size: 15px;
  line-height: 1.35;
}
.flag {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
  opacity: 0.5;
  transition: opacity 0.15s, color 0.15s;
  padding: 6px;
}
.flag:hover {
  opacity: 1;
  color: var(--pole-b);
}
.suggestions-empty {
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  padding: 16px;
}

/* search */
#screen-search {
  text-align: center;
  padding-top: 36px;
}
.search-preview-wrap {
  position: relative;
  width: 240px;
  height: 180px;
  margin: 0 auto 26px;
}
.search-preview {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: var(--radius);
  background: #000;
  border: 1px solid var(--line);
  transform: scaleX(-1); /* mirror, like a selfie cam */
}
.radar {
  position: absolute;
  inset: -30px;
  pointer-events: none;
}
.radar span {
  position: absolute;
  inset: 0;
  border-radius: var(--radius);
  border: 2px solid var(--pole-a);
  opacity: 0;
  animation: radar 2.4s ease-out infinite;
}
.radar span:nth-child(2) {
  animation-delay: 0.8s;
  border-color: var(--pole-b);
}
.radar span:nth-child(3) {
  animation-delay: 1.6s;
  border-color: var(--pole-a-2);
}
@keyframes radar {
  0% {
    transform: scale(0.85);
    opacity: 0.9;
  }
  100% {
    transform: scale(1.15);
    opacity: 0;
  }
}
#screen-search h2 {
  font-size: 24px;
  font-weight: 700;
}
.muted {
  color: var(--muted);
  margin: 12px 0 26px;
}

/* buttons */
.btn {
  background: linear-gradient(90deg, var(--pole-a), var(--pole-b));
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 11px 18px;
  font-size: 15px;
  font-weight: 650;
  cursor: pointer;
  transition: filter 0.15s, transform 0.1s;
}
.btn:hover {
  filter: brightness(1.1);
}
.btn:active {
  transform: scale(0.97);
}
.btn.ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
}
.btn.danger {
  background: transparent;
  border: 1px solid rgba(244, 63, 94, 0.5);
  color: #fda4af;
}
.btn.danger:hover {
  background: rgba(244, 63, 94, 0.12);
  filter: none;
}

/* ===== VIDEO CHAT ===== */
.chat {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 110px);
  gap: 14px;
}
.stage-wrap {
  display: flex;
  gap: 14px;
  flex: 1;
  min-height: 0;
}
.stage {
  position: relative;
  flex: 1;
  min-width: 0;
  background: #05070f;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
#remote-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #05070f;
}
.pip {
  position: absolute;
  right: 14px;
  bottom: 14px;
  width: 168px;
  max-width: 36%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border-radius: 12px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  background: #000;
  box-shadow: var(--shadow);
  transform: scaleX(-1); /* mirror your own preview */
  z-index: 3;
}
.matchup.floating {
  position: absolute;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  background: rgba(5, 7, 15, 0.6);
  backdrop-filter: blur(8px);
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
}
.matchup {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
}
.badge {
  padding: 5px 11px;
  border-radius: 999px;
  font-weight: 650;
  font-size: 12.5px;
  white-space: nowrap;
}
.badge.you {
  background: rgba(59, 130, 246, 0.25);
  color: #bfdbfe;
  border: 1px solid rgba(59, 130, 246, 0.5);
}
.badge.them {
  background: rgba(244, 63, 94, 0.25);
  color: #fecdd3;
  border: 1px solid rgba(244, 63, 94, 0.5);
}
.badge-vs {
  color: var(--muted);
  font-weight: 700;
}

/* connecting overlay */
.remote-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--muted);
  background: radial-gradient(circle at center, #0b1020, #05070f);
}
.spinner {
  width: 46px;
  height: 46px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, 0.12);
  border-top-color: var(--pole-a-2);
  border-right-color: var(--pole-b);
  animation: spin 0.9s linear infinite;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* "Tap for sound" button (shown when mobile blocks autoplay-with-audio) */
.unmute-btn {
  position: absolute;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 4;
  background: rgba(5, 7, 15, 0.74);
  backdrop-filter: blur(8px);
  border: 1px solid var(--line);
  color: #fff;
  font-size: 14px;
  font-weight: 650;
  padding: 11px 20px;
  border-radius: 999px;
  cursor: pointer;
  box-shadow: var(--shadow);
  animation: pulse 2s infinite;
}
.unmute-btn:hover {
  background: rgba(5, 7, 15, 0.92);
}
.remote-overlay {
  cursor: pointer;
}

/* text chat panel */
.chatpanel {
  width: 320px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}
.chatpanel.collapsed {
  display: none;
}
.panel-title {
  padding: 12px 16px;
  font-weight: 700;
  font-size: 14px;
  border-bottom: 1px solid var(--line);
}
.messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
}
.msg {
  max-width: 85%;
  padding: 9px 13px;
  border-radius: 14px;
  line-height: 1.4;
  font-size: 14px;
  word-wrap: break-word;
  white-space: pre-wrap;
}
.msg.you {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--pole-a), #2563eb);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.msg.them {
  align-self: flex-start;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}
.msg.system {
  align-self: center;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  text-align: center;
  max-width: 95%;
}
.typing {
  color: var(--muted);
  font-size: 12.5px;
  padding: 2px 14px 6px;
  font-style: italic;
}
.composer {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--line);
}
.composer input {
  flex: 1;
  min-width: 0;
  background: var(--card-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 11px 13px;
  color: var(--text);
  font-size: 14px;
  outline: none;
}
.composer input:focus {
  border-color: rgba(59, 130, 246, 0.5);
}

/* controls bar */
.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}
.ctrl {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  font-size: 20px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: filter 0.15s, transform 0.1s, background 0.15s;
}
.ctrl:hover {
  filter: brightness(1.2);
}
.ctrl:active {
  transform: scale(0.94);
}
.ctrl.off {
  background: rgba(244, 63, 94, 0.2);
  border-color: rgba(244, 63, 94, 0.5);
}

@media (max-width: 859px) {
  .chat {
    height: calc(100vh - 96px);
  }
  .stage-wrap {
    position: relative;
  }
  .chatpanel {
    position: absolute;
    inset: auto 0 0 0;
    width: 100%;
    height: 58%;
    z-index: 5;
    border-radius: var(--radius) var(--radius) 0 0;
  }
  .pip {
    width: 110px;
  }
}
@media (max-width: 540px) {
  .topbar {
    padding: 16px;
  }
  main {
    padding: 14px 12px 30px;
  }
}
